// File: 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
subq $0x100, %rsp            # imm = 0x100
movq %rdx, -0xc8(%rbp)
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
leaq 0x4affd(%rip), %rdi     # 0x50700
leaq 0x4adce(%rip), %rsi     # 0x504d8
callq 0x1a2a0
movq %rax, -0x18(%rbp)
leaq 0x4afe6(%rip), %rdi     # 0x50700
callq 0x1a300
movq %rax, -0x20(%rbp)
leaq -0x18(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x1a2d0
testb $0x1, %al
jne 0x5736
jmp 0x5798
leaq 0x4ae1b(%rip), %rdi     # 0x50558
callq 0x19990
movq %rax, -0x50(%rbp)
leaq 0x4ae0b(%rip), %rdi     # 0x50558
callq 0x19990
movq %rax, -0x58(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x1a3a0
movq %rax, -0x48(%rbp)
movq %rdx, -0x40(%rbp)
leaq -0x38(%rbp), %rdi
leaq 0x4ad62(%rip), %rsi     # 0x504d8
leaq -0x48(%rbp), %rdx
callq 0x1a370
leaq 0x4af7a(%rip), %rdi     # 0x50700
leaq -0x38(%rbp), %rsi
callq 0x1a330
movq %rax, -0x68(%rbp)
movb %dl, -0x60(%rbp)
jmp 0x57bf
leaq 0x4adb9(%rip), %rdi     # 0x50558
callq 0x19990
movq %rax, -0xd0(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x1a3d0
movq -0xd0(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x4ad92(%rip), %rdi     # 0x50558
callq 0x19990
movq %rax, -0x70(%rbp)
movl -0x4(%rbp), %eax
movl %eax, -0x74(%rbp)
leaq 0x4ad7c(%rip), %rdi     # 0x50558
leaq -0x74(%rbp), %rsi
callq 0x1a400
movl -0x4(%rbp), %edi
callq 0x1a130
testb $0x1, %al
jne 0x57f3
jmp 0x5838
cmpl $0x25, -0x4(%rbp)
je 0x580b
cmpl $0x27, -0x4(%rbp)
je 0x580b
cmpl $0x28, -0x4(%rbp)
je 0x580b
cmpl $0x29, -0x4(%rbp)
jne 0x5828
leaq 0x4ad46(%rip), %rdi     # 0x50558
callq 0x19990
movq %rax, %rcx
addq $0x1, %rcx
movslq -0x8(%rbp), %rax
subq %rcx, %rax
movl %eax, -0x8(%rbp)
leaq 0x4ad29(%rip), %rdi     # 0x50558
leaq -0x8(%rbp), %rsi
callq 0x1a430
movq -0xc8(%rbp), %rdi
callq 0x3430
testb $0x1, %al
jne 0x58d7
movq -0xc8(%rbp), %rdx
leaq -0xa0(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
leaq -0x70(%rbp), %rsi
callq 0x19930
movq -0xe8(%rbp), %rsi
leaq 0x4ad38(%rip), %rdi     # 0x505b0
callq 0x198f0
movb %dl, -0xd9(%rbp)
movq %rax, -0xd8(%rbp)
jmp 0x588c
movb -0xd9(%rbp), %al
movq -0xd8(%rbp), %rcx
movq %rcx, -0xc0(%rbp)
movb %al, -0xb8(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x19970
jmp 0x58d7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x19970
jmp 0x5981
cmpl $0x3, 0x4af4a(%rip)     # 0x50828
jl 0x5974
movq 0x4aec5(%rip), %rax     # 0x507b0
movq %rax, -0xf0(%rbp)
leaq 0x4ac5f(%rip), %rdi     # 0x50558
callq 0x19990
movq %rax, %rcx
movq -0xf0(%rbp), %rax
cmpq %rcx, %rax
jae 0x5972
leaq 0x319f6(%rip), %rdi     # 0x3730a
movb $0x0, %al
callq 0x19420
movq 0x4ae8e(%rip), %rax     # 0x507b0
movq %rax, -0xf8(%rbp)
leaq 0x4ac28(%rip), %rdi     # 0x50558
callq 0x19990
movq %rax, %rcx
movq -0xf8(%rbp), %rax
cmpq %rcx, %rax
jae 0x5964
movq 0x4ae65(%rip), %rsi     # 0x507b0
leaq 0x4ac06(%rip), %rdi     # 0x50558
xorl %eax, %eax
movl %eax, %edx
callq 0x5530
movq %rax, 0x4ae4e(%rip)     # 0x507b0
jmp 0x591b
leaq 0x32a9a(%rip), %rdi     # 0x38405
movb $0x0, %al
callq 0x19420
jmp 0x5974
movq -0x70(%rbp), %rax
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
movq -0xa8(%rbp), %rdi
callq 0x3460
nopl (%rax)