#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 GLdouble;

/* Variables and functions */
int /*<<< orphan*/ GL_MODELVIEW;
int /*<<< orphan*/ GL_PROJECTION;
int /*<<< orphan*/ glLoadIdentity();
int /*<<< orphan*/ glMatrixMode(int /*<<< orphan*/);
int /*<<< orphan*/ glViewport(int /*<<< orphan*/, int /*<<< orphan*/, int, int);
int /*<<< orphan*/ gluPerspective(double, int, double, double);
void reshape(int x, int y) {
  if (y == 0 || x == 0)
    return;
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  gluPerspective(40.0, (GLdouble)x / (GLdouble)y, 0.5, 20.0);
  glMatrixMode(GL_MODELVIEW);
  glViewport(0, 0, x, y);
}


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)
je     1162 <reshape+0x22>
cmpl   $0x0,-0x4(%rbp)
jne    1167 <reshape+0x27>
jmp    11bf <reshape+0x7f>
mov    0x2e6a(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
mov    $0x0,%al
call   1050 <glLoadIdentity@plt>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,%edi
movsd  0xe73(%rip),%xmm0
movsd  0xe73(%rip),%xmm1
movsd  0xe73(%rip),%xmm2
call   1040 <gluPerspective@plt>
mov    0x2e3f(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
xor    %esi,%esi
mov    %esi,%edi
call   1060 <glViewport@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reshape>:
push   %rbp
push   %rbx
push   %rax
test   %edi,%edi
je     11a9 <reshape+0x69>
mov    %esi,%ebx
test   %esi,%esi
je     11a9 <reshape+0x69>
mov    %edi,%ebp
mov    0x2e82(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
xor    %eax,%eax
call   1050 <glLoadIdentity@plt>
mov    %ebp,%eax
cltd
idiv   %ebx
movsd  0xe8f(%rip),%xmm0
movsd  0xe8f(%rip),%xmm1
movsd  0xe8f(%rip),%xmm2
mov    %eax,%edi
call   1040 <gluPerspective@plt>
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
xor    %edi,%edi
xor    %esi,%esi
mov    %ebp,%edx
mov    %ebx,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1060 <glViewport@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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 %10, label %7
7: ; preds = %2
%8 = load i32, i32* %3
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %7, %2
br label %24
11: ; preds = %7
%12 = load i32, i32* @GL_PROJECTION
%13 = call i32 @glMatrixMode(i32 %12)
%14 = call i32 (...) @glLoadIdentity()
%15 = load i32, i32* %3
%16 = load i32, i32* %4
%17 = sdiv i32 %15, %16
%18 = call i32 @gluPerspective(double 4.000000e+01, i32 %17, double 5.000000e-01, double 2.000000e+01)
%19 = load i32, i32* @GL_MODELVIEW
%20 = call i32 @glMatrixMode(i32 %19)
%21 = load i32, i32* %3
%22 = load i32, i32* %4
%23 = call i32 @glViewport(i32 0, i32 0, i32 %21, i32 %22)
br label %24
24: ; preds = %11, %10
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 = icmp eq i32 %0, 0
%5 = or i1 %4, %3
br i1 %5, label %15, label %6
6: ; preds = %2
%7 = load i32, i32* @GL_PROJECTION
%8 = tail call i32 @glMatrixMode(i32 %7)
%9 = tail call i32 (...) @glLoadIdentity()
%10 = sdiv i32 %0, %1
%11 = tail call i32 @gluPerspective(double 4.000000e+01, i32 %10, double 5.000000e-01, double 2.000000e+01)
%12 = load i32, i32* @GL_MODELVIEW
%13 = tail call i32 @glMatrixMode(i32 %12)
%14 = tail call i32 @glViewport(i32 0, i32 0, i32 %0, i32 %1)
br label %15
15: ; preds = %2, %6
ret void
}