// File: sighingnow[P]compile-pascal/pl0_tac_gen.cpp
// Function: pl0_tac_stmt(pl0_ast_stmt const*)
void pl0_tac_stmt(pl0_ast_stmt const *stmt) {
    cout << __func__;
    if (stmt == nullptr) { return; } // check if null pointer.
    switch (stmt->t) {
        case pl0_ast_stmt::type_t::ASSIGN_STMT: pl0_tac_assign_stmt(dynamic_cast<pl0_ast_assign_stmt const *>(stmt)); break;
        case pl0_ast_stmt::type_t::COND_STMT: pl0_tac_cond_stmt(dynamic_cast<pl0_ast_cond_stmt const *>(stmt)); break;
        case pl0_ast_stmt::type_t::CASE_STMT: pl0_tac_case_stmt(dynamic_cast<pl0_ast_case_stmt const *>(stmt)); break;
        case pl0_ast_stmt::type_t::CALL_PROC: pl0_tac_call_proc(dynamic_cast<pl0_ast_call_proc const *>(stmt)); break;
        case pl0_ast_stmt::type_t::COMPOUND_STMT: pl0_tac_compound_stmt(dynamic_cast<pl0_ast_compound_stmt const *>(stmt)); break;
        case pl0_ast_stmt::type_t::WRITE_STMT: pl0_tac_write_stmt(dynamic_cast<pl0_ast_write_stmt const *>(stmt)); break;
        case pl0_ast_stmt::type_t::READ_STMT: pl0_tac_read_stmt(dynamic_cast<pl0_ast_read_stmt const *>(stmt)); break;
        case pl0_ast_stmt::type_t::FOR_STMT: pl0_tac_for_stmt(dynamic_cast<pl0_ast_for_stmt const *>(stmt)); break;
        case pl0_ast_stmt::type_t::NULL_STMT: pl0_tac_null_stmt(dynamic_cast<pl0_ast_null_stmt const *>(stmt)); break;
        default: cout << "UNIMPLEMENT STMT TYPE" << endl;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq 0xacc12(%rip), %rdi     # 0x15efd8
leaq 0x3f862(%rip), %rsi     # 0xf1c2f
callq 0x5330
cmpq $0x0, -0x8(%rbp)
jne 0xb23de
jmp 0xb26b1
movq -0x8(%rbp), %rax
movl 0x10(%rax), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x10(%rbp)
subl $0x8, %eax
ja 0xb268f
movq -0x10(%rbp), %rax
leaq 0x3ec27(%rip), %rcx     # 0xf1028
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
je 0xb2439
movq -0x18(%rbp), %rdi
leaq 0xabd5d(%rip), %rsi     # 0x15e180
leaq 0xabdbe(%rip), %rdx     # 0x15e1e8
xorl %eax, %eax
movl %eax, %ecx
callq 0x53f0
movq %rax, -0x20(%rbp)
jmp 0xb2441
xorl %eax, %eax
movq %rax, -0x20(%rbp)
jmp 0xb2441
movq -0x20(%rbp), %rdi
callq 0xb26c0
jmp 0xb26b1
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
je 0xb247e
movq -0x28(%rbp), %rdi
leaq 0xabd18(%rip), %rsi     # 0x15e180
leaq 0xabdc1(%rip), %rdx     # 0x15e230
xorl %eax, %eax
movl %eax, %ecx
callq 0x53f0
movq %rax, -0x30(%rbp)
jmp 0xb2486
xorl %eax, %eax
movq %rax, -0x30(%rbp)
jmp 0xb2486
movq -0x30(%rbp), %rdi
callq 0xb34f0
jmp 0xb26b1
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
je 0xb24c3
movq -0x38(%rbp), %rdi
leaq 0xabcd3(%rip), %rsi     # 0x15e180
leaq 0xabdb4(%rip), %rdx     # 0x15e268
xorl %eax, %eax
movl %eax, %ecx
callq 0x53f0
movq %rax, -0x40(%rbp)
jmp 0xb24cb
xorl %eax, %eax
movq %rax, -0x40(%rbp)
jmp 0xb24cb
movq -0x40(%rbp), %rdi
callq 0xb4fb0
jmp 0xb26b1
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, %rax
je 0xb2508
movq -0x48(%rbp), %rdi
leaq 0xabc8e(%rip), %rsi     # 0x15e180
leaq 0xabddf(%rip), %rdx     # 0x15e2d8
xorl %eax, %eax
movl %eax, %ecx
callq 0x53f0
movq %rax, -0x50(%rbp)
jmp 0xb2510
xorl %eax, %eax
movq %rax, -0x50(%rbp)
jmp 0xb2510
movq -0x50(%rbp), %rdi
callq 0xb6210
jmp 0xb26b1
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
cmpq $0x0, %rax
je 0xb254d
movq -0x58(%rbp), %rdi
leaq 0xabc49(%rip), %rsi     # 0x15e180
leaq 0xabdd2(%rip), %rdx     # 0x15e310
xorl %eax, %eax
movl %eax, %ecx
callq 0x53f0
movq %rax, -0x60(%rbp)
jmp 0xb2555
xorl %eax, %eax
movq %rax, -0x60(%rbp)
jmp 0xb2555
movq -0x60(%rbp), %rdi
callq 0xb1680
jmp 0xb26b1
movq -0x8(%rbp), %rax
movq %rax, -0x68(%rbp)
cmpq $0x0, %rax
je 0xb2592
movq -0x68(%rbp), %rdi
leaq 0xabc04(%rip), %rsi     # 0x15e180
leaq 0xabdfd(%rip), %rdx     # 0x15e380
xorl %eax, %eax
movl %eax, %ecx
callq 0x53f0
movq %rax, -0x70(%rbp)
jmp 0xb259a
xorl %eax, %eax
movq %rax, -0x70(%rbp)
jmp 0xb259a
movq -0x70(%rbp), %rdi
callq 0xb6e00
jmp 0xb26b1
movq -0x8(%rbp), %rax
movq %rax, -0x78(%rbp)
cmpq $0x0, %rax
je 0xb25d7
movq -0x78(%rbp), %rdi
leaq 0xabbbf(%rip), %rsi     # 0x15e180
leaq 0xabd80(%rip), %rdx     # 0x15e348
xorl %eax, %eax
movl %eax, %ecx
callq 0x53f0
movq %rax, -0x80(%rbp)
jmp 0xb25df
xorl %eax, %eax
movq %rax, -0x80(%rbp)
jmp 0xb25df
movq -0x80(%rbp), %rdi
callq 0xb75a0
jmp 0xb26b1
movq -0x8(%rbp), %rax
movq %rax, -0x88(%rbp)
cmpq $0x0, %rax
je 0xb2625
movq -0x88(%rbp), %rdi
leaq 0xabb74(%rip), %rsi     # 0x15e180
leaq 0xabc8d(%rip), %rdx     # 0x15e2a0
xorl %eax, %eax
movl %eax, %ecx
callq 0x53f0
movq %rax, -0x90(%rbp)
jmp 0xb2630
xorl %eax, %eax
movq %rax, -0x90(%rbp)
jmp 0xb2630
movq -0x90(%rbp), %rdi
callq 0xb7dd0
jmp 0xb26b1
movq -0x8(%rbp), %rax
movq %rax, -0x98(%rbp)
cmpq $0x0, %rax
je 0xb2676
movq -0x98(%rbp), %rdi
leaq 0xabb23(%rip), %rsi     # 0x15e180
leaq 0xabb2c(%rip), %rdx     # 0x15e190
xorl %eax, %eax
movl %eax, %ecx
callq 0x53f0
movq %rax, -0xa0(%rbp)
jmp 0xb2681
xorl %eax, %eax
movq %rax, -0xa0(%rbp)
jmp 0xb2681
movq -0xa0(%rbp), %rdi
callq 0xba5d0
jmp 0xb26b1
movq 0xac942(%rip), %rdi     # 0x15efd8
leaq 0x3ea74(%rip), %rsi     # 0xf1111
callq 0x5330
movq %rax, %rdi
movq 0xac914(%rip), %rsi     # 0x15efc0
callq 0x53a0
addq $0xa0, %rsp
popq %rbp
retq
nopw (%rax,%rax)