#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*/ esmFrustumf(float *, float, float, float, float, float,
                               float);
float tanf(float);
void esmPerspectivef(float *M, float fovy, float aspect, float near,
                     float far) {
  float frustumW, frustumH;
  frustumH = tanf(fovy / 360.0f * 3.1415926535f) * near;
  frustumW = frustumH * aspect;
  esmFrustumf(M, -frustumW, frustumW, -frustumH, frustumH, near, far);
}


x86 assembly (clang, -O0):
<esmPerspectivef>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
movss  %xmm2,-0x14(%rbp)
movss  %xmm3,-0x18(%rbp)
movss  -0xc(%rbp),%xmm0
movss  0xeb7(%rip),%xmm1
divss  %xmm1,%xmm0
movss  0xea7(%rip),%xmm1
mulss  %xmm1,%xmm0
call   1030 <tanf@plt>
mulss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
movss  -0x1c(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  -0x1c(%rbp),%xmm1
movss  -0x20(%rbp),%xmm2
movd   %xmm2,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm2
movss  -0x20(%rbp),%xmm3
movss  -0x14(%rbp),%xmm4
movss  -0x18(%rbp),%xmm5
call   1040 <esmFrustumf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<esmPerspectivef>:
push   %rbx
sub    $0x20,%rsp
movss  %xmm3,0xc(%rsp)
movss  %xmm2,0x8(%rsp)
movaps %xmm1,0x10(%rsp)
mov    %rdi,%rbx
divss  0xebf(%rip),%xmm0
mulss  0xebb(%rip),%xmm0
call   1030 <tanf@plt>
movaps %xmm0,%xmm3
movss  0x8(%rsp),%xmm4
mulss  %xmm4,%xmm3
movaps 0x10(%rsp),%xmm1
mulss  %xmm3,%xmm1
movaps 0xea5(%rip),%xmm2
movaps %xmm1,%xmm0
xorps  %xmm2,%xmm0
xorps  %xmm3,%xmm2
mov    %rbx,%rdi
movss  0xc(%rsp),%xmm5
add    $0x20,%rsp
pop    %rbx
jmp    1040 <esmFrustumf@plt>

LLVM IR (-O0):
define void @esmPerspectivef(float* %0, float %1, float %2, float %3, float %4) {
%6 = alloca float*
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
store float* %0, float** %6
store float %1, float* %7
store float %2, float* %8
store float %3, float* %9
store float %4, float* %10
%13 = load float, float* %7
%14 = fdiv float %13, 3.600000e+02
%15 = fmul float %14, 0x400921FB60000000
%16 = call float @tanf(float %15)
%17 = load float, float* %9
%18 = fmul float %16, %17
store float %18, float* %12
%19 = load float, float* %12
%20 = load float, float* %8
%21 = fmul float %19, %20
store float %21, float* %11
%22 = load float*, float** %6
%23 = load float, float* %11
%24 = fneg float %23
%25 = load float, float* %11
%26 = load float, float* %12
%27 = fneg float %26
%28 = load float, float* %12
%29 = load float, float* %9
%30 = load float, float* %10
%31 = call i32 @esmFrustumf(float* %22, float %24, float %25, float %27, float %28, float %29, float %30)
ret void
}

LLVM IR (-O2):
define void @esmPerspectivef(float* %0, float %1, float %2, float %3, float %4) {
%6 = fdiv float %1, 3.600000e+02
%7 = fmul float %6, 0x400921FB60000000
%8 = tail call float @tanf(float %7)
%9 = fmul float %8, %3
%10 = fmul float %9, %2
%11 = fneg float %10
%12 = fneg float %9
%13 = tail call i32 @esmFrustumf(float* %0, float %11, float %10, float %12, float %9, float %3, float %4)
ret void
}