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

	ep = dp+(dlen/sizeof(Rune))-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.rsp != 0 && ms>i)
					for(ssp = mp[i].s.rsp;
					     ssp < mp[i].e.rep;
					     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.rsp != 0 && ms>0)
				for(ssp = mp[0].s.rsp;
				     ssp < mp[0].e.rep; 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
shrq $0x2, %rcx
shlq $0x2, %rcx
addq %rcx, %rax
addq $-0x4, %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x0, (%rax)
je 0xa8d8
movq -0x8(%rbp), %rax
cmpl $0x5c, (%rax)
jne 0xa834
movq -0x8(%rbp), %rax
movq %rax, %rcx
addq $0x4, %rcx
movq %rcx, -0x8(%rbp)
movl 0x4(%rax), %eax
movl %eax, -0x40(%rbp)
testl %eax, %eax
je 0xa7fe
jmp 0xa72b
movl -0x40(%rbp), %eax
addl $-0x30, %eax
subl $0xa, %eax
jb 0xa749
jmp 0xa738
movl -0x40(%rbp), %eax
subl $0x5c, %eax
je 0xa7dd
jmp 0xa80c
movq -0x8(%rbp), %rax
movl (%rax), %eax
subl $0x30, %eax
movl %eax, -0x3c(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0xa7db
movq -0x20(%rbp), %rax
movslq -0x3c(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
cmpq $0x0, (%rax)
je 0xa7db
movl -0x24(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jle 0xa7db
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 0xa7d9
movq -0x10(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0xa7c9
movq -0x30(%rbp), %rax
movl (%rax), %ecx
movq -0x10(%rbp), %rax
movq %rax, %rdx
addq $0x4, %rdx
movq %rdx, -0x10(%rbp)
movl %ecx, (%rax)
jmp 0xa7cb
movq -0x30(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x30(%rbp)
jmp 0xa78f
jmp 0xa7db
jmp 0xa82f
movq -0x10(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0xa7fc
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x4, %rcx
movq %rcx, -0x10(%rbp)
movl $0x5c, (%rax)
jmp 0xa82f
movq -0x8(%rbp), %rax
addq $-0x4, %rax
movq %rax, -0x8(%rbp)
jmp 0xa82f
movq -0x10(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0xa82d
movq -0x8(%rbp), %rax
movl (%rax), %ecx
movq -0x10(%rbp), %rax
movq %rax, %rdx
addq $0x4, %rdx
movq %rdx, -0x10(%rbp)
movl %ecx, (%rax)
jmp 0xa82f
jmp 0xa8c7
movq -0x8(%rbp), %rax
cmpl $0x26, (%rax)
jne 0xa8a2
cmpq $0x0, -0x20(%rbp)
je 0xa8a0
movq -0x20(%rbp), %rax
cmpq $0x0, (%rax)
je 0xa8a0
cmpl $0x0, -0x24(%rbp)
jle 0xa8a0
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0xa89e
movq -0x10(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0xa88e
movq -0x30(%rbp), %rax
movl (%rax), %ecx
movq -0x10(%rbp), %rax
movq %rax, %rdx
addq $0x4, %rdx
movq %rdx, -0x10(%rbp)
movl %ecx, (%rax)
jmp 0xa890
movq -0x30(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x30(%rbp)
jmp 0xa85f
jmp 0xa8a0
jmp 0xa8c5
movq -0x10(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0xa8c3
movq -0x8(%rbp), %rax
movl (%rax), %ecx
movq -0x10(%rbp), %rax
movq %rax, %rdx
addq $0x4, %rdx
movq %rdx, -0x10(%rbp)
movl %ecx, (%rax)
jmp 0xa8c5
jmp 0xa8c7
movq -0x8(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x8(%rbp)
jmp 0xa6f2
movq -0x10(%rbp), %rax
movl $0x0, (%rax)
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop