#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_MODELVIEW;
int /*<<< orphan*/ GL_PROJECTION;
int /*<<< orphan*/ glLoadIdentity();
int /*<<< orphan*/ glMatrixMode(int /*<<< orphan*/);
int /*<<< orphan*/ gluPerspective(float, float, double, double);
void reshape(int w, int h) {
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  if (h == 0)
    h = 1;
  gluPerspective(45.0f, (float)w / (float)h, 0.1, 100.0);
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
}


x86 assembly (clang, -O0):
<reshape>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    0x2e93(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
mov    $0x0,%al
call   1050 <glLoadIdentity@plt>
cmpl   $0x0,-0x8(%rbp)
jne    1164 <reshape+0x34>
movl   $0x1,-0x8(%rbp)
cvtsi2ssl -0x4(%rbp),%xmm1
cvtsi2ssl -0x8(%rbp),%xmm0
divss  %xmm0,%xmm1
movss  0xe86(%rip),%xmm0
movsd  0xe86(%rip),%xmm2
movsd  0xe86(%rip),%xmm3
call   1040 <gluPerspective@plt>
mov    0x2e52(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
mov    $0x0,%al
call   1050 <glLoadIdentity@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reshape>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
xor    %eax,%eax
call   1050 <glLoadIdentity@plt>
test   %ebx,%ebx
mov    $0x1,%eax
cmovne %ebx,%eax
cvtsi2ss %ebp,%xmm1
cvtsi2ss %eax,%xmm0
divss  %xmm0,%xmm1
movss  0xe96(%rip),%xmm0
movsd  0xe96(%rip),%xmm2
movsd  0xe96(%rip),%xmm3
call   1040 <gluPerspective@plt>
mov    0x2e62(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <glLoadIdentity@plt>

LLVM IR (-O0):
@GL_PROJECTION = global i32 0
@GL_MODELVIEW = global i32 0
define void @reshape(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* @GL_PROJECTION
%6 = call i32 @glMatrixMode(i32 %5)
%7 = call i32 (...) @glLoadIdentity()
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 1, i32* %4
br label %11
11: ; preds = %10, %2
%12 = load i32, i32* %3
%13 = sitofp i32 %12 to float
%14 = load i32, i32* %4
%15 = sitofp i32 %14 to float
%16 = fdiv float %13, %15
%17 = call i32 @gluPerspective(float 4.500000e+01, float %16, double 1.000000e-01, double 1.000000e+02)
%18 = load i32, i32* @GL_MODELVIEW
%19 = call i32 @glMatrixMode(i32 %18)
%20 = call i32 (...) @glLoadIdentity()
ret void
}

LLVM IR (-O2):
@GL_PROJECTION = global i32 0
@GL_MODELVIEW = global i32 0
define void @reshape(i32 %0, i32 %1) {
%3 = load i32, i32* @GL_PROJECTION
%4 = tail call i32 @glMatrixMode(i32 %3)
%5 = tail call i32 (...) @glLoadIdentity()
%6 = icmp eq i32 %1, 0
%7 = select i1 %6, i32 1, i32 %1
%8 = sitofp i32 %0 to float
%9 = sitofp i32 %7 to float
%10 = fdiv float %8, %9
%11 = tail call i32 @gluPerspective(float 4.500000e+01, float %10, double 1.000000e-01, double 1.000000e+02)
%12 = load i32, i32* @GL_MODELVIEW
%13 = tail call i32 @glMatrixMode(i32 %12)
%14 = tail call i32 (...) @glLoadIdentity()
ret void
}