// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
leaq -0x1a(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
addq $0x38, %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
xorl %esi, %esi
movl $0x60, %edx
callq 0x30c0
movq -0x10(%rbp), %rax
movl $0x20, 0x4(%rax)
leaq -0x1a(%rbp), %rdi
leaq 0x12570(%rip), %rax     # 0x183a0
movl 0x18(%rax), %edx
andl $0xffff, %edx           # imm = 0xFFFF
leaq 0xb328(%rip), %rsi      # 0x11168
movb $0x0, %al
callq 0x31a0
movl $0x2e, %edi
callq 0x5a90
cmpl $0x0, %eax
je 0x6128
cmpl $0x0, 0x1b0bf(%rip)     # 0x20f20
jne 0x5e7c
movl $0x3, %edi
leaq 0xb1ee(%rip), %rsi      # 0x1105d
callq 0xd130
movl %eax, -0x4(%rbp)
jmp 0x6418
movq -0x10(%rbp), %rax
movl $0x2, 0x4(%rax)
cmpl $0x5c, 0x1b092(%rip)    # 0x20f20
je 0x5f6b
movslq 0x1b085(%rip), %rcx     # 0x20f20
leaq 0x1b8fe(%rip), %rax     # 0x217a0
cmpl $0x0, (%rax,%rcx,4)
je 0x5f6b
jmp 0x5eae
cmpl $0x40, 0x1b06b(%rip)    # 0x20f20
jne 0x5ef7
leaq -0x1a(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpb $0x0, (%rax)
je 0x5ef5
movq -0x28(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x28(%rbp)
movb (%rax), %cl
movq -0x30(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x30(%rbp)
movb %cl, (%rax)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x5ebf
jmp 0x5f19
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movl 0x1b01a(%rip), %eax     # 0x20f20
movb %al, %cl
movq -0x30(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x30(%rbp)
movb %cl, (%rax)
jmp 0x5f1b
callq 0x59e0
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0xb5(%rbp)
je 0x5f4a
movslq 0x1afea(%rip), %rcx     # 0x20f20
leaq 0x1b863(%rip), %rax     # 0x217a0
cmpl $0x0, (%rax,%rcx,4)
setne %al
movb %al, -0xb5(%rbp)
movb -0xb5(%rbp), %al
testb $0x1, %al
jne 0x5eae
cmpl $0x3a, 0x1afc1(%rip)    # 0x20f20
jne 0x5f66
callq 0x59e0
jmp 0x6123
movq -0x10(%rbp), %rax
movl 0x4(%rax), %ecx
orl $0x4, %ecx
movl %ecx, 0x4(%rax)
callq 0x59e0
cmpl $0x0, %eax
jne 0x5f9b
movl $0x3, %edi
leaq 0xb0cf(%rip), %rsi      # 0x1105d
callq 0xd130
movl %eax, -0x4(%rbp)
jmp 0x6418
cmpl $0x7e, 0x1af7e(%rip)    # 0x20f20
jne 0x603b
movl $0xa, %edi
movl $0x1, %esi
callq 0x30f0
movq %rax, -0x38(%rbp)
callq 0x59e0
leaq 0x1bbd9(%rip), %rax     # 0x21ba0
cmpl $0x0, (%rax)
je 0x5fe7
movq -0x30(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x30(%rbp)
movb $0x4d, (%rax)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movq -0x38(%rbp), %rdi
leaq 0x12606(%rip), %rax     # 0x185f8
movl 0x24(%rax), %edx
leaq 0xb167(%rip), %rsi      # 0x11163
movb $0x0, %al
callq 0x31a0
movq -0x38(%rbp), %rax
cmpb $0x0, (%rax)
je 0x6039
movq -0x38(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x38(%rbp)
movb (%rax), %cl
movq -0x30(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x30(%rbp)
movb %cl, (%rax)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x6003
jmp 0x603b
callq 0x31d0
movq (%rax), %rax
movslq 0x1aed6(%rip), %rcx     # 0x20f20
movzwl (%rax,%rcx,2), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
jne 0x6065
cmpl $0x5f, 0x1aec1(%rip)    # 0x20f20
jne 0x6113
jmp 0x6067
cmpl $0x40, 0x1aeb2(%rip)    # 0x20f20
jne 0x60b0
leaq -0x1a(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpb $0x0, (%rax)
je 0x60ae
movq -0x28(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x28(%rbp)
movb (%rax), %cl
movq -0x30(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x30(%rbp)
movb %cl, (%rax)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x6078
jmp 0x60d2
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movl 0x1ae61(%rip), %eax     # 0x20f20
movb %al, %cl
movq -0x30(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x30(%rbp)
movb %cl, (%rax)
jmp 0x60d4
callq 0x59e0
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0xb6(%rbp)
je 0x6103
movslq 0x1ae31(%rip), %rcx     # 0x20f20
leaq 0x1b6aa(%rip), %rax     # 0x217a0
cmpl $0x0, (%rax,%rcx,4)
setne %al
movb %al, -0xb6(%rbp)
movb -0xb6(%rbp), %al
testb $0x1, %al
jne 0x6067
jmp 0x6113
cmpl $0x3a, 0x1ae06(%rip)    # 0x20f20
jne 0x6121
callq 0x59e0
jmp 0x6123
jmp 0x634b
callq 0x31d0
movq (%rax), %rax
movslq 0x1ade9(%rip), %rcx     # 0x20f20
movzwl (%rax,%rcx,2), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
jne 0x6152
cmpl $0x5f, 0x1add4(%rip)    # 0x20f20
jne 0x62e3
movq -0x10(%rbp), %rax
movl $0x21, 0x4(%rax)
cmpl $0x40, 0x1adbc(%rip)    # 0x20f20
jne 0x61a9
leaq -0x1a(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpb $0x0, (%rax)
je 0x61a4
movq -0x28(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x28(%rbp)
movb (%rax), %cl
movq -0x30(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x30(%rbp)
movb %cl, (%rax)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x616e
jmp 0x6285
cmpl $0x24, 0x1ad70(%rip)    # 0x20f20
jne 0x6261
leaq -0xa2(%rbp), %rax
movq %rax, -0xb0(%rbp)
callq 0x59e0
leaq -0x98(%rbp), %rdi
callq 0x5de0
cmpl $0x0, %eax
je 0x61e6
movl $0x1, -0x4(%rbp)
jmp 0x6418
leaq -0x98(%rbp), %rdi
leaq -0xb4(%rbp), %rsi
callq 0x6f20
cmpq $0x0, %rax
jne 0x620b
movl $0x1, -0x4(%rbp)
jmp 0x6418
leaq -0xa2(%rbp), %rdi
movl -0xb4(%rbp), %edx
leaq 0xaf4e(%rip), %rsi      # 0x1116d
movb $0x0, %al
callq 0x31a0
movq -0xb0(%rbp), %rax
cmpb $0x0, (%rax)
je 0x625c
movq -0xb0(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0xb0(%rbp)
movb (%rax), %cl
movq -0x30(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x30(%rbp)
movb %cl, (%rax)
jmp 0x6226
jmp 0x62e1
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
movl 0x1acb0(%rip), %eax     # 0x20f20
movb %al, %cl
movq -0x30(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x30(%rbp)
movb %cl, (%rax)
jmp 0x6285
jmp 0x6287
callq 0x59e0
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0xb7(%rbp)
je 0x62d3
movslq 0x1ac7e(%rip), %rdx     # 0x20f20
movb $0x1, %al
leaq 0x1b4f5(%rip), %rcx     # 0x217a0
cmpl $0x0, (%rcx,%rdx,4)
movb %al, -0xb8(%rbp)
jne 0x62c7
cmpl $0x24, 0x1ac62(%rip)    # 0x20f20
sete %al
movb %al, -0xb8(%rbp)
movb -0xb8(%rbp), %al
movb %al, -0xb7(%rbp)
movb -0xb7(%rbp), %al
testb $0x1, %al
jne 0x615d
jmp 0x6349
cmpl $0x5c, 0x1ac36(%rip)    # 0x20f20
jne 0x6347
leaq 0x12305(%rip), %rax     # 0x185f8
cmpl $0x0, 0xc(%rax)
je 0x6347
callq 0x59e0
cmpl $0x30, 0x1ac1b(%rip)    # 0x20f20
jl 0x6310
cmpl $0x39, 0x1ac12(%rip)    # 0x20f20
jle 0x6334
cmpl $0x61, 0x1ac09(%rip)    # 0x20f20
jl 0x6322
cmpl $0x66, 0x1ac00(%rip)    # 0x20f20
jle 0x6334
cmpl $0x41, 0x1abf7(%rip)    # 0x20f20
jl 0x6345
cmpl $0x46, 0x1abee(%rip)    # 0x20f20
jg 0x6345
callq 0x59e0
movl $0x0, -0x4(%rbp)
jmp 0x6418
jmp 0x6347
jmp 0x6349
jmp 0x634b
movq -0x30(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x30(%rbp)
movb $0x0, (%rax)
cmpl $0x0, -0x14(%rbp)
jne 0x636f
movl $0x1, -0x4(%rbp)
jmp 0x6418
cmpl $0x3a, 0x1abaa(%rip)    # 0x20f20
jne 0x63d4
callq 0x59e0
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x63ae
leaq 0x1b80d(%rip), %rax     # 0x21ba0
cmpl $0x0, (%rax)
jne 0x63ae
movl $0x3, %edi
leaq 0xacb9(%rip), %rsi      # 0x1105d
callq 0xd130
movl %eax, -0x4(%rbp)
jmp 0x6418
movq -0x10(%rbp), %rax
movl $0x1, 0x4(%rax)
cmpl $0x3a, 0x1ab60(%rip)    # 0x20f20
jne 0x63d2
movq -0x10(%rbp), %rax
movl $0x8, 0x4(%rax)
callq 0x59e0
jmp 0x63d4
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
leaq 0x12214(%rip), %rax     # 0x185f8
movl 0x4(%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x14(%rax)
leaq 0x12203(%rip), %rax     # 0x185f8
movl (%rax), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x10(%rax)
leaq 0x11f9b(%rip), %rax     # 0x183a0
movl (%rax), %eax
movl %eax, %ecx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xc0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)