#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_PROJECTION;
int /*<<< orphan*/ glFrustum(float, float, float, float, float, float);
int /*<<< orphan*/ glLoadIdentity();
int /*<<< orphan*/ glMatrixMode(int /*<<< orphan*/);
int /*<<< orphan*/ glTranslatef(float, float, float);
void stereoproj(float xmin, float xmax, float ymin, float ymax, float znear,
                float zfar, float zzps, float dist, float eye) {
  float xmid, ymid, clip_near, clip_far, top, bottom, left, right, dx, dy,
      n_over_d;
  dx = xmax - xmin;
  dy = ymax - ymin;
  xmid = (xmax + xmin) / 2.0;
  ymid = (ymax + ymin) / 2.0;
  clip_near = dist + zzps - znear;
  clip_far = dist + zzps - zfar;
  n_over_d = clip_near / dist;
  top = n_over_d * dy / 2.0;
  bottom = -top;
  right = n_over_d * (dx / 2.0 - eye);
  left = n_over_d * (-dx / 2.0 - eye);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  glFrustum(left, right, bottom, top, clip_near, clip_far);
  glTranslatef(-xmid - eye, -ymid, -zzps - dist);
}


x86 assembly (clang, -O0):
<stereoproj>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movss  0x10(%rbp),%xmm8
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  %xmm4,-0x14(%rbp)
movss  %xmm5,-0x18(%rbp)
movss  %xmm6,-0x1c(%rbp)
movss  %xmm7,-0x20(%rbp)
movss  -0x8(%rbp),%xmm0
subss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x44(%rbp)
movss  -0x10(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x48(%rbp)
movss  -0x8(%rbp),%xmm0
addss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe56(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x10(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe33(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x20(%rbp),%xmm0
addss  -0x1c(%rbp),%xmm0
subss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x20(%rbp),%xmm0
addss  -0x1c(%rbp),%xmm0
subss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x2c(%rbp),%xmm0
divss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x4c(%rbp)
movss  -0x4c(%rbp),%xmm0
mulss  -0x48(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdd9(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x34(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x4c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x44(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xd9b(%rip),%xmm2
divsd  %xmm2,%xmm1
movss  0x10(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x40(%rbp)
movss  -0x4c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x44(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xd56(%rip),%xmm2
divsd  %xmm2,%xmm1
movss  0x10(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x3c(%rbp)
mov    0x2d11(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
mov    $0x0,%al
call   1040 <glLoadIdentity@plt>
movss  -0x3c(%rbp),%xmm0
movss  -0x40(%rbp),%xmm1
movss  -0x38(%rbp),%xmm2
movss  -0x34(%rbp),%xmm3
movss  -0x2c(%rbp),%xmm4
movss  -0x30(%rbp),%xmm5
call   1050 <glFrustum@plt>
movss  -0x24(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
subss  0x10(%rbp),%xmm0
movss  -0x28(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
movss  -0x1c(%rbp),%xmm2
movd   %xmm2,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm2
subss  -0x20(%rbp),%xmm2
call   1060 <glTranslatef@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stereoproj>:
sub    $0x78,%rsp
movaps %xmm6,0x60(%rsp)
movss  0x80(%rsp),%xmm8
movss  %xmm8,0x10(%rsp)
movaps %xmm1,%xmm9
subss  %xmm0,%xmm9
movaps %xmm3,%xmm10
subss  %xmm2,%xmm10
addss  %xmm1,%xmm0
movss  %xmm0,0x18(%rsp)
addss  %xmm3,%xmm2
movss  %xmm2,0x1c(%rsp)
movss  %xmm7,0x14(%rsp)
addss  %xmm7,%xmm6
movaps %xmm6,%xmm1
subss  %xmm4,%xmm1
movaps %xmm1,0x40(%rsp)
subss  %xmm5,%xmm6
movaps %xmm6,0x50(%rsp)
divss  %xmm7,%xmm1
mulss  %xmm1,%xmm10
mulss  0xe4f(%rip),%xmm10
movaps %xmm10,0x30(%rsp)
movaps 0xe52(%rip),%xmm0
xorps  %xmm0,%xmm10
movaps %xmm10,0x20(%rsp)
cvtss2sd %xmm1,%xmm1
xorps  %xmm2,%xmm2
cvtss2sd %xmm9,%xmm2
movsd  0xe44(%rip),%xmm3
mulsd  %xmm3,%xmm2
xorps  %xmm4,%xmm4
cvtss2sd %xmm8,%xmm4
subsd  %xmm4,%xmm2
mulsd  %xmm1,%xmm2
cvtsd2ss %xmm2,%xmm2
movss  %xmm2,0xc(%rsp)
xorps  %xmm0,%xmm9
xorps  %xmm0,%xmm0
cvtss2sd %xmm9,%xmm0
mulsd  %xmm3,%xmm0
subsd  %xmm4,%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x8(%rsp)
mov    0x2dbd(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
xor    %eax,%eax
call   1040 <glLoadIdentity@plt>
movss  0x8(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
movaps 0x20(%rsp),%xmm2
movaps 0x30(%rsp),%xmm3
movaps 0x40(%rsp),%xmm4
movaps 0x50(%rsp),%xmm5
call   1050 <glFrustum@plt>
movss  0xda6(%rip),%xmm2
movss  0x18(%rsp),%xmm0
mulss  %xmm2,%xmm0
subss  0x10(%rsp),%xmm0
movss  0x1c(%rsp),%xmm1
mulss  %xmm2,%xmm1
movaps 0x60(%rsp),%xmm2
xorps  0xd8c(%rip),%xmm2
subss  0x14(%rsp),%xmm2
add    $0x78,%rsp
jmp    1060 <glTranslatef@plt>

LLVM IR (-O0):
@GL_PROJECTION = global i32 0
define void @stereoproj(float %0, float %1, float %2, float %3, float %4, float %5, float %6, float %7, float %8) {
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca float
%15 = alloca float
%16 = alloca float
%17 = alloca float
%18 = alloca float
%19 = alloca float
%20 = alloca float
%21 = alloca float
%22 = alloca float
%23 = alloca float
%24 = alloca float
%25 = alloca float
%26 = alloca float
%27 = alloca float
%28 = alloca float
%29 = alloca float
store float %0, float* %10
store float %1, float* %11
store float %2, float* %12
store float %3, float* %13
store float %4, float* %14
store float %5, float* %15
store float %6, float* %16
store float %7, float* %17
store float %8, float* %18
%30 = load float, float* %11
%31 = load float, float* %10
%32 = fsub float %30, %31
store float %32, float* %27
%33 = load float, float* %13
%34 = load float, float* %12
%35 = fsub float %33, %34
store float %35, float* %28
%36 = load float, float* %11
%37 = load float, float* %10
%38 = fadd float %36, %37
%39 = fpext float %38 to double
%40 = fdiv double %39, 2.000000e+00
%41 = fptrunc double %40 to float
store float %41, float* %19
%42 = load float, float* %13
%43 = load float, float* %12
%44 = fadd float %42, %43
%45 = fpext float %44 to double
%46 = fdiv double %45, 2.000000e+00
%47 = fptrunc double %46 to float
store float %47, float* %20
%48 = load float, float* %17
%49 = load float, float* %16
%50 = fadd float %48, %49
%51 = load float, float* %14
%52 = fsub float %50, %51
store float %52, float* %21
%53 = load float, float* %17
%54 = load float, float* %16
%55 = fadd float %53, %54
%56 = load float, float* %15
%57 = fsub float %55, %56
store float %57, float* %22
%58 = load float, float* %21
%59 = load float, float* %17
%60 = fdiv float %58, %59
store float %60, float* %29
%61 = load float, float* %29
%62 = load float, float* %28
%63 = fmul float %61, %62
%64 = fpext float %63 to double
%65 = fdiv double %64, 2.000000e+00
%66 = fptrunc double %65 to float
store float %66, float* %23
%67 = load float, float* %23
%68 = fneg float %67
store float %68, float* %24
%69 = load float, float* %29
%70 = fpext float %69 to double
%71 = load float, float* %27
%72 = fpext float %71 to double
%73 = fdiv double %72, 2.000000e+00
%74 = load float, float* %18
%75 = fpext float %74 to double
%76 = fsub double %73, %75
%77 = fmul double %70, %76
%78 = fptrunc double %77 to float
store float %78, float* %26
%79 = load float, float* %29
%80 = fpext float %79 to double
%81 = load float, float* %27
%82 = fneg float %81
%83 = fpext float %82 to double
%84 = fdiv double %83, 2.000000e+00
%85 = load float, float* %18
%86 = fpext float %85 to double
%87 = fsub double %84, %86
%88 = fmul double %80, %87
%89 = fptrunc double %88 to float
store float %89, float* %25
%90 = load i32, i32* @GL_PROJECTION
%91 = call i32 @glMatrixMode(i32 %90)
%92 = call i32 (...) @glLoadIdentity()
%93 = load float, float* %25
%94 = load float, float* %26
%95 = load float, float* %24
%96 = load float, float* %23
%97 = load float, float* %21
%98 = load float, float* %22
%99 = call i32 @glFrustum(float %93, float %94, float %95, float %96, float %97, float %98)
%100 = load float, float* %19
%101 = fneg float %100
%102 = load float, float* %18
%103 = fsub float %101, %102
%104 = load float, float* %20
%105 = fneg float %104
%106 = load float, float* %16
%107 = fneg float %106
%108 = load float, float* %17
%109 = fsub float %107, %108
%110 = call i32 @glTranslatef(float %103, float %105, float %109)
ret void
}

LLVM IR (-O2):
@GL_PROJECTION = global i32 0
define void @stereoproj(float %0, float %1, float %2, float %3, float %4, float %5, float %6, float %7, float %8) {
%10 = fsub float %1, %0
%11 = fsub float %3, %2
%12 = fadd float %0, %1
%13 = fadd float %2, %3
%14 = fadd float %6, %7
%15 = fsub float %14, %4
%16 = fsub float %14, %5
%17 = fdiv float %15, %7
%18 = fmul float %11, %17
%19 = fmul float %18, 5.000000e-01
%20 = fneg float %19
%21 = fpext float %17 to double
%22 = fpext float %10 to double
%23 = fmul double %22, 5.000000e-01
%24 = fpext float %8 to double
%25 = fsub double %23, %24
%26 = fmul double %25, %21
%27 = fptrunc double %26 to float
%28 = fneg float %10
%29 = fpext float %28 to double
%30 = fmul double %29, 5.000000e-01
%31 = fsub double %30, %24
%32 = fmul double %31, %21
%33 = fptrunc double %32 to float
%34 = load i32, i32* @GL_PROJECTION
%35 = tail call i32 @glMatrixMode(i32 %34)
%36 = tail call i32 (...) @glLoadIdentity()
%37 = tail call i32 @glFrustum(float %33, float %27, float %20, float %19, float %15, float %16)
%38 = fmul float %12, -5.000000e-01
%39 = fsub float %38, %8
%40 = fmul float %13, -5.000000e-01
%41 = fneg float %6
%42 = fsub float %41, %7
%43 = tail call i32 @glTranslatef(float %39, float %40, float %42)
ret void
}