// File: /workspace/github_c_makefile_star2_O1/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
subq $0x18, %rsp
movslq %edi, %rax
leaq 0x11d96e(%rip), %r13    # 0x12e210
movq %rax, 0x10(%rsp)
movq (%r13,%rax,8), %rax
movswl 0x2a(%rax), %ebx
movl %ebx, %edi
callq 0x1e9f9
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
je 0x10c4a
cmpl $0x0, 0x11ba96(%rip)    # 0x12c360
je 0x10c4a
movslq %ebx, %rcx
leaq 0x1c5936(%rip), %rdx    # 0x1d6210
movq (%rdx,%rcx,8), %rcx
movzwl 0xa(%rcx), %ecx
cmpl $0x8d2, %ecx            # imm = 0x8D2
jle 0x1092b
cmpl $0xa40, %ecx            # imm = 0xA40
jle 0x10999
cmpl $0xafe, %ecx            # imm = 0xAFE
jle 0x10a25
cmpl $0xb76, %ecx            # imm = 0xB76
jg 0x10a42
cmpl $0xaff, %ecx            # imm = 0xAFF
je 0x10a56
cmpl $0xb3b, %ecx            # imm = 0xB3B
je 0x10a56
jmp 0x10c4a
cmpl $0x75e, %ecx            # imm = 0x75E
jg 0x10968
cmpl $0x6d6, %ecx            # imm = 0x6D6
jg 0x109ca
cmpl $0x163, %ecx            # imm = 0x163
je 0x10a56
cmpl $0x3e7, %ecx            # imm = 0x3E7
je 0x10a56
cmpl $0x45b, %ecx            # imm = 0x45B
je 0x10a56
jmp 0x10c4a
cmpl $0x810, %ecx            # imm = 0x810
jg 0x109eb
cmpl $0x75f, %ecx            # imm = 0x75F
je 0x10a56
cmpl $0x79e, %ecx            # imm = 0x79E
je 0x10a56
cmpl $0x7d3, %ecx            # imm = 0x7D3
je 0x10a56
jmp 0x10c4a
cmpl $0x982, %ecx            # imm = 0x982
jg 0x10a08
cmpl $0x8d3, %ecx            # imm = 0x8D3
je 0x10a56
cmpl $0x92d, %ecx            # imm = 0x92D
je 0x10a56
cmpl $0x947, %ecx            # imm = 0x947
je 0x10a56
jmp 0x10c4a
cmpl $0x6d7, %ecx            # imm = 0x6D7
je 0x10a56
cmpl $0x709, %ecx            # imm = 0x709
je 0x10a56
cmpl $0x72a, %ecx            # imm = 0x72A
je 0x10a56
jmp 0x10c4a
cmpl $0x811, %ecx            # imm = 0x811
je 0x10a56
cmpl $0x84d, %ecx            # imm = 0x84D
je 0x10a56
cmpl $0x889, %ecx            # imm = 0x889
je 0x10a56
jmp 0x10c4a
cmpl $0x983, %ecx            # imm = 0x983
je 0x10a56
cmpl $0x9ca, %ecx            # imm = 0x9CA
je 0x10a56
cmpl $0xa05, %ecx            # imm = 0xA05
je 0x10a56
jmp 0x10c4a
cmpl $0xa41, %ecx            # imm = 0xA41
je 0x10a56
cmpl $0xa7d, %ecx            # imm = 0xA7D
je 0x10a56
cmpl $0xac0, %ecx            # imm = 0xAC0
je 0x10a56
jmp 0x10c4a
cmpl $0xbb9, %ecx            # imm = 0xBB9
je 0x10a56
cmpl $0xb77, %ecx            # imm = 0xB77
jne 0x10c4a
leaq 0x7b9cd(%rip), %rdi     # 0x8c42a
callq 0x2be4a
movslq %eax, %rdx
imulq $0x38e38e39, %rdx, %rax # imm = 0x38E38E39
movq %rax, %rcx
shrq $0x3f, %rcx
sarq $0x24, %rax
addl %ecx, %eax
shll $0x3, %eax
leal (%rax,%rax,8), %eax
subl %eax, %edx
movq %rdx, 0x8(%rsp)
cmpl $-0x7, %edx
jl 0x10c0b
movq 0x8(%rsp), %rax
addl $0x8, %eax
movq %rax, 0x8(%rsp)
xorl %r15d, %r15d
movq 0x10(%rsp), %r12
movl $0x1ff, %ebp            # imm = 0x1FF
movl $0xffffff00, %ebx       # imm = 0xFFFFFF00
movq (%r13,%r12,8), %rax
movswl 0x18(%rax), %edi
movl $0x384, %esi            # imm = 0x384
callq 0x1e94c
movq (%r13,%r12,8), %rcx
movl (%rcx), %ecx
movswq %ax, %r14
movq (%r13,%r14,8), %rax
movl %ecx, (%rax)
movq (%r13,%r12,8), %rax
movl 0x4(%rax), %eax
movq (%r13,%r14,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,%r14,8), %rcx
movl %eax, 0x8(%rcx)
movq (%r13,%r14,8), %rax
xorl %ecx, %ecx
movw %cx, 0xc(%rax)
movq (%r13,%r14,8), %rax
movb %cl, 0x10(%rax)
movq (%r13,%r14,8), %rax
movb %cl, 0x11(%rax)
movq (%r13,%r14,8), %rax
movb $0x18, %cl
movb %cl, 0x14(%rax)
movq (%r13,%r14,8), %rax
movb %cl, 0x15(%rax)
movq (%r13,%r12,8), %rax
movzwl 0x1c(%rax), %eax
movq (%r13,%r14,8), %rcx
movw %ax, 0x1c(%rcx)
leaq 0x7b8f3(%rip), %rdi     # 0x8c433
callq 0x2be4a
andl %ebp, %eax
addl %ebx, %eax
movq (%r13,%r14,8), %rcx
movw %ax, 0x20(%rcx)
leaq 0x7b8e3(%rip), %rdi     # 0x8c43c
callq 0x2be4a
andl %ebp, %eax
addl %ebx, %eax
movq (%r13,%r14,8), %rcx
movw %ax, 0x22(%rcx)
leaq 0x7b8d3(%rip), %rdi     # 0x8c445
callq 0x2be4a
andl $0x1fff, %eax           # imm = 0x1FFF
movl $0xfffff000, %ecx       # imm = 0xFFFFF000
subl %eax, %ecx
movq (%r13,%r14,8), %rax
movw %cx, 0x24(%rax)
movq (%r13,%r12,8), %rax
movzwl 0x1e(%rax), %eax
movq (%r13,%r14,8), %rcx
movw %ax, 0x1e(%rcx)
movq (%r13,%r14,8), %rax
movb $0x20, 0x12(%rax)
movq (%r13,%r14,8), %rax
movw $0x168, 0x26(%rax)      # imm = 0x168
movq (%r13,%r14,8), %rax
xorl %ecx, %ecx
movw %cx, 0x28(%rax)
cmpl $0x4, %r15d
jle 0x10bdb
cmpl $0x5, %r15d
je 0x10bf0
cmpl $0xf, %r15d
je 0x10bf0
cmpl $0xa, %r15d
jne 0x10bea
movw $0x528, %ax             # imm = 0x528
jmp 0x10bf4
movw $0x52c, %ax             # imm = 0x52C
testl %r15d, %r15d
je 0x10bf4
cmpl $0x1, %r15d
je 0x10bd5
movw $0x540, %ax             # imm = 0x540
jmp 0x10bf4
movw $0x530, %ax             # imm = 0x530
movq (%r13,%r14,8), %rcx
movw %ax, 0xe(%rcx)
incl %r15d
cmpl %r15d, 0x8(%rsp)
jne 0x10aae
leaq 0x7b83c(%rip), %rdi     # 0x8c44e
callq 0x2be4a
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
andl $-0x2, %ecx
negl %ecx
leal (%rax,%rcx), %edi
addl $0x76, %edi
movq 0x10(%rsp), %rax
movq (%r13,%rax,8), %rax
movl (%rax), %esi
movl 0x4(%rax), %edx
xorl %ecx, %ecx
movl $0x4, %r8d
callq 0x1c1f1
movl $0x1, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq