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

/* Variables and functions */
int GL_COLOR_BUFFER_BIT;
int GL_DEPTH_BUFFER_BIT;
int /*<<< orphan*/ GL_MODELVIEW;
int /*<<< orphan*/ GL_PROJECTION;
int /*<<< orphan*/ glClear(int);
int /*<<< orphan*/ glFrustum(double, double, int, int, double, double);
int /*<<< orphan*/ glLoadIdentity();
int /*<<< orphan*/ glMatrixMode(int /*<<< orphan*/);
int /*<<< orphan*/ glTranslatef(double, double, double);
int /*<<< orphan*/ glViewport(int /*<<< orphan*/, int /*<<< orphan*/,
                              int /*<<< orphan*/, int /*<<< orphan*/);
void reshape(int width, int height) {
  GLfloat h = (GLfloat)height / (GLfloat)width;
  glViewport(0, 0, (GLint)width, (GLint)height);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  glFrustum(-1.0, 1.0, -h, h, 5.0, 60.0);
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  glTranslatef(0.0, 0.0, -40.0);
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}


x86 assembly (clang, -O0):
<reshape>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cltd
idivl  -0x4(%rbp)
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
xor    %esi,%esi
mov    %esi,%edi
call   1080 <glViewport@plt>
mov    0x2e42(%rip),%rax
mov    (%rax),%edi
call   1040 <glMatrixMode@plt>
mov    $0x0,%al
call   1050 <glLoadIdentity@plt>
xor    %edi,%edi
sub    -0xc(%rbp),%edi
mov    -0xc(%rbp),%esi
movsd  0xe5c(%rip),%xmm0
movsd  0xe5c(%rip),%xmm1
movsd  0xe5c(%rip),%xmm2
movsd  0xe5c(%rip),%xmm3
call   1060 <glFrustum@plt>
mov    0x2e10(%rip),%rax
mov    (%rax),%edi
call   1040 <glMatrixMode@plt>
mov    $0x0,%al
call   1050 <glLoadIdentity@plt>
xorps  %xmm1,%xmm1
movsd  0xe17(%rip),%xmm2
movaps %xmm1,%xmm0
call   1070 <glTranslatef@plt>
mov    0x2dd0(%rip),%rax
mov    (%rax),%edi
mov    0x2de7(%rip),%rax
or     (%rax),%edi
call   1030 <glClear@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reshape>:
push   %rbx
mov    %esi,%r8d
mov    %edi,%ecx
mov    %esi,%eax
cltd
idiv   %edi
mov    %eax,%ebx
xor    %edi,%edi
xor    %esi,%esi
mov    %ecx,%edx
mov    %r8d,%ecx
call   1080 <glViewport@plt>
mov    0x2e4e(%rip),%rax
mov    (%rax),%edi
call   1040 <glMatrixMode@plt>
xor    %eax,%eax
call   1050 <glLoadIdentity@plt>
mov    %ebx,%edi
neg    %edi
movsd  0xe64(%rip),%xmm0
movsd  0xe64(%rip),%xmm1
movsd  0xe64(%rip),%xmm2
movsd  0xe64(%rip),%xmm3
mov    %ebx,%esi
call   1060 <glFrustum@plt>
mov    0x2e1e(%rip),%rax
mov    (%rax),%edi
call   1040 <glMatrixMode@plt>
xor    %eax,%eax
call   1050 <glLoadIdentity@plt>
movsd  0xe48(%rip),%xmm2
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
call   1070 <glTranslatef@plt>
mov    0x2dde(%rip),%rax
mov    0x2df7(%rip),%rcx
mov    (%rcx),%edi
or     (%rax),%edi
pop    %rbx
jmp    1030 <glClear@plt>

LLVM IR (-O0):
@GL_PROJECTION = global i32 0
@GL_MODELVIEW = global i32 0
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_DEPTH_BUFFER_BIT = global i32 0
define void @reshape(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = load i32, i32* %3
%8 = sdiv i32 %6, %7
store i32 %8, i32* %5
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = call i32 @glViewport(i32 0, i32 0, i32 %9, i32 %10)
%12 = load i32, i32* @GL_PROJECTION
%13 = call i32 @glMatrixMode(i32 %12)
%14 = call i32 (...) @glLoadIdentity()
%15 = load i32, i32* %5
%16 = sub nsw i32 0, %15
%17 = load i32, i32* %5
%18 = call i32 @glFrustum(double -1.000000e+00, double 1.000000e+00, i32 %16, i32 %17, double 5.000000e+00, double 6.000000e+01)
%19 = load i32, i32* @GL_MODELVIEW
%20 = call i32 @glMatrixMode(i32 %19)
%21 = call i32 (...) @glLoadIdentity()
%22 = call i32 @glTranslatef(double 0.000000e+00, double 0.000000e+00, double -4.000000e+01)
%23 = load i32, i32* @GL_COLOR_BUFFER_BIT
%24 = load i32, i32* @GL_DEPTH_BUFFER_BIT
%25 = or i32 %23, %24
%26 = call i32 @glClear(i32 %25)
ret void
}

LLVM IR (-O2):
@GL_PROJECTION = global i32 0
@GL_MODELVIEW = global i32 0
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_DEPTH_BUFFER_BIT = global i32 0
define void @reshape(i32 %0, i32 %1) {
%3 = sdiv i32 %1, %0
%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 = sub nsw i32 0, %3
%9 = tail call i32 @glFrustum(double -1.000000e+00, double 1.000000e+00, i32 %8, i32 %3, double 5.000000e+00, double 6.000000e+01)
%10 = load i32, i32* @GL_MODELVIEW
%11 = tail call i32 @glMatrixMode(i32 %10)
%12 = tail call i32 (...) @glLoadIdentity()
%13 = tail call i32 @glTranslatef(double 0.000000e+00, double 0.000000e+00, double -4.000000e+01)
%14 = load i32, i32* @GL_COLOR_BUFFER_BIT
%15 = load i32, i32* @GL_DEPTH_BUFFER_BIT
%16 = or i32 %15, %14
%17 = tail call i32 @glClear(i32 %16)
ret void
}