// File: /workspace/github_cpp_makefile_star2_O2/sighingnow[P]compile-pascal/pl0_tac_gen.cpp
// Function: pl0_tac_function_stmt(pl0_ast_function_stmt const*)
void pl0_tac_function_stmt(pl0_ast_function_stmt const *stmts) {
    cout << __func__;
    for (auto && f: stmts->funcs) {
        // validate.
        string fid = f.first->id->id;
        if (valtb.find(fid, false) || vartb.find(fid, false) || proctb.find(fid, false) || functb.find(fid, false)
                || (!scope.empty() && fid == scope.back())) {
            pl0_ast_error(f.first->id->loc, string("overloaded identifier ") + "\"" + fid + "\"" + " isn't a function");
        }
        else {
            scope.emplace_back(fid); // update global scope.
            vector<string> functype = pl0_tac_function_header(f.first);
            irb.emit("function", new Value(scope_name(), "string"));
            functb.push(func(scope_name(), f.first->type->type, functype)); // update symbol table
            proctb.tag(); functb.tag();
            irb.emit("def", new Value(scope_name(), f.first->type->type), new Value("function", "string"), new Value(-1, "integer"));
            pl0_tac_prog(f.second);
            irb.emit("loadret", new Value(scope_name(), "string"));
            irb.emit("endfunc", new Value(scope_name(), "string"));
            // end of current scope.
            scope.pop_back(); // restore scope.
            valtb.detag(); vartb.detag();
            proctb.detag(), functb.detag();
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x348, %rsp            # imm = 0x348
movq %rdi, %rbx
movq 0x4c23b(%rip), %rdi     # 0x8afd8
leaq 0x1c79b(%rip), %rsi     # 0x5b53f
callq 0x5250
movq 0x8(%rbx), %rax
movq 0x10(%rbx), %rcx
movq %rcx, 0x48(%rsp)
leaq 0x1c266(%rip), %r15     # 0x5b023
leaq 0x2b0(%rsp), %r14
leaq 0x2f0(%rsp), %rbx
cmpq 0x48(%rsp), %rax
je 0x3f3ae
movq %rax, 0x10(%rsp)
movq (%rax), %rax
movq 0x8(%rax), %rsi
addq $0x8, %rsi
movq %rbx, %r12
leaq 0x28(%rsp), %rbx
movq %rbx, %rdi
callq 0x5340
leaq 0x4d849(%rip), %rdi     # 0x8c648
movq %rbx, %rsi
movq %r12, %rbx
xorl %edx, %edx
callq 0x46d8a
testb %al, %al
jne 0x3ee7f
leaq 0x4d801(%rip), %rdi     # 0x8c618
leaq 0x28(%rsp), %rsi
xorl %edx, %edx
callq 0x46e8a
testb %al, %al
jne 0x3ee7f
leaq 0x4d84a(%rip), %rdi     # 0x8c678
leaq 0x28(%rsp), %rsi
xorl %edx, %edx
callq 0x47006
testb %al, %al
jne 0x3ee7f
leaq 0x4d863(%rip), %rdi     # 0x8c6a8
leaq 0x28(%rsp), %rsi
xorl %edx, %edx
callq 0x47106
testb %al, %al
jne 0x3ee7f
movq 0x4d7ac(%rip), %rsi     # 0x8c608
cmpq %rsi, 0x4d79d(%rip)     # 0x8c600
je 0x3ef50
addq $-0x20, %rsi
leaq 0x28(%rsp), %rdi
callq 0xfb78
testb %al, %al
je 0x3ef50
movq %r15, %rbx
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movq (%rax), %rbp
leaq 0x130(%rsp), %r15
movq %r15, %rdi
leaq 0x1bafc(%rip), %rsi     # 0x5a99f
leaq 0xf(%rsp), %rdx
callq 0xfa26
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %r15
movq %rbx, %rdx
callq 0xfd14
leaq 0x50(%rsp), %r13
movq %r13, %rdi
movq %r14, %rsi
leaq 0x28(%rsp), %rdx
callq 0xfda4
movq %r12, %rbx
movq %r12, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0xfd14
leaq 0x2d0(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
leaq 0x1babd(%rip), %rdx     # 0x5a9b6
callq 0xfd14
movq %rbp, %rdi
movq %r12, %rsi
callq 0x3da88
movq %r12, %rdi
callq 0x5120
movq %rbx, %rdi
callq 0x5120
leaq 0x50(%rsp), %rdi
callq 0x5120
movq %r14, %rdi
callq 0x5120
leaq 0x130(%rsp), %rdi
callq 0x5120
leaq 0x28(%rsp), %rdi
callq 0x5120
movq 0x10(%rsp), %rax
addq $0x10, %rax
jmp 0x3edcd
leaq 0x4d6a9(%rip), %rdi     # 0x8c600
leaq 0x28(%rsp), %rsi
callq 0x47206
movq 0x10(%rsp), %rax
movq (%rax), %rsi
leaq 0x50(%rsp), %rdi
callq 0x3f76b
leaq 0x290(%rsp), %rdi
leaq 0x1ba3d(%rip), %rsi     # 0x5a9bf
movq %rbx, %rdx
callq 0xfa26
pushq $0x48
popq %rdi
callq 0x5260
movq %rax, %rbp
leaq 0x110(%rsp), %rdi
callq 0x3f6b6
leaq 0x270(%rsp), %r12
movq %r12, %rdi
leaq 0x1c2f4(%rip), %rsi     # 0x5b2a8
movq %r14, %rdx
callq 0xfa26
movb $0x1, %r13b
movq %rbp, %rdi
leaq 0x110(%rsp), %rsi
movq %r12, %rdx
callq 0x46fc0
leaq 0x290(%rsp), %r12
xorl %r13d, %r13d
leaq 0x4d5ec(%rip), %rdi     # 0x8c5d0
movq %r12, %rsi
movq %rbp, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x46a38
leaq 0x270(%rsp), %rdi
callq 0x5120
leaq 0x110(%rsp), %rdi
callq 0x5120
movq %r12, %rdi
callq 0x5120
leaq 0xf0(%rsp), %rdi
callq 0x3f6b6
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq 0x18(%rax), %rsi
addq $0x8, %rsi
leaq 0x250(%rsp), %r12
movq %r12, %rdi
callq 0x5340
leaq 0x130(%rsp), %r13
movq %rbx, %rdi
leaq 0xf0(%rsp), %rsi
movq %r12, %rdx
leaq 0x50(%rsp), %rcx
callq 0x3bef2
leaq 0x4d63e(%rip), %rdi     # 0x8c6a8
movq %rbx, %rsi
callq 0x48d7c
movq %rbx, %rdi
callq 0x4726c
leaq 0x250(%rsp), %rdi
callq 0x5120
leaq 0xf0(%rsp), %rdi
callq 0x5120
leaq 0x4d5dd(%rip), %rdi     # 0x8c678
callq 0x46b50
leaq 0x4d601(%rip), %rdi     # 0x8c6a8
callq 0x46b72
leaq 0x230(%rsp), %rdi
leaq 0x1b8e0(%rip), %rsi     # 0x5a99b
movq %rbx, %rdx
callq 0xfa26
pushq $0x48
popq %rdi
callq 0x5260
movq %rax, 0x20(%rsp)
leaq 0xd0(%rsp), %rdi
callq 0x3f6b6
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq 0x18(%rax), %rsi
addq $0x8, %rsi
leaq 0x210(%rsp), %r12
movq %r12, %rdi
callq 0x5340
movb $0x1, %bpl
movq 0x20(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
movq %r12, %rdx
callq 0x46fc0
xorl %ebp, %ebp
pushq $0x48
popq %rdi
callq 0x5260
movq %rax, 0x18(%rsp)
leaq 0xb0(%rsp), %rdi
leaq 0x1b88c(%rip), %rsi     # 0x5a9bf
movq %r14, %rdx
callq 0xfa26
leaq 0x1f0(%rsp), %r12
movq %r12, %rdi
leaq 0x1c15b(%rip), %rsi     # 0x5b2a8
movq %r13, %rdx
callq 0xfa26
movb $0x1, %r13b
movq 0x18(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
movq %r12, %rdx
callq 0x46fc0
xorl %r13d, %r13d
pushq $0x48
popq %rdi
callq 0x5260
movq %rax, %rbp
leaq 0x1d0(%rsp), %r12
movq %r12, %rdi
leaq 0x19f82(%rip), %rsi     # 0x5910f
leaq 0xf(%rsp), %rdx
callq 0xfa26
movb $0x1, %r13b
movq %rbp, %rdi
pushq $-0x1
popq %rsi
movq %r12, %rdx
callq 0x46ac6
leaq 0x230(%rsp), %r12
xorl %r13d, %r13d
leaq 0x4d416(%rip), %rdi     # 0x8c5d0
movq %r12, %rsi
movq 0x20(%rsp), %rdx
movq 0x18(%rsp), %rcx
movq %rbp, %r8
callq 0x46a38
leaq 0x1d0(%rsp), %rdi
callq 0x5120
leaq 0x1f0(%rsp), %rdi
callq 0x5120
leaq 0xb0(%rsp), %rdi
callq 0x5120
leaq 0x210(%rsp), %rdi
callq 0x5120
leaq 0xd0(%rsp), %rdi
callq 0x5120
movq %r12, %rdi
callq 0x5120
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x3de04
leaq 0x1b0(%rsp), %rdi
leaq 0x1b793(%rip), %rsi     # 0x5a9c8
movq %rbx, %rdx
callq 0xfa26
pushq $0x48
popq %rdi
callq 0x5260
movq %rax, %rbp
leaq 0x90(%rsp), %rdi
callq 0x3f6b6
leaq 0x190(%rsp), %r12
movq %r12, %rdi
leaq 0x1c041(%rip), %rsi     # 0x5b2a8
movq %r14, %rdx
callq 0xfa26
movb $0x1, %r13b
movq %rbp, %rdi
leaq 0x90(%rsp), %rsi
movq %r12, %rdx
callq 0x46fc0
leaq 0x1b0(%rsp), %r12
xorl %r13d, %r13d
leaq 0x4d339(%rip), %rdi     # 0x8c5d0
movq %r12, %rsi
movq %rbp, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x46a38
leaq 0x190(%rsp), %rdi
callq 0x5120
leaq 0x90(%rsp), %rdi
callq 0x5120
movq %r12, %rdi
callq 0x5120
leaq 0x170(%rsp), %rdi
leaq 0x1b6f8(%rip), %rsi     # 0x5a9d0
movq %rbx, %rdx
callq 0xfa26
pushq $0x48
popq %rdi
callq 0x5260
movq %rax, %rbp
leaq 0x70(%rsp), %rdi
callq 0x3f6b6
leaq 0x150(%rsp), %r12
movq %r12, %rdi
leaq 0x1bfa1(%rip), %rsi     # 0x5b2a8
movq %r14, %rdx
callq 0xfa26
movb $0x1, %r13b
movq %rbp, %rdi
leaq 0x70(%rsp), %rsi
movq %r12, %rdx
callq 0x46fc0
leaq 0x170(%rsp), %r12
xorl %r13d, %r13d
leaq 0x4d29c(%rip), %rdi     # 0x8c5d0
movq %r12, %rsi
movq %rbp, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x46a38
leaq 0x150(%rsp), %rdi
callq 0x5120
leaq 0x70(%rsp), %rdi
callq 0x5120
movq %r12, %rdi
callq 0x5120
leaq 0x4d296(%rip), %rdi     # 0x8c600
callq 0x47258
leaq 0x4d2d2(%rip), %rdi     # 0x8c648
callq 0x46c92
leaq 0x4d296(%rip), %rdi     # 0x8c618
callq 0x46cd0
leaq 0x4d2ea(%rip), %rdi     # 0x8c678
callq 0x46d0e
leaq 0x4d30e(%rip), %rdi     # 0x8c6a8
callq 0x46d4c
leaq 0x50(%rsp), %rdi
callq 0x46752
jmp 0x3ef38
addq $0x348, %rsp            # imm = 0x348
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x3f4ee
jmp 0x3f5c8
movq %rax, %rbx
jmp 0x3f510
movq %rax, %rbx
movb $0x1, %r13b
jmp 0x3f530
movq %rax, %rbx
jmp 0x3f542
movq %rax, %rbx
movb $0x1, %bpl
jmp 0x3f563
movq %rax, %rbx
jmp 0x3f575
movq %rax, %rbx
jmp 0x3f582
jmp 0x3f5c8
movq %rax, %rbx
leaq 0x2f0(%rsp), %rdi
callq 0x4726c
jmp 0x3f41d
movq %rax, %rbx
leaq 0x250(%rsp), %rdi
callq 0x5120
jmp 0x3f42f
movq %rax, %rbx
leaq 0xf0(%rsp), %rdi
jmp 0x3f5c1
jmp 0x3f5c8
movq %rax, %rbx
movb $0x1, %r13b
jmp 0x3f59c
movq %rax, %rbx
jmp 0x3f5ae
movq %rax, %rbx
jmp 0x3f5b9
jmp 0x3f5c8
jmp 0x3f630
movq %rax, %rbx
movb $0x1, %r13b
jmp 0x3f49a
movq %rax, %rbx
jmp 0x3f4a9
movq %rax, %rbx
jmp 0x3f4b4
jmp 0x3f5c8
movq %rax, %rbx
movb $0x1, %r13b
jmp 0x3f4d1
movq %rax, %rbx
jmp 0x3f4e3
movq %rax, %rbx
leaq 0x150(%rsp), %rdi
callq 0x5120
leaq 0x70(%rsp), %rdi
callq 0x5120
testb %r13b, %r13b
je 0x3f4b4
pushq $0x48
popq %rsi
movq %rbp, %rdi
callq 0x5270
leaq 0x170(%rsp), %rdi
jmp 0x3f5c1
movq %rax, %rbx
leaq 0x190(%rsp), %rdi
callq 0x5120
leaq 0x90(%rsp), %rdi
callq 0x5120
testb %r13b, %r13b
je 0x3f4ee
pushq $0x48
popq %rsi
movq %rbp, %rdi
callq 0x5270
leaq 0x1b0(%rsp), %rdi
jmp 0x3f5c1
movq %rax, %rbx
leaq 0x1d0(%rsp), %rdi
callq 0x5120
testb %r13b, %r13b
je 0x3f51b
pushq $0x48
popq %rsi
movq %rbp, %rdi
callq 0x5270
xorl %r13d, %r13d
jmp 0x3f523
movq %rax, %rbx
leaq 0x1f0(%rsp), %rdi
callq 0x5120
leaq 0xb0(%rsp), %rdi
callq 0x5120
testb %r13b, %r13b
je 0x3f54f
pushq $0x48
popq %rsi
movq 0x18(%rsp), %rdi
callq 0x5270
xorl %ebp, %ebp
jmp 0x3f556
movq %rax, %rbx
leaq 0x210(%rsp), %rdi
callq 0x5120
leaq 0xd0(%rsp), %rdi
callq 0x5120
testb %bpl, %bpl
je 0x3f582
pushq $0x48
popq %rsi
movq 0x20(%rsp), %rdi
callq 0x5270
leaq 0x230(%rsp), %rdi
jmp 0x3f5c1
movq %rax, %rbx
leaq 0x270(%rsp), %rdi
callq 0x5120
leaq 0x110(%rsp), %rdi
callq 0x5120
testb %r13b, %r13b
je 0x3f5b9
pushq $0x48
popq %rsi
movq %rbp, %rdi
callq 0x5270
leaq 0x290(%rsp), %rdi
callq 0x5120
jmp 0x3f5cb
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x46752
jmp 0x3f633
movq %rax, %rbx
jmp 0x3f621
movq %rax, %rbx
leaq 0x2d0(%rsp), %rdi
callq 0x5120
jmp 0x3f5fd
movq %rax, %rbx
jmp 0x3f614
movq %rax, %rbx
jmp 0x3f60a
jmp 0x3f630
movq %rax, %rbx
leaq 0x2f0(%rsp), %rdi
callq 0x5120
leaq 0x50(%rsp), %rdi
callq 0x5120
leaq 0x2b0(%rsp), %rdi
callq 0x5120
leaq 0x130(%rsp), %rdi
callq 0x5120
jmp 0x3f633
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x5120
movq %rbx, %rdi
callq 0x53f0