;--------------------------------------------------------
; File Created by SDCC : FreeWare ANSI-C Compiler
; Version 2.4.0 Tue Oct 12 01:21:27 2004

;--------------------------------------------------------
	.module _memcmp
	
	.area CSEG
	.area GSINIT
	.area GSFINAL
	.area XINIT
	.area DSEG
	.area OSEG    (OVR)
	.area BSEG
	.area XSEG
	.area XISEG
;--------------------------------------------------------
; Public variables in this module
;--------------------------------------------------------
	.globl _memcmp_PARM_3
	.globl _memcmp_PARM_2
	.globl _memcmp
;--------------------------------------------------------
;  ram data
;--------------------------------------------------------
	.area DSEG
;--------------------------------------------------------
; overlayable items in  ram 
;--------------------------------------------------------
	.area	OSEG    (OVR)
_memcmp_sloc0_1_0::
	.ds 2
_memcmp_sloc1_1_0::
	.ds 2
_memcmp_sloc2_1_0::
	.ds 1
_memcmp_sloc3_1_0::
	.ds 1
;--------------------------------------------------------
; external initialized ram data
;--------------------------------------------------------
	.area XISEG
;--------------------------------------------------------
; extended address mode data
;--------------------------------------------------------
	.area XSEG
_memcmp_PARM_2::
	.ds 2
_memcmp_PARM_3::
	.ds 2
_memcmp_buf1_1_1::
	.ds 2
;--------------------------------------------------------
; global & static initialisations
;--------------------------------------------------------
	.area GSINIT
	.area GSFINAL
	.area GSINIT
;--------------------------------------------------------
; Home
;--------------------------------------------------------
	.area HOME
	.area CSEG
;--------------------------------------------------------
; code
;--------------------------------------------------------
	.area CSEG
;------------------------------------------------------------
;Allocation info for local variables in function 'memcmp'
;------------------------------------------------------------
;buf2                      Allocated with name '_memcmp_PARM_2'
;count                     Allocated with name '_memcmp_PARM_3'
;buf1                      Allocated with name '_memcmp_buf1_1_1'
;sloc0                     Allocated with name '_memcmp_sloc0_1_0'
;sloc1                     Allocated with name '_memcmp_sloc1_1_0'
;sloc2                     Allocated with name '_memcmp_sloc2_1_0'
;sloc3                     Allocated with name '_memcmp_sloc3_1_0'
;------------------------------------------------------------
;_memcmp.c:26: int memcmp (
;	-----------------------------------------
;	 function memcmp
;	-----------------------------------------
_memcmp:
;     genReceive
;     loadRegFromAop (a, REG(-,-,-,a), 0)
; transferRegReg(a,a)
;     storeRegToAop (a, EXT(_memcmp_buf1_1_1), 0), stacked=0, isaddr=0
	sta	(_memcmp_buf1_1_1 + 1)
;     loadRegFromAop (x, REG(-,-,-,x), 0)
; transferRegReg(x,x)
;     storeRegToAop (x, EXT(_memcmp_buf1_1_1), 1), stacked=0, isaddr=0
	stx	_memcmp_buf1_1_1
;_memcmp.c:32: if (!count)
;     genIfx
;     loadRegFromAop (a, EXT(_memcmp_PARM_3), 0)
	lda	(_memcmp_PARM_3 + 1)
	ora	_memcmp_PARM_3
;     genIfxJump
; Peephole 2c	- eliminated jmp
	bne	00112$
00113$:
;_memcmp.c:33: return(0);
;     genRet
;     loadRegFromAop (x, LIT(#0x00), 1)
	ldx	#0x00
;     storeRegToAop (x, REG(-,-,-,x), 0), stacked=0, isaddr=0
; transferRegReg(x,x)
;     loadRegFromAop (a, LIT(#0x00), 0)
	lda	#0x00
;     storeRegToAop (a, REG(-,-,-,a), 0), stacked=0, isaddr=0
; transferRegReg(a,a)
	jmp	00107$
;_memcmp.c:35: while ( --count && *((char *)buf1) == *((char *)buf2) ) {
00112$:
;     genAssign
;     loadRegFromAop (a, EXT(_memcmp_buf1_1_1), 0)
	lda	(_memcmp_buf1_1_1 + 1)
;     storeRegToAop (a, DIR(_memcmp_sloc0_1_0), 0), stacked=0, isaddr=0
	sta	*(_memcmp_sloc0_1_0 + 1)
;     loadRegFromAop (a, EXT(_memcmp_buf1_1_1), 1)
	lda	_memcmp_buf1_1_1
;     storeRegToAop (a, DIR(_memcmp_sloc0_1_0), 1), stacked=0, isaddr=0
	sta	*_memcmp_sloc0_1_0
;     genAssign
;     loadRegFromAop (a, EXT(_memcmp_PARM_3), 0)
	lda	(_memcmp_PARM_3 + 1)
;     storeRegToAop (a, DIR(_memcmp_sloc1_1_0), 0), stacked=0, isaddr=0
	sta	*(_memcmp_sloc1_1_0 + 1)
;     loadRegFromAop (a, EXT(_memcmp_PARM_3), 1)
	lda	_memcmp_PARM_3
;     storeRegToAop (a, DIR(_memcmp_sloc1_1_0), 1), stacked=0, isaddr=0
	sta	*_memcmp_sloc1_1_0
00104$:
;     genMinus
;     loadRegFromAop (a, DIR(_memcmp_sloc1_1_0), 0)
	lda	*(_memcmp_sloc1_1_0 + 1)
	sub	#0x01
;     storeRegToAop (a, DIR(_memcmp_sloc1_1_0), 0), stacked=0, isaddr=0
	sta	*(_memcmp_sloc1_1_0 + 1)
;     loadRegFromAop (a, DIR(_memcmp_sloc1_1_0), 1)
	lda	*_memcmp_sloc1_1_0
	sbc	#0x00
;     storeRegToAop (a, DIR(_memcmp_sloc1_1_0), 1), stacked=0, isaddr=0
	sta	*_memcmp_sloc1_1_0
;     genIfx
;     loadRegFromAop (a, DIR(_memcmp_sloc1_1_0), 0)
	lda	*(_memcmp_sloc1_1_0 + 1)
	ora	*_memcmp_sloc1_1_0
;     genIfxJump
; Peephole 2d	- eliminated jmp
	beq	00106$
00114$:
;     genPointerGet
;     genFarPointerGet
;     loadRegFromAop (hx, DIR(_memcmp_sloc0_1_0), 0)
	ldhx	*_memcmp_sloc0_1_0
	lda	,x
;     storeRegToAop (a, DIR(_memcmp_sloc2_1_0), 0), stacked=0, isaddr=0
	sta	*_memcmp_sloc2_1_0
;     genAssign
;     genPointerGet
;     genFarPointerGet
;     loadRegFromAop (hx, EXT(_memcmp_PARM_2), 0)
;     loadRegFromAop (a, EXT(_memcmp_PARM_2), 1)
	lda	_memcmp_PARM_2
;     loadRegFromAop (x, EXT(_memcmp_PARM_2), 0)
	ldx	(_memcmp_PARM_2 + 1)
; transferRegReg(a,h)
	psha
	pulh
	lda	,x
;     storeRegToAop (a, DIR(_memcmp_sloc3_1_0), 0), stacked=0, isaddr=0
	sta	*_memcmp_sloc3_1_0
;     genCmpEq
;     loadRegFromAop (a, DIR(_memcmp_sloc2_1_0), 0)
	lda	*_memcmp_sloc2_1_0
	cmp	*_memcmp_sloc3_1_0
	bne	00115$
	bra	00116$
00115$:
; Peephole 3	- shortened jmp to bra
	bra	00106$
00116$:
;_memcmp.c:36: buf1 = (char *)buf1 + 1;
; checking lic
; checking IS_ITEMP
; pset=0, pget=0
;     genPlus
; IS_AOP_HX = 0
;     loadRegFromAop (hx, DIR(_memcmp_sloc0_1_0), 0)
	ldhx	*_memcmp_sloc0_1_0
	aix	#1
;     storeRegToAop (hx, DIR(_memcmp_sloc0_1_0), 0), stacked=0, isaddr=0
	sthx	*_memcmp_sloc0_1_0
;_memcmp.c:37: buf2 = (char *)buf2 + 1;
;     genAssign
; checking lic
; checking IS_ITEMP
;     genPlus
; IS_AOP_HX = 0
; icount = 1, sameRegs=1
;     genPlusIncr
;     loadRegFromAop (a, EXT(_memcmp_PARM_2), 0)
	lda	(_memcmp_PARM_2 + 1)
	inca
;     storeRegToAop (a, EXT(_memcmp_PARM_2), 0), stacked=0, isaddr=1
	sta	(_memcmp_PARM_2 + 1)
	bne	00117$
;     loadRegFromAop (a, EXT(_memcmp_PARM_2), 1)
	lda	_memcmp_PARM_2
	inca
;     storeRegToAop (a, EXT(_memcmp_PARM_2), 1), stacked=0, isaddr=1
	sta	_memcmp_PARM_2
00117$:
; Peephole 3	- shortened jmp to bra
	bra	00104$
00106$:
;_memcmp.c:40: return( *((unsigned char *)buf1) - *((unsigned char *)buf2) );
;     genPointerGet
;     genFarPointerGet
;     loadRegFromAop (hx, DIR(_memcmp_sloc0_1_0), 0)
	ldhx	*_memcmp_sloc0_1_0
	lda	,x
;     storeRegToAop (a, DIR(_memcmp_sloc3_1_0), 0), stacked=0, isaddr=0
	sta	*_memcmp_sloc3_1_0
;     genCast
	mov	*_memcmp_sloc3_1_0,*(_memcmp_sloc1_1_0 + 1)
	clr	*_memcmp_sloc1_1_0
;     genPointerGet
;     genFarPointerGet
;     loadRegFromAop (hx, EXT(_memcmp_PARM_2), 0)
;     loadRegFromAop (a, EXT(_memcmp_PARM_2), 1)
	lda	_memcmp_PARM_2
;     loadRegFromAop (x, EXT(_memcmp_PARM_2), 0)
	ldx	(_memcmp_PARM_2 + 1)
; transferRegReg(a,h)
	psha
	pulh
	lda	,x
;     storeRegToAop (a, DIR(_memcmp_sloc3_1_0), 0), stacked=0, isaddr=0
	sta	*_memcmp_sloc3_1_0
;     genCast
	mov	*_memcmp_sloc3_1_0,*(_memcmp_sloc0_1_0 + 1)
	clr	*_memcmp_sloc0_1_0
;     genMinus
;     loadRegFromAop (a, DIR(_memcmp_sloc1_1_0), 0)
	lda	*(_memcmp_sloc1_1_0 + 1)
	sub	*(_memcmp_sloc0_1_0 + 1)
;     storeRegToAop (a, DIR(_memcmp_sloc1_1_0), 0), stacked=0, isaddr=0
	sta	*(_memcmp_sloc1_1_0 + 1)
;     loadRegFromAop (a, DIR(_memcmp_sloc1_1_0), 1)
	lda	*_memcmp_sloc1_1_0
	sbc	*_memcmp_sloc0_1_0
;     storeRegToAop (a, DIR(_memcmp_sloc1_1_0), 1), stacked=0, isaddr=0
	sta	*_memcmp_sloc1_1_0
;     genRet
;     loadRegFromAop (x, DIR(_memcmp_sloc1_1_0), 1)
	ldx	*_memcmp_sloc1_1_0
;     storeRegToAop (x, REG(-,-,-,x), 0), stacked=0, isaddr=0
; transferRegReg(x,x)
;     loadRegFromAop (a, DIR(_memcmp_sloc1_1_0), 0)
	lda	*(_memcmp_sloc1_1_0 + 1)
;     storeRegToAop (a, REG(-,-,-,a), 0), stacked=0, isaddr=0
; transferRegReg(a,a)
00107$:
	rts
	.area CSEG
	.area XINIT
