// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x1
popq %rax
movl %eax, 0x104f7(%rip)     # 0x14700
movl %eax, 0x10581(%rip)     # 0x14790
movl %edi, 0x104d7(%rip)     # 0x146ec
xorl %ebp, %ebp
leaq 0x7e1c(%rip), %r14      # 0xc03a
leaq 0x18bfb(%rip), %r15     # 0x1ce20
leaq 0x18d04(%rip), %rbx     # 0x1cf30
leaq 0x10469(%rip), %r12     # 0x1469c
leaq 0x103f6(%rip), %r13     # 0x14630
xorl %eax, %eax
callq 0x4aef
testl %eax, %eax
je 0x43db
movl 0x10161(%rip), %edx     # 0x143b0
movl %edx, 0x1015f(%rip)     # 0x143b4
incl 0x1015d(%rip)           # 0x143b8
movl 0x103a7(%rip), %esi     # 0x14608
incl %esi
movl %esi, 0x1039f(%rip)     # 0x14608
andq $0x0, 0x1047f(%rip)     # 0x146f0
andq $0x0, 0x10417(%rip)     # 0x14690
andl $0x0, 0x10544(%rip)     # 0x147c4
andl $0x0, 0x1885d(%rip)     # 0x1cae4
cmpl %ebp, 0x1045f(%rip)     # 0x146ec
movq 0x1034c(%rip), %rax     # 0x145e0
sete %cl
cmpl $0x0, 0x10462(%rip)     # 0x14700
movq %rax, 0x10343(%rip)     # 0x145e8
setne %al
cmpl $0x0, 0x104e1(%rip)     # 0x14790
setne %dil
andb %al, %dil
andb %cl, %dil
movl 0x100bd(%rip), %eax     # 0x1437c
testl %eax, %eax
setne %cl
andb %dil, %cl
cmpb $0x1, %cl
jne 0x42e9
cmpl $0x2, %eax
jg 0x42dc
xorl $0x2, %eax
orl 0x10336(%rip), %eax     # 0x14610
jne 0x42e9
movq %r14, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x30c0
movl (%rbx), %eax
testl %eax, %eax
je 0x43cc
cmpl $0x20, %eax
jne 0x430a
callq 0x5386
testl %eax, %eax
jne 0x43cc
jmp 0x43b3
movq %r13, %rdi
callq 0x4fa0
testl %eax, %eax
je 0x4325
pushq $0x3
popq %rdi
leaq 0x7c72(%rip), %rsi      # 0xbf92
jmp 0x43c7
testb $0x20, 0x10308(%rip)    # 0x14634
je 0x434f
leaq 0x10333(%rip), %rdi     # 0x14668
pushq $0x1
popq %rsi
callq 0x46f0
testl %eax, %eax
jns 0x43cc
movl $0x1, 0x102e5(%rip)     # 0x14634
cmpl $0x0, 0x102da(%rip)     # 0x14630
je 0x439f
cmpl $0x0, 0x1038d(%rip)     # 0x146ec
jne 0x439f
cmpl $0x0, 0x102ac(%rip)     # 0x14614
jne 0x439f
cmpl $0x0, 0x1038f(%rip)     # 0x14700
je 0x439f
cmpl $0x0, 0x10416(%rip)     # 0x14790
je 0x439f
movl 0x1002e(%rip), %eax     # 0x143b0
movq %rax, 0x102af(%rip)     # 0x14638
movq %r13, %rdi
leaq 0x10361(%rip), %rsi     # 0x146f4
callq 0x55fd
movq %rax, 0x102f1(%rip)     # 0x14690
callq 0x5386
testl %eax, %eax
je 0x43b3
testb $0x40, 0x10285(%rip)    # 0x14634
je 0x43cc
jmp 0x43f0
movq %r12, %rdi
xorl %esi, %esi
callq 0x46f0
testl %eax, %eax
jns 0x43cc
pushq $0xf
popq %rdi
movq %r12, %rsi
callq 0x96cc
callq 0x4e3f
callq 0x44ee
jmp 0x423a
movl 0x18703(%rip), %eax     # 0x1cae4
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x7c54(%rip), %rsi      # 0xc04b
pushq $0x12
popq %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x96cc