// File: fondoger[P]C0-Compiler/src/mips.cpp
// Function: gen_WRITE(_FourTuple const&)
static void gen_WRITE(const FourTuple &ft)
{
    assert(ft.a == "int" || ft.a == "str" || ft.a == "char");
    if (ft.a == "str") {
        MIPS(T << "la" << HT << "$a0, " << ft.b);
        MIPS(T << "li" << HT << "$v0, 4");
    }
    else if (ft.a == "int") {
        loadToReg("$a0", ft.b);
        MIPS(T << "li" << HT << "$v0, 1");
    }
    else { // ft.a == "char"
        loadToReg("$a0", ft.b);
        MIPS(T << "li" << HT << "$v0, 11");
    }
    MIPS(T << "syscall");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
addq $0x8, %rdi
leaq 0xa5eb(%rip), %rsi      # 0x357a9
callq 0x2d280
movb %al, %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, -0x62(%rbp)
jne 0x2b206
movq -0x8(%rbp), %rdi
addq $0x8, %rdi
leaq 0xa6a9(%rip), %rsi      # 0x35887
callq 0x2d280
movb %al, %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, -0x62(%rbp)
jne 0x2b206
movq -0x8(%rbp), %rdi
addq $0x8, %rdi
leaq 0x9eb5(%rip), %rsi      # 0x350b3
callq 0x2d280
movb %al, -0x62(%rbp)
movb -0x62(%rbp), %al
testb $0x1, %al
jne 0x2b20f
jmp 0x2b211
jmp 0x2b230
leaq 0xb025(%rip), %rdi      # 0x3623d
leaq 0xad71(%rip), %rsi      # 0x35f90
movl $0x135, %edx            # imm = 0x135
leaq 0xb043(%rip), %rcx      # 0x3626e
callq 0x3230
movq -0x8(%rbp), %rdi
addq $0x8, %rdi
leaq 0xa648(%rip), %rsi      # 0x35887
callq 0x2d280
testb $0x1, %al
jne 0x2b24d
jmp 0x2b2dc
leaq 0x1f3dc(%rip), %rdi     # 0x4a630
addq $0x10, %rdi
leaq 0xb031(%rip), %rsi      # 0x36290
callq 0x3300
movq %rax, %rdi
leaq 0xad86(%rip), %rsi      # 0x35ff4
callq 0x3300
movq %rax, %rdi
leaq 0xb016(%rip), %rsi      # 0x36293
callq 0x3300
movq %rax, %rdi
movq -0x8(%rbp), %rsi
addq $0x28, %rsi
callq 0x32c0
movq %rax, %rdi
callq 0x29270
leaq 0x1f38f(%rip), %rdi     # 0x4a630
addq $0x10, %rdi
leaq 0xad61(%rip), %rsi      # 0x3600d
callq 0x3300
movq %rax, %rdi
leaq 0xad39(%rip), %rsi      # 0x35ff4
callq 0x3300
movq %rax, %rdi
leaq 0xaf3d(%rip), %rsi      # 0x36207
callq 0x3300
movq %rax, %rdi
callq 0x29270
jmp 0x2b46b
movq -0x8(%rbp), %rdi
addq $0x8, %rdi
leaq 0xa4be(%rip), %rsi      # 0x357a9
callq 0x2d280
testb $0x1, %al
jne 0x2b2f9
jmp 0x2b3b4
leaq -0x29(%rbp), %rdi
movq %rdi, -0x70(%rbp)
callq 0x3570
movq -0x70(%rbp), %rdx
leaq 0xaf88(%rip), %rsi      # 0x36299
leaq -0x28(%rbp), %rdi
callq 0x3440
jmp 0x2b31c
movq -0x8(%rbp), %rsi
addq $0x28, %rsi
leaq -0x28(%rbp), %rdi
callq 0x2cf90
jmp 0x2b32f
leaq -0x28(%rbp), %rdi
callq 0x35e8
leaq -0x29(%rbp), %rdi
callq 0x3370
leaq 0x1f2e8(%rip), %rdi     # 0x4a630
addq $0x10, %rdi
leaq 0xacba(%rip), %rsi      # 0x3600d
callq 0x3300
movq %rax, %rdi
leaq 0xac92(%rip), %rsi      # 0x35ff4
callq 0x3300
movq %rax, %rdi
leaq 0xaf2c(%rip), %rsi      # 0x3629d
callq 0x3300
movq %rax, %rdi
callq 0x29270
jmp 0x2b469
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x2b3a6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x35e8
leaq -0x29(%rbp), %rdi
callq 0x3370
jmp 0x2b493
leaq -0x61(%rbp), %rdi
movq %rdi, -0x78(%rbp)
callq 0x3570
movq -0x78(%rbp), %rdx
leaq 0xaecd(%rip), %rsi      # 0x36299
leaq -0x60(%rbp), %rdi
callq 0x3440
jmp 0x2b3d7
movq -0x8(%rbp), %rsi
addq $0x28, %rsi
leaq -0x60(%rbp), %rdi
callq 0x2cf90
jmp 0x2b3ea
leaq -0x60(%rbp), %rdi
callq 0x35e8
leaq -0x61(%rbp), %rdi
callq 0x3370
leaq 0x1f22d(%rip), %rdi     # 0x4a630
addq $0x10, %rdi
leaq 0xabff(%rip), %rsi      # 0x3600d
callq 0x3300
movq %rax, %rdi
leaq 0xabd7(%rip), %rsi      # 0x35ff4
callq 0x3300
movq %rax, %rdi
leaq 0xae78(%rip), %rsi      # 0x362a4
callq 0x3300
movq %rax, %rdi
callq 0x29270
jmp 0x2b469
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x2b45e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x35e8
leaq -0x61(%rbp), %rdi
callq 0x3370
jmp 0x2b493
jmp 0x2b46b
leaq 0x1f1be(%rip), %rdi     # 0x4a630
addq $0x10, %rdi
leaq 0xab99(%rip), %rsi      # 0x36016
callq 0x3300
movq %rax, %rdi
callq 0x29270
addq $0x80, %rsp
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x3560
nopl (%rax)