// File: /workspace/github_cpp_makefile_star2_O3/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 0x51e2(%rip), %rax      # 0xc2b0
incq %rax
movq %rax, 0x51d8(%rip)      # 0xc2b0
movq 0x50e9(%rip), %rcx      # 0xc1c8
leaq (%rax,%rax,4), %rax
leaq (%rcx,%rax,8), %r15
movl (%r15), %eax
cmpl 0x5078(%rip), %eax      # 0xc168
jne 0x716e
movq 0x517f(%rip), %rax      # 0xc278
movq 0x5170(%rip), %r12      # 0xc270
subq %r12, %rax
je 0x71bc
movl %ebp, 0xc(%rsp)
movq %rbx, 0x10(%rsp)
sarq $0x3, %rax
movabsq $-0x3333333333333333, %r13 # imm = 0xCCCCCCCCCCCCCCCD
imulq %rax, %r13
movq 0x10(%r15), %r14
movl $0x1, %ebx
xorl %eax, %eax
leaq (%rax,%rax,4), %rax
cmpq %r14, 0x8(%r12,%rax,8)
jne 0x715f
leaq (%r12,%rax,8), %rbp
testq %r14, %r14
je 0x7205
movq 0x8(%r15), %rsi
movq (%rbp), %rdi
movq %r14, %rdx
callq 0x2170
testl %eax, %eax
je 0x7205
movl %ebx, %eax
incl %ebx
cmpq %rax, %r13
ja 0x712f
movl 0xc(%rsp), %ebp
jmp 0x71c0
cmpl 0x4fec(%rip), %eax      # 0xc160
jne 0x7279
leaq 0x28(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x8(%r15), %rsi
movq 0x10(%r15), %rdx
addq %rsi, %rdx
leaq 0x18(%rsp), %r14
movq %r14, %rdi
callq 0x7ace
movq %r14, %rdi
callq 0x75d2
movq %rax, 0x50a5(%rip)      # 0xc250
movq 0x18(%rsp), %rdi
cmpq %r12, %rdi
je 0x7219
callq 0x2140
jmp 0x7219
movq 0x10(%r15), %r14
leaq 0x48(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x8(%r15), %rsi
addq %rsi, %r14
leaq 0x38(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rdx
callq 0x7ace
movq 0x4fb0(%rip), %rsi      # 0xc198
decl %ebp
movq %rbx, %rdi
movl %ebp, %edx
callq 0x77fd
movq 0x38(%rsp), %rdi
cmpq %r12, %rdi
je 0x726a
callq 0x2140
jmp 0x726a
movq 0x20(%rbp), %rax
movq %rax, 0x5040(%rip)      # 0xc250
movq 0x10(%rsp), %rbx
movl 0xc(%rsp), %ebp
cmpl %ebp, 0x4f61(%rip)      # 0xc180
jne 0x7255
cmpq $0x100, 0x5024(%rip) # imm = 0x100
jl 0x726a
movq 0x4dbb(%rip), %rdi      # 0xbff0
leaq 0x2506(%rip), %rsi      # 0x9742
callq 0x2150
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2130
leaq 0x2582(%rip), %rsi      # 0x97d5
jmp 0x72c5
cmpl %ebp, 0x4f29(%rip)      # 0xc184
jne 0x726a
cmpq $0x10000, 0x4fe8(%rip) # imm = 0x10000
jge 0x72a0
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x4d70(%rip), %rdi      # 0xbff0
leaq 0x24bb(%rip), %rsi      # 0x9742
callq 0x2150
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2130
leaq 0x23c4(%rip), %rsi      # 0x9662
jmp 0x72c5
movq 0x4d49(%rip), %rdi      # 0xbff0
leaq 0x2494(%rip), %rsi      # 0x9742
callq 0x2150
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2130
leaq 0x252f(%rip), %rsi      # 0x97f4
movq %rax, %rdi
callq 0x2150
movl $0x1, %edi
callq 0x21b0
movq %rax, %rbx
movq 0x38(%rsp), %rdi
jmp 0x72e9
movq %rax, %rbx
movq 0x18(%rsp), %rdi
cmpq %r12, %rdi
je 0x72f3
callq 0x2140
movq %rbx, %rdi
callq 0x2250