// File: /workspace/github_c_makefile_star2_O1/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 %r12
pushq %rbx
subq $0x80, %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 0xefc9(%rip), %r15      # 0x143b0
movzwl 0x18(%r15), %edx
leaq 0x7cf3(%rip), %rsi      # 0xd0e6
leaq 0xa(%rsp), %rdi
xorl %eax, %eax
callq 0x31b0
movl $0x2e, %edi
callq 0x4fa3
testl %eax, %eax
je 0x54d7
movslq 0x17b18(%rip), %rcx     # 0x1cf30
testq %rcx, %rcx
je 0x560e
movl $0x2, 0x4(%rbx)
cmpl $0x5c, %ecx
je 0x55bf
leaq 0x18378(%rip), %rax     # 0x1d7b0
cmpl $0x0, (%rax,%rcx,4)
je 0x55bf
xorl %ebp, %ebp
leaq 0xb(%rsp), %rcx
movl 0x17ae1(%rip), %edx     # 0x1cf30
cmpl $0x40, %edx
jne 0x5477
movb 0xa(%rsp), %sil
testb %sil, %sil
je 0x5480
movq %rcx, %rdx
movb %sil, (%r12)
incq %r12
incl %ebp
movb (%rdx), %sil
incq %rdx
testb %sil, %sil
jne 0x5461
jmp 0x5480
incl %ebp
movb %dl, (%r12)
incq %r12
movl 0x17aaa(%rip), %edx     # 0x1cf30
movl %edx, 0x17aa8(%rip)     # 0x1cf34
movq 0x17a8d(%rip), %rdx     # 0x1cf20
leaq 0x1(%rdx), %rsi
movq %rsi, 0x17a82(%rip)     # 0x1cf20
movsbl (%rdx), %esi
movl %esi, 0x17a89(%rip)     # 0x1cf30
movsbl 0x1(%rdx), %edi
movl %edi, 0x17a87(%rip)     # 0x1cf38
testl %esi, %esi
je 0x58b8
movslq %esi, %rdx
cmpl $0x0, (%rax,%rdx,4)
jne 0x5449
cmpb $0x3a, %sil
jne 0x58bf
movl %esi, 0x17a62(%rip)     # 0x1cf34
jmp 0x588f
callq 0x31e0
movslq 0x17a4d(%rip), %rcx     # 0x1cf30
cmpq $0x5f, %rcx
je 0x562e
movq (%rax), %rax
movzwl (%rax,%rcx,2), %eax
andl $0x400, %eax            # imm = 0x400
jne 0x562e
xorl %ebp, %ebp
cmpl $0x5c, %ecx
jne 0x58bf
leaq 0xf0f7(%rip), %rax      # 0x14608
cmpl $0x0, 0xc(%rax)
je 0x58bf
movl %ecx, 0x17a13(%rip)     # 0x1cf34
movq 0x179f8(%rip), %rdx     # 0x1cf20
leaq 0x1(%rdx), %rax
movq %rax, 0x179ed(%rip)     # 0x1cf20
movb (%rdx), %cl
movsbl %cl, %eax
movl %eax, 0x179f2(%rip)     # 0x1cf30
movsbl 0x1(%rdx), %esi
movl %esi, 0x179f0(%rip)     # 0x1cf38
testb %cl, %cl
jne 0x5553
movq %rdx, 0x179cd(%rip)     # 0x1cf20
leal -0x30(%rax), %edx
cmpl $0xa, %edx
jb 0x557e
movzbl %cl, %ecx
addl $-0x41, %ecx
cmpl $0x25, %ecx
ja 0x58bf
movabsq $0x3f0000003f, %rdx     # imm = 0x3F0000003F
btq %rcx, %rdx
jae 0x58bf
movl %eax, 0x179b0(%rip)     # 0x1cf34
movq 0x17995(%rip), %rcx     # 0x1cf20
leaq 0x1(%rcx), %rax
movq %rax, 0x1798a(%rip)     # 0x1cf20
movsbl (%rcx), %edx
movl %edx, 0x17991(%rip)     # 0x1cf30
movsbl 0x1(%rcx), %eax
movl %eax, 0x1798f(%rip)     # 0x1cf38
xorl %eax, %eax
testl %edx, %edx
jne 0x59a1
movq %rcx, 0x17966(%rip)     # 0x1cf20
jmp 0x59a1
movl $0x6, 0x4(%rbx)
movl %ecx, 0x17968(%rip)     # 0x1cf34
movq 0x1794d(%rip), %rax     # 0x1cf20
leaq 0x1(%rax), %rcx
movq %rcx, 0x17942(%rip)     # 0x1cf20
movzbl (%rax), %ecx
movsbl %cl, %ebp
movl %ebp, 0x17946(%rip)     # 0x1cf30
movsbl 0x1(%rax), %edx
movl %edx, 0x17944(%rip)     # 0x1cf38
cmpl $0x7e, %ecx
je 0x56d7
xorl %ebp, %ebp
testl %ecx, %ecx
jne 0x57d0
movq %rax, 0x17912(%rip)     # 0x1cf20
leaq 0x797d(%rip), %rsi      # 0xcf92
movl $0x3, %edi
addq $0x80, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xa2c8
movl $0x21, 0x4(%rbx)
xorl %ebp, %ebp
leaq 0xb(%rsp), %rax
leaq 0x1816d(%rip), %rcx     # 0x1d7b0
movl 0x178e7(%rip), %edx     # 0x1cf30
cmpl $0x40, %edx
je 0x5662
cmpl $0x24, %edx
je 0x573a
incl %ebp
movb %dl, (%r12)
incq %r12
jmp 0x5683
movb 0xa(%rsp), %sil
testb %sil, %sil
je 0x5683
movq %rax, %rdx
movb %sil, (%r12)
incq %r12
incl %ebp
movb (%rdx), %sil
incq %rdx
testb %sil, %sil
jne 0x566f
movl 0x178a7(%rip), %edx     # 0x1cf30
movl %edx, 0x178a5(%rip)     # 0x1cf34
movq 0x1788a(%rip), %rdx     # 0x1cf20
leaq 0x1(%rdx), %rsi
movq %rsi, 0x1787f(%rip)     # 0x1cf20
movsbl (%rdx), %esi
movl %esi, 0x17886(%rip)     # 0x1cf30
movsbl 0x1(%rdx), %edi
movl %edi, 0x17884(%rip)     # 0x1cf38
testl %esi, %esi
je 0x58b8
movslq %esi, %rdx
cmpb $0x24, %dl
je 0x5643
cmpl $0x0, (%rcx,%rdx,4)
jne 0x5643
jmp 0x58bf
movl $0xa, %edi
movl $0x1, %esi
callq 0x3100
movq %rax, %r14
movl %ebp, 0x17845(%rip)     # 0x1cf34
movq 0x1782a(%rip), %rax     # 0x1cf20
leaq 0x1(%rax), %rcx
movq %rcx, 0x1781f(%rip)     # 0x1cf20
movsbl (%rax), %ecx
movl %ecx, 0x17826(%rip)     # 0x1cf30
movsbl 0x1(%rax), %edx
movl %edx, 0x17824(%rip)     # 0x1cf38
testl %ecx, %ecx
jne 0x571f
movq %rax, 0x17801(%rip)     # 0x1cf20
leaq 0x1848a(%rip), %rax     # 0x1dbb0
cmpl $0x0, (%rax)
je 0x5796
leaq 0x39(%rbx), %r12
movb $0x4d, 0x38(%rbx)
movl $0x1, %ebp
jmp 0x5798
movl %edx, 0x177f4(%rip)     # 0x1cf34
movq 0x177d9(%rip), %rax     # 0x1cf20
leaq 0x1(%rax), %rcx
movq %rcx, 0x177ce(%rip)     # 0x1cf20
movsbl (%rax), %ecx
movl %ecx, 0x177d5(%rip)     # 0x1cf30
movsbl 0x1(%rax), %edx
movl %edx, 0x177d3(%rip)     # 0x1cf38
testl %ecx, %ecx
jne 0x5770
movq %rax, 0x177b0(%rip)     # 0x1cf20
leaq 0x20(%rsp), %rdi
callq 0x53a9
testl %eax, %eax
je 0x59b1
xorl %ecx, %ecx
movl $0x1, %eax
testb %cl, %cl
jne 0x58bf
jmp 0x59a1
xorl %ebp, %ebp
leaq 0xee69(%rip), %rax      # 0x14608
movl 0x24(%rax), %edx
leaq 0x7938(%rip), %rsi      # 0xd0e1
movq %r14, %rdi
xorl %eax, %eax
callq 0x31b0
movb (%r14), %al
testb %al, %al
je 0x57d0
incq %r14
movb %al, (%r12)
incq %r12
incl %ebp
movb (%r14), %al
incq %r14
testb %al, %al
jne 0x57bd
callq 0x31e0
movslq 0x17754(%rip), %rcx     # 0x1cf30
cmpq $0x5f, %rcx
je 0x57f4
movq (%rax), %rax
movzwl (%rax,%rcx,2), %eax
andl $0x400, %eax            # imm = 0x400
je 0x587e
leaq 0xb(%rsp), %rax
leaq 0x17fb0(%rip), %rcx     # 0x1d7b0
movl 0x1772a(%rip), %edx     # 0x1cf30
cmpl $0x40, %edx
jne 0x582e
movb 0xa(%rsp), %sil
testb %sil, %sil
je 0x5837
movq %rax, %rdx
movb %sil, (%r12)
incq %r12
incl %ebp
movb (%rdx), %sil
incq %rdx
testb %sil, %sil
jne 0x5818
jmp 0x5837
incl %ebp
movb %dl, (%r12)
incq %r12
movl 0x176f3(%rip), %edx     # 0x1cf30
movl %edx, 0x176f1(%rip)     # 0x1cf34
movq 0x176d6(%rip), %rdx     # 0x1cf20
leaq 0x1(%rdx), %rsi
movq %rsi, 0x176cb(%rip)     # 0x1cf20
movsbl (%rdx), %esi
movl %esi, 0x176d2(%rip)     # 0x1cf30
movsbl 0x1(%rdx), %edi
movl %edi, 0x176d0(%rip)     # 0x1cf38
testl %esi, %esi
je 0x5877
movslq %esi, %rdx
cmpl $0x0, (%rcx,%rdx,4)
jne 0x5800
jmp 0x587e
movq %rdx, 0x176a2(%rip)     # 0x1cf20
movl 0x176ac(%rip), %eax     # 0x1cf30
cmpl $0x3a, %eax
jne 0x58bf
movl %eax, 0x176a5(%rip)     # 0x1cf34
movq 0x1768a(%rip), %rdx     # 0x1cf20
leaq 0x1(%rdx), %rax
movq %rax, 0x1767f(%rip)     # 0x1cf20
movsbl (%rdx), %eax
movl %eax, 0x17686(%rip)     # 0x1cf30
movsbl 0x1(%rdx), %ecx
movl %ecx, 0x17684(%rip)     # 0x1cf38
testl %eax, %eax
jne 0x58bf
movq %rdx, 0x17661(%rip)     # 0x1cf20
movb $0x0, (%r12)
testl %ebp, %ebp
je 0x5989
movl 0x1765e(%rip), %eax     # 0x1cf30
cmpl $0x3a, %eax
jne 0x596a
movl %eax, 0x17653(%rip)     # 0x1cf34
movq 0x17638(%rip), %rcx     # 0x1cf20
leaq 0x1(%rcx), %rax
movq %rax, 0x1762d(%rip)     # 0x1cf20
movsbl (%rcx), %eax
movl %eax, 0x17634(%rip)     # 0x1cf30
movsbl 0x1(%rcx), %edx
movl %edx, 0x17632(%rip)     # 0x1cf38
testl %eax, %eax
jne 0x5911
movq %rcx, 0x1760f(%rip)     # 0x1cf20
movl 0x4(%rbx), %ecx
andl $0x1, %ecx
leaq 0x18292(%rip), %rdx     # 0x1dbb0
orl (%rdx), %ecx
je 0x5990
movl $0x1, 0x4(%rbx)
cmpb $0x3a, %al
jne 0x596a
movl $0x8, 0x4(%rbx)
movl %eax, 0x175fa(%rip)     # 0x1cf34
movq 0x175df(%rip), %rax     # 0x1cf20
leaq 0x1(%rax), %rcx
movq %rcx, 0x175d4(%rip)     # 0x1cf20
movsbl (%rax), %ecx
movl %ecx, 0x175db(%rip)     # 0x1cf30
movsbl 0x1(%rax), %edx
movl %edx, 0x175d9(%rip)     # 0x1cf38
testl %ecx, %ecx
jne 0x596a
movq %rax, 0x175b6(%rip)     # 0x1cf20
movl %ebp, (%rbx)
leaq 0xec95(%rip), %rax      # 0x14608
movl 0x4(%rax), %ecx
movl %ecx, 0x14(%rbx)
movl (%rax), %eax
movl %eax, 0x10(%rbx)
movl (%r15), %eax
movq %rax, 0x8(%rbx)
xorl %eax, %eax
jmp 0x59a1
movl $0x1, %eax
jmp 0x59a1
leaq 0x75fb(%rip), %rsi      # 0xcf92
movl $0x3, %edi
callq 0xa2c8
addq $0x80, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x20(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x6140
testq %rax, %rax
je 0x5782
movl 0x10(%rsp), %edx
leaq 0x7717(%rip), %rsi      # 0xd0eb
leaq 0x16(%rsp), %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x31b0
movb (%r14), %al
movb $0x1, %cl
testb %al, %al
je 0x5784
leaq 0x17(%rsp), %rdx
movb %al, (%r12)
incq %r12
movb (%rdx), %al
incq %rdx
testb %al, %al
jne 0x59f5
jmp 0x5784