// File: /workspace/github_cpp_makefile_star2_O2/yanlinlin82[P]icpp/icpp.cpp
// Function: parse_function(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
string parse_function(string name)
{
	log<3>("[DEBUG] %s: '%s'\n", __FUNCTION__, name.c_str());
	next();
	vector<string> arg_types;
	if (token != ")") {
		for (;;) {
			string type = parse_expression(",");
			arg_types.push_back(type);
			add_assembly_code(PUSH);
			if (token == ")") break;
			expect_token(",", "function '" + name + "'");
			next();
		}
	}
	expect_token(")", "function '" + name + "'");
	log<3>("[DEBUG] function '%s' has %zd args\n", name.c_str(), arg_types.size());
	auto [ offset, ret_type, is_code, type_name, arg_count ] = query_function(name, arg_types);
	if (arg_count < 0) {
		add_assembly_code(MOV, arg_types.size() + arg_count, "variable parameter count");
		add_assembly_code(PUSH);
	}
	add_assembly_code(CALL, offset, ret_type + " " + name + "(" + type_name + ")");
	if (arg_count < 0) {
		add_assembly_code(ADJ, arg_types.size());
	}
	log<3>("[DEBUG] ret_type = '%s'\n", ret_type.c_str());
	next();
	return ret_type;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x268, %rsp            # imm = 0x268
movq %rdi, -0x58(%rbp)
movq %rsi, -0x30(%rbp)
movq (%rsi), %rdx
leaq 0xf855(%rip), %rdi      # 0x16714
leaq 0xf860(%rip), %rsi      # 0x16726
xorl %eax, %eax
callq 0xf138
callq 0x4fdf
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
andq $0x0, -0x40(%rbp)
leaq 0x1a3ab(%rip), %rdi     # 0x21290
leaq 0xfc9c(%rip), %rsi      # 0x16b88
callq 0xf65a
testb %al, %al
je 0x7028
leaq -0x230(%rbp), %rbx
leaq -0x78(%rbp), %r14
leaq -0x290(%rbp), %r12
leaq -0x270(%rbp), %r13
movq %rbx, %rdi
leaq 0xf2f0(%rip), %rsi      # 0x1620c
movq %r14, %rdx
callq 0xf1f8
leaq -0xd0(%rbp), %r15
movq %r15, %rdi
movq %rbx, %rsi
xorl %edx, %edx
pushq $0x1
popq %rcx
callq 0x7431
movq %rbx, %rdi
callq 0x3368
leaq -0x50(%rbp), %rdi
movq %r15, %rsi
callq 0xf668
movq %r12, %r15
movq %r12, %rdi
leaq 0x10528(%rip), %rsi     # 0x17484
movq %r14, %rdx
callq 0xf1f8
pushq $0x1
popq %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0x4a27
movq %r15, %rdi
callq 0x3368
leaq 0x1a310(%rip), %rdi     # 0x21290
leaq 0xfc01(%rip), %rsi      # 0x16b88
callq 0xf4c8
testb %al, %al
jne 0x701c
movq %r13, %rdi
leaq 0xf26e(%rip), %rsi      # 0x1620c
leaq -0xf0(%rbp), %rdx
callq 0xf1f8
movq %r14, %r15
movq %r14, %rdi
leaq 0xf77e(%rip), %rsi      # 0x16735
movq -0x30(%rbp), %rdx
callq 0xf5e4
leaq -0x250(%rbp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
leaq 0xfac2(%rip), %rdx      # 0x16a96
callq 0xf309
movq %r13, %r15
movq %r13, %rdi
movq %rbx, %rsi
callq 0x540c
movq %rbx, %rdi
callq 0x3368
movq %r14, %rdi
callq 0x3368
movq %r15, %rdi
callq 0x3368
callq 0x4fdf
leaq -0xd0(%rbp), %rdi
callq 0x3368
leaq -0x230(%rbp), %rbx
jmp 0x6f12
leaq -0xd0(%rbp), %rdi
callq 0x3368
leaq 0xfb59(%rip), %rsi      # 0x16b88
leaq -0x210(%rbp), %rdi
leaq -0x78(%rbp), %rdx
callq 0xf1f8
leaq 0xf6ef(%rip), %rsi      # 0x16735
leaq -0xd0(%rbp), %rdi
movq -0x30(%rbp), %rdx
callq 0xf5e4
leaq 0xfa39(%rip), %rdx      # 0x16a96
leaq -0x1f0(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0xf309
leaq -0x210(%rbp), %rdi
leaq -0x1f0(%rbp), %rsi
callq 0x540c
leaq -0x1f0(%rbp), %rdi
callq 0x3368
leaq -0xd0(%rbp), %rdi
callq 0x3368
leaq -0x210(%rbp), %rdi
callq 0x3368
movq -0x30(%rbp), %rbx
movq (%rbx), %rsi
movq -0x48(%rbp), %rdx
subq -0x50(%rbp), %rdx
sarq $0x5, %rdx
leaq 0xf67f(%rip), %rdi      # 0x16740
xorl %eax, %eax
callq 0xf138
leaq -0x1d0(%rbp), %rdi
movq %rbx, %rsi
callq 0x3270
leaq -0xd0(%rbp), %rdi
leaq -0x1d0(%rbp), %rsi
leaq -0x50(%rbp), %rdx
callq 0x5cc6
leaq -0x1d0(%rbp), %rdi
callq 0x3368
movl -0xd0(%rbp), %ebx
testl %ebx, %ebx
jns 0x717e
movq -0x50(%rbp), %r15
movq -0x48(%rbp), %r14
leaq 0xf651(%rip), %rsi      # 0x16764
leaq -0x1b0(%rbp), %rdi
leaq -0x78(%rbp), %rdx
callq 0xf1f8
subq %r15, %r14
shrq $0x5, %r14
addl %r14d, %ebx
pushq $0x4
popq %rdi
leaq -0x1b0(%rbp), %rdx
movl %ebx, %esi
callq 0x4a27
leaq -0x1b0(%rbp), %rdi
callq 0x3368
leaq 0x10333(%rip), %rsi     # 0x17484
leaq -0x190(%rbp), %rdi
leaq -0x78(%rbp), %rdx
callq 0xf1f8
pushq $0x1
popq %rdi
leaq -0x190(%rbp), %rdx
xorl %esi, %esi
callq 0x4a27
leaq -0x190(%rbp), %rdi
callq 0x3368
leaq -0xa0(%rbp), %r15
movl 0x20(%r15), %ebx
leaq 0xf0f0(%rip), %rdx      # 0x16280
leaq -0x130(%rbp), %rdi
movq %r15, %rsi
callq 0xf35b
leaq -0x150(%rbp), %rdi
leaq -0x130(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0xf332
leaq 0xf80a(%rip), %rdx      # 0x169c7
leaq -0xf0(%rbp), %rdi
leaq -0x150(%rbp), %rsi
callq 0xf309
leaq -0xc8(%rbp), %rdx
leaq -0x78(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0xf332
leaq 0xf99a(%rip), %rdx      # 0x16b88
leaq -0x170(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0xf309
pushq $0x25
popq %rdi
leaq -0x170(%rbp), %rdx
movl %ebx, %esi
callq 0x4a27
leaq -0x170(%rbp), %rdi
callq 0x3368
leaq -0x78(%rbp), %rdi
callq 0x3368
leaq -0xf0(%rbp), %rdi
callq 0x3368
leaq -0x150(%rbp), %rdi
callq 0x3368
leaq -0x130(%rbp), %rdi
callq 0x3368
cmpl $0x0, -0xd0(%rbp)
jns 0x7294
movq -0x50(%rbp), %r14
movq -0x48(%rbp), %rbx
leaq 0x10224(%rip), %rsi     # 0x17484
leaq -0x110(%rbp), %rdi
leaq -0x78(%rbp), %rdx
callq 0xf1f8
subq %r14, %rbx
shrq $0x5, %rbx
pushq $0x3
popq %rdi
leaq -0x110(%rbp), %rdx
movl %ebx, %esi
callq 0x4a27
leaq -0x110(%rbp), %rdi
callq 0x3368
movq -0xa0(%rbp), %rsi
leaq 0xf4db(%rip), %rdi      # 0x1677d
xorl %eax, %eax
callq 0xf138
callq 0x4fdf
movq -0x58(%rbp), %rdi
movq %r15, %rsi
callq 0x3270
leaq -0xd0(%rbp), %rdi
callq 0xf6a4
leaq -0x50(%rbp), %rdi
callq 0xef96
movq -0x58(%rbp), %rax
addq $0x268, %rsp            # imm = 0x268
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x110(%rbp), %rdi
jmp 0x7363
jmp 0x73af
movq %rax, %rbx
leaq -0x190(%rbp), %rdi
jmp 0x7363
jmp 0x73af
movq %rax, %rbx
leaq -0x1b0(%rbp), %rdi
jmp 0x7363
jmp 0x73af
movq %rax, %rbx
leaq -0x170(%rbp), %rdi
callq 0x3368
jmp 0x732c
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x3368
jmp 0x733a
movq %rax, %rbx
leaq -0xf0(%rbp), %rdi
callq 0x3368
jmp 0x734b
movq %rax, %rbx
leaq -0x150(%rbp), %rdi
callq 0x3368
jmp 0x735c
movq %rax, %rbx
leaq -0x130(%rbp), %rdi
callq 0x3368
jmp 0x73b2
jmp 0x73af
movq %rax, %rbx
leaq -0x1d0(%rbp), %rdi
jmp 0x741b
jmp 0x73ed
jmp 0x73ed
movq %rax, %rbx
leaq -0x1f0(%rbp), %rdi
callq 0x3368
jmp 0x7393
movq %rax, %rbx
leaq -0xd0(%rbp), %rdi
callq 0x3368
jmp 0x73a4
movq %rax, %rbx
leaq -0x210(%rbp), %rdi
jmp 0x741b
jmp 0x73ed
movq %rax, %rbx
leaq -0xd0(%rbp), %rdi
callq 0xf6a4
jmp 0x7420
jmp 0x7411
movq %rax, %rbx
jmp 0x73e4
movq %rax, %rbx
jmp 0x73db
movq %rax, %rbx
leaq -0x250(%rbp), %rdi
callq 0x3368
leaq -0x78(%rbp), %rdi
callq 0x3368
leaq -0x270(%rbp), %rdi
jmp 0x740a
movq %rax, %rbx
jmp 0x7420
movq %rax, %rbx
leaq -0x230(%rbp), %rdi
jmp 0x741b
jmp 0x7411
movq %rax, %rbx
leaq -0x290(%rbp), %rdi
callq 0x3368
jmp 0x7414
movq %rax, %rbx
leaq -0xd0(%rbp), %rdi
callq 0x3368
leaq -0x50(%rbp), %rdi
callq 0xef96
movq %rbx, %rdi
callq 0x3310