// File: /workspace/github_c_makefile_star2_O3/42Bastian[P]lyxass/parser.c
// Function: GetLabel
int GetLabel(label_t *Label)
{
  extern int LabelTable[256];
  extern int mac_mode;

  int len = 0;
  char varhelp[6],*varptr = varhelp;
  char *ptr = Label->name;

  memset((char *)Label,0,sizeof(label_t));

  Label->type = UNSURE;

  sprintf(varhelp,"%04x",Global.var & 0xffff);

  if ( TestAtom('.') ){

    if ( !atom ) return  Error(LABEL_ERR,"");

    Label->type = LOCAL;

    if (atom != '\\' && LabelTable[atom]) {
      do {
        if ( atom == '@' ){
          varptr = varhelp;
          while( *varptr ){
            *ptr++ = *varptr++;
            len++;
          }
        } else {
          len++;
          *ptr++ = atom;
        }
      } while ( GetAtom() && LabelTable[atom] );

      if ( /*mac_mode &&*/ atom == ':' ){
        GetAtom();
      }
    } else {
      Label->type |= MACRO;

      if ( !GetAtom() ) return Error(LABEL_ERR,"");
      if ( atom == '~' ){
        char *ptr1 = (char *)calloc(10,1);

        GetAtom();
        if ( mac_mode ){
          *ptr++='M';
          ++len;
        }
        sprintf(ptr1,"%04X",Current.Macro.invoked);

        while(*ptr1){
          *ptr++=*ptr1++;
          ++len;
        }
      }
      if ( isalpha(atom) || atom == '_') {
        do{
          if ( atom == '@' ){
            varptr = varhelp;
            while( *varptr ){
              *ptr++ = *varptr++;
              len++;
            }
          } else {
            len++;
            *ptr++ = atom;
          }
        }while ( GetAtom() && LabelTable[atom] );
      }
      if ( /*mac_mode &&*/ atom == ':' ){
        GetAtom();
      }
    }
  } else if ( isalpha(atom) || atom == '_') {

    Label->type = UNSURE|NORMAL;
    do{
      if ( atom == '@' ){
        varptr = varhelp;
        while( *varptr ){
          *ptr++ = *varptr++;
          len++;
        }
      } else if ( atom == '$' ){
        label_t label;
        char help[10], *p = help;
        int32_t l;

        GetAtom();
        if ( GetLabel( &label ) ) return 1;
        if ( !FindLabel( &label, &l) ) return 1;

        sprintf(help,"%08X",l);
        while ( *p ){
          *ptr++=*p++;
        }
        break;
      } else {
        len++;
        *ptr++ = atom;
      }
    }while ( GetAtom() && (LabelTable[atom] || atom == '$'));
  } else if ( atom == '\\' && Current.Macro.Define ){
    GetAtom();
    if ( (atom >= '0' && atom <= '9') ||
         (atom >= 'a' && atom <= 'f') ||
         (atom >= 'A' && atom <= 'F')){
      GetAtom();
      return 0;
    }
  }
  *ptr++ = 0;
  // must return here 1 for GPU/DSP mode
  if ( len == 0 ) return 1; //Error(LABEL_ERR,"");

  if ( atom == ':' ){
    GetAtom();
    if ( !(Label->type & NORMAL) && !mac_mode ) return Error(LABEL_ERR,"");

    Label->type  = NORMAL;

    if ( atom == ':'  ){
      Label->type = GLOBAL;
      GetAtom();
    }
  }

  Label->len   = len;
  Label->file  = Current.File;
  Label->line  = Current.Line;
  Label->value = Global.pc;

//->  printf("GetLabel:%d(%s)%p %p\n",len,Label->name,Label->name,ptr);

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdi, %rbx
leaq 0x38(%rdi), %r12
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movups %xmm0, 0x50(%rdi)
movups %xmm0, 0x40(%rdi)
movups %xmm0, 0x30(%rdi)
movups %xmm0, 0x20(%rdi)
movups %xmm0, 0x10(%rdi)
movl $0x20, 0x4(%rdi)
leaq 0xf082(%rip), %r15      # 0x143b0
movzwl 0x18(%r15), %edx
leaq 0x7dac(%rip), %rsi      # 0xd0e6
leaq 0x2(%rsp), %rdi
xorl %eax, %eax
callq 0x31b0
movl $0x2e, %edi
callq 0x4fa8
testl %eax, %eax
je 0x5448
movslq 0x17bd1(%rip), %rdx     # 0x1cf30
testq %rdx, %rdx
je 0x5581
movl $0x2, 0x4(%rbx)
cmpl $0x5c, %edx
je 0x552d
leaq 0x18431(%rip), %rax     # 0x1d7b0
cmpl $0x0, (%rax,%rdx,4)
je 0x552d
xorl %ebp, %ebp
leaq 0x3(%rsp), %rcx
cmpl $0x40, %edx
jne 0x53b8
movb 0x2(%rsp), %sil
testb %sil, %sil
je 0x53c1
movq %rcx, %rdx
movb %sil, (%r12)
incq %r12
incl %ebp
movb (%rdx), %sil
incq %rdx
testb %sil, %sil
jne 0x53a2
jmp 0x53c1
incl %ebp
movb %dl, (%r12)
incq %r12
movl 0x17b69(%rip), %edx     # 0x1cf30
movl %edx, 0x17b67(%rip)     # 0x1cf34
movq 0x17b4c(%rip), %rdi     # 0x1cf20
leaq 0x1(%rdi), %rsi
movq %rsi, 0x17b41(%rip)     # 0x1cf20
movsbl (%rdi), %edx
movl %edx, 0x17b48(%rip)     # 0x1cf30
movsbl 0x1(%rdi), %r8d
movl %r8d, 0x17b44(%rip)     # 0x1cf38
testl %edx, %edx
je 0x56a6
movslq %edx, %r8
cmpl $0x0, (%rax,%r8,4)
jne 0x5390
cmpb $0x3a, %dl
jne 0x5891
movl %edx, 0x17b1f(%rip)     # 0x1cf34
leaq 0x2(%rdi), %rax
movq %rax, 0x17b00(%rip)     # 0x1cf20
movsbl 0x1(%rdi), %eax
movl %eax, 0x17b06(%rip)     # 0x1cf30
movsbl 0x2(%rdi), %ecx
movl %ecx, 0x17b04(%rip)     # 0x1cf38
testl %eax, %eax
jne 0x5891
movq %rsi, 0x17add(%rip)     # 0x1cf20
jmp 0x5891
callq 0x31e0
movslq 0x17adc(%rip), %rdx     # 0x1cf30
cmpq $0x5f, %rdx
je 0x55a0
movq (%rax), %rax
movzwl (%rax,%rdx,2), %eax
andl $0x400, %eax            # imm = 0x400
jne 0x55a0
cmpl $0x5c, %edx
jne 0x575c
leaq 0xf188(%rip), %rax      # 0x14608
cmpl $0x0, 0xc(%rax)
je 0x575c
movl $0x5c, 0x17aa0(%rip)    # 0x1cf34
movq 0x17a85(%rip), %rdx     # 0x1cf20
leaq 0x1(%rdx), %rcx
movq %rcx, 0x17a7a(%rip)     # 0x1cf20
movb (%rdx), %sil
movsbl %sil, %eax
movl %eax, 0x17a7d(%rip)     # 0x1cf30
movsbl 0x1(%rdx), %edi
movl %edi, 0x17a7b(%rip)     # 0x1cf38
testb %sil, %sil
je 0x5755
leal -0x30(%rax), %edi
cmpl $0xa, %edi
jb 0x54f2
movzbl %sil, %esi
addl $-0x41, %esi
cmpl $0x25, %esi
ja 0x575c
movabsq $0x3f0000003f, %rdi     # imm = 0x3F0000003F
btq %rsi, %rdi
jae 0x575c
movl %eax, 0x17a3c(%rip)     # 0x1cf34
leaq 0x2(%rdx), %rax
movq %rax, 0x17a1d(%rip)     # 0x1cf20
movsbl 0x1(%rdx), %esi
xorl %eax, %eax
movl %esi, 0x17a21(%rip)     # 0x1cf30
movsbl 0x2(%rdx), %edx
movl %edx, 0x17a1f(%rip)     # 0x1cf38
testl %esi, %esi
jne 0x595b
movq %rcx, 0x179f8(%rip)     # 0x1cf20
jmp 0x595b
movl $0x6, 0x4(%rbx)
movl %edx, 0x179fa(%rip)     # 0x1cf34
movq 0x179df(%rip), %r13     # 0x1cf20
leaq 0x1(%r13), %rbp
movq %rbp, 0x179d4(%rip)     # 0x1cf20
movzbl (%r13), %eax
movsbl %al, %r15d
movl %r15d, 0x179d4(%rip)    # 0x1cf30
movsbl 0x1(%r13), %ecx
movl %ecx, 0x179d1(%rip)     # 0x1cf38
cmpl $0x7e, %eax
je 0x563f
xorl %ebp, %ebp
testl %eax, %eax
jne 0x57a0
movq %r13, 0x1799f(%rip)     # 0x1cf20
leaq 0x7a0a(%rip), %rsi      # 0xcf92
movl $0x3, %edi
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa1d8
movl $0x21, 0x4(%rbx)
xorl %ebp, %ebp
leaq 0x3(%rsp), %rax
leaq 0x181fb(%rip), %rcx     # 0x1d7b0
cmpl $0x40, %edx
je 0x55ce
cmpl $0x24, %edx
je 0x56b2
incl %ebp
movb %dl, (%r12)
incq %r12
jmp 0x55ef
movb 0x2(%rsp), %sil
testb %sil, %sil
je 0x55ef
movq %rax, %rdx
movb %sil, (%r12)
incq %r12
incl %ebp
movb (%rdx), %sil
incq %rdx
testb %sil, %sil
jne 0x55db
movl 0x1793b(%rip), %edx     # 0x1cf30
movl %edx, 0x17939(%rip)     # 0x1cf34
movq 0x1791e(%rip), %rsi     # 0x1cf20
leaq 0x1(%rsi), %rdx
movq %rdx, 0x17913(%rip)     # 0x1cf20
movsbl (%rsi), %edx
movl %edx, 0x1791a(%rip)     # 0x1cf30
movsbl 0x1(%rsi), %edi
movl %edi, 0x17918(%rip)     # 0x1cf38
testl %edx, %edx
je 0x543c
cmpb $0x24, %dl
je 0x55b5
movslq %edx, %rsi
cmpl $0x0, (%rcx,%rsi,4)
jne 0x55b5
jmp 0x5891
movl $0xa, %edi
movl $0x1, %esi
callq 0x3100
movq %rax, %r14
movl %r15d, 0x178dc(%rip)    # 0x1cf34
leaq 0x2(%r13), %rax
movq %rax, 0x178bd(%rip)     # 0x1cf20
movsbl 0x1(%r13), %eax
movl %eax, 0x178c2(%rip)     # 0x1cf30
movsbl 0x2(%r13), %ecx
movl %ecx, 0x178bf(%rip)     # 0x1cf38
testl %eax, %eax
jne 0x5684
movq %rbp, 0x1789c(%rip)     # 0x1cf20
leaq 0x18525(%rip), %rax     # 0x1dbb0
cmpl $0x0, (%rax)
je 0x5766
leaq 0x39(%rbx), %r12
movb $0x4d, 0x38(%rbx)
movl $0x1, %ebp
jmp 0x5768
movq %rdi, 0x17873(%rip)     # 0x1cf20
jmp 0x5891
movl $0x24, 0x17878(%rip)    # 0x1cf34
movq 0x1785d(%rip), %rax     # 0x1cf20
leaq 0x1(%rax), %rcx
movq %rcx, 0x17852(%rip)     # 0x1cf20
movsbl (%rax), %ecx
movl %ecx, 0x17859(%rip)     # 0x1cf30
movsbl 0x1(%rax), %edx
movl %edx, 0x17857(%rip)     # 0x1cf38
testl %ecx, %ecx
jne 0x56ec
movq %rax, 0x17834(%rip)     # 0x1cf20
leaq 0x18(%rsp), %rdi
callq 0x52f1
testl %eax, %eax
jne 0x5956
leaq 0x18(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x60dc
testq %rax, %rax
je 0x5956
movl 0x8(%rsp), %edx
leaq 0x79ca(%rip), %rsi      # 0xd0eb
leaq 0xe(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x31b0
movb (%r14), %al
testb %al, %al
je 0x5891
leaq 0xf(%rsp), %rcx
movb %al, (%r12)
incq %r12
movb (%rcx), %al
incq %rcx
testb %al, %al
jne 0x5740
jmp 0x5891
movq %rdx, 0x177c4(%rip)     # 0x1cf20
movb $0x0, (%r12)
jmp 0x5956
xorl %ebp, %ebp
leaq 0xee99(%rip), %rax      # 0x14608
movl 0x24(%rax), %edx
leaq 0x7968(%rip), %rsi      # 0xd0e1
movq %r14, %rdi
xorl %eax, %eax
callq 0x31b0
movb (%r14), %al
testb %al, %al
je 0x57a0
incq %r14
movb %al, (%r12)
incq %r12
incl %ebp
movb (%r14), %al
incq %r14
testb %al, %al
jne 0x578d
callq 0x31e0
movslq 0x17784(%rip), %rdx     # 0x1cf30
cmpq $0x5f, %rdx
je 0x57cc
movq (%rax), %rax
movzwl (%rax,%rdx,2), %eax
andl $0x400, %eax            # imm = 0x400
jne 0x57cc
leaq 0xebe9(%rip), %r15      # 0x143b0
jmp 0x5852
leaq 0x3(%rsp), %rax
leaq 0x17fd8(%rip), %rcx     # 0x1d7b0
leaq 0xebd1(%rip), %r15      # 0x143b0
cmpl $0x40, %edx
jne 0x5807
movb 0x2(%rsp), %sil
testb %sil, %sil
je 0x5810
movq %rax, %rdx
movb %sil, (%r12)
incq %r12
incl %ebp
movb (%rdx), %sil
incq %rdx
testb %sil, %sil
jne 0x57f1
jmp 0x5810
incl %ebp
movb %dl, (%r12)
incq %r12
movl 0x1771a(%rip), %edx     # 0x1cf30
movl %edx, 0x17718(%rip)     # 0x1cf34
movq 0x176fd(%rip), %rsi     # 0x1cf20
leaq 0x1(%rsi), %rdx
movq %rdx, 0x176f2(%rip)     # 0x1cf20
movsbl (%rsi), %edx
movl %edx, 0x176f9(%rip)     # 0x1cf30
movsbl 0x1(%rsi), %edi
movl %edi, 0x176f7(%rip)     # 0x1cf38
testl %edx, %edx
je 0x543c
movslq %edx, %rsi
cmpl $0x0, (%rcx,%rsi,4)
jne 0x57df
cmpl $0x3a, %edx
jne 0x5891
movl $0x3a, 0x176d3(%rip)    # 0x1cf34
movq 0x176b8(%rip), %rax     # 0x1cf20
leaq 0x1(%rax), %rcx
movq %rcx, 0x176ad(%rip)     # 0x1cf20
movsbl (%rax), %ecx
movl %ecx, 0x176b4(%rip)     # 0x1cf30
movsbl 0x1(%rax), %edx
movl %edx, 0x176b2(%rip)     # 0x1cf38
testl %ecx, %ecx
jne 0x5891
movq %rax, 0x1768f(%rip)     # 0x1cf20
movb $0x0, (%r12)
testl %ebp, %ebp
je 0x5956
cmpl $0x3a, 0x1768b(%rip)    # 0x1cf30
jne 0x593b
movl $0x3a, 0x1767f(%rip)    # 0x1cf34
movq 0x17664(%rip), %rdx     # 0x1cf20
leaq 0x1(%rdx), %rax
movq %rax, 0x17659(%rip)     # 0x1cf20
movsbl (%rdx), %ecx
movl %ecx, 0x17660(%rip)     # 0x1cf30
movsbl 0x1(%rdx), %esi
movl %esi, 0x1765e(%rip)     # 0x1cf38
testl %ecx, %ecx
jne 0x58e8
movq %rdx, 0x1763b(%rip)     # 0x1cf20
movq %rdx, %rax
movl 0x4(%rbx), %edx
andl $0x1, %edx
leaq 0x182bb(%rip), %rsi     # 0x1dbb0
orl (%rsi), %edx
je 0x596a
movl $0x1, 0x4(%rbx)
cmpb $0x3a, %cl
jne 0x593b
movl $0x8, 0x4(%rbx)
movl %ecx, 0x17622(%rip)     # 0x1cf34
leaq 0x1(%rax), %rcx
movq %rcx, 0x17603(%rip)     # 0x1cf20
movsbl (%rax), %ecx
movl %ecx, 0x1760a(%rip)     # 0x1cf30
movsbl 0x1(%rax), %edx
movl %edx, 0x17608(%rip)     # 0x1cf38
testl %ecx, %ecx
jne 0x593b
movq %rax, 0x175e5(%rip)     # 0x1cf20
movl %ebp, (%rbx)
leaq 0xecc4(%rip), %rax      # 0x14608
movq (%rax), %rax
movq %rax, 0x10(%rbx)
movl (%r15), %eax
movq %rax, 0x8(%rbx)
xorl %eax, %eax
jmp 0x595b
movl $0x1, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x7621(%rip), %rsi      # 0xcf92
movl $0x3, %edi
callq 0xa1d8
jmp 0x595b