#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(int, double, double, int);
void reshape(int w, int h) {
  if (h == 0)
    h = 1;
  glMatrixMode(GL_PROJECTION);
  gluPerspective(45, (double)w / (double)h, .1, 200);
  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)
cmpl   $0x0,-0x8(%rbp)
jne    114f <reshape+0x1f>
movl   $0x1,-0x8(%rbp)
mov    0x2e82(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
cvtsi2sdl -0x4(%rbp),%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    $0x2d,%edi
movsd  0xe88(%rip),%xmm1
mov    $0xc8,%esi
call   1040 <gluPerspective@plt>
mov    0x2e5f(%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    %edi,%ebx
test   %esi,%esi
mov    $0x1,%ebp
cmovne %esi,%ebp
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
cvtsi2sd %ebx,%xmm0
cvtsi2sd %ebp,%xmm1
divsd  %xmm1,%xmm0
movsd  0xe9f(%rip),%xmm1
mov    $0x2d,%edi
mov    $0xc8,%esi
call   1040 <gluPerspective@plt>
mov    0x2e71(%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* %4
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %2
store i32 1, i32* %4
br label %8
8: ; preds = %7, %2
%9 = load i32, i32* @GL_PROJECTION
%10 = call i32 @glMatrixMode(i32 %9)
%11 = load i32, i32* %3
%12 = sitofp i32 %11 to double
%13 = load i32, i32* %4
%14 = sitofp i32 %13 to double
%15 = fdiv double %12, %14
%16 = call i32 @gluPerspective(i32 45, double %15, double 1.000000e-01, i32 200)
%17 = load i32, i32* @GL_MODELVIEW
%18 = call i32 @glMatrixMode(i32 %17)
%19 = 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 = icmp eq i32 %1, 0
%4 = select i1 %3, i32 1, i32 %1
%5 = load i32, i32* @GL_PROJECTION
%6 = tail call i32 @glMatrixMode(i32 %5)
%7 = sitofp i32 %0 to double
%8 = sitofp i32 %4 to double
%9 = fdiv double %7, %8
%10 = tail call i32 @gluPerspective(i32 45, double %9, double 1.000000e-01, i32 200)
%11 = load i32, i32* @GL_MODELVIEW
%12 = tail call i32 @glMatrixMode(i32 %11)
%13 = tail call i32 (...) @glLoadIdentity()
ret void
}