// File: 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
movq %rsp, %rbp
subq $0x260, %rsp            # imm = 0x260
movq %rdi, -0x8(%rbp)
movq 0xa81c2(%rip), %rdi     # 0x15efd8
leaq 0x3ae12(%rip), %rsi     # 0xf1c2f
callq 0x5330
movq -0x8(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x1ec(%rbp)
testl %eax, %eax
je 0xb6e5a
jmp 0xb6e35
movl -0x1ec(%rbp), %eax
subl $0x1, %eax
je 0xb70ee
jmp 0xb6e46
movl -0x1ec(%rbp), %eax
subl $0x2, %eax
je 0xb71d1
jmp 0xb756a
leaq -0x29(%rbp), %rdi
movq %rdi, -0x1f8(%rbp)
callq 0x55d0
movq -0x1f8(%rbp), %rdx
leaq 0x3a46e(%rip), %rsi     # 0xf12e6
leaq -0x28(%rbp), %rdi
callq 0x19840
jmp 0xb6e83
movl $0x48, %edi
callq 0x5340
movq %rax, -0x200(%rbp)
jmp 0xb6e96
movb $0x1, -0x82(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rsi
addq $0x8, %rsi
leaq -0x60(%rbp), %rdi
callq 0x5150
jmp 0xb6eb4
leaq -0x81(%rbp), %rdi
movq %rdi, -0x208(%rbp)
callq 0x55d0
movq -0x208(%rbp), %rdx
leaq 0x3aacb(%rip), %rsi     # 0xf19a0
leaq -0x80(%rbp), %rdi
callq 0x19840
jmp 0xb6ee0
movq -0x200(%rbp), %rdi
leaq -0x60(%rbp), %rsi
leaq -0x80(%rbp), %rdx
callq 0xbeae0
jmp 0xb6ef6
movb $0x0, -0x82(%rbp)
movl $0x48, %edi
callq 0x5340
movq %rax, -0x210(%rbp)
jmp 0xb6f10
movb $0x1, -0xaa(%rbp)
leaq 0xa97b2(%rip), %rdi     # 0x1606d0
callq 0xa01e0
movl %eax, -0x214(%rbp)
jmp 0xb6f2b
leaq -0xa9(%rbp), %rdi
movq %rdi, -0x220(%rbp)
callq 0x55d0
movq -0x220(%rbp), %rdx
leaq 0x382fb(%rip), %rsi     # 0xef247
leaq -0xa8(%rbp), %rdi
callq 0x19840
jmp 0xb6f5a
movl -0x214(%rbp), %esi
movq -0x210(%rbp), %rdi
leaq -0xa8(%rbp), %rdx
callq 0xbdfe0
jmp 0xb6f75
movq -0x210(%rbp), %rcx
movq -0x200(%rbp), %rdx
movb $0x0, -0xaa(%rbp)
leaq 0xa973f(%rip), %rdi     # 0x1606d0
xorl %eax, %eax
movl %eax, %r8d
leaq -0x28(%rbp), %rsi
callq 0xbdf00
jmp 0xb6fa1
leaq -0xa8(%rbp), %rdi
callq 0x5200
leaq -0xa9(%rbp), %rdi
callq 0x53c0
leaq -0x80(%rbp), %rdi
callq 0x5200
leaq -0x81(%rbp), %rdi
callq 0x53c0
leaq -0x60(%rbp), %rdi
callq 0x5200
leaq -0x28(%rbp), %rdi
callq 0x5200
leaq -0x29(%rbp), %rdi
callq 0x53c0
jmp 0xb758c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xb70e0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xb70d7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xb70b9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xb70a4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xb709b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xb707d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xb7071
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x5200
leaq -0xa9(%rbp), %rdi
callq 0x53c0
testb $0x1, -0xaa(%rbp)
jne 0xb7088
jmp 0xb7099
movq -0x210(%rbp), %rdi
movl $0x48, %esi
callq 0x5350
jmp 0xb709b
leaq -0x80(%rbp), %rdi
callq 0x5200
leaq -0x81(%rbp), %rdi
callq 0x53c0
leaq -0x60(%rbp), %rdi
callq 0x5200
testb $0x1, -0x82(%rbp)
jne 0xb70c4
jmp 0xb70d5
movq -0x200(%rbp), %rdi
movl $0x48, %esi
callq 0x5350
jmp 0xb70d7
leaq -0x28(%rbp), %rdi
callq 0x5200
leaq -0x29(%rbp), %rdi
callq 0x53c0
jmp 0xb7595
leaq -0xd1(%rbp), %rdi
movq %rdi, -0x228(%rbp)
callq 0x55d0
movq -0x228(%rbp), %rdx
leaq 0x3a304(%rip), %rsi     # 0xf1413
leaq -0xd0(%rbp), %rdi
callq 0x19840
jmp 0xb711d
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
leaq -0x100(%rbp), %rdi
callq 0xba600
jmp 0xb7133
movq -0x100(%rbp), %rdx
leaq 0xa958f(%rip), %rdi     # 0x1606d0
xorl %eax, %eax
movl %eax, %r8d
leaq -0xd0(%rbp), %rsi
movq %r8, %rcx
callq 0xbdf00
jmp 0xb7157
leaq -0x100(%rbp), %rdi
callq 0xbf290
leaq -0xd0(%rbp), %rdi
callq 0x5200
leaq -0xd1(%rbp), %rdi
callq 0x53c0
jmp 0xb758c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xb71c0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xb71b4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x100(%rbp), %rdi
callq 0xbf290
leaq -0xd0(%rbp), %rdi
callq 0x5200
leaq -0xd1(%rbp), %rdi
callq 0x53c0
jmp 0xb7595
leaq -0x121(%rbp), %rdi
movq %rdi, -0x230(%rbp)
callq 0x55d0
movq -0x230(%rbp), %rdx
leaq 0x3a0f4(%rip), %rsi     # 0xf12e6
leaq -0x120(%rbp), %rdi
callq 0x19840
jmp 0xb7200
movl $0x48, %edi
callq 0x5340
movq %rax, -0x238(%rbp)
jmp 0xb7213
movb $0x1, -0x16a(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rsi
addq $0x8, %rsi
leaq -0x148(%rbp), %rdi
callq 0x5150
jmp 0xb7234
leaq -0x169(%rbp), %rdi
movq %rdi, -0x240(%rbp)
callq 0x55d0
movq -0x240(%rbp), %rdx
leaq 0x3a74b(%rip), %rsi     # 0xf19a0
leaq -0x168(%rbp), %rdi
callq 0x19840
jmp 0xb7263
movq -0x238(%rbp), %rdi
leaq -0x148(%rbp), %rsi
leaq -0x168(%rbp), %rdx
callq 0xbeae0
jmp 0xb727f
movb $0x0, -0x16a(%rbp)
movl $0x48, %edi
callq 0x5340
movq %rax, -0x248(%rbp)
jmp 0xb7299
movb $0x1, -0x192(%rbp)
leaq 0xa9429(%rip), %rdi     # 0x1606d0
callq 0xa01e0
movl %eax, -0x24c(%rbp)
jmp 0xb72b4
leaq -0x191(%rbp), %rdi
movq %rdi, -0x258(%rbp)
callq 0x55d0
movq -0x258(%rbp), %rdx
leaq 0x37f72(%rip), %rsi     # 0xef247
leaq -0x190(%rbp), %rdi
callq 0x19840
jmp 0xb72e3
movl -0x24c(%rbp), %esi
movq -0x248(%rbp), %rdi
leaq -0x190(%rbp), %rdx
callq 0xbdfe0
jmp 0xb72fe
movq -0x248(%rbp), %rcx
movq -0x238(%rbp), %rdx
movb $0x0, -0x192(%rbp)
leaq 0xa93b6(%rip), %rdi     # 0x1606d0
xorl %eax, %eax
movl %eax, %r8d
leaq -0x120(%rbp), %rsi
callq 0xbdf00
jmp 0xb732d
leaq -0x190(%rbp), %rdi
callq 0x5200
leaq -0x191(%rbp), %rdi
callq 0x53c0
leaq -0x168(%rbp), %rdi
callq 0x5200
leaq -0x169(%rbp), %rdi
callq 0x53c0
leaq -0x148(%rbp), %rdi
callq 0x5200
leaq -0x120(%rbp), %rdi
callq 0x5200
leaq -0x121(%rbp), %rdi
callq 0x53c0
leaq -0x1b9(%rbp), %rdi
movq %rdi, -0x260(%rbp)
callq 0x55d0
movq -0x260(%rbp), %rdx
leaq 0x3a071(%rip), %rsi     # 0xf1413
leaq -0x1b8(%rbp), %rdi
callq 0x19840
jmp 0xb73b0
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
leaq -0x1e8(%rbp), %rdi
callq 0xba600
jmp 0xb73c6
movq -0x1e8(%rbp), %rdx
leaq 0xa92fc(%rip), %rdi     # 0x1606d0
xorl %eax, %eax
movl %eax, %r8d
leaq -0x1b8(%rbp), %rsi
movq %r8, %rcx
callq 0xbdf00
jmp 0xb73ea
leaq -0x1e8(%rbp), %rdi
callq 0xbf290
leaq -0x1b8(%rbp), %rdi
callq 0x5200
leaq -0x1b9(%rbp), %rdi
callq 0x53c0
jmp 0xb758c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xb750e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xb7502
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xb74e4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xb74cc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xb74c0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xb74a2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xb7496
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x190(%rbp), %rdi
callq 0x5200
leaq -0x191(%rbp), %rdi
callq 0x53c0
testb $0x1, -0x192(%rbp)
jne 0xb74ad
jmp 0xb74be
movq -0x248(%rbp), %rdi
movl $0x48, %esi
callq 0x5350
jmp 0xb74c0
leaq -0x168(%rbp), %rdi
callq 0x5200
leaq -0x169(%rbp), %rdi
callq 0x53c0
leaq -0x148(%rbp), %rdi
callq 0x5200
testb $0x1, -0x16a(%rbp)
jne 0xb74ef
jmp 0xb7500
movq -0x238(%rbp), %rdi
movl $0x48, %esi
callq 0x5350
jmp 0xb7502
leaq -0x120(%rbp), %rdi
callq 0x5200
leaq -0x121(%rbp), %rdi
callq 0x53c0
jmp 0xb7595
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xb755c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xb7550
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x1e8(%rbp), %rdi
callq 0xbf290
leaq -0x1b8(%rbp), %rdi
callq 0x5200
leaq -0x1b9(%rbp), %rdi
callq 0x53c0
jmp 0xb7595
movq 0xa7a67(%rip), %rdi     # 0x15efd8
leaq 0x39d76(%rip), %rsi     # 0xf12ee
callq 0x5330
movq %rax, %rdi
movq 0xa7a39(%rip), %rsi     # 0x15efc0
callq 0x53a0
addq $0x260, %rsp            # imm = 0x260
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x55b0
nop