// File: /workspace/github_c_makefile_star2_O2/jonof[P]jftekwar/src/tekgun.c
// Function: tekexplodebody
int
tekexplodebody(int i)
{
     int  j,k,r,ext;

     ext=sprptr[i]->extra;
     if( (!validext(ext)) || (goreflag == 0) ) {
          return(0);
     }
     switch( sprXTptr[ext]->basepic ) {
     case RUBWALKPIC:
     case JAKEWALKPIC:
     case COP1WALKPIC:
     case ANTWALKPIC:
     case SARAHWALKPIC:
     case MAWALKPIC:
     case DIWALKPIC:
     case ERWALKPIC:
     case SAMWALKPIC:
     case FRGWALKPIC:
     case SUNGWALKPIC:
     case COWWALKPIC:
     case COPBWALKPIC:
     case NIKAWALKPIC:
     case REBRWALKPIC:
     case TRENWALKPIC:
     case WINGWALKPIC:
     case HALTWALKPIC:
     case REDHWALKPIC:
     case ORANWALKPIC:
     case BLKSWALKPIC:
     case SFROWALKPIC:
     case SSALWALKPIC:
     case SGOLWALKPIC:
     case SWATWALKPIC:
          break;
     default:
          return(0);
     }

     r=(krand_intercept(" GUN 787")%72)+8;
     for (k=0 ; k < r ; k++) {
          j=jsinsertsprite(sprptr[i]->sectnum,MOVEBODYPARTSSTAT);
          sprptr[j]->x=sprptr[i]->x;
          sprptr[j]->y=sprptr[i]->y;
          sprptr[j]->z=sprptr[i]->z+(8<<8);
          sprptr[j]->cstat=0;
          sprptr[j]->shade=0;
          sprptr[j]->pal=0;
          sprptr[j]->xrepeat=24;
          sprptr[j]->yrepeat=24;
          sprptr[j]->ang=sprptr[i]->ang;
          sprptr[j]->xvel=(krand_intercept(" GUN 799")&511)-256;
          sprptr[j]->yvel=(krand_intercept(" GUN 800")&511)-256;
          sprptr[j]->zvel=-((krand_intercept(" GUN 801")&8191)+4096);
          sprptr[j]->owner=sprptr[i]->owner;
          sprptr[j]->clipdist=32;
          sprptr[j]->lotag=360;
          sprptr[j]->hitag=0;
          switch (k) {
          case 0:
               sprptr[j]->picnum=GOREHEAD;
               break;
          case 1:
          case 10:
               sprptr[j]->picnum=GOREARM;
               break;
          case 5:
          case 15:
               sprptr[j]->picnum=GORELEG;
               break;
          default:
               sprptr[j]->picnum=GOREBLOOD;
               break;
          }
     }
     playsound(S_GORE1+(krand_intercept(" GUN 823")%2), sprptr[i]->x,sprptr[i]->y, 0, ST_NOUPDATE);

     return(1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movslq %edi, %r12
leaq 0x117979(%rip), %r13    # 0x127230
movq (%r13,%r12,8), %rax
movswl 0x2a(%rax), %ebx
movl %ebx, %edi
callq 0x1cfb8
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
je 0xfb9c
cmpl $0x0, 0x115a86(%rip)    # 0x125360
je 0xfb9c
movslq %ebx, %rcx
leaq 0x1bf946(%rip), %rdx    # 0x1cf230
movq (%rdx,%rcx,8), %rcx
movzwl 0xa(%rcx), %ecx
cmpl $0x163, %ecx            # imm = 0x163
je 0xf9e2
cmpl $0x3e7, %ecx            # imm = 0x3E7
je 0xf9e2
cmpl $0x45b, %ecx            # imm = 0x45B
je 0xf9e2
cmpl $0x6d7, %ecx            # imm = 0x6D7
je 0xf9e2
cmpl $0x709, %ecx            # imm = 0x709
je 0xf9e2
cmpl $0x72a, %ecx            # imm = 0x72A
je 0xf9e2
cmpl $0x75f, %ecx            # imm = 0x75F
je 0xf9e2
cmpl $0x79e, %ecx            # imm = 0x79E
je 0xf9e2
cmpl $0x7d3, %ecx            # imm = 0x7D3
je 0xf9e2
cmpl $0x811, %ecx            # imm = 0x811
je 0xf9e2
cmpl $0x84d, %ecx            # imm = 0x84D
je 0xf9e2
cmpl $0x889, %ecx            # imm = 0x889
je 0xf9e2
cmpl $0x8d3, %ecx            # imm = 0x8D3
je 0xf9e2
cmpl $0x92d, %ecx            # imm = 0x92D
je 0xf9e2
cmpl $0x947, %ecx            # imm = 0x947
je 0xf9e2
cmpl $0x983, %ecx            # imm = 0x983
je 0xf9e2
cmpl $0x9ca, %ecx            # imm = 0x9CA
je 0xf9e2
cmpl $0xa05, %ecx            # imm = 0xA05
je 0xf9e2
cmpl $0xa41, %ecx            # imm = 0xA41
je 0xf9e2
cmpl $0xa7d, %ecx            # imm = 0xA7D
je 0xf9e2
cmpl $0xac0, %ecx            # imm = 0xAC0
je 0xf9e2
cmpl $0xaff, %ecx            # imm = 0xAFF
je 0xf9e2
cmpl $0xb3b, %ecx            # imm = 0xB3B
je 0xf9e2
cmpl $0xbb9, %ecx            # imm = 0xBB9
je 0xf9e2
cmpl $0xb77, %ecx            # imm = 0xB77
jne 0xfb9c
leaq 0x71a55(%rip), %rdi     # 0x8143e
callq 0x2945b
pushq $0x48
popq %rcx
cltd
idivl %ecx
cmpl $-0x7, %edx
pushq $-0x8
popq %rax
cmovgel %edx, %eax
addl $0x8, %eax
movl %eax, 0x4(%rsp)
xorl %r14d, %r14d
movl $0x1ff, %ebx            # imm = 0x1FF
movl $0xffffff00, %ebp       # imm = 0xFFFFFF00
cmpl %r14d, 0x4(%rsp)
je 0xfb6f
movq (%r13,%r12,8), %rax
movswl 0x18(%rax), %edi
movl $0x384, %esi            # imm = 0x384
callq 0x1cf0c
movq (%r13,%r12,8), %rcx
movl (%rcx), %ecx
movswq %ax, %r15
movq (%r13,%r15,8), %rax
movl %ecx, (%rax)
movq (%r13,%r12,8), %rax
movl 0x4(%rax), %eax
movq (%r13,%r15,8), %rcx
movl %eax, 0x4(%rcx)
movq (%r13,%r12,8), %rax
movl 0x8(%rax), %eax
movl $0x800, %ecx            # imm = 0x800
addl %ecx, %eax
movq (%r13,%r15,8), %rcx
movl %eax, 0x8(%rcx)
movq (%r13,%r15,8), %rax
andw $0x0, 0xc(%rax)
movq (%r13,%r15,8), %rax
xorl %ecx, %ecx
movb %cl, 0x10(%rax)
movq (%r13,%r15,8), %rax
movb %cl, 0x11(%rax)
movq (%r13,%r15,8), %rax
movb $0x18, %cl
movb %cl, 0x14(%rax)
movq (%r13,%r15,8), %rax
movb %cl, 0x15(%rax)
movq (%r13,%r12,8), %rax
movzwl 0x1c(%rax), %eax
movq (%r13,%r15,8), %rcx
movw %ax, 0x1c(%rcx)
leaq 0x71998(%rip), %rdi     # 0x81447
callq 0x2945b
andl %ebx, %eax
addl %ebp, %eax
movq (%r13,%r15,8), %rcx
movw %ax, 0x20(%rcx)
leaq 0x71988(%rip), %rdi     # 0x81450
callq 0x2945b
andl %ebx, %eax
addl %ebp, %eax
movq (%r13,%r15,8), %rcx
movw %ax, 0x22(%rcx)
leaq 0x71978(%rip), %rdi     # 0x81459
callq 0x2945b
andl $0x1fff, %eax           # imm = 0x1FFF
movl $0xfffff000, %ecx       # imm = 0xFFFFF000
subl %eax, %ecx
movq (%r13,%r15,8), %rax
movw %cx, 0x24(%rax)
movq (%r13,%r12,8), %rax
movzwl 0x1e(%rax), %eax
movq (%r13,%r15,8), %rcx
movw %ax, 0x1e(%rcx)
movq (%r13,%r15,8), %rax
movb $0x20, 0x12(%rax)
movq (%r13,%r15,8), %rax
movw $0x168, 0x26(%rax)      # imm = 0x168
movq (%r13,%r15,8), %rax
andw $0x0, 0x28(%rax)
testl %r14d, %r14d
je 0xfb5a
cmpl $0x1, %r14d
je 0xfb48
cmpl $0x5, %r14d
je 0xfb4e
cmpl $0xf, %r14d
je 0xfb4e
cmpl $0xa, %r14d
jne 0xfb54
movw $0x528, %ax             # imm = 0x528
jmp 0xfb5e
movw $0x530, %ax             # imm = 0x530
jmp 0xfb5e
movw $0x540, %ax             # imm = 0x540
jmp 0xfb5e
movw $0x52c, %ax             # imm = 0x52C
movq (%r13,%r15,8), %rcx
movw %ax, 0xe(%rcx)
incl %r14d
jmp 0xfa11
leaq 0x718ec(%rip), %rdi     # 0x81462
callq 0x2945b
pushq $0x2
popq %rcx
cltd
idivl %ecx
leal 0x76(%rdx), %edi
movq (%r13,%r12,8), %rax
movl (%rax), %esi
movl 0x4(%rax), %edx
pushq $0x4
popq %r8
xorl %ecx, %ecx
callq 0x1ab2a
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq