// File: rfotino[P]consolite-assembler/src/parser.cpp
// Function: Parser::firstPass()
bool Parser::firstPass() {
  _tokenizer->reset();
  if (_tokenizer->hasError()) {
    return false;
  }

  bool error = false;
  unsigned line = 0;
  unsigned byte_pos = 0;
  std::vector<Token> tokens;
  while (true) {
    // Get the next line of tokens
    _tokenizer->getLineOfTokens(tokens);
    line++;
    // If there is an error or the tokenizer is
    // empty, break out of the loop
    if (_tokenizer->isEmpty()) {
      line--;
      break;
    }
    if (_tokenizer->hasError()) {
      error = true;
      std::cerr << "Error reading from input file on line "
                << line << "." << std::endl;
      break;
    }
    // If it's an empty line, do nothing
    if (0 == tokens.size()) {
      continue;
    }
    // If there's an unknown token, that's an error
    bool has_unknown = false;
    for (auto token = tokens.begin(); token != tokens.end(); token++) {
      if (UNKNOWN == token->getType()) {
        error = true;
        has_unknown = true;
        std::cerr << "Error: Unknown token '" << token->getData()
                  << "' on line " << line << "." << std::endl;
        break;
      }
    }
    // If there's an unknown token don't validate any further
    if (has_unknown) {
      continue;
    }
    // Validate based on lead token
    switch (tokens[0].getType()) {
    case OPCODE:
      // Validate further based on specific opcode
      if (_validateInstruction(tokens, line)) {
        byte_pos += 4;
      } else {
        error = true;
      }
      break;
    case REGISTER:
      error = true;
      std::cerr << "Error: REG '" << tokens[0].getData()
                << "' not allowed at start of instruction on line " << line
                << "." << std::endl;
      break;
    case DATA:
      // Make sure all tokens on this line are data, and
      // add their sizes to the byte offset at this point
      for (auto token = tokens.begin(); token != tokens.end(); token++) {
        if (DATA == token->getType()) {
          byte_pos += token->getSize();
        } else {
          error = true;
          std::cerr << "Error: Unknown token '" << token->getData()
               << "', expected DATA on line " << line
               << "." << std::endl;
          break;
        }
      }
      // Pad data to 4 bytes so that instructions that
      // follow are aligned correctly
      while (0 != byte_pos % 4) {
        byte_pos++;
      }
      break;
    case LABELDECL:
      {
        const std::string label = tokens[0].getData();
        if (1 == tokens.size()) {
          if (_labels.find(label) == _labels.end()) {
            _labels[label] = byte_pos;
          } else {
            error = true;
            std::cerr << "Error: Duplicate LABEL '" << label
                      << "' on line " << line << "." << std::endl;
          }
        } else {
          error = true;
          std::cerr << "Error: Invalid syntax, LABEL '" << label
                    << "' must be by itself on line " << line
                    << "." << std::endl;
        }
      }
      break;
    case LABELREF:
    case UNKNOWN:
      error = true;
      std::cerr << "Error: Unknown token '" << tokens[0].getData()
                << "' on line " << line << "." << std::endl;
      break;
    }
  }

  if (!error) {
    // Check that all of the label references have a corresponding
    // label. If not, that is another error.
    for (auto ref = _labelRefs.begin(); ref != _labelRefs.end(); ref++) {
      std::string ref_label = ref->first;
      unsigned ref_line = ref->second;
      if (_labels.find(ref_label) == _labels.end()) {
        error = true;
        std::cerr << "Error: Could not find LABEL for reference '"
                  << ref_label << "' on line " << ref_line
                  << "." << std::endl;
      }
    }
    // Check if the total size of the output will be too large,
    // which would be another error.
    if (MAX_OUTPUT_SIZE < byte_pos) {
      error = true;
      std::cerr << "Error: Output would be " << byte_pos
                << " bytes, which is larger than the maximum output size of "
                << MAX_OUTPUT_SIZE << " bytes." << std::endl;
    }
  }

  return !error;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x330, %rsp            # imm = 0x330
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x180(%rbp)
movq (%rax), %rdi
callq 0x6180
movq -0x180(%rbp), %rax
movq (%rax), %rdi
callq 0x6a40
testb $0x1, %al
jne 0xb157
jmp 0xb160
movb $0x0, -0x1(%rbp)
jmp 0xbcf1
movb $0x0, -0x11(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0xc5c0
jmp 0xb17d
movq -0x180(%rbp), %rax
movq (%rax), %rdi
leaq -0x38(%rbp), %rsi
callq 0x5f60
jmp 0xb192
movq -0x180(%rbp), %rax
movl -0x18(%rbp), %ecx
incl %ecx
movl %ecx, -0x18(%rbp)
movq (%rax), %rdi
callq 0xc5e0
movb %al, -0x181(%rbp)
jmp 0xb1b1
movb -0x181(%rbp), %al
testb $0x1, %al
jne 0xb1bd
jmp 0xb1dc
movl -0x18(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xba50
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0xbce6
movq -0x180(%rbp), %rax
movq (%rax), %rdi
callq 0x6a40
movb %al, -0x182(%rbp)
jmp 0xb1f3
movb -0x182(%rbp), %al
testb $0x1, %al
jne 0xb1ff
jmp 0xb26d
movb $0x1, -0x11(%rbp)
movq 0xade6(%rip), %rdi      # 0x15ff0
leaq 0x4090(%rip), %rsi      # 0xf2a1
callq 0x21e0
movq %rax, -0x190(%rbp)
jmp 0xb21f
movq -0x190(%rbp), %rdi
movl -0x18(%rbp), %esi
callq 0x22c0
movq %rax, -0x198(%rbp)
jmp 0xb237
movq -0x198(%rbp), %rdi
leaq 0x3f21(%rip), %rsi      # 0xf166
callq 0x21e0
movq %rax, -0x1a0(%rbp)
jmp 0xb253
movq -0x1a0(%rbp), %rdi
movq 0xad5f(%rip), %rsi      # 0x15fc0
callq 0x2240
jmp 0xb268
jmp 0xba50
leaq -0x38(%rbp), %rdi
callq 0x9620
movq %rax, %rcx
xorl %eax, %eax
cmpq %rcx, %rax
jne 0xb285
jmp 0xb17b
movb $0x0, -0x45(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x9470
movq %rax, -0x50(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x92a0
movq %rax, -0x58(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0xc630
testb $0x1, %al
jne 0xb2b9
jmp 0xb3d9
leaq -0x50(%rbp), %rdi
callq 0xc670
movq %rax, %rdi
callq 0xc520
movl %eax, -0x1a4(%rbp)
jmp 0xb2d2
movl -0x1a4(%rbp), %ecx
movl $0x5, %eax
cmpl %ecx, %eax
jne 0xb3c3
movb $0x1, -0x11(%rbp)
movb $0x1, -0x45(%rbp)
movq 0xacfc(%rip), %rdi      # 0x15ff0
leaq 0x3fcd(%rip), %rsi      # 0xf2c8
callq 0x21e0
movq %rax, -0x1b0(%rbp)
jmp 0xb309
leaq -0x50(%rbp), %rdi
callq 0xc670
movq %rax, %rsi
leaq -0x78(%rbp), %rdi
callq 0xc4c0
jmp 0xb320
movq -0x1b0(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x21c0
movq %rax, -0x1b8(%rbp)
jmp 0xb339
movq -0x1b8(%rbp), %rdi
leaq 0x3f98(%rip), %rsi      # 0xf2df
callq 0x21e0
movq %rax, -0x1c0(%rbp)
jmp 0xb355
movq -0x1c0(%rbp), %rdi
movl -0x18(%rbp), %esi
callq 0x22c0
movq %rax, -0x1c8(%rbp)
jmp 0xb36d
movq -0x1c8(%rbp), %rdi
leaq 0x3deb(%rip), %rsi      # 0xf166
callq 0x21e0
movq %rax, -0x1d0(%rbp)
jmp 0xb389
movq -0x1d0(%rbp), %rdi
movq 0xac29(%rip), %rsi      # 0x15fc0
callq 0x2240
jmp 0xb39e
leaq -0x78(%rbp), %rdi
callq 0x2120
jmp 0xb3d9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x2120
jmp 0xbce6
jmp 0xb3c5
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
callq 0xc690
movq %rax, -0x80(%rbp)
jmp 0xb296
testb $0x1, -0x45(%rbp)
je 0xb3e4
jmp 0xb17b
xorl %eax, %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
callq 0xc6d0
movq %rax, %rdi
callq 0xc520
movl %eax, -0x1d4(%rbp)
jmp 0xb401
movl -0x1d4(%rbp), %eax
movl %eax, %ecx
movq %rcx, -0x1e0(%rbp)
subl $0x5, %eax
ja 0xba4b
movq -0x1e0(%rbp), %rax
leaq 0x3d5d(%rip), %rcx      # 0xf184
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x180(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x18(%rbp), %rdx
callq 0x9e00
movb %al, -0x1e1(%rbp)
jmp 0xb44c
movb -0x1e1(%rbp), %al
testb $0x1, %al
jne 0xb458
jmp 0xb463
movl -0x1c(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x1c(%rbp)
jmp 0xb467
movb $0x1, -0x11(%rbp)
jmp 0xba4b
movb $0x1, -0x11(%rbp)
movq 0xab79(%rip), %rdi      # 0x15ff0
leaq 0x3e6c(%rip), %rsi      # 0xf2ea
callq 0x21e0
movq %rax, -0x1f0(%rbp)
jmp 0xb48c
xorl %eax, %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
callq 0xc6d0
movq %rax, %rsi
leaq -0xa0(%rbp), %rdi
callq 0xc4c0
jmp 0xb4aa
movq -0x1f0(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x21c0
movq %rax, -0x1f8(%rbp)
jmp 0xb4c6
movq -0x1f8(%rbp), %rdi
leaq 0x3e23(%rip), %rsi      # 0xf2f7
callq 0x21e0
movq %rax, -0x200(%rbp)
jmp 0xb4e2
movq -0x200(%rbp), %rdi
movl -0x18(%rbp), %esi
callq 0x22c0
movq %rax, -0x208(%rbp)
jmp 0xb4fa
movq -0x208(%rbp), %rdi
leaq 0x3c5e(%rip), %rsi      # 0xf166
callq 0x21e0
movq %rax, -0x210(%rbp)
jmp 0xb516
movq -0x210(%rbp), %rdi
movq 0xaa9c(%rip), %rsi      # 0x15fc0
callq 0x2240
jmp 0xb52b
leaq -0xa0(%rbp), %rdi
callq 0x2120
jmp 0xba4b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x2120
jmp 0xbce6
leaq -0x38(%rbp), %rdi
callq 0x9470
movq %rax, -0xa8(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x92a0
movq %rax, -0xb0(%rbp)
leaq -0xa8(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0xc630
testb $0x1, %al
jne 0xb595
jmp 0xb6f7
leaq -0xa8(%rbp), %rdi
callq 0xc670
movq %rax, %rdi
callq 0xc520
movl %eax, -0x214(%rbp)
jmp 0xb5b1
movl -0x214(%rbp), %ecx
movl $0x2, %eax
cmpl %ecx, %eax
jne 0xb5f2
leaq -0xa8(%rbp), %rdi
callq 0xc670
movq %rax, %rdi
callq 0xc530
movq %rax, -0x220(%rbp)
jmp 0xb5dd
movq -0x220(%rbp), %rcx
movl -0x1c(%rbp), %eax
addq %rcx, %rax
movl %eax, -0x1c(%rbp)
jmp 0xb6db
movb $0x1, -0x11(%rbp)
movq 0xa9f3(%rip), %rdi      # 0x15ff0
leaq 0x3cc4(%rip), %rsi      # 0xf2c8
callq 0x21e0
movq %rax, -0x228(%rbp)
jmp 0xb612
leaq -0xa8(%rbp), %rdi
callq 0xc670
movq %rax, %rsi
leaq -0xd0(%rbp), %rdi
callq 0xc4c0
jmp 0xb62f
movq -0x228(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x21c0
movq %rax, -0x230(%rbp)
jmp 0xb64b
movq -0x230(%rbp), %rdi
leaq 0x3ccd(%rip), %rsi      # 0xf326
callq 0x21e0
movq %rax, -0x238(%rbp)
jmp 0xb667
movq -0x238(%rbp), %rdi
movl -0x18(%rbp), %esi
callq 0x22c0
movq %rax, -0x240(%rbp)
jmp 0xb67f
movq -0x240(%rbp), %rdi
leaq 0x3ad9(%rip), %rsi      # 0xf166
callq 0x21e0
movq %rax, -0x248(%rbp)
jmp 0xb69b
movq -0x248(%rbp), %rdi
movq 0xa917(%rip), %rsi      # 0x15fc0
callq 0x2240
jmp 0xb6b0
leaq -0xd0(%rbp), %rdi
callq 0x2120
jmp 0xb6f7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x2120
jmp 0xbce6
jmp 0xb6dd
leaq -0xa8(%rbp), %rdi
xorl %esi, %esi
callq 0xc690
movq %rax, -0xd8(%rbp)
jmp 0xb569
jmp 0xb6f9
movl -0x1c(%rbp), %ecx
andl $0x3, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
je 0xb710
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xb6f9
jmp 0xba4b
xorl %eax, %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
callq 0xc6d0
movq %rax, %rsi
leaq -0xf8(%rbp), %rdi
callq 0xc4c0
jmp 0xb733
leaq -0x38(%rbp), %rdi
callq 0x9620
movq %rax, %rcx
movl $0x1, %eax
cmpq %rcx, %rax
jne 0xb8ad
movq -0x180(%rbp), %rdi
addq $0x8, %rdi
leaq -0xf8(%rbp), %rsi
callq 0xc720
movq %rax, -0x250(%rbp)
jmp 0xb76d
movq -0x180(%rbp), %rdi
movq -0x250(%rbp), %rax
movq %rax, -0x100(%rbp)
addq $0x8, %rdi
callq 0xc750
movq %rax, -0x108(%rbp)
leaq -0x100(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0xc6f0
testb $0x1, %al
jne 0xb7ab
jmp 0xb805
movq -0x180(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, -0x25c(%rbp)
addq $0x8, %rdi
leaq -0xf8(%rbp), %rsi
callq 0xc780
movq %rax, -0x258(%rbp)
jmp 0xb7d4
movq -0x258(%rbp), %rax
movl -0x25c(%rbp), %ecx
movl %ecx, (%rax)
jmp 0xb8a8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x2120
jmp 0xbce6
movb $0x1, -0x11(%rbp)
movq 0xa7e0(%rip), %rdi      # 0x15ff0
leaq 0x3b29(%rip), %rsi      # 0xf340
callq 0x21e0
movq %rax, -0x268(%rbp)
jmp 0xb825
movq -0x268(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x21c0
movq %rax, -0x270(%rbp)
jmp 0xb841
movq -0x270(%rbp), %rdi
leaq 0x3a90(%rip), %rsi      # 0xf2df
callq 0x21e0
movq %rax, -0x278(%rbp)
jmp 0xb85d
movq -0x278(%rbp), %rdi
movl -0x18(%rbp), %esi
callq 0x22c0
movq %rax, -0x280(%rbp)
jmp 0xb875
movq -0x280(%rbp), %rdi
leaq 0x38e3(%rip), %rsi      # 0xf166
callq 0x21e0
movq %rax, -0x288(%rbp)
jmp 0xb891
movq -0x288(%rbp), %rdi
movq 0xa721(%rip), %rsi      # 0x15fc0
callq 0x2240
jmp 0xb8a6
jmp 0xb8a8
jmp 0xb950
movb $0x1, -0x11(%rbp)
movq 0xa738(%rip), %rdi      # 0x15ff0
leaq 0x3a9a(%rip), %rsi      # 0xf359
callq 0x21e0
movq %rax, -0x290(%rbp)
jmp 0xb8cd
movq -0x290(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x21c0
movq %rax, -0x298(%rbp)
jmp 0xb8e9
movq -0x298(%rbp), %rdi
leaq 0x3a81(%rip), %rsi      # 0xf378
callq 0x21e0
movq %rax, -0x2a0(%rbp)
jmp 0xb905
movq -0x2a0(%rbp), %rdi
movl -0x18(%rbp), %esi
callq 0x22c0
movq %rax, -0x2a8(%rbp)
jmp 0xb91d
movq -0x2a8(%rbp), %rdi
leaq 0x383b(%rip), %rsi      # 0xf166
callq 0x21e0
movq %rax, -0x2b0(%rbp)
jmp 0xb939
movq -0x2b0(%rbp), %rdi
movq 0xa679(%rip), %rsi      # 0x15fc0
callq 0x2240
jmp 0xb94e
jmp 0xb950
leaq -0xf8(%rbp), %rdi
callq 0x2120
jmp 0xba4b
movb $0x1, -0x11(%rbp)
movq 0xa684(%rip), %rdi      # 0x15ff0
leaq 0x3955(%rip), %rsi      # 0xf2c8
callq 0x21e0
movq %rax, -0x2b8(%rbp)
jmp 0xb981
xorl %eax, %eax
movl %eax, %esi
leaq -0x38(%rbp), %rdi
callq 0xc6d0
movq %rax, %rsi
leaq -0x128(%rbp), %rdi
callq 0xc4c0
jmp 0xb99f
movq -0x2b8(%rbp), %rdi
leaq -0x128(%rbp), %rsi
callq 0x21c0
movq %rax, -0x2c0(%rbp)
jmp 0xb9bb
movq -0x2c0(%rbp), %rdi
leaq 0x3916(%rip), %rsi      # 0xf2df
callq 0x21e0
movq %rax, -0x2c8(%rbp)
jmp 0xb9d7
movq -0x2c8(%rbp), %rdi
movl -0x18(%rbp), %esi
callq 0x22c0
movq %rax, -0x2d0(%rbp)
jmp 0xb9ef
movq -0x2d0(%rbp), %rdi
leaq 0x3769(%rip), %rsi      # 0xf166
callq 0x21e0
movq %rax, -0x2d8(%rbp)
jmp 0xba0b
movq -0x2d8(%rbp), %rdi
movq 0xa5a7(%rip), %rsi      # 0x15fc0
callq 0x2240
jmp 0xba20
leaq -0x128(%rbp), %rdi
callq 0x2120
jmp 0xba4b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x128(%rbp), %rdi
callq 0x2120
jmp 0xbce6
jmp 0xb17b
testb $0x1, -0x11(%rbp)
jne 0xbcd1
movq -0x180(%rbp), %rdi
addq $0x38, %rdi
callq 0xc860
movq %rax, -0x130(%rbp)
movq -0x180(%rbp), %rdi
addq $0x38, %rdi
callq 0xc8d0
movq %rax, -0x138(%rbp)
leaq -0x130(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0xc890
testb $0x1, %al
jne 0xbaa4
jmp 0xbc20
leaq -0x130(%rbp), %rdi
callq 0xc900
movq %rax, %rsi
leaq -0x158(%rbp), %rdi
callq 0x20c0
jmp 0xbac1
leaq -0x130(%rbp), %rdi
callq 0xc900
movq -0x180(%rbp), %rdi
movl 0x20(%rax), %eax
movl %eax, -0x15c(%rbp)
addq $0x8, %rdi
leaq -0x158(%rbp), %rsi
callq 0xc720
movq %rax, -0x2e0(%rbp)
jmp 0xbaf6
movq -0x180(%rbp), %rdi
movq -0x2e0(%rbp), %rax
movq %rax, -0x168(%rbp)
addq $0x8, %rdi
callq 0xc750
movq %rax, -0x170(%rbp)
leaq -0x168(%rbp), %rdi
leaq -0x170(%rbp), %rsi
callq 0xc6f0
testb $0x1, %al
jne 0xbb37
jmp 0xbbfa
movb $0x1, -0x11(%rbp)
movq 0xa4ae(%rip), %rdi      # 0x15ff0
leaq 0x384c(%rip), %rsi      # 0xf395
callq 0x21e0
movq %rax, -0x2e8(%rbp)
jmp 0xbb57
movq -0x2e8(%rbp), %rdi
leaq -0x158(%rbp), %rsi
callq 0x21c0
movq %rax, -0x2f0(%rbp)
jmp 0xbb73
movq -0x2f0(%rbp), %rdi
leaq 0x375e(%rip), %rsi      # 0xf2df
callq 0x21e0
movq %rax, -0x2f8(%rbp)
jmp 0xbb8f
movq -0x2f8(%rbp), %rdi
movl -0x15c(%rbp), %esi
callq 0x22c0
movq %rax, -0x300(%rbp)
jmp 0xbbaa
movq -0x300(%rbp), %rdi
leaq 0x35ae(%rip), %rsi      # 0xf166
callq 0x21e0
movq %rax, -0x308(%rbp)
jmp 0xbbc6
movq -0x308(%rbp), %rdi
movq 0xa3ec(%rip), %rsi      # 0x15fc0
callq 0x2240
jmp 0xbbdb
jmp 0xbbfa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x2120
jmp 0xbce6
leaq -0x158(%rbp), %rdi
callq 0x2120
leaq -0x130(%rbp), %rdi
xorl %esi, %esi
callq 0xc920
movq %rax, -0x178(%rbp)
jmp 0xba71
movl $0x10000, %eax          # imm = 0x10000
cmpl -0x1c(%rbp), %eax
jae 0xbccf
movb $0x1, -0x11(%rbp)
movq 0xa3b7(%rip), %rdi      # 0x15ff0
leaq 0x3781(%rip), %rsi      # 0xf3c1
callq 0x21e0
movq %rax, -0x310(%rbp)
jmp 0xbc4e
movq -0x310(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x22c0
movq %rax, -0x318(%rbp)
jmp 0xbc66
movq -0x318(%rbp), %rdi
leaq 0x3765(%rip), %rsi      # 0xf3d9
callq 0x21e0
movq %rax, -0x320(%rbp)
jmp 0xbc82
movq -0x320(%rbp), %rdi
movl $0x10000, %esi          # imm = 0x10000
callq 0x2390
movq %rax, -0x328(%rbp)
jmp 0xbc9c
movq -0x328(%rbp), %rdi
leaq 0x3768(%rip), %rsi      # 0xf412
callq 0x21e0
movq %rax, -0x330(%rbp)
jmp 0xbcb8
movq -0x330(%rbp), %rdi
movq 0xa2fa(%rip), %rsi      # 0x15fc0
callq 0x2240
jmp 0xbccd
jmp 0xbccf
jmp 0xbcd1
movb -0x11(%rbp), %al
xorb $-0x1, %al
andb $0x1, %al
movb %al, -0x1(%rbp)
leaq -0x38(%rbp), %rdi
callq 0xc960
jmp 0xbcf1
leaq -0x38(%rbp), %rdi
callq 0xc960
jmp 0xbcff
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x330, %rsp            # imm = 0x330
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x23a0
nopl (%rax,%rax)