// File: /workspace/github_cpp_makefile_star2_O2/sighingnow[P]compile-pascal/pl0_tac_gen.cpp
// Function: pl0_tac_procedure_stmt(pl0_ast_procedure_stmt const*)
void pl0_tac_procedure_stmt(pl0_ast_procedure_stmt const *stmts) {
    cout << __func__;
    for (auto && p: stmts->procs) {
        // validate.
        string pid = p.first->id->id;
        if (valtb.find(pid, false) || vartb.find(pid, false) || proctb.find(pid, false) || functb.find(pid, false)
                || (!scope.empty() && pid == scope.back())) {
            pl0_ast_error(p.first->id->loc, string("overloaded identifier ") + "\"" + pid + "\"" + " isn't a function");
        }
        else {
            scope.emplace_back(pid); // update global scope.
            vector<string> proctype = pl0_tac_procedure_header(p.first);
            irb.emit("procedure", new Value(scope_name(), "string"));
            proctb.push(proc(scope_name(), proctype)); // update symbol table.
            proctb.tag(); functb.tag();
            pl0_tac_prog(p.second);
            irb.emit("endproc", 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 $0x1d8, %rsp            # imm = 0x1D8
movq %rdi, %rbx
movq 0x4c77c(%rip), %rdi     # 0x8afd8
leaq 0x1ccdc(%rip), %rsi     # 0x5b53f
callq 0x5250
movq 0x8(%rbx), %rcx
movq 0x10(%rbx), %rax
movq %rax, 0x38(%rsp)
leaq 0x1c7a7(%rip), %r15     # 0x5b023
leaq 0x160(%rsp), %r14
leaq 0x1a0(%rsp), %rbx
cmpq 0x38(%rsp), %rcx
je 0x3ec23
movq %rcx, 0x10(%rsp)
movq (%rcx), %rax
movq 0x8(%rax), %rsi
addq $0x8, %rsi
movq %rbx, %r13
leaq 0x18(%rsp), %rbx
movq %rbx, %rdi
callq 0x5340
leaq 0x4dd8a(%rip), %rdi     # 0x8c648
movq %rbx, %rsi
movq %r13, %rbx
xorl %edx, %edx
callq 0x46d8a
testb %al, %al
jne 0x3e93e
leaq 0x4dd42(%rip), %rdi     # 0x8c618
leaq 0x18(%rsp), %rsi
xorl %edx, %edx
callq 0x46e8a
testb %al, %al
jne 0x3e93e
leaq 0x4dd8b(%rip), %rdi     # 0x8c678
leaq 0x18(%rsp), %rsi
xorl %edx, %edx
callq 0x47006
testb %al, %al
jne 0x3e93e
leaq 0x4dda4(%rip), %rdi     # 0x8c6a8
leaq 0x18(%rsp), %rsi
xorl %edx, %edx
callq 0x47106
testb %al, %al
jne 0x3e93e
movq 0x4dced(%rip), %rsi     # 0x8c608
cmpq %rsi, 0x4dcde(%rip)     # 0x8c600
je 0x3ea0f
addq $-0x20, %rsi
leaq 0x18(%rsp), %rdi
callq 0xfb78
testb %al, %al
je 0x3ea0f
movq %r15, %rbx
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movq (%rax), %r12
leaq 0x140(%rsp), %r15
movq %r15, %rdi
leaq 0x1c03d(%rip), %rsi     # 0x5a99f
leaq 0xf(%rsp), %rdx
callq 0xfa26
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %r15
movq %rbx, %rdx
callq 0xfd14
leaq 0x40(%rsp), %rbp
movq %rbp, %rdi
movq %r14, %rsi
leaq 0x18(%rsp), %rdx
callq 0xfda4
movq %r13, %rbx
movq %r13, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0xfd14
leaq 0x180(%rsp), %r13
movq %r13, %rdi
movq %rbx, %rsi
leaq 0x1bffe(%rip), %rdx     # 0x5a9b6
callq 0xfd14
movq %r12, %rdi
movq %r13, %rsi
callq 0x3da88
movq %r13, %rdi
callq 0x5120
movq %rbx, %rdi
callq 0x5120
leaq 0x40(%rsp), %rdi
callq 0x5120
movq %r14, %rdi
callq 0x5120
leaq 0x140(%rsp), %rdi
callq 0x5120
leaq 0x18(%rsp), %rdi
callq 0x5120
movq 0x10(%rsp), %rcx
addq $0x10, %rcx
jmp 0x3e88c
leaq 0x4dbea(%rip), %rdi     # 0x8c600
leaq 0x18(%rsp), %rsi
callq 0x47206
movq 0x10(%rsp), %rax
movq (%rax), %rsi
leaq 0x40(%rsp), %rdi
callq 0x3f682
leaq 0x120(%rsp), %rdi
leaq 0x1aea7(%rip), %rsi     # 0x598e8
movq %rbx, %rdx
callq 0xfa26
pushq $0x48
popq %rdi
callq 0x5260
movq %rax, %rbp
leaq 0x80(%rsp), %rdi
callq 0x3f6b6
leaq 0x100(%rsp), %r13
movq %r13, %rdi
leaq 0x1c835(%rip), %rsi     # 0x5b2a8
movq %r14, %rdx
callq 0xfa26
movb $0x1, %r12b
movq %rbp, %rdi
leaq 0x80(%rsp), %rsi
movq %r13, %rdx
callq 0x46fc0
leaq 0x120(%rsp), %r13
xorl %r12d, %r12d
leaq 0x4db2d(%rip), %rdi     # 0x8c5d0
movq %r13, %rsi
movq %rbp, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x46a38
leaq 0x100(%rsp), %rdi
callq 0x5120
leaq 0x80(%rsp), %rdi
callq 0x5120
movq %r13, %rdi
callq 0x5120
leaq 0xe0(%rsp), %r12
movq %r12, %rdi
callq 0x3f6b6
movq %rbx, %rdi
movq %r12, %rsi
leaq 0x40(%rsp), %rdx
callq 0x3be36
leaq 0x4db7c(%rip), %r12     # 0x8c678
movq %r12, %rdi
movq %rbx, %rsi
callq 0x48ad6
movq %rbx, %rdi
callq 0x47242
leaq 0xe0(%rsp), %rdi
callq 0x5120
movq %r12, %rdi
callq 0x46b50
leaq 0x4db7d(%rip), %rdi     # 0x8c6a8
callq 0x46b72
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x3de04
leaq 0xc0(%rsp), %rdi
leaq 0x1be0e(%rip), %rsi     # 0x5a95b
movq %rbx, %rdx
callq 0xfa26
pushq $0x48
popq %rdi
callq 0x5260
movq %rax, %rbp
leaq 0x60(%rsp), %rdi
callq 0x3f6b6
leaq 0xa0(%rsp), %r13
movq %r13, %rdi
leaq 0x1c72c(%rip), %rsi     # 0x5b2a8
movq %r14, %rdx
callq 0xfa26
movb $0x1, %r12b
movq %rbp, %rdi
leaq 0x60(%rsp), %rsi
movq %r13, %rdx
callq 0x46fc0
leaq 0xc0(%rsp), %r13
xorl %r12d, %r12d
leaq 0x4da27(%rip), %rdi     # 0x8c5d0
movq %r13, %rsi
movq %rbp, %rdx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x46a38
leaq 0xa0(%rsp), %rdi
callq 0x5120
leaq 0x60(%rsp), %rdi
callq 0x5120
movq %r13, %rdi
callq 0x5120
leaq 0x4da21(%rip), %rdi     # 0x8c600
callq 0x47258
leaq 0x4da5d(%rip), %rdi     # 0x8c648
callq 0x46c92
leaq 0x4da21(%rip), %rdi     # 0x8c618
callq 0x46cd0
leaq 0x4da75(%rip), %rdi     # 0x8c678
callq 0x46d0e
leaq 0x4da99(%rip), %rdi     # 0x8c6a8
callq 0x46d4c
leaq 0x40(%rsp), %rdi
callq 0x46752
jmp 0x3e9f7
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x3ec8b
jmp 0x3ed05
movq %rax, %rbx
movb $0x1, %r12b
jmp 0x3ecd9
movq %rax, %rbx
jmp 0x3eceb
movq %rax, %rbx
jmp 0x3ecf6
jmp 0x3ed05
jmp 0x3ed6d
movq %rax, %rbx
movb $0x1, %r12b
jmp 0x3eca5
movq %rax, %rbx
jmp 0x3ecb4
movq %rax, %rbx
jmp 0x3ecbf
jmp 0x3ed05
movq %rax, %rbx
leaq 0x1a0(%rsp), %rdi
callq 0x47242
leaq 0xe0(%rsp), %rdi
jmp 0x3ecfe
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x5120
leaq 0x60(%rsp), %rdi
callq 0x5120
testb %r12b, %r12b
je 0x3ecbf
pushq $0x48
popq %rsi
movq %rbp, %rdi
callq 0x5270
leaq 0xc0(%rsp), %rdi
jmp 0x3ecfe
movq %rax, %rbx
leaq 0x100(%rsp), %rdi
callq 0x5120
leaq 0x80(%rsp), %rdi
callq 0x5120
testb %r12b, %r12b
je 0x3ecf6
pushq $0x48
popq %rsi
movq %rbp, %rdi
callq 0x5270
leaq 0x120(%rsp), %rdi
callq 0x5120
jmp 0x3ed08
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x46752
jmp 0x3ed70
movq %rax, %rbx
jmp 0x3ed5e
movq %rax, %rbx
leaq 0x180(%rsp), %rdi
callq 0x5120
jmp 0x3ed3a
movq %rax, %rbx
jmp 0x3ed51
movq %rax, %rbx
jmp 0x3ed47
jmp 0x3ed6d
movq %rax, %rbx
leaq 0x1a0(%rsp), %rdi
callq 0x5120
leaq 0x40(%rsp), %rdi
callq 0x5120
leaq 0x160(%rsp), %rdi
callq 0x5120
leaq 0x140(%rsp), %rdi
callq 0x5120
jmp 0x3ed70
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x5120
movq %rbx, %rdi
callq 0x53f0