// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/src/tekgun.c
// Function: tekdrawgun
void
tekdrawgun(int gun,short p)
{
     int  pic,x,apic;

     if (fireseq[p] == 0) {
          pic=guntype[gun].pic;
          return;
     }
     apic=AIMPIC;
     if( difficulty <= 1 )
          apic=BIGAIMPIC;
     if( (toggles[TOGGLE_RETICULE]) && (dimensionmode[myconnectindex] == 3) ) {
          overwritesprite(windowx1+((windowx2-windowx1)>>1),
                          windowy1+((windowy2-windowy1)>>1),apic,16,0x01,0);
     }
     gun=lastgun[p];
     if( firedonetics[p] > 0 ) {
          pic=guntype[gun].firepic;
     }
     else {
          pic=guntype[gun].pic+fireseq[p]-1;
     }
     x=160L;

     if( pic == 3981 ) {
          if( syncsvel[p] < 0 ) {
               overwritesprite(x,100L,3990,sectptr[cursectnum[p]]->floorshade,1|2,0);
               return;
          }
          else if( syncsvel[p] > 0 ) {
               overwritesprite(x,100L,3986,sectptr[cursectnum[p]]->floorshade,1|2,0);
               return;
          }
          else if( syncangvel[p] < 0 ) {
               overwritesprite(x,100L,3985,sectptr[cursectnum[p]]->floorshade,1|2,0);
               return;
          }
          else if( syncangvel[p] > 0 ) {
               overwritesprite(x,100L,3989,sectptr[cursectnum[p]]->floorshade,1|2,0);
               return;
          }
          else if( (syncbits[p]&1) != 0 ) {
               overwritesprite(x,100L,3994+((syncbits[p]&256)==0),sectptr[cursectnum[p]]->floorshade,1|2,0);
               return;
          }
          else if( (syncbits[p]&2) != 0 ) {
               overwritesprite(x,100L,3998+((syncbits[p]&256)==0),sectptr[cursectnum[p]]->floorshade,1|2,0);
               return;
          }
     }

     if( (syncvel[p]|syncsvel[p]) != 0 ) {
          switch( pic ) {
          case GUN01FIRESTART:
          case GUN02FIRESTART:
          case GUN03FIRESTART:
          case GUN04FIRESTART:
          case GUN05FIRESTART:
          case GUN06FIRESTART:
          case GUN07FIRESTART:
          case GUN08FIRESTART:
               bobtics+=( 1 + (((syncbits[p]&256)>0)<<2) );
               if( bobtics > TICSPERFRAME ) {
                    bobtics=0;
                    gunbob++;
                    if( gunbob > 9 )
                         gunbob=0;
               }
               break;
          default:
               gunbob=0;
               break;
          }
     }
     overwritesprite(x+gunbobx[gunbob],100L+gunboby[gunbob],pic,sectptr[cursectnum[p]]->floorshade,1|2,0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movw %si, %ax
movl %edi, -0x4(%rbp)
movw %ax, -0x6(%rbp)
movswq -0x6(%rbp), %rcx
leaq 0x1626e2(%rip), %rax    # 0x1782a0
cmpl $0x0, (%rax,%rcx,4)
jne 0x15be1
movslq -0x4(%rbp), %rcx
leaq 0x104621(%rip), %rax    # 0x11a1f0
imulq $0x12, %rcx, %rcx
addq %rcx, %rax
movswl (%rax), %eax
movl %eax, -0xc(%rbp)
jmp 0x160b9
movl $0x14d, -0x14(%rbp)     # imm = 0x14D
leaq 0x1643d9(%rip), %rax    # 0x179fc8
cmpl $0x1, (%rax)
jg 0x15bfb
movl $0x14e, -0x14(%rbp)     # imm = 0x14E
leaq 0x1043fe(%rip), %rax    # 0x11a000
cmpl $0x0, (%rax)
je 0x15c78
leaq 0x78f336(%rip), %rax    # 0x7a4f44
movslq (%rax), %rcx
leaq 0x118c68(%rip), %rax    # 0x12e880
movsbl (%rax,%rcx), %eax
cmpl $0x3, %eax
jne 0x15c78
leaq 0x5b57f8(%rip), %rax    # 0x5cb420
movl (%rax), %edi
leaq 0x5ea3df(%rip), %rax    # 0x600010
movl (%rax), %eax
leaq 0x5b57e6(%rip), %rcx    # 0x5cb420
subl (%rcx), %eax
sarl %eax
addl %eax, %edi
leaq 0x5b6e69(%rip), %rax    # 0x5ccab0
movl (%rax), %esi
leaq 0x5ea3c4(%rip), %rax    # 0x600014
movl (%rax), %eax
leaq 0x5b6e57(%rip), %rcx    # 0x5ccab0
subl (%rcx), %eax
sarl %eax
addl %eax, %esi
movl -0x14(%rbp), %eax
movl $0x10, %ecx
movl $0x1, %r8d
xorl %r9d, %r9d
movswl %ax, %edx
callq 0x9460
movswq -0x6(%rbp), %rcx
leaq 0x1626ec(%rip), %rax    # 0x178370
movl (%rax,%rcx,4), %eax
movl %eax, -0x4(%rbp)
movswq -0x6(%rbp), %rcx
leaq 0x16271a(%rip), %rax    # 0x1783b0
cmpl $0x0, (%rax,%rcx,4)
jle 0x15cb7
movslq -0x4(%rbp), %rcx
leaq 0x104549(%rip), %rax    # 0x11a1f0
imulq $0x12, %rcx, %rcx
addq %rcx, %rax
movswl 0x2(%rax), %eax
movl %eax, -0xc(%rbp)
jmp 0x15ce1
movslq -0x4(%rbp), %rcx
leaq 0x10452e(%rip), %rax    # 0x11a1f0
imulq $0x12, %rcx, %rcx
addq %rcx, %rax
movswl (%rax), %eax
movswq -0x6(%rbp), %rdx
leaq 0x1625c8(%rip), %rcx    # 0x1782a0
addl (%rcx,%rdx,4), %eax
subl $0x1, %eax
movl %eax, -0xc(%rbp)
movl $0xa0, -0x10(%rbp)
cmpl $0xf8d, -0xc(%rbp)      # imm = 0xF8D
jne 0x15f51
movswq -0x6(%rbp), %rcx
leaq 0x11883f(%rip), %rax    # 0x12e540
movswl (%rax,%rcx,2), %eax
cmpl $0x0, %eax
jge 0x15d4a
movl -0x10(%rbp), %edi
movswq -0x6(%rbp), %rcx
leaq 0x1189c7(%rip), %rax    # 0x12e6e0
movswq (%rax,%rcx,2), %rcx
leaq 0x22c4bb(%rip), %rax    # 0x2421e0
movq (%rax,%rcx,8), %rax
movl $0x64, %esi
movl $0xf96, %edx            # imm = 0xF96
movl $0x3, %r8d
xorl %r9d, %r9d
movsbl 0x1c(%rax), %ecx
callq 0x9460
jmp 0x160b9
movswq -0x6(%rbp), %rcx
leaq 0x1187ea(%rip), %rax    # 0x12e540
movswl (%rax,%rcx,2), %eax
cmpl $0x0, %eax
jle 0x15d9f
movl -0x10(%rbp), %edi
movswq -0x6(%rbp), %rcx
leaq 0x118972(%rip), %rax    # 0x12e6e0
movswq (%rax,%rcx,2), %rcx
leaq 0x22c466(%rip), %rax    # 0x2421e0
movq (%rax,%rcx,8), %rax
movl $0x64, %esi
movl $0xf92, %edx            # imm = 0xF92
movl $0x3, %r8d
xorl %r9d, %r9d
movsbl 0x1c(%rax), %ecx
callq 0x9460
jmp 0x160b9
movswq -0x6(%rbp), %rcx
leaq 0x1187f5(%rip), %rax    # 0x12e5a0
movswl (%rax,%rcx,2), %eax
cmpl $0x0, %eax
jge 0x15df4
movl -0x10(%rbp), %edi
movswq -0x6(%rbp), %rcx
leaq 0x11891d(%rip), %rax    # 0x12e6e0
movswq (%rax,%rcx,2), %rcx
leaq 0x22c411(%rip), %rax    # 0x2421e0
movq (%rax,%rcx,8), %rax
movl $0x64, %esi
movl $0xf91, %edx            # imm = 0xF91
movl $0x3, %r8d
xorl %r9d, %r9d
movsbl 0x1c(%rax), %ecx
callq 0x9460
jmp 0x160b9
movswq -0x6(%rbp), %rcx
leaq 0x1187a0(%rip), %rax    # 0x12e5a0
movswl (%rax,%rcx,2), %eax
cmpl $0x0, %eax
jle 0x15e49
movl -0x10(%rbp), %edi
movswq -0x6(%rbp), %rcx
leaq 0x1188c8(%rip), %rax    # 0x12e6e0
movswq (%rax,%rcx,2), %rcx
leaq 0x22c3bc(%rip), %rax    # 0x2421e0
movq (%rax,%rcx,8), %rax
movl $0x64, %esi
movl $0xf95, %edx            # imm = 0xF95
movl $0x3, %r8d
xorl %r9d, %r9d
movsbl 0x1c(%rax), %ecx
callq 0x9460
jmp 0x160b9
movswq -0x6(%rbp), %rcx
leaq 0x1179bb(%rip), %rax    # 0x12d810
movzwl (%rax,%rcx,2), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x15ec7
movl -0x10(%rbp), %edi
movswq -0x6(%rbp), %rcx
leaq 0x1179a0(%rip), %rax    # 0x12d810
movzwl (%rax,%rcx,2), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
addl $0xf9a, %eax            # imm = 0xF9A
movw %ax, %cx
movswq -0x6(%rbp), %rdx
leaq 0x118848(%rip), %rax    # 0x12e6e0
movswq (%rax,%rdx,2), %rdx
leaq 0x22c33c(%rip), %rax    # 0x2421e0
movq (%rax,%rdx,8), %rax
movl $0x64, %esi
movl $0x3, %r8d
xorl %r9d, %r9d
movswl %cx, %edx
movsbl 0x1c(%rax), %ecx
callq 0x9460
jmp 0x160b9
movswq -0x6(%rbp), %rcx
leaq 0x11793d(%rip), %rax    # 0x12d810
movzwl (%rax,%rcx,2), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x15f45
movl -0x10(%rbp), %edi
movswq -0x6(%rbp), %rcx
leaq 0x117922(%rip), %rax    # 0x12d810
movzwl (%rax,%rcx,2), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
addl $0xf9e, %eax            # imm = 0xF9E
movw %ax, %cx
movswq -0x6(%rbp), %rdx
leaq 0x1187ca(%rip), %rax    # 0x12e6e0
movswq (%rax,%rdx,2), %rdx
leaq 0x22c2be(%rip), %rax    # 0x2421e0
movq (%rax,%rdx,8), %rax
movl $0x64, %esi
movl $0x3, %r8d
xorl %r9d, %r9d
movswl %cx, %edx
movsbl 0x1c(%rax), %ecx
callq 0x9460
jmp 0x160b9
jmp 0x15f47
jmp 0x15f49
jmp 0x15f4b
jmp 0x15f4d
jmp 0x15f4f
jmp 0x15f51
movswq -0x6(%rbp), %rcx
leaq 0x1185a3(%rip), %rax    # 0x12e500
movsbl (%rax,%rcx), %eax
movswq -0x6(%rbp), %rdx
leaq 0x1185d3(%rip), %rcx    # 0x12e540
movswl (%rcx,%rdx,2), %ecx
orl %ecx, %eax
cmpl $0x0, %eax
je 0x16056
movl -0xc(%rbp), %eax
movl %eax, -0x18(%rbp)
subl $0x1da, %eax            # imm = 0x1DA
je 0x15fdf
jmp 0x15f8b
movl -0x18(%rbp), %eax
subl $0x440, %eax            # imm = 0x440
je 0x15fdf
jmp 0x15f97
movl -0x18(%rbp), %eax
subl $0x447, %eax            # imm = 0x447
je 0x15fdf
jmp 0x15fa3
movl -0x18(%rbp), %eax
subl $0x44e, %eax            # imm = 0x44E
je 0x15fdf
jmp 0x15faf
movl -0x18(%rbp), %eax
subl $0x503, %eax            # imm = 0x503
je 0x15fdf
jmp 0x15fbb
movl -0x18(%rbp), %eax
subl $0x508, %eax            # imm = 0x508
je 0x15fdf
jmp 0x15fc7
movl -0x18(%rbp), %eax
subl $0x50d, %eax            # imm = 0x50D
je 0x15fdf
jmp 0x15fd3
movl -0x18(%rbp), %eax
subl $0x51e, %eax            # imm = 0x51E
jne 0x1604a
jmp 0x15fdf
movswq -0x6(%rbp), %rcx
leaq 0x117825(%rip), %rax    # 0x12d810
movzwl (%rax,%rcx,2), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
setg %al
andb $0x1, %al
movzbl %al, %eax
shll $0x2, %eax
addl $0x1, %eax
addl 0x162425(%rip), %eax    # 0x178430
movl %eax, 0x16241f(%rip)    # 0x178430
cmpl $0x3, 0x162418(%rip)    # 0x178430
jle 0x16048
movl $0x0, 0x16240c(%rip)    # 0x178430
movl 0x16240a(%rip), %eax    # 0x178434
addl $0x1, %eax
movl %eax, 0x162401(%rip)    # 0x178434
cmpl $0x9, 0x1623fa(%rip)    # 0x178434
jle 0x16046
movl $0x0, 0x1623ee(%rip)    # 0x178434
jmp 0x16048
jmp 0x16054
movl $0x0, 0x1623e0(%rip)    # 0x178434
jmp 0x16056
movl -0x10(%rbp), %edi
movslq 0x1623d4(%rip), %rcx    # 0x178434
leaq 0x104219(%rip), %rax    # 0x11a280
addl (%rax,%rcx,4), %edi
movslq 0x1623c3(%rip), %rcx    # 0x178434
leaq 0x104238(%rip), %rax    # 0x11a2b0
movslq (%rax,%rcx,4), %rax
addq $0x64, %rax
movl %eax, %esi
movl -0xc(%rbp), %eax
movw %ax, %cx
movswq -0x6(%rbp), %rdx
leaq 0x11864c(%rip), %rax    # 0x12e6e0
movswq (%rax,%rdx,2), %rdx
leaq 0x22c140(%rip), %rax    # 0x2421e0
movq (%rax,%rdx,8), %rax
movl $0x3, %r8d
xorl %r9d, %r9d
movswl %cx, %edx
movsbl 0x1c(%rax), %ecx
callq 0x9460
addq $0x20, %rsp
popq %rbp
retq
nop