// File: rfotino[P]consolite-compiler/src/syntax.cpp
// Function: GlobalVarToken::output(Parser*)
void GlobalVarToken::output(Parser *parser) {
  // Write out a label for the global variable.
  parser->writeln(_name + ":");
  if (_type.isArray()) {
    // The address for the array's elements will be the current byte
    // position plus the instruction size.
    parser->writeData(toHexStr(parser->getBytePos() + INST_SIZE), 1);
    // Write out the array's elements as hex values.
    std::string dataOutput;
    for (size_t i = 0; i < _arrayValues.size(); i++) {
      dataOutput += toHexStr(_arrayValues[i]);
      if (i + 1 < _arrayValues.size()) {
        dataOutput += " ";
      }
    }
    parser->writeData(dataOutput, _arrayValues.size());
  } else {
    // Not an array, just write out the single hex value.
    parser->writeData(toHexStr(_value), 1);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rsi
movq %rsi, -0xe0(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xd8(%rbp)
addq $0x70, %rsi
leaq 0x4b9f4(%rip), %rdx     # 0x71648
leaq -0x30(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
callq 0xdd40
movq -0xd8(%rbp), %rdi
movq -0xd0(%rbp), %rsi
callq 0xcc30
jmp 0x25c79
leaq -0x30(%rbp), %rdi
callq 0x8848
movq -0xe0(%rbp), %rdi
addq $0x10, %rdi
addq $0x28, %rdi
callq 0x33e20
testb $0x1, %al
jne 0x25c9f
jmp 0x25e8e
movq -0x10(%rbp), %rdi
movq %rdi, -0xf0(%rbp)
callq 0x33fb0
movw %ax, %cx
movw %cx, %ax
addl $0x4, %eax
movzwl %ax, %esi
leaq -0x60(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
movl $0x4, %edx
callq 0x6c950
movq -0xf0(%rbp), %rdi
movq -0xe8(%rbp), %rsi
movl $0x1, %edx
callq 0xcd10
jmp 0x25cea
leaq -0x60(%rbp), %rdi
callq 0x8848
leaq -0x80(%rbp), %rdi
callq 0x8590
movq $0x0, -0x88(%rbp)
movq -0xe0(%rbp), %rdi
movq -0x88(%rbp), %rax
movq %rax, -0xf8(%rbp)
addq $0x98, %rdi
callq 0x33fd0
movq %rax, %rcx
movq -0xf8(%rbp), %rax
cmpq %rcx, %rax
jae 0x25e46
movq -0xe0(%rbp), %rdi
addq $0x98, %rdi
movq -0x88(%rbp), %rsi
callq 0x33ff0
movzwl (%rax), %esi
leaq -0xa8(%rbp), %rdi
movl $0x4, %edx
callq 0x6c950
jmp 0x25d6b
leaq -0x80(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x8510
jmp 0x25d7d
leaq -0xa8(%rbp), %rdi
callq 0x8848
movq -0xe0(%rbp), %rdi
movq -0x88(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x100(%rbp)
addq $0x98, %rdi
callq 0x33fd0
movq %rax, %rcx
movq -0x100(%rbp), %rax
cmpq %rcx, %rax
jae 0x25e2d
leaq 0x49375(%rip), %rsi     # 0x6f139
leaq -0x80(%rbp), %rdi
callq 0x83c0
jmp 0x25dcf
jmp 0x25e2d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x8848
jmp 0x25f0a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x8848
jmp 0x25f0a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x25e83
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x8848
jmp 0x25e83
jmp 0x25e2f
movq -0x88(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x88(%rbp)
jmp 0x25d07
movq -0xe0(%rbp), %rdi
movq -0x10(%rbp), %rax
movq %rax, -0x108(%rbp)
addq $0x98, %rdi
callq 0x33fd0
movq -0x108(%rbp), %rdi
movl %eax, %edx
leaq -0x80(%rbp), %rsi
callq 0xcd10
jmp 0x25e78
leaq -0x80(%rbp), %rdi
callq 0x8848
jmp 0x25f01
leaq -0x80(%rbp), %rdi
callq 0x8848
jmp 0x25f0a
movq -0xe0(%rbp), %rax
movq -0x10(%rbp), %rcx
movq %rcx, -0x118(%rbp)
movzwl 0x92(%rax), %esi
leaq -0xc8(%rbp), %rdi
movq %rdi, -0x110(%rbp)
movl $0x4, %edx
callq 0x6c950
movq -0x118(%rbp), %rdi
movq -0x110(%rbp), %rsi
movl $0x1, %edx
callq 0xcd10
jmp 0x25ed9
leaq -0xc8(%rbp), %rdi
callq 0x8848
jmp 0x25f01
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x8848
jmp 0x25f0a
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x8750
nopw %cs:(%rax,%rax)