;--------------------------------------------------------
; File Created by SDCC : FreeWare ANSI-C Compiler
; Version 2.5.1 #1058 (Jul 15 2005)
; This file generated Fri Jul 15 02:51:11 2005
;--------------------------------------------------------
	.module _strncmp
	.optsdcc -mmcs51 --model-large
	
;--------------------------------------------------------
; Public variables in this module
;--------------------------------------------------------
	.globl _strncmp_PARM_3
	.globl _strncmp_PARM_2
	.globl _strncmp
;--------------------------------------------------------
; special function registers
;--------------------------------------------------------
	.area RSEG    (DATA)
;--------------------------------------------------------
; special function bits 
;--------------------------------------------------------
	.area RSEG    (DATA)
;--------------------------------------------------------
; overlayable register banks 
;--------------------------------------------------------
	.area REG_BANK_0	(REL,OVR,DATA)
	.ds 8
;--------------------------------------------------------
; internal ram data
;--------------------------------------------------------
	.area DSEG    (DATA)
;--------------------------------------------------------
; overlayable items in internal ram 
;--------------------------------------------------------
	.area	OSEG    (OVR,DATA)
_strncmp_sloc0_1_0::
	.ds 1
;--------------------------------------------------------
; indirectly addressable internal ram data
;--------------------------------------------------------
	.area ISEG    (DATA)
;--------------------------------------------------------
; bit data
;--------------------------------------------------------
	.area BSEG    (BIT)
;--------------------------------------------------------
; paged external ram data
;--------------------------------------------------------
	.area PSEG    (PAG,XDATA)
;--------------------------------------------------------
; external ram data
;--------------------------------------------------------
	.area XSEG    (XDATA)
_strncmp_PARM_2::
	.ds 3
_strncmp_PARM_3::
	.ds 2
_strncmp_first_1_1::
	.ds 3
;--------------------------------------------------------
; external initialized ram data
;--------------------------------------------------------
	.area XISEG   (XDATA)
	.area CSEG    (CODE)
	.area GSINIT0 (CODE)
	.area GSINIT1 (CODE)
	.area GSINIT2 (CODE)
	.area GSINIT3 (CODE)
	.area GSINIT4 (CODE)
	.area GSINIT5 (CODE)
;--------------------------------------------------------
; global & static initialisations
;--------------------------------------------------------
	.area CSEG    (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 'strncmp'
;------------------------------------------------------------
;last                      Allocated with name '_strncmp_PARM_2'
;count                     Allocated with name '_strncmp_PARM_3'
;first                     Allocated with name '_strncmp_first_1_1'
;sloc0                     Allocated with name '_strncmp_sloc0_1_0'
;------------------------------------------------------------
;_strncmp.c:26: int strncmp (
;	-----------------------------------------
;	 function strncmp
;	-----------------------------------------
_strncmp:
	ar2 = 0x02
	ar3 = 0x03
	ar4 = 0x04
	ar5 = 0x05
	ar6 = 0x06
	ar7 = 0x07
	ar0 = 0x00
	ar1 = 0x01
;     genReceive
	mov	r2,b
	mov	r3,dph
	mov	a,dpl
	mov	dptr,#_strncmp_first_1_1
	movx	@dptr,a
	inc	dptr
	mov	a,r3
	movx	@dptr,a
	inc	dptr
	mov	a,r2
	movx	@dptr,a
;_strncmp.c:32: if (!count)
;     genAssign
	mov	dptr,#_strncmp_PARM_3
	movx	a,@dptr
	mov	r2,a
	inc	dptr
	movx	a,@dptr
;     genIfx
;	Peephole 135	removed redundant mov
	mov	r3,a
	orl	a,r2
;     genIfxJump
;	Peephole 109	removed ljmp by inverse jump logic
	jnz	00114$
;	Peephole 300	removed redundant label 00115$
;_strncmp.c:33: return(0);
;     genRet
;	Peephole 182.b	used 16 bit load of dptr
	mov	dptr,#0x0000
;	Peephole 251.a	replaced ljmp to ret with ret
	ret
;_strncmp.c:35: while (--count && *first && *first == *last) {
00114$:
;     genAssign
	mov	dptr,#_strncmp_first_1_1
	movx	a,@dptr
	mov	r4,a
	inc	dptr
	movx	a,@dptr
	mov	r5,a
	inc	dptr
	movx	a,@dptr
	mov	r6,a
;     genAssign
	mov	dptr,#_strncmp_PARM_2
	movx	a,@dptr
	mov	r7,a
	inc	dptr
	movx	a,@dptr
	mov	r0,a
	inc	dptr
	movx	a,@dptr
	mov	r1,a
;     genAssign
00105$:
;     genMinus
;     genMinusDec
	dec	r2
	cjne	r2,#0xff,00116$
	dec	r3
00116$:
;     genIfx
	mov	a,r2
	orl	a,r3
;     genIfxJump
;	Peephole 110	removed ljmp by inverse jump logic
	jz	00107$
;	Peephole 300	removed redundant label 00117$
;     genPointerGet
;     genGenPointerGet
	mov	dpl,r4
	mov	dph,r5
	mov	b,r6
	lcall	__gptrget
	mov	_strncmp_sloc0_1_0,a
;     genIfx
	mov	a,_strncmp_sloc0_1_0
;     genIfxJump
;	Peephole 110	removed ljmp by inverse jump logic
	jz	00107$
;	Peephole 300	removed redundant label 00118$
;     genIpush
	push	ar2
	push	ar3
;     genPointerGet
;     genGenPointerGet
	mov	dpl,r7
	mov	dph,r0
	mov	b,r1
	lcall	__gptrget
	mov	r2,a
;     genCmpEq
	mov	a,_strncmp_sloc0_1_0
	cjne	a,ar2,00119$
	mov	a,#0x01
	sjmp	00120$
00119$:
	clr	a
00120$:
;     genIpop
	pop	ar3
	pop	ar2
;     genIfx
;     genIfxJump
;	Peephole 110	removed ljmp by inverse jump logic
	jz	00107$
;	Peephole 300	removed redundant label 00121$
;_strncmp.c:36: first++;
;     genPlus
;     genPlusIncr
	inc	r4
	cjne	r4,#0x00,00122$
	inc	r5
00122$:
;     genAssign
	mov	dptr,#_strncmp_first_1_1
	mov	a,r4
	movx	@dptr,a
	inc	dptr
	mov	a,r5
	movx	@dptr,a
	inc	dptr
	mov	a,r6
	movx	@dptr,a
;_strncmp.c:37: last++;
;     genPlus
;     genPlusIncr
	inc	r7
;	Peephole 112.b	changed ljmp to sjmp
;	Peephole 243	avoided branch to sjmp
	cjne	r7,#0x00,00105$
	inc	r0
;	Peephole 300	removed redundant label 00123$
	sjmp	00105$
00107$:
;_strncmp.c:40: return( *first - *last );
;     genAssign
	mov	dptr,#_strncmp_first_1_1
	mov	a,r4
	movx	@dptr,a
	inc	dptr
	mov	a,r5
	movx	@dptr,a
	inc	dptr
	mov	a,r6
	movx	@dptr,a
;     genPointerGet
;     genGenPointerGet
	mov	dpl,r4
	mov	dph,r5
	mov	b,r6
	lcall	__gptrget
;     genCast
;	Peephole 105	removed redundant mov
	mov	r4,a
	rlc	a
	subb	a,acc
	mov	r2,a
;     genPointerGet
;     genGenPointerGet
	mov	dpl,r7
	mov	dph,r0
	mov	b,r1
	lcall	__gptrget
;     genCast
;	Peephole 105	removed redundant mov
	mov	r7,a
	rlc	a
	subb	a,acc
	mov	r3,a
;     genMinus
	mov	a,r4
	clr	c
;	Peephole 236.l	used r7 instead of ar7
	subb	a,r7
	mov	r4,a
	mov	a,r2
;	Peephole 236.l	used r3 instead of ar3
	subb	a,r3
;     genRet
;	Peephole 235	loading dph directly from a(ccumulator), r2 not set
	mov	dpl,r4
	mov	dph,a
;	Peephole 300	removed redundant label 00108$
	ret
	.area CSEG    (CODE)
	.area CONST   (CODE)
	.area XINIT   (CODE)
