// File: /workspace/github_cpp_makefile_star2_O1/IsaacLaw12[P]RayTracer/./src/Transformation.cpp
// Function: Transformation::create_transform_matrix(double*)
void Transformation::create_transform_matrix(double transform_string[]){
    double rot_trans_x = transform_string[0];
    double rot_trans_y = transform_string[1];
    double rot_trans_z = transform_string[2];
    double deg_angle   = transform_string[3];
    double scale       = transform_string[4];
    double translate_x = transform_string[5];
    double translate_y = transform_string[6];
    double translate_z = transform_string[7];

    // Populate rotation matrices
    Eigen::Vector3d Wv = Eigen::Vector3d(rot_trans_x, rot_trans_y, rot_trans_z).normalized();
    Eigen::Vector3d Uv = Eigen::Vector3d(Wv);
    Eigen::Vector3d Vv;

    // Make sure Uv is not parallel to Wv
    int minindex;
    Uv.minCoeff(&minindex);
    if (Uv(minindex) == -1)
        // (-1 0 0) is a special case because it would change to (1 0 0)
        //     which is parallel
        minindex = (minindex + 1) % 3;
    Uv(minindex) = 1.0;

    Uv = Wv.cross(Uv).normalized();
    Vv = Wv.cross(Uv).normalized();

    normalize_z_rotate << Uv[0], Uv[1], Uv[2], 0,
                          Vv[0], Vv[1], Vv[2], 0,
                          Wv[0], Wv[1], Wv[2], 0,
                          0,     0,     0,     1;

    double rad_angle = (deg_angle * M_PI) / 180;
    double cos_angle = cos(rad_angle);
    double sin_angle = sin(rad_angle);
    rotate_matrix(0,0) = cos_angle;
    rotate_matrix(1,1) = cos_angle;
    rotate_matrix(0,1) = -sin_angle;
    rotate_matrix(1,0) = sin_angle;

    // Populate scale matrix
    scale_matrix(0,0) = scale;
    scale_matrix(1,1) = scale;
    scale_matrix(2,2) = scale;

    // Populate translate matrix
    translate_matrix(0,3) = translate_x;
    translate_matrix(1,3) = translate_y;
    translate_matrix(2,3) = translate_z;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0xe8, %rsp
movq %rdi, %rbx
movupd (%rsi), %xmm1
movsd 0x10(%rsi), %xmm0
movapd %xmm1, %xmm2
mulpd %xmm1, %xmm2
movapd %xmm2, %xmm3
unpckhpd %xmm2, %xmm3            # xmm3 = xmm3[1],xmm2[1]
addsd %xmm2, %xmm3
movapd %xmm0, %xmm2
mulsd %xmm0, %xmm2
addsd %xmm3, %xmm2
xorpd %xmm3, %xmm3
ucomisd %xmm3, %xmm2
jbe 0x111ec
movq %xmm2, %xmm2            # xmm2 = xmm2[0],zero
sqrtpd %xmm2, %xmm2
divsd %xmm2, %xmm0
unpcklpd %xmm2, %xmm2            # xmm2 = xmm2[0,0]
divpd %xmm2, %xmm1
movapd %xmm1, 0x30(%rsp)
movsd %xmm0, 0x40(%rsp)
movsd 0x18(%rsi), %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0x20(%rsi), %xmm9
movups 0x28(%rsi), %xmm10
movsd 0x38(%rsi), %xmm11
movq 0x40(%rsp), %rax
movq %rax, 0x20(%rsp)
movaps 0x30(%rsp), %xmm0
movaps %xmm0, 0x10(%rsp)
movsd 0x10(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
xorl %eax, %eax
ucomisd %xmm1, %xmm0
seta %al
minsd %xmm0, %xmm1
ucomisd 0x20(%rsp), %xmm1
movl $0x2, %ecx
cmovbel %eax, %ecx
leal 0x1(%rcx), %edx
xorl %eax, %eax
cmpl $0x3, %edx
cmovnel %edx, %eax
movl %ecx, %edx
movsd 0x10(%rsp,%rdx,8), %xmm0
ucomisd 0x5c4e(%rip), %xmm0     # 0x16eb8
cmovnel %ecx, %eax
cmovpl %ecx, %eax
cmpl $0x3, %eax
jae 0x115b0
movl %eax, %eax
movabsq $0x3ff0000000000000, %r14 # imm = 0x3FF0000000000000
movq %r14, 0x10(%rsp,%rax,8)
movsd 0x10(%rsp), %xmm6
movsd 0x30(%rsp), %xmm0
movupd 0x38(%rsp), %xmm1
movapd %xmm1, %xmm3
shufpd $0x1, %xmm0, %xmm3      # xmm3 = xmm3[1],xmm0[0]
movapd 0x5c63(%rip), %xmm2     # 0x16f10
movupd 0x18(%rsp), %xmm5
movapd %xmm5, %xmm7
mulpd %xmm3, %xmm7
xorpd %xmm2, %xmm3
movapd %xmm0, %xmm4
mulsd %xmm5, %xmm4
shufpd $0x1, %xmm6, %xmm5      # xmm5 = xmm5[1],xmm6[0]
mulpd %xmm1, %xmm5
subpd %xmm7, %xmm5
xorpd %xmm1, %xmm2
mulsd %xmm1, %xmm6
subsd %xmm6, %xmm4
movapd %xmm5, %xmm6
mulpd %xmm5, %xmm6
movapd %xmm6, %xmm8
unpckhpd %xmm6, %xmm8            # xmm8 = xmm8[1],xmm6[1]
addsd %xmm6, %xmm8
movapd %xmm4, %xmm7
mulsd %xmm4, %xmm7
addsd %xmm8, %xmm7
xorpd %xmm6, %xmm6
ucomisd %xmm6, %xmm7
jbe 0x11322
movq %xmm7, %xmm7            # xmm7 = xmm7[0],zero
sqrtpd %xmm7, %xmm7
divsd %xmm7, %xmm4
unpcklpd %xmm7, %xmm7            # xmm7 = xmm7[0,0]
divpd %xmm7, %xmm5
leaq 0x18(%rsp), %rsi
movapd %xmm5, -0x8(%rsi)
movsd %xmm4, 0x8(%rsi)
movsd -0x8(%rsi), %xmm5
movsd (%rsi), %xmm7
mulsd %xmm7, %xmm0
unpcklpd %xmm4, %xmm7            # xmm7 = xmm7[0],xmm4[0]
mulpd %xmm3, %xmm7
unpcklpd %xmm5, %xmm4            # xmm4 = xmm4[0],xmm5[0]
mulpd %xmm4, %xmm1
addpd %xmm7, %xmm1
mulsd %xmm5, %xmm2
addsd %xmm2, %xmm0
movapd %xmm1, %xmm2
mulpd %xmm1, %xmm2
movapd %xmm2, %xmm3
unpckhpd %xmm2, %xmm3            # xmm3 = xmm3[1],xmm2[1]
addsd %xmm2, %xmm3
movapd %xmm0, %xmm2
mulsd %xmm0, %xmm2
addsd %xmm3, %xmm2
ucomisd %xmm6, %xmm2
movsd %xmm9, 0x58(%rsp)
movaps %xmm10, 0xa0(%rsp)
movsd %xmm11, 0x50(%rsp)
jbe 0x113ab
movq %xmm2, %xmm2            # xmm2 = xmm2[0],zero
sqrtpd %xmm2, %xmm2
divsd %xmm2, %xmm0
unpcklpd %xmm2, %xmm2            # xmm2 = xmm2[0,0]
divpd %xmm2, %xmm1
movapd %xmm1, 0x80(%rsp)
movsd %xmm0, 0x90(%rsp)
leaq 0x50(%rbx), %rax
leaq 0x60(%rsp), %rdi
movq %rax, (%rdi)
movq $0x0, 0x8(%rdi)
movl $0x1, %eax
movq %rax, 0x10(%rdi)
movq %rax, 0x18(%rdi)
movsd %xmm5, 0x50(%rbx)
callq 0x11c04
leaq 0x20(%rsp), %rsi
movq %rax, %rdi
callq 0x11c04
leaq 0xe0(%rsp), %rsi
movq $0x0, (%rsi)
movq %rax, %rdi
callq 0x11c04
leaq 0x80(%rsp), %rsi
movq %rax, %rdi
callq 0x11c04
leaq 0x88(%rsp), %rsi
movq %rax, %rdi
callq 0x11c04
leaq 0x90(%rsp), %rsi
movq %rax, %rdi
callq 0x11c04
leaq 0xd8(%rsp), %rsi
movq $0x0, (%rsi)
movq %rax, %rdi
callq 0x11c04
leaq 0x30(%rsp), %rsi
movq %rax, %rdi
callq 0x11c04
leaq 0x38(%rsp), %rsi
movq %rax, %rdi
callq 0x11c04
leaq 0x40(%rsp), %rsi
movq %rax, %rdi
callq 0x11c04
leaq 0xd0(%rsp), %rsi
movq $0x0, (%rsi)
movq %rax, %rdi
callq 0x11c04
leaq 0xc8(%rsp), %rsi
movq $0x0, (%rsi)
movq %rax, %rdi
callq 0x11c04
leaq 0xc0(%rsp), %rsi
movq $0x0, (%rsi)
movq %rax, %rdi
callq 0x11c04
leaq 0xb8(%rsp), %rsi
movq $0x0, (%rsi)
movq %rax, %rdi
callq 0x11c04
leaq 0xb0(%rsp), %rsi
movq %r14, (%rsi)
movq %rax, %rdi
callq 0x11c04
movq 0x78(%rsp), %rax
addq 0x68(%rsp), %rax
cmpq $0x4, %rax
jne 0x115fd
cmpq $0x4, 0x70(%rsp)
jne 0x115fd
movsd 0x8(%rsp), %xmm0
mulsd 0x69d1(%rip), %xmm0     # 0x17ee8
divsd 0x69d1(%rip), %xmm0     # 0x17ef0
movsd %xmm0, 0x8(%rsp)
callq 0x34f0
movsd %xmm0, 0x48(%rsp)
movsd 0x8(%rsp), %xmm0
callq 0x3090
movsd 0x48(%rsp), %xmm1
movsd %xmm1, 0xd0(%rbx)
movsd %xmm1, 0xf8(%rbx)
movaps 0x59b8(%rip), %xmm1     # 0x16f10
xorps %xmm0, %xmm1
movlps %xmm1, 0xf0(%rbx)
movsd %xmm0, 0xd8(%rbx)
movsd 0x58(%rsp), %xmm0
movsd %xmm0, 0x150(%rbx)
movsd %xmm0, 0x178(%rbx)
movsd %xmm0, 0x1a0(%rbx)
movaps 0xa0(%rsp), %xmm0
movaps %xmm0, 0x230(%rbx)
movsd 0x50(%rsp), %xmm0
movsd %xmm0, 0x240(%rbx)
addq $0xe8, %rsp
popq %rbx
popq %r14
retq
leaq 0x69e8(%rip), %rdi      # 0x17f9f
leaq 0x4f0a(%rip), %rsi      # 0x164c8
leaq 0x69f7(%rip), %rcx      # 0x17fbc
movl $0x1a9, %edx            # imm = 0x1A9
callq 0x31a0
jmp 0x115dd
jmp 0x115dd
jmp 0x115dd
jmp 0x115dd
jmp 0x115dd
jmp 0x115dd
jmp 0x115dd
movq 0x78(%rsp), %rcx
addq 0x68(%rsp), %rcx
cmpq $0x4, %rcx
jne 0x115fd
cmpq $0x4, 0x70(%rsp)
jne 0x115fd
movq %rax, %rdi
callq 0x34b0
leaq 0x5344(%rip), %rdi      # 0x16948
leaq 0x53db(%rip), %rsi      # 0x169e6
leaq 0x6a2f(%rip), %rcx      # 0x18041
movl $0x78, %edx
callq 0x31a0