;--------------------------------------------------------
; File Created by SDCC : FreeWare ANSI-C Compiler
; Version 2.6.1 #4330 (Oct 18 2006)
; This file generated Wed Oct 18 23:31:02 2006
;--------------------------------------------------------
	.module _atoi
	.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 _atoi
;--------------------------------------------------------
;  ram data
;--------------------------------------------------------
	.area DSEG
_atoi_rv_1_1:
	.ds 2
_atoi_sign_1_1:
	.ds 1
_atoi_sloc0_1_0:
	.ds 2
_atoi_sloc1_1_0:
	.ds 2
_atoi_sloc2_1_0:
	.ds 2
;--------------------------------------------------------
; overlayable items in  ram 
;--------------------------------------------------------
	.area OSEG    (OVR)
;--------------------------------------------------------
; external initialized ram data
;--------------------------------------------------------
	.area XISEG
;--------------------------------------------------------
; extended address mode data
;--------------------------------------------------------
	.area XSEG
_atoi_s_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 'atoi'
;------------------------------------------------------------
;rv                        Allocated with name '_atoi_rv_1_1'
;sign                      Allocated with name '_atoi_sign_1_1'
;sloc0                     Allocated with name '_atoi_sloc0_1_0'
;sloc1                     Allocated with name '_atoi_sloc1_1_0'
;sloc2                     Allocated with name '_atoi_sloc2_1_0'
;s                         Allocated with name '_atoi_s_1_1'
;------------------------------------------------------------
;_atoi.c:25: int atoi(char * s)
;	-----------------------------------------
;	 function atoi
;	-----------------------------------------
_atoi:
;     genReceive
;     loadRegFromAop (a, REG(-,-,-,a), 0)
; transferRegReg(a,a)
;     storeRegToAop (a, EXT(_atoi_s_1_1), 0), stacked=0, isaddr=0
	sta	(_atoi_s_1_1 + 1)
;     loadRegFromAop (x, REG(-,-,-,x), 0)
; transferRegReg(x,x)
;     storeRegToAop (x, EXT(_atoi_s_1_1), 1), stacked=0, isaddr=0
	stx	_atoi_s_1_1
;_atoi.c:27: register int rv=0; 
;     genAssign
	clr	*_atoi_rv_1_1
	clr	*(_atoi_rv_1_1 + 1)
;_atoi.c:31: while (*s) {
;     genAssign
;     loadRegFromAop (a, EXT(_atoi_s_1_1), 1)
	lda	_atoi_s_1_1
;     storeRegToAop (a, DIR(_atoi_sloc0_1_0), 1), stacked=0, isaddr=0
	sta	*_atoi_sloc0_1_0
;     loadRegFromAop (a, EXT(_atoi_s_1_1), 0)
	lda	(_atoi_s_1_1 + 1)
;     storeRegToAop (a, DIR(_atoi_sloc0_1_0), 0), stacked=0, isaddr=0
	sta	*(_atoi_sloc0_1_0 + 1)
00107$:
;     genPointerGet
;     loadRegFromAop (hx, DIR(_atoi_sloc0_1_0), 0)
	ldhx	*_atoi_sloc0_1_0
	lda	,x
;     genIfxJump
; Peephole 2d	- eliminated jmp
	beq	00133$
00135$:
;_atoi.c:32: if (*s <= '9' && *s >= '0')
;     genPointerGet
;     loadRegFromAop (hx, DIR(_atoi_sloc0_1_0), 0)
	ldhx	*_atoi_sloc0_1_0
	lda	,x
;     storeRegToAop (a, REG(-,-,x,a), 0), stacked=0, isaddr=0
; transferRegReg(a,a)
;     genCmp	(>)
;     loadRegFromAop (a, REG(-,-,x,a), 0)
; transferRegReg(a,a)
	cmp	#0x39
; Peephole 2i	- eliminated bra
	bgt	00102$
00136$:
;     genPointerGet
;     loadRegFromAop (hx, DIR(_atoi_sloc0_1_0), 0)
	ldhx	*_atoi_sloc0_1_0
	lda	,x
;     storeRegToAop (a, REG(-,-,x,a), 0), stacked=0, isaddr=0
; transferRegReg(a,a)
;     genCmp	(<)
;     loadRegFromAop (a, REG(-,-,x,a), 0)
; transferRegReg(a,a)
	cmp	#0x30
; Peephole 2l	- eliminated bra
	bge	00133$
00137$:
;_atoi.c:33: break;
00102$:
;_atoi.c:34: if (*s == '-' || *s == '+') 
;     genPointerGet
;     loadRegFromAop (hx, DIR(_atoi_sloc0_1_0), 0)
	ldhx	*_atoi_sloc0_1_0
	lda	,x
;     storeRegToAop (a, REG(-,-,x,a), 0), stacked=0, isaddr=0
; transferRegReg(a,a)
;     genCmpEQorNE	(==)
;     loadRegFromAop (a, REG(-,-,x,a), 0)
; transferRegReg(a,a)
	cmp	#0x2D
; Peephole 2d	- eliminated jmp
	beq	00133$
00138$:
;     genPointerGet
;     loadRegFromAop (hx, DIR(_atoi_sloc0_1_0), 0)
	ldhx	*_atoi_sloc0_1_0
	lda	,x
;     storeRegToAop (a, REG(-,-,x,a), 0), stacked=0, isaddr=0
; transferRegReg(a,a)
;     genCmpEQorNE	(==)
;     loadRegFromAop (a, REG(-,-,x,a), 0)
; transferRegReg(a,a)
	cmp	#0x2B
; Peephole 2d	- eliminated jmp
	beq	00133$
00139$:
;_atoi.c:36: s++;
; checking lic
; checking IS_ITEMP
; pset=0, pget=0
;     genPlus
; IS_AOP_HX = 0
;     loadRegFromAop (hx, DIR(_atoi_sloc0_1_0), 0)
	ldhx	*_atoi_sloc0_1_0
	aix	#1
;     storeRegToAop (hx, DIR(_atoi_sloc0_1_0), 0), stacked=0, isaddr=0
	sthx	*_atoi_sloc0_1_0
; Peephole 3	- shortened jmp to bra
	bra	00107$
00133$:
;     genAssign
;     loadRegFromAop (a, DIR(_atoi_sloc0_1_0), 1)
	lda	*_atoi_sloc0_1_0
;     storeRegToAop (a, EXT(_atoi_s_1_1), 1), stacked=0, isaddr=0
	sta	_atoi_s_1_1
;     loadRegFromAop (a, DIR(_atoi_sloc0_1_0), 0)
	lda	*(_atoi_sloc0_1_0 + 1)
;     storeRegToAop (a, EXT(_atoi_s_1_1), 0), stacked=0, isaddr=0
	sta	(_atoi_s_1_1 + 1)
;_atoi.c:39: sign = (*s == '-');
;     genPointerGet
;     loadRegFromAop (hx, DIR(_atoi_sloc0_1_0), 0)
	ldhx	*_atoi_sloc0_1_0
	lda	,x
;     storeRegToAop (a, REG(-,-,x,a), 0), stacked=0, isaddr=0
; transferRegReg(a,a)
;     genCmpEQorNE	(==)
;     loadRegFromAop (a, REG(-,-,x,a), 0)
; transferRegReg(a,a)
	cmp	#0x2D
	beq	00141$
	clra
	bra	00140$
00141$:
	lda	#0x01
00140$:
;     storeRegToAop (a, DIR(_atoi_sign_1_1), 0), stacked=0, isaddr=0
	sta	*_atoi_sign_1_1
; forgot to free a
; forgot to free xa
;_atoi.c:40: if (*s == '-' || *s == '+') s++;
;     genPointerGet
;     loadRegFromAop (hx, DIR(_atoi_sloc0_1_0), 0)
	ldhx	*_atoi_sloc0_1_0
	lda	,x
;     storeRegToAop (a, REG(-,-,x,a), 0), stacked=0, isaddr=0
; transferRegReg(a,a)
;     genCmpEQorNE	(==)
;     loadRegFromAop (a, REG(-,-,x,a), 0)
; transferRegReg(a,a)
	cmp	#0x2D
; Peephole 2d	- eliminated jmp
	beq	00110$
00142$:
;     genPointerGet
;     loadRegFromAop (hx, DIR(_atoi_sloc0_1_0), 0)
	ldhx	*_atoi_sloc0_1_0
	lda	,x
;     storeRegToAop (a, REG(-,-,x,a), 0), stacked=0, isaddr=0
; transferRegReg(a,a)
;     genCmpEQorNE	(==)
;     loadRegFromAop (a, REG(-,-,x,a), 0)
; transferRegReg(a,a)
	cmp	#0x2B
; Peephole 2c	- eliminated jmp
	bne	00131$
00143$:
00110$:
; checking lic
; checking IS_ITEMP
; pset=0, pget=0
;     genPlus
; IS_AOP_HX = 0
; icount = 1, sameRegs=1
;     genPlusIncr
;     loadRegFromAop (a, EXT(_atoi_s_1_1), 0)
	lda	(_atoi_s_1_1 + 1)
	inca
;     storeRegToAop (a, EXT(_atoi_s_1_1), 0), stacked=0, isaddr=0
	sta	(_atoi_s_1_1 + 1)
	bne	00144$
;     loadRegFromAop (a, EXT(_atoi_s_1_1), 1)
	lda	_atoi_s_1_1
	inca
;     storeRegToAop (a, EXT(_atoi_s_1_1), 1), stacked=0, isaddr=0
	sta	_atoi_s_1_1
00144$:
;_atoi.c:42: while (*s && *s >= '0' && *s <= '9') {
00131$:
;     genAssign
;     loadRegFromAop (a, EXT(_atoi_s_1_1), 1)
	lda	_atoi_s_1_1
;     storeRegToAop (a, DIR(_atoi_sloc0_1_0), 1), stacked=0, isaddr=0
	sta	*_atoi_sloc0_1_0
;     loadRegFromAop (a, EXT(_atoi_s_1_1), 0)
	lda	(_atoi_s_1_1 + 1)
;     storeRegToAop (a, DIR(_atoi_sloc0_1_0), 0), stacked=0, isaddr=0
	sta	*(_atoi_sloc0_1_0 + 1)
00115$:
;     genPointerGet
;     loadRegFromAop (hx, DIR(_atoi_sloc0_1_0), 0)
	ldhx	*_atoi_sloc0_1_0
	lda	,x
;     genIfxJump
	bne	00145$
; Peephole 3	- shortened jmp to bra
	bra	00117$
00145$:
;     genPointerGet
;     loadRegFromAop (hx, DIR(_atoi_sloc0_1_0), 0)
	ldhx	*_atoi_sloc0_1_0
	lda	,x
;     storeRegToAop (a, REG(-,-,x,a), 0), stacked=0, isaddr=0
; transferRegReg(a,a)
;     genCmp	(<)
;     loadRegFromAop (a, REG(-,-,x,a), 0)
; transferRegReg(a,a)
	cmp	#0x30
; Peephole 2k	- eliminated bra
	blt	00117$
00146$:
;     genPointerGet
;     loadRegFromAop (hx, DIR(_atoi_sloc0_1_0), 0)
	ldhx	*_atoi_sloc0_1_0
	lda	,x
;     storeRegToAop (a, REG(-,-,x,a), 0), stacked=0, isaddr=0
; transferRegReg(a,a)
;     genCmp	(>)
;     loadRegFromAop (a, REG(-,-,x,a), 0)
; transferRegReg(a,a)
	cmp	#0x39
; Peephole 2i	- eliminated bra
	bgt	00117$
00147$:
;_atoi.c:43: rv = (rv * 10) + (*s - '0');
;     genAssign
;     loadRegFromAop (a, LIT(#0x0A), 1)
	clra
;     storeRegToAop (a, EXT(__mulint_PARM_2), 1), stacked=0, isaddr=1
	sta	__mulint_PARM_2
;     loadRegFromAop (a, LIT(#0x0A), 0)
	lda	#0x0A
;     storeRegToAop (a, EXT(__mulint_PARM_2), 0), stacked=0, isaddr=1
	sta	(__mulint_PARM_2 + 1)
;     genCall
;     loadRegFromAop (x, DIR(_atoi_rv_1_1), 1)
	ldx	*_atoi_rv_1_1
;     storeRegToAop (x, REG(-,-,-,x), 0), stacked=0, isaddr=0
; transferRegReg(x,x)
;     loadRegFromAop (a, DIR(_atoi_rv_1_1), 0)
	lda	*(_atoi_rv_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, DIR(_atoi_sloc1_1_0), 0), stacked=0, isaddr=0
	sta	*(_atoi_sloc1_1_0 + 1)
;     loadRegFromAop (x, REG(-,-,-,x), 0)
; transferRegReg(x,x)
;     storeRegToAop (x, DIR(_atoi_sloc1_1_0), 1), stacked=0, isaddr=0
	stx	*_atoi_sloc1_1_0
;     genPointerGet
;     loadRegFromAop (hx, DIR(_atoi_sloc0_1_0), 0)
	ldhx	*_atoi_sloc0_1_0
	lda	,x
	aix	#1
;     storeRegToAop (a, REG(-,-,x,a), 0), stacked=0, isaddr=0
; transferRegReg(a,a)
;     storeRegToAop (hx, DIR(_atoi_sloc0_1_0), 0), stacked=0, isaddr=0
	sthx	*_atoi_sloc0_1_0
;     genCast
;     loadRegFromAop (a, REG(-,-,x,a), 0)
; transferRegReg(a,a)
;     storeRegToAop (a, DIR(_atoi_sloc2_1_0), 0), stacked=0, isaddr=0
	sta	*(_atoi_sloc2_1_0 + 1)
;     loadRegFromAop (a, REG(-,-,x,a), 0)
; transferRegReg(a,a)
	rola	
	clra	
	sbc	#0x00
;     storeRegToAop (a, DIR(_atoi_sloc2_1_0), 1), stacked=0, isaddr=0
	sta	*_atoi_sloc2_1_0
; forgot to free a
;     genMinus
;     loadRegFromAop (a, DIR(_atoi_sloc2_1_0), 0)
	lda	*(_atoi_sloc2_1_0 + 1)
	sub	#0x30
;     storeRegToAop (a, DIR(_atoi_sloc2_1_0), 0), stacked=0, isaddr=0
	sta	*(_atoi_sloc2_1_0 + 1)
;     loadRegFromAop (a, DIR(_atoi_sloc2_1_0), 1)
	lda	*_atoi_sloc2_1_0
	sbc	#0x00
;     storeRegToAop (a, DIR(_atoi_sloc2_1_0), 1), stacked=0, isaddr=0
	sta	*_atoi_sloc2_1_0
; checking lic
; checking IS_ITEMP
; pset=0, pget=0
;     genPlus
;  left size = 2
;  right size = 2
;  result size = 2
;     loadRegFromAop (a, DIR(_atoi_sloc1_1_0), 0)
	lda	*(_atoi_sloc1_1_0 + 1)
	add	*(_atoi_sloc2_1_0 + 1)
;     storeRegToAop (a, DIR(_atoi_rv_1_1), 0), stacked=0, isaddr=0
	sta	*(_atoi_rv_1_1 + 1)
;     loadRegFromAop (a, DIR(_atoi_sloc1_1_0), 1)
	lda	*_atoi_sloc1_1_0
	adc	*_atoi_sloc2_1_0
;     storeRegToAop (a, DIR(_atoi_rv_1_1), 1), stacked=0, isaddr=0
	sta	*_atoi_rv_1_1
;_atoi.c:44: s++;
	jmp	00115$
00117$:
;_atoi.c:47: return (sign ? -rv : rv);
;     genIfx
	tst	*_atoi_sign_1_1
;     genIfxJump
; Peephole 2d	- eliminated jmp
	beq	00120$
00148$:
;     genUminus
	clra
	sub	*(_atoi_rv_1_1 + 1)
;     storeRegToAop (a, DIR(_atoi_sloc2_1_0), 0), stacked=0, isaddr=0
	sta	*(_atoi_sloc2_1_0 + 1)
	clra
	sbc	*_atoi_rv_1_1
;     storeRegToAop (a, DIR(_atoi_sloc2_1_0), 1), stacked=0, isaddr=0
	sta	*_atoi_sloc2_1_0
; Peephole 3	- shortened jmp to bra
	bra	00121$
00120$:
;     genAssign
	mov	*_atoi_rv_1_1,*_atoi_sloc2_1_0
	mov	*(_atoi_rv_1_1 + 1),*(_atoi_sloc2_1_0 + 1)
00121$:
;     genRet
;     loadRegFromAop (x, DIR(_atoi_sloc2_1_0), 1)
	ldx	*_atoi_sloc2_1_0
;     storeRegToAop (x, REG(-,-,-,x), 0), stacked=0, isaddr=0
; transferRegReg(x,x)
;     loadRegFromAop (a, DIR(_atoi_sloc2_1_0), 0)
	lda	*(_atoi_sloc2_1_0 + 1)
;     storeRegToAop (a, REG(-,-,-,a), 0), stacked=0, isaddr=0
; transferRegReg(a,a)
00118$:
	rts
	.area CSEG (CODE)
	.area CONST   (CODE)
	.area XINIT
