// File: /workspace/github_cpp_makefile_star2_O1/sighingnow[P]compile-pascal/pl0_tac_gen.cpp
// Function: pl0_tac_write_stmt(pl0_ast_write_stmt const*)
void pl0_tac_write_stmt(pl0_ast_write_stmt const *stmt) {
    cout << __func__;
    switch (stmt->t) {
        case pl0_ast_write_stmt::type_t::ONLY_STRING:
            irb.emit("write_s", new Value(stmt->str->val, "string"), new Value(irb.makelabel(), "integer"));
            break;
        case pl0_ast_write_stmt::type_t::ONLY_EXPR:
            irb.emit("write_e", pl0_tac_expr(stmt->expr).first);
            break;
        case pl0_ast_write_stmt::type_t::STRING_AND_EXPR:
            irb.emit("write_s", new Value(stmt->str->val, "string"), new Value(irb.makelabel(), "integer"));
            irb.emit("write_e", pl0_tac_expr(stmt->expr).first);
            break;
        default: cout << "UNIMPLEMENT WRITE TYPE" << endl;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x178, %rsp            # imm = 0x178
movq %rdi, %rbx
movq 0x4bdbd(%rip), %r14     # 0xbffd8
leaq 0x252ed(%rip), %rsi     # 0x9950f
movq %r14, %rdi
xorl %edx, %edx
callq 0x52e0
movl 0x14(%rbx), %eax
cmpl $0x2, %eax
je 0x74468
cmpl $0x1, %eax
je 0x743db
testl %eax, %eax
jne 0x74685
leaq 0x168(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x24959(%rip), %rsi     # 0x98bb6
leaq 0x24959(%rip), %rdx     # 0x98bbd
leaq 0x158(%rsp), %rdi
callq 0x2670a
movl $0x48, %edi
callq 0x5250
movq %rax, %r13
movq 0x18(%rbx), %rax
leaq 0x88(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
addq %rsi, %rdx
leaq 0x78(%rsp), %rdi
movq %r13, 0x8(%rsp)
callq 0x36590
leaq 0xe8(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x24fbd(%rip), %rsi     # 0x99278
leaq 0x24fbc(%rip), %rdx     # 0x9927e
leaq 0xd8(%rsp), %rdi
callq 0x2670a
movb $0x1, %bl
leaq 0x78(%rsp), %rsi
leaq 0xd8(%rsp), %rdx
movq %r13, %rdi
callq 0x7be1c
xorl %ebx, %ebx
movl $0x48, %edi
callq 0x5250
movq %rax, %r15
leaq 0x4d2ac(%rip), %rdi     # 0xc15a8
callq 0x69188
movl %eax, %ebx
leaq 0xc8(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x22df9(%rip), %rsi     # 0x9710f
leaq 0x22df9(%rip), %rdx     # 0x97116
leaq 0xb8(%rsp), %rdi
callq 0x2670a
movb $0x1, %r13b
leaq 0xb8(%rsp), %rdx
movq %r15, %rdi
movl %ebx, %esi
callq 0x7b654
xorl %r13d, %r13d
leaq 0x4d25f(%rip), %rdi     # 0xc15a8
leaq 0x158(%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r15, %rcx
xorl %r8d, %r8d
callq 0x7b53e
movq 0xb8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x7437e
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x5260
movq 0xd8(%rsp), %rdi
cmpq %r14, %rdi
leaq 0x88(%rsp), %rbx
je 0x743a3
movq 0xe8(%rsp), %rsi
incq %rsi
callq 0x5260
movq 0x78(%rsp), %rdi
cmpq %rbx, %rdi
je 0x743bd
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x5260
movq 0x158(%rsp), %rdi
cmpq %r12, %rdi
je 0x74673
movq 0x168(%rsp), %rsi
jmp 0x7466b
leaq 0x148(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x248fc(%rip), %rsi     # 0x98ceb
leaq 0x248fc(%rip), %rdx     # 0x98cf2
leaq 0x138(%rsp), %rdi
callq 0x2670a
movq 0x20(%rbx), %rsi
leaq 0x10(%rsp), %rdi
callq 0x77914
movq 0x10(%rsp), %rdx
leaq 0x4d18b(%rip), %rdi     # 0xc15a8
leaq 0x138(%rsp), %rsi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x7b53e
leaq 0x28(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7444a
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x5260
movq 0x138(%rsp), %rdi
cmpq %r12, %rdi
je 0x74673
movq 0x148(%rsp), %rsi
jmp 0x7466b
leaq 0x128(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x2473a(%rip), %rsi     # 0x98bb6
leaq 0x2473a(%rip), %rdx     # 0x98bbd
leaq 0x118(%rsp), %rdi
callq 0x2670a
movl $0x48, %edi
callq 0x5250
movq %rax, %r14
movq 0x18(%rbx), %rax
leaq 0x68(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
addq %rsi, %rdx
leaq 0x58(%rsp), %rdi
movq %r14, 0x8(%rsp)
callq 0x36590
leaq 0x48(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x24da4(%rip), %rsi     # 0x99278
leaq 0x24da3(%rip), %rdx     # 0x9927e
leaq 0x38(%rsp), %rdi
callq 0x2670a
movb $0x1, %bpl
leaq 0x58(%rsp), %rsi
leaq 0x38(%rsp), %rdx
movq %r14, %rdi
callq 0x7be1c
xorl %ebp, %ebp
movl $0x48, %edi
callq 0x5250
movq %rax, %r15
leaq 0x4d098(%rip), %rdi     # 0xc15a8
callq 0x69188
movl %eax, %ebp
leaq 0xa8(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x22be5(%rip), %rsi     # 0x9710f
leaq 0x22be5(%rip), %rdx     # 0x97116
leaq 0x98(%rsp), %rdi
callq 0x2670a
movb $0x1, %r13b
leaq 0x98(%rsp), %rdx
movq %r15, %rdi
movl %ebp, %esi
callq 0x7b654
xorl %r13d, %r13d
leaq 0x4d04b(%rip), %rdi     # 0xc15a8
leaq 0x118(%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r15, %rcx
xorl %r8d, %r8d
callq 0x7b53e
movq 0x98(%rsp), %rdi
cmpq %r14, %rdi
je 0x74592
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x5260
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x745ae
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x5260
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x745ca
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x5260
movq 0x118(%rsp), %rdi
cmpq %r12, %rdi
je 0x745e7
movq 0x128(%rsp), %rsi
incq %rsi
callq 0x5260
leaq 0x108(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x246f0(%rip), %rsi     # 0x98ceb
leaq 0x246f0(%rip), %rdx     # 0x98cf2
leaq 0xf8(%rsp), %rdi
callq 0x2670a
movq 0x20(%rbx), %rsi
leaq 0x10(%rsp), %rdi
callq 0x77914
movq 0x10(%rsp), %rdx
leaq 0x4cf7f(%rip), %rdi     # 0xc15a8
leaq 0xf8(%rsp), %rsi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x7b53e
leaq 0x28(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x74656
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x5260
movq 0xf8(%rsp), %rdi
cmpq %r12, %rdi
je 0x74673
movq 0x108(%rsp), %rsi
incq %rsi
callq 0x5260
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x24532(%rip), %rsi     # 0x98bbe
movl $0x16, %edx
movq %r14, %rdi
callq 0x52e0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x5240
movsbl %al, %esi
movq %r14, %rdi
callq 0x5030
movq %rax, %rdi
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5190
movq %rax, (%rsp)
leaq 0x28(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x746f6
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x5260
jmp 0x746f6
movq %rax, (%rsp)
movq 0xf8(%rsp), %rdi
jmp 0x748b7
jmp 0x74707
jmp 0x74713
movq %rax, (%rsp)
movb $0x1, %r13b
jmp 0x747b2
movq %rax, (%rsp)
movb $0x1, %r13b
jmp 0x747e9
movq %rax, (%rsp)
movb $0x1, %bl
jmp 0x74820
movq %rax, (%rsp)
movb $0x1, %bpl
jmp 0x7487f
movq %rax, (%rsp)
movb $0x1, %bl
jmp 0x74842
movq %rax, (%rsp)
movb $0x1, %bpl
jmp 0x7489b
movq %rax, (%rsp)
leaq 0x28(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x74784
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x5260
jmp 0x74784
movq %rax, (%rsp)
jmp 0x74855
movq %rax, (%rsp)
jmp 0x748af
movq %rax, (%rsp)
movq 0x138(%rsp), %rdi
jmp 0x748b7
movq %rax, (%rsp)
movq 0xb8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x747b2
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x5260
testb %r13b, %r13b
je 0x747c4
movl $0x48, %esi
movq %r15, %rdi
callq 0x5260
xorl %ebx, %ebx
jmp 0x74803
movq %rax, (%rsp)
movq 0x98(%rsp), %rdi
cmpq %r14, %rdi
je 0x747e9
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x5260
testb %r13b, %r13b
je 0x747fb
movl $0x48, %esi
movq %r15, %rdi
callq 0x5260
xorl %ebp, %ebp
jmp 0x74863
movq %rax, (%rsp)
movq 0xd8(%rsp), %rdi
cmpq %r14, %rdi
je 0x74820
movq 0xe8(%rsp), %rsi
incq %rsi
callq 0x5260
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x74842
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x5260
testb %bl, %bl
je 0x74855
movl $0x48, %esi
movq 0x8(%rsp), %rdi
callq 0x5260
movq 0x158(%rsp), %rdi
jmp 0x748b7
movq %rax, (%rsp)
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x7487f
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x5260
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0x7489b
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x5260
testb %bpl, %bpl
je 0x748af
movl $0x48, %esi
movq 0x8(%rsp), %rdi
callq 0x5260
movq 0x118(%rsp), %rdi
cmpq %r12, %rdi
je 0x748c8
movq (%r12), %rsi
incq %rsi
callq 0x5260
movq (%rsp), %rdi
callq 0x53d0