// File: /workspace/github_c_makefile_star2_O0/42Bastian[P]lyxass/parser.c
// Function: LoadSource
int LoadSource(char fn[])
{
  FILE *f;

  ConvertFilename(fn);

  f = fopen(fn,"r");

  if ( f != NULL ){
    char * ptr, *ptr_end, *ptr_start;
    int comment;

    comment = 0;
    ptr = loadBuffer;

    ptr_end = ptr + LOAD_BUFFER_SIZE - 256;

    strcpy(file_list[Global.Files].name,fn);

    while ( ! feof(f) && ptr <= ptr_end){
      char c;
      char *ptrLine = line;

      memset(line,0,254);
      if ( fgets(line,254,f) == NULL ){
        break;
      }
      ptr_start = ptr;
      ptrLine = line;
      // remove comment
      c = *ptrLine++;
      if (comment == 0 && (c == '*' || c == '#') )  {
        *ptr++ = '\n';
      } else {
        for( ; c ; c = *ptrLine++){
          // skip CR
          if ( c == '\r' ) {
            c = *ptrLine++;
          }
          if ( comment ) {
            if ( c == '*' && *ptrLine == '/' ){
              ++ptrLine;
              comment = 0;
            }
            continue;
          }
          if ( (noCcomment == 0) && (c == '/' && *ptrLine == '*') ){
            comment = 1;
            ++ptrLine;
            continue;
          }
          // comment ? => finished
          if ( c == ';' || (c == '/' && *ptrLine == '/') ){
            if ( *(ptr-1) == ' ' ){
              --ptr;
            }
            *ptr++ = '\n';
            break;
          }

          // do not delete Space within strings
          if ( c == '\'' || c == '"' ){
            char end;
            end = c;
            do{
              *ptr++ = c;
              c = *ptrLine++;
            }while ( c && c != end );
            *ptr++ = c;
            continue;
          }

          // collapse white spaces
          if ( c == '\t' ) {
            c = ' ';
          }
          while ( (c == ' ' || c == '\t') &&
                  (*ptrLine == ' ' || *ptrLine == '\t' ) ) {
            ++ptrLine;
          }
          *ptr++ = c;
        }
      } // if ( c == '*' || c == '#' )
      if ( ptr == ptr_start ){
        *ptr++ = '\n';
      }

    } // while

    while( *(ptr-2) == ' ' ){
      --ptr;
      *ptr = '\n';
    }
    *ptr++ = 0;

    fclose(f);

    if ( ptr >= ptr_end ) Error(-LOAD_ERR,fn);

    Current.SrcPtr = my_malloc( (long)(ptr-loadBuffer + 1));
    memcpy(Current.SrcPtr, loadBuffer, ptr-loadBuffer);

    Current.Line = 0;

  } else {
    Global.Files--;
    return Error(-FILE_ERR,fn);
  }
  return TRUE;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x3cf0
movq -0x10(%rbp), %rdi
leaq 0xc3b2(%rip), %rsi      # 0x11442
callq 0x3180
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x547e
movl $0x0, -0x34(%rbp)
movq 0x1bc3e(%rip), %rax     # 0x20cf0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
addq $0x100000, %rax         # imm = 0x100000
addq $-0x100, %rax
movq %rax, -0x28(%rbp)
leaq 0x132cf(%rip), %rax     # 0x183a0
movslq 0xc(%rax), %rax
leaq 0x136f4(%rip), %rdi     # 0x187d0
imulq $0x204, %rax, %rax      # imm = 0x204
addq %rax, %rdi
addq $0x4, %rdi
movq -0x10(%rbp), %rsi
callq 0x3060
movq -0x18(%rbp), %rdi
callq 0x3130
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x42(%rbp)
jne 0x5116
movq -0x20(%rbp), %rax
cmpq -0x28(%rbp), %rax
setbe %al
movb %al, -0x42(%rbp)
movb -0x42(%rbp), %al
testb $0x1, %al
jne 0x5122
jmp 0x53c8
leaq 0x1bbd7(%rip), %rax     # 0x20d00
movq %rax, -0x40(%rbp)
leaq 0x1bbcc(%rip), %rdi     # 0x20d00
xorl %esi, %esi
movl $0xfe, %edx
callq 0x30c0
movq -0x18(%rbp), %rdx
leaq 0x1bbb5(%rip), %rdi     # 0x20d00
movl $0xfe, %esi
callq 0x30e0
cmpq $0x0, %rax
jne 0x5160
jmp 0x53c8
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
leaq 0x1bb91(%rip), %rax     # 0x20d00
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x40(%rbp)
movb (%rax), %al
movb %al, -0x35(%rbp)
cmpl $0x0, -0x34(%rbp)
jne 0x51b6
movsbl -0x35(%rbp), %eax
cmpl $0x2a, %eax
je 0x519f
movsbl -0x35(%rbp), %eax
cmpl $0x23, %eax
jne 0x51b6
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movb $0xa, (%rax)
jmp 0x53a7
jmp 0x51b8
cmpb $0x0, -0x35(%rbp)
je 0x53a5
movsbl -0x35(%rbp), %eax
cmpl $0xd, %eax
jne 0x51df
movq -0x40(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x40(%rbp)
movb (%rax), %al
movb %al, -0x35(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0x5212
movsbl -0x35(%rbp), %eax
cmpl $0x2a, %eax
jne 0x520d
movq -0x40(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
jne 0x520d
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
movl $0x0, -0x34(%rbp)
jmp 0x538c
leaq 0x13177(%rip), %rax     # 0x18390
cmpl $0x0, (%rax)
jne 0x524b
movsbl -0x35(%rbp), %eax
cmpl $0x2f, %eax
jne 0x524b
movq -0x40(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2a, %eax
jne 0x524b
movl $0x1, -0x34(%rbp)
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x538c
movsbl -0x35(%rbp), %eax
cmpl $0x3b, %eax
je 0x5269
movsbl -0x35(%rbp), %eax
cmpl $0x2f, %eax
jne 0x5299
movq -0x40(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
jne 0x5299
movq -0x20(%rbp), %rax
movsbl -0x1(%rax), %eax
cmpl $0x20, %eax
jne 0x5282
movq -0x20(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movb $0xa, (%rax)
jmp 0x53a5
movsbl -0x35(%rbp), %eax
cmpl $0x27, %eax
je 0x52ab
movsbl -0x35(%rbp), %eax
cmpl $0x22, %eax
jne 0x5314
movb -0x35(%rbp), %al
movb %al, -0x41(%rbp)
movb -0x35(%rbp), %cl
movq -0x20(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x20(%rbp)
movb %cl, (%rax)
movq -0x40(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x40(%rbp)
movb (%rax), %al
movb %al, -0x35(%rbp)
movsbl -0x35(%rbp), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x43(%rbp)
je 0x52f7
movsbl -0x35(%rbp), %eax
movsbl -0x41(%rbp), %ecx
cmpl %ecx, %eax
setne %al
movb %al, -0x43(%rbp)
movb -0x43(%rbp), %al
testb $0x1, %al
jne 0x52b1
movb -0x35(%rbp), %cl
movq -0x20(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x20(%rbp)
movb %cl, (%rax)
jmp 0x538c
movsbl -0x35(%rbp), %eax
cmpl $0x9, %eax
jne 0x5321
movb $0x20, -0x35(%rbp)
jmp 0x5323
movsbl -0x35(%rbp), %eax
cmpl $0x20, %eax
je 0x533a
movsbl -0x35(%rbp), %ecx
xorl %eax, %eax
cmpl $0x9, %ecx
movb %al, -0x44(%rbp)
jne 0x5361
movq -0x40(%rbp), %rax
movsbl (%rax), %ecx
movb $0x1, %al
cmpl $0x20, %ecx
movb %al, -0x45(%rbp)
je 0x535b
movq -0x40(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x9, %eax
sete %al
movb %al, -0x45(%rbp)
movb -0x45(%rbp), %al
movb %al, -0x44(%rbp)
movb -0x44(%rbp), %al
testb $0x1, %al
jne 0x536a
jmp 0x5378
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x5323
movb -0x35(%rbp), %cl
movq -0x20(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x20(%rbp)
movb %cl, (%rax)
movq -0x40(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x40(%rbp)
movb (%rax), %al
movb %al, -0x35(%rbp)
jmp 0x51b8
jmp 0x53a7
movq -0x20(%rbp), %rax
cmpq -0x30(%rbp), %rax
jne 0x53c3
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movb $0xa, (%rax)
jmp 0x50f3
jmp 0x53ca
movq -0x20(%rbp), %rax
movsbl -0x2(%rax), %eax
cmpl $0x20, %eax
jne 0x53ec
movq -0x20(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movb $0xa, (%rax)
jmp 0x53ca
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movb $0x0, (%rax)
movq -0x18(%rbp), %rdi
callq 0x3090
movq -0x20(%rbp), %rax
cmpq -0x28(%rbp), %rax
jb 0x541f
movq -0x10(%rbp), %rsi
movl $0xffffffd6, %edi       # imm = 0xFFFFFFD6
callq 0xd130
movq -0x20(%rbp), %rdi
movq 0x1b8c6(%rip), %rax     # 0x20cf0
subq %rax, %rdi
addq $0x1, %rdi
callq 0x32e0
movq %rax, %rcx
leaq 0x131b8(%rip), %rax     # 0x185f8
movq %rcx, 0x198(%rax)
leaq 0x131aa(%rip), %rax     # 0x185f8
movq 0x198(%rax), %rdi
movq 0x1b894(%rip), %rsi     # 0x20cf0
movq -0x20(%rbp), %rdx
movq 0x1b889(%rip), %rax     # 0x20cf0
subq %rax, %rdx
callq 0x3140
leaq 0x13182(%rip), %rax     # 0x185f8
movl $0x0, (%rax)
jmp 0x54a8
leaq 0x12f1b(%rip), %rax     # 0x183a0
movl 0xc(%rax), %ecx
addl $-0x1, %ecx
leaq 0x12f0e(%rip), %rax     # 0x183a0
movl %ecx, 0xc(%rax)
movq -0x10(%rbp), %rsi
movl $0xfffffffe, %edi       # imm = 0xFFFFFFFE
callq 0xd130
movl %eax, -0x4(%rbp)
jmp 0x54af
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)