#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 tanf(float);
void mat4f_LoadPerspective(float fov_radians, float aspect, float zNear,
                           float zFar, float *mout) {
  float f = 1.0f / tanf(fov_radians / 2.0f);
  mout[0] = f / aspect;
  mout[1] = 0.0f;
  mout[2] = 0.0f;
  mout[3] = 0.0f;
  mout[4] = 0.0f;
  mout[5] = f;
  mout[6] = 0.0f;
  mout[7] = 0.0f;
  mout[8] = 0.0f;
  mout[9] = 0.0f;
  mout[10] = (zFar + zNear) / (zNear - zFar);
  mout[11] = -1.0f;
  mout[12] = 0.0f;
  mout[13] = 0.0f;
  mout[14] = 2 * zFar * zNear / (zNear - zFar);
  mout[15] = 0.0f;
}


x86 assembly (clang, -O0):
<mat4f_LoadPerspective>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xec3(%rip),%xmm1
divss  %xmm1,%xmm0
call   1030 <tanf@plt>
movaps %xmm0,%xmm1
movss  0xeb7(%rip),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
divss  -0x8(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x4(%rax)
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x8(%rax)
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0xc(%rax)
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x10(%rax)
movss  -0x1c(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,0x14(%rax)
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x18(%rax)
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x1c(%rax)
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x20(%rax)
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x24(%rax)
movss  -0x10(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
subss  -0x10(%rbp),%xmm1
divss  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,0x28(%rax)
mov    -0x18(%rbp),%rax
movss  0xdfd(%rip),%xmm0
movss  %xmm0,0x2c(%rax)
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x30(%rax)
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x34(%rax)
movss  0xdd4(%rip),%xmm0
mulss  -0x10(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
subss  -0x10(%rbp),%xmm1
divss  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,0x38(%rax)
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x3c(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mat4f_LoadPerspective>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movss  %xmm3,0xc(%rsp)
movss  %xmm2,0x8(%rsp)
movss  %xmm1,0x4(%rsp)
mulss  0xece(%rip),%xmm0
call   1030 <tanf@plt>
movss  0xec5(%rip),%xmm1
divss  %xmm0,%xmm1
movaps %xmm1,%xmm0
divss  0x4(%rsp),%xmm0
movss  %xmm0,(%rbx)
xorps  %xmm0,%xmm0
movups %xmm0,0x4(%rbx)
movss  %xmm1,0x14(%rbx)
movss  0x8(%rsp),%xmm4
movaps %xmm4,%xmm1
movss  0xc(%rsp),%xmm3
addss  %xmm3,%xmm1
movaps %xmm4,%xmm2
subss  %xmm3,%xmm2
divss  %xmm2,%xmm1
movups %xmm0,0x18(%rbx)
movss  %xmm1,0x28(%rbx)
mov    $0xbf800000,%eax
mov    %rax,0x2c(%rbx)
movl   $0x0,0x34(%rbx)
addss  %xmm3,%xmm3
mulss  %xmm4,%xmm3
divss  %xmm2,%xmm3
movss  %xmm3,0x38(%rbx)
movl   $0x0,0x3c(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @mat4f_LoadPerspective(float %0, float %1, float %2, float %3, float* %4) {
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float*
%11 = alloca float
store float %0, float* %6
store float %1, float* %7
store float %2, float* %8
store float %3, float* %9
store float* %4, float** %10
%12 = load float, float* %6
%13 = fdiv float %12, 2.000000e+00
%14 = call float @tanf(float %13)
%15 = fdiv float 1.000000e+00, %14
store float %15, float* %11
%16 = load float, float* %11
%17 = load float, float* %7
%18 = fdiv float %16, %17
%19 = load float*, float** %10
%20 = getelementptr inbounds float, float* %19, i64 0
store float %18, float* %20
%21 = load float*, float** %10
%22 = getelementptr inbounds float, float* %21, i64 1
store float 0.000000e+00, float* %22
%23 = load float*, float** %10
%24 = getelementptr inbounds float, float* %23, i64 2
store float 0.000000e+00, float* %24
%25 = load float*, float** %10
%26 = getelementptr inbounds float, float* %25, i64 3
store float 0.000000e+00, float* %26
%27 = load float*, float** %10
%28 = getelementptr inbounds float, float* %27, i64 4
store float 0.000000e+00, float* %28
%29 = load float, float* %11
%30 = load float*, float** %10
%31 = getelementptr inbounds float, float* %30, i64 5
store float %29, float* %31
%32 = load float*, float** %10
%33 = getelementptr inbounds float, float* %32, i64 6
store float 0.000000e+00, float* %33
%34 = load float*, float** %10
%35 = getelementptr inbounds float, float* %34, i64 7
store float 0.000000e+00, float* %35
%36 = load float*, float** %10
%37 = getelementptr inbounds float, float* %36, i64 8
store float 0.000000e+00, float* %37
%38 = load float*, float** %10
%39 = getelementptr inbounds float, float* %38, i64 9
store float 0.000000e+00, float* %39
%40 = load float, float* %9
%41 = load float, float* %8
%42 = fadd float %40, %41
%43 = load float, float* %8
%44 = load float, float* %9
%45 = fsub float %43, %44
%46 = fdiv float %42, %45
%47 = load float*, float** %10
%48 = getelementptr inbounds float, float* %47, i64 10
store float %46, float* %48
%49 = load float*, float** %10
%50 = getelementptr inbounds float, float* %49, i64 11
store float -1.000000e+00, float* %50
%51 = load float*, float** %10
%52 = getelementptr inbounds float, float* %51, i64 12
store float 0.000000e+00, float* %52
%53 = load float*, float** %10
%54 = getelementptr inbounds float, float* %53, i64 13
store float 0.000000e+00, float* %54
%55 = load float, float* %9
%56 = fmul float 2.000000e+00, %55
%57 = load float, float* %8
%58 = fmul float %56, %57
%59 = load float, float* %8
%60 = load float, float* %9
%61 = fsub float %59, %60
%62 = fdiv float %58, %61
%63 = load float*, float** %10
%64 = getelementptr inbounds float, float* %63, i64 14
store float %62, float* %64
%65 = load float*, float** %10
%66 = getelementptr inbounds float, float* %65, i64 15
store float 0.000000e+00, float* %66
ret void
}

LLVM IR (-O2):
define void @mat4f_LoadPerspective(float %0, float %1, float %2, float %3, float* nocapture writeonly %4) {
%6 = fmul float %0, 5.000000e-01
%7 = tail call float @tanf(float %6)
%8 = fdiv float 1.000000e+00, %7
%9 = fdiv float %8, %1
store float %9, float* %4
%10 = getelementptr inbounds float, float* %4, i64 1
%11 = getelementptr inbounds float, float* %4, i64 5
%12 = bitcast float* %10 to i8*
store float %8, float* %11
%13 = getelementptr inbounds float, float* %4, i64 6
%14 = fadd float %2, %3
%15 = fsub float %2, %3
%16 = fdiv float %14, %15
%17 = getelementptr inbounds float, float* %4, i64 10
%18 = bitcast float* %13 to i8*
store float %16, float* %17
%19 = getelementptr inbounds float, float* %4, i64 11
store float -1.000000e+00, float* %19
%20 = getelementptr inbounds float, float* %4, i64 12
store float 0.000000e+00, float* %20
%21 = getelementptr inbounds float, float* %4, i64 13
store float 0.000000e+00, float* %21
%22 = fmul float %3, 2.000000e+00
%23 = fmul float %22, %2
%24 = fdiv float %23, %15
%25 = getelementptr inbounds float, float* %4, i64 14
store float %24, float* %25
%26 = getelementptr inbounds float, float* %4, i64 15
store float 0.000000e+00, float* %26
ret void
}