;* * * * *  Small-C/Plus Z88 * * * * *
;  Version: v1.10b0.46 Date: 1/3/99 
;
;	Reconstructed for the z80 Module Assembler
;	By Dominic Morris <djm@jb.man.ac.uk>

;	Small C+ Library Function

	XLIB	strstr

	INCLUDE "#z88_crt0.hdr"
        LIB     strlen

.strstr
	ld	hl,-7
	add	hl,sp
	ld	sp,hl
	ld	hl,5
	add	hl,sp
	push	hl
	ld	hl,11
	add	hl,sp
	call	l_gint
	push	hl
	call	strlen
	pop	bc
	pop	de
	call	l_pint
.i_5
	ld	hl,9
	add	hl,sp
	call	l_gint
	ld	l,(hl)
	ld	h,0
	push	hl
	ld	hl,13
	add	hl,sp
	call	l_gint
	ld	l,(hl)
	ld	h,0
	pop	de
	call	l_eq
	ld	a,h
	or	l
	jp	z,i_6
	ld	hl,5
	add	hl,sp
	call	l_gint
	pop	bc
	push	hl
	ld	hl,3
	add	hl,sp
	push	hl
	ld	hl,11
	add	hl,sp
	call	l_gint
	inc	hl
	pop	de
	call	l_pint
	ld	hl,11
	add	hl,sp
	push	hl
	call	l_gint
	inc	hl
	pop	de
	call	l_pint
	dec	hl
.i_7
;Decrement int at top of stack (from j--)
	pop	hl
	dec	hl
	push	hl
	ld	a,h
	or	l
	jp	z,i_9
	ld	hl,3
	add	hl,sp
	call	l_gint
	ld	l,(hl)
	ld	h,0
	push	hl
	ld	hl,13
	add	hl,sp
	call	l_gint
	ld	l,(hl)
	ld	h,0
	pop	de
	call	l_eq
	ld	a,h
	or	l
	jp	z,i_9
	ld	hl,1
	jp	i_10
.i_9
	ld	hl,0
.i_10
	ld	a,h
	or	l
	jp	z,i_8
	ld	hl,3
	add	hl,sp
	push	hl
	call	l_gint
	inc	hl
	pop	de
	call	l_pint
; Removed redundant dec hl instruction
	ld	hl,11
	add	hl,sp
	push	hl
	call	l_gint
	inc	hl
	pop	de
	call	l_pint
	dec	hl
	jp	i_7
.i_8
;Get top int off stack optimized
	pop	hl
	push	hl
	call	l_lneg
	ld	a,h
	or	l
	jp	z,i_11
	ld	hl,11
	add	hl,sp
	push	hl
	call	l_gint
	push	hl
	ld	hl,9
	add	hl,sp
	call	l_gint
	pop	de
	call	l_sub
	pop	de
	call	l_pint
	ld	hl,11
	add	hl,sp
	call	l_gint
	ex	de,hl
	ld	hl,7
	add	hl,sp
	ld	sp,hl
	ex	de,hl
	ret


.i_11
	ld	hl,11
	add	hl,sp
	push	hl
	call	l_gint
	dec	hl
	pop	de
	call	l_pint
	inc	hl
.i_12
.i_6
.i_3
	ld	hl,2
	add	hl,sp
	push	hl
	ld	hl,13
	add	hl,sp
	push	hl
	call	l_gint
	inc	hl
	pop	de
	call	l_pint
	dec	hl
	ld	l,(hl)
	ld	h,0
	pop	de
	ld	a,l
	ld	(de),a
	ld	a,h
	or	l
	jp	z,i_4
	jp	i_5
.i_4
;ld hl,ex,ld hl
	ld	de,0
	ld	hl,7
	add	hl,sp
	ld	sp,hl
	ex	de,hl
	ret




; --- Start of Static Variables ---


; --- End of Compilation ---
