// File: rfotino[P]consolite-compiler/src/util.cpp
// Function: operandValueToReg(Parser*, Operand const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void operandValueToReg(Parser *parser,
                       const Operand& operand,
                       const std::string& reg) {
  if (OperandType::ADDRESS == operand.type()) {
    parser->writeInst("POP " + reg);
    parser->writeInst("LOAD " + reg + " " + reg);
  } else if (OperandType::REGISTER == operand.type()) {
    parser->writeInst("MOV " + reg + " " + operand.reg());
  } else if (OperandType::VALUE == operand.type()) {
    parser->writeInst("POP " + reg);
  } else if (OperandType::LITERAL == operand.type()) {
    parser->writeInst("MOVI " + reg + " " + toHexStr(operand.literal()));
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x220, %rsp            # imm = 0x220
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x325e0
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x6c61b
movq -0x8(%rbp), %rax
movq %rax, -0x1d8(%rbp)
movq -0x18(%rbp), %rdx
leaq 0x2c36(%rip), %rsi      # 0x6f128
leaq -0x38(%rbp), %rdi
movq %rdi, -0x1d0(%rbp)
callq 0xdc30
movq -0x1d8(%rbp), %rdi
movq -0x1d0(%rbp), %rsi
callq 0xc600
jmp 0x6c517
leaq -0x38(%rbp), %rdi
callq 0x8848
movq -0x8(%rbp), %rax
movq %rax, -0x1e8(%rbp)
movq -0x18(%rbp), %rdx
leaq 0x50c2(%rip), %rsi      # 0x715f8
leaq -0xa8(%rbp), %rdi
movq %rdi, -0x1e0(%rbp)
callq 0xdc30
movq -0x1e0(%rbp), %rsi
leaq 0x2be2(%rip), %rdx      # 0x6f139
leaq -0x88(%rbp), %rdi
callq 0xe020
jmp 0x6c565
movq -0x18(%rbp), %rdx
leaq -0x68(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0xdfd0
jmp 0x6c57b
movq -0x1e8(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0xc600
jmp 0x6c58d
leaq -0x68(%rbp), %rdi
callq 0x8848
leaq -0x88(%rbp), %rdi
callq 0x8848
leaq -0xa8(%rbp), %rdi
callq 0x8848
jmp 0x6c938
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x8848
jmp 0x6c941
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x6c60a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x6c5fe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x8848
leaq -0x88(%rbp), %rdi
callq 0x8848
leaq -0xa8(%rbp), %rdi
callq 0x8848
jmp 0x6c941
movq -0x10(%rbp), %rdi
callq 0x325e0
movl %eax, %ecx
movl $0x1, %eax
cmpl %ecx, %eax
jne 0x6c75b
movq -0x8(%rbp), %rax
movq %rax, -0x1f8(%rbp)
movq -0x18(%rbp), %rdx
leaq 0x2ae4(%rip), %rsi      # 0x6f12d
leaq -0x108(%rbp), %rdi
movq %rdi, -0x1f0(%rbp)
callq 0xdc30
movq -0x1f0(%rbp), %rsi
leaq 0x2acf(%rip), %rdx      # 0x6f139
leaq -0xe8(%rbp), %rdi
callq 0xe020
jmp 0x6c678
movq -0x10(%rbp), %rsi
leaq -0x128(%rbp), %rdi
callq 0x32640
jmp 0x6c68a
leaq -0xc8(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
leaq -0x128(%rbp), %rdx
callq 0x33bb0
jmp 0x6c6a6
movq -0x1f8(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0xc600
jmp 0x6c6bb
leaq -0xc8(%rbp), %rdi
callq 0x8848
leaq -0x128(%rbp), %rdi
callq 0x8848
leaq -0xe8(%rbp), %rdi
callq 0x8848
leaq -0x108(%rbp), %rdi
callq 0x8848
jmp 0x6c936
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x6c74a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x6c73e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x6c732
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x8848
leaq -0x128(%rbp), %rdi
callq 0x8848
leaq -0xe8(%rbp), %rdi
callq 0x8848
leaq -0x108(%rbp), %rdi
callq 0x8848
jmp 0x6c941
movq -0x10(%rbp), %rdi
callq 0x325e0
movl %eax, %ecx
movl $0x2, %eax
cmpl %ecx, %eax
jne 0x6c7db
movq -0x8(%rbp), %rax
movq %rax, -0x208(%rbp)
movq -0x18(%rbp), %rdx
leaq 0x29a3(%rip), %rsi      # 0x6f128
leaq -0x148(%rbp), %rdi
movq %rdi, -0x200(%rbp)
callq 0xdc30
movq -0x208(%rbp), %rdi
movq -0x200(%rbp), %rsi
callq 0xc600
jmp 0x6c7ad
leaq -0x148(%rbp), %rdi
callq 0x8848
jmp 0x6c934
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x148(%rbp), %rdi
callq 0x8848
jmp 0x6c941
movq -0x10(%rbp), %rdi
callq 0x325e0
movl %eax, %ecx
movl $0x3, %eax
cmpl %ecx, %eax
jne 0x6c932
movq -0x8(%rbp), %rax
movq %rax, -0x218(%rbp)
movq -0x18(%rbp), %rdx
leaq 0x4df5(%rip), %rsi      # 0x715fe
leaq -0x1a8(%rbp), %rdi
movq %rdi, -0x210(%rbp)
callq 0xdc30
movq -0x210(%rbp), %rsi
leaq 0x290f(%rip), %rdx      # 0x6f139
leaq -0x188(%rbp), %rdi
callq 0xe020
jmp 0x6c838
movq -0x10(%rbp), %rdi
callq 0x6ddb0
movw %ax, -0x21a(%rbp)
jmp 0x6c84a
movw -0x21a(%rbp), %ax
movzwl %ax, %esi
leaq -0x1c8(%rbp), %rdi
movl $0x4, %edx
callq 0x6c950
jmp 0x6c867
leaq -0x168(%rbp), %rdi
leaq -0x188(%rbp), %rsi
leaq -0x1c8(%rbp), %rdx
callq 0x33bb0
jmp 0x6c883
movq -0x218(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0xc600
jmp 0x6c898
leaq -0x168(%rbp), %rdi
callq 0x8848
leaq -0x1c8(%rbp), %rdi
callq 0x8848
leaq -0x188(%rbp), %rdi
callq 0x8848
leaq -0x1a8(%rbp), %rdi
callq 0x8848
jmp 0x6c932
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x6c924
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x6c918
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x6c90c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x168(%rbp), %rdi
callq 0x8848
leaq -0x1c8(%rbp), %rdi
callq 0x8848
leaq -0x188(%rbp), %rdi
callq 0x8848
leaq -0x1a8(%rbp), %rdi
callq 0x8848
jmp 0x6c941
jmp 0x6c934
jmp 0x6c936
jmp 0x6c938
addq $0x220, %rsp            # imm = 0x220
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x8750
nopw (%rax,%rax)