#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 const asinf(float const);
float const atan2f(float const, float const);
void Mat4_GetAnglesZXY(float ang[3], const float mat[16]) {
  const float rad_to_deg = 180.0f / 3.14159265358979323846;
  ang[1] = rad_to_deg * asinf(mat[2 + 4 * 1]);
  if (ang[1] < 90.0f) {
    if (ang[1] > -90.0f) {
      ang[0] = rad_to_deg * atan2f(-mat[0 + 4 * 1], mat[1 + 4 * 1]);
      ang[2] = rad_to_deg * atan2f(-mat[2 + 4 * 0], mat[2 + 4 * 2]);
    } else {
      ang[0] = -rad_to_deg * atan2f(mat[0 + 4 * 2], mat[0 + 4 * 0]);
      ang[2] = 0.0f;
    }
  } else {
    ang[0] = -rad_to_deg * atan2f(mat[0 + 4 * 2], mat[0 + 4 * 0]);
    ang[2] = 0.0f;
  }
}


x86 assembly (clang, -O0):
<Mat4_GetAnglesZXY>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  0xecc(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movss  0x18(%rax),%xmm0
call   1030 <asinf@plt>
movaps %xmm0,%xmm1
movss  0xeae(%rip),%xmm0
mulss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
mov    -0x8(%rbp),%rax
movss  0xe91(%rip),%xmm0
ucomiss 0x4(%rax),%xmm0
jbe    124d <Mat4_GetAnglesZXY+0x12d>
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
movss  0xe82(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    120f <Mat4_GetAnglesZXY+0xef>
mov    -0x10(%rbp),%rax
movss  0x10(%rax),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mov    -0x10(%rbp),%rax
movss  0x14(%rax),%xmm1
call   1040 <atan2f@plt>
movaps %xmm0,%xmm1
movss  0xe42(%rip),%xmm0
mulss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mov    -0x10(%rbp),%rax
movss  0x28(%rax),%xmm1
call   1040 <atan2f@plt>
movaps %xmm0,%xmm1
movss  0xe07(%rip),%xmm0
mulss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
jmp    1248 <Mat4_GetAnglesZXY+0x128>
mov    -0x10(%rbp),%rax
movss  0x20(%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm1
call   1040 <atan2f@plt>
movaps %xmm0,%xmm1
movss  0xdd8(%rip),%xmm0
mulss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x8(%rax)
jmp    1286 <Mat4_GetAnglesZXY+0x166>
mov    -0x10(%rbp),%rax
movss  0x20(%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm1
call   1040 <atan2f@plt>
movaps %xmm0,%xmm1
movss  0xd9a(%rip),%xmm0
mulss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x8(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Mat4_GetAnglesZXY>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
movss  0x18(%rsi),%xmm0
call   1030 <asinf@plt>
mulss  0xec4(%rip),%xmm0
movss  %xmm0,0x4(%r14)
movss  0xeba(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    119b <Mat4_GetAnglesZXY+0x7b>
ucomiss 0xeb6(%rip),%xmm0
jbe    119b <Mat4_GetAnglesZXY+0x7b>
movss  0x10(%rbx),%xmm0
xorps  0xeac(%rip),%xmm0
movss  0x14(%rbx),%xmm1
call   1040 <atan2f@plt>
mulss  0xe8a(%rip),%xmm0
movss  %xmm0,(%r14)
movss  0x8(%rbx),%xmm0
xorps  0xe89(%rip),%xmm0
movss  0x28(%rbx),%xmm1
call   1040 <atan2f@plt>
mulss  0xe67(%rip),%xmm0
jmp    11b9 <Mat4_GetAnglesZXY+0x99>
movss  (%rbx),%xmm1
movss  0x20(%rbx),%xmm0
call   1040 <atan2f@plt>
mulss  0xe57(%rip),%xmm0
movss  %xmm0,(%r14)
xorps  %xmm0,%xmm0
movss  %xmm0,0x8(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @Mat4_GetAnglesZXY(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
%5 = alloca float
store float* %0, float** %3
store float* %1, float** %4
store float 0x404CA5DC20000000, float* %5
%6 = load float*, float** %4
%7 = getelementptr inbounds float, float* %6, i64 6
%8 = load float, float* %7
%9 = call float @asinf(float %8)
%10 = fmul float 0x404CA5DC20000000, %9
%11 = load float*, float** %3
%12 = getelementptr inbounds float, float* %11, i64 1
store float %10, float* %12
%13 = load float*, float** %3
%14 = getelementptr inbounds float, float* %13, i64 1
%15 = load float, float* %14
%16 = fcmp olt float %15, 9.000000e+01
br i1 %16, label %17, label %59
17: ; preds = %2
%18 = load float*, float** %3
%19 = getelementptr inbounds float, float* %18, i64 1
%20 = load float, float* %19
%21 = fcmp ogt float %20, -9.000000e+01
br i1 %21, label %22, label %45
22: ; preds = %17
%23 = load float*, float** %4
%24 = getelementptr inbounds float, float* %23, i64 4
%25 = load float, float* %24
%26 = fneg float %25
%27 = load float*, float** %4
%28 = getelementptr inbounds float, float* %27, i64 5
%29 = load float, float* %28
%30 = call float @atan2f(float %26, float %29)
%31 = fmul float 0x404CA5DC20000000, %30
%32 = load float*, float** %3
%33 = getelementptr inbounds float, float* %32, i64 0
store float %31, float* %33
%34 = load float*, float** %4
%35 = getelementptr inbounds float, float* %34, i64 2
%36 = load float, float* %35
%37 = fneg float %36
%38 = load float*, float** %4
%39 = getelementptr inbounds float, float* %38, i64 10
%40 = load float, float* %39
%41 = call float @atan2f(float %37, float %40)
%42 = fmul float 0x404CA5DC20000000, %41
%43 = load float*, float** %3
%44 = getelementptr inbounds float, float* %43, i64 2
store float %42, float* %44
br label %58
45: ; preds = %17
%46 = load float*, float** %4
%47 = getelementptr inbounds float, float* %46, i64 8
%48 = load float, float* %47
%49 = load float*, float** %4
%50 = getelementptr inbounds float, float* %49, i64 0
%51 = load float, float* %50
%52 = call float @atan2f(float %48, float %51)
%53 = fmul float 0xC04CA5DC20000000, %52
%54 = load float*, float** %3
%55 = getelementptr inbounds float, float* %54, i64 0
store float %53, float* %55
%56 = load float*, float** %3
%57 = getelementptr inbounds float, float* %56, i64 2
store float 0.000000e+00, float* %57
br label %58
58: ; preds = %45, %22
br label %72
59: ; preds = %2
%60 = load float*, float** %4
%61 = getelementptr inbounds float, float* %60, i64 8
%62 = load float, float* %61
%63 = load float*, float** %4
%64 = getelementptr inbounds float, float* %63, i64 0
%65 = load float, float* %64
%66 = call float @atan2f(float %62, float %65)
%67 = fmul float 0xC04CA5DC20000000, %66
%68 = load float*, float** %3
%69 = getelementptr inbounds float, float* %68, i64 0
store float %67, float* %69
%70 = load float*, float** %3
%71 = getelementptr inbounds float, float* %70, i64 2
store float 0.000000e+00, float* %71
br label %72
72: ; preds = %59, %58
ret void
}

LLVM IR (-O2):
define void @Mat4_GetAnglesZXY(float* nocapture writeonly %0, float* nocapture %1) {
%3 = getelementptr inbounds float, float* %1, i64 6
%4 = load float, float* %3
%5 = tail call float @asinf(float %4)
%6 = fmul float %5, 0x404CA5DC20000000
%7 = getelementptr inbounds float, float* %0, i64 1
store float %6, float* %7
%8 = fcmp olt float %6, 9.000000e+01
br i1 %8, label %9, label %32
9: ; preds = %2
%10 = fcmp ogt float %6, -9.000000e+01
br i1 %10, label %11, label %26
11: ; preds = %9
%12 = getelementptr inbounds float, float* %1, i64 4
%13 = load float, float* %12
%14 = fneg float %13
%15 = getelementptr inbounds float, float* %1, i64 5
%16 = load float, float* %15
%17 = tail call float @atan2f(float %14, float %16)
%18 = fmul float %17, 0x404CA5DC20000000
store float %18, float* %0
%19 = getelementptr inbounds float, float* %1, i64 2
%20 = load float, float* %19
%21 = fneg float %20
%22 = getelementptr inbounds float, float* %1, i64 10
%23 = load float, float* %22
%24 = tail call float @atan2f(float %21, float %23)
%25 = fmul float %24, 0x404CA5DC20000000
br label %38
26: ; preds = %9
%27 = getelementptr inbounds float, float* %1, i64 8
%28 = load float, float* %27
%29 = load float, float* %1
%30 = tail call float @atan2f(float %28, float %29)
%31 = fmul float %30, 0xC04CA5DC20000000
store float %31, float* %0
br label %38
32: ; preds = %2
%33 = getelementptr inbounds float, float* %1, i64 8
%34 = load float, float* %33
%35 = load float, float* %1
%36 = tail call float @atan2f(float %34, float %35)
%37 = fmul float %36, 0xC04CA5DC20000000
store float %37, float* %0
br label %38
38: ; preds = %11, %26, %32
%39 = phi float [ %25, %11 ], [ 0.000000e+00, %26 ], [ 0.000000e+00, %32 ]
%40 = getelementptr inbounds float, float* %0, i64 2
store float %39, float* %40
ret void
}