// File: /workspace/github_cpp_makefile_star2_O2/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 %r12
pushq %rbx
subq $0x170, %rsp            # imm = 0x170
movq %rdi, %rbx
movq 0x488a8(%rip), %rdi     # 0x8afd8
leaq 0x18e08(%rip), %rsi     # 0x5b53f
callq 0x5250
movl 0x14(%rbx), %eax
cmpl $0x2, %eax
je 0x428bf
cmpl $0x1, %eax
je 0x42863
testl %eax, %eax
jne 0x42a1a
leaq 0x18476(%rip), %rsi     # 0x5abd6
leaq 0x150(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0xfa26
pushq $0x48
popq %rdi
callq 0x5260
movq %rax, %r14
movq 0x18(%rbx), %rsi
addq $0x8, %rsi
leaq 0x130(%rsp), %rdi
callq 0x5340
leaq 0x18b0f(%rip), %rsi     # 0x5b2a8
leaq 0x110(%rsp), %rdi
leaq 0x6(%rsp), %rdx
callq 0xfa26
movb $0x1, %bpl
leaq 0x130(%rsp), %rsi
leaq 0x110(%rsp), %rdx
movq %r14, %rdi
callq 0x46fc0
xorl %ebp, %ebp
pushq $0x48
popq %rdi
callq 0x5260
movq %rax, %r15
leaq 0x49df6(%rip), %rdi     # 0x8c5d0
callq 0x3bb88
movl %eax, %ebx
leaq 0x16927(%rip), %rsi     # 0x5910f
leaq 0xf0(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0xfa26
movb $0x1, %r12b
leaq 0xf0(%rsp), %rdx
movq %r15, %rdi
movl %ebx, %esi
callq 0x46ac6
xorl %r12d, %r12d
leaq 0x49db7(%rip), %rdi     # 0x8c5d0
leaq 0x150(%rsp), %rsi
movq %r14, %rdx
movq %r15, %rcx
xorl %r8d, %r8d
callq 0x46a38
leaq 0xf0(%rsp), %rdi
callq 0x5120
leaq 0x110(%rsp), %rdi
callq 0x5120
leaq 0x130(%rsp), %rdi
callq 0x5120
leaq 0x150(%rsp), %rdi
jmp 0x42a05
leaq 0x184b1(%rip), %rsi     # 0x5ad1b
leaq 0xd0(%rsp), %rdi
leaq 0x6(%rsp), %rdx
callq 0xfa26
movq 0x20(%rbx), %rsi
leaq 0x8(%rsp), %rdi
callq 0x44859
movq 0x8(%rsp), %rdx
leaq 0x49d3a(%rip), %rdi     # 0x8c5d0
leaq 0xd0(%rsp), %rsi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x46a38
leaq 0x10(%rsp), %rdi
callq 0x5120
leaq 0xd0(%rsp), %rdi
jmp 0x42a05
leaq 0x18310(%rip), %rsi     # 0x5abd6
leaq 0xb0(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0xfa26
pushq $0x48
popq %rdi
callq 0x5260
movq %rax, %r14
movq 0x18(%rbx), %rsi
addq $0x8, %rsi
leaq 0x90(%rsp), %rdi
callq 0x5340
leaq 0x189a9(%rip), %rsi     # 0x5b2a8
leaq 0x70(%rsp), %rdi
leaq 0x6(%rsp), %rdx
callq 0xfa26
movb $0x1, %bpl
leaq 0x90(%rsp), %rsi
leaq 0x70(%rsp), %rdx
movq %r14, %rdi
callq 0x46fc0
xorl %ebp, %ebp
pushq $0x48
popq %rdi
callq 0x5260
movq %rax, %r15
leaq 0x49c96(%rip), %rdi     # 0x8c5d0
callq 0x3bb88
movl %eax, %ebp
leaq 0x167c7(%rip), %rsi     # 0x5910f
leaq 0x50(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0xfa26
movb $0x1, %r12b
leaq 0x50(%rsp), %rdx
movq %r15, %rdi
movl %ebp, %esi
callq 0x46ac6
xorl %r12d, %r12d
leaq 0x49c5d(%rip), %rdi     # 0x8c5d0
leaq 0xb0(%rsp), %rsi
movq %r14, %rdx
movq %r15, %rcx
xorl %r8d, %r8d
callq 0x46a38
leaq 0x50(%rsp), %rdi
callq 0x5120
leaq 0x70(%rsp), %rdi
callq 0x5120
leaq 0x90(%rsp), %rdi
callq 0x5120
leaq 0xb0(%rsp), %rdi
callq 0x5120
leaq 0x1835d(%rip), %rsi     # 0x5ad1b
leaq 0x30(%rsp), %rdi
leaq 0x6(%rsp), %rdx
callq 0xfa26
movq 0x20(%rbx), %rsi
leaq 0x8(%rsp), %rdi
callq 0x44859
movq 0x8(%rsp), %rdx
leaq 0x49be9(%rip), %rdi     # 0x8c5d0
leaq 0x30(%rsp), %rsi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x46a38
leaq 0x10(%rsp), %rdi
callq 0x5120
leaq 0x30(%rsp), %rdi
callq 0x5120
addq $0x170, %rsp            # imm = 0x170
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x485b7(%rip), %rdi     # 0x8afd8
leaq 0x181b6(%rip), %rsi     # 0x5abde
callq 0x5250
movq %rax, %rdi
addq $0x170, %rsp            # imm = 0x170
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x5130
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x5120
jmp 0x42a56
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
jmp 0x42b82
jmp 0x42acc
jmp 0x42a66
jmp 0x42a6b
movq %rax, %rbx
jmp 0x42ae9
movq %rax, %rbx
jmp 0x42b0a
movq %rax, %rbx
movb $0x1, %bpl
jmp 0x42b29
movq %rax, %rbx
movb $0x1, %bpl
jmp 0x42b5d
movq %rax, %rbx
jmp 0x42b3b
movq %rax, %rbx
jmp 0x42b6f
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x5120
jmp 0x42abb
movq %rax, %rbx
jmp 0x42b46
movq %rax, %rbx
jmp 0x42b7a
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
jmp 0x42b82
jmp 0x42acc
jmp 0x42acc
movq %rax, %rbx
jmp 0x42b87
movq %rax, %rbx
leaq 0xf0(%rsp), %rdi
callq 0x5120
testb %r12b, %r12b
je 0x42af4
pushq $0x48
popq %rsi
movq %r15, %rdi
callq 0x5270
xorl %ebp, %ebp
jmp 0x42b1c
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x5120
testb %r12b, %r12b
je 0x42b15
pushq $0x48
popq %rsi
movq %r15, %rdi
callq 0x5270
xorl %ebp, %ebp
jmp 0x42b53
movq %rax, %rbx
leaq 0x110(%rsp), %rdi
callq 0x5120
leaq 0x130(%rsp), %rdi
callq 0x5120
testb %bpl, %bpl
je 0x42b46
pushq $0x48
popq %rsi
movq %r14, %rdi
callq 0x5270
leaq 0x150(%rsp), %rdi
jmp 0x42b82
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x5120
leaq 0x90(%rsp), %rdi
callq 0x5120
testb %bpl, %bpl
je 0x42b7a
pushq $0x48
popq %rsi
movq %r14, %rdi
callq 0x5270
leaq 0xb0(%rsp), %rdi
callq 0x5120
movq %rbx, %rdi
callq 0x53f0