// File: /workspace/github_cpp_makefile_star2_O1/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 0x50e6
movq %rdx, %rbx
movq 0x1f2aa(%rip), %r15     # 0x24318
subq 0x1f29b(%rip), %r15     # 0x24310
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 0x16d2e
leaq 0x17926(%rip), %rsi     # 0x1c9c4
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 0x51f2
movq %rdx, -0x50(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x40(%rbp)
jmp 0x51f9
movq 0x1f243(%rip), %rbx     # 0x24330
subq 0x1f234(%rip), %rbx     # 0x24328
leaq -0x160(%rbp), %r14
movq %r14, -0x10(%r14)
movq (%r13), %rsi
movq 0x8(%r13), %rdx
addq %rsi, %rdx
leaq -0x170(%rbp), %rdi
callq 0x16d2e
leaq -0x140(%rbp), %r15
movq %r15, -0x10(%r15)
movq (%r12), %rsi
movq 0x8(%r12), %rdx
addq %rsi, %rdx
leaq -0x150(%rbp), %rdi
callq 0x16d2e
leaq -0x120(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x18335(%rip), %rdx     # 0x1d481
leaq -0x130(%rbp), %rdi
movq %rdx, %rsi
callq 0x16dc8
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 0x425f
movq -0x130(%rbp), %rdi
cmpq %r12, %rdi
je 0x51a5
movq -0x120(%rbp), %rsi
incq %rsi
callq 0x31d0
movq -0x150(%rbp), %rdi
cmpq %r15, %rdi
je 0x51c0
movq -0x140(%rbp), %rsi
incq %rsi
callq 0x31d0
movq -0x170(%rbp), %rdi
cmpq %r14, %rdi
je 0x51db
movq -0x160(%rbp), %rsi
incq %rsi
callq 0x31d0
incq %rbx
leaq 0x1f143(%rip), %rdi     # 0x24328
movq %rbx, %rsi
callq 0x156ba
jmp 0x5490
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 0x1796a(%rip), %rsi     # 0x1cb85
callq 0x3360
leaq -0x60(%rbp), %rsi
movq %rsi, -0x10(%rsi)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x5244
movq %rdx, -0x70(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x60(%rbp)
jmp 0x524a
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 0x5276
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x31d0
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x5292
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x31d0
leaq 0x1f1af(%rip), %rdi     # 0x24448
movq %r13, %rsi
callq 0x183ea
leaq -0x50(%rbp), %rdx
movq %rax, (%rdx)
leaq -0x70(%rbp), %rsi
movq %rax, %rdi
callq 0x190fc
leaq -0x100(%rbp), %r13
movq %r13, -0x10(%r13)
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
addq %rsi, %rdx
leaq -0x110(%rbp), %rdi
callq 0x16d2e
leaq -0xe0(%rbp), %r14
movq %r14, -0x10(%r14)
movq (%r12), %rsi
movq 0x8(%r12), %rdx
addq %rsi, %rdx
leaq -0xf0(%rbp), %rdi
callq 0x16d2e
leaq -0xc0(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0xd0(%rbp), %rdi
callq 0x16d2e
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 0x425f
movq -0xd0(%rbp), %rdi
cmpq %r12, %rdi
je 0x5367
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x31d0
movq -0xf0(%rbp), %rdi
cmpq %r14, %rdi
je 0x5382
movq -0xe0(%rbp), %rsi
incq %rsi
callq 0x31d0
movq -0x110(%rbp), %rdi
cmpq %r13, %rdi
leaq -0x40(%rbp), %r14
je 0x53a1
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 0x16d2e
leaq 0x16eb3(%rip), %rsi     # 0x1c27d
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 0x5411
movq %rdx, -0xb0(%rbp)
movq (%rcx), %rdx
movq %rdx, -0xa0(%rbp)
jmp 0x5418
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 0x4d8b
movq -0xb0(%rbp), %rdi
cmpq %r14, %rdi
je 0x545e
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x31d0
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x5477
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x31d0
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x5490
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 0x54c5
movq -0x120(%rbp), %rsi
incq %rsi
callq 0x31d0
jmp 0x54c5
movq %rax, %rbx
movq -0x150(%rbp), %rdi
cmpq %r15, %rdi
je 0x54e5
movq -0x140(%rbp), %rsi
incq %rsi
callq 0x31d0
jmp 0x54e5
movq %rax, %rbx
movq -0x170(%rbp), %rdi
cmpq %r14, %rdi
je 0x5602
movq -0x160(%rbp), %rsi
jmp 0x55fa
movq %rax, %rbx
movq -0xb0(%rbp), %rdi
cmpq %r14, %rdi
je 0x5524
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x31d0
jmp 0x5524
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
jne 0x5546
jmp 0x55e9
movq %rax, %rbx
movq -0x50(%rbp), %rdi
cmpq %r14, %rdi
je 0x55e9
movq -0x40(%rbp), %rsi
jmp 0x55a7
jmp 0x55e6
movq %rax, %rbx
movq -0xd0(%rbp), %rdi
cmpq %r12, %rdi
je 0x5574
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x31d0
jmp 0x5574
movq %rax, %rbx
movq -0xf0(%rbp), %rdi
cmpq %r14, %rdi
je 0x5594
movq -0xe0(%rbp), %rsi
incq %rsi
callq 0x31d0
jmp 0x5594
movq %rax, %rbx
movq -0x110(%rbp), %rdi
cmpq %r13, %rdi
je 0x55e9
movq -0x100(%rbp), %rsi
incq %rsi
callq 0x31d0
jmp 0x55e9
movq %rax, %rbx
movq -0x50(%rbp), %rdi
cmpq %r14, %rdi
je 0x55d0
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x31d0
jmp 0x55d0
jmp 0x55cd
movq %rax, %rbx
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x5602
movq -0x80(%rbp), %rsi
jmp 0x55fa
movq %rax, %rbx
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x5602
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x31d0
movq %rbx, %rdi
callq 0x3320