// File: /workspace/github_c_makefile_star2_O3/42Bastian[P]lyxass/lyxass.c
// Function: mainloop
int mainloop(int pass2)
{
  Current.ifFlag = 1;
  Current.switchFlag = 1;

  Current.pass2 = pass2;

  for ( ; GetLine() ; killLine(),doReference() ) {

    Global.OldPC = Global.pc;
    Global.Lines++;

    code.OldPtr = code.Ptr;

    Current.Line++;
    Current.varModifier = 0;
    Current.LabelPtr = 0;
    Current.doRef = 0;
    Current.needsReloc = 0;

    error = 0;

    if ( !Current.pass2 && Current.ifFlag && Current.switchFlag && verbose){
      if ( verbose > 2 || (!Current.Macro.Processing && verbose > 1) )
        printf("%4d:$%04"PRIx32": <%s>\n",Current.Line,Global.pc,srcLine);
    }

    if ( !atom ) continue;

    if ( atom == ' ' ){

      if ( GetCmd() )  continue; // empty line
      if ( checkCode(Current.Cmd,0) >= 0) continue;

      Error(UNKNOWN_ERR,Current.Cmd);
      continue;
    }

    if ( GetLabel( & Current.Label ) ){
      Error(LABEL_ERR,"");
      continue;
    }

    if ( (Current.Label.type & UNSURE) ){

      if ( checkCode(Current.Label.name,1 ) >= 0){
        //      Warning("Opcode/Macro in first column !");
        continue;
      }
      Current.Label.type = NORMAL;
    }

    if ( Current.Label.len &&
         !Current.pass2 &&
         !Current.Macro.Define &&
         Current.ifFlag &&
         Current.switchFlag){

      if ( Global.genesis ){
        Current.Label.type |= CODELABEL;
      }
      Current.Label.value = Global.pc;
      Current.LabelPtr = DefineLabel( &Current.Label , &Current.doRef);
    }
    //
    // we have a line-label, so store command elsewhere
    //

    if ( GetCmd() ) {
      if ( Current.Label.type & REGISTER ){
        return Error(SYNTAX_ERR,"REG label used as code label");
      }
      continue;
    }
    if ( checkCode( Current.Cmd,0 ) >= 0 ){
      // XXX: Must check if label is still a code label
      continue;
    }

    Error(UNKNOWN_ERR,Current.Cmd);

  }

  //  printf("Mainloop:%d\n",count--);

  return error;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl $0x1, %eax
movl %eax, 0x1042d(%rip)     # 0x14700
movl %eax, 0x104b7(%rip)     # 0x14790
movl %edi, 0x1040d(%rip)     # 0x146ec
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x4c13
testl %eax, %eax
je 0x44b3
leaq 0x8d43(%rip), %rbx      # 0xd03a
leaq 0x18b22(%rip), %r14     # 0x1ce20
leaq 0x18c2b(%rip), %r13     # 0x1cf30
leaq 0x10390(%rip), %r15     # 0x1469c
leaq 0x1031d(%rip), %r12     # 0x14630
movl 0x10097(%rip), %edx     # 0x143b0
movl %edx, 0x10095(%rip)     # 0x143b4
incl 0x10093(%rip)           # 0x143b8
movq 0x102b4(%rip), %rax     # 0x145e0
movl 0x102d6(%rip), %esi     # 0x14608
incl %esi
movl %esi, 0x102ce(%rip)     # 0x14608
movq %rbp, 0x103af(%rip)     # 0x146f0
movq %rbp, 0x10348(%rip)     # 0x14690
movl %ebp, 0x10476(%rip)     # 0x147c4
cmpl %ebp, 0x10398(%rip)     # 0x146ec
movq %rax, 0x1028d(%rip)     # 0x145e8
sete %al
cmpl $0x0, 0x1039b(%rip)     # 0x14700
movl %ebp, 0x18779(%rip)     # 0x1cae4
setne %cl
cmpl $0x0, 0x1041b(%rip)     # 0x14790
setne %dil
andb %cl, %dil
andb %al, %dil
movl 0xfff7(%rip), %eax      # 0x1437c
testl %eax, %eax
setne %cl
andb %dil, %cl
cmpb $0x1, %cl
jne 0x43af
cmpl $0x2, %eax
jg 0x43a2
xorl $0x2, %eax
orl 0x10270(%rip), %eax     # 0x14610
jne 0x43af
movq %rbx, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30c0
movl (%r13), %eax
testl %eax, %eax
je 0x449a
cmpl $0x20, %eax
jne 0x43d2
callq 0x597d
testl %eax, %eax
jne 0x449a
jmp 0x447f
movq %r12, %rdi
callq 0x52f1
testl %eax, %eax
je 0x43ef
movl $0x3, %edi
leaq 0x8ba8(%rip), %rsi      # 0xcf92
jmp 0x4495
testb $0x20, 0x1023e(%rip)    # 0x14634
je 0x441b
leaq 0x10269(%rip), %rdi     # 0x14668
movl $0x1, %esi
callq 0x47c1
testl %eax, %eax
jns 0x449a
movl $0x1, 0x10219(%rip)     # 0x14634
cmpl $0x0, 0x1020e(%rip)     # 0x14630
je 0x446b
cmpl $0x0, 0x102c1(%rip)     # 0x146ec
jne 0x446b
cmpl $0x0, 0x101e0(%rip)     # 0x14614
jne 0x446b
cmpl $0x0, 0x102c3(%rip)     # 0x14700
je 0x446b
cmpl $0x0, 0x1034a(%rip)     # 0x14790
je 0x446b
movl 0xff62(%rip), %eax      # 0x143b0
movq %rax, 0x101e3(%rip)     # 0x14638
movq %r12, %rdi
leaq 0x10295(%rip), %rsi     # 0x146f4
callq 0x5cf9
movq %rax, 0x10225(%rip)     # 0x14690
callq 0x597d
testl %eax, %eax
je 0x447f
testb $0x40, 0x101b9(%rip)    # 0x14634
je 0x449a
jmp 0x44c8
movq %r15, %rdi
xorl %esi, %esi
callq 0x47c1
testl %eax, %eax
jns 0x449a
movl $0xf, %edi
movq %r15, %rsi
callq 0xa1d8
callq 0x5124
callq 0x45cb
xorl %eax, %eax
callq 0x4c13
testl %eax, %eax
jne 0x4313
movl 0x1862b(%rip), %eax     # 0x1cae4
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8b7c(%rip), %rsi      # 0xd04b
movl $0x12, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa1d8