#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 *createMat4(int /*<<< orphan*/ *);
int /*<<< orphan*/ loadIdentity(float *);
float *loadOrtho(float left, float right, float bottom, float top, float near,
                 float far) {
  float *destMat4 = createMat4(NULL);
  loadIdentity(destMat4);
  destMat4[0] = 2 / (right - left);
  destMat4[5] = 2 / (top - bottom);
  destMat4[10] = -2 / (far - near);
  destMat4[12] = -(right + left) / (right - left);
  destMat4[13] = -(top + bottom) / (top - bottom);
  destMat4[14] = -(far + near) / (far - near);
  return destMat4;
}


x86 assembly (clang, -O0):
<loadOrtho>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%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)
xor    %eax,%eax
mov    %eax,%edi
call   1030 <createMat4@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <loadIdentity@plt>
movss  -0x8(%rbp),%xmm1
subss  -0x4(%rbp),%xmm1
movss  0xe96(%rip),%xmm0
divss  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x10(%rbp),%xmm1
subss  -0xc(%rbp),%xmm1
movss  0xe78(%rip),%xmm0
divss  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,0x14(%rax)
movss  -0x18(%rbp),%xmm1
subss  -0x14(%rbp),%xmm1
movss  0xe55(%rip),%xmm0
divss  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,0x28(%rax)
movss  -0x8(%rbp),%xmm0
addss  -0x4(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  -0x8(%rbp),%xmm1
subss  -0x4(%rbp),%xmm1
divss  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,0x30(%rax)
movss  -0x10(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  -0x10(%rbp),%xmm1
subss  -0xc(%rbp),%xmm1
divss  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,0x34(%rax)
movss  -0x18(%rbp),%xmm0
addss  -0x14(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  -0x18(%rbp),%xmm1
subss  -0x14(%rbp),%xmm1
divss  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,0x38(%rax)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<loadOrtho>:
push   %rbx
sub    $0x40,%rsp
movss  %xmm5,0xc(%rsp)
movaps %xmm4,0x30(%rsp)
movss  %xmm3,0x8(%rsp)
movaps %xmm2,0x20(%rsp)
movss  %xmm1,0x4(%rsp)
movaps %xmm0,0x10(%rsp)
xor    %edi,%edi
call   1030 <createMat4@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <loadIdentity@plt>
movss  0x4(%rsp),%xmm5
movaps %xmm5,%xmm0
movaps 0x10(%rsp),%xmm4
subss  %xmm4,%xmm0
movss  0xe8e(%rip),%xmm1
movaps %xmm1,%xmm2
divss  %xmm0,%xmm2
movss  %xmm2,(%rbx)
movss  0x8(%rsp),%xmm6
movaps %xmm6,%xmm2
movaps 0x20(%rsp),%xmm7
subss  %xmm7,%xmm2
divss  %xmm2,%xmm1
movss  %xmm1,0x14(%rbx)
movss  0xc(%rsp),%xmm8
movaps %xmm8,%xmm1
movaps 0x30(%rsp),%xmm9
subss  %xmm9,%xmm1
movss  0xe4e(%rip),%xmm3
divss  %xmm1,%xmm3
movss  %xmm3,0x28(%rbx)
addss  %xmm5,%xmm4
movaps 0xe46(%rip),%xmm3
xorps  %xmm3,%xmm4
divss  %xmm0,%xmm4
movss  %xmm4,0x30(%rbx)
movaps %xmm7,%xmm0
addss  %xmm6,%xmm0
xorps  %xmm3,%xmm0
divss  %xmm2,%xmm0
movss  %xmm0,0x34(%rbx)
movaps %xmm9,%xmm0
addss  %xmm8,%xmm0
xorps  %xmm3,%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,0x38(%rbx)
mov    %rbx,%rax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define float* @loadOrtho(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 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
%14 = call float* @createMat4(i32* null)
store float* %14, float** %13
%15 = load float*, float** %13
%16 = call i32 @loadIdentity(float* %15)
%17 = load float, float* %8
%18 = load float, float* %7
%19 = fsub float %17, %18
%20 = fdiv float 2.000000e+00, %19
%21 = load float*, float** %13
%22 = getelementptr inbounds float, float* %21, i64 0
store float %20, float* %22
%23 = load float, float* %10
%24 = load float, float* %9
%25 = fsub float %23, %24
%26 = fdiv float 2.000000e+00, %25
%27 = load float*, float** %13
%28 = getelementptr inbounds float, float* %27, i64 5
store float %26, float* %28
%29 = load float, float* %12
%30 = load float, float* %11
%31 = fsub float %29, %30
%32 = fdiv float -2.000000e+00, %31
%33 = load float*, float** %13
%34 = getelementptr inbounds float, float* %33, i64 10
store float %32, float* %34
%35 = load float, float* %8
%36 = load float, float* %7
%37 = fadd float %35, %36
%38 = fneg float %37
%39 = load float, float* %8
%40 = load float, float* %7
%41 = fsub float %39, %40
%42 = fdiv float %38, %41
%43 = load float*, float** %13
%44 = getelementptr inbounds float, float* %43, i64 12
store float %42, float* %44
%45 = load float, float* %10
%46 = load float, float* %9
%47 = fadd float %45, %46
%48 = fneg float %47
%49 = load float, float* %10
%50 = load float, float* %9
%51 = fsub float %49, %50
%52 = fdiv float %48, %51
%53 = load float*, float** %13
%54 = getelementptr inbounds float, float* %53, i64 13
store float %52, float* %54
%55 = load float, float* %12
%56 = load float, float* %11
%57 = fadd float %55, %56
%58 = fneg float %57
%59 = load float, float* %12
%60 = load float, float* %11
%61 = fsub float %59, %60
%62 = fdiv float %58, %61
%63 = load float*, float** %13
%64 = getelementptr inbounds float, float* %63, i64 14
store float %62, float* %64
%65 = load float*, float** %13
ret float* %65
}

LLVM IR (-O2):
define float* @loadOrtho(float %0, float %1, float %2, float %3, float %4, float %5) {
%7 = tail call float* @createMat4(i32* null)
%8 = tail call i32 @loadIdentity(float* %7)
%9 = fsub float %1, %0
%10 = fdiv float 2.000000e+00, %9
store float %10, float* %7
%11 = fsub float %3, %2
%12 = fdiv float 2.000000e+00, %11
%13 = getelementptr inbounds float, float* %7, i64 5
store float %12, float* %13
%14 = fsub float %5, %4
%15 = fdiv float -2.000000e+00, %14
%16 = getelementptr inbounds float, float* %7, i64 10
store float %15, float* %16
%17 = fadd float %0, %1
%18 = fneg float %17
%19 = fdiv float %18, %9
%20 = getelementptr inbounds float, float* %7, i64 12
store float %19, float* %20
%21 = fadd float %2, %3
%22 = fneg float %21
%23 = fdiv float %22, %11
%24 = getelementptr inbounds float, float* %7, i64 13
store float %23, float* %24
%25 = fadd float %4, %5
%26 = fneg float %25
%27 = fdiv float %26, %14
%28 = getelementptr inbounds float, float* %7, i64 14
store float %27, float* %28
ret float* %7
}