// File: /workspace/github_c_makefile_star2_O3/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 0x120936(%rip), %r13    # 0x131230
movq %rax, 0x10(%rsp)
movq (%r13,%rax,8), %rax
movswl 0x2a(%rax), %ebx
movl %ebx, %edi
callq 0x1eb75
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
je 0x10ca2
cmpl $0x0, 0x11ea3e(%rip)    # 0x12f360
je 0x10ca2
movslq %ebx, %rcx
leaq 0x1c88fe(%rip), %rdx    # 0x1d9230
movq (%rdx,%rcx,8), %rcx
movzwl 0xa(%rcx), %ecx
cmpl $0x8d2, %ecx            # imm = 0x8D2
jle 0x10983
cmpl $0xa40, %ecx            # imm = 0xA40
jle 0x109f1
cmpl $0xafe, %ecx            # imm = 0xAFE
jle 0x10a7d
cmpl $0xb76, %ecx            # imm = 0xB76
jg 0x10a9a
cmpl $0xaff, %ecx            # imm = 0xAFF
je 0x10aae
cmpl $0xb3b, %ecx            # imm = 0xB3B
je 0x10aae
jmp 0x10ca2
cmpl $0x75e, %ecx            # imm = 0x75E
jg 0x109c0
cmpl $0x6d6, %ecx            # imm = 0x6D6
jg 0x10a22
cmpl $0x163, %ecx            # imm = 0x163
je 0x10aae
cmpl $0x3e7, %ecx            # imm = 0x3E7
je 0x10aae
cmpl $0x45b, %ecx            # imm = 0x45B
je 0x10aae
jmp 0x10ca2
cmpl $0x810, %ecx            # imm = 0x810
jg 0x10a43
cmpl $0x75f, %ecx            # imm = 0x75F
je 0x10aae
cmpl $0x79e, %ecx            # imm = 0x79E
je 0x10aae
cmpl $0x7d3, %ecx            # imm = 0x7D3
je 0x10aae
jmp 0x10ca2
cmpl $0x982, %ecx            # imm = 0x982
jg 0x10a60
cmpl $0x8d3, %ecx            # imm = 0x8D3
je 0x10aae
cmpl $0x92d, %ecx            # imm = 0x92D
je 0x10aae
cmpl $0x947, %ecx            # imm = 0x947
je 0x10aae
jmp 0x10ca2
cmpl $0x6d7, %ecx            # imm = 0x6D7
je 0x10aae
cmpl $0x709, %ecx            # imm = 0x709
je 0x10aae
cmpl $0x72a, %ecx            # imm = 0x72A
je 0x10aae
jmp 0x10ca2
cmpl $0x811, %ecx            # imm = 0x811
je 0x10aae
cmpl $0x84d, %ecx            # imm = 0x84D
je 0x10aae
cmpl $0x889, %ecx            # imm = 0x889
je 0x10aae
jmp 0x10ca2
cmpl $0x983, %ecx            # imm = 0x983
je 0x10aae
cmpl $0x9ca, %ecx            # imm = 0x9CA
je 0x10aae
cmpl $0xa05, %ecx            # imm = 0xA05
je 0x10aae
jmp 0x10ca2
cmpl $0xa41, %ecx            # imm = 0xA41
je 0x10aae
cmpl $0xa7d, %ecx            # imm = 0xA7D
je 0x10aae
cmpl $0xac0, %ecx            # imm = 0xAC0
je 0x10aae
jmp 0x10ca2
cmpl $0xbb9, %ecx            # imm = 0xBB9
je 0x10aae
cmpl $0xb77, %ecx            # imm = 0xB77
jne 0x10ca2
leaq 0x7e989(%rip), %rdi     # 0x8f43e
callq 0x2d112
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 0x10c63
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 0x1eac8
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 0x7e8af(%rip), %rdi     # 0x8f447
callq 0x2d112
andl %ebp, %eax
addl %ebx, %eax
movq (%r13,%r14,8), %rcx
movw %ax, 0x20(%rcx)
leaq 0x7e89f(%rip), %rdi     # 0x8f450
callq 0x2d112
andl %ebp, %eax
addl %ebx, %eax
movq (%r13,%r14,8), %rcx
movw %ax, 0x22(%rcx)
leaq 0x7e88f(%rip), %rdi     # 0x8f459
callq 0x2d112
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 0x10c33
cmpl $0x5, %r15d
je 0x10c48
cmpl $0xf, %r15d
je 0x10c48
cmpl $0xa, %r15d
jne 0x10c42
movw $0x528, %ax             # imm = 0x528
jmp 0x10c4c
movw $0x52c, %ax             # imm = 0x52C
testl %r15d, %r15d
je 0x10c4c
cmpl $0x1, %r15d
je 0x10c2d
movw $0x540, %ax             # imm = 0x540
jmp 0x10c4c
movw $0x530, %ax             # imm = 0x530
movq (%r13,%r14,8), %rcx
movw %ax, 0xe(%rcx)
incl %r15d
cmpl %r15d, 0x8(%rsp)
jne 0x10b06
leaq 0x7e7f8(%rip), %rdi     # 0x8f462
callq 0x2d112
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 0x1c370
movl $0x1, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq