;--------------------------------------------------------
; File Created by SDCC : FreeWare ANSI-C Compiler
; Version 2.5.1 #1058 (Jul 15 2005)
; This file generated Fri Jul 15 02:51:16 2005
;--------------------------------------------------------
	.module _strstr
	.optsdcc -mmcs51 --model-large
	
;--------------------------------------------------------
; Public variables in this module
;--------------------------------------------------------
	.globl _strstr_PARM_2
	.globl _strstr
;--------------------------------------------------------
; 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)
_strstr_sloc0_1_0::
	.ds 3
_strstr_sloc1_1_0::
	.ds 3
;--------------------------------------------------------
; 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)
_strstr_PARM_2::
	.ds 3
_strstr_str1_1_1::
	.ds 3
_strstr_cp_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 'strstr'
;------------------------------------------------------------
;str2                      Allocated with name '_strstr_PARM_2'
;str1                      Allocated with name '_strstr_str1_1_1'
;cp                        Allocated with name '_strstr_cp_1_1'
;s1                        Allocated with name '_strstr_s1_1_1'
;s2                        Allocated with name '_strstr_s2_1_1'
;sloc0                     Allocated with name '_strstr_sloc0_1_0'
;sloc1                     Allocated with name '_strstr_sloc1_1_0'
;------------------------------------------------------------
;_strstr.c:26: char * strstr (
;	-----------------------------------------
;	 function strstr
;	-----------------------------------------
_strstr:
	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,#_strstr_str1_1_1
	movx	@dptr,a
	inc	dptr
	mov	a,r3
	movx	@dptr,a
	inc	dptr
	mov	a,r2
	movx	@dptr,a
;_strstr.c:31: char * cp = str1;
;     genAssign
	mov	dptr,#_strstr_str1_1_1
	movx	a,@dptr
	mov	r2,a
	inc	dptr
	movx	a,@dptr
	mov	r3,a
	inc	dptr
	movx	a,@dptr
	mov	r4,a
;     genAssign
	mov	dptr,#_strstr_cp_1_1
	mov	a,r2
	movx	@dptr,a
	inc	dptr
	mov	a,r3
	movx	@dptr,a
	inc	dptr
	mov	a,r4
	movx	@dptr,a
;_strstr.c:35: if ( !*str2 )
;     genAssign
	mov	dptr,#_strstr_PARM_2
	movx	a,@dptr
	mov	r5,a
	inc	dptr
	movx	a,@dptr
	mov	r6,a
	inc	dptr
	movx	a,@dptr
	mov	r7,a
;     genPointerGet
;     genGenPointerGet
	mov	dpl,r5
	mov	dph,r6
	mov	b,r7
	lcall	__gptrget
;     genIfxJump
;	Peephole 109	removed ljmp by inverse jump logic
	jnz	00122$
;	Peephole 300	removed redundant label 00123$
;_strstr.c:36: return str1;
;     genRet
	mov	dpl,r2
	mov	dph,r3
	mov	b,r4
;	Peephole 251.a	replaced ljmp to ret with ret
	ret
;_strstr.c:38: while (*cp)
00122$:
;     genAssign
00110$:
;     genPointerGet
;     genGenPointerGet
	mov	dpl,r2
	mov	dph,r3
	mov	b,r4
	lcall	__gptrget
;     genIfxJump
	jnz	00124$
	ljmp	00112$
00124$:
;_strstr.c:43: while ( *s1 && *s2 && !(*s1-*s2) )
;     genAssign
	mov	_strstr_sloc0_1_0,r2
	mov	(_strstr_sloc0_1_0 + 1),r3
	mov	(_strstr_sloc0_1_0 + 2),r4
;     genAssign
	mov	_strstr_sloc1_1_0,r5
	mov	(_strstr_sloc1_1_0 + 1),r6
	mov	(_strstr_sloc1_1_0 + 2),r7
00105$:
;     genPointerGet
;     genGenPointerGet
	mov	dpl,_strstr_sloc0_1_0
	mov	dph,(_strstr_sloc0_1_0 + 1)
	mov	b,(_strstr_sloc0_1_0 + 2)
	lcall	__gptrget
;     genIfx
;	Peephole 105	removed redundant mov
	mov	r0,a
;     genIfxJump
;	Peephole 110	removed ljmp by inverse jump logic
	jz	00107$
;	Peephole 300	removed redundant label 00125$
;     genPointerGet
;     genGenPointerGet
	mov	dpl,_strstr_sloc1_1_0
	mov	dph,(_strstr_sloc1_1_0 + 1)
	mov	b,(_strstr_sloc1_1_0 + 2)
	lcall	__gptrget
;     genIfx
;	Peephole 105	removed redundant mov
	mov	r1,a
;     genIfxJump
;	Peephole 110	removed ljmp by inverse jump logic
	jz	00107$
;	Peephole 300	removed redundant label 00126$
;     genDjnz
;     genMinus
	mov	a,r0
	clr	c
;	Peephole 236.l	used r1 instead of ar1
	subb	a,r1
;     genIfx
;     genIfxJump
;	Peephole 109	removed ljmp by inverse jump logic
	jnz	00107$
;	Peephole 300	removed redundant label 00127$
;_strstr.c:44: s1++, s2++;
;     genPlus
;     genPlusIncr
	inc	_strstr_sloc0_1_0
	clr	a
	cjne	a,_strstr_sloc0_1_0,00128$
	inc	(_strstr_sloc0_1_0 + 1)
00128$:
;     genPlus
;     genPlusIncr
;	tail increment optimized
	inc	_strstr_sloc1_1_0
	clr	a
	cjne	a,_strstr_sloc1_1_0,00105$
	inc	(_strstr_sloc1_1_0 + 1)
;	Peephole 112.b	changed ljmp to sjmp
	sjmp	00105$
00107$:
;_strstr.c:46: if (!*s2)
;     genPointerGet
;     genGenPointerGet
	mov	dpl,_strstr_sloc1_1_0
	mov	dph,(_strstr_sloc1_1_0 + 1)
	mov	b,(_strstr_sloc1_1_0 + 2)
	lcall	__gptrget
;     genIfxJump
;	Peephole 109	removed ljmp by inverse jump logic
	jnz	00109$
;	Peephole 300	removed redundant label 00129$
;_strstr.c:47: return(cp);
;     genAssign
	mov	dptr,#_strstr_cp_1_1
	movx	a,@dptr
	mov	_strstr_sloc1_1_0,a
	inc	dptr
	movx	a,@dptr
	mov	(_strstr_sloc1_1_0 + 1),a
	inc	dptr
	movx	a,@dptr
	mov	(_strstr_sloc1_1_0 + 2),a
;     genRet
	mov	dpl,_strstr_sloc1_1_0
	mov	dph,(_strstr_sloc1_1_0 + 1)
	mov	b,(_strstr_sloc1_1_0 + 2)
;	Peephole 112.b	changed ljmp to sjmp
;	Peephole 251.b	replaced sjmp to ret with ret
	ret
00109$:
;_strstr.c:49: cp++;
;     genPlus
;     genPlusIncr
	inc	r2
	cjne	r2,#0x00,00130$
	inc	r3
00130$:
;     genAssign
	mov	dptr,#_strstr_cp_1_1
	mov	a,r2
	movx	@dptr,a
	inc	dptr
	mov	a,r3
	movx	@dptr,a
	inc	dptr
	mov	a,r4
	movx	@dptr,a
	ljmp	00110$
00112$:
;_strstr.c:52: return (NULL) ;
;     genRet
;	Peephole 182.b	used 16 bit load of dptr
	mov	dptr,#0x0000
	mov	b,#0x00
;	Peephole 300	removed redundant label 00113$
	ret
	.area CSEG    (CODE)
	.area CONST   (CODE)
	.area XINIT   (CODE)
