// File: /workspace/github_c_makefile_star2_O0/phase[P]o/libregexp/regsub.c
// Function: regsub9
extern	void
regsub(char *sp,	/* source string */
	char *dp,	/* destination string */
	int dlen,
	Resub *mp,	/* subexpression elements */
	int ms)		/* number of elements pointed to by mp */
{
	char *ssp, *ep;
	int i;

	ep = dp+dlen-1;
	while(*sp != '\0'){
		if(*sp == '\\'){
			switch(*++sp){
			case '0':
			case '1':
			case '2':
			case '3':
			case '4':
			case '5':
			case '6':
			case '7':
			case '8':
			case '9':
				i = *sp-'0';
				if(mp!=0 && mp[i].s.sp != 0 && ms>i)
					for(ssp = mp[i].s.sp;
					     ssp < mp[i].e.ep;
					     ssp++)
						if(dp < ep)
							*dp++ = *ssp;
				break;
			case '\\':
				if(dp < ep)
					*dp++ = '\\';
				break;
			case '\0':
				sp--;
				break;
			default:
				if(dp < ep)
					*dp++ = *sp;
				break;
			}
		}else if(*sp == '&'){
			if(mp!=0 && mp[0].s.sp != 0 && ms>0)
				for(ssp = mp[0].s.sp;
				     ssp < mp[0].e.ep; ssp++)
					if(dp < ep)
						*dp++ = *ssp;
		}else{
			if(dp < ep)
				*dp++ = *sp;
		}
		sp++;
	}
	*dp = '\0';
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
addq %rcx, %rax
addq $-0x1, %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x9e47
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5c, %eax
jne 0x9da0
movq -0x8(%rbp), %rax
movq %rax, %rcx
incq %rcx
movq %rcx, -0x8(%rbp)
movsbl 0x1(%rax), %eax
movl %eax, -0x40(%rbp)
testl %eax, %eax
je 0x9d6a
jmp 0x9c99
movl -0x40(%rbp), %eax
addl $-0x30, %eax
subl $0xa, %eax
jb 0x9cb7
jmp 0x9ca6
movl -0x40(%rbp), %eax
subl $0x5c, %eax
je 0x9d4c
jmp 0x9d78
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
subl $0x30, %eax
movl %eax, -0x3c(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x9d4a
movq -0x20(%rbp), %rax
movslq -0x3c(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
cmpq $0x0, (%rax)
je 0x9d4a
movl -0x24(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jle 0x9d4a
movq -0x20(%rbp), %rax
movslq -0x3c(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq -0x3c(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
cmpq 0x8(%rcx), %rax
jae 0x9d48
movq -0x10(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x9d38
movq -0x30(%rbp), %rax
movb (%rax), %cl
movq -0x10(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x10(%rbp)
movb %cl, (%rax)
jmp 0x9d3a
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x9cfe
jmp 0x9d4a
jmp 0x9d9b
movq -0x10(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x9d68
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
movb $0x5c, (%rax)
jmp 0x9d9b
movq -0x8(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x9d9b
movq -0x10(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x9d99
movq -0x8(%rbp), %rax
movb (%rax), %cl
movq -0x10(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x10(%rbp)
movb %cl, (%rax)
jmp 0x9d9b
jmp 0x9e36
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x26, %eax
jne 0x9e11
cmpq $0x0, -0x20(%rbp)
je 0x9e0f
movq -0x20(%rbp), %rax
cmpq $0x0, (%rax)
je 0x9e0f
cmpl $0x0, -0x24(%rbp)
jle 0x9e0f
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x9e0d
movq -0x10(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x9dfd
movq -0x30(%rbp), %rax
movb (%rax), %cl
movq -0x10(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x10(%rbp)
movb %cl, (%rax)
jmp 0x9dff
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x9dce
jmp 0x9e0f
jmp 0x9e34
movq -0x10(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x9e32
movq -0x8(%rbp), %rax
movb (%rax), %cl
movq -0x10(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x10(%rbp)
movb %cl, (%rax)
jmp 0x9e34
jmp 0x9e36
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x9c5a
movq -0x10(%rbp), %rax
movb $0x0, (%rax)
popq %rbp
retq