// File: /workspace/github_c_makefile_star2_O1/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, 0x1041d(%rip)     # 0x14700
movl %eax, 0x104a7(%rip)     # 0x14790
movl %edi, 0x103fd(%rip)     # 0x146ec
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x4c17
testl %eax, %eax
je 0x44c3
leaq 0x8d33(%rip), %rbx      # 0xd03a
leaq 0x18b12(%rip), %r14     # 0x1ce20
leaq 0x18c1b(%rip), %r13     # 0x1cf30
leaq 0x10380(%rip), %r15     # 0x1469c
leaq 0x1030d(%rip), %r12     # 0x14630
movl 0x10087(%rip), %edx     # 0x143b0
movl %edx, 0x10085(%rip)     # 0x143b4
incl 0x10083(%rip)           # 0x143b8
movq 0x102a4(%rip), %rax     # 0x145e0
movl 0x102c6(%rip), %esi     # 0x14608
incl %esi
movl %esi, 0x102be(%rip)     # 0x14608
movq %rbp, 0x1039f(%rip)     # 0x146f0
movq %rbp, 0x10338(%rip)     # 0x14690
movl %ebp, 0x10466(%rip)     # 0x147c4
cmpl %ebp, 0x10388(%rip)     # 0x146ec
movq %rax, 0x1027d(%rip)     # 0x145e8
sete %al
cmpl $0x0, 0x1038b(%rip)     # 0x14700
movl %ebp, 0x18769(%rip)     # 0x1cae4
setne %cl
cmpl $0x0, 0x1040b(%rip)     # 0x14790
setne %dil
andb %cl, %dil
andb %al, %dil
movl 0xffe7(%rip), %eax      # 0x1437c
testl %eax, %eax
setne %cl
andb %dil, %cl
cmpb $0x1, %cl
jne 0x43bf
cmpl $0x2, %eax
jg 0x43b2
xorl $0x2, %eax
orl 0x10260(%rip), %eax     # 0x14610
jne 0x43bf
movq %rbx, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x30c0
movl (%r13), %eax
testl %eax, %eax
je 0x44aa
cmpl $0x20, %eax
jne 0x43e2
callq 0x5a0a
testl %eax, %eax
jne 0x44aa
jmp 0x448f
movq %r12, %rdi
callq 0x53a9
testl %eax, %eax
je 0x43ff
movl $0x3, %edi
leaq 0x8b98(%rip), %rsi      # 0xcf92
jmp 0x44a5
testb $0x20, 0x1022e(%rip)    # 0x14634
je 0x442b
leaq 0x10259(%rip), %rdi     # 0x14668
movl $0x1, %esi
callq 0x47f9
testl %eax, %eax
jns 0x44aa
movl $0x1, 0x10209(%rip)     # 0x14634
cmpl $0x0, 0x101fe(%rip)     # 0x14630
je 0x447b
cmpl $0x0, 0x102b1(%rip)     # 0x146ec
jne 0x447b
cmpl $0x0, 0x101d0(%rip)     # 0x14614
jne 0x447b
cmpl $0x0, 0x102b3(%rip)     # 0x14700
je 0x447b
cmpl $0x0, 0x1033a(%rip)     # 0x14790
je 0x447b
movl 0xff52(%rip), %eax      # 0x143b0
movq %rax, 0x101d3(%rip)     # 0x14638
movq %r12, %rdi
leaq 0x10285(%rip), %rsi     # 0x146f4
callq 0x5d4f
movq %rax, 0x10215(%rip)     # 0x14690
callq 0x5a0a
testl %eax, %eax
je 0x448f
testb $0x40, 0x101a9(%rip)    # 0x14634
je 0x44aa
jmp 0x44d8
movq %r15, %rdi
xorl %esi, %esi
callq 0x47f9
testl %eax, %eax
jns 0x44aa
movl $0xf, %edi
movq %r15, %rsi
callq 0xa2c8
callq 0x5192
callq 0x45ea
xorl %eax, %eax
callq 0x4c17
testl %eax, %eax
jne 0x4323
movl 0x1861b(%rip), %eax     # 0x1cae4
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8b6c(%rip), %rsi      # 0xd04b
movl $0x12, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa2c8