// File: /workspace/github_c_makefile_star2_O3/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
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movq (%rdi), %rax
movq (%rax), %r13
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)
xorps %xmm0, %xmm0
cvtss2sd 0x20(%rcx), %xmm0
callq 0x41e0
movsd %xmm0, (%rsp)
xorps %xmm0, %xmm0
cvtss2sd 0x20(%r12), %xmm0
callq 0x4590
movl (%r14), %eax
testl %eax, %eax
jle 0x4d9a
xorps %xmm2, %xmm2
cvtsd2ss (%rsp), %xmm2
xorps %xmm3, %xmm3
cvtsd2ss %xmm0, %xmm3
movss 0xc(%r15), %xmm0
movss 0x10(%r15), %xmm4
subss 0x100(%rbx), %xmm0
subss 0x104(%rbx), %xmm4
movaps %xmm4, %xmm1
mulss %xmm3, %xmm1
movaps %xmm0, %xmm5
mulss %xmm2, %xmm5
addss %xmm1, %xmm5
mulss %xmm2, %xmm4
mulss %xmm3, %xmm0
subss %xmm0, %xmm4
movss 0x24(%r15), %xmm0
movss 0x28(%r15), %xmm1
movaps %xmm1, %xmm6
mulss %xmm3, %xmm6
mulss %xmm0, %xmm3
mulss %xmm2, %xmm0
addss %xmm6, %xmm0
mulss %xmm2, %xmm1
subss %xmm3, %xmm1
movq 0x10(%r14), %rcx
movss 0x8(%rcx), %xmm2
subss %xmm5, %xmm2
movss 0xc(%rcx), %xmm3
subss %xmm4, %xmm3
movslq %ebp, %rdx
leaq 0x10(%rbx,%rdx,4), %rcx
leaq (%rdx,%rdx,2), %rdx
leaq (%r13,%rdx,2), %rdx
movss 0x108(%rbx), %xmm4
movss 0x118(%rbx), %xmm5
movss 0x11c(%rbx), %xmm6
movaps 0x935d(%rip), %xmm7     # 0xe010
xorps %xmm6, %xmm7
xorl %esi, %esi
movss 0x9343(%rip), %xmm8     # 0xe004
movaps 0x9357(%rip), %xmm10    # 0xe020
movsd 0x935e(%rip), %xmm11    # 0xe030
movswl (%rdx), %edi
movswl 0x2(%rdx), %r8d
xorps %xmm12, %xmm12
cvtsi2ss %edi, %xmm12
xorps %xmm14, %xmm14
cvtsi2ss %r8d, %xmm14
movaps %xmm7, %xmm15
mulss %xmm14, %xmm15
movaps %xmm12, %xmm13
mulss %xmm5, %xmm13
addss %xmm15, %xmm13
mulss %xmm5, %xmm14
mulss %xmm6, %xmm12
addss %xmm14, %xmm12
addss %xmm2, %xmm13
addss %xmm3, %xmm12
movaps %xmm1, %xmm15
mulss %xmm12, %xmm15
movaps %xmm13, %xmm14
mulss %xmm0, %xmm12
mulss %xmm1, %xmm13
movswl 0x4(%rdx), %edi
mulss %xmm0, %xmm14
xorps %xmm9, %xmm9
cvtsi2ss %edi, %xmm9
addss %xmm15, %xmm14
subss %xmm13, %xmm12
movaps %xmm8, %xmm13
addss %xmm4, %xmm9
maxss %xmm12, %xmm13
xorps 0x92ab(%rip), %xmm9     # 0xe010
unpcklps %xmm9, %xmm14           # xmm14 = xmm14[0],xmm9[0],xmm14[1],xmm9[1]
shufps $0x0, %xmm13, %xmm13    # xmm13 = xmm13[0,0,0,0]
divps %xmm13, %xmm14
mulps %xmm10, %xmm14
addps %xmm11, %xmm14
cvttps2dq %xmm14, %xmm9
pshuflw $0xe8, %xmm9, %xmm9     # xmm9 = xmm9[0,2,2,3,4,5,6,7]
movd %xmm9, (%rcx,%rsi,4)
addq $0x6, %rdx
incq %rsi
cmpl %esi, %eax
jne 0x4cd2
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq