#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 */
typedef double GLdouble;

/* Variables and functions */
double M_PI;
int /*<<< orphan*/ glFrustum(double, double, double, double, double, double);
double tan(double);
void gluPerspective(GLdouble fovy, GLdouble aspect, GLdouble zNear,
                    GLdouble zFar) {
  GLdouble xmin, xmax, ymin, ymax;
  ymax = zNear * tan(fovy * M_PI / 360.0);
  ymin = -ymax;
  xmin = ymin * aspect;
  xmax = ymax * aspect;
  glFrustum(xmin, xmax, ymin, ymax, zNear, zFar);
}


x86 assembly (clang, -O0):
<gluPerspective>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    0x2e96(%rip),%rax
mulsd  (%rax),%xmm0
movsd  0xea2(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <tan@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x40(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm3
movsd  -0x18(%rbp),%xmm4
movsd  -0x20(%rbp),%xmm5
call   1030 <glFrustum@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gluPerspective>:
sub    $0x18,%rsp
movsd  %xmm3,0x10(%rsp)
movsd  %xmm2,(%rsp)
movsd  %xmm1,0x8(%rsp)
mov    0x2eac(%rip),%rax
mulsd  (%rax),%xmm0
divsd  0xeb8(%rip),%xmm0
call   1040 <tan@plt>
movapd %xmm0,%xmm3
movsd  (%rsp),%xmm4
mulsd  %xmm4,%xmm3
movapd 0xeae(%rip),%xmm2
xorpd  %xmm3,%xmm2
movapd %xmm2,%xmm0
movsd  0x8(%rsp),%xmm1
mulsd  %xmm1,%xmm0
mulsd  %xmm3,%xmm1
movsd  0x10(%rsp),%xmm5
add    $0x18,%rsp
jmp    1030 <glFrustum@plt>

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define void @gluPerspective(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%13 = load double, double* %7
%14 = load double, double* %5
%15 = load double, double* @M_PI
%16 = fmul double %14, %15
%17 = fdiv double %16, 3.600000e+02
%18 = call double @tan(double %17)
%19 = fmul double %13, %18
store double %19, double* %12
%20 = load double, double* %12
%21 = fneg double %20
store double %21, double* %11
%22 = load double, double* %11
%23 = load double, double* %6
%24 = fmul double %22, %23
store double %24, double* %9
%25 = load double, double* %12
%26 = load double, double* %6
%27 = fmul double %25, %26
store double %27, double* %10
%28 = load double, double* %9
%29 = load double, double* %10
%30 = load double, double* %11
%31 = load double, double* %12
%32 = load double, double* %7
%33 = load double, double* %8
%34 = call i32 @glFrustum(double %28, double %29, double %30, double %31, double %32, double %33)
ret void
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define void @gluPerspective(double %0, double %1, double %2, double %3) {
%5 = load double, double* @M_PI
%6 = fmul double %5, %0
%7 = fdiv double %6, 3.600000e+02
%8 = tail call double @tan(double %7)
%9 = fmul double %8, %2
%10 = fneg double %9
%11 = fmul double %10, %1
%12 = fmul double %9, %1
%13 = tail call i32 @glFrustum(double %11, double %12, double %10, double %9, double %2, double %3)
ret void
}