#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 /*<<< orphan*/ GLsizei;
typedef int GLfloat;

/* 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 /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ gluPerspective(float, int, double, double);
int /*<<< orphan*/ printf(char *, int, int);
void reshapeFunc(int w, int h) {
  static float FOVY = 20.0;
  printf("reshapeFunc(%d,%d)\n", w, h);
  glViewport(0, 0, (GLsizei)w, (GLsizei)h);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  gluPerspective(FOVY, (GLfloat)w / (GLfloat)h, 2.0, -2.0);
  glMatrixMode(GL_MODELVIEW);
  return;
}


x86 assembly (clang, -O0):
<reshapeFunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xea5(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
xor    %esi,%esi
mov    %esi,%edi
call   1070 <glViewport@plt>
mov    0x2e52(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
mov    $0x0,%al
call   1060 <glLoadIdentity@plt>
movss  0x2eac(%rip),%xmm0
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,%edi
movsd  0xe53(%rip),%xmm1
movsd  0xe53(%rip),%xmm2
call   1050 <gluPerspective@plt>
mov    0x2e27(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reshapeFunc>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
lea    0xeba(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1040 <printf@plt>
xor    %edi,%edi
xor    %esi,%esi
mov    %ebp,%edx
mov    %ebx,%ecx
call   1070 <glViewport@plt>
mov    0x2e5d(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
xor    %eax,%eax
call   1060 <glLoadIdentity@plt>
mov    %ebp,%eax
cltd
idiv   %ebx
movss  0xe6a(%rip),%xmm0
movsd  0xe6a(%rip),%xmm1
movsd  0xe6a(%rip),%xmm2
mov    %eax,%edi
call   1050 <gluPerspective@plt>
mov    0x2e34(%rip),%rax
mov    (%rax),%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <glMatrixMode@plt>

LLVM IR (-O0):
@reshapeFunc.FOVY = internal global float 2.000000e+01
@.str = [20 x i8] c"reshapeFunc(%d,%d)\0A\00"
@GL_PROJECTION = global i32 0
@GL_MODELVIEW = global i32 0
define void @reshapeFunc(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6)
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = call i32 @glViewport(i32 0, i32 0, i32 %8, i32 %9)
%11 = load i32, i32* @GL_PROJECTION
%12 = call i32 @glMatrixMode(i32 %11)
%13 = call i32 (...) @glLoadIdentity()
%14 = load float, float* @reshapeFunc.FOVY
%15 = load i32, i32* %3
%16 = load i32, i32* %4
%17 = sdiv i32 %15, %16
%18 = call i32 @gluPerspective(float %14, i32 %17, double 2.000000e+00, double -2.000000e+00)
%19 = load i32, i32* @GL_MODELVIEW
%20 = call i32 @glMatrixMode(i32 %19)
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"reshapeFunc(%d,%d)\0A\00"
@GL_PROJECTION = global i32 0
@GL_MODELVIEW = global i32 0
define void @reshapeFunc(i32 %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
%4 = tail call i32 @glViewport(i32 0, i32 0, i32 %0, i32 %1)
%5 = load i32, i32* @GL_PROJECTION
%6 = tail call i32 @glMatrixMode(i32 %5)
%7 = tail call i32 (...) @glLoadIdentity()
%8 = sdiv i32 %0, %1
%9 = tail call i32 @gluPerspective(float 2.000000e+01, i32 %8, double 2.000000e+00, double -2.000000e+00)
%10 = load i32, i32* @GL_MODELVIEW
%11 = tail call i32 @glMatrixMode(i32 %10)
ret void
}