// File: /workspace/github_cpp_makefile_star2_O2/arnoldrobbins[P]mcilroy-regex/sed1.cpp
// Function: compile(Text*, Text*)
void
compile(Text *script, Text *t)
{
	int loc;	/* progam counter */
	int neg;	/* ! in effect */
	int cmd;
	int naddr;
	int *q;		/* address of instruction word */
	t->w = t->s;	/* here w is a read pointer */
	while(*t->w) {
		assure(script, 4*sizeof(int));
		loc = script->w - script->s;
		synl = t->w;
		naddr = 0;
		while(blank(t)) ;
		naddr += addr(script, t);
		if(naddr && *t->w ==',') {
			t->w++;
			naddr += addr(script, t);
			if(naddr < 2)
				syntax("missing address");
		}
		q = (int*)script->w;
		if(naddr == 2)
			*q++ = INACT;
		script->w = (uchar*)(q+1);
		neg = 0;
		for(;;) {
			while(blank(t));
			cmd = *t->w++;
			if(neg && docom[cmd&0xff]==Ic)
				syntax("improper !");
			if(cmd != '!')
				break;
			neg = NEG;
		}
		if(!neg) {
			switch(adrs[cmd]) {
			case 1:
				if(naddr <= 1)
					break;
			case 0:
				if(naddr == 0)
					break;
				syntax("too many addresses");
			}
		}
		docom[cmd&0xff](script, t);
		switch(*t->w) {
		case 0:
			script->w = script->s + loc;
			break;
		default:
			if(cmd == '{')
				break;
			syntax("junk after command");
		case ';':
			if(!semicolon++)
				synwarn("semicolon separators");
		case '\n':
				t->w++;
		}
		*q = pack(neg,cmd,script->w-script->s-loc);
	}
	fixbrack(script);
	fixlabels(script);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq 0x10(%rsi), %rax
movq %rax, (%rsi)
leaq 0xb2de(%rip), %r13      # 0x10d60
cmpb $0x0, (%rax)
je 0x5c56
movq 0x10(%rbx), %r15
testq %r15, %r15
je 0x5aa4
movq (%rbx), %r12
movq 0x8(%rbx), %rcx
addq $-0x11, %rcx
cmpq %rcx, %r12
jb 0x5ab9
movq %rbx, %rdi
pushq $0x10
popq %rsi
callq 0x5880
movq (%rbx), %r12
movq 0x10(%rbx), %r15
movq (%r14), %rax
movq %rax, 0xcc98(%rip)      # 0x12758
movq %r14, %rdi
callq 0x5c74
testl %eax, %eax
jne 0x5ac0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5c90
movl %eax, 0x4(%rsp)
testl %eax, %eax
je 0x5b1e
movq (%r14), %rax
cmpb $0x2c, (%rax)
jne 0x5b1e
incq %rax
movq %rax, (%r14)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5c90
testl %eax, %eax
je 0x5b12
movq (%rbx), %rax
movl $0x80000000, (%rax)     # imm = 0x80000000
addq $0x4, %rax
movl $0x0, (%rsp)
jmp 0x5b26
leaq 0x65d5(%rip), %rdi      # 0xc0ee
callq 0x5d41
movq (%rbx), %rax
movb $0x1, %cl
movl %ecx, (%rsp)
subq %r15, %r12
movq %r12, 0x10(%rsp)
movq %rax, 0x8(%rsp)
addq $0x4, %rax
movq %rax, (%rbx)
xorl %eax, %eax
movb $0x1, %bpl
movl %eax, %r12d
movq %r14, %rdi
callq 0x5c74
testl %eax, %eax
jne 0x5b42
movq (%r14), %rax
leaq 0x1(%rax), %rcx
movq %rcx, (%r14)
movzbl (%rax), %r15d
testb $0x1, %bpl
je 0x5b71
movl $0x1000000, %eax        # imm = 0x1000000
xorl %ebp, %ebp
cmpl $0x21, %r15d
je 0x5b3f
jmp 0x5b9a
leaq 0x203(%rip), %rax       # 0x5d7b
cmpq %rax, (%r13,%r15,8)
jne 0x5b8b
leaq 0x6578(%rip), %rdi      # 0xc0fe
callq 0x5d41
movl $0x1000000, %eax        # imm = 0x1000000
xorl %ebp, %ebp
cmpl $0x21, %r15d
je 0x5b3f
jmp 0x5bd1
leaq 0xc5ff(%rip), %rax      # 0x121a0
movzbl (%r15,%rax), %eax
testl %eax, %eax
je 0x5bbe
cmpl $0x1, %eax
jne 0x5bd1
cmpl $0x0, 0x4(%rsp)
sete %al
orb (%rsp), %al
je 0x5bc5
jmp 0x5bd1
cmpl $0x0, 0x4(%rsp)
je 0x5bd1
leaq 0x653d(%rip), %rdi      # 0xc109
callq 0x5d41
movq %rbx, %rdi
movq %r14, %rsi
callq *(%r13,%r15,8)
movq (%r14), %rax
movzbl (%rax), %eax
cmpl $0x3b, %eax
movq 0x10(%rsp), %rbp
je 0x5c13
cmpl $0xa, %eax
je 0x5c32
testl %eax, %eax
jne 0x5c01
movslq %ebp, %rax
addq 0x10(%rbx), %rax
movq %rax, (%rbx)
jmp 0x5c35
cmpl $0x7b, %r15d
je 0x5c35
leaq 0x650e(%rip), %rdi      # 0xc11c
callq 0x5d41
movl 0xcb1f(%rip), %eax      # 0x12738
leal 0x1(%rax), %ecx
movl %ecx, 0xcb16(%rip)      # 0x12738
testl %eax, %eax
jne 0x5c32
leaq 0x6502(%rip), %rdi      # 0xc12f
callq 0x5d7f
incq (%r14)
movl (%rbx), %edx
addl 0x10(%rbx), %ebp
subl %ebp, %edx
movl %r12d, %edi
movl %r15d, %esi
callq 0x5db9
movq 0x8(%rsp), %rcx
movl %eax, (%rcx)
movq (%r14), %rax
jmp 0x5a82
movq %rbx, %rdi
callq 0x5df0
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5e67