// File: /workspace/github_c_makefile_star2_O2/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 $0x578, %rsp            # imm = 0x578
movq %rsi, %rbx
andq $0x0, 0x5422c(%rip)     # 0x5e1c0
movslq %edi, %rcx
leaq 0x23ae2(%rip), %rsi     # 0x2da80
leaq 0x28(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rdx
callq 0x2ad86
andl $0x0, 0x54213(%rip)     # 0x5e1c8
leaq 0x6f98(%rip), %rax      # 0x10f54
leaq 0x54385(%rip), %rcx     # 0x5e348
movq %rax, (%rcx)
leaq 0x54293(%rip), %r15     # 0x5e260
leaq 0x54294(%rip), %r12     # 0x5e268
leaq 0x547cd(%rip), %r13     # 0x5e7a8
leaq 0x541fe(%rip), %rbp     # 0x5e1e0
movq %r14, %rdi
callq 0x2aeda
testl %eax, %eax
jne 0xa119
movq %r14, %rdi
callq 0x2ae04
cmpl $0x39, %eax
je 0xa0e0
cmpl $0x47, %eax
je 0xa06a
cmpl $0x49, %eax
je 0xa049
cmpl $0x4f, %eax
je 0xa0ef
cmpl $0x53, %eax
je 0xa0d1
cmpl $0x54, %eax
je 0xa0c8
cmpl $0x63, %eax
je 0xa05b
cmpl $0x64, %eax
je 0xa09a
cmpl $0x6f, %eax
jne 0xa5f5
movq 0x28(%rsp), %rax
movq %rax, 0x54179(%rip)     # 0x5e1c0
jmp 0x9fe2
movq 0x28(%rsp), %rdx
movq %r15, %rdi
movq %r12, %rsi
callq 0x29b2d
jmp 0x9fe2
movl $0x1, 0x37843(%rip)     # 0x418a8
jmp 0x9fe2
movq 0x28(%rsp), %rax
movzbl (%rax), %ecx
cmpl $0x6d, %ecx
je 0xa100
cmpl $0x65, %ecx
jne 0xa60c
cmpb $0x0, 0x1(%rax)
jne 0xa60c
andl $0x0, 0x54133(%rip)     # 0x5e1c8
jmp 0x9fe2
movq 0x28(%rsp), %rax
testq %rax, %rax
je 0x9fe2
cmpb $0x0, (%rax)
je 0x9fe2
leaq 0x1(%rax), %rcx
movq %rcx, 0x28(%rsp)
movzbl (%rax), %eax
andl $0x7f, %eax
incb (%rax,%rbp)
movq %rcx, %rax
jmp 0xa09f
incl (%r13)
jmp 0x9fe2
movl $0x1, 0x540fd(%rip)     # 0x5e1d8
jmp 0x9fe2
movl $0x2, 0x540de(%rip)     # 0x5e1c8
jmp 0x9fe2
movq 0x28(%rsp), %rax
movq %rax, 0x540d5(%rip)     # 0x5e1d0
jmp 0x9fe2
cmpb $0x0, 0x1(%rax)
jne 0xa60c
movl $0x1, 0x540b4(%rip)     # 0x5e1c8
jmp 0x9fe2
leaq 0x54140(%rip), %rdi     # 0x5e260
leaq 0x54141(%rip), %rsi     # 0x5e268
leaq 0x2397d(%rip), %rdx     # 0x2daab
callq 0x29b2d
movq 0x38(%rsp), %rax
cmpq $0x1, %rax
je 0xa14f
testq %rax, %rax
je 0xa61a
andq $0x0, 0x54071(%rip)     # 0x5e1c0
leaq 0x54122(%rip), %r12     # 0x5e278
leaq 0x239c8(%rip), %rbp     # 0x2db25
leaq 0x70(%rsp), %r15
leaq 0x18(%rsp), %r14
leaq 0x20(%rsp), %r13
xorl %ebx, %ebx
cmpq %rax, %rbx
jae 0xa5a1
movq 0x54042(%rip), %rdi     # 0x5e1c0
testq %rdi, %rdi
jne 0xa18c
movq 0x30(%rsp), %rax
movq (%rax,%rbx,8), %rdi
callq 0xa717
movq %rax, 0x540d8(%rip)     # 0x5e270
movq 0x30(%rsp), %rax
movq (%rax), %rsi
movq %r12, %rdi
callq 0x1b50c
movq 0x30(%rsp), %rax
movq (%rax,%rbx,8), %rdi
callq 0x1e98c
callq 0x1332c
cmpb $0x0, 0x54072(%rip)     # 0x5e234
je 0xa1d3
movq 0x36e05(%rip), %rax     # 0x40fd0
movq (%rax), %rdi
callq 0x118e2
callq 0x23fd0
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
xorl %esi, %esi
movq %rbp, %rdx
callq 0x1bd23
movq 0x5411a(%rip), %rdi     # 0x5e308
movq %rax, %rsi
callq 0x1dc67
testq %rax, %rax
je 0xa248
movq 0x20(%rax), %rax
cmpq $0x0, 0x18(%rax)
jne 0xa248
movq 0x540bb(%rip), %rdi     # 0x5e2c8
movq 0x540bc(%rip), %rsi     # 0x5e2d0
movq 0x540dd(%rip), %rdx     # 0x5e2f8
leaq 0x238b2(%rip), %rcx     # 0x2dad4
callq 0x1d4b1
movq 0x540aa(%rip), %rdi     # 0x5e2d8
movq 0x540ab(%rip), %rsi     # 0x5e2e0
movq 0x540c4(%rip), %rdx     # 0x5e300
leaq 0x2389a(%rip), %rcx     # 0x2dadd
callq 0x1d4b1
callq 0x15d4b
xorl %edi, %edi
callq 0x12349
cmpb $0x0, 0x53ff9(%rip)     # 0x5e254
je 0xa26c
movq 0x36d6c(%rip), %rax     # 0x40fd0
movq (%rax), %rdi
callq 0x118e2
cmpl $0x0, 0x53f65(%rip)     # 0x5e1d8
movq %rbx, 0x8(%rsp)
je 0xa2a1
cmpq $0x0, 0x53f3e(%rip)     # 0x5e1c0
je 0xa339
leaq 0x170(%rsp), %rdi
leaq 0x2384f(%rip), %rsi     # 0x2dae6
callq 0xa744
jmp 0xa362
movq 0x30(%rsp), %rax
movq 0x8(%rsp), %rcx
movq (%rax,%rcx,8), %rbx
leaq 0x23874(%rip), %rdi     # 0x2db2a
callq 0x4030
movq %r15, %rbp
movq %rax, %r15
movq %rbx, %rdi
pushq $0x2f
popq %rsi
callq 0x4160
leaq 0x1(%rax), %r12
testq %rax, %rax
cmoveq %rbx, %r12
movq 0x8(%rsp), %rbx
testq %r15, %r15
leaq 0x2384b(%rip), %rax     # 0x2db31
cmoveq %rax, %r15
movq %rbp, %rdi
xorl %esi, %esi
callq 0x4170
movq 0x70(%rsp), %r8
movq 0x78(%rsp), %r9
movl $0x400, %esi            # imm = 0x400
leaq 0x170(%rsp), %rdi
leaq 0x23824(%rip), %rdx     # 0x2db36
movq %r15, %rcx
xorl %eax, %eax
leaq 0x237c8(%rip), %r10     # 0x2dae6
pushq %r10
pushq %r12
leaq 0x53f4f(%rip), %r12     # 0x5e278
leaq 0x237f5(%rip), %rbp     # 0x2db25
callq 0x2a9bf
popq %rcx
popq %rdx
jmp 0xa362
movq 0x30(%rsp), %rax
movq (%rax,%rbx,8), %rdx
movl $0x400, %esi            # imm = 0x400
leaq 0x170(%rsp), %rdi
leaq 0x23793(%rip), %rcx     # 0x2dae9
leaq 0x23789(%rip), %r8      # 0x2dae6
callq 0x2ab21
cmpq $0x0, 0x53e56(%rip)     # 0x5e1c0
je 0xa382
leaq 0x70(%rsp), %r15
movq %r15, %rdi
leaq 0x29d2b(%rip), %rsi     # 0x340a6
callq 0xa744
jmp 0xa3f6
movq 0x30(%rsp), %rax
movq (%rax,%rbx,8), %r15
movq %r15, %rdi
pushq $0x2b
popq %rsi
callq 0x4160
movq %rax, %rbx
movq 0x53e30(%rip), %rcx     # 0x5e1d0
testq %rcx, %rcx
je 0xa3bf
movl $0x100, %esi            # imm = 0x100
leaq 0x70(%rsp), %rdi
leaq 0x23792(%rip), %rdx     # 0x2db48
xorl %eax, %eax
callq 0x2a9bf
jmp 0xa3c1
xorl %eax, %eax
movl $0x100, %esi            # imm = 0x100
subq %rax, %rsi
leaq (%rsp,%rax), %rdi
addq $0x70, %rdi
movq %r15, %rdx
testq %rbx, %rbx
je 0xa3de
movq %rbx, %rcx
jmp 0xa3e5
leaq 0x23704(%rip), %rcx     # 0x2dae9
leaq 0x29cba(%rip), %r8      # 0x340a6
callq 0x2ab21
leaq 0x70(%rsp), %r15
movq %r15, %rdi
callq 0xa7a2
movq %r15, %rdi
leaq 0x214db(%rip), %rsi     # 0x2b8e3
callq 0x42e0
testq %rax, %rax
je 0xa5b5
movq %rax, %rbx
movq %rax, %rdi
callq 0x24006
movq %rbx, %rdi
callq 0x4110
leaq 0x170(%rsp), %rdi
callq 0x5233
movq 0x53d83(%rip), %rsi     # 0x5e1c0
testq %rsi, %rsi
je 0xa451
movl $0x100, %edx            # imm = 0x100
movq %r15, %rdi
callq 0x4090
jmp 0xa4ca
movq 0x30(%rsp), %rax
movq 0x8(%rsp), %rcx
movq (%rax,%rcx,8), %r15
movq %r15, %rdi
pushq $0x2b
popq %rsi
callq 0x4160
movq %rax, %rbx
movq 0x53d5c(%rip), %rcx     # 0x5e1d0
testq %rcx, %rcx
je 0xa493
movl $0x100, %esi            # imm = 0x100
leaq 0x70(%rsp), %rdi
leaq 0x236be(%rip), %rdx     # 0x2db48
xorl %eax, %eax
callq 0x2a9bf
jmp 0xa495
xorl %eax, %eax
movl $0x100, %esi            # imm = 0x100
subq %rax, %rsi
leaq (%rsp,%rax), %rdi
addq $0x70, %rdi
movq %r15, %rdx
testq %rbx, %rbx
je 0xa4b2
movq %rbx, %rcx
jmp 0xa4b9
leaq 0x23630(%rip), %rcx     # 0x2dae9
leaq 0x236de(%rip), %r8      # 0x2db9e
callq 0x2ab21
leaq 0x70(%rsp), %r15
movq %r15, %rdi
callq 0xa7a2
andq $0x0, 0x18(%rsp)
andq $0x0, 0x20(%rsp)
leaq 0x3615b(%rip), %rbx     # 0x40640
movq (%rbx), %rdx
movq %r14, %rdi
movq %r13, %rsi
testq %rdx, %rdx
je 0xa4fe
callq 0x29b2d
addq $0x8, %rbx
jmp 0xa4e5
movq %r15, %rdx
callq 0x29b2d
movq %r14, %rdi
movq %r13, %rsi
leaq 0x170(%rsp), %rdx
callq 0x29b2d
movq %r14, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x29b2d
callq 0x4360
testl %eax, %eax
je 0xa55b
cmpl $-0x1, %eax
movq 0x8(%rsp), %rbx
je 0xa5da
movl %eax, %edi
leaq 0x14(%rsp), %rsi
xorl %edx, %edx
callq 0x42c0
movzwl 0x14(%rsp), %eax
testw $0xff7f, %ax            # imm = 0xFF7F
je 0xa572
jmp 0xa5e3
movq 0x18(%rsp), %rsi
movq (%rsi), %rdi
callq 0x4310
cmpl $-0x1, %eax
movq 0x8(%rsp), %rbx
je 0xa5ec
cmpl $0x0, 0x53c5f(%rip)     # 0x5e1d8
jne 0xa588
leaq 0x170(%rsp), %rdi
callq 0x4080
movq 0x53ce1(%rip), %rdi     # 0x5e270
callq 0x4040
incq %rbx
movq 0x38(%rsp), %rax
jmp 0xa16e
xorl %eax, %eax
addq $0x578, %rsp            # imm = 0x578
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x36a34(%rip), %rax     # 0x40ff0
movq (%rax), %rdi
leaq 0x23586(%rip), %rsi     # 0x2db4c
leaq 0x70(%rsp), %rdx
xorl %eax, %eax
callq 0x4240
pushq $0x1
popq %rdi
callq 0x4320
leaq 0x235c0(%rip), %rdi     # 0x2dba1
jmp 0xa613
leaq 0x235de(%rip), %rdi     # 0x2dbc8
jmp 0xa613
leaq 0x235bc(%rip), %rdi     # 0x2dbaf
jmp 0xa613
cmpl $0x3f, %eax
je 0xa5fd
cmpl $0x68, %eax
movq (%rbx), %rdi
callq 0xa638
xorl %edi, %edi
callq 0x4320
leaq 0x2347e(%rip), %rdi     # 0x2da91
xorl %eax, %eax
callq 0x1205c
movq 0x369cf(%rip), %rax     # 0x40ff0
movq (%rax), %rcx
leaq 0x23493(%rip), %rdi     # 0x2dabe
pushq $0x15
popq %rsi
pushq $0x1
popq %rdx
callq 0x4330
jmp 0xa5d2