// File: /workspace/github_c_makefile_star2_O0/hsjoihs[P]c-compiler/main.c
// Function: main
int main(int argc, char const **argv)
{
	struct __FILE *fp = stdin;
	struct Vector macros = init_vector();

	for (int i = 1; i < argc; i++) {
		if (strncmp(argv[i], "-D", 2) == 0) {
			push_vector(&macros, argv[i] + 2);
		} else if (strncmp(argv[i], "--ir=", 5) == 0) {
			const char *ir_filename = argv[i] + 5;
			global_ir = fopen(ir_filename, "w");
			if (!global_ir) {
				fprintf(stderr, "failed to write to file `%s`.\n", ir_filename);
				exit(EXIT_FAILURE);
			}
		} else if (strcmp(argv[i], "-pedantic") == 0) {
			global_flag_pedantic = 1;
		} else {
			const char *filename = argv[i];
			fp = fopen(filename, "r");
			if (!fp) {
				fprintf(stderr, "failed to open file `%s`.\n", filename);
				exit(EXIT_FAILURE);
			}
		}
	}

	char *str = read_from_file(fp);
	const struct Token *tokvec = read_and_preprocess(str, &macros);
	++tokvec; /* skip the dummy token BEGINNING */
	const struct Vector /*<Toplevel>*/ vec = parse(tokvec);
	generate(&vec);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq 0x15fdb(%rip), %rax     # 0x1bfd8
movq (%rax), %rax
movq %rax, -0x18(%rbp)
callq 0x61d0
movq %rax, -0x28(%rbp)
movq %rdx, -0x20(%rbp)
movl $0x1, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x617c
movq -0x10(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xe471(%rip), %rsi      # 0x144a8
movl $0x2, %edx
callq 0x1030
cmpl $0x0, %eax
jne 0x6064
movq -0x10(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
addq $0x2, %rsi
leaq -0x28(%rbp), %rdi
callq 0x62c0
jmp 0x616c
movq -0x10(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xe434(%rip), %rsi      # 0x144ab
movl $0x5, %edx
callq 0x1030
cmpl $0x0, %eax
jne 0x60ec
movq -0x10(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
addq $0x5, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
leaq 0xe40c(%rip), %rsi      # 0x144b1
callq 0x1110
movq %rax, %rcx
leaq 0x16014(%rip), %rax     # 0x1c0c8
movq %rcx, (%rax)
leaq 0x1600a(%rip), %rax     # 0x1c0c8
cmpq $0x0, (%rax)
jne 0x60ea
movq 0x15f2d(%rip), %rax     # 0x1bff8
movq (%rax), %rdi
movq -0x38(%rbp), %rdx
leaq 0xe3da(%rip), %rsi      # 0x144b3
movb $0x0, %al
callq 0x10d0
movl $0x1, %edi
callq 0x1150
jmp 0x616a
movq -0x10(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xe3d3(%rip), %rsi      # 0x144d2
callq 0x10c0
cmpl $0x0, %eax
jne 0x6115
movl $0x1, 0x15fb1(%rip)     # 0x1c0c4
jmp 0x6168
movq -0x10(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
leaq 0xf35e(%rip), %rsi      # 0x1548e
callq 0x1110
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x6166
movq 0x15eb1(%rip), %rax     # 0x1bff8
movq (%rax), %rdi
movq -0x40(%rbp), %rdx
leaq 0xe387(%rip), %rsi      # 0x144dc
movb $0x0, %al
callq 0x10d0
movl $0x1, %edi
callq 0x1150
jmp 0x6168
jmp 0x616a
jmp 0x616c
jmp 0x616e
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x6018
movq -0x18(%rbp), %rdi
callq 0x11710
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0xecf0
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdi
callq 0x2a40
movq %rax, -0x60(%rbp)
movq %rdx, -0x58(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x1b50
xorl %eax, %eax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax,%rax)