// File: /workspace/github_cpp_makefile_star2_O3/arnoldrobbins[P]mcilroy-regex/sed0.cpp
// Function: main
int
main(int argc, char **argv)
{
	static Text script;
	static Text data;
	for(;;) {
		switch(getopt(argc, argv, "bnf:e:")) {
		case 'b':
			bflag++;
			continue;
		case 'e':
			copyscript(&data, (uchar*)optarg);
			continue;
		case 'f':
			readscript(&data, optarg);
			continue;
		case 'n':
			nflag++;
			continue;
		case '?':
			quit("usage: sed [-n] script [files]\n"
			"     sed [-n] [-f scriptfile] "
			      "[-e script] [files]");
		case -1:
			break;
		}
		break;
	}
	if(data.s == 0) {
		if(optind >= argc)
			quit("no script");
		copyscript(&data, (uchar*)argv[optind++]);
	}
	if(ustrncmp(data.s, "#n", 2) == 0)
		nflag = 1;
	copyscript(&data, (uchar*)"\n\n");  /* e.g. s/a/\ */
	compile(&script, &data);
	// printscript(&script); //  debugging

	initinput(argc-optind, argv+optind);
	for(;;) {
		data.w = data.s;
		if(!readline(&data))
			break;
		execute(&script, &data);
	}
	if(fclose(stdout) == EOF)
		quit(stdouterr);
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %r14
movl %edi, %ebx
leaq 0x7a83(%rip), %r15      # 0xd004
movq 0xda38(%rip), %r13      # 0x12fc0
leaq 0xe179(%rip), %r12      # 0x13708
movl %ebx, %edi
movq %r14, %rsi
movq %r15, %rdx
callq 0x5080
cmpl $0x65, %eax
jg 0x55b9
cmpl $0x62, %eax
je 0x55d9
cmpl $0x65, %eax
jne 0x55e1
movq (%r13), %rsi
movq %r12, %rdi
callq 0x5736
jmp 0x558f
cmpl $0x66, %eax
je 0x55cb
cmpl $0x6e, %eax
jne 0x55ea
incl 0xe113(%rip)            # 0x136dc
jmp 0x558f
movq (%r13), %rsi
movq %r12, %rdi
callq 0x57d2
jmp 0x558f
incl 0xe109(%rip)            # 0x136e8
jmp 0x558f
cmpl $0x3f, %eax
je 0x5713
movq 0xe127(%rip), %rax      # 0x13718
testq %rax, %rax
jne 0x5624
movq 0xd9e3(%rip), %rax      # 0x12fe0
movslq (%rax), %rcx
cmpl %ebx, %ecx
jge 0x572d
leal 0x1(%rcx), %edx
movl %edx, (%rax)
movq (%r14,%rcx,8), %rsi
leaq 0xe0f0(%rip), %rdi      # 0x13708
callq 0x5736
movq 0xe0f4(%rip), %rax      # 0x13718
cmpb $0x23, (%rax)
jne 0x5639
cmpb $0x6e, 0x1(%rax)
jne 0x5639
movl $0x1, 0xe0a3(%rip)      # 0x136dc
leaq 0xe0c8(%rip), %r15      # 0x13708
leaq 0x7a1f(%rip), %rsi      # 0xd066
movq %r15, %rdi
callq 0x5736
leaq 0xe09a(%rip), %rdi      # 0x136f0
movq %r15, %rsi
callq 0x5ba8
movq 0xd97b(%rip), %rax      # 0x12fe0
movslq (%rax), %rcx
leaq (%r14,%rcx,8), %rax
subl %ecx, %ebx
movl %ebx, 0xe0ac(%rip)      # 0x13720
movq %rax, 0xe0ad(%rip)      # 0x13728
jne 0x5693
movl $0x1, 0xe099(%rip)      # 0x13720
movq 0xd942(%rip), %rax      # 0x12fd0
movq (%rax), %rax
jmp 0x569b
movq (%rax), %rdi
callq 0x5b19
movq %rax, 0xe08e(%rip)      # 0x13730
leaq 0xe05f(%rip), %rdi      # 0x13708
movq 0xe068(%rip), %rax      # 0x13718
movq %rax, 0xe051(%rip)      # 0x13708
callq 0x599b
testl %eax, %eax
je 0x56f3
leaq 0xe029(%rip), %rbx      # 0x136f0
leaq 0xe03a(%rip), %r14      # 0x13708
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7179
movq 0xe038(%rip), %rax      # 0x13718
movq %rax, 0xe021(%rip)      # 0x13708
movq %r14, %rdi
callq 0x599b
testl %eax, %eax
jne 0x56ce
movq 0xd8b6(%rip), %rax      # 0x12fb0
movq (%rax), %rdi
callq 0x5160
cmpl $-0x1, %eax
je 0x5721
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x78f1(%rip), %rdi      # 0xd00b
xorl %eax, %eax
callq 0x589a
leaq 0xdb78(%rip), %rax      # 0x132a0
movq (%rax), %rdi
jmp 0x571a
leaq 0x7928(%rip), %rdi      # 0xd05c
jmp 0x571a