// File: /workspace/github_c_makefile_star2_O3/oridb[P]mc/6/main.c
// Function: main
int
main(int argc, char **argv)
{
	char buf[1024];
	Optctx ctx;
	size_t i;

	outfile = NULL;

	optinit(&ctx, "cd:?hSo:I:9G:O:T", argv, argc);
	asmsyntax = Defaultasm;
	sizefn = size;
	while (!optdone(&ctx)) {
		switch (optnext(&ctx)) {
		case 'O':
			objdir = ctx.optarg;
			break;
		case 'o':
			outfile = ctx.optarg;
			break;
		case 'S':
			writeasm = 1;
			break;
		case '?':
		case 'h':
			usage(argv[0]);
			exit(0);
			break;
		case 'c':
			extracheck = 1;
			break;
		case 'd':
			while (ctx.optarg && *ctx.optarg)
				debugopt[*ctx.optarg++ & 0x7f]++;
			break;
		case '9':
			asmsyntax = Plan9;
			break;
		case 'G':
			if (!strcmp(ctx.optarg, "e"))
				asmsyntax = Gnugaself;
			else if (!strcmp(ctx.optarg, "m"))
				asmsyntax = Gnugasmacho;
			else
				die("unknown gnu syntax flavor");
			break;
		case 'I':
			lappend(&incpaths, &nincpaths, ctx.optarg);
			break;
		case 'T':
			allowhidden++;
			break;
		default:
			usage(argv[0]);
			exit(0);
			break;
		}
	}

	/* Sysinit is arbitrary code defined by the configure script */
	Sysinit;

	lappend(&incpaths, &nincpaths, Instroot "/lib/myr");

	if (ctx.nargs == 0) {
		fprintf(stderr, "No input files given\n");
		exit(1);
	} else if (ctx.nargs > 1)
		outfile = NULL;

	for (i = 0; i < ctx.nargs; i++) {
		if (outfile)
			localincpath = dirname(outfile);
		else
			localincpath = dirname(ctx.args[i]);

		initfile(&file, ctx.args[0]);
		tokinit(ctx.args[i]);
		yyparse();

		/* before we do anything to the parse */
		if (debugopt['T'])
			dump(stdout);
		loaduses();
		if (hasmain()) {
			genautocall(file.init, file.ninit,
			    file.localinit, "__init__");
			genautocall(file.fini, file.nfini,
			    file.localfini, "__fini__");
		}
		infer();
		tagexports(0);
		/* after all type inference */
		if (debugopt['t'])
			dump(stdout);

		if (writeasm) {
			if (outfile != NULL)
				swapout(buf, sizeof buf, ".s");
			else
				swapsuffix(buf, sizeof buf, ctx.args[i], ".myr", ".s");
		} else {
			gentempfile(buf, sizeof buf, ctx.args[i], ".s");
		}
		genuse(ctx.args[i]);
		gen(buf);
		assemble(buf, ctx.args[i]);

		free(localincpath);
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x568, %rsp            # imm = 0x568
movq %rsi, %rbx
movq $0x0, 0x56645(%rip) # 0x611c0
movslq %edi, %rcx
leaq 0x26efb(%rip), %rsi     # 0x31a80
leaq 0x18(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rdx
callq 0x2e388
movl $0x0, 0x56629(%rip)     # 0x611c8
leaq 0x7abe(%rip), %rax      # 0x12664
leaq 0x5679b(%rip), %rcx     # 0x61348
movq %rax, (%rcx)
movq %r14, %rdi
callq 0x2e4db
testl %eax, %eax
jne 0xad22
leaq 0x18(%rsp), %r14
leaq 0x56694(%rip), %r15     # 0x61260
leaq 0x56695(%rip), %r12     # 0x61268
leaq 0x56bce(%rip), %r13     # 0x617a8
leaq 0x565ff(%rip), %rbp     # 0x611e0
movq %r14, %rdi
callq 0x2e40d
cmpl $0x52, %eax
jle 0xac1d
cmpl $0x63, %eax
jg 0xac67
cmpl $0x53, %eax
je 0xacb4
cmpl $0x54, %eax
je 0xacf8
cmpl $0x63, %eax
jne 0xb1d2
movl $0x1, 0x39c90(%rip)     # 0x448a8
jmp 0xad12
cmpl $0x48, %eax
jg 0xac86
cmpl $0x39, %eax
je 0xacec
cmpl $0x47, %eax
jne 0xb1cf
movq 0x18(%rsp), %rax
movzbl (%rax), %ecx
cmpl $0x6d, %ecx
je 0xacfe
cmpl $0x65, %ecx
jne 0xb1c1
cmpb $0x0, 0x1(%rax)
jne 0xb1c1
movl $0x0, 0x56566(%rip)     # 0x611c8
jmp 0xad12
cmpl $0x64, %eax
je 0xacc0
cmpl $0x6f, %eax
jne 0xb1ca
movq 0x18(%rsp), %rax
movq %rax, 0x5653f(%rip)     # 0x611c0
jmp 0xad12
cmpl $0x49, %eax
je 0xaca2
cmpl $0x4f, %eax
jne 0xb1d2
movq 0x18(%rsp), %rax
movq %rax, 0x56530(%rip)     # 0x611d0
jmp 0xad12
movq 0x18(%rsp), %rdx
movq %r15, %rdi
movq %r12, %rsi
callq 0x2ceff
jmp 0xad12
movl $0x1, 0x5651a(%rip)     # 0x611d8
jmp 0xad12
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0xad12
cmpb $0x0, (%rax)
je 0xad12
incq %rax
movq %rax, 0x18(%rsp)
movzbl -0x1(%rax), %ecx
andl $0x7f, %ecx
incb (%rcx,%rbp)
cmpb $0x0, (%rax)
leaq 0x1(%rax), %rax
jne 0xacd2
jmp 0xad12
movl $0x2, 0x564d2(%rip)     # 0x611c8
jmp 0xad12
incl (%r13)
jmp 0xad12
cmpb $0x0, 0x1(%rax)
jne 0xb1c1
movl $0x1, 0x564b6(%rip)     # 0x611c8
movq %r14, %rdi
callq 0x2e4db
testl %eax, %eax
je 0xabe1
leaq 0x56537(%rip), %rdi     # 0x61260
leaq 0x56538(%rip), %rsi     # 0x61268
leaq 0x26d74(%rip), %rdx     # 0x31aab
callq 0x2ceff
movq 0x28(%rsp), %rax
cmpq $0x1, %rax
je 0xad5b
testq %rax, %rax
je 0xb1e1
movq $0x0, 0x56465(%rip) # 0x611c0
xorl %r12d, %r12d
leaq 0x8(%rsp), %r14
leaq 0x10(%rsp), %r13
xorl %r15d, %r15d
movq 0x5644e(%rip), %rdi     # 0x611c0
testq %rdi, %rdi
jne 0xad80
movq 0x20(%rsp), %rax
movq (%rax,%r15,8), %rdi
callq 0xb2c5
movq %rax, 0x564e4(%rip)     # 0x61270
movq 0x20(%rsp), %rax
movq (%rax), %rsi
leaq 0x564dd(%rip), %rdi     # 0x61278
callq 0x1d334
movq 0x20(%rsp), %rax
movq (%rax,%r15,8), %rdi
callq 0x21068
callq 0x14c3c
cmpb $0x0, 0x5647a(%rip)     # 0x61234
je 0xadcb
movq 0x3920d(%rip), %rax     # 0x43fd0
movq (%rax), %rdi
callq 0x130ae
callq 0x26efe
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
xorl %esi, %esi
leaq 0x26d47(%rip), %rdx     # 0x31b25
callq 0x1dfda
movq 0x5651e(%rip), %rdi     # 0x61308
movq %rax, %rsi
callq 0x20250
testq %rax, %rax
je 0xae44
movq 0x20(%rax), %rax
cmpq $0x0, 0x18(%rax)
jne 0xae44
movq 0x564bf(%rip), %rdi     # 0x612c8
movq 0x564c0(%rip), %rsi     # 0x612d0
movq 0x564e1(%rip), %rdx     # 0x612f8
leaq 0x26cb6(%rip), %rcx     # 0x31ad4
callq 0x1fa33
movq 0x564ae(%rip), %rdi     # 0x612d8
movq 0x564af(%rip), %rsi     # 0x612e0
movq 0x564c8(%rip), %rdx     # 0x61300
leaq 0x26c9e(%rip), %rcx     # 0x31add
callq 0x1fa33
callq 0x1761e
xorl %edi, %edi
callq 0x13b60
cmpb $0x0, 0x563fd(%rip)     # 0x61254
je 0xae68
movq 0x39170(%rip), %rax     # 0x43fd0
movq (%rax), %rdi
callq 0x130ae
cmpl $0x0, 0x56369(%rip)     # 0x611d8
je 0xae98
cmpq $0x0, 0x56347(%rip)     # 0x611c0
je 0xaf1e
leaq 0x160(%rsp), %rdi
leaq 0x26c58(%rip), %rsi     # 0x31ae6
callq 0xb2f4
jmp 0xaf47
movq 0x20(%rsp), %rax
movq (%rax,%r15,8), %rbx
leaq 0x26c82(%rip), %rdi     # 0x31b2a
callq 0x4030
movq %rax, %rbp
movq %rbx, %rdi
movl $0x2f, %esi
callq 0x4160
leaq 0x1(%rax), %r12
testq %rax, %rax
cmoveq %rbx, %r12
testq %rbp, %rbp
leaq 0x26c5f(%rip), %rax     # 0x31b31
cmoveq %rax, %rbp
leaq 0x60(%rsp), %rdi
xorl %esi, %esi
callq 0x4170
movq 0x60(%rsp), %r8
movq 0x68(%rsp), %r9
movl $0x400, %esi            # imm = 0x400
leaq 0x160(%rsp), %rdi
leaq 0x26c36(%rip), %rdx     # 0x31b36
movq %rbp, %rcx
xorl %eax, %eax
leaq 0x26bda(%rip), %r10     # 0x31ae6
pushq %r10
pushq %r12
xorl %r12d, %r12d
callq 0x2dfae
addq $0x10, %rsp
jmp 0xaf47
movq 0x20(%rsp), %rax
movq (%rax,%r15,8), %rdx
movl $0x400, %esi            # imm = 0x400
leaq 0x160(%rsp), %rdi
leaq 0x26bae(%rip), %rcx     # 0x31ae9
leaq 0x26ba4(%rip), %r8      # 0x31ae6
callq 0x2e125
cmpq $0x0, 0x56271(%rip)     # 0x611c0
je 0xaf67
leaq 0x60(%rsp), %rbp
movq %rbp, %rdi
leaq 0x2d136(%rip), %rsi     # 0x38096
callq 0xb2f4
jmp 0xafdd
movq 0x20(%rsp), %rax
movq (%rax,%r15,8), %rbp
movq %rbp, %rdi
movl $0x2b, %esi
callq 0x4160
movq %rax, %rbx
movq 0x56249(%rip), %rcx     # 0x611d0
testq %rcx, %rcx
je 0xafa6
movl $0x100, %esi            # imm = 0x100
leaq 0x60(%rsp), %rdi
leaq 0x26bab(%rip), %rdx     # 0x31b48
xorl %eax, %eax
callq 0x2dfae
jmp 0xafa8
xorl %eax, %eax
movl $0x100, %esi            # imm = 0x100
subq %rax, %rsi
leaq (%rsp,%rax), %rdi
addq $0x60, %rdi
movq %rbp, %rdx
testq %rbx, %rbx
je 0xafc5
movq %rbx, %rcx
jmp 0xafcc
leaq 0x26b1d(%rip), %rcx     # 0x31ae9
leaq 0x2d0c3(%rip), %r8      # 0x38096
callq 0x2e125
leaq 0x60(%rsp), %rbp
movq %rbp, %rdi
callq 0xb354
movq %rbp, %rdi
leaq 0x248f4(%rip), %rsi     # 0x2f8e3
callq 0x42e0
testq %rax, %rax
je 0xb197
movq %rax, %rbx
movq %rax, %rdi
callq 0x26f3a
movq %rbx, %rdi
callq 0x4110
leaq 0x160(%rsp), %rdi
callq 0x58b3
movq 0x5619c(%rip), %rsi     # 0x611c0
testq %rsi, %rsi
je 0xb038
movl $0x100, %edx            # imm = 0x100
movq %rbp, %rdi
callq 0x4090
jmp 0xb0ae
movq 0x20(%rsp), %rax
movq (%rax,%r15,8), %rbp
movq %rbp, %rdi
movl $0x2b, %esi
callq 0x4160
movq %rax, %rbx
movq 0x56178(%rip), %rcx     # 0x611d0
testq %rcx, %rcx
je 0xb077
movl $0x100, %esi            # imm = 0x100
leaq 0x60(%rsp), %rdi
leaq 0x26ada(%rip), %rdx     # 0x31b48
xorl %eax, %eax
callq 0x2dfae
jmp 0xb079
xorl %eax, %eax
movl $0x100, %esi            # imm = 0x100
subq %rax, %rsi
leaq (%rsp,%rax), %rdi
addq $0x60, %rdi
movq %rbp, %rdx
testq %rbx, %rbx
je 0xb096
movq %rbx, %rcx
jmp 0xb09d
leaq 0x26a4c(%rip), %rcx     # 0x31ae9
leaq 0x26afa(%rip), %r8      # 0x31b9e
callq 0x2e125
leaq 0x60(%rsp), %rbp
movq %rbp, %rdi
callq 0xb354
movq %r12, 0x8(%rsp)
movq %r12, 0x10(%rsp)
leaq 0x38581(%rip), %rbx     # 0x43648
leaq 0x26aca(%rip), %rdx     # 0x31b98
movq %r14, %rdi
movq %r13, %rsi
callq 0x2ceff
movq (%rbx), %rdx
addq $0x8, %rbx
testq %rdx, %rdx
jne 0xb0ce
movq %r14, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x2ceff
movq %r14, %rdi
movq %r13, %rsi
leaq 0x160(%rsp), %rdx
callq 0x2ceff
movq %r14, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x2ceff
callq 0x4360
testl %eax, %eax
je 0xb141
cmpl $-0x1, %eax
je 0xb1b3
movl %eax, %edi
leaq 0x4(%rsp), %rsi
xorl %edx, %edx
callq 0x42c0
movzwl 0x4(%rsp), %eax
testl $0xff7f, %eax           # imm = 0xFF7F
je 0xb153
jmp 0xb1a1
movq 0x8(%rsp), %rsi
movq (%rsi), %rdi
callq 0x4310
cmpl $-0x1, %eax
je 0xb1aa
cmpl $0x0, 0x5607e(%rip)     # 0x611d8
jne 0xb169
leaq 0x160(%rsp), %rdi
callq 0x4080
movq 0x56100(%rip), %rdi     # 0x61270
callq 0x4040
incq %r15
cmpq 0x28(%rsp), %r15
jb 0xad6b
xorl %eax, %eax
addq $0x568, %rsp            # imm = 0x568
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x60(%rsp), %rdi
callq 0x43d5
leaq 0x26a20(%rip), %rdi     # 0x31bc8
jmp 0xb1ba
leaq 0x269fe(%rip), %rdi     # 0x31baf
jmp 0xb1ba
leaq 0x269e7(%rip), %rdi     # 0x31ba1
xorl %eax, %eax
callq 0x13844
leaq 0x268c9(%rip), %rdi     # 0x31a91
jmp 0xb1ba
cmpl $0x68, %eax
jmp 0xb1d2
cmpl $0x3f, %eax
movq (%rbx), %rdi
callq 0xb1e6
xorl %edi, %edi
callq 0x4320
callq 0x43b0