#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
float M_PI;
float cos(float);
float sin(float);
float sqrt(double);
int /*<<< orphan*/ xrotatemat(float **, float, float);
int /*<<< orphan*/ yrotatemat(float **, float, float);
int /*<<< orphan*/ zrotatemat(float **, float, float);
void simplehuerotatemat(float mat[4][4], float rot) {
  float mag;
  float xrs, xrc;
  float yrs, yrc;
  float zrs, zrc;
  mag = sqrt(2.0);
  xrs = 1.0 / mag;
  xrc = 1.0 / mag;
  xrotatemat(mat, xrs, xrc);
  mag = sqrt(3.0);
  yrs = -1.0 / mag;
  yrc = sqrt(2.0) / mag;
  yrotatemat(mat, yrs, yrc);
  zrs = sin(rot * M_PI / 180.0);
  zrc = cos(rot * M_PI / 180.0);
  zrotatemat(mat, zrs, zrc);
  yrotatemat(mat, -yrs, yrc);
  xrotatemat(mat, -xrs, xrc);
}


x86 assembly (clang, -O0):
<simplehuerotatemat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movsd  0xe8f(%rip),%xmm0
call   1070 <sqrt@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe8c(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe6e(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
movss  -0x14(%rbp),%xmm0
movss  -0x18(%rbp),%xmm1
call   1050 <xrotatemat@plt>
movsd  0xe3e(%rip),%xmm0
call   1070 <sqrt@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe1b(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
movsd  0xdfe(%rip),%xmm0
call   1070 <sqrt@plt>
divss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
movss  -0x1c(%rbp),%xmm0
movss  -0x20(%rbp),%xmm1
call   1080 <yrotatemat@plt>
movss  -0xc(%rbp),%xmm0
mov    0x2db0(%rip),%rax
mulss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdb8(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1040 <sin@plt>
movss  %xmm0,-0x24(%rbp)
movss  -0xc(%rbp),%xmm0
mov    0x2d82(%rip),%rax
mulss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd8a(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1060 <cos@plt>
movss  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
movss  -0x24(%rbp),%xmm0
movss  -0x28(%rbp),%xmm1
call   1030 <zrotatemat@plt>
mov    -0x8(%rbp),%rdi
movss  -0x1c(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  -0x20(%rbp),%xmm1
call   1080 <yrotatemat@plt>
mov    -0x8(%rbp),%rdi
movss  -0x14(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  -0x18(%rbp),%xmm1
call   1050 <xrotatemat@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<simplehuerotatemat>:
push   %r14
push   %rbx
sub    $0x38,%rsp
movss  %xmm0,0x8(%rsp)
mov    %rdi,%rbx
movsd  0xe88(%rip),%xmm0
call   1070 <sqrt@plt>
movss  0xe8b(%rip),%xmm1
divss  %xmm0,%xmm1
movaps %xmm1,0x20(%rsp)
mov    %rbx,%rdi
movaps %xmm1,%xmm0
call   1050 <xrotatemat@plt>
movsd  0xe67(%rip),%xmm0
call   1070 <sqrt@plt>
movss  %xmm0,0x4(%rsp)
movss  0xe60(%rip),%xmm1
divss  %xmm0,%xmm1
movaps %xmm1,0x10(%rsp)
movsd  0xe3b(%rip),%xmm0
call   1070 <sqrt@plt>
movaps %xmm0,%xmm1
divss  0x4(%rsp),%xmm1
movss  %xmm1,0x4(%rsp)
mov    %rbx,%rdi
movaps 0x10(%rsp),%xmm0
call   1080 <yrotatemat@plt>
mov    0x2dfb(%rip),%r14
movss  (%r14),%xmm0
mulss  0x8(%rsp),%xmm0
divss  0xe18(%rip),%xmm0
call   1040 <sin@plt>
movss  %xmm0,0xc(%rsp)
movss  0x8(%rsp),%xmm0
mulss  (%r14),%xmm0
divss  0xdfa(%rip),%xmm0
call   1060 <cos@plt>
movaps %xmm0,%xmm1
mov    %rbx,%rdi
movss  0xc(%rsp),%xmm0
call   1030 <zrotatemat@plt>
movaps 0x10(%rsp),%xmm0
xorps  0xde0(%rip),%xmm0
mov    %rbx,%rdi
movss  0x4(%rsp),%xmm1
call   1080 <yrotatemat@plt>
movaps 0x20(%rsp),%xmm1
movaps 0xdc6(%rip),%xmm0
xorps  %xmm1,%xmm0
mov    %rbx,%rdi
add    $0x38,%rsp
pop    %rbx
pop    %r14
jmp    1050 <xrotatemat@plt>

LLVM IR (-O0):
@M_PI = global float 0.000000e+00
define void @simplehuerotatemat([4 x float]* %0, float %1) {
%3 = alloca [4 x float]*
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
store [4 x float]* %0, [4 x float]** %3
store float %1, float* %4
%12 = call float @sqrt(double 2.000000e+00)
store float %12, float* %5
%13 = load float, float* %5
%14 = fpext float %13 to double
%15 = fdiv double 1.000000e+00, %14
%16 = fptrunc double %15 to float
store float %16, float* %6
%17 = load float, float* %5
%18 = fpext float %17 to double
%19 = fdiv double 1.000000e+00, %18
%20 = fptrunc double %19 to float
store float %20, float* %7
%21 = load [4 x float]*, [4 x float]** %3
%22 = bitcast [4 x float]* %21 to float**
%23 = load float, float* %6
%24 = load float, float* %7
%25 = call i32 @xrotatemat(float** %22, float %23, float %24)
%26 = call float @sqrt(double 3.000000e+00)
store float %26, float* %5
%27 = load float, float* %5
%28 = fpext float %27 to double
%29 = fdiv double -1.000000e+00, %28
%30 = fptrunc double %29 to float
store float %30, float* %8
%31 = call float @sqrt(double 2.000000e+00)
%32 = load float, float* %5
%33 = fdiv float %31, %32
store float %33, float* %9
%34 = load [4 x float]*, [4 x float]** %3
%35 = bitcast [4 x float]* %34 to float**
%36 = load float, float* %8
%37 = load float, float* %9
%38 = call i32 @yrotatemat(float** %35, float %36, float %37)
%39 = load float, float* %4
%40 = load float, float* @M_PI
%41 = fmul float %39, %40
%42 = fpext float %41 to double
%43 = fdiv double %42, 1.800000e+02
%44 = fptrunc double %43 to float
%45 = call float @sin(float %44)
store float %45, float* %10
%46 = load float, float* %4
%47 = load float, float* @M_PI
%48 = fmul float %46, %47
%49 = fpext float %48 to double
%50 = fdiv double %49, 1.800000e+02
%51 = fptrunc double %50 to float
%52 = call float @cos(float %51)
store float %52, float* %11
%53 = load [4 x float]*, [4 x float]** %3
%54 = bitcast [4 x float]* %53 to float**
%55 = load float, float* %10
%56 = load float, float* %11
%57 = call i32 @zrotatemat(float** %54, float %55, float %56)
%58 = load [4 x float]*, [4 x float]** %3
%59 = bitcast [4 x float]* %58 to float**
%60 = load float, float* %8
%61 = fneg float %60
%62 = load float, float* %9
%63 = call i32 @yrotatemat(float** %59, float %61, float %62)
%64 = load [4 x float]*, [4 x float]** %3
%65 = bitcast [4 x float]* %64 to float**
%66 = load float, float* %6
%67 = fneg float %66
%68 = load float, float* %7
%69 = call i32 @xrotatemat(float** %65, float %67, float %68)
ret void
}

LLVM IR (-O2):
@M_PI = global float 0.000000e+00
define void @simplehuerotatemat([4 x float]* %0, float %1) {
%3 = tail call float @sqrt(double 2.000000e+00)
%4 = fdiv float 1.000000e+00, %3
%5 = bitcast [4 x float]* %0 to float**
%6 = tail call i32 @xrotatemat(float** %5, float %4, float %4)
%7 = tail call float @sqrt(double 3.000000e+00)
%8 = fdiv float -1.000000e+00, %7
%9 = tail call float @sqrt(double 2.000000e+00)
%10 = fdiv float %9, %7
%11 = tail call i32 @yrotatemat(float** %5, float %8, float %10)
%12 = load float, float* @M_PI
%13 = fmul float %12, %1
%14 = fdiv float %13, 1.800000e+02
%15 = tail call float @sin(float %14)
%16 = load float, float* @M_PI
%17 = fmul float %16, %1
%18 = fdiv float %17, 1.800000e+02
%19 = tail call float @cos(float %18)
%20 = tail call i32 @zrotatemat(float** %5, float %15, float %19)
%21 = fneg float %8
%22 = tail call i32 @yrotatemat(float** %5, float %21, float %10)
%23 = fneg float %4
%24 = tail call i32 @xrotatemat(float** %5, float %23, float %4)
ret void
}