#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 */
int /*<<< orphan*/ GL_MODELVIEW_MATRIX;
scalar_t__ atan2(float, float);
int /*<<< orphan*/ buildRot(int, int /*<<< orphan*/, int, int /*<<< orphan*/,
                            float *);
int /*<<< orphan*/ glGetFloatv(int /*<<< orphan*/, float *);
int /*<<< orphan*/ glMultMatrixf(float *);
void calcMatrix(void) {
  float mat[16];
  glGetFloatv(GL_MODELVIEW_MATRIX, mat);
  buildRot(-180 * ((float)atan2((mat[8]), (mat[10]))) / 3.14159265358979323846,
           0, 1, 0, mat);
  glMultMatrixf(mat);
}


x86 assembly (clang, -O0):
<calcMatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
lea    -0x40(%rbp),%rsi
call   1060 <glGetFloatv@plt>
movss  -0x20(%rbp),%xmm0
movss  -0x18(%rbp),%xmm1
call   1030 <atan2@plt>
cvtsi2ss %rax,%xmm1
movss  0xe92(%rip),%xmm0
mulss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe7a(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
lea    -0x40(%rbp),%r8
xor    %ecx,%ecx
mov    $0x1,%edx
mov    %ecx,%esi
call   1050 <buildRot@plt>
lea    -0x40(%rbp),%rdi
call   1040 <glMultMatrixf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calcMatrix>:
push   %rbx
sub    $0x40,%rsp
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1060 <glGetFloatv@plt>
movss  0x20(%rsp),%xmm0
movss  0x28(%rsp),%xmm1
call   1030 <atan2@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
mulss  0xe86(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
divsd  0xe82(%rip),%xmm0
cvttsd2si %xmm0,%edi
xor    %esi,%esi
mov    $0x1,%edx
xor    %ecx,%ecx
mov    %rbx,%r8
call   1050 <buildRot@plt>
mov    %rbx,%rdi
call   1040 <glMultMatrixf@plt>
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@GL_MODELVIEW_MATRIX = global i32 0
define void @calcMatrix() {
%1 = alloca [16 x float]
%2 = load i32, i32* @GL_MODELVIEW_MATRIX
%3 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 0
%4 = call i32 @glGetFloatv(i32 %2, float* %3)
%5 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 8
%6 = load float, float* %5
%7 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 10
%8 = load float, float* %7
%9 = call i64 @atan2(float %6, float %8)
%10 = sitofp i64 %9 to float
%11 = fmul float -1.800000e+02, %10
%12 = fpext float %11 to double
%13 = fdiv double %12, 0x400921FB54442D18
%14 = fptosi double %13 to i32
%15 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 0
%16 = call i32 @buildRot(i32 %14, i32 0, i32 1, i32 0, float* %15)
%17 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 0
%18 = call i32 @glMultMatrixf(float* %17)
ret void
}

LLVM IR (-O2):
@GL_MODELVIEW_MATRIX = global i32 0
define void @calcMatrix() {
%1 = alloca [16 x float]
%2 = bitcast [16 x float]* %1 to i8*
%3 = load i32, i32* @GL_MODELVIEW_MATRIX
%4 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 0
%5 = call i32 @glGetFloatv(i32 %3, float* %4)
%6 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 8
%7 = load float, float* %6
%8 = getelementptr inbounds [16 x float], [16 x float]* %1, i64 0, i64 10
%9 = load float, float* %8
%10 = call i64 @atan2(float %7, float %9)
%11 = sitofp i64 %10 to float
%12 = fmul float %11, -1.800000e+02
%13 = fpext float %12 to double
%14 = fdiv double %13, 0x400921FB54442D18
%15 = fptosi double %14 to i32
%16 = call i32 @buildRot(i32 %15, i32 0, i32 1, i32 0, float* %4)
%17 = call i32 @glMultMatrixf(float* %4)
ret void
}