// File: /workspace/github_c_makefile_star2_O1/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 0x5b13
leaq 0xea9d(%rip), %rax      # 0x14590
movq (%rax), %rax
movl 0xf0(%rax), %edi
xorl %eax, %eax
callq 0x7608
leaq 0x70(%rbx), %rdi
movl $0x5, %esi
xorl %eax, %eax
callq 0x6e78
movl 0x8(%rbx), %eax
testb $0x10, %al
jne 0x5b20
cmpl $0x14, 0x44(%rbx)
jl 0x5b2c
movl $0x0, 0x8(%rbx)
jmp 0x5db9
testb $0x2, %al
je 0x5c10
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 0x84fe(%rip), %xmm1     # 0xe060
divsd %xmm1, %xmm0
movsd 0x84fa(%rip), %xmm1     # 0xe068
mulsd %xmm1, %xmm0
movsd 0x84f6(%rip), %xmm1     # 0xe070
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x8(%rbx,%r15)
callq 0x4510
andl %ebp, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x84c1(%rip), %xmm0     # 0xe060
mulsd 0x84c1(%rip), %xmm0     # 0xe068
addsd 0x84c1(%rip), %xmm0     # 0xe070
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x4(%rbx,%r15)
callq 0x4510
andl %ebp, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x84c8(%rip), %xmm0     # 0xe098
mulsd 0x84c8(%rip), %xmm0     # 0xe0a0
addsd 0x84c8(%rip), %xmm0     # 0xe0a8
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 0x5b4c
cmpl $0x0, 0x188(%rbx)
je 0x5dae
xorl %eax, %eax
cmpq %r14, 0x650(%rbx)
setne %al
leaq 0xe960(%rip), %rcx      # 0x14590
movq (%rcx), %rcx
shll $0x4, %eax
movl 0x100(%rcx,%rax), %edi
xorl %eax, %eax
callq 0x7608
movl $0x174, %eax            # imm = 0x174
movss 0x8403(%rip), %xmm0     # 0xe054
movss -0xc(%rbx,%rax), %xmm1
movss -0x8(%rbx,%rax), %xmm2
addss -0x14(%rbx,%rax), %xmm2
movss %xmm2, -0x14(%rbx,%rax)
movss -0x4(%rbx,%rax), %xmm2
addss -0x10(%rbx,%rax), %xmm2
movss %xmm2, -0x10(%rbx,%rax)
movss (%rbx,%rax), %xmm2
addss %xmm0, %xmm2
movss %xmm2, (%rbx,%rax)
subss %xmm2, %xmm1
movss %xmm1, -0xc(%rbx,%rax)
addq $0x130, %rax            # imm = 0x130
cmpq $0x764, %rax            # imm = 0x764
jne 0x5c51
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 0x832c(%rip), %xmm6     # 0xe004
movss 0x8328(%rip), %xmm7     # 0xe008
movss 0x8323(%rip), %xmm8     # 0xe00c
movss 0x831e(%rip), %xmm9     # 0xe010
movss -0x8(%rax), %xmm11
addss %xmm0, %xmm11
movss -0x4(%rax), %xmm12
subss %xmm2, %xmm11
addss %xmm1, %xmm12
subss %xmm3, %xmm12
movss (%rax), %xmm10
movaps %xmm12, %xmm13
mulss %xmm5, %xmm13
movaps %xmm11, %xmm14
mulss %xmm4, %xmm12
mulss %xmm4, %xmm14
mulss %xmm5, %xmm11
subss %xmm11, %xmm12
movaps %xmm6, %xmm11
addss %xmm13, %xmm14
maxss %xmm12, %xmm11
divss %xmm11, %xmm14
mulss %xmm7, %xmm14
addss %xmm8, %xmm14
cvttss2si %xmm14, %edx
divss %xmm11, %xmm10
movw %dx, (%rdi,%rcx,8)
mulss %xmm7, %xmm10
movaps %xmm9, %xmm11
subss %xmm10, %xmm11
movw %dx, 0x4(%rdi,%rcx,8)
cvttss2si %xmm11, %edx
movw %dx, 0x2(%rdi,%rcx,8)
addl $0x2, %edx
movw %dx, 0x6(%rdi,%rcx,8)
incq %rcx
addq $0x130, %rax            # imm = 0x130
cmpq $0x5, %rcx
jne 0x5cf2
movl $0x5, %esi
xorl %eax, %eax
callq 0x6e78
movl $0x1, %eax
jmp 0x5db0
xorl %eax, %eax
movl %eax, 0x18c(%rbx)
incl 0x48(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq