// File: /workspace/github_c_makefile_star2_O1/Encryptr[P]O-plus-plus/opp/opp.c
// Function: opp_init_module
void opp_init_module(const char* fname, struct Opp_Options* opts)
{
	Opp_Stats stats = {0};
	struct Opp_Scan scan = {0};

	opp_init_file(fname, &scan);

	START_CLOCK();
	struct Opp_Parser* parser = opp_parser_init(&scan);
	opp_parser_begin(parser);
	END_CLOCK();
	GET_TIME(S_PARSER);

	START_CLOCK();
	struct Opp_Analize* ctx = opp_init_analize(parser, opts);
	analize_tree(ctx);
	END_CLOCK();
	GET_TIME(S_ANALIZE);

	START_CLOCK();
	struct Opp_Context* context = opp_init_compile(parser, opts);
	opp_compile(context);
	END_CLOCK();
	GET_TIME(S_COMPILER);

	START_CLOCK();
	context->oppir = init_oppir();
	oppir_get_opcodes(context->oppir, &context->ir);
	oppir_eval(context->oppir);
	OppIO io = { .file = fopen("out.o", "wb") };
	oppir_emit_obj(context->oppir, &io);
	END_CLOCK();
	GET_TIME(S_IR);
	fclose(io.file);


	if (opts->run_output) 
		system("gcc ./stdlib/testing.o out.o");

	if (opts->debug)
		opp_debug_info(&stats, context);

	oppir_free(context->oppir);
	opp_free_compiler(context);
	opp_free_analize(ctx);
	opp_free_parser(parser);
	opp_free_lex(&scan, false);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rsi, %r12
xorpd %xmm0, %xmm0
leaq 0x50(%rsp), %rbx
movapd %xmm0, 0x40(%rbx)
movapd %xmm0, 0x30(%rbx)
movapd %xmm0, 0x20(%rbx)
movapd %xmm0, 0x10(%rbx)
movapd %xmm0, (%rbx)
movq %rbx, %rsi
callq 0x132c
callq 0x1090
movq %rax, 0x18(%rsp)
movq %rbx, %rdi
callq 0x808c
movq %rax, %rbx
movq %rax, %rdi
callq 0x8435
callq 0x1090
movq %rax, 0x10(%rsp)
callq 0x1090
movq %rax, 0x8(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1bd0
movq %rax, 0x28(%rsp)
movq %rax, %rdi
callq 0x1c3f
callq 0x1090
movq %rax, %r13
callq 0x1090
movq %rax, (%rsp)
movq %rbx, 0x30(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x37b8
movq %rax, %r15
movq %rax, %rdi
callq 0x39d9
callq 0x1090
movq %rax, %r14
callq 0x1090
movq %rax, 0x20(%rsp)
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x5610
movq %rax, 0x60(%r15)
leaq 0x48(%r15), %rsi
movq %rax, %rdi
callq 0x5867
movq 0x60(%r15), %rdi
callq 0x5871
leaq 0x38(%rsp), %rbx
movq %rbp, (%rbx)
leaq 0x9b11(%rip), %rdi      # 0xb05b
leaq 0x9af0(%rip), %rsi      # 0xb041
callq 0x11e0
movq %rax, 0x8(%rbx)
movq %rbp, 0x10(%rbx)
movq 0x60(%r15), %rdi
movq %rbx, %rsi
callq 0x6861
callq 0x1090
movq %rax, %rbp
movq 0x8(%rbx), %rdi
callq 0x10a0
cmpb $0x1, 0x1(%r12)
jne 0x158f
leaq 0x9aba(%rip), %rdi      # 0xb044
callq 0x10d0
cmpb $0x1, 0x5(%r12)
jne 0x16f4
movq 0x10(%rsp), %rax
subq 0x18(%rsp), %rax
subq 0x8(%rsp), %r13
subq (%rsp), %r14
cvtsi2sd %rax, %xmm1
subq 0x20(%rsp), %rbp
movsd 0x9a48(%rip), %xmm0     # 0xb008
cvtsi2sd %r13, %xmm4
cvtsi2sd %r14, %xmm3
cvtsi2sd %rbp, %xmm2
divsd %xmm0, %xmm1
movsd %xmm1, 0x18(%rsp)
divsd %xmm0, %xmm4
movsd %xmm4, (%rsp)
divsd %xmm0, %xmm3
movsd %xmm3, 0x8(%rsp)
divsd %xmm0, %xmm2
movsd %xmm2, 0x10(%rsp)
leaq 0x9aa8(%rip), %rdi      # 0xb0a5
leaq 0x9ac6(%rip), %r12      # 0xb0ca
leaq 0x9c88(%rip), %r13      # 0xb293
movq %r12, %rsi
movq %r13, %rdx
xorl %eax, %eax
callq 0x10e0
movq (%r15), %rax
movq (%rax), %rax
movq 0x10(%rax), %rsi
leaq 0x9aa7(%rip), %rdi      # 0xb0d0
xorl %eax, %eax
callq 0x10e0
movq (%r15), %rax
movq (%rax), %rax
movq 0x20(%rax), %rsi
leaq 0x9a99(%rip), %rdi      # 0xb0da
xorl %eax, %eax
callq 0x10e0
leaq 0x9bdd(%rip), %rdi      # 0xb22c
callq 0x1060
leaq 0x9a8a(%rip), %rdi      # 0xb0e5
movsd 0x18(%rsp), %xmm0
movb $0x1, %al
callq 0x10e0
leaq 0x9a88(%rip), %rdi      # 0xb0f7
movsd (%rsp), %xmm0
movb $0x1, %al
callq 0x10e0
leaq 0x9a87(%rip), %rdi      # 0xb109
movsd 0x8(%rsp), %xmm0
movb $0x1, %al
callq 0x10e0
leaq 0x9a85(%rip), %rdi      # 0xb11b
movsd 0x10(%rsp), %xmm0
movb $0x1, %al
callq 0x10e0
movsd (%rsp), %xmm0
addsd 0x18(%rsp), %xmm0
addsd 0x8(%rsp), %xmm0
addsd 0x10(%rsp), %xmm0
leaq 0x9a6c(%rip), %rdi      # 0xb12d
movb $0x1, %al
callq 0x10e0
leaq 0x9b69(%rip), %rdi      # 0xb238
callq 0x1060
leaq 0x9b6a(%rip), %rdi      # 0xb245
callq 0x1060
leaq 0x9a52(%rip), %rdi      # 0xb139
movq %r12, %rsi
movq %r13, %rdx
xorl %eax, %eax
callq 0x10e0
movq 0x60(%r15), %rdi
callq 0x57a0
movq %r15, %rdi
callq 0x3845
movq 0x28(%rsp), %rdi
callq 0x1c3a
movq 0x30(%rsp), %rdi
callq 0x81de
leaq 0x50(%rsp), %rdi
xorl %esi, %esi
callq 0x9a71
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq