// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x470, %rsp            # imm = 0x470
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, 0x6c9bc(%rip) # 0x7cce0
movq -0x10(%rbp), %rdx
movslq -0x8(%rbp), %rcx
leaq -0x458(%rbp), %rdi
leaq 0x3d482(%rip), %rsi     # 0x4d7bc
callq 0x4a7b0
movl $0x0, 0x6c99f(%rip)     # 0x7cce8
leaq 0x6cb18(%rip), %rax     # 0x7ce68
leaq 0xc129(%rip), %rcx      # 0x1c480
movq %rcx, (%rax)
leaq -0x458(%rbp), %rdi
callq 0x4ab60
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x10377
jmp 0x1052c
leaq -0x458(%rbp), %rdi
callq 0x4a920
addl $-0x39, %eax
movl %eax, %ecx
movq %rcx, -0x468(%rbp)
subl $0x36, %eax
ja 0x10514
movq -0x468(%rbp), %rax
leaq 0x3d33a(%rip), %rcx     # 0x4d6e0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x458(%rbp), %rax
movq %rax, 0x6c933(%rip)     # 0x7ccf0
jmp 0x10527
movq -0x458(%rbp), %rax
movq %rax, 0x6c910(%rip)     # 0x7cce0
jmp 0x10527
movl $0x1, 0x6c919(%rip)     # 0x7ccf8
jmp 0x10527
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x107a0
xorl %edi, %edi
callq 0x6310
movl $0x1, 0x4ffb7(%rip)     # 0x603b8
jmp 0x10527
jmp 0x10408
xorl %eax, %eax
cmpq $0x0, -0x458(%rbp)
movb %al, -0x469(%rbp)
je 0x10430
movq -0x458(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x469(%rbp)
movb -0x469(%rbp), %al
testb $0x1, %al
jne 0x1043c
jmp 0x10473
movq -0x458(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x458(%rbp)
movsbl (%rax), %eax
andl $0x7f, %eax
movslq %eax, %rcx
leaq 0x6c89f(%rip), %rax     # 0x7cd00
movb (%rax,%rcx), %dl
addb $0x1, %dl
leaq 0x6c892(%rip), %rax     # 0x7cd00
movb %dl, (%rax,%rcx)
jmp 0x10408
jmp 0x10527
movl $0x2, 0x6c866(%rip)     # 0x7cce8
jmp 0x10527
movq -0x458(%rbp), %rdi
leaq 0x43c59(%rip), %rsi     # 0x540ee
callq 0x6220
cmpl $0x0, %eax
jne 0x104ab
movl $0x0, 0x6c83f(%rip)     # 0x7cce8
jmp 0x104df
movq -0x458(%rbp), %rdi
leaq 0x41264(%rip), %rsi     # 0x5171d
callq 0x6220
cmpl $0x0, %eax
jne 0x104cf
movl $0x1, 0x6c81b(%rip)     # 0x7cce8
jmp 0x104dd
leaq 0x3d2f7(%rip), %rdi     # 0x4d7cd
movb $0x0, %al
callq 0x1df20
jmp 0x104df
jmp 0x10527
movq -0x458(%rbp), %rdx
leaq 0x6c891(%rip), %rdi     # 0x7cd80
leaq 0x6c892(%rip), %rsi     # 0x7cd88
callq 0x48290
jmp 0x10527
leaq 0x6cdc4(%rip), %rax     # 0x7d2c8
movl (%rax), %ecx
addl $0x1, %ecx
leaq 0x6cdb8(%rip), %rax     # 0x7d2c8
movl %ecx, (%rax)
jmp 0x10527
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x107a0
xorl %edi, %edi
callq 0x6310
jmp 0x1035a
leaq 0x6c84d(%rip), %rdi     # 0x7cd80
leaq 0x6c84e(%rip), %rsi     # 0x7cd88
leaq 0x3d2a6(%rip), %rdx     # 0x4d7e7
callq 0x48290
cmpq $0x0, -0x448(%rbp)
jne 0x10572
movq 0x4ea99(%rip), %rax     # 0x5eff0
movq (%rax), %rdi
leaq 0x3d299(%rip), %rsi     # 0x4d7fa
movb $0x0, %al
callq 0x6230
movl $0x1, %edi
callq 0x6310
cmpq $0x1, -0x448(%rbp)
jbe 0x10587
movq $0x0, 0x6c759(%rip) # 0x7cce0
jmp 0x10589
movq $0x0, -0x460(%rbp)
movq -0x460(%rbp), %rax
cmpq -0x448(%rbp), %rax
jae 0x10792
cmpq $0x0, 0x6c730(%rip)     # 0x7cce0
je 0x105c7
movq 0x6c727(%rip), %rdi     # 0x7cce0
callq 0x108c0
movq %rax, 0x6c7cb(%rip)     # 0x7cd90
jmp 0x105e5
movq -0x450(%rbp), %rax
movq -0x460(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x108c0
movq %rax, 0x6c7ab(%rip)     # 0x7cd90
movq -0x450(%rbp), %rax
movq (%rax), %rsi
leaq 0x6c7a2(%rip), %rdi     # 0x7cd98
callq 0x2f0c0
movq -0x450(%rbp), %rax
movq -0x460(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x34d90
callq 0x1ffe0
cmpb $0x0, 0x6c736(%rip)     # 0x7cd54
je 0x1062f
movq 0x4e9a9(%rip), %rax     # 0x5efd0
movq (%rax), %rdi
callq 0x1d440
callq 0x3e4f0
callq 0x10920
cmpl $0x0, %eax
je 0x10680
movq 0x6c7a3(%rip), %rdi     # 0x7cde8
movq 0x6c7a4(%rip), %rsi     # 0x7cdf0
movq 0x6c7c5(%rip), %rdx     # 0x7ce18
leaq 0x3d1b6(%rip), %rcx     # 0x4d810
callq 0x32530
movq 0x6c792(%rip), %rdi     # 0x7cdf8
movq 0x6c793(%rip), %rsi     # 0x7ce00
movq 0x6c7ac(%rip), %rdx     # 0x7ce20
leaq 0x3d19e(%rip), %rcx     # 0x4d819
callq 0x32530
callq 0x25cb0
xorl %edi, %edi
callq 0x1e3a0
cmpb $0x0, 0x6c6e1(%rip)     # 0x7cd74
je 0x106a4
movq 0x4e934(%rip), %rax     # 0x5efd0
movq (%rax), %rdi
callq 0x1d440
cmpl $0x0, 0x6c64d(%rip)     # 0x7ccf8
je 0x10704
cmpq $0x0, 0x6c62b(%rip)     # 0x7cce0
je 0x106d1
leaq -0x410(%rbp), %rdi
movl $0x400, %esi            # imm = 0x400
leaq 0x3d158(%rip), %rdx     # 0x4d822
callq 0x109b0
jmp 0x10702
leaq -0x410(%rbp), %rdi
movq -0x450(%rbp), %rax
movq -0x460(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movl $0x400, %esi            # imm = 0x400
leaq 0x3d12f(%rip), %rcx     # 0x4d825
leaq 0x3d125(%rip), %r8      # 0x4d822
callq 0x4a450
jmp 0x1072e
leaq -0x410(%rbp), %rdi
movq -0x450(%rbp), %rax
movq -0x460(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movl $0x400, %esi            # imm = 0x400
leaq 0x3d0f9(%rip), %rcx     # 0x4d822
callq 0x10a30
movq -0x450(%rbp), %rax
movq -0x460(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x10af0
leaq -0x410(%rbp), %rdi
callq 0x7d60
leaq -0x410(%rbp), %rdi
movq -0x450(%rbp), %rax
movq -0x460(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x10c60
movq 0x6c61a(%rip), %rdi     # 0x7cd90
callq 0x6040
movq -0x460(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x460(%rbp)
jmp 0x10594
xorl %eax, %eax
addq $0x470, %rsp            # imm = 0x470
popq %rbp
retq
nopl (%rax)