// File: /workspace/github_cpp_makefile_star2_O1/nicklausw[P]snesasm/snesasm.cpp
// Function: directive_arg(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int)
void directive_arg(string str, int range)
{
  unsigned int label_search;
  int label_count = 0;
  
  pass_counter++;
  
  if (tokens[pass_counter].token_type == tkOP) { // if it's not number
    for (label_search = 0; label_search < labels.size(); label_search++) { // look for a label!
      if (labels[label_search].name == tokens[pass_counter].token_i) {
        tr = labels[label_search].val; // it's a match!
        label_count++; // no need for unsolved.
        break;
      }
    }
    
    if (!label_count) { // if no match was found
      // time for an unsolved!
      new_unsolved(tokens[pass_counter].token_i, org, range-1);
      return;
    }
  } else if (tokens[pass_counter].token_type == tkNUM) {
    tr = parse_num(tokens[pass_counter].token_i);
  } else {
    cerr << "error: " << str << " expects args\n";
    exit(fail);
  }
   
 
  if (range == r8) {
    if (tr > 0xFF) {
      cerr << "error: " << str << " requires 8-bit args\n";
      exit(fail);
    }
  } else if (range == r16) {
    if (tr > 0xFFFF) {
      cerr << "error: " << str << " requires 16-bit args\n";
      exit(fail);
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %esi, %ebp
movq %rdi, %rbx
movq 0x50c7(%rip), %rax      # 0xc2b0
incq %rax
movq %rax, 0x50bd(%rip)      # 0xc2b0
movq 0x4fce(%rip), %rcx      # 0xc1c8
leaq (%rax,%rax,4), %rax
leaq (%rcx,%rax,8), %r14
movl (%r14), %eax
cmpl 0x4f5d(%rip), %eax      # 0xc168
jne 0x72d1
movl %ebp, 0xc(%rsp)
movq %rbx, 0x10(%rsp)
movq 0x5057(%rip), %rax      # 0xc278
movq 0x5048(%rip), %r15      # 0xc270
subq %r15, %rax
je 0x7283
sarq $0x3, %rax
movabsq $-0x3333333333333333, %r12 # imm = 0xCCCCCCCCCCCCCCCD
imulq %rax, %r12
movq 0x10(%r14), %r13
movl $0x1, %ebx
xorl %eax, %eax
leaq (%rax,%rax,4), %rax
movq 0x8(%r15,%rax,8), %rdx
cmpq %r13, %rdx
jne 0x727a
leaq (%r15,%rax,8), %rbp
testq %rdx, %rdx
je 0x731e
movq 0x8(%r14), %rsi
movq (%rbp), %rdi
callq 0x2170
testl %eax, %eax
je 0x731e
movl %ebx, %eax
incl %ebx
cmpq %rax, %r12
ja 0x724a
leaq 0x48(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x8(%r14), %rsi
movq 0x10(%r14), %rdx
addq %rsi, %rdx
leaq 0x38(%rsp), %rbx
movq %rbx, %rdi
callq 0x7be0
movq 0x4eed(%rip), %rsi      # 0xc198
movl 0xc(%rsp), %edx
decl %edx
movq %rbx, %rdi
callq 0x7921
movq 0x38(%rsp), %rdi
cmpq %r15, %rdi
je 0x7383
callq 0x2140
jmp 0x7383
cmpl 0x4e89(%rip), %eax      # 0xc160
jne 0x7392
leaq 0x28(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x8(%r14), %rsi
movq 0x10(%r14), %rdx
addq %rsi, %rdx
leaq 0x18(%rsp), %r14
movq %r14, %rdi
callq 0x7be0
movq %r14, %rdi
callq 0x76eb
movq %rax, 0x4f43(%rip)      # 0xc250
movq 0x18(%rsp), %rdi
cmpq %r15, %rdi
je 0x7332
callq 0x2140
jmp 0x7332
movq 0x20(%rbp), %rax
movq %rax, 0x4f27(%rip)      # 0xc250
movq 0x10(%rsp), %rbx
movl 0xc(%rsp), %ebp
cmpl %ebp, 0x4e48(%rip)      # 0xc180
jne 0x736e
cmpq $0x100, 0x4f0b(%rip) # imm = 0x100
jl 0x7383
movq 0x4ca2(%rip), %rdi      # 0xbff0
leaq 0x23ed(%rip), %rsi      # 0x9742
callq 0x2150
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2130
leaq 0x2469(%rip), %rsi      # 0x97d5
jmp 0x73de
cmpl %ebp, 0x4e10(%rip)      # 0xc184
jne 0x7383
cmpq $0x10000, 0x4ecf(%rip) # imm = 0x10000
jge 0x73b9
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x4c57(%rip), %rdi      # 0xbff0
leaq 0x23a2(%rip), %rsi      # 0x9742
callq 0x2150
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2130
leaq 0x22ab(%rip), %rsi      # 0x9662
jmp 0x73de
movq 0x4c30(%rip), %rdi      # 0xbff0
leaq 0x237b(%rip), %rsi      # 0x9742
callq 0x2150
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2130
leaq 0x2416(%rip), %rsi      # 0x97f4
movq %rax, %rdi
callq 0x2150
movl $0x1, %edi
callq 0x21b0
movq %rax, %rbx
movq 0x38(%rsp), %rdi
jmp 0x7402
movq %rax, %rbx
movq 0x18(%rsp), %rdi
cmpq %r15, %rdi
je 0x740c
callq 0x2140
movq %rbx, %rdi
callq 0x2250