// File: /workspace/github_cpp_makefile_star2_O3/BartMassey[P]ancient-raytracer/xform.cc
// Function: xform::xform(xform_types, point)
xform::xform( enum xform_types t, point r ) {
  int i, j;

  assert( r.d() > 2 );
  m = &mv;
  mi = &miv;
  for( i = 0; i < 4; i++ )
    for( j = 0; j < 4; j++ ) {
      (*m)[i][j] = 0;
      (*mi)[i][j] = 0;
    }
  switch( t ) {
  case XFORM_TRANSLATE:
    (*m)[0][0] = 1;
    (*m)[1][1] = 1;
    (*m)[2][2] = 1;
    (*m)[3][3] = 1;
    (*m)[0][3] = r[0];
    (*m)[1][3] = r[1];
    (*m)[2][3] = r[2];
    (*mi)[0][0] = 1;
    (*mi)[1][1] = 1;
    (*mi)[2][2] = 1;
    (*mi)[3][3] = 1;
    (*mi)[0][3] = -r[0];
    (*mi)[1][3] = -r[1];
    (*mi)[2][3] = -r[2];
    break;
  case XFORM_SCALE:
    assert( r[0] > TINY && r[1] > TINY && r[2] > TINY );
    (*m)[0][0] = r[0];
    (*m)[1][1] = r[1];
    (*m)[2][2] = r[2];
    (*m)[3][3] = 1;
    (*mi)[0][0] = 1.0/r[0];
    (*mi)[1][1] = 1.0/r[1];
    (*mi)[2][2] = 1.0/r[2];
    (*mi)[3][3] = 1;
    break;
  default:
    assert( 0 );
  }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
leaq 0x6fd3(%rip), %rax      # 0xba60
movq %rax, (%rdi)
cmpl $0x2, 0x8(%rdx)
jle 0x4ce9
movq %rdx, %r14
movq %rdi, %rbx
leaq 0x18(%rdi), %rax
movq %rax, 0x8(%rdi)
leaq 0x58(%rdi), %rax
movq %rax, 0x10(%rdi)
movq $-0x40, %rcx
xorps %xmm0, %xmm0
movups %xmm0, (%rax,%rcx)
movups %xmm0, 0x40(%rax,%rcx)
addq $0x10, %rcx
jne 0x4aba
cmpl $0x2, %esi
je 0x4bab
cmpl $0x1, %esi
jne 0x4d08
movl $0x3f800000, %ebp       # imm = 0x3F800000
movl %ebp, 0x18(%rbx)
movl %ebp, 0x2c(%rbx)
movl %ebp, 0x40(%rbx)
movl %ebp, 0x54(%rbx)
movq (%r14), %rax
movq %r14, %rdi
xorl %esi, %esi
callq *(%rax)
movss (%rax), %xmm0
movq 0x8(%rbx), %rax
movss %xmm0, 0xc(%rax)
movq (%r14), %rax
movq %r14, %rdi
movl $0x1, %esi
callq *(%rax)
movss (%rax), %xmm0
movq 0x8(%rbx), %rax
movss %xmm0, 0x1c(%rax)
movq (%r14), %rax
movq %r14, %rdi
movl $0x2, %esi
callq *(%rax)
movss (%rax), %xmm0
movq 0x8(%rbx), %rax
movss %xmm0, 0x2c(%rax)
movq 0x10(%rbx), %rax
movl %ebp, (%rax)
movl %ebp, 0x14(%rax)
movl %ebp, 0x28(%rax)
movl %ebp, 0x3c(%rax)
movq (%r14), %rax
movq %r14, %rdi
xorl %esi, %esi
callq *(%rax)
movss (%rax), %xmm0
xorps 0x34e5(%rip), %xmm0     # 0x8040
movq 0x10(%rbx), %rax
movss %xmm0, 0xc(%rax)
movq (%r14), %rax
movq %r14, %rdi
movl $0x1, %esi
callq *(%rax)
movss (%rax), %xmm0
xorps 0x34c4(%rip), %xmm0     # 0x8040
movq 0x10(%rbx), %rax
movss %xmm0, 0x1c(%rax)
movq (%r14), %rax
movq %r14, %rdi
movl $0x2, %esi
callq *(%rax)
movss (%rax), %xmm0
xorps 0x34a3(%rip), %xmm0     # 0x8040
movq 0x10(%rbx), %rax
movss %xmm0, 0x2c(%rax)
jmp 0x4cc5
movq (%r14), %rax
movq %r14, %rdi
xorl %esi, %esi
callq *(%rax)
xorps %xmm0, %xmm0
cvtss2sd (%rax), %xmm0
ucomisd 0x34ac(%rip), %xmm0     # 0x8070
jbe 0x4cca
movq (%r14), %rax
movq %r14, %rdi
movl $0x1, %esi
callq *(%rax)
xorps %xmm0, %xmm0
cvtss2sd (%rax), %xmm0
ucomisd 0x348a(%rip), %xmm0     # 0x8070
jbe 0x4cca
movq (%r14), %rax
movq %r14, %rdi
movl $0x2, %esi
callq *(%rax)
xorps %xmm0, %xmm0
cvtss2sd (%rax), %xmm0
ucomisd 0x3468(%rip), %xmm0     # 0x8070
jbe 0x4cca
movq (%r14), %rax
movq %r14, %rdi
xorl %esi, %esi
callq *(%rax)
movss (%rax), %xmm0
movq 0x8(%rbx), %rax
movss %xmm0, (%rax)
movq (%r14), %rax
movq %r14, %rdi
movl $0x1, %esi
callq *(%rax)
movss (%rax), %xmm0
movq 0x8(%rbx), %rax
movss %xmm0, 0x14(%rax)
movq (%r14), %rax
movq %r14, %rdi
movl $0x2, %esi
callq *(%rax)
movss (%rax), %xmm0
movq 0x8(%rbx), %rax
movss %xmm0, 0x28(%rax)
movl $0x3f800000, %ebp       # imm = 0x3F800000
movl %ebp, 0x3c(%rax)
movq (%r14), %rax
movq %r14, %rdi
xorl %esi, %esi
callq *(%rax)
movss 0x33e6(%rip), %xmm0     # 0x8058
divss (%rax), %xmm0
movq 0x10(%rbx), %rax
movss %xmm0, (%rax)
movq (%r14), %rax
movq %r14, %rdi
movl $0x1, %esi
callq *(%rax)
movss 0x33c5(%rip), %xmm0     # 0x8058
divss (%rax), %xmm0
movq 0x10(%rbx), %rax
movss %xmm0, 0x14(%rax)
movq (%r14), %rax
movq %r14, %rdi
movl $0x2, %esi
callq *(%rax)
movss 0x33a3(%rip), %xmm0     # 0x8058
divss (%rax), %xmm0
movq 0x10(%rbx), %rax
movss %xmm0, 0x28(%rax)
movl %ebp, 0x3c(%rax)
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x3801(%rip), %rdi      # 0x84d2
leaq 0x377c(%rip), %rsi      # 0x8454
leaq 0x37cd(%rip), %rcx      # 0x84ac
movl $0x79, %edx
callq 0x2080
leaq 0x37b2(%rip), %rdi      # 0x84a2
leaq 0x375d(%rip), %rsi      # 0x8454
leaq 0x37ae(%rip), %rcx      # 0x84ac
movl $0x5f, %edx
callq 0x2080
leaq 0x35e4(%rip), %rdi      # 0x82f3
leaq 0x373e(%rip), %rsi      # 0x8454
leaq 0x378f(%rip), %rcx      # 0x84ac
movl $0x84, %edx
callq 0x2080
nop