// File: /workspace/github_cpp_makefile_star2_O2/yanlinlin82[P]icpp/icpp.cpp
// Function: add_assembly_code(instruction, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
size_t add_assembly_code(instruction code, int param = 0, string comment = "")
{
	auto it = offset.find(line_no);
	if (it == offset.end()) {
		offset.insert(make_pair(line_no, make_pair(code_sec.size(), code_sec.size())));
	} else {
		it->second.second = code_sec.size();
	}
	size_t code_offset = code_sec.size();
	code_sec.push_back(code);
	if (instruction_has_parameter(code)) {
		if (code == CALL || code == JMP || code == JZ || code == JNZ) {
			param -= code_sec.size() + 1; // use relative address
		}
		code_sec.push_back(param);
	}
	if (!comment.empty()) {
		comments.insert(make_pair(code_offset, comment));
	}
	if (verbose >= 3) {
		if (next_display_instruction < code_sec.size()) {
			log(COLOR_BLUE);
			while (next_display_instruction < code_sec.size()) {
				next_display_instruction = print_code(code_sec, next_display_instruction);
			}
			log(COLOR_NORMAL);
		}
	}
	return code_offset;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
movq %rdx, %r14
movl %esi, %r15d
movl %edi, %r12d
movl %esi, -0x24(%rbp)
leaq 0x1ca5f(%rip), %rdi     # 0x214a8
leaq 0x1c830(%rip), %rsi     # 0x21280
callq 0x12d18
testq %rax, %rax
je 0x4a72
movq 0x1c8a7(%rip), %rbx     # 0x21308
subq 0x1c898(%rip), %rbx     # 0x21300
sarq $0x2, %rbx
movq %rbx, 0x18(%rax)
jmp 0x4ab8
movq 0x1c88f(%rip), %rax     # 0x21308
subq 0x1c880(%rip), %rax     # 0x21300
sarq $0x2, %rax
movq 0x1c7f5(%rip), %rcx     # 0x21280
leaq -0x50(%rbp), %rsi
movq %rcx, (%rsi)
movq %rax, 0x8(%rsi)
movq %rax, 0x10(%rsi)
leaq 0x1ca07(%rip), %rdi     # 0x214a8
callq 0x12da2
movq 0x1c85b(%rip), %rbx     # 0x21308
subq 0x1c84c(%rip), %rbx     # 0x21300
sarq $0x2, %rbx
leaq -0x50(%rbp), %rsi
movl %r12d, (%rsi)
leaq 0x1c83a(%rip), %rdi     # 0x21300
callq 0x130be
cmpl $0x29, %r12d
ja 0x4b1e
movl %r12d, %eax
movabsq $0x48000007f8, %rcx     # imm = 0x48000007F8
btq %rax, %rcx
jb 0x4b0e
movabsq $0x3a000000000, %rcx    # imm = 0x3A000000000
btq %rax, %rcx
jae 0x4b1e
movq 0x1c80d(%rip), %rax     # 0x21308
subq 0x1c7fe(%rip), %rax     # 0x21300
shrq $0x2, %rax
notl %eax
addl %r15d, %eax
movl %eax, -0x24(%rbp)
leaq 0x1c7eb(%rip), %rdi     # 0x21300
leaq -0x24(%rbp), %rsi
callq 0xf2e4
cmpq $0x0, 0x8(%r14)
je 0x4b50
leaq -0x48(%rbp), %r15
movq %rbx, -0x8(%r15)
movq %r15, %rdi
movq %r14, %rsi
callq 0x3270
leaq 0x1c819(%rip), %rdi     # 0x21358
leaq -0x50(%rbp), %rsi
callq 0x1197c
movq %r15, %rdi
callq 0x3368
cmpl $0x3, 0x1ca79(%rip)     # 0x215d0
jl 0x4bcb
movq 0x1c7a8(%rip), %rax     # 0x21308
subq 0x1c799(%rip), %rax     # 0x21300
sarq $0x2, %rax
cmpq %rax, 0x1c9e6(%rip)     # 0x21558
jae 0x4bcb
leaq 0x1184f(%rip), %rdi     # 0x163ca
xorl %eax, %eax
callq 0xf09e
movq 0x1c9cf(%rip), %rax     # 0x21558
leaq 0x1c770(%rip), %r14     # 0x21300
movq 0x1c771(%rip), %rcx     # 0x21308
subq 0x1c762(%rip), %rcx     # 0x21300
sarq $0x2, %rcx
cmpq %rcx, %rax
jae 0x4bbd
movq %r14, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x48e3
movq %rax, 0x1c99d(%rip)     # 0x21558
jmp 0x4b90
leaq 0x12901(%rip), %rdi     # 0x174c5
xorl %eax, %eax
callq 0xf09e
movq %rbx, %rax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %r15, %rdi
callq 0x3368
movq %rbx, %rdi
callq 0x3310