// File: /workspace/github_c_makefile_star2_O2/42Bastian[P]lyxass/lyxass.c
// Function: doReference
void doReference(void)
{
  if ( error || !Current.doRef || Current.pass2) return;

  if ( refFirst ){

    REFERENCE *ptr1,*ptr = refFirst;
    struct current_s save_current = Current;
    struct code_s save_code = code;
    struct global_s save_global = Global;
    int mode = sourceMode;

    //    printf("Pass 2:....");

    Current.doRef = 0;

    while ( ptr ){
      ptr1 = ptr->up;

      //      printf("->%p = %p %p\n",ptr->unknown,l,ptr1);

      if ( ptr->unknown == save_current.LabelPtr ){
        cntRef++;
        Current.Line = ptr->line;
        Current.File = ptr->file;
        Current.Macro.Line = ptr->macroline;
        Current.Macro.File = ptr->macrofile;
        Current.Macro.invoked = ptr->macroinvoked;
        Global.pc = ptr->pc;
        //Current.var = ptr->var;
        code.Ptr = ptr->codePtr;
        Current.SrcPtr = ptr->src;
        sourceMode = ptr->mode;

        //mesg(Current.SrcPtr);

        mainloop( 1 );

        ptr->unknown = 0;

        if ( ptr->down ){
          ptr->down->up = ptr->up;
        }
        if ( ptr->up ){
          ptr->up->down = ptr->down;
        }
        if ( ptr == refFirst ) refFirst = ptr->up;
        if ( ptr == refLast ) refLast = ptr->down;

        free(ptr);
      }
      ptr = ptr1;
    }

    //exit(1);
    sourceMode = mode;
    code = save_code;
    Current = save_current;
    Global = save_global;
    //    printf("finished\n");
  }
  Current.doRef = 0;
}

// Assembly:
cmpl $0x0, 0x185ef(%rip)     # 0x1cae4
jne 0x46ef
cmpl $0x0, 0x101f2(%rip)     # 0x146f4
je 0x46ef
cmpl $0x0, 0x101dd(%rip)     # 0x146ec
jne 0x46ef
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
leaq 0x1e873(%rip), %r12     # 0x22da0
movq (%r12), %r13
testq %r13, %r13
je 0x46d7
leaq 0x100c7(%rip), %rsi     # 0x14608
leaq 0x30(%rsp), %rdi
movl $0x88, %edx
callq 0x3150
movq 0x10139(%rip), %r15     # 0x14690
leaq 0x1013a(%rip), %rsi     # 0x14698
leaq 0xb8(%rsp), %rdi
movl $0x130, %edx            # imm = 0x130
callq 0x3150
movups 0x10069(%rip), %xmm0    # 0x145e0
movaps %xmm0, 0x20(%rsp)
movups 0x1004d(%rip), %xmm0    # 0x145d0
movaps %xmm0, 0x10(%rsp)
leaq 0xfe21(%rip), %rsi      # 0x143b0
leaq 0x1e8(%rsp), %rdi
movl $0x220, %edx            # imm = 0x220
callq 0x3150
andl $0x0, 0x1014c(%rip)     # 0x146f4
movl 0x10042(%rip), %eax     # 0x145f0
movl %eax, 0xc(%rsp)
pushq $0x1
popq %rbx
leaq 0x1e7ec(%rip), %rbp     # 0x22da8
testq %r13, %r13
je 0x4666
movq %r13, %r14
movq (%r13), %r13
cmpq %r15, 0x38(%r14)
jne 0x45bc
incl 0xfdc4(%rip)            # 0x1439c
movq 0x14(%r14), %rax
movq %rax, 0x10025(%rip)     # 0x14608
movq 0x1c(%r14), %rax
movq %rax, 0x1002a(%rip)     # 0x14618
movl 0x24(%r14), %eax
movl %eax, 0x10034(%rip)     # 0x1462c
movl 0x10(%r14), %eax
movl %eax, 0xfdae(%rip)      # 0x143b0
movq 0x40(%r14), %rax
movq %rax, 0xffd3(%rip)      # 0x145e0
leaq 0x48(%r14), %rax
movq %rax, 0x10188(%rip)     # 0x147a0
movl 0x30(%r14), %eax
movl %eax, 0xffce(%rip)      # 0x145f0
movl %ebx, %edi
callq 0x41f5
movq (%r14), %rax
movq 0x8(%r14), %rcx
testq %rcx, %rcx
je 0x4638
movq %rax, (%rcx)
testq %rax, %rax
je 0x4641
movq %rcx, 0x8(%rax)
cmpq (%r12), %r14
jne 0x464b
movq %rax, (%r12)
cmpq (%rbp), %r14
jne 0x4659
movq 0x8(%r14), %rax
movq %rax, (%rbp)
movq %r14, %rdi
callq 0x3050
jmp 0x45bc
movl 0xc(%rsp), %eax
movl %eax, 0xff80(%rip)      # 0x145f0
movaps 0x10(%rsp), %xmm0
movaps 0x20(%rsp), %xmm1
movups %xmm0, 0xff4f(%rip)     # 0x145d0
movups %xmm1, 0xff58(%rip)     # 0x145e0
leaq 0xff79(%rip), %rdi      # 0x14608
leaq 0x30(%rsp), %rsi
movl $0x88, %edx
callq 0x3150
movq %r15, 0xffeb(%rip)      # 0x14690
leaq 0xffec(%rip), %rdi      # 0x14698
leaq 0xb8(%rsp), %rsi
movl $0x130, %edx            # imm = 0x130
callq 0x3150
leaq 0xfceb(%rip), %rdi      # 0x143b0
leaq 0x1e8(%rsp), %rsi
movl $0x220, %edx            # imm = 0x220
callq 0x3150
andl $0x0, 0x10016(%rip)     # 0x146f4
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq