// File: /workspace/github_cpp_makefile_star2_O2/BartMassey[P]ancient-raytracer/xform.cc
// Function: xform::xform(xform_types, float)
xform::xform( enum xform_types t, float a ) {
  int i, j;
  float ca = cos(a);
  float sa = sin(a);

#if DEBUGLEVEL > 0
  // check for small floating-point errors in trig functions
  assert( ca <= 1 );
  assert( ca >= -1 );
  assert( sa <= 1 );
  assert( ca >= -1 );
#endif
  // now generate the xform
  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_ROTATE_X:
    (*m)[0][0] = 1;
    (*m)[3][3] = 1;
    (*m)[1][1] = ca;
    (*m)[2][2] = ca;
    (*m)[1][2] = -sa;
    (*m)[2][1] = sa;
    (*mi)[0][0] = 1;
    (*mi)[3][3] = 1;
    (*mi)[1][1] = ca;
    (*mi)[2][2] = ca;
    (*mi)[1][2] = sa;
    (*mi)[2][1] = -sa;
    break;
  case XFORM_ROTATE_Y:
    (*m)[1][1] = 1;
    (*m)[3][3] = 1;
    (*m)[0][0] = ca;
    (*m)[2][2] = ca;
    (*m)[2][0] = -sa;
    (*m)[0][2] = sa;
    (*mi)[1][1] = 1;
    (*mi)[3][3] = 1;
    (*mi)[0][0] = ca;
    (*mi)[2][2] = ca;
    (*mi)[2][0] = sa;
    (*mi)[0][2] = -sa;
    break;
  case XFORM_ROTATE_Z:
    (*m)[2][2] = 1;
    (*m)[3][3] = 1;
    (*m)[0][0] = ca;
    (*m)[1][1] = ca;
    (*m)[0][1] = -sa;
    (*m)[1][0] = sa;
    (*mi)[2][2] = 1;
    (*mi)[3][3] = 1;
    (*mi)[0][0] = ca;
    (*mi)[1][1] = ca;
    (*mi)[0][1] = sa;
    (*mi)[1][0] = -sa;
    break;
  default:
    assert( 0 );
  }
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movss %xmm0, (%rsp)
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x5d12(%rip), %rax      # 0x9a60
movq %rax, (%rdi)
callq 0x2080
movss %xmm0, 0x4(%rsp)
movss (%rsp), %xmm0
callq 0x20a0
leaq 0x18(%rbx), %rax
movq %rax, 0x8(%rbx)
leaq 0x58(%rbx), %rax
movq %rax, 0x10(%rbx)
xorl %ecx, %ecx
movq %rax, %rdx
cmpq $0x4, %rcx
je 0x3da0
xorl %esi, %esi
cmpq $0x4, %rsi
je 0x3d97
andl $0x0, -0x40(%rdx,%rsi,4)
andl $0x0, (%rdx,%rsi,4)
incq %rsi
jmp 0x3d83
incq %rcx
addq $0x10, %rdx
jmp 0x3d7b
cmpl $0x5, %ebp
movss 0x4(%rsp), %xmm3
je 0x3e40
cmpl $0x4, %ebp
je 0x3e01
cmpl $0x3, %ebp
jne 0x3e98
movl $0x3f800000, %eax       # imm = 0x3F800000
movl %eax, 0x18(%rbx)
movss %xmm3, 0x2c(%rbx)
movss %xmm3, 0x40(%rbx)
movaps 0x226a(%rip), %xmm1     # 0x6040
xorps %xmm0, %xmm1
movss %xmm1, 0x30(%rbx)
movss %xmm0, 0x3c(%rbx)
movsd 0x2605(%rip), %xmm2     # 0x63f0
movsd %xmm2, 0x54(%rbx)
movl %eax, 0x94(%rbx)
leaq 0x6c(%rbx), %rax
pushq $0x7c
popq %rcx
pushq $0x70
jmp 0x3e38
movl $0x3f800000, %ecx       # imm = 0x3F800000
movl %ecx, 0x2c(%rbx)
movl %ecx, 0x54(%rbx)
movss %xmm3, 0x18(%rbx)
movss %xmm3, 0x40(%rbx)
movaps 0x2223(%rip), %xmm1     # 0x6040
xorps %xmm0, %xmm1
movss %xmm1, 0x38(%rbx)
movss %xmm0, 0x20(%rbx)
movl %ecx, 0x6c(%rbx)
movl %ecx, 0x94(%rbx)
pushq $0x60
popq %rcx
pushq $0x78
popq %rdx
movl $0x80, %esi
jmp 0x3e7e
movl $0x3f800000, %ecx       # imm = 0x3F800000
movl %ecx, 0x40(%rbx)
movl %ecx, 0x54(%rbx)
movss %xmm3, 0x18(%rbx)
movss %xmm3, 0x2c(%rbx)
movaps 0x21e4(%rip), %xmm1     # 0x6040
xorps %xmm0, %xmm1
movss %xmm1, 0x1c(%rbx)
movss %xmm0, 0x28(%rbx)
movl %ecx, 0x80(%rbx)
movl %ecx, 0x94(%rbx)
pushq $0x68
popq %rcx
pushq $0x5c
popq %rdx
pushq $0x6c
popq %rsi
movss %xmm3, (%rax)
movss %xmm3, (%rbx,%rsi)
movss %xmm0, (%rbx,%rdx)
movss %xmm1, (%rbx,%rcx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0x2444(%rip), %rdi      # 0x62e3
leaq 0x256e(%rip), %rsi      # 0x6414
leaq 0x258f(%rip), %rcx      # 0x643c
pushq $0x58
popq %rdx
callq 0x2070
nop