LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/tekprep.c
// Function: initplayersprite
void
initplayersprite(short snum)
{
     int      i;

     if (playersprite[snum] >= 0) return;

     i=jsinsertsprite(cursectnum[snum], 8);
     if( i == -1 ) {
          crashgame("initplayersprite: jsinsertsprite on player %d failed", snum);
     }
     playersprite[snum]=i;
     sprite[i].x=posx[snum];
     sprite[i].y=posy[snum];
     sprite[i].z=posz[snum]+(KENSPLAYERHEIGHT<<8);
     sprite[i].cstat = 0x101;
     sprite[i].shade=0;
     if( option[4] == 0 ) {
          sprite[i].pal=0;
     }
     else {
          sprite[i].pal=snum+16;
     }
     sprite[i].clipdist=32;
     sprite[i].xrepeat=24;
     sprite[i].yrepeat=24;
     sprite[i].xoffset=0;
     sprite[i].yoffset=0;
     sprite[i].picnum=DOOMGUY;
     sprite[i].ang=ang[snum];
     sprite[i].xvel=0;
     sprite[i].yvel=0;
     sprite[i].zvel=0;
     sprite[i].owner=snum+4096;
     sprite[i].sectnum=cursectnum[snum];
     sprite[i].statnum=8;
     sprite[i].lotag=0;
     sprite[i].hitag=0;
     // important to set extra = -1
     sprite[i].extra=-1;

     tekrestoreplayer(snum);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movslq %edi, %r14
leaq 0xca559(%rip), %r12     # 0xe5750
cmpw $0x0, (%r12,%r14,2)
js 0x1b208
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0xca511(%rip), %r15     # 0xe5720
movswl (%r15,%r14,2), %edi
movl $0x8, %esi
callq 0x1eac8
movl %eax, %ebp
movswl %r14w, %ebx
cmpw $-0x1, %ax
jne 0x1b23a
leaq 0x74cac(%rip), %rdi     # 0x8fedd
movl %ebx, %esi
xorl %eax, %eax
callq 0x2eb88
movw %bp, (%r12,%r14,2)
leaq 0xc928a(%rip), %rax     # 0xe44d0
movl (%rax,%r14,4), %edx
movswq %bp, %rax
imulq $0x2c, %rax, %rax
leaq 0x4128d7(%rip), %rcx    # 0x42db30
movl %edx, (%rcx,%rax)
leaq 0xc92ad(%rip), %rdx     # 0xe4510
movl (%rdx,%r14,4), %edx
movl %edx, 0x4(%rcx,%rax)
leaq 0xc92de(%rip), %rdx     # 0xe4550
movl $0x2200, %esi           # imm = 0x2200
addl (%rdx,%r14,4), %esi
movl %esi, 0x8(%rcx,%rax)
movw $0x101, 0xc(%rcx,%rax)  # imm = 0x101
leaq 0xb66eb(%rip), %rdx     # 0xd1978
xorl %esi, %esi
cmpb $0x0, 0x4(%rdx)
leal 0x10(%rbx), %edx
movzbl %dl, %edx
cmovel %esi, %edx
movb $0x0, 0x10(%rcx,%rax)
movb %dl, 0x11(%rcx,%rax)
movb $0x20, 0x12(%rcx,%rax)
movl $0x1818, 0x14(%rcx,%rax) # imm = 0x1818
movw $0x3e7, 0xe(%rcx,%rax)  # imm = 0x3E7
leaq 0xc91f0(%rip), %rdx     # 0xe44b0
movzwl (%rdx,%r14,2), %edx
movw %dx, 0x1c(%rcx,%rax)
leal 0x1000(%rbx), %edx
movw %dx, 0x1e(%rcx,%rax)
movzwl (%r15,%r14,2), %edx
movw %dx, 0x18(%rcx,%rax)
movw $0x8, 0x1a(%rcx,%rax)
movq $0x0, 0x20(%rcx,%rax)
movl $0xffff0000, 0x28(%rcx,%rax) # imm = 0xFFFF0000
movl %ebx, %edi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1b0c8
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/tekprep.c
// Function: initptrlists
int
initptrlists()
{
     int       i;

     for( i=0; i < MAXSPRITES; i++ ) {
          sprptr[i]=&sprite[i];
          sprXTptr[i]=&spriteXT[i];
     }
     for( i=0; i < MAXSECTORS; i++ ) {
          sectptr[i]=&sector[i];
     }
     for( i=0; i < MAXWALLS; i++ ) {
          wallptr[i]=&wall[i];
     }

     return 0;
}

// Assembly:
movdqa 0x74b12(%rip), %xmm1    # 0x8fe20
xorl %eax, %eax
movdqa 0x74b18(%rip), %xmm2    # 0x8fe30
movq 0xb5c60(%rip), %xmm0    # 0xd0f80
pshufd $0x44, %xmm0, %xmm3     # xmm3 = xmm0[0,1,0,1]
leaq 0x115f04(%rip), %rcx    # 0x131230
movdqa 0x74b0c(%rip), %xmm4    # 0x8fe40
leaq 0x135ef5(%rip), %rdx    # 0x151230
movq %rdx, %xmm0
pshufd $0x44, %xmm0, %xmm5     # xmm5 = xmm0[0,1,0,1]
leaq 0x1bdee4(%rip), %rdx    # 0x1d9230
movdqa 0x74afc(%rip), %xmm0    # 0x8fe50
movdqa %xmm1, %xmm6
pmuludq %xmm2, %xmm6
paddq %xmm3, %xmm6
movdqa %xmm1, %xmm7
psrlq $0x20, %xmm7
movdqa %xmm7, %xmm8
pmuludq %xmm2, %xmm8
psllq $0x20, %xmm8
paddq %xmm6, %xmm8
movdqa %xmm8, (%rax,%rcx)
movdqa %xmm1, %xmm6
pmuludq %xmm4, %xmm6
paddq %xmm5, %xmm6
pmuludq %xmm4, %xmm7
psllq $0x20, %xmm7
paddq %xmm6, %xmm7
movdqa %xmm7, (%rax,%rdx)
paddq %xmm0, %xmm1
addq $0x10, %rax
cmpq $0x20000, %rax          # imm = 0x20000
jne 0x1b354
movdqa 0x74a66(%rip), %xmm1    # 0x8fe20
xorl %eax, %eax
movdqa 0x74a9c(%rip), %xmm2    # 0x8fe60
movq 0xb5b5c(%rip), %xmm3    # 0xd0f28
pshufd $0x44, %xmm3, %xmm3     # xmm3 = xmm3[0,1,0,1]
leaq 0x1dde58(%rip), %rcx    # 0x1f9230
movdqa %xmm1, %xmm4
pmuludq %xmm2, %xmm4
paddq %xmm3, %xmm4
movdqa %xmm1, %xmm5
psrlq $0x20, %xmm5
pmuludq %xmm2, %xmm5
psllq $0x20, %xmm5
paddq %xmm4, %xmm5
movdqa %xmm5, (%rax,%rcx)
paddq %xmm0, %xmm1
addq $0x10, %rax
cmpq $0x8000, %rax           # imm = 0x8000
jne 0x1b3d8
movdqa 0x74a09(%rip), %xmm1    # 0x8fe20
xorl %eax, %eax
movq 0xb5bd7(%rip), %xmm2    # 0xd0ff8
pshufd $0x44, %xmm2, %xmm2     # xmm2 = xmm2[0,1,0,1]
leaq 0x1e5e03(%rip), %rcx    # 0x201230
movdqa %xmm1, %xmm3
psllq $0x5, %xmm3
paddq %xmm2, %xmm3
movdqa %xmm3, (%rax,%rcx)
paddq %xmm0, %xmm1
addq $0x10, %rax
cmpq $0x20000, %rax          # imm = 0x20000
jne 0x1b42d
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/teksmk.c
// Function: smkopenmenu
void
smkopenmenu(char *name)
{
     unsigned long smkx, smky;
     int fh, flen;

     fh = kopen4load(name, 0);
     if (fh < 0) {
          debugprintf("smkopenmenu(\"%s\") failed\n", name);
          return;
     }

     flen = kfilelength(fh);
     smkmenubuf = (unsigned char *)malloc(flen);

     if (smkmenubuf == NULL) {
          kclose(fh);
          debugprintf("smkopenmenu(\"%s\") malloc of %d bytes failed\n", name, flen);
          return;
     }

     kread(fh, smkmenubuf, flen);
     kclose(fh);

     smkmenu = smk_open_memory(smkmenubuf, flen);
     if (!smkmenu) {
          free(smkmenubuf);
          smkmenubuf = NULL;
          debugprintf("smk_open_memory() returned null\n");
          return;
     }

     // Smacker frames are decoded linewise, but BUILD expects its
     // tiles columnwise, so we will treat the tile as though it's
     // rotated 90 degrees and flipped horizontally.

     smk_enable_all(smkmenu, SMK_VIDEO_TRACK);
     smk_info_video(smkmenu, &smkx, &smky, NULL);
     tilesizx[SMKPICNUM0] = smky;
     tilesizy[SMKPICNUM0] = smkx;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
xorl %esi, %esi
callq 0x34174
testl %eax, %eax
js 0x1be76
movl %eax, %ebp
movl %eax, %edi
callq 0x346d9
movl %eax, %r15d
movslq %eax, %r14
movq %r14, %rdi
callq 0x8d50
movq %rax, 0x20d47f(%rip)    # 0x229260
testq %rax, %rax
je 0x1be91
movl %ebp, %edi
movq %rax, %rsi
movl %r14d, %edx
callq 0x343bc
movl %ebp, %edi
callq 0x34878
movq 0x20d45b(%rip), %rdi    # 0x229260
movq %r14, %rsi
callq 0x2f0c8
movq %rax, 0x20d454(%rip)    # 0x229268
testq %rax, %rax
je 0x1beb6
movq %rax, %rdi
movl $0x80, %esi
callq 0x3059e
movq 0x20d437(%rip), %rdi    # 0x229268
leaq 0x10(%rsp), %rbx
leaq 0x8(%rsp), %r14
movq %rbx, %rsi
movq %r14, %rdx
xorl %ecx, %ecx
callq 0x3045c
movzwl (%r14), %eax
leaq 0x5a504d(%rip), %rcx    # 0x5c0ea0
movw %ax, 0x47fa(%rcx)
movzwl (%rbx), %eax
leaq 0x5967fc(%rip), %rcx    # 0x5b2660
movw %ax, 0x47fa(%rcx)
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x741ea(%rip), %rdi     # 0x90067
movq %rbx, %rsi
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x81da7
movl %ebp, %edi
callq 0x34878
leaq 0x741e2(%rip), %rdi     # 0x90081
movq %rbx, %rsi
movl %r15d, %edx
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x81da7
movq 0x20d3a3(%rip), %rdi    # 0x229260
callq 0x8270
movq $0x0, 0x20d393(%rip) # 0x229260
leaq 0x740b5(%rip), %rdi     # 0x8ff89
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x81da7
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/teksmk.c
// Function: smkmenuframe
void
smkmenuframe(int fn)
{
     unsigned char spal[768];
     const unsigned char *palptr;
     int i;

     if (!smkmenu) {
          return;
     }

     // Render the first decodeframe as the menu background.
     smk_first(smkmenu);

     // Next, render the particular decodeframe requested.
     smk_render_frame(smkmenu, fn-1);

     // Convert the palette to the VGA (0-63) range BUILD uses.
     for (palptr = smk_get_palette(smkmenu), i=256*3-1; i>=0; i--)
          spal[i] = palptr[i] >> 2;

     waloff[SMKPICNUM0] = (intptr_t)smk_get_video(smkmenu);
#if USE_POLYMOST && USE_OPENGL
     invalidatetile(SMKPICNUM0, 0, -1);
#endif

     setbrightness(-1, spal, 2|4);
}

// Assembly:
pushq %rbx
subq $0x300, %rsp            # imm = 0x300
movl %edi, %ebx
movq 0x20d372(%rip), %rdi    # 0x229268
testq %rdi, %rdi
je 0x1bf6e
callq 0x306a2
movq 0x20d361(%rip), %rdi    # 0x229268
decl %ebx
movslq %ebx, %rsi
callq 0x313a0
movq 0x20d350(%rip), %rdi    # 0x229268
callq 0x30620
movl $0x2ff, %ecx            # imm = 0x2FF
movb (%rax,%rcx), %dl
shrb $0x2, %dl
movb %dl, (%rsp,%rcx)
addq $-0x1, %rcx
jb 0x1bf22
movq 0x20d330(%rip), %rdi    # 0x229268
callq 0x3063c
leaq 0x52e21c(%rip), %rcx    # 0x54a160
movq %rax, 0x11fe8(%rcx)
movl $0x23fd, %edi           # imm = 0x23FD
xorl %esi, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x4ed07
movq %rsp, %rsi
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0x6, %edx
callq 0x46954
addq $0x300, %rsp            # imm = 0x300
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/teksmk.c
// Function: smkshowmenu
void
smkshowmenu()
{
     if (!smkmenu) {
          return;
     }

     clearallviews(0);
     rotatesprite(160<<16, 100<<16, divscale16(200, tilesizx[SMKPICNUM0]),
                 512, SMKPICNUM0, 0, 0, 2+4, 0, 0, xdim-1, ydim-1);
     nextpage();
}

// Assembly:
cmpq $0x0, 0x20d2e9(%rip)    # 0x229268
je 0x1bfee
pushq %rbx
xorl %ebx, %ebx
xorl %edi, %edi
callq 0x46ba3
leaq 0x5a4f0e(%rip), %rax    # 0x5c0ea0
movswl 0x47fa(%rax), %ecx
movl $0xc80000, %eax         # imm = 0xC80000
xorl %edx, %edx
idivl %ecx
leaq 0x59cec3(%rip), %rcx    # 0x5b8e6c
movl (%rcx), %r10d
decl %r10d
leaq 0x59ceba(%rip), %rcx    # 0x5b8e70
movl (%rcx), %r11d
decl %r11d
movl $0xa00000, %edi         # imm = 0xA00000
movl $0x640000, %esi         # imm = 0x640000
movl %eax, %edx
movl $0x200, %ecx            # imm = 0x200
movl $0x23fd, %r8d           # imm = 0x23FD
xorl %r9d, %r9d
pushq %r11
pushq %r10
pushq %rbx
pushq %rbx
pushq $0x6
pushq %rbx
callq 0x4dcbd
addq $0x30, %rsp
popq %rbx
jmp 0x46cdb
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/teksmk.c
// Function: smkclosemenu
void
smkclosemenu()
{
     if (smkmenu) smk_close(smkmenu);
     if (smkmenubuf) free(smkmenubuf);

     waloff[SMKPICNUM0] = 0;
     smkmenu = NULL;
     smkmenubuf = NULL;
}

// Assembly:
pushq %rax
movq 0x20d271(%rip), %rdi    # 0x229268
testq %rdi, %rdi
je 0x1c001
callq 0x301d3
movq 0x20d258(%rip), %rdi    # 0x229260
testq %rdi, %rdi
je 0x1c012
callq 0x8270
leaq 0x52e147(%rip), %rax    # 0x54a160
xorl %ecx, %ecx
movq %rcx, 0x11fe8(%rax)
movq %rcx, 0x20d23f(%rip)    # 0x229268
movq %rcx, 0x20d230(%rip)    # 0x229260
popq %rax
retq
nop
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/teksnd.c
// Function: soundcallback
static void
soundcallback(unsigned int i)
{
     if (i == (unsigned int)-1) return;

     sbuf[dsound[i].sndnum].users--;
     if( sbuf[dsound[i].sndnum].users < 0 )
          sbuf[dsound[i].sndnum].users=0;
     if( sbuf[dsound[i].sndnum].users == 0 ) {
          sbuf[dsound[i].sndnum].cache_lock=199;
     }
     dsound[i].handle=NULL_HANDLE;
     dsound[i].plevel=0;
     dsound[i].sndnum=-1;

     if (dsound[i].type&ST_VEHUPDATE) {
          vehiclesoundstopped(i);
     }
}

// Assembly:
cmpl $-0x1, %edi
je 0x1c2d0
movl %edi, %eax
leaq (%rax,%rax,2), %rax
leaq 0x20cffa(%rip), %rcx    # 0x229280
leaq (%rcx,%rax,8), %rax
movslq 0x4(%rax), %rcx
leaq (%rcx,%rcx,2), %rcx
leaq 0x20d167(%rip), %rdx    # 0x229400
leaq (%rdx,%rcx,8), %rcx
movl (%rcx), %esi
leal -0x1(%rsi), %edx
movl %edx, (%rcx)
testl %esi, %esi
jle 0x1c2ae
testl %edx, %edx
jne 0x1c2b8
jmp 0x1c2b4
movl $0x0, (%rcx)
movb $-0x39, 0x14(%rcx)
movq $-0x1, (%rax)
movl $0x0, 0x8(%rax)
testb $-0x80, 0x14(%rax)
jne 0x2e1fa
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/teksnd.c
// Function: uninitsb
void
uninitsb(void)
{
     int i;

     if( musicstarted )  {
          MUSIC_StopSong();
          MUSIC_Shutdown();
          musicstarted = 0;
     }

     if( fxstarted ) {
          for( i=0; i<MAXSOUNDS; i++ ) {
               if( dsound[i].handle == NULL_HANDLE )
                    continue;
               FX_StopSound(dsound[i].handle);
          }
          FX_Shutdown();
          fxstarted = 0;
     }

     if (fhsounds >= 0) {
          kclose(fhsounds);
          fhsounds = -1;
     }
     if (fhsongs >= 0) {
          kclose(fhsongs);
          fhsongs = -1;
     }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpb $0x1, 0x20cf98(%rip)    # 0x229274
jne 0x1c2ef
callq 0x8a8c4
callq 0x8a861
movb $0x0, 0x20cf85(%rip)    # 0x229274
cmpb $0x1, 0x20cf7a(%rip)    # 0x229270
jne 0x1c328
xorl %ebx, %ebx
leaq 0x20cf7f(%rip), %r14    # 0x229280
movl (%rbx,%r14), %edi
cmpl $-0x1, %edi
je 0x1c30f
callq 0x86f1f
addq $0x18, %rbx
cmpq $0x180, %rbx            # imm = 0x180
jne 0x1c301
callq 0x86c1e
movb $0x0, 0x20cf48(%rip)    # 0x229270
movl 0xb64a2(%rip), %edi     # 0xd27d0
testl %edi, %edi
js 0x1c341
callq 0x34878
movl $0xffffffff, 0xb648f(%rip) # imm = 0xFFFFFFFF
movl 0xb648d(%rip), %edi     # 0xd27d4
testl %edi, %edi
js 0x1c35a
callq 0x34878
movl $0xffffffff, 0xb647a(%rip) # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/teksnd.c
// Function: stopsound
void
stopsound(int i)
{
     if( !fxstarted )
          return;
     if( (i < 0) || (i >= MAXSOUNDS) ) {
          return;
     }
     if( dsound[i].handle == NULL_HANDLE )
          return;

     FX_StopSound(dsound[i].handle);
     sbuf[dsound[i].sndnum].users--;
     if( sbuf[dsound[i].sndnum].users < 0 )
              sbuf[dsound[i].sndnum].users=0;
     if( sbuf[dsound[i].sndnum].users == 0 ) {
         sbuf[dsound[i].sndnum].cache_lock=199;
     }
     dsound[i].handle=NULL_HANDLE;
     dsound[i].plevel=0;
     dsound[i].sndnum=-1;
}

// Assembly:
cmpl $0xf, %edi
ja 0x1c623
testb $0x1, 0x20ccab(%rip)    # 0x229270
je 0x1c623
movl %edi, %eax
leaq (%rax,%rax,2), %rax
leaq 0x20ccac(%rip), %rcx    # 0x229280
movl (%rcx,%rax,8), %edi
cmpl $-0x1, %edi
je 0x1c623
pushq %rbx
leaq (%rcx,%rax,8), %rbx
callq 0x86f1f
movslq 0x4(%rbx), %rax
leaq (%rax,%rax,2), %rax
leaq 0x20ce0b(%rip), %rcx    # 0x229400
leaq (%rcx,%rax,8), %rax
movl (%rax), %edx
leal -0x1(%rdx), %ecx
movl %ecx, (%rax)
testl %edx, %edx
jle 0x1c60a
testl %ecx, %ecx
jne 0x1c614
jmp 0x1c610
movl $0x0, (%rax)
movb $-0x39, 0x14(%rax)
movq $-0x1, (%rbx)
movl $0x0, 0x8(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/teksnd.c
// Function: updatevehiclesnds
void
updatevehiclesnds(int i, int sndx, int sndy)
{
     int dx, dy, dist, pan;
     if( !fxstarted ) {
          return;
     }
     if( (i < 0) || (i > MAXSOUNDS) ) {
          return;
     }

     dsound[i].x=sndx;
     dsound[i].y=sndy;

     /*
     dist=labs(posx[screenpeek]-sndx)+labs(posy[screenpeek]-sndy);
     if( dist < 1000L ) {
          vol = 0x7fff;
     }
     else if( dist > 9000L ) {
          vol = 0x0000;
     }
     else {
          vol = 36000L-(dist<<2);
     }
     if( (vol < 0) || (vol > 0x7FFF) ) {
          vol=0x7fff;
     }
     pan=((getangle(posx[screenpeek]-dsoundptr[i]->x,posy[screenpeek]-dsoundptr[i]->y)+(2047-ang[screenpeek]))&2047) >> 6;
     if( (pan < 0) || (pan > 35) )
          pan=13;
     */

     dx = klabs(posx[screenpeek]-sndx);
     dy = klabs(posy[screenpeek]-sndy);
     dist = ksqrt(dx*dx+dy*dy) >> 6;

     pan = 2048 + ang[screenpeek] - getangle(posx[screenpeek]-sndx,posy[screenpeek]-sndy);
     pan = (pan & 2047) >> 6;

     if( dsound[i].handle != NULL_HANDLE )
          FX_Pan3D(dsound[i].handle,pan,dist);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x10, %edi
ja 0x1c6f5
testb $0x1, 0x20cc31(%rip)    # 0x229270
je 0x1c6f5
movl %edx, %ebx
movl %esi, %ebp
movl %edi, %eax
leaq (%rax,%rax,2), %r12
leaq 0x20cc2a(%rip), %rax    # 0x229280
movl %esi, 0xc(%rax,%r12,8)
movl %edx, 0x10(%rax,%r12,8)
leaq 0xc7df7(%rip), %r15     # 0xe445e
movswq (%r15), %rax
leaq 0xc7e5e(%rip), %rcx     # 0xe44d0
movl (%rcx,%rax,4), %ecx
subl %esi, %ecx
leaq 0xc7e92(%rip), %r13     # 0xe4510
movl (%r13,%rax,4), %edi
subl %edx, %edi
imull %ecx, %ecx
imull %edi, %edi
addl %ecx, %edi
callq 0x48a4d
movl %eax, %r14d
movswq (%r15), %rax
leaq 0xc7e10(%rip), %rcx     # 0xe44b0
movzwl (%rcx,%rax,2), %r15d
leaq 0xc7e24(%rip), %rcx     # 0xe44d0
movl (%rcx,%rax,4), %edi
subl %ebp, %edi
movl (%r13,%rax,4), %esi
subl %ebx, %esi
callq 0x48943
leaq 0x20cbbc(%rip), %rcx    # 0x229280
movl (%rcx,%r12,8), %edi
cmpl $-0x1, %edi
je 0x1c6f5
subl %eax, %r15d
shrl $0x6, %r15d
andl $0x1f, %r15d
sarl $0x6, %r14d
movl %r15d, %esi
movl %r14d, %edx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x86ef6
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/teksnd.c
// Function: updatesounds
void
updatesounds(int snum)
{
     int      dist=0L,pan=0L,dx,dy;
     int       i;

     if( (toggles[TOGGLE_SOUND] == 0) || !fxstarted )
          return;

     for( i=0; i<MAXSOUNDS; i++ ) {
          if( dsound[i].handle == NULL_HANDLE ) {
               continue;
          }
          if( (dsound[i].type&(ST_IMMEDIATE|ST_NOUPDATE|ST_VEHUPDATE)) != 0 ) {
               continue;
          }
          /*
          dist=klabs(posx[snum]-dsoundptr[i]->x)+labs(posy[snum]-dsoundptr[i]->y);
          if(dsoundptr[i]->type==ST_AMBUPDATE) {
               if( dist < AMBUPDATEDIST ) {
                    vol = (AMBUPDATEDIST<<3)-(dist<<3);
               }
               else {
                    vol=0;
               }
          }
          else {
               if(dist < 1500L)
                    vol = 0x7fff;
               else if(dist > 8500L)
                    vol = 0x1f00;
               else
                    vol = 39000L-(dist<<2);
          }
          */

          dx = klabs(posx[snum]-dsound[i].x);
          dy = klabs(posy[snum]-dsound[i].y);
          dist = ksqrt(dx*dx+dy*dy) >> 6;

          pan = 2048 + ang[snum] - getangle(posx[snum]-dsound[i].x,posy[snum]-dsound[i].y);
          pan = (pan & 2047) >> 6;

          if( dsound[i].handle != NULL_HANDLE )
               FX_Pan3D(dsound[i].handle,pan,dist);
     }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0xb5337(%rip), %rax     # 0xd1a60
cmpl $0x0, 0xc(%rax)
je 0x1c7e4
testb $0x1, 0x20cb36(%rip)    # 0x229270
je 0x1c7e4
movslq %edi, %r14
movl $0x14, %r15d
leaq 0x20cb30(%rip), %r12    # 0x229280
leaq 0xc7db9(%rip), %r13     # 0xe4510
cmpl $-0x1, -0x14(%r15,%r12)
je 0x1c7d3
testb $-0x7b, (%r15,%r12)
jne 0x1c7d3
leaq 0xc7d63(%rip), %rbp     # 0xe44d0
movl (%rbp,%r14,4), %eax
subl -0x8(%r15,%r12), %eax
movl (%r13,%r14,4), %edi
subl -0x4(%r15,%r12), %edi
imull %eax, %eax
imull %edi, %edi
addl %eax, %edi
callq 0x48a4d
movl %eax, %ebx
movl (%rbp,%r14,4), %edi
subl -0x8(%r15,%r12), %edi
leaq 0xc7d0f(%rip), %rax     # 0xe44b0
movzwl (%rax,%r14,2), %ebp
movl (%r13,%r14,4), %esi
subl -0x4(%r15,%r12), %esi
callq 0x48943
movl -0x14(%r15,%r12), %edi
cmpl $-0x1, %edi
je 0x1c7d3
subl %eax, %ebp
shrl $0x6, %ebp
andl $0x1f, %ebp
sarl $0x6, %ebx
movl %ebp, %esi
movl %ebx, %edx
callq 0x86ef6
addq $0x18, %r15
cmpq $0x194, %r15            # imm = 0x194
jne 0x1c757
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/teksnd.c
// Function: stopallsounds
void
stopallsounds(void)
{
     int       i;

     if( !fxstarted )
          return;

     for( i=0; i< MAXSOUNDS; i++ ) {
          if( dsound[i].handle == NULL_HANDLE )
               continue;
          FX_StopSound(dsound[i].handle);
          sbuf[dsound[i].sndnum].users--;
          if( sbuf[dsound[i].sndnum].users < 0 )
              sbuf[dsound[i].sndnum].users=0;
          if( sbuf[dsound[i].sndnum].users == 0 ) {
               sbuf[dsound[i].sndnum].cache_lock=199;
          }
          dsound[i].handle=NULL_HANDLE;
          dsound[i].plevel=0;
          dsound[i].sndnum=-1;
     }

//clear variables that track looping sounds
     loopinsound=-1;
     baydoorloop=-1;
     ambsubloop=-1;
}

// Assembly:
cmpb $0x1, 0x20ca76(%rip)    # 0x229270
jne 0x1c88e
pushq %r15
pushq %r14
pushq %rbx
xorl %ebx, %ebx
leaq 0x20ca72(%rip), %r14    # 0x229280
leaq 0x20cbeb(%rip), %r15    # 0x229400
movl (%rbx,%r14), %edi
cmpl $-0x1, %edi
je 0x1c85c
callq 0x86f1f
movslq 0x4(%rbx,%r14), %rax
leaq (%rax,%rax,2), %rax
leaq (%r15,%rax,8), %rax
movl (%rax), %edx
leal -0x1(%rdx), %ecx
movl %ecx, (%rax)
testl %edx, %edx
jle 0x1c841
testl %ecx, %ecx
jne 0x1c84b
jmp 0x1c847
movl $0x0, (%rax)
movb $-0x39, 0x14(%rax)
movq $-0x1, (%rbx,%r14)
movl $0x0, 0x8(%rbx,%r14)
addq $0x18, %rbx
cmpq $0x180, %rbx            # imm = 0x180
jne 0x1c815
leaq 0xb6110(%rip), %rax     # 0xd2980
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movl %ecx, (%rax)
leaq 0xb6106(%rip), %rax     # 0xd2984
movl %ecx, (%rax)
leaq 0xb6101(%rip), %rax     # 0xd2988
movl %ecx, (%rax)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/teksnd.c
// Function: menusong
void
menusong(int insubway)
{
     int i,index;

     if( !musicstarted )
          return;

     for( i=0; i<SONGSPERLEVEL; i++ ) {
          removesong(i);
     }

     if(insubway)
          index=(NUMLEVELS*(AVAILMODES*SONGSPERLEVEL)+3);
     else
          index=NUMLEVELS*(AVAILMODES*SONGSPERLEVEL);

     index+=2;

     songoffsets[BASESONG] = songlist[index*3]*4096;
     songlengths[BASESONG] = songlist[(index*3)+1];
     if( songlengths[BASESONG] >= MAXBASESONGLENGTH ) {
          crashgame("prepsongs: basesong exceeded max length");
     }

     playsong(BASESONG);
}

// Assembly:
cmpb $0x1, 0x20c4d1(%rip)    # 0x229274
jne 0x1ce24
pushq %rbp
pushq %rbx
pushq %rax
movl %edi, %ebx
xorl %ebp, %ebp
movl 0xb5a1a(%rip), %eax     # 0xd27cc
cmpl %eax, %ebp
jne 0x1cdca
callq 0x8a8c4
movl $0xffffffff, 0xb5a07(%rip) # imm = 0xFFFFFFFF
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
incl %ebp
cmpl $0x3, %ebp
jne 0x1cdb2
xorl %eax, %eax
testl %ebx, %ebx
setne %al
shll $0x2, %eax
leal (%rax,%rax,8), %eax
leaq 0x21862b(%rip), %rcx    # 0x235410
movl 0x30c(%rax,%rcx), %edx
movl 0x310(%rax,%rcx), %eax
shll $0xc, %edx
movl %edx, 0x20d990(%rip)    # 0x22a78c
movl %eax, 0x20d97e(%rip)    # 0x22a780
cmpl $0xac68, %eax           # imm = 0xAC68
jl 0x1ce17
leaq 0x73327(%rip), %rdi     # 0x90137
xorl %eax, %eax
callq 0x2eb88
xorl %edi, %edi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x1c8c9
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/teksnd.c
// Function: startmusic
void
startmusic(int level)
{
     int       i,index;

     if( !musicstarted ) {
          return;
     }

     if( level > 6 ) {
          return;
     }

     for( i=0; i<SONGSPERLEVEL; i++ ) {
          removesong(i);
     }

     index=totalsongsperlevel*(level);

     index+=SONGSPERLEVEL;    // Skip FM.
     index+=SONGSPERLEVEL;    // Skip AWE32.

     for( i=0; i<SONGSPERLEVEL; i++ ) {
          songoffsets[i]=songlist[(index*3)+(i*3)]*4096;
          songlengths[i]=songlist[((index*3)+(i*3))+1];
          if( songlengths[i] >= MAXBASESONGLENGTH ) {
               crashgame("prepsongs: basesong exceeded max length");
          }
     }

     playsong(BASESONG);
}

// Assembly:
cmpl $0x6, %edi
jg 0x1ceee
testb $0x1, 0x20c43f(%rip)    # 0x229274
je 0x1ceee
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edi, %ebx
xorl %ebp, %ebp
movl 0xb597c(%rip), %eax     # 0xd27cc
cmpl %eax, %ebp
jne 0x1ce68
callq 0x8a8c4
movl $0xffffffff, 0xb5969(%rip) # imm = 0xFFFFFFFF
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
incl %ebp
cmpl $0x3, %ebp
jne 0x1ce50
imull 0x21959a(%rip), %ebx    # 0x236410
leal (%rbx,%rbx,2), %r14d
addl $0x13, %r14d
leaq 0x21858b(%rip), %r15    # 0x235410
leaq 0x20d900(%rip), %r12    # 0x22a78c
leaq 0x20d8ed(%rip), %r13    # 0x22a780
leaq 0x7329d(%rip), %rbx     # 0x90137
xorl %ebp, %ebp
leal -0x1(%r14), %eax
cltq
movl (%r15,%rax,4), %eax
shll $0xc, %eax
movl %eax, (%rbp,%r12)
movslq %r14d, %rax
movl (%r15,%rax,4), %eax
movl %eax, (%rbp,%r13)
cmpl $0xac68, %eax           # imm = 0xAC68
jl 0x1cecb
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2eb88
addq $0x4, %rbp
addl $0x3, %r14d
cmpq $0xc, %rbp
jne 0x1ce9c
xorl %edi, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1c8c9
retq
nop
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/tekspr.c
// Function: floatmovesprite
short
floatmovesprite(short spritenum, int dx, int dy, int dz, int ceildist, int flordist, char cliptype)
{
     int daz, zoffs;
     short retval, dasectnum;
     unsigned int dcliptype;
     spritetype *spr;

     (void)dz;

    #ifdef PLRSPRDEBUG
     if( isaplayersprite(spritenum) ) {
          crashgame("messing w plrsprite at 18");
     }
    #endif

     switch (cliptype) {
          case NORMALCLIP: dcliptype = CLIPMASK0; break;
          case PROJECTILECLIP: dcliptype = CLIPMASK1; break;
          case CLIFFCLIP: dcliptype = CLIPMASK0; break;
     }

     spr = &sprite[spritenum];

     if ((spr->cstat&128) == 0)
          zoffs = -((tilesizy[spr->picnum]*spr->yrepeat)<<1);
     else
          zoffs = 0;

     dasectnum = spr->sectnum;  //Can't modify sprite sectors directly becuase of linked lists
     daz = spr->z+zoffs;  //Must do this if not using the new centered centering (of course)
     retval = clipmove(&spr->x,&spr->y,&daz,&dasectnum,dx,dy,
                                   ((int)spr->clipdist)<<2,ceildist,flordist,dcliptype);

     if ((dasectnum != spr->sectnum) && (dasectnum >= 0))
          changespritesect(spritenum,dasectnum);

     return(retval);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %r9d, %r10d
movl %r8d, %eax
movl %edx, %r9d
movl %esi, %r8d
cmpb $0x1, 0x40(%rsp)
movl $0x1000040, %ecx        # imm = 0x1000040
movl $0x10001, %r11d         # imm = 0x10001
cmovel %ecx, %r11d
movl %edi, %ebx
movslq %edi, %rcx
imulq $0x2c, %rcx, %rdx
leaq 0x410a8b(%rip), %rsi    # 0x42db30
leaq (%rsi,%rdx), %r14
xorl %ecx, %ecx
testb $-0x80, 0xc(%rsi,%rdx)
jne 0x1d0ce
movswq 0xe(%r14), %rcx
leaq 0x5955a2(%rip), %rdx    # 0x5b2660
movswl (%rdx,%rcx,2), %edx
movzbl 0x15(%r14), %ecx
imull %edx, %ecx
addl %ecx, %ecx
negl %ecx
movzwl 0x18(%r14), %edx
leaq 0xa(%rsp), %r15
movw %dx, (%r15)
addl 0x8(%r14), %ecx
leaq 0xc(%rsp), %rdx
movl %ecx, (%rdx)
leaq 0x4(%r14), %rsi
movzbl 0x12(%r14), %r12d
shll $0x2, %r12d
movq %r14, %rdi
movq %r15, %rcx
pushq %r11
pushq %r10
pushq %rax
pushq %r12
callq 0x4acdd
addq $0x20, %rsp
movl %eax, %ebp
movzwl (%r15), %eax
testw %ax, %ax
js 0x1d127
cmpw 0x18(%r14), %ax
je 0x1d127
movswl %bx, %edi
movswl %ax, %esi
callq 0x48b21
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/tekspr.c
// Function: flymovesprite
short
flymovesprite(short spritenum, int dx, int dy, int dz, int ceildist, int flordist, char cliptype)
{
     int           daz;
     short          retval, dasectnum, tempshort;
    unsigned int dcliptype;
     spritetype *spr;

     (void)dz;

    #ifdef PLRSPRDEBUG
     if( isaplayersprite(spritenum) ) {
          crashgame("messing w plrsprite at 20");
     }
    #endif

     switch (cliptype) {
          case NORMALCLIP: dcliptype = CLIPMASK0; break;
          case PROJECTILECLIP: dcliptype = CLIPMASK1; break;
          case CLIFFCLIP: dcliptype = CLIPMASK0; break;
     }

     spr = &sprite[spritenum];

     dasectnum = spr->sectnum;
     retval = clipmove(&spr->x,&spr->y,&spr->z,&dasectnum,dx,dy,
                                   ((int)spr->clipdist)<<2,ceildist,flordist,dcliptype);

     if ((dasectnum != spr->sectnum) && (dasectnum >= 0))
          changespritesect(spritenum,dasectnum);

     if( spr->statnum != PINBALL ) {
          tempshort = spr->cstat; spr->cstat &= ~1;
          getzrange(spr->x,spr->y,spr->z-1,spr->sectnum,
                          &globhiz,&globhihit,&globloz,&globlohit,
                          ((int)spr->clipdist)<<2,dcliptype);
          spr->cstat = tempshort;
          daz=(globloz+globhiz);
          spr->z=(daz>>1);
     }

     return(retval);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r9d, %r10d
movl %r8d, %eax
movl %edx, %r9d
movl %esi, %r8d
cmpb $0x1, 0x40(%rsp)
movl $0x1000040, %ecx        # imm = 0x1000040
movl $0x10001, %r12d         # imm = 0x10001
cmovel %ecx, %r12d
movl %edi, %r14d
movslq %edi, %rcx
imulq $0x2c, %rcx, %r13
leaq 0x41078e(%rip), %rbp    # 0x42db30
movq %rbp, %rbx
addq %r13, %rbx
leaq 0x4(%rbp,%r13), %rsi
movzwl 0x14(%rsi), %ecx
leaq 0x6(%rsp), %r15
movw %cx, (%r15)
leaq 0x8(,%r13), %rdx
addq %rbp, %rdx
movzbl 0xa(%rdx), %r11d
shll $0x2, %r11d
movq %rbx, %rdi
movq %r15, %rcx
pushq %r12
pushq %r10
pushq %rax
pushq %r11
callq 0x4acdd
addq $0x20, %rsp
movzwl (%r15), %ecx
testw %cx, %cx
js 0x1d405
cmpw 0x18(%rbp,%r13), %cx
je 0x1d405
movswl %r14w, %edi
movswl %cx, %esi
movl %eax, %ebp
callq 0x48b21
movl %ebp, %eax
cmpw $0x193, 0x1a(%rbx)      # imm = 0x193
je 0x1d475
movzwl 0xc(%rbx), %r15d
movl %r15d, %ecx
andl $-0x2, %ecx
movw %cx, 0xc(%rbx)
movl (%rbx), %edi
movl 0x4(%rbx), %esi
movl 0x8(%rbx), %edx
decl %edx
movl %eax, %ebp
movswl 0x18(%rbx), %ecx
movzbl 0x12(%rbx), %eax
shll $0x2, %eax
leaq 0xc8342(%rip), %r10     # 0xe577c
leaq 0xc8337(%rip), %r13     # 0xe5778
leaq 0xc8328(%rip), %r14     # 0xe5770
leaq 0xc8325(%rip), %r9      # 0xe5774
movq %r14, %r8
pushq %r12
pushq %rax
pushq %r10
pushq %r13
callq 0x4d1fe
movl %ebp, %eax
addq $0x20, %rsp
movw %r15w, 0xc(%rbx)
movl (%r14), %ecx
addl (%r13), %ecx
sarl %ecx
movl %ecx, 0x8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/tekspr.c
// Function: dropit
void
dropit(int x, int y, int z, short sect, int pic)
{
     int       j,ang;

     j=jsinsertsprite(sect, DROPSIES);
     if( j != -1 ) {
          ang=dropangles[dropanglecnt];
          fillsprite(j,x,y,z,0,
                     0,0,12,
                     16,16,0,0,pic,ang,
                     sintable[(ang+2560)&2047]>>6,sintable[(ang+2048)&2047]>>6,
                     30L,0,sect,DROPSIES,0,0,0);
     }
     dropanglecnt++;
     if( dropanglecnt >= MAXDROPANGLES ) {
          dropanglecnt=0;
     }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %r8d, %ebx
movl %edx, %ebp
movl %esi, %r14d
movl %edi, %r15d
movl %ecx, %edi
movl $0x196, %esi            # imm = 0x196
callq 0x1eac8
cmpw $-0x1, %ax
je 0x1e7d1
movzbl 0x217cf8(%rip), %ecx    # 0x236414
leaq 0xb40b5(%rip), %rdx     # 0xd27d8
movzwl (%rdx,%rcx,2), %esi
movswq %ax, %rax
imulq $0x2c, %rax, %rcx
leaq 0x40f3fa(%rip), %rdx    # 0x42db30
leaq (%rdx,%rcx), %rdi
movl %r15d, (%rdx,%rcx)
movl %r14d, 0x4(%rdx,%rcx)
movl %ebp, 0x8(%rdx,%rcx)
xorl %r8d, %r8d
movw %r8w, 0xc(%rdx,%rcx)
movw %r8w, 0x10(%rdx,%rcx)
movb $0xc, 0x12(%rdx,%rcx)
movl $0x1010, 0x14(%rdx,%rcx) # imm = 0x1010
movw %bx, 0xe(%rdx,%rcx)
movw %si, 0x1c(%rdx,%rcx)
leal 0x200(%rsi), %r9d
movl $0x7ff, %r10d           # imm = 0x7FF
andl %r10d, %r9d
leaq 0x56144c(%rip), %r11    # 0x57fbd0
movswl (%r11,%r9,2), %r9d
shrl $0x6, %r9d
movw %r9w, 0x20(%rdx,%rcx)
andl %r10d, %esi
movswl (%r11,%rsi,2), %esi
shrl $0x6, %esi
movw %si, 0x22(%rdx,%rcx)
movw %r8w, 0x1e(%rdx,%rcx)
movabsq $-0xffffffffffe2, %rsi  # imm = 0xFFFF00000000001E
movq %rsi, 0x24(%rdx,%rcx)
leaq (%rax,%rax,2), %rsi
shlq $0x2, %rsi
addq 0xb27e9(%rip), %rsi     # 0xd0fb0
movl $0x3, %edx
callq 0x6110e
movb 0x217c3d(%rip), %al     # 0x236414
incb %al
xorl %ecx, %ecx
cmpb $0x6, %al
movzbl %al, %eax
cmovael %ecx, %eax
movb %al, 0x217c2b(%rip)     # 0x236414
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/tekstat.c
// Function: jsdeletesprite
short
jsdeletesprite(short spritenum)
{
     int       ext;

     ext=sprptr[spritenum]->extra;

     if( validext(ext) ) {
          memset(sprXTptr[ext], 0, sizeof(struct spriteextension));
          sprXTptr[ext]->lock=0x00;
     }

     deletesprite(spritenum);
     sprite[spritenum].extra=-1;

     return(0);
}

// Assembly:
pushq %rbx
movslq %edi, %rbx
leaq 0x11270c(%rip), %rax    # 0x131230
movq (%rax,%rbx,8), %rax
movzwl 0x2a(%rax), %eax
cmpq $0x3fff, %rax           # imm = 0x3FFF
ja 0x1eb57
leaq 0x1ba6f5(%rip), %rcx    # 0x1d9230
movq (%rcx,%rax,8), %rdx
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rdx)
movups %xmm0, (%rdx)
movw $0x0, 0x20(%rdx)
movq (%rcx,%rax,8), %rax
movb $0x0, 0x1e(%rax)
movswl %di, %edi
callq 0x48e5b
imulq $0x2c, %rbx, %rax
leaq 0x40efc6(%rip), %rcx    # 0x42db30
movw $0xffff, 0x2a(%rcx,%rax) # imm = 0xFFFF
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/tekstat.c
// Function: isaplayersprite
int
isaplayersprite(int sprnum)
{
     int       j;

     for( j=connecthead ; j >= 0 ; j=connectpoint2[j] ) {
          if( playersprite[j] == sprnum ) {
               return(1);
          }
     }
     if( sprptr[sprnum]->statnum == 8 ) {
          crashgame("isplrspr: non plr has statnm 8");
     }
     return(0);
}

// Assembly:
pushq %rbx
leaq 0x786fa7(%rip), %rax    # 0x7a5b30
movl (%rax), %edx
testl %edx, %edx
js 0x1ebae
leaq 0xc6bba(%rip), %rax     # 0xe5750
leaq 0x786fa3(%rip), %rcx    # 0x7a5b40
movl %edx, %edx
movswl (%rax,%rdx,2), %esi
cmpl %edi, %esi
je 0x1ebd7
movl (%rcx,%rdx,4), %edx
testl %edx, %edx
jns 0x1eb9d
movslq %edi, %rax
leaq 0x112678(%rip), %rcx    # 0x131230
movq (%rcx,%rax,8), %rax
xorl %ebx, %ebx
cmpw $0x8, 0x1a(%rax)
jne 0x1ebdc
leaq 0x718d0(%rip), %rdi     # 0x9049c
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x2eb88
jmp 0x1ebdc
movl $0x1, %ebx
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/tekstat.c
// Function: clearXTpics
void
clearXTpics(short spriteno)
{
     short     extno=sprptr[spriteno]->extra;

    #ifdef PLRSPRDEBUG
     if( isaplayersprite(spriteno) ) {
          crashgame("messing w plrsprite at 2");
     }
    #endif

     if( extno != -1 ) {
          sprXTptr[extno]->basepic=sprptr[spriteno]->picnum;
          sprXTptr[extno]->standpic=NO_PIC;
          sprXTptr[extno]->walkpic=NO_PIC;
          sprXTptr[extno]->runpic=NO_PIC;
          sprXTptr[extno]->attackpic=NO_PIC;
          sprXTptr[extno]->deathpic=NO_PIC;
          sprXTptr[extno]->painpic=NO_PIC;
          sprXTptr[extno]->squatpic=NO_PIC;
          sprXTptr[extno]->morphpic=NO_PIC;
          sprXTptr[extno]->specialpic=NO_PIC;
     }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movslq %edi, %rbx
leaq 0x112641(%rip), %r15    # 0x131230
movq (%r15,%rbx,8), %rax
movswq 0x2a(%rax), %r14
movl %ebx, %edi
callq 0x1eb81
testl %eax, %eax
je 0x1ec11
leaq 0x718b1(%rip), %rdi     # 0x904bb
xorl %eax, %eax
callq 0x2eb88
cmpw $-0x1, %r14w
je 0x1ec79
movq (%r15,%rbx,8), %rax
movzwl 0xe(%rax), %eax
leaq 0x1ba609(%rip), %rcx    # 0x1d9230
movq (%rcx,%r14,8), %rdx
movw %ax, 0xa(%rdx)
movq (%rcx,%r14,8), %rax
xorl %edx, %edx
movw %dx, 0xc(%rax)
movq (%rcx,%r14,8), %rax
movw %dx, 0xe(%rax)
movq (%rcx,%r14,8), %rax
movw %dx, 0x10(%rax)
movq (%rcx,%r14,8), %rax
movw %dx, 0x12(%rax)
movq (%rcx,%r14,8), %rax
movw %dx, 0x14(%rax)
movq (%rcx,%r14,8), %rax
movw %dx, 0x16(%rax)
movq (%rcx,%r14,8), %rax
movw %dx, 0x18(%rax)
movq (%rcx,%r14,8), %rax
movw %dx, 0x1a(%rax)
movq (%rcx,%r14,8), %rax
movw %dx, 0x1c(%rax)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/tekstat.c
// Function: mapXT
int
mapXT(int sn)
{
     short    i;

    #ifdef PLRSPRDEBUG
     if( isaplayersprite(sn) ) {
          crashgame("messing w plrsprite at 0");
     }
    #endif

     for ( i=0; i<MAXSPRITES; i++ ) {
          if( sprXTptr[i]->lock == 0x00 ) {
               sprptr[sn]->extra=i;
               memset(sprXTptr[i], 0, sizeof(struct spriteextension));
               sprXTptr[i]->lock=0xFF;
               return(i);
          }
     }

     sprptr[sn]->extra=-1;
     return(-1);   // no free spot found
}

// Assembly:
pushq %rbx
movl %edi, %ebx
callq 0x1eb81
testl %eax, %eax
je 0x1ec99
leaq 0x71842(%rip), %rdi     # 0x904d4
xorl %eax, %eax
callq 0x2eb88
xorl %eax, %eax
leaq 0x1ba58e(%rip), %rcx    # 0x1d9230
movq (%rcx,%rax,8), %rdx
cmpb $0x0, 0x1e(%rdx)
je 0x1ecd2
incq %rax
cmpq $0x4000, %rax           # imm = 0x4000
jne 0x1eca2
movslq %ebx, %rax
leaq 0x11256f(%rip), %rcx    # 0x131230
movq (%rcx,%rax,8), %rax
movw $0xffff, 0x2a(%rax)     # imm = 0xFFFF
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x1ed00
movslq %ebx, %rdx
leaq 0x112554(%rip), %rsi    # 0x131230
movq (%rsi,%rdx,8), %rdx
movw %ax, 0x2a(%rdx)
movq (%rcx,%rax,8), %rdx
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rdx)
movups %xmm0, (%rdx)
movw $0x0, 0x20(%rdx)
movq (%rcx,%rax,8), %rcx
movb $-0x1, 0x1e(%rcx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/tekstat.c
// Function: verifystatus
void
verifystatus(int i, int stat)
{
     if( i == -1 ) {
          return;
     }
     if( sprptr[i]->statnum != stat ) {
          if( nextspritestat[i] != -1 ) {
               crashgame("verifystatus fail for %d", stat);
          }
          vbad++;
     }
}

// Assembly:
cmpl $-0x1, %edi
je 0x1ed69
movslq %edi, %rax
leaq 0x1124fa(%rip), %rcx    # 0x131230
movq (%rcx,%rax,8), %rcx
movswl 0x1a(%rcx), %ecx
cmpl %esi, %ecx
je 0x1ed69
leaq 0x558e67(%rip), %rcx    # 0x577bb0
cmpw $-0x1, (%rcx,%rax,2)
je 0x1ed63
pushq %rax
leaq 0x717bb(%rip), %rdi     # 0x90513
xorl %eax, %eax
callq 0x2eb88
addq $0x8, %rsp
incb 0x2176bc(%rip)          # 0x236425
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/tekstat.c
// Function: isvisible
int
isvisible(short i, short target)
{

     if( !validplayer(target) ) {
          crashgame("isvisible: bad targetnum");
     }

	if( sintable[(sprptr[i]->ang+2560)&2047]*(posx[target]-sprptr[i]->x) + sintable[(sprptr[i]->ang+2048)&2047]*(posy[target]-sprptr[i]->y) >= 0) {
	     if( cansee(posx[target],posy[target],(posz[target])>>1,cursectnum[target],
                     sprptr[i]->x,sprptr[i]->y,sprptr[i]->z-(tilesizy[sprptr[i]->picnum]<<7),sprptr[i]->sectnum) == 1) {
          return(1);
          }
     }

     return(0);
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %ebx
movl %edi, %ebp
movl %esi, %edi
callq 0xf230
testl %eax, %eax
jne 0x1f394
leaq 0x711ac(%rip), %rdi     # 0x90539
xorl %eax, %eax
callq 0x2eb88
movswq %bp, %rax
leaq 0x111e91(%rip), %rcx    # 0x131230
movq (%rcx,%rax,8), %rax
movzwl 0x1c(%rax), %edx
leal 0x200(%rdx), %ecx
movl $0x7ff, %esi            # imm = 0x7FF
andl %esi, %ecx
leaq 0x560815(%rip), %r10    # 0x57fbd0
movswl (%r10,%rcx,2), %r11d
movswq %bx, %rcx
leaq 0xc5105(%rip), %rdi     # 0xe44d0
movl (%rdi,%rcx,4), %edi
movl (%rax), %r8d
movl 0x4(%rax), %r9d
movl %edi, %ebx
subl %r8d, %ebx
imull %r11d, %ebx
andl %esi, %edx
movswl (%r10,%rdx,2), %edx
leaq 0xc5124(%rip), %rsi     # 0xe4510
movl (%rsi,%rcx,4), %esi
movl %esi, %r10d
subl %r9d, %r10d
imull %edx, %r10d
addl %ebx, %r10d
js 0x1f44e
leaq 0xc514b(%rip), %rdx     # 0xe4550
movl (%rdx,%rcx,4), %edx
sarl %edx
leaq 0xc630f(%rip), %r10     # 0xe5720
movswl (%r10,%rcx,2), %ecx
movl 0x8(%rax), %r10d
movswq 0xe(%rax), %r11
leaq 0x59323a(%rip), %rbx    # 0x5b2660
movswl (%rbx,%r11,2), %r11d
shll $0x7, %r11d
subl %r11d, %r10d
movswl 0x18(%rax), %eax
pushq %rax
pushq %r10
callq 0x4909b
addq $0x10, %rsp
movl %eax, %ecx
movl $0x1, %eax
cmpl $0x1, %ecx
je 0x1f450
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/tekstat.c
// Function: getpicinfo
void
getpicinfo(short picnum)
{
     int      amask=picanm[picnum];

     picinfoptr->numframes=amask&0x0000003F;
     picinfoptr->animtype =( amask&0x000000C0 )>>6;
     picinfoptr->xcenteroffset=( amask&0x0000FF00 )>>8;
     picinfoptr->ycenteroffset=( amask&0x00FF0000 )>>16;
     picinfoptr->animspeed=( amask&0x0F000000 )>>24;
}

// Assembly:
movslq %edi, %rax
leaq 0x3cc47f(%rip), %rcx    # 0x3eb8e0
movl (%rcx,%rax,4), %eax
movl %eax, %ecx
andb $0x3f, %cl
movq 0xb3380(%rip), %rdx     # 0xd27f0
movb %cl, (%rdx)
movl %eax, %ecx
shrb $0x6, %cl
movq 0xb3372(%rip), %rdx     # 0xd27f0
movb %cl, 0x1(%rdx)
movq 0xb3368(%rip), %rcx     # 0xd27f0
movb %ah, 0x3(%rcx)
movl %eax, %ecx
shrl $0x10, %ecx
movq 0xb3359(%rip), %rdx     # 0xd27f0
movb %cl, 0x2(%rdx)
shrl $0x18, %eax
andb $0xf, %al
movq 0xb334a(%rip), %rcx     # 0xd27f0
movb %al, 0x4(%rcx)
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/tekstat.c
// Function: wallangle
short
wallangle(int wn)
{
     int      w1x,w1y, w2x,w2y;
     short     wang;

     w1x=wallptr[wn]->x; w1y=wallptr[wn]->y;
     wn=wallptr[wn]->point2;
     w2x=wallptr[wn]->x; w2y=wallptr[wn]->y;
     wang=getangle(w2x-w1x, w2y-w1y);

 return(wang);
}

// Assembly:
pushq %rax
movslq %edi, %rax
leaq 0x1e1d7b(%rip), %rcx    # 0x201230
movq (%rcx,%rax,8), %rax
movswq 0x8(%rax), %rdx
movq (%rcx,%rdx,8), %rcx
movl (%rcx), %edi
movl 0x4(%rcx), %esi
subl (%rax), %edi
subl 0x4(%rax), %esi
callq 0x48943
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/tekstat.c
// Function: wallnormal
short
wallnormal(int wn)
{
     int      w1x,w1y, w2x,w2y;
     short     wnorm;

     w1x=wallptr[wn]->x; w1y=wallptr[wn]->y;
     wn=wallptr[wn]->point2;
     w2x=wallptr[wn]->x; w2y=wallptr[wn]->y;
     wnorm=getangle(w2x-w1x, w2y-w1y);
     wnorm=(wnorm+512L)&2047;

 return(wnorm);
}

// Assembly:
pushq %rax
movslq %edi, %rax
leaq 0x1e1d11(%rip), %rcx    # 0x201230
movq (%rcx,%rax,8), %rax
movswq 0x8(%rax), %rdx
movq (%rcx,%rdx,8), %rcx
movl (%rcx), %edi
movl 0x4(%rcx), %esi
subl (%rax), %edi
subl 0x4(%rax), %esi
callq 0x48943
addl $0x200, %eax            # imm = 0x200
andl $0x7ff, %eax            # imm = 0x7FF
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/tekstat.c
// Function: spritedeflect
short
spritedeflect(int sn, short angin)
{
     short     angout;

     switch ( sprptr[sn]->statnum ) {
     case INANIMATE:
     case INACTIVE:
     case AMBUSH:
          angout=(angin+1024)&2047;
          switch( (int)RMOD2("STAT697 ") ) {
          case 0:
               angout=leftof[angout];
               break;
          case 1:
          default:
               angout=rightof[angout];
               break;
          }
          break;
     default:
          angout=sprptr[sn]->ang;
          break;
     }

 return(angout);
}

// Assembly:
pushq %rbx
movl %esi, %ebx
movslq %edi, %rax
leaq 0x111cb3(%rip), %rcx    # 0x131230
movq (%rcx,%rax,8), %rax
movzwl 0x1a(%rax), %ecx
testl %ecx, %ecx
je 0x1f596
cmpl $0xca, %ecx
je 0x1f596
cmpl $0x64, %ecx
jne 0x1f5cb
andl $0x7ff, %ebx            # imm = 0x7FF
xorl $0x400, %ebx            # imm = 0x400
leaq 0x70fc4(%rip), %rdi     # 0x9056d
callq 0x2d112
cmpl $0x8000, %eax           # imm = 0x8000
jg 0x1f5be
leaq 0xb32c4(%rip), %rax     # 0xd2880
jmp 0x1f5c5
leaq 0xb32eb(%rip), %rax     # 0xd28b0
leaq (%rax,%rbx,2), %rax
jmp 0x1f5cf
addq $0x1c, %rax
movzwl (%rax), %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/tekstat.c
// Function: tweakdeathdist
void
tweakdeathdist(short i)
{
	int      dax,day;

    #ifdef PLRSPRDEBUG
     if( isaplayersprite(i) ) {
          crashgame("messing w plrsprite at 1");
     }
    #endif

     sprptr[i]->clipdist<<=1;
     dax=( ((sintable[(sprptr[i]->ang+512)&2047])*sprptr[i]->xvel) <<3 );
	day=( ((sintable[sprptr[i]->ang])*sprptr[i]->yvel) <<3 );
	movesprite(( short)i,dax,day,0L,1024,1024,CLIFFCLIP);

     if( sprptr[i]->extra == -1 ) {
          sprptr[i]->lotag=SPR_LOTAG_PICKUP;
     }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %ebx
callq 0x1eb81
testl %eax, %eax
je 0x1f5f1
leaq 0x70f8c(%rip), %rdi     # 0x90576
xorl %eax, %eax
callq 0x2eb88
movswq %bx, %rbx
leaq 0x111c34(%rip), %r14    # 0x131230
movq (%r14,%rbx,8), %rax
shlb 0x12(%rax)
movq (%r14,%rbx,8), %rax
movswq 0x1c(%rax), %rcx
leal 0x200(%rcx), %edx
andl $0x7ff, %edx            # imm = 0x7FF
leaq 0x5605b1(%rip), %rdi    # 0x57fbd0
movswl (%rdi,%rdx,2), %edx
movswl 0x20(%rax), %esi
imull %edx, %esi
shll $0x3, %esi
movswl (%rdi,%rcx,2), %ecx
movswl 0x22(%rax), %edx
imull %ecx, %edx
shll $0x3, %edx
movl $0x2, (%rsp)
movswl %bx, %edi
xorl %ecx, %ecx
movl $0x400, %r8d            # imm = 0x400
movl $0x400, %r9d            # imm = 0x400
callq 0x1d136
movq (%r14,%rbx,8), %rax
cmpw $-0x1, 0x2a(%rax)
jne 0x1f669
movw $0x7d4, 0x26(%rax)      # imm = 0x7D4
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/jonof[P]jftekwar/src/tekstat.c
// Function: pickupsprite
int
pickupsprite(short sn)
{
    #ifdef PLRSPRDEBUG
     if( isaplayersprite(sn) ) {
          crashgame("messing w plrsprite at 4");
     }
    #endif

     // can only carry one at a time of these items
     if( (pickup.picnum != 0) || (option[4] != 0) ) {
          return(0);
     }

     pickup.picnum=sprptr[sn]->picnum;
     pickup.cstat=sprptr[sn]->cstat;
     pickup.shade=sprptr[sn]->shade;
     pickup.pal=sprptr[sn]->pal;
     pickup.clipdist=sprptr[sn]->clipdist;
     pickup.xrepeat=sprptr[sn]->xrepeat;
     pickup.yrepeat=sprptr[sn]->yrepeat;
	pickup.xoffset=sprptr[sn]->xoffset;
	pickup.yoffset=sprptr[sn]->yoffset;
     // cant set lotag/hitag as TOSS needs to use them
     pickup.extra=sprptr[sn]->extra;

     jsdeletesprite(sn);

     pickupclock=lockclock;
     return(1);
}

// Assembly:
pushq %rbx
movl %edi, %ebx
callq 0x1eb81
testl %eax, %eax
je 0x1f826
leaq 0x70d89(%rip), %rdi     # 0x905a8
xorl %eax, %eax
callq 0x2eb88
xorl %eax, %eax
cmpw $0x0, 0x2a0c3e(%rip)    # 0x2c046e
jne 0x1f8af
leaq 0xb213f(%rip), %rcx     # 0xd1978
cmpb $0x0, 0x4(%rcx)
jne 0x1f8af
movswq %bx, %rax
leaq 0x1119e6(%rip), %rcx    # 0x131230
movq (%rcx,%rax,8), %rcx
movzwl 0xe(%rcx), %edx
movw %dx, 0x2a0c15(%rip)     # 0x2c046e
movzwl 0xc(%rcx), %edx
movw %dx, 0x2a0c08(%rip)     # 0x2c046c
movb 0x10(%rcx), %dl
movb %dl, 0x2a0c03(%rip)     # 0x2c0470
movb 0x11(%rcx), %dl
movb %dl, 0x2a0bfb(%rip)     # 0x2c0471
movb 0x12(%rcx), %dl
movb %dl, 0x2a0bf3(%rip)     # 0x2c0472
movl 0x14(%rcx), %edx
movl %edx, 0x2a0bec(%rip)    # 0x2c0474
movzwl 0x2a(%rcx), %ecx
movw %cx, 0x2a0bf7(%rip)     # 0x2c048a
movswl %ax, %edi
callq 0x1eb19
leaq 0xc4be6(%rip), %rax     # 0xe4488
movl (%rax), %eax
movl %eax, 0x2a0c2e(%rip)    # 0x2c04d8
movl $0x1, %eax
popq %rbx
retq