;--------------------------------------------------------
; File Created by SDCC : FreeWare ANSI-C Compiler
; Version 2.6.1 #4330 (Oct 18 2006)
; This file generated Wed Oct 18 23:31:20 2006
;--------------------------------------------------------
	.module calloc
	.optsdcc -mhc08
	
	.area HOME (CODE)
	.area GSINIT0 (CODE)
	.area GSINIT (CODE)
	.area GSFINAL (CODE)
	.area CSEG (CODE)
	.area XINIT
	.area CONST   (CODE)
	.area DSEG
	.area OSEG    (OVR)
	.area BSEG
	.area XSEG
	.area XISEG
;--------------------------------------------------------
; Public variables in this module
;--------------------------------------------------------
	.globl _calloc_PARM_2
	.globl _calloc
;--------------------------------------------------------
;  ram data
;--------------------------------------------------------
	.area DSEG
;--------------------------------------------------------
; overlayable items in  ram 
;--------------------------------------------------------
	.area OSEG    (OVR)
;--------------------------------------------------------
; external initialized ram data
;--------------------------------------------------------
	.area XISEG
;--------------------------------------------------------
; extended address mode data
;--------------------------------------------------------
	.area XSEG
_calloc_PARM_2:
	.ds 2
_calloc_nmemb_1_1:
	.ds 2
_calloc_ptr_1_1:
	.ds 2
;--------------------------------------------------------
; global & static initialisations
;--------------------------------------------------------
	.area HOME (CODE)
	.area GSINIT (CODE)
	.area GSFINAL (CODE)
	.area GSINIT (CODE)
;--------------------------------------------------------
; Home
;--------------------------------------------------------
	.area HOME (CODE)
	.area CSEG (CODE)
;--------------------------------------------------------
; code
;--------------------------------------------------------
	.area CSEG (CODE)
;------------------------------------------------------------
;Allocation info for local variables in function 'calloc'
;------------------------------------------------------------
;size                      Allocated with name '_calloc_PARM_2'
;nmemb                     Allocated with name '_calloc_nmemb_1_1'
;ptr                       Allocated with name '_calloc_ptr_1_1'
;------------------------------------------------------------
;calloc.c:53: void xdata * calloc (size_t nmemb, size_t size)
;	-----------------------------------------
;	 function calloc
;	-----------------------------------------
_calloc:
;     genReceive
;     loadRegFromAop (a, REG(-,-,-,a), 0)
; transferRegReg(a,a)
;     storeRegToAop (a, EXT(_calloc_nmemb_1_1), 0), stacked=0, isaddr=0
	sta	(_calloc_nmemb_1_1 + 1)
;     loadRegFromAop (x, REG(-,-,-,x), 0)
; transferRegReg(x,x)
;     storeRegToAop (x, EXT(_calloc_nmemb_1_1), 1), stacked=0, isaddr=0
	stx	_calloc_nmemb_1_1
;calloc.c:57: ptr = malloc(nmemb * size);
;     genAssign
;     loadRegFromAop (a, EXT(_calloc_PARM_2), 1)
	lda	_calloc_PARM_2
;     storeRegToAop (a, EXT(__mulint_PARM_2), 1), stacked=0, isaddr=1
	sta	__mulint_PARM_2
;     loadRegFromAop (a, EXT(_calloc_PARM_2), 0)
	lda	(_calloc_PARM_2 + 1)
;     storeRegToAop (a, EXT(__mulint_PARM_2), 0), stacked=0, isaddr=1
	sta	(__mulint_PARM_2 + 1)
;     genCall
;     loadRegFromAop (x, EXT(_calloc_nmemb_1_1), 1)
	ldx	_calloc_nmemb_1_1
;     storeRegToAop (x, REG(-,-,-,x), 0), stacked=0, isaddr=0
; transferRegReg(x,x)
;     loadRegFromAop (a, EXT(_calloc_nmemb_1_1), 0)
	lda	(_calloc_nmemb_1_1 + 1)
;     storeRegToAop (a, REG(-,-,-,a), 0), stacked=0, isaddr=0
; transferRegReg(a,a)
	jsr	__mulint
;     loadRegFromAop (a, REG(-,-,-,a), 0)
; transferRegReg(a,a)
;     storeRegToAop (a, REG(-,-,x,a), 0), stacked=0, isaddr=0
; transferRegReg(a,a)
;     loadRegFromAop (x, REG(-,-,-,x), 0)
; transferRegReg(x,x)
;     storeRegToAop (x, REG(-,-,x,a), 1), stacked=0, isaddr=0
; transferRegReg(x,x)
; forgot to free a
;     genCall
;     loadRegFromAop (x, REG(-,-,x,a), 1)
; transferRegReg(x,x)
;     storeRegToAop (x, REG(-,-,-,x), 0), stacked=0, isaddr=0
; transferRegReg(x,x)
;     loadRegFromAop (a, REG(-,-,x,a), 0)
; transferRegReg(a,a)
;     storeRegToAop (a, REG(-,-,-,a), 0), stacked=0, isaddr=0
; transferRegReg(a,a)
	jsr	_malloc
;     loadRegFromAop (a, REG(-,-,-,a), 0)
; transferRegReg(a,a)
;     storeRegToAop (a, EXT(_calloc_ptr_1_1), 0), stacked=0, isaddr=0
	sta	(_calloc_ptr_1_1 + 1)
;     loadRegFromAop (x, REG(-,-,-,x), 0)
; transferRegReg(x,x)
;     storeRegToAop (x, EXT(_calloc_ptr_1_1), 1), stacked=0, isaddr=0
	stx	_calloc_ptr_1_1
;calloc.c:58: if (ptr)
;     genIfx
;     loadRegFromAop (a, EXT(_calloc_ptr_1_1), 0)
	lda	(_calloc_ptr_1_1 + 1)
	ora	_calloc_ptr_1_1
;     genIfxJump
; Peephole 2d	- eliminated jmp
	beq	00102$
00106$:
;calloc.c:60: memset(ptr, 0, nmemb * size);
;     genAssign
;     loadRegFromAop (a, EXT(_calloc_PARM_2), 1)
	lda	_calloc_PARM_2
;     storeRegToAop (a, EXT(__mulint_PARM_2), 1), stacked=0, isaddr=1
	sta	__mulint_PARM_2
;     loadRegFromAop (a, EXT(_calloc_PARM_2), 0)
	lda	(_calloc_PARM_2 + 1)
;     storeRegToAop (a, EXT(__mulint_PARM_2), 0), stacked=0, isaddr=1
	sta	(__mulint_PARM_2 + 1)
;     genCall
;     loadRegFromAop (x, EXT(_calloc_nmemb_1_1), 1)
	ldx	_calloc_nmemb_1_1
;     storeRegToAop (x, REG(-,-,-,x), 0), stacked=0, isaddr=0
; transferRegReg(x,x)
;     loadRegFromAop (a, EXT(_calloc_nmemb_1_1), 0)
	lda	(_calloc_nmemb_1_1 + 1)
;     storeRegToAop (a, REG(-,-,-,a), 0), stacked=0, isaddr=0
; transferRegReg(a,a)
	jsr	__mulint
;     loadRegFromAop (a, REG(-,-,-,a), 0)
; transferRegReg(a,a)
;     storeRegToAop (a, EXT(_memset_PARM_3), 0), stacked=0, isaddr=1
	sta	(_memset_PARM_3 + 1)
;     loadRegFromAop (x, REG(-,-,-,x), 0)
; transferRegReg(x,x)
;     storeRegToAop (x, EXT(_memset_PARM_3), 1), stacked=0, isaddr=1
	stx	_memset_PARM_3
;     genAssign
;     loadRegFromAop (a, LIT(#0x00), 0)
	clra
;     storeRegToAop (a, EXT(_memset_PARM_2), 0), stacked=0, isaddr=1
	sta	_memset_PARM_2
;     genCall
;     loadRegFromAop (x, EXT(_calloc_ptr_1_1), 1)
	ldx	_calloc_ptr_1_1
;     storeRegToAop (x, REG(-,-,-,x), 0), stacked=0, isaddr=0
; transferRegReg(x,x)
;     loadRegFromAop (a, EXT(_calloc_ptr_1_1), 0)
	lda	(_calloc_ptr_1_1 + 1)
;     storeRegToAop (a, REG(-,-,-,a), 0), stacked=0, isaddr=0
; transferRegReg(a,a)
	jsr	_memset
00102$:
;calloc.c:62: return ptr;
;     genRet
;     loadRegFromAop (x, EXT(_calloc_ptr_1_1), 1)
	ldx	_calloc_ptr_1_1
;     storeRegToAop (x, REG(-,-,-,x), 0), stacked=0, isaddr=0
; transferRegReg(x,x)
;     loadRegFromAop (a, EXT(_calloc_ptr_1_1), 0)
	lda	(_calloc_ptr_1_1 + 1)
;     storeRegToAop (a, REG(-,-,-,a), 0), stacked=0, isaddr=0
; transferRegReg(a,a)
00103$:
	rts
	.area CSEG (CODE)
	.area CONST   (CODE)
	.area XINIT
