// File: /workspace/github_c_makefile_star2_O2/jrrk[P]cbzone/c_draw.c
// Function: calcpointsIV
void calcpointsIV(dc, method, index, g, pl)
     DCp dc;
     Methodp method;
     int index;
     Genericp g, pl;
{
  int i;
  float temp, dx, dy, xn, yn, cn, sn, prx, pry, prz, rx, ry, csa, ssa;
  Coord2dp new;
  Coord3dp old;
  Float2d pivot;

  old = dc->s->object+index;
  new = dc->points+index;
  temp = dc->cta;
  dc->cta = dc->cta * method->vars[0] - dc->sta * method->vars[1];
  dc->sta = dc->sta * method->vars[0] + temp * method->vars[1];
  csa = cos(g->azm);
  ssa = sin(g->azm);
  dx = pl->x - dc->pos.x;
  dy = pl->y - dc->pos.y;
  xn =  dx * csa + dy * ssa;
  yn = -dx * ssa + dy * csa;
  cn = pl->ca * csa + pl->sa * ssa;
  sn = pl->sa * csa - ssa * pl->ca;
  pivot.x = method->vars[2] - xn;
  pivot.y = method->vars[3] - yn;
  for (i=0; i<method->num; i++, old++, new++) {
    rx = old->x * dc->cta - old->y * dc->sta + pivot.x;
    ry = old->x * dc->sta + old->y * dc->cta + pivot.y;
    prx =  rx * cn + ry * sn;
    pry = -rx * sn + ry * cn;
    if (pry < 10.0)
      pry = 10.0;
    prz = old->z + dc->pos.z;
    new->x = 500 + prx / pry * 450;
    new->y = 260 - prz / pry * 450;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r15
movq %rcx, %r12
movq %rsi, %r14
movq %rdi, %rbx
movq (%rdi), %rax
movslq %edx, %rcx
imulq $0x6, %rcx, %r13
addq (%rax), %r13
leaq (%rdi,%rcx,4), %rbp
addq $0x10, %rbp
movss 0x118(%rdi), %xmm0
movq 0x10(%rsi), %rax
movss 0x11c(%rdi), %xmm1
movss 0x4(%rax), %xmm2
mulss %xmm1, %xmm2
movss (%rax), %xmm3
mulss %xmm0, %xmm3
subss %xmm2, %xmm3
movss %xmm3, 0x118(%rdi)
mulss 0x4(%rax), %xmm0
mulss (%rax), %xmm1
addss %xmm0, %xmm1
movss %xmm1, 0x11c(%rdi)
cvtss2sd 0x20(%r12), %xmm0
callq 0x41e0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x4(%rsp)
cvtss2sd 0x20(%r12), %xmm0
callq 0x45a0
cvtsd2ss %xmm0, %xmm2
movss 0xc(%r15), %xmm0
movss 0x10(%r15), %xmm4
subss 0x100(%rbx), %xmm0
subss 0x104(%rbx), %xmm4
movaps %xmm4, %xmm1
mulss %xmm2, %xmm1
movaps %xmm0, %xmm3
movss 0x4(%rsp), %xmm5
mulss %xmm5, %xmm3
addss %xmm1, %xmm3
mulss %xmm5, %xmm4
movaps %xmm5, %xmm6
mulss %xmm2, %xmm0
subss %xmm0, %xmm4
movss 0x24(%r15), %xmm0
movss 0x28(%r15), %xmm1
movaps %xmm1, %xmm5
mulss %xmm2, %xmm5
mulss %xmm0, %xmm2
mulss %xmm6, %xmm0
addss %xmm5, %xmm0
mulss %xmm6, %xmm1
subss %xmm2, %xmm1
movq 0x10(%r14), %rax
movss 0x8(%rax), %xmm2
subss %xmm3, %xmm2
movss 0xc(%rax), %xmm3
subss %xmm4, %xmm3
movl (%r14), %eax
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
movss 0x83e6(%rip), %xmm4     # 0xd004
movaps 0x83eb(%rip), %xmm5     # 0xd010
movaps 0x83f4(%rip), %xmm6     # 0xd020
movsd 0x83fc(%rip), %xmm7     # 0xd030
cmpl %ecx, %eax
je 0x4d07
movswl (%r13), %edx
cvtsi2ss %edx, %xmm8
movswl 0x2(%r13), %edx
cvtsi2ss %edx, %xmm10
movss 0x118(%rbx), %xmm11
movss 0x11c(%rbx), %xmm12
movaps %xmm8, %xmm9
mulss %xmm12, %xmm8
mulss %xmm10, %xmm12
mulss %xmm11, %xmm9
subss %xmm12, %xmm9
addss %xmm2, %xmm9
mulss %xmm10, %xmm11
addss %xmm11, %xmm8
addss %xmm3, %xmm8
movaps %xmm1, %xmm10
mulss %xmm8, %xmm10
movaps %xmm9, %xmm11
mulss %xmm0, %xmm11
addss %xmm10, %xmm11
mulss %xmm0, %xmm8
mulss %xmm1, %xmm9
movswl 0x4(%r13), %edx
cvtsi2ss %edx, %xmm10
subss %xmm9, %xmm8
movaps %xmm4, %xmm9
addss 0x108(%rbx), %xmm10
maxss %xmm8, %xmm9
xorps %xmm5, %xmm10
unpcklps %xmm10, %xmm11          # xmm11 = xmm11[0],xmm10[0],xmm11[1],xmm10[1]
shufps $0x0, %xmm9, %xmm9      # xmm9 = xmm9[0,0,0,0]
divps %xmm9, %xmm11
mulps %xmm6, %xmm11
addps %xmm7, %xmm11
cvttps2dq %xmm11, %xmm8
pshuflw $0xe8, %xmm8, %xmm8     # xmm8 = xmm8[0,2,2,3,4,5,6,7]
movd %xmm8, (%rbp,%rcx,4)
addq $0x6, %r13
incq %rcx
jmp 0x4c34
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq