// File: /workspace/github_c_makefile_star2_O2/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 0x5905
leaq 0xdca9(%rip), %rax      # 0x13590
movq (%rax), %rax
movl 0xf0(%rax), %edi
xorl %eax, %eax
callq 0x7092
leaq 0x70(%rbx), %rdi
pushq $0x5
popq %rsi
xorl %eax, %eax
callq 0x6abd
movl 0x8(%rbx), %eax
testb $0x10, %al
jne 0x5912
cmpl $0x14, 0x44(%rbx)
jl 0x591b
andl $0x0, 0x8(%rbx)
jmp 0x5b90
testb $0x2, %al
jne 0x5ab6
cmpl $0x0, 0x188(%rbx)
je 0x5b85
xorl %eax, %eax
cmpq %r14, 0x650(%rbx)
setne %al
leaq 0xdc4d(%rip), %rcx      # 0x13590
movq (%rcx), %rcx
shll $0x4, %eax
movl 0x100(%rcx,%rax), %edi
xorl %eax, %eax
callq 0x7092
movl $0x174, %eax            # imm = 0x174
movss 0x76fc(%rip), %xmm0     # 0xd060
cmpq $0x764, %rax            # imm = 0x764
je 0x59a6
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
jmp 0x5964
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 0x7627(%rip), %xmm6     # 0xd004
movaps 0x762c(%rip), %xmm7     # 0xd010
movaps 0x7634(%rip), %xmm8     # 0xd020
movsd 0x763b(%rip), %xmm9     # 0xd030
cmpq $0x5, %rcx
je 0x5aa4
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, %xmm13
addss %xmm12, %xmm13
mulss %xmm4, %xmm11
mulss %xmm5, %xmm10
subss %xmm10, %xmm11
movaps %xmm6, %xmm10
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)
movd %xmm11, 0x70(%rbx,%rcx,8)
pextrw $0x2, %xmm10, %edx
addl $0x2, %edx
movw %dx, 0x76(%rbx,%rcx,8)
incq %rcx
addq $0x130, %rax            # imm = 0x130
jmp 0x59f5
pushq $0x5
popq %rsi
xorl %eax, %eax
callq 0x6abd
pushq $0x1
popq %rax
jmp 0x5b87
andl $0x0, 0x48(%rbx)
andl $-0x13, %eax
movl %eax, 0x8(%rbx)
movl $0x174, %r15d           # imm = 0x174
movl $0xffff, %ebp           # imm = 0xFFFF
cmpq $0x764, %r15            # imm = 0x764
je 0x5923
callq 0x4520
andl %ebp, %eax
cvtsi2sd %eax, %xmm0
movsd 0x7585(%rip), %xmm1     # 0xd070
divsd %xmm1, %xmm0
movsd 0x7581(%rip), %xmm1     # 0xd078
mulsd %xmm1, %xmm0
movsd 0x757d(%rip), %xmm1     # 0xd080
addsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x8(%rbx,%r15)
callq 0x4520
andl %ebp, %eax
cvtsi2sd %eax, %xmm0
divsd 0x754b(%rip), %xmm0     # 0xd070
mulsd 0x754b(%rip), %xmm0     # 0xd078
addsd 0x754b(%rip), %xmm0     # 0xd080
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x4(%rbx,%r15)
callq 0x4520
andl %ebp, %eax
cvtsi2sd %eax, %xmm0
divsd 0x7555(%rip), %xmm0     # 0xd0a8
mulsd 0x7555(%rip), %xmm0     # 0xd0b0
addsd 0x7555(%rip), %xmm0     # 0xd0b8
cvtsd2ss %xmm0, %xmm0
movss %xmm0, (%rbx,%r15)
andq $0x0, -0x14(%rbx,%r15)
andl $0x0, -0xc(%rbx,%r15)
addq $0x130, %r15            # imm = 0x130
jmp 0x5acb
xorl %eax, %eax
movl %eax, 0x18c(%rbx)
incl 0x48(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop