// File: /workspace/github_cpp_makefile_star2_O1/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 0x573e
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 0x57d4
jmp 0x558f
incl 0xe109(%rip)            # 0x136e8
jmp 0x558f
cmpl $0x3f, %eax
je 0x571b
cmpq $0x0, 0xe126(%rip)      # 0x13718
jne 0x561b
movq 0xd9e5(%rip), %rax      # 0x12fe0
cmpl %ebx, (%rax)
jge 0x5735
movslq (%rax), %rcx
leal 0x1(%rcx), %edx
movl %edx, (%rax)
movq (%r14,%rcx,8), %rsi
leaq 0xe0f2(%rip), %rdi      # 0x13708
callq 0x573e
movq 0xe0f6(%rip), %rdi      # 0x13718
leaq 0x7a3d(%rip), %rsi      # 0xd066
movl $0x2, %edx
callq 0x50e0
testl %eax, %eax
jne 0x5641
movl $0x1, 0xe09b(%rip)      # 0x136dc
leaq 0xe0c0(%rip), %r15      # 0x13708
leaq 0x7a1a(%rip), %rsi      # 0xd069
movq %r15, %rdi
callq 0x573e
leaq 0xe092(%rip), %rdi      # 0x136f0
movq %r15, %rsi
callq 0x5bc0
movq 0xd973(%rip), %rax      # 0x12fe0
movslq (%rax), %rcx
leaq (%r14,%rcx,8), %rax
subl %ecx, %ebx
movl %ebx, 0xe0a4(%rip)      # 0x13720
movq %rax, 0xe0a5(%rip)      # 0x13728
jne 0x569b
movl $0x1, 0xe091(%rip)      # 0x13720
movq 0xd93a(%rip), %rax      # 0x12fd0
movq (%rax), %rax
jmp 0x56a3
movq (%rax), %rdi
callq 0x5b1c
movq %rax, 0xe086(%rip)      # 0x13730
leaq 0xe057(%rip), %rdi      # 0x13708
movq 0xe060(%rip), %rax      # 0x13718
movq %rax, 0xe049(%rip)      # 0x13708
callq 0x599a
testl %eax, %eax
je 0x56fb
leaq 0xe021(%rip), %rbx      # 0x136f0
leaq 0xe032(%rip), %r14      # 0x13708
movq %rbx, %rdi
movq %r14, %rsi
callq 0x703d
movq 0xe030(%rip), %rax      # 0x13718
movq %rax, 0xe019(%rip)      # 0x13708
movq %r14, %rdi
callq 0x599a
testl %eax, %eax
jne 0x56d6
movq 0xd8ae(%rip), %rax      # 0x12fb0
movq (%rax), %rdi
callq 0x5160
cmpl $-0x1, %eax
je 0x5729
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x78e9(%rip), %rdi      # 0xd00b
xorl %eax, %eax
callq 0x5899
leaq 0xdb70(%rip), %rax      # 0x132a0
movq (%rax), %rdi
jmp 0x5722
leaq 0x7920(%rip), %rdi      # 0xd05c
jmp 0x5722