#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 int GLfloat;

/* Variables and functions */
int M_PI;
int tan(int);
int /*<<< orphan*/ vFrustum(int *, int, int, int, int, int, int);
void vPerspective(GLfloat mMatrix[16], GLfloat nFOVdeg, GLfloat nRatio,
                  GLfloat nNear, GLfloat nFar) {
  GLfloat nH = tan(nFOVdeg * M_PI / 360) * nNear;
  GLfloat nW = nH * nRatio;
  vFrustum(mMatrix, -nW, nW, -nH, nH, nNear, nFar);
}


x86 assembly (clang, -O0):
<vPerspective>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2ea5(%rip),%rcx
imul   (%rcx),%eax
mov    $0x168,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <tan@plt>
imul   -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
sub    -0x20(%rbp),%esi
mov    -0x20(%rbp),%edx
xor    %ecx,%ecx
sub    -0x1c(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    -0x14(%rbp),%r9d
mov    -0x18(%rbp),%eax
mov    %eax,(%rsp)
call   1040 <vFrustum@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vPerspective>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    0x2eba(%rip),%rax
imul   (%rax),%esi
mov    %r8d,%r14d
mov    %ecx,%ebx
mov    %edx,%ebp
mov    %rdi,%r15
movslq %esi,%rdi
imul   $0xffffffffb60b60b7,%rdi,%rax
shr    $0x20,%rax
add    %eax,%edi
mov    %edi,%eax
shr    $0x1f,%eax
sar    $0x8,%edi
add    %eax,%edi
call   1030 <tan@plt>
imul   %ebx,%eax
imul   %eax,%ebp
mov    %ebp,%esi
neg    %esi
mov    %eax,%ecx
neg    %ecx
mov    %r14d,(%rsp)
mov    %r15,%rdi
mov    %ebp,%edx
mov    %eax,%r8d
mov    %ebx,%r9d
call   1040 <vFrustum@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@M_PI = global i32 0
define void @vPerspective(i32* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32* %0, i32** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%13 = load i32, i32* %7
%14 = load i32, i32* @M_PI
%15 = mul nsw i32 %13, %14
%16 = sdiv i32 %15, 360
%17 = call i32 @tan(i32 %16)
%18 = load i32, i32* %9
%19 = mul nsw i32 %17, %18
store i32 %19, i32* %11
%20 = load i32, i32* %11
%21 = load i32, i32* %8
%22 = mul nsw i32 %20, %21
store i32 %22, i32* %12
%23 = load i32*, i32** %6
%24 = load i32, i32* %12
%25 = sub nsw i32 0, %24
%26 = load i32, i32* %12
%27 = load i32, i32* %11
%28 = sub nsw i32 0, %27
%29 = load i32, i32* %11
%30 = load i32, i32* %9
%31 = load i32, i32* %10
%32 = call i32 @vFrustum(i32* %23, i32 %25, i32 %26, i32 %28, i32 %29, i32 %30, i32 %31)
ret void
}

LLVM IR (-O2):
@M_PI = global i32 0
define void @vPerspective(i32* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = load i32, i32* @M_PI
%7 = mul nsw i32 %6, %1
%8 = sdiv i32 %7, 360
%9 = tail call i32 @tan(i32 %8)
%10 = mul nsw i32 %9, %3
%11 = mul nsw i32 %10, %2
%12 = sub nsw i32 0, %11
%13 = sub nsw i32 0, %10
%14 = tail call i32 @vFrustum(i32* %0, i32 %12, i32 %11, i32 %13, i32 %10, i32 %3, i32 %4)
ret void
}