// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/src/tekprep.c
// Function: tekpreinit
int
tekpreinit(void)
{
     int  i,j,k,l;
     int fh;

     cdpreinit();

     if( (fh=kopen4load("lookup.dat",0)) >= 0 ) {
          l=kgetc(fh);
          for (j=0 ; j < l ; j++) {
               k=kgetc(fh);
               for (i=0 ; i < 256 ; i++) {
                    tempbuf[i]=kgetc(fh);
               }
               makepalookup(k,tempbuf,0,0,0,1);
          }
          kclose(fh);
     }
     if( (option[4] != 0) && ((fh=kopen4load("nlookup.dat",0)) >= 0) ) {
          l=kgetc(fh);
          for (j=0 ; j < l ; j++) {
               k=kgetc(fh);
               for (i=0 ; i < 256 ; i++) {
                    tempbuf[i]=kgetc(fh);
               }
               makepalookup(k+15,tempbuf,0,0,0,1);
          }
          kclose(fh);
     }

     makepalookup(255,tempbuf,60,60,60,1);

     pskyoff[0]=0;  // 2 tiles
     pskyoff[1]=1;
     pskyoff[2]=2;
     pskyoff[3]=3;
     pskybits=2;    // tile 4 times, every 90 deg.
     parallaxtype=1;
     parallaxyoffs=112;
     initptrlists();
     initpaletteshifts();
     initmenu();
     initmoreoptions();
     if( screensize == 0 ) {
          screensize=MAXXDIM;
     }
     activemenu=0;

     return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
callq 0x9d20
leaq 0xb4a8c(%rip), %rdi     # 0xd9e10
xorl %esi, %esi
callq 0x4d470
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
jl 0x25420
movl -0x14(%rbp), %edi
callq 0x4dae0
movl %eax, -0x10(%rbp)
movl $0x0, -0x8(%rbp)
movl -0x8(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x25418
movl -0x14(%rbp), %edi
callq 0x4dae0
movl %eax, -0xc(%rbp)
movl $0x0, -0x4(%rbp)
cmpl $0x100, -0x4(%rbp)      # imm = 0x100
jge 0x253ef
movl -0x14(%rbp), %edi
callq 0x4dae0
movb %al, %dl
movslq -0x4(%rbp), %rcx
leaq 0x10858f(%rip), %rax    # 0x12d970
movb %dl, (%rax,%rcx)
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x253c3
movl -0xc(%rbp), %edi
leaq 0x108577(%rip), %rsi    # 0x12d970
xorl %r8d, %r8d
movl $0x1, %r9d
movl %r8d, %edx
movl %r8d, %ecx
callq 0x72000
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x253a9
movl -0x14(%rbp), %edi
callq 0x4def0
leaq 0xf4af1(%rip), %rax     # 0x119f18
movzbl 0x4(%rax), %eax
cmpl $0x0, %eax
je 0x254da
leaq 0xb49d4(%rip), %rdi     # 0xd9e0f
xorl %esi, %esi
callq 0x4d470
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
jl 0x254da
movl -0x14(%rbp), %edi
callq 0x4dae0
movl %eax, -0x10(%rbp)
movl $0x0, -0x8(%rbp)
movl -0x8(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x254d2
movl -0x14(%rbp), %edi
callq 0x4dae0
movl %eax, -0xc(%rbp)
movl $0x0, -0x4(%rbp)
cmpl $0x100, -0x4(%rbp)      # imm = 0x100
jge 0x254a6
movl -0x14(%rbp), %edi
callq 0x4dae0
movb %al, %dl
movslq -0x4(%rbp), %rcx
leaq 0x1084d8(%rip), %rax    # 0x12d970
movb %dl, (%rax,%rcx)
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x2547a
movl -0xc(%rbp), %edi
addl $0xf, %edi
leaq 0x1084bd(%rip), %rsi    # 0x12d970
xorl %r8d, %r8d
movl $0x1, %r9d
movl %r8d, %edx
movl %r8d, %ecx
callq 0x72000
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x25460
movl -0x14(%rbp), %edi
callq 0x4def0
movl $0xff, %edi
leaq 0x10848a(%rip), %rsi    # 0x12d970
movl $0x3c, %r8d
movl $0x1, %r9d
movl %r8d, %edx
movl %r8d, %ecx
callq 0x72000
leaq 0x5321ec(%rip), %rax    # 0x5576f0
movw $0x0, (%rax)
leaq 0x5321e0(%rip), %rax    # 0x5576f0
movw $0x1, 0x2(%rax)
leaq 0x5321d3(%rip), %rax    # 0x5576f0
movw $0x2, 0x4(%rax)
leaq 0x5321c6(%rip), %rax    # 0x5576f0
movw $0x3, 0x6(%rax)
leaq 0x5323b9(%rip), %rax    # 0x5578f0
movw $0x2, (%rax)
leaq 0x5323af(%rip), %rax    # 0x5578f2
movb $0x1, (%rax)
leaq 0x5323a7(%rip), %rax    # 0x5578f4
movl $0x70, (%rax)
callq 0x25290
callq 0x19830
callq 0x1d7c0
movb $0x0, %al
callq 0x1f880
leaq 0x1095f2(%rip), %rax    # 0x12eb62
movswl (%rax), %eax
cmpl $0x0, %eax
jne 0x25584
leaq 0x1095e3(%rip), %rax    # 0x12eb62
movw $0xb40, (%rax)          # imm = 0xB40
leaq 0x152f29(%rip), %rax    # 0x1784b4
movl $0x0, (%rax)
xorl %eax, %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)