#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_mult_matrixf(float *);
void gl_frustum(float left, float right, float bottom, float top, float near,
                float far) {
  float mat[] = {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1};
  float dx = right - left;
  float dy = top - bottom;
  float dz = far - near;
  float a = (right + left) / dx;
  float b = (top + bottom) / dy;
  float c = -(far + near) / dz;
  float d = -2.f * far * near / dz;
  mat[0] = 2.f * near / dx;
  mat[5] = 2.f * near / dy;
  mat[8] = a;
  mat[9] = b;
  mat[10] = c;
  mat[11] = -1.f;
  mat[14] = d;
  mat[15] = 0;
  gl_mult_matrixf(mat);
}


x86 assembly (clang, -O0):
<gl_frustum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  %xmm4,-0x14(%rbp)
movss  %xmm5,-0x18(%rbp)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1030 <memset@plt>
movss  0xeab(%rip),%xmm0
movss  %xmm0,-0x60(%rbp)
movss  0xe9e(%rip),%xmm0
movss  %xmm0,-0x4c(%rbp)
movss  0xe91(%rip),%xmm0
movss  %xmm0,-0x38(%rbp)
movss  0xe84(%rip),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x8(%rbp),%xmm0
subss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x64(%rbp)
movss  -0x10(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x68(%rbp)
movss  -0x18(%rbp),%xmm0
subss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x6c(%rbp)
movss  -0x8(%rbp),%xmm0
addss  -0x4(%rbp),%xmm0
divss  -0x64(%rbp),%xmm0
movss  %xmm0,-0x70(%rbp)
movss  -0x10(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
divss  -0x68(%rbp),%xmm0
movss  %xmm0,-0x74(%rbp)
movss  -0x18(%rbp),%xmm0
addss  -0x14(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
divss  -0x6c(%rbp),%xmm0
movss  %xmm0,-0x78(%rbp)
movss  0xdfd(%rip),%xmm0
mulss  -0x18(%rbp),%xmm0
mulss  -0x14(%rbp),%xmm0
divss  -0x6c(%rbp),%xmm0
movss  %xmm0,-0x7c(%rbp)
movss  0xddd(%rip),%xmm0
mulss  -0x14(%rbp),%xmm0
divss  -0x64(%rbp),%xmm0
movss  %xmm0,-0x60(%rbp)
movss  0xdc6(%rip),%xmm0
mulss  -0x14(%rbp),%xmm0
divss  -0x68(%rbp),%xmm0
movss  %xmm0,-0x4c(%rbp)
movss  -0x70(%rbp),%xmm0
movss  %xmm0,-0x40(%rbp)
movss  -0x74(%rbp),%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0x78(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
movss  0xd8d(%rip),%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x7c(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
lea    -0x60(%rbp),%rdi
call   1040 <gl_mult_matrixf@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gl_frustum>:
sub    $0x48,%rsp
xorps  %xmm6,%xmm6
movaps %xmm6,(%rsp)
movaps %xmm6,0x10(%rsp)
movaps %xmm6,0x20(%rsp)
movaps %xmm6,0x30(%rsp)
movaps %xmm1,%xmm6
subss  %xmm0,%xmm6
movaps %xmm3,%xmm8
subss  %xmm2,%xmm8
movaps %xmm5,%xmm7
subss  %xmm4,%xmm7
addss  %xmm1,%xmm0
divss  %xmm6,%xmm0
addss  %xmm3,%xmm2
divss  %xmm8,%xmm2
movaps %xmm4,%xmm1
addss  %xmm5,%xmm1
xorps  0xea0(%rip),%xmm1
divss  %xmm7,%xmm1
mulss  0xea4(%rip),%xmm5
mulss  %xmm4,%xmm5
divss  %xmm7,%xmm5
addss  %xmm4,%xmm4
movaps %xmm4,%xmm3
divss  %xmm6,%xmm3
movss  %xmm3,(%rsp)
divss  %xmm8,%xmm4
movss  %xmm4,0x14(%rsp)
movss  %xmm0,0x20(%rsp)
movss  %xmm2,0x24(%rsp)
movss  %xmm1,0x28(%rsp)
movl   $0xbf800000,0x2c(%rsp)
bf
movss  %xmm5,0x38(%rsp)
movl   $0x0,0x3c(%rsp)
mov    %rsp,%rdi
call   1030 <gl_mult_matrixf@plt>
add    $0x48,%rsp
ret

LLVM IR (-O0):
define void @gl_frustum(float %0, float %1, float %2, float %3, float %4, float %5) {
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca [16 x float]
%14 = alloca float
%15 = alloca float
%16 = alloca float
%17 = alloca float
%18 = alloca float
%19 = alloca float
%20 = alloca float
store float %0, float* %7
store float %1, float* %8
store float %2, float* %9
store float %3, float* %10
store float %4, float* %11
store float %5, float* %12
%21 = bitcast [16 x float]* %13 to i8*
%22 = bitcast i8* %21 to [16 x float]*
%23 = getelementptr inbounds [16 x float], [16 x float]* %22, i32 0, i32 0
store float 1.000000e+00, float* %23
%24 = getelementptr inbounds [16 x float], [16 x float]* %22, i32 0, i32 5
store float 1.000000e+00, float* %24
%25 = getelementptr inbounds [16 x float], [16 x float]* %22, i32 0, i32 10
store float 1.000000e+00, float* %25
%26 = getelementptr inbounds [16 x float], [16 x float]* %22, i32 0, i32 15
store float 1.000000e+00, float* %26
%27 = load float, float* %8
%28 = load float, float* %7
%29 = fsub float %27, %28
store float %29, float* %14
%30 = load float, float* %10
%31 = load float, float* %9
%32 = fsub float %30, %31
store float %32, float* %15
%33 = load float, float* %12
%34 = load float, float* %11
%35 = fsub float %33, %34
store float %35, float* %16
%36 = load float, float* %8
%37 = load float, float* %7
%38 = fadd float %36, %37
%39 = load float, float* %14
%40 = fdiv float %38, %39
store float %40, float* %17
%41 = load float, float* %10
%42 = load float, float* %9
%43 = fadd float %41, %42
%44 = load float, float* %15
%45 = fdiv float %43, %44
store float %45, float* %18
%46 = load float, float* %12
%47 = load float, float* %11
%48 = fadd float %46, %47
%49 = fneg float %48
%50 = load float, float* %16
%51 = fdiv float %49, %50
store float %51, float* %19
%52 = load float, float* %12
%53 = fmul float -2.000000e+00, %52
%54 = load float, float* %11
%55 = fmul float %53, %54
%56 = load float, float* %16
%57 = fdiv float %55, %56
store float %57, float* %20
%58 = load float, float* %11
%59 = fmul float 2.000000e+00, %58
%60 = load float, float* %14
%61 = fdiv float %59, %60
%62 = getelementptr inbounds [16 x float], [16 x float]* %13, i64 0, i64 0
store float %61, float* %62
%63 = load float, float* %11
%64 = fmul float 2.000000e+00, %63
%65 = load float, float* %15
%66 = fdiv float %64, %65
%67 = getelementptr inbounds [16 x float], [16 x float]* %13, i64 0, i64 5
store float %66, float* %67
%68 = load float, float* %17
%69 = getelementptr inbounds [16 x float], [16 x float]* %13, i64 0, i64 8
store float %68, float* %69
%70 = load float, float* %18
%71 = getelementptr inbounds [16 x float], [16 x float]* %13, i64 0, i64 9
store float %70, float* %71
%72 = load float, float* %19
%73 = getelementptr inbounds [16 x float], [16 x float]* %13, i64 0, i64 10
store float %72, float* %73
%74 = getelementptr inbounds [16 x float], [16 x float]* %13, i64 0, i64 11
store float -1.000000e+00, float* %74
%75 = load float, float* %20
%76 = getelementptr inbounds [16 x float], [16 x float]* %13, i64 0, i64 14
store float %75, float* %76
%77 = getelementptr inbounds [16 x float], [16 x float]* %13, i64 0, i64 15
store float 0.000000e+00, float* %77
%78 = getelementptr inbounds [16 x float], [16 x float]* %13, i64 0, i64 0
%79 = call i32 @gl_mult_matrixf(float* %78)
ret void
}

LLVM IR (-O2):
define void @gl_frustum(float %0, float %1, float %2, float %3, float %4, float %5) {
%7 = alloca [16 x float]
%8 = bitcast [16 x float]* %7 to i8*
%9 = getelementptr inbounds [16 x float], [16 x float]* %7, i64 0, i64 0
%10 = getelementptr inbounds [16 x float], [16 x float]* %7, i64 0, i64 5
%11 = getelementptr inbounds [16 x float], [16 x float]* %7, i64 0, i64 10
%12 = getelementptr inbounds [16 x float], [16 x float]* %7, i64 0, i64 15
%13 = fsub float %1, %0
%14 = fsub float %3, %2
%15 = fsub float %5, %4
%16 = fadd float %0, %1
%17 = fdiv float %16, %13
%18 = fadd float %2, %3
%19 = fdiv float %18, %14
%20 = fadd float %4, %5
%21 = fneg float %20
%22 = fdiv float %21, %15
%23 = fmul float %5, -2.000000e+00
%24 = fmul float %23, %4
%25 = fdiv float %24, %15
%26 = fmul float %4, 2.000000e+00
%27 = fdiv float %26, %13
store float %27, float* %9
%28 = fdiv float %26, %14
store float %28, float* %10
%29 = getelementptr inbounds [16 x float], [16 x float]* %7, i64 0, i64 8
store float %17, float* %29
%30 = getelementptr inbounds [16 x float], [16 x float]* %7, i64 0, i64 9
store float %19, float* %30
store float %22, float* %11
%31 = getelementptr inbounds [16 x float], [16 x float]* %7, i64 0, i64 11
store float -1.000000e+00, float* %31
%32 = getelementptr inbounds [16 x float], [16 x float]* %7, i64 0, i64 14
store float %25, float* %32
store float 0.000000e+00, float* %12
%33 = call i32 @gl_mult_matrixf(float* %9)
ret void
}