// File: /workspace/github_c_makefile_star2_O1/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, 0x56511(%rip) # 0x611c0
movslq %edi, %rcx
leaq 0x26db7(%rip), %rsi     # 0x31a70
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rdx
callq 0x2e808
movl $0x0, 0x564f5(%rip)     # 0x611c8
leaq 0x7b40(%rip), %rax      # 0x1281a
leaq 0x56667(%rip), %rcx     # 0x61348
movq %rax, (%rcx)
movq %r14, %rdi
callq 0x2e96f
testl %eax, %eax
jne 0xae5c
leaq 0x10(%rsp), %r14
leaq 0x56568(%rip), %rbp     # 0x61268
leaq 0x56aa1(%rip), %r15     # 0x617a8
leaq 0x564d2(%rip), %r13     # 0x611e0
movq %r14, %rdi
callq 0x2e88d
cmpl $0x52, %eax
jle 0xad4e
cmpl $0x63, %eax
jg 0xada7
cmpl $0x53, %eax
je 0xadf8
cmpl $0x54, %eax
je 0xae3d
cmpl $0x63, %eax
jne 0xb30f
movl $0x1, 0x39b5f(%rip)     # 0x448a8
jmp 0xae4c
cmpl $0x48, %eax
jg 0xadc6
cmpl $0x39, %eax
je 0xae31
cmpl $0x47, %eax
jne 0xb30c
movq 0x10(%rsp), %r12
movq %r12, %rdi
leaq 0x2d0a8(%rip), %rsi     # 0x37e1c
callq 0x4230
testl %eax, %eax
je 0xae42
movq %r12, %rdi
leaq 0x2aacd(%rip), %rsi     # 0x35858
callq 0x4230
testl %eax, %eax
jne 0xb31e
movl $0x1, 0x56426(%rip)     # 0x611c8
jmp 0xae4c
cmpl $0x64, %eax
je 0xae04
cmpl $0x6f, %eax
jne 0xb307
movq 0x10(%rsp), %rax
movq %rax, 0x563ff(%rip)     # 0x611c0
jmp 0xae4c
cmpl $0x49, %eax
je 0xade2
cmpl $0x4f, %eax
jne 0xb30f
movq 0x10(%rsp), %rax
movq %rax, 0x563f0(%rip)     # 0x611d0
jmp 0xae4c
movq 0x10(%rsp), %rdx
leaq 0x56472(%rip), %rdi     # 0x61260
movq %rbp, %rsi
callq 0x2d3ff
jmp 0xae4c
movl $0x1, 0x563d6(%rip)     # 0x611d8
jmp 0xae4c
movq 0x10(%rsp), %rax
testq %rax, %rax
je 0xae4c
cmpb $0x0, (%rax)
je 0xae4c
incq %rax
movq %rax, 0x10(%rsp)
movzbl -0x1(%rax), %ecx
andl $0x7f, %ecx
incb (%rcx,%r13)
cmpb $0x0, (%rax)
leaq 0x1(%rax), %rax
jne 0xae16
jmp 0xae4c
movl $0x2, 0x5638d(%rip)     # 0x611c8
jmp 0xae4c
incl (%r15)
jmp 0xae4c
movl $0x0, 0x5637c(%rip)     # 0x611c8
movq %r14, %rdi
callq 0x2e96f
testl %eax, %eax
je 0xad0e
leaq 0x563fd(%rip), %rdi     # 0x61260
leaq 0x563fe(%rip), %rsi     # 0x61268
leaq 0x26c2a(%rip), %rdx     # 0x31a9b
callq 0x2d3ff
movq 0x20(%rsp), %rax
cmpq $0x1, %rax
je 0xae95
testq %rax, %rax
je 0xb327
movq $0x0, 0x5632b(%rip) # 0x611c0
cmpq $0x0, 0x20(%rsp)
je 0xb2c9
xorl %r12d, %r12d
leaq 0x8(%rsp), %r14
leaq 0x58(%rsp), %r13
xorl %r15d, %r15d
movq 0x56308(%rip), %rdi     # 0x611c0
testq %rdi, %rdi
jne 0xaec6
movq 0x18(%rsp), %rax
movq (%rax,%r15,8), %rdi
callq 0xb40b
movq %rax, 0x5639e(%rip)     # 0x61270
movq 0x18(%rsp), %rax
movq (%rax), %rsi
leaq 0x56397(%rip), %rdi     # 0x61278
callq 0x1d584
movq 0x18(%rsp), %rax
movq (%rax,%r15,8), %rdi
callq 0x212e8
callq 0x14e94
cmpb $0x0, 0x56334(%rip)     # 0x61234
je 0xaf11
movq 0x390c7(%rip), %rax     # 0x43fd0
movq (%rax), %rdi
callq 0x13272
callq 0x273b0
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
xorl %esi, %esi
leaq 0x26bf1(%rip), %rdx     # 0x31b15
callq 0x1e22a
movq 0x563d8(%rip), %rdi     # 0x61308
movq %rax, %rsi
callq 0x2048b
testq %rax, %rax
je 0xaf8a
movq 0x20(%rax), %rax
cmpq $0x0, 0x18(%rax)
jne 0xaf8a
movq 0x56379(%rip), %rdi     # 0x612c8
movq 0x5637a(%rip), %rsi     # 0x612d0
movq 0x5639b(%rip), %rdx     # 0x612f8
leaq 0x26b60(%rip), %rcx     # 0x31ac4
callq 0x1fc74
movq 0x56368(%rip), %rdi     # 0x612d8
movq 0x56369(%rip), %rsi     # 0x612e0
movq 0x56382(%rip), %rdx     # 0x61300
leaq 0x26b48(%rip), %rcx     # 0x31acd
callq 0x1fc74
callq 0x17858
xorl %edi, %edi
callq 0x13d17
cmpb $0x0, 0x562b7(%rip)     # 0x61254
je 0xafae
movq 0x3902a(%rip), %rax     # 0x43fd0
movq (%rax), %rdi
callq 0x13272
cmpl $0x0, 0x56223(%rip)     # 0x611d8
je 0xafde
cmpq $0x0, 0x56201(%rip)     # 0x611c0
je 0xb064
leaq 0x160(%rsp), %rdi
leaq 0x26b02(%rip), %rsi     # 0x31ad6
callq 0xb43a
jmp 0xb08d
movq 0x18(%rsp), %rax
movq (%rax,%r15,8), %rbx
leaq 0x26b2c(%rip), %rdi     # 0x31b1a
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 0x26b09(%rip), %rax     # 0x31b21
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 0x26ae0(%rip), %rdx     # 0x31b26
movq %rbp, %rcx
xorl %eax, %eax
leaq 0x26a84(%rip), %r10     # 0x31ad6
pushq %r10
pushq %r12
xorl %r12d, %r12d
callq 0x2e42e
addq $0x10, %rsp
jmp 0xb08d
movq 0x18(%rsp), %rax
movq (%rax,%r15,8), %rdx
movl $0x400, %esi            # imm = 0x400
leaq 0x160(%rsp), %rdi
leaq 0x26a58(%rip), %rcx     # 0x31ad9
leaq 0x26a4e(%rip), %r8      # 0x31ad6
callq 0x2e5a5
cmpq $0x0, 0x5612b(%rip)     # 0x611c0
je 0xb0ad
leaq 0x60(%rsp), %rbp
movq %rbp, %rdi
leaq 0x2d020(%rip), %rsi     # 0x380c6
callq 0xb43a
jmp 0xb123
movq 0x18(%rsp), %rax
movq (%rax,%r15,8), %rbp
movq %rbp, %rdi
movl $0x2b, %esi
callq 0x4160
movq %rax, %rbx
movq 0x56103(%rip), %rcx     # 0x611d0
testq %rcx, %rcx
je 0xb0ec
movl $0x100, %esi            # imm = 0x100
leaq 0x60(%rsp), %rdi
leaq 0x26a55(%rip), %rdx     # 0x31b38
xorl %eax, %eax
callq 0x2e42e
jmp 0xb0ee
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 0xb10b
movq %rbx, %rcx
jmp 0xb112
leaq 0x269c7(%rip), %rcx     # 0x31ad9
leaq 0x2cfad(%rip), %r8      # 0x380c6
callq 0x2e5a5
leaq 0x60(%rsp), %rbp
movq %rbp, %rdi
callq 0xb49a
movq %rbp, %rdi
leaq 0x247ae(%rip), %rsi     # 0x2f8e3
callq 0x42e0
testq %rax, %rax
je 0xb2dd
movq %rax, %rbx
movq %rax, %rdi
callq 0x273ec
movq %rbx, %rdi
callq 0x4110
leaq 0x160(%rsp), %rdi
callq 0x5969
movq 0x56056(%rip), %rsi     # 0x611c0
testq %rsi, %rsi
je 0xb17e
movl $0x100, %edx            # imm = 0x100
movq %rbp, %rdi
callq 0x4090
jmp 0xb1f4
movq 0x18(%rsp), %rax
movq (%rax,%r15,8), %rbp
movq %rbp, %rdi
movl $0x2b, %esi
callq 0x4160
movq %rax, %rbx
movq 0x56032(%rip), %rcx     # 0x611d0
testq %rcx, %rcx
je 0xb1bd
movl $0x100, %esi            # imm = 0x100
leaq 0x60(%rsp), %rdi
leaq 0x26984(%rip), %rdx     # 0x31b38
xorl %eax, %eax
callq 0x2e42e
jmp 0xb1bf
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 0xb1dc
movq %rbx, %rcx
jmp 0xb1e3
leaq 0x268f6(%rip), %rcx     # 0x31ad9
leaq 0x269a4(%rip), %r8      # 0x31b8e
callq 0x2e5a5
leaq 0x60(%rsp), %rbp
movq %rbp, %rdi
callq 0xb49a
movq %r12, 0x8(%rsp)
movq %r12, 0x58(%rsp)
leaq 0x3843b(%rip), %rbx     # 0x43648
leaq 0x26974(%rip), %rdx     # 0x31b88
movq %r14, %rdi
movq %r13, %rsi
callq 0x2d3ff
movq (%rbx), %rdx
addq $0x8, %rbx
testq %rdx, %rdx
jne 0xb214
movq %r14, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x2d3ff
movq %r14, %rdi
movq %r13, %rsi
leaq 0x160(%rsp), %rdx
callq 0x2d3ff
movq %r14, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x2d3ff
callq 0x4360
testl %eax, %eax
je 0xb287
cmpl $-0x1, %eax
je 0xb2f9
movl %eax, %edi
leaq 0x4(%rsp), %rsi
xorl %edx, %edx
callq 0x42c0
movzwl 0x4(%rsp), %eax
testl $0xff7f, %eax           # imm = 0xFF7F
je 0xb299
jmp 0xb2f0
movq 0x8(%rsp), %rsi
movq (%rsi), %rdi
callq 0x4310
cmpl $-0x1, %eax
je 0xb2e7
cmpl $0x0, 0x55f38(%rip)     # 0x611d8
jne 0xb2af
leaq 0x160(%rsp), %rdi
callq 0x4080
movq 0x55fba(%rip), %rdi     # 0x61270
callq 0x4040
incq %r15
cmpq 0x20(%rsp), %r15
jb 0xaeb1
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 0x268b1(%rip), %rdi     # 0x31b9f
jmp 0xb300
leaq 0x268c1(%rip), %rdi     # 0x31bb8
jmp 0xb300
leaq 0x26891(%rip), %rdi     # 0x31b91
xorl %eax, %eax
callq 0x13a00
cmpl $0x68, %eax
jmp 0xb30f
cmpl $0x3f, %eax
movq (%rbx), %rdi
callq 0xb32c
xorl %edi, %edi
callq 0x4320
leaq 0x2675c(%rip), %rdi     # 0x31a81
jmp 0xb300
callq 0x43b0