#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);
int /*<<< orphan*/ identmat(float *);
int /*<<< orphan*/ matrixmult(float **, float **, float **);
float sin(float);
float sqrt(double);
int /*<<< orphan*/ xformpnt(float **, double, double, double, float *, float *,
                            float *);
int /*<<< orphan*/ xrotatemat(float **, float, float);
int /*<<< orphan*/ yrotatemat(float **, float, float);
int /*<<< orphan*/ zrotatemat(float **, float, float);
int /*<<< orphan*/ zshearmat(float **, float, float);
void huerotatemat(float mat[4][4], float rot) {
  float mmat[4][4];
  float mag;
  float lx, ly, lz;
  float xrs, xrc;
  float yrs, yrc;
  float zrs, zrc;
  float zsx, zsy;
  identmat((float *)mmat);
  mag = sqrt(2.0);
  xrs = 1.0 / mag;
  xrc = 1.0 / mag;
  xrotatemat(mmat, xrs, xrc);
  mag = sqrt(3.0);
  yrs = -1.0 / mag;
  yrc = sqrt(2.0) / mag;
  yrotatemat(mmat, yrs, yrc);
  xformpnt(mmat, (0.2126), (0.7152), (0.0722), &lx, &ly, &lz);
  zsx = lx / lz;
  zsy = ly / lz;
  zshearmat(mmat, zsx, zsy);
  zrs = sin(rot * M_PI / 180.0);
  zrc = cos(rot * M_PI / 180.0);
  zrotatemat(mmat, zrs, zrc);
  zshearmat(mmat, -zsx, -zsy);
  yrotatemat(mmat, -yrs, yrc);
  xrotatemat(mmat, -xrs, xrc);
  matrixmult(mmat, mat, mat);
}


x86 assembly (clang, -O0):
<huerotatemat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
lea    -0x50(%rbp),%rdi
call   1040 <identmat@plt>
movsd  0xe5b(%rip),%xmm0
call   10b0 <sqrt@plt>
movss  %xmm0,-0x54(%rbp)
movss  -0x54(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe58(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x64(%rbp)
movss  -0x54(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe3a(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x68(%rbp)
lea    -0x50(%rbp),%rdi
movss  -0x64(%rbp),%xmm0
movss  -0x68(%rbp),%xmm1
call   1080 <xrotatemat@plt>
movsd  0xe0a(%rip),%xmm0
call   10b0 <sqrt@plt>
movss  %xmm0,-0x54(%rbp)
movss  -0x54(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xde7(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x6c(%rbp)
movsd  0xdca(%rip),%xmm0
call   10b0 <sqrt@plt>
divss  -0x54(%rbp),%xmm0
movss  %xmm0,-0x70(%rbp)
lea    -0x50(%rbp),%rdi
movss  -0x6c(%rbp),%xmm0
movss  -0x70(%rbp),%xmm1
call   10c0 <yrotatemat@plt>
lea    -0x50(%rbp),%rdi
movsd  0xd84(%rip),%xmm0
movsd  0xd84(%rip),%xmm1
movsd  0xd84(%rip),%xmm2
lea    -0x58(%rbp),%rsi
lea    -0x5c(%rbp),%rdx
lea    -0x60(%rbp),%rcx
call   1060 <xformpnt@plt>
movss  -0x58(%rbp),%xmm0
divss  -0x60(%rbp),%xmm0
movss  %xmm0,-0x7c(%rbp)
movss  -0x5c(%rbp),%xmm0
divss  -0x60(%rbp),%xmm0
movss  %xmm0,-0x80(%rbp)
lea    -0x50(%rbp),%rdi
movss  -0x7c(%rbp),%xmm0
movss  -0x80(%rbp),%xmm1
call   1050 <zshearmat@plt>
movss  -0xc(%rbp),%xmm0
mov    0x2d06(%rip),%rax
mulss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd0e(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1070 <sin@plt>
movss  %xmm0,-0x74(%rbp)
movss  -0xc(%rbp),%xmm0
mov    0x2cd8(%rip),%rax
mulss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xce0(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1090 <cos@plt>
movss  %xmm0,-0x78(%rbp)
lea    -0x50(%rbp),%rdi
movss  -0x74(%rbp),%xmm0
movss  -0x78(%rbp),%xmm1
call   1030 <zrotatemat@plt>
lea    -0x50(%rbp),%rdi
movss  -0x7c(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  -0x80(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
call   1050 <zshearmat@plt>
lea    -0x50(%rbp),%rdi
movss  -0x6c(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  -0x70(%rbp),%xmm1
call   10c0 <yrotatemat@plt>
lea    -0x50(%rbp),%rdi
movss  -0x64(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  -0x68(%rbp),%xmm1
call   1080 <xrotatemat@plt>
lea    -0x50(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x8(%rbp),%rdx
call   10a0 <matrixmult@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<huerotatemat>:
push   %r15
push   %r14
push   %rbx
sub    $0xa0,%rsp
movss  %xmm0,0xc(%rsp)
mov    %rdi,%r14
lea    0x60(%rsp),%r15
mov    %r15,%rdi
call   1040 <identmat@plt>
movsd  0xe36(%rip),%xmm0
call   10b0 <sqrt@plt>
movss  0xe51(%rip),%xmm1
divss  %xmm0,%xmm1
movaps %xmm1,0x50(%rsp)
mov    %r15,%rdi
movaps %xmm1,%xmm0
call   1080 <xrotatemat@plt>
movsd  0xe15(%rip),%xmm0
call   10b0 <sqrt@plt>
movss  %xmm0,0x8(%rsp)
movss  0xe26(%rip),%xmm1
divss  %xmm0,%xmm1
movaps %xmm1,0x20(%rsp)
movsd  0xde9(%rip),%xmm0
call   10b0 <sqrt@plt>
movaps %xmm0,%xmm1
divss  0x8(%rsp),%xmm1
movss  %xmm1,0x8(%rsp)
mov    %r15,%rdi
movaps 0x20(%rsp),%xmm0
call   10c0 <yrotatemat@plt>
movsd  0xdd0(%rip),%xmm0
movsd  0xdd0(%rip),%xmm1
movsd  0xdd0(%rip),%xmm2
lea    0x1c(%rsp),%rsi
lea    0x18(%rsp),%rdx
lea    0x14(%rsp),%rcx
mov    %r15,%rdi
call   1060 <xformpnt@plt>
movss  0x1c(%rsp),%xmm0
movss  0x14(%rsp),%xmm2
divss  %xmm2,%xmm0
movaps %xmm0,0x30(%rsp)
movss  0x18(%rsp),%xmm1
divss  %xmm2,%xmm1
movaps %xmm1,0x40(%rsp)
mov    %r15,%rdi
call   1050 <zshearmat@plt>
mov    0x2d4e(%rip),%rbx
movss  (%rbx),%xmm0
mulss  0xc(%rsp),%xmm0
divss  0xd84(%rip),%xmm0
call   1070 <sin@plt>
movss  %xmm0,0x10(%rsp)
movss  0xc(%rsp),%xmm0
mulss  (%rbx),%xmm0
divss  0xd67(%rip),%xmm0
call   1090 <cos@plt>
movaps %xmm0,%xmm1
mov    %r15,%rdi
movss  0x10(%rsp),%xmm0
call   1030 <zrotatemat@plt>
movaps 0xd5a(%rip),%xmm2
movaps 0x30(%rsp),%xmm0
xorps  %xmm2,%xmm0
movaps 0x40(%rsp),%xmm1
xorps  %xmm2,%xmm1
mov    %r15,%rdi
call   1050 <zshearmat@plt>
movaps 0x20(%rsp),%xmm0
xorps  0xd36(%rip),%xmm0
mov    %r15,%rdi
movss  0x8(%rsp),%xmm1
call   10c0 <yrotatemat@plt>
movaps 0x50(%rsp),%xmm1
movaps 0xd1c(%rip),%xmm0
xorps  %xmm1,%xmm0
mov    %r15,%rdi
call   1080 <xrotatemat@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r14,%rdx
call   10a0 <matrixmult@plt>
add    $0xa0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@M_PI = global float 0.000000e+00
define void @huerotatemat([4 x float]* %0, float %1) {
%3 = alloca [4 x float]*
%4 = alloca float
%5 = alloca [4 x [4 x float]]
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca float
%15 = alloca float
%16 = alloca float
%17 = alloca float
store [4 x float]* %0, [4 x float]** %3
store float %1, float* %4
%18 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %5, i64 0, i64 0
%19 = bitcast [4 x float]* %18 to float*
%20 = call i32 @identmat(float* %19)
%21 = call float @sqrt(double 2.000000e+00)
store float %21, float* %6
%22 = load float, float* %6
%23 = fpext float %22 to double
%24 = fdiv double 1.000000e+00, %23
%25 = fptrunc double %24 to float
store float %25, float* %10
%26 = load float, float* %6
%27 = fpext float %26 to double
%28 = fdiv double 1.000000e+00, %27
%29 = fptrunc double %28 to float
store float %29, float* %11
%30 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %5, i64 0, i64 0
%31 = bitcast [4 x float]* %30 to float**
%32 = load float, float* %10
%33 = load float, float* %11
%34 = call i32 @xrotatemat(float** %31, float %32, float %33)
%35 = call float @sqrt(double 3.000000e+00)
store float %35, float* %6
%36 = load float, float* %6
%37 = fpext float %36 to double
%38 = fdiv double -1.000000e+00, %37
%39 = fptrunc double %38 to float
store float %39, float* %12
%40 = call float @sqrt(double 2.000000e+00)
%41 = load float, float* %6
%42 = fdiv float %40, %41
store float %42, float* %13
%43 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %5, i64 0, i64 0
%44 = bitcast [4 x float]* %43 to float**
%45 = load float, float* %12
%46 = load float, float* %13
%47 = call i32 @yrotatemat(float** %44, float %45, float %46)
%48 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %5, i64 0, i64 0
%49 = bitcast [4 x float]* %48 to float**
%50 = call i32 @xformpnt(float** %49, double 2.126000e-01, double 7.152000e-01, double 7.220000e-02, float* %7, float* %8, float* %9)
%51 = load float, float* %7
%52 = load float, float* %9
%53 = fdiv float %51, %52
store float %53, float* %16
%54 = load float, float* %8
%55 = load float, float* %9
%56 = fdiv float %54, %55
store float %56, float* %17
%57 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %5, i64 0, i64 0
%58 = bitcast [4 x float]* %57 to float**
%59 = load float, float* %16
%60 = load float, float* %17
%61 = call i32 @zshearmat(float** %58, float %59, float %60)
%62 = load float, float* %4
%63 = load float, float* @M_PI
%64 = fmul float %62, %63
%65 = fpext float %64 to double
%66 = fdiv double %65, 1.800000e+02
%67 = fptrunc double %66 to float
%68 = call float @sin(float %67)
store float %68, float* %14
%69 = load float, float* %4
%70 = load float, float* @M_PI
%71 = fmul float %69, %70
%72 = fpext float %71 to double
%73 = fdiv double %72, 1.800000e+02
%74 = fptrunc double %73 to float
%75 = call float @cos(float %74)
store float %75, float* %15
%76 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %5, i64 0, i64 0
%77 = bitcast [4 x float]* %76 to float**
%78 = load float, float* %14
%79 = load float, float* %15
%80 = call i32 @zrotatemat(float** %77, float %78, float %79)
%81 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %5, i64 0, i64 0
%82 = bitcast [4 x float]* %81 to float**
%83 = load float, float* %16
%84 = fneg float %83
%85 = load float, float* %17
%86 = fneg float %85
%87 = call i32 @zshearmat(float** %82, float %84, float %86)
%88 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %5, i64 0, i64 0
%89 = bitcast [4 x float]* %88 to float**
%90 = load float, float* %12
%91 = fneg float %90
%92 = load float, float* %13
%93 = call i32 @yrotatemat(float** %89, float %91, float %92)
%94 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %5, i64 0, i64 0
%95 = bitcast [4 x float]* %94 to float**
%96 = load float, float* %10
%97 = fneg float %96
%98 = load float, float* %11
%99 = call i32 @xrotatemat(float** %95, float %97, float %98)
%100 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %5, i64 0, i64 0
%101 = bitcast [4 x float]* %100 to float**
%102 = load [4 x float]*, [4 x float]** %3
%103 = bitcast [4 x float]* %102 to float**
%104 = load [4 x float]*, [4 x float]** %3
%105 = bitcast [4 x float]* %104 to float**
%106 = call i32 @matrixmult(float** %101, float** %103, float** %105)
ret void
}

LLVM IR (-O2):
@M_PI = global float 0.000000e+00
define void @huerotatemat([4 x float]* %0, float %1) {
%3 = alloca [4 x [4 x float]]
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = bitcast [4 x [4 x float]]* %3 to i8*
%8 = bitcast float* %4 to i8*
%9 = bitcast float* %5 to i8*
%10 = bitcast float* %6 to i8*
%11 = getelementptr inbounds [4 x [4 x float]], [4 x [4 x float]]* %3, i64 0, i64 0, i64 0
%12 = call i32 @identmat(float* %11)
%13 = call float @sqrt(double 2.000000e+00)
%14 = fdiv float 1.000000e+00, %13
%15 = bitcast [4 x [4 x float]]* %3 to float**
%16 = call i32 @xrotatemat(float** %15, float %14, float %14)
%17 = call float @sqrt(double 3.000000e+00)
%18 = fdiv float -1.000000e+00, %17
%19 = call float @sqrt(double 2.000000e+00)
%20 = fdiv float %19, %17
%21 = call i32 @yrotatemat(float** %15, float %18, float %20)
%22 = call i32 @xformpnt(float** %15, double 2.126000e-01, double 7.152000e-01, double 7.220000e-02, float* %4, float* %5, float* %6)
%23 = load float, float* %4
%24 = load float, float* %6
%25 = fdiv float %23, %24
%26 = load float, float* %5
%27 = fdiv float %26, %24
%28 = call i32 @zshearmat(float** %15, float %25, float %27)
%29 = load float, float* @M_PI
%30 = fmul float %29, %1
%31 = fdiv float %30, 1.800000e+02
%32 = call float @sin(float %31)
%33 = load float, float* @M_PI
%34 = fmul float %33, %1
%35 = fdiv float %34, 1.800000e+02
%36 = call float @cos(float %35)
%37 = call i32 @zrotatemat(float** %15, float %32, float %36)
%38 = fneg float %25
%39 = fneg float %27
%40 = call i32 @zshearmat(float** %15, float %38, float %39)
%41 = fneg float %18
%42 = call i32 @yrotatemat(float** %15, float %41, float %20)
%43 = fneg float %14
%44 = call i32 @xrotatemat(float** %15, float %43, float %14)
%45 = bitcast [4 x float]* %0 to float**
%46 = call i32 @matrixmult(float** %15, float** %45, float** %45)
ret void
}