// File: /workspace/github_cpp_makefile_star2_O3/yanlinlin82[P]icpp/icpp.cpp
// Function: add_external_symbol(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int)
void add_external_symbol(string name, string args_type, string ret_type = "", int arg_count = 0)
{
	// for variable arguments, arg_count is negative, and the number is fixed arguments.
	// for example
	//   `int printf(const char* fmt, ...)`, arg_count is -1
	//   `int fprintf(FILE*, const char* fmt, ...)`, arg_count is -2
	// in runtime, an integer is appended after variable arguments, specifying their numbers.
	//   the number, as in stdcall calling convention (which means the arguments are pushed into
	//   stack as the order in source code, and this interpreter follows this rule), could be
	//   found as [bp + 1] in subroutine (before ENTER)
	if (ret_type.empty()) { // data
		size_t offset = data_sec.size();
		add_symbol(name, false, offset, 1, args_type, "", 0);
		data_sec.resize(offset + 1);
	} else { // code
		size_t offset = code_sec.size();
		string name_with_args = name + "(" + args_type + ")";
		override_functions[name].insert(name_with_args);
		add_symbol(name_with_args, true, offset, 2, args_type, ret_type, arg_count);
		add_assembly_code(RET, (arg_count >= 0 ? arg_count : 0), ret_type + " " + name_with_args);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movl %ecx, -0x2c(%rbp)
movq %rsi, %r12
movq %rdi, %r13
cmpq $0x0, 0x8(%rdx)
je 0x5083
movq %rdx, %rbx
movq 0x1e30d(%rip), %r15     # 0x23318
subq 0x1e2fe(%rip), %r15     # 0x23310
leaq -0x80(%rbp), %rax
movq %rax, -0x10(%rax)
movq (%r13), %rsi
movq 0x8(%r13), %rdx
addq %rsi, %rdx
leaq -0x90(%rbp), %r14
movq %r14, %rdi
callq 0x16942
leaq 0x16989(%rip), %rsi     # 0x1b9c4
movq %r14, %rdi
callq 0x3360
movq (%r12), %rsi
movq 0x8(%r12), %rdx
leaq -0x90(%rbp), %rdi
callq 0x30c0
leaq -0x40(%rbp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x518f
movq %rdx, -0x50(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x40(%rbp)
jmp 0x5196
movq 0x1e2a6(%rip), %rbx     # 0x23330
subq 0x1e297(%rip), %rbx     # 0x23328
leaq -0x160(%rbp), %r14
movq %r14, -0x10(%r14)
movq (%r13), %rsi
movq 0x8(%r13), %rdx
addq %rsi, %rdx
leaq -0x170(%rbp), %rdi
callq 0x16942
leaq -0x140(%rbp), %r15
movq %r15, -0x10(%r15)
movq (%r12), %rsi
movq 0x8(%r12), %rdx
addq %rsi, %rdx
leaq -0x150(%rbp), %rdi
callq 0x16942
leaq -0x120(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x17398(%rip), %rdx     # 0x1c481
leaq -0x130(%rbp), %rdi
movq %rdx, %rsi
callq 0x169e0
sarq $0x2, %rbx
movl $0x0, (%rsp)
leaq -0x170(%rbp), %rdi
leaq -0x150(%rbp), %r8
leaq -0x130(%rbp), %r9
movl $0x1, %ecx
xorl %esi, %esi
movq %rbx, %rdx
callq 0x4262
movq -0x130(%rbp), %rdi
cmpq %r12, %rdi
je 0x5142
movq -0x120(%rbp), %rsi
incq %rsi
callq 0x31d0
movq -0x150(%rbp), %rdi
cmpq %r15, %rdi
je 0x515d
movq -0x140(%rbp), %rsi
incq %rsi
callq 0x31d0
movq -0x170(%rbp), %rdi
cmpq %r14, %rdi
je 0x5178
movq -0x160(%rbp), %rsi
incq %rsi
callq 0x31d0
incq %rbx
leaq 0x1e1a6(%rip), %rdi     # 0x23328
movq %rbx, %rsi
callq 0x152ca
jmp 0x542d
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rax), %rdx
leaq -0x50(%rbp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x169cd(%rip), %rsi     # 0x1bb85
callq 0x3360
leaq -0x60(%rbp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x51e1
movq %rdx, -0x70(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x60(%rbp)
jmp 0x51e7
movups (%rcx), %xmm0
movups %xmm0, (%rsi)
movq 0x8(%rax), %rdx
movq %rdx, -0x68(%rbp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq -0x50(%rbp), %rdi
cmpq %r14, %rdi
je 0x5213
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x31d0
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x522f
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x31d0
leaq 0x1e212(%rip), %rdi     # 0x23448
movq %r13, %rsi
callq 0x17f96
leaq -0x50(%rbp), %rdx
movq %rax, (%rdx)
leaq -0x70(%rbp), %rsi
movq %rax, %rdi
callq 0x18cfe
leaq -0x100(%rbp), %r13
movq %r13, -0x10(%r13)
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
addq %rsi, %rdx
leaq -0x110(%rbp), %rdi
callq 0x16942
leaq -0xe0(%rbp), %r14
movq %r14, -0x10(%r14)
movq (%r12), %rsi
movq 0x8(%r12), %rdx
addq %rsi, %rdx
leaq -0xf0(%rbp), %rdi
callq 0x16942
leaq -0xc0(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0xd0(%rbp), %rdi
callq 0x16942
sarq $0x2, %r15
movl -0x2c(%rbp), %eax
movl %eax, (%rsp)
leaq -0x110(%rbp), %rdi
leaq -0xf0(%rbp), %r8
leaq -0xd0(%rbp), %r9
movl $0x2, %ecx
movl $0x1, %esi
movq %r15, %rdx
callq 0x4262
movq -0xd0(%rbp), %rdi
cmpq %r12, %rdi
je 0x5304
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x31d0
movq -0xf0(%rbp), %rdi
cmpq %r14, %rdi
je 0x531f
movq -0xe0(%rbp), %rsi
incq %rsi
callq 0x31d0
movq -0x110(%rbp), %rdi
cmpq %r13, %rdi
leaq -0x40(%rbp), %r14
je 0x533e
movq -0x100(%rbp), %rsi
incq %rsi
callq 0x31d0
xorl %r15d, %r15d
movl -0x2c(%rbp), %eax
testl %eax, %eax
cmovgl %eax, %r15d
leaq -0x50(%rbp), %rdi
movq %r14, (%rdi)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
callq 0x16942
leaq 0x15f16(%rip), %rsi     # 0x1b27d
leaq -0x50(%rbp), %rdi
callq 0x3360
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
leaq -0x50(%rbp), %rdi
callq 0x30c0
leaq -0xa0(%rbp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x53ae
movq %rdx, -0xb0(%rbp)
movq (%rcx), %rdx
movq %rdx, -0xa0(%rbp)
jmp 0x53b5
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rax), %rsi
leaq -0xb0(%rbp), %rdx
movq %rsi, 0x8(%rdx)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movl $0x26, %edi
movl %r15d, %esi
callq 0x4d40
movq -0xb0(%rbp), %rdi
cmpq %r14, %rdi
je 0x53fb
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x31d0
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x5414
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x31d0
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x542d
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x31d0
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x130(%rbp), %rdi
cmpq %r12, %rdi
je 0x5462
movq -0x120(%rbp), %rsi
incq %rsi
callq 0x31d0
jmp 0x5462
movq %rax, %rbx
movq -0x150(%rbp), %rdi
cmpq %r15, %rdi
je 0x5482
movq -0x140(%rbp), %rsi
incq %rsi
callq 0x31d0
jmp 0x5482
movq %rax, %rbx
movq -0x170(%rbp), %rdi
cmpq %r14, %rdi
je 0x559f
movq -0x160(%rbp), %rsi
jmp 0x5597
movq %rax, %rbx
movq -0xb0(%rbp), %rdi
cmpq %r14, %rdi
je 0x54c1
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x31d0
jmp 0x54c1
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
jne 0x54e3
jmp 0x5586
movq %rax, %rbx
movq -0x50(%rbp), %rdi
cmpq %r14, %rdi
je 0x5586
movq -0x40(%rbp), %rsi
jmp 0x5544
jmp 0x5583
movq %rax, %rbx
movq -0xd0(%rbp), %rdi
cmpq %r12, %rdi
je 0x5511
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x31d0
jmp 0x5511
movq %rax, %rbx
movq -0xf0(%rbp), %rdi
cmpq %r14, %rdi
je 0x5531
movq -0xe0(%rbp), %rsi
incq %rsi
callq 0x31d0
jmp 0x5531
movq %rax, %rbx
movq -0x110(%rbp), %rdi
cmpq %r13, %rdi
je 0x5586
movq -0x100(%rbp), %rsi
incq %rsi
callq 0x31d0
jmp 0x5586
movq %rax, %rbx
movq -0x50(%rbp), %rdi
cmpq %r14, %rdi
je 0x556d
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x31d0
jmp 0x556d
jmp 0x556a
movq %rax, %rbx
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x559f
movq -0x80(%rbp), %rsi
jmp 0x5597
movq %rax, %rbx
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x559f
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x31d0
movq %rbx, %rdi
callq 0x3320