// File: /workspace/github_c_makefile_star2_O1/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 0x4de2
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 0x9333(%rip), %xmm7     # 0xe020
xorps %xmm6, %xmm7
xorl %esi, %esi
movss 0x930d(%rip), %xmm9     # 0xe008
movss 0x9308(%rip), %xmm10    # 0xe00c
movss 0x9303(%rip), %xmm11    # 0xe010
movswl (%rdx), %edi
movswl 0x2(%rdx), %r8d
xorps %xmm12, %xmm12
cvtsi2ss %edi, %xmm12
xorps %xmm13, %xmm13
cvtsi2ss %r8d, %xmm13
movaps %xmm7, %xmm15
mulss %xmm13, %xmm15
movaps %xmm12, %xmm14
mulss %xmm5, %xmm14
addss %xmm15, %xmm14
mulss %xmm5, %xmm13
mulss %xmm6, %xmm12
addss %xmm13, %xmm12
addss %xmm2, %xmm14
addss %xmm3, %xmm12
movaps %xmm1, %xmm15
mulss %xmm12, %xmm15
movaps %xmm14, %xmm13
mulss %xmm0, %xmm12
mulss %xmm1, %xmm14
movswl 0x4(%rdx), %edi
mulss %xmm0, %xmm13
xorps %xmm8, %xmm8
cvtsi2ss %edi, %xmm8
addss %xmm15, %xmm13
subss %xmm14, %xmm12
movss 0x9271(%rip), %xmm14    # 0xe004
addss %xmm4, %xmm8
maxss %xmm12, %xmm14
divss %xmm14, %xmm13
mulss %xmm9, %xmm13
divss %xmm14, %xmm8
addss %xmm10, %xmm13
mulss %xmm9, %xmm8
movaps %xmm11, %xmm12
cvttss2si %xmm13, %edi
subss %xmm8, %xmm12
cvttss2si %xmm12, %r8d
movw %di, (%rcx,%rsi,4)
movw %r8w, 0x2(%rcx,%rsi,4)
addq $0x6, %rdx
incq %rsi
cmpl %esi, %eax
jne 0x4d0d
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq