// File: /workspace/github_cpp_makefile_star2_O2/sighingnow[P]compile-pascal/pl0_tac_gen.cpp
// Function: pl0_tac_var_stmt(pl0_ast_var_stmt const*)
void pl0_tac_var_stmt(pl0_ast_var_stmt const *stmts) {
    cout << __func__;
    if (!stmts) { return; }
    for (auto && s: stmts->stmt) {
        for (auto && var: s->ids) {
            // validate.
            if (!scope.empty() && var->id == scope.back()) {
                pl0_ast_error(var->loc, string("duplicate identifier ") + "\"" + var->id + "\"");
            }
            else if (valtb.find(var->id, false) || vartb.find(var->id, false)) {
                pl0_ast_error(var->loc, string("redefinition of ") + "\"" + var->id + "\"");
            }
            else {
                string t = s->type->type->type + (s->type->len == -1 ? "" : "array");
                vartb.push(variable(var->id, s->type->type->type, t, s->type->len)); // update symbol table.
                irb.emit("def", new Value(var->id, s->type->type->type), new Value(t, "string"), new Value(s->type->len, "integer"));
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x238, %rsp            # imm = 0x238
movq %rdi, %rbx
movq 0x4cd7b(%rip), %rdi     # 0x8afd8
leaq 0x1d2db(%rip), %rsi     # 0x5b53f
callq 0x5250
testq %rbx, %rbx
je 0x3e6a4
movq 0x8(%rbx), %rax
movq 0x10(%rbx), %rcx
movq %rcx, 0x40(%rsp)
leaq 0x50(%rsp), %rbp
cmpq 0x40(%rsp), %rax
je 0x3e6a4
movq %rax, 0x8(%rsp)
movq (%rax), %rax
movq 0x10(%rax), %r13
movq 0x18(%rax), %rax
movq %rax, 0x48(%rsp)
cmpq 0x48(%rsp), %r13
je 0x3e696
movq 0x4e352(%rip), %rsi     # 0x8c608
cmpq %rsi, 0x4e343(%rip)     # 0x8c600
je 0x3e352
movq (%r13), %rdi
addq $0x8, %rdi
addq $-0x20, %rsi
callq 0xfb78
testb %al, %al
je 0x3e352
movq (%r13), %rax
movq (%rax), %r14
movq %rbp, %rdi
leaq 0x1c68b(%rip), %rsi     # 0x5a974
leaq 0x7(%rsp), %rdx
callq 0xfa26
leaq 0x20(%rsp), %r12
movq %r12, %rdi
movq %rbp, %rsi
leaq 0x1cd1e(%rip), %rdx     # 0x5b023
callq 0xfd14
movq (%r13), %rdx
addq $0x8, %rdx
leaq 0x150(%rsp), %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0xfda4
leaq 0x218(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
leaq 0x1cce9(%rip), %rdx     # 0x5b023
callq 0xfd14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3da88
movq %rbx, %rdi
jmp 0x3e3ff
movq (%r13), %rsi
addq $0x8, %rsi
leaq 0x4e2e7(%rip), %rdi     # 0x8c648
xorl %edx, %edx
callq 0x46d8a
testb %al, %al
jne 0x3e38a
movq (%r13), %rsi
addq $0x8, %rsi
leaq 0x4e29d(%rip), %rdi     # 0x8c618
xorl %edx, %edx
callq 0x46e8a
testb %al, %al
je 0x3e42c
movq (%r13), %rax
movq (%rax), %r14
movq %rbp, %rdi
leaq 0x1c5ef(%rip), %rsi     # 0x5a98a
leaq 0x7(%rsp), %rdx
callq 0xfa26
leaq 0x20(%rsp), %r12
movq %r12, %rdi
movq %rbp, %rsi
leaq 0x1cc6c(%rip), %rdx     # 0x5b023
callq 0xfd14
movq (%r13), %rdx
addq $0x8, %rdx
leaq 0x150(%rsp), %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0xfda4
leaq 0x1f8(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
leaq 0x1cc37(%rip), %rdx     # 0x5b023
callq 0xfd14
movq %r14, %rdi
movq %r12, %rsi
callq 0x3da88
movq %r12, %rdi
callq 0x5120
leaq 0x150(%rsp), %rdi
callq 0x5120
leaq 0x20(%rsp), %rdi
callq 0x5120
movq %rbp, %rdi
callq 0x5120
addq $0x8, %r13
jmp 0x3e2a4
movq 0x8(%rsp), %rbx
movq (%rbx), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rsi
addq $0x8, %rsi
cmpl $-0x1, 0x10(%rax)
leaq 0x1c647(%rip), %rdx     # 0x5aa92
leaq 0x1d0ed(%rip), %rax     # 0x5b53f
cmoveq %rax, %rdx
leaq 0x20(%rsp), %r14
movq %r14, %rdi
callq 0x1def2
movq (%r13), %rsi
addq $0x8, %rsi
leaq 0x1d8(%rsp), %r15
movq %r15, %rdi
callq 0x5340
movq (%rbx), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rsi
addq $0x8, %rsi
leaq 0x1b8(%rsp), %rbp
movq %rbp, %rdi
callq 0x5340
leaq 0x150(%rsp), %r12
leaq 0x130(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5340
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movl 0x10(%rax), %r8d
movq %r12, %rdi
movq %r15, %rsi
movq %rbp, %rdx
movq %rbx, %rcx
callq 0x3bd60
leaq 0x4e13b(%rip), %rdi     # 0x8c618
movq %r12, %rsi
callq 0x4866e
movq %r12, %rdi
callq 0x46fa0
leaq 0x130(%rsp), %rdi
callq 0x5120
movq %rbp, %rdi
callq 0x5120
movq %r15, %rdi
callq 0x5120
leaq 0x110(%rsp), %rdi
leaq 0x1c482(%rip), %rsi     # 0x5a99b
movq %r12, %rdx
callq 0xfa26
pushq $0x48
popq %rdi
callq 0x5260
movq %rax, 0x18(%rsp)
leaq 0xf0(%rsp), %rbx
movq 0x8(%rsp), %r15
movq (%r13), %rsi
addq $0x8, %rsi
leaq 0x90(%rsp), %rdi
callq 0x5340
movq (%r15), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rsi
addq $0x8, %rsi
movq %rbx, %rdi
callq 0x5340
movb $0x1, %bpl
movq 0x18(%rsp), %rdi
leaq 0x90(%rsp), %rsi
movq %rbx, %rdx
callq 0x46fc0
xorl %ebp, %ebp
pushq $0x48
popq %rdi
callq 0x5260
movq %rax, 0x10(%rsp)
leaq 0x70(%rsp), %rdi
movq %r14, %rsi
callq 0x5340
leaq 0xd0(%rsp), %rbx
movq %rbx, %rdi
leaq 0x1ccfb(%rip), %rsi     # 0x5b2a8
leaq 0x50(%rsp), %rdx
callq 0xfa26
movb $0x1, %r12b
movq 0x10(%rsp), %rdi
leaq 0x70(%rsp), %rsi
movq %rbx, %rdx
callq 0x46fc0
xorl %r12d, %r12d
pushq $0x48
popq %rdi
callq 0x5260
movq %rax, %rbp
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movl 0x10(%rax), %r12d
leaq 0xb0(%rsp), %r14
movq %r14, %rdi
leaq 0x1ab13(%rip), %rsi     # 0x5910f
leaq 0x7(%rsp), %rdx
callq 0xfa26
movb $0x1, %bl
movq %rbp, %rdi
movl %r12d, %esi
movq %r14, %rdx
callq 0x46ac6
leaq 0x110(%rsp), %r12
xorl %ebx, %ebx
leaq 0x4dfa9(%rip), %rdi     # 0x8c5d0
movq %r12, %rsi
movq 0x18(%rsp), %rdx
movq 0x10(%rsp), %rcx
movq %rbp, %r8
callq 0x46a38
leaq 0xb0(%rsp), %rdi
callq 0x5120
leaq 0xd0(%rsp), %rdi
callq 0x5120
leaq 0x70(%rsp), %rdi
callq 0x5120
leaq 0xf0(%rsp), %rdi
callq 0x5120
leaq 0x90(%rsp), %rdi
callq 0x5120
movq %r12, %rdi
callq 0x5120
leaq 0x20(%rsp), %rdi
callq 0x5120
leaq 0x50(%rsp), %rbp
jmp 0x3e423
movq 0x8(%rsp), %rax
addq $0x8, %rax
jmp 0x3e284
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3e6fe
movq %rax, %r15
leaq 0x150(%rsp), %rdi
callq 0x46fa0
jmp 0x3e6d2
movq %rax, %r15
jmp 0x3e6df
movq %rax, %r15
leaq 0x130(%rsp), %rdi
callq 0x5120
leaq 0x1b8(%rsp), %rdi
callq 0x5120
jmp 0x3e6f1
movq %rax, %r15
leaq 0x1d8(%rsp), %rdi
jmp 0x3e7e8
movq %rax, %r15
jmp 0x3e7ed
movq %rax, %r15
jmp 0x3e776
movq %rax, %r15
movb $0x1, %r12b
jmp 0x3e796
movq %rax, %r15
jmp 0x3e7a5
movq %rax, %r15
movb $0x1, %bpl
jmp 0x3e7c1
movq %rax, %r15
jmp 0x3e7d3
movq %rax, %r15
jmp 0x3e7e0
movq %rax, %r15
leaq 0x218(%rsp), %rdi
jmp 0x3e80e
jmp 0x3e7f4
jmp 0x3e7fe
jmp 0x3e7f9
jmp 0x3e83c
movq %rax, %r15
jmp 0x3e7b4
movq %rax, %r15
leaq 0xb0(%rsp), %rdi
callq 0x5120
testb %bl, %bl
je 0x3e781
pushq $0x48
popq %rsi
movq %rbp, %rdi
callq 0x5270
xorl %r12d, %r12d
jmp 0x3e789
movq %rax, %r15
leaq 0xd0(%rsp), %rdi
callq 0x5120
leaq 0x70(%rsp), %rdi
callq 0x5120
testb %r12b, %r12b
je 0x3e7b2
pushq $0x48
popq %rsi
movq 0x10(%rsp), %rdi
callq 0x5270
xorl %ebp, %ebp
leaq 0xf0(%rsp), %rdi
callq 0x5120
leaq 0x90(%rsp), %rdi
callq 0x5120
testb %bpl, %bpl
je 0x3e7e0
pushq $0x48
popq %rsi
movq 0x18(%rsp), %rdi
callq 0x5270
leaq 0x110(%rsp), %rdi
callq 0x5120
leaq 0x20(%rsp), %rdi
jmp 0x3e82f
movq %rax, %r15
jmp 0x3e813
movq %rax, %r15
jmp 0x3e82a
movq %rax, %r15
jmp 0x3e820
movq %rax, %r15
leaq 0x1f8(%rsp), %rdi
callq 0x5120
leaq 0x150(%rsp), %rdi
callq 0x5120
leaq 0x20(%rsp), %rdi
callq 0x5120
leaq 0x50(%rsp), %rdi
callq 0x5120
movq %r15, %rdi
callq 0x53f0
movq %rax, %r15
jmp 0x3e834