// File: /workspace/github_c_makefile_star2_O3/jrrk[P]cbzone/c_explode.c
// Function: explodesalvo
void explodesalvo (g, pl)
     Genericp g;
     Genericp pl;
{
  float mrx[5], mry[5];
  float mrz[5], xmoff[5], ymoff[5], zmoff[5];
  static float gravity = 1.0;
  int i, j;
  Coord2dp point, first;

  if (g->dc[0].last) {
    gprsetdrawvalue(opt->cpi[COLOR_BG]);
    multiline(g->dc[0].points, 5);
  }

  if (g->attr & EXERASE || g->ecount >= 20) {
    g->attr = 0;
    return;
  }

  if (g->attr & IS_NEW) {
    g->ccount = 0;
    g->attr &= ~IS_NEW;
    for (j=0; j<5; j++) {
      g->dc[j].vel.x = frand() * 20.0 - 10.0;
      g->dc[j].vel.y = frand() * 20.0 - 10.0;
      g->dc[j].vel.z = -7.5 - frand() * 5.0;
      g->dc[j].pos.x = 0.0;
      g->dc[j].pos.y = 0.0;
      g->dc[j].pos.z = 0.0;
    }
  }
  if (g->dc[0].seen) {
    if (g->salvo == pl)
      gprsetdrawvalue(opt->cpi[COLOR_PSALVO]);
    else
      gprsetdrawvalue(opt->cpi[COLOR_ESALVO]);
    for (i=0; i<5; i++) {
      g->dc[i].pos.x += g->dc[i].vel.x;
      g->dc[i].pos.y += g->dc[i].vel.y;
      g->dc[i].vel.z += gravity;
      g->dc[i].pos.z -= g->dc[i].vel.z;
    }
    point = g->dc[0].points;
    for (i=0; i<5; i++) {
      xmoff[i] = g->dc[i].pos.x + g->x - pl->x;
      ymoff[i] = g->dc[i].pos.y + g->y - pl->y;
      zmoff[i] = g->dc[i].pos.z;
      mrx[i] =  xmoff[i] * pl->ca + ymoff[i] * pl->sa;
      mry[i] = -xmoff[i] * pl->sa + ymoff[i] * pl->ca;
      mrz[i] =  zmoff[i];
      if (mry[i] < 10.0)
        mry[i] = 10.0;
      first = point++;
      point->x = first->x = 500 + mrx[i] / mry[i] * 450;
      first->y = 260 - mrz[i] / mry[i] * 450;
      point->y = first->y+2;
      point++;
    }
    multiline(g->dc[0].points, 5);
    g->dc[0].last = True;
  }
  else
    g->dc[0].last = False;
  g->ccount++;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
cmpl $0x0, 0x18c(%rdi)
je 0x5a62
leaq 0xeb3e(%rip), %rax      # 0x14580
movq (%rax), %rax
movl 0xf0(%rax), %edi
xorl %eax, %eax
callq 0x7660
leaq 0x70(%rbx), %rdi
movl $0x5, %esi
xorl %eax, %eax
callq 0x6ed0
movl 0x8(%rbx), %eax
testb $0x10, %al
jne 0x5a6f
cmpl $0x14, 0x44(%rbx)
jl 0x5a7b
movl $0x0, 0x8(%rbx)
jmp 0x5cf7
testb $0x2, %al
je 0x5b5f
movl $0x0, 0x48(%rbx)
andl $-0x13, %eax
movl %eax, 0x8(%rbx)
movl $0x174, %r15d           # imm = 0x174
movl $0xffff, %ebp           # imm = 0xFFFF
callq 0x4510
andl %ebp, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd 0x85bf(%rip), %xmm1     # 0xe070
divsd %xmm1, %xmm0
movsd 0x85bb(%rip), %xmm1     # 0xe078
mulsd %xmm1, %xmm0
movsd 0x85b7(%rip), %xmm1     # 0xe080
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x8(%rbx,%r15)
callq 0x4510
andl %ebp, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x8582(%rip), %xmm0     # 0xe070
mulsd 0x8582(%rip), %xmm0     # 0xe078
addsd 0x8582(%rip), %xmm0     # 0xe080
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x4(%rbx,%r15)
callq 0x4510
andl %ebp, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x8589(%rip), %xmm0     # 0xe0a8
mulsd 0x8589(%rip), %xmm0     # 0xe0b0
addsd 0x8589(%rip), %xmm0     # 0xe0b8
cvtsd2ss %xmm0, %xmm0
movss %xmm0, (%rbx,%r15)
movq $0x0, -0x14(%rbx,%r15)
movl $0x0, -0xc(%rbx,%r15)
addq $0x130, %r15            # imm = 0x130
cmpq $0x764, %r15            # imm = 0x764
jne 0x5a9b
cmpl $0x0, 0x188(%rbx)
je 0x5cec
xorl %eax, %eax
cmpq %r14, 0x650(%rbx)
setne %al
leaq 0xea01(%rip), %rcx      # 0x14580
movq (%rcx), %rcx
shll $0x4, %eax
movl 0x100(%rcx,%rax), %edi
xorl %eax, %eax
callq 0x7660
movl $0x174, %eax            # imm = 0x174
movss 0x84c0(%rip), %xmm0     # 0xe060
movsd -0x8(%rbx,%rax), %xmm1
movsd -0x14(%rbx,%rax), %xmm2
addps %xmm1, %xmm2
movlps %xmm2, -0x14(%rbx,%rax)
movss (%rbx,%rax), %xmm1
addss %xmm0, %xmm1
movss %xmm1, (%rbx,%rax)
movss -0xc(%rbx,%rax), %xmm2
subss %xmm1, %xmm2
movss %xmm2, -0xc(%rbx,%rax)
addq $0x130, %rax            # imm = 0x130
cmpq $0x764, %rax            # imm = 0x764
jne 0x5ba0
leaq 0x70(%rbx), %rdi
movss 0xc(%rbx), %xmm0
movss 0x10(%rbx), %xmm1
movss 0xc(%r14), %xmm2
movss 0x10(%r14), %xmm3
movss 0x24(%r14), %xmm4
movss 0x28(%r14), %xmm5
leaq 0x168(%rbx), %rax
xorl %ecx, %ecx
movss 0x83ed(%rip), %xmm6     # 0xe004
movaps 0x83f2(%rip), %xmm7     # 0xe010
movaps 0x83fa(%rip), %xmm8     # 0xe020
movsd 0x8401(%rip), %xmm9     # 0xe030
movss -0x8(%rax), %xmm10
addss %xmm0, %xmm10
subss %xmm2, %xmm10
movss -0x4(%rax), %xmm11
addss %xmm1, %xmm11
subss %xmm3, %xmm11
movaps %xmm11, %xmm12
mulss %xmm5, %xmm12
movaps %xmm10, %xmm13
mulss %xmm4, %xmm11
mulss %xmm4, %xmm13
mulss %xmm5, %xmm10
subss %xmm10, %xmm11
movaps %xmm6, %xmm10
addss %xmm12, %xmm13
maxss %xmm11, %xmm10
movss (%rax), %xmm11
xorps %xmm7, %xmm11
unpcklps %xmm11, %xmm13          # xmm13 = xmm13[0],xmm11[0],xmm13[1],xmm11[1]
shufps $0x0, %xmm10, %xmm10    # xmm10 = xmm10[0,0,0,0]
divps %xmm10, %xmm13
mulps %xmm8, %xmm13
addps %xmm9, %xmm13
cvttps2dq %xmm13, %xmm10
pshuflw $0xe8, %xmm10, %xmm11   # xmm11 = xmm10[0,2,2,3,4,5,6,7]
movd %xmm10, %edx
movw %dx, 0x74(%rbx,%rcx,8)
pextrw $0x2, %xmm10, %edx
addl $0x2, %edx
movd %xmm11, 0x70(%rbx,%rcx,8)
movw %dx, 0x76(%rbx,%rcx,8)
incq %rcx
addq $0x130, %rax            # imm = 0x130
cmpq $0x5, %rcx
jne 0x5c2f
movl $0x5, %esi
xorl %eax, %eax
callq 0x6ed0
movl $0x1, %eax
jmp 0x5cee
xorl %eax, %eax
movl %eax, 0x18c(%rbx)
incl 0x48(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop