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

/* Variables and functions */
int /*<<< orphan*/ GL_MODELVIEW;
int /*<<< orphan*/ GL_PROJECTION;
int /*<<< orphan*/ glLoadIdentity();
int /*<<< orphan*/ glMatrixMode(int /*<<< orphan*/);
int /*<<< orphan*/ glOrtho(int, int, int, int, int, int);
int /*<<< orphan*/ glViewport(int /*<<< orphan*/, int /*<<< orphan*/, int, int);
int /*<<< orphan*/ glutPostRedisplay();
void reshape(int w, int h) {
  glViewport(0, 0, w, h);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  if (h >= w)
    glOrtho(-2, 2, -2 * (GLfloat)h / (GLfloat)w, 2 * (GLfloat)h / (GLfloat)w,
            -10, 10);
  else
    glOrtho(-2 * (GLfloat)w / (GLfloat)h, 2 * (GLfloat)w / (GLfloat)h, -2, 2,
            -10, 10);
  glMatrixMode(GL_MODELVIEW);
  glutPostRedisplay();
}


x86 assembly (clang, -O0):
<reshape>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
xor    %esi,%esi
mov    %esi,%edi
call   1070 <glViewport@plt>
mov    0x2e64(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
mov    $0x0,%al
call   1050 <glLoadIdentity@plt>
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jl     11cb <reshape+0x7b>
imul   $0xfffffffe,-0x8(%rbp),%eax
cltd
idivl  -0x4(%rbp)
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
cltd
idivl  -0x4(%rbp)
mov    -0xc(%rbp),%edx
mov    %eax,%ecx
mov    $0xfffffffe,%edi
mov    $0x2,%esi
mov    $0xfffffff6,%r8d
mov    $0xa,%r9d
call   1040 <glOrtho@plt>
jmp    11ff <reshape+0xaf>
imul   $0xfffffffe,-0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,%edi
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,%esi
mov    $0xfffffffe,%edx
mov    $0x2,%ecx
mov    $0xfffffff6,%r8d
mov    $0xa,%r9d
call   1040 <glOrtho@plt>
mov    0x2de2(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
mov    $0x0,%al
call   1060 <glutPostRedisplay@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reshape>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %edi,%edi
xor    %esi,%esi
mov    %ebp,%edx
mov    %ebx,%ecx
call   1070 <glViewport@plt>
mov    0x2e6d(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
xor    %eax,%eax
call   1050 <glLoadIdentity@plt>
cmp    %ebp,%ebx
jge    119b <reshape+0x4b>
add    %ebp,%ebp
mov    %ebp,%eax
neg    %eax
cltd
idiv   %ebx
mov    %eax,%edi
mov    %ebp,%eax
cltd
idiv   %ebx
mov    %eax,%esi
mov    $0xfffffffe,%edx
mov    $0x2,%ecx
jmp    11b9 <reshape+0x69>
add    %ebx,%ebx
mov    %ebx,%eax
neg    %eax
cltd
idiv   %ebp
mov    %eax,%ecx
mov    %ebx,%eax
cltd
idiv   %ebp
mov    $0xfffffffe,%edi
mov    $0x2,%esi
mov    %ecx,%edx
mov    %eax,%ecx
mov    $0xfffffff6,%r8d
mov    $0xa,%r9d
call   1040 <glOrtho@plt>
mov    0x2e17(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1060 <glutPostRedisplay@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* %3
%6 = load i32, i32* %4
%7 = call i32 @glViewport(i32 0, i32 0, i32 %5, i32 %6)
%8 = load i32, i32* @GL_PROJECTION
%9 = call i32 @glMatrixMode(i32 %8)
%10 = call i32 (...) @glLoadIdentity()
%11 = load i32, i32* %4
%12 = load i32, i32* %3
%13 = icmp sge i32 %11, %12
br i1 %13, label %14, label %24
14: ; preds = %2
%15 = load i32, i32* %4
%16 = mul nsw i32 -2, %15
%17 = load i32, i32* %3
%18 = sdiv i32 %16, %17
%19 = load i32, i32* %4
%20 = mul nsw i32 2, %19
%21 = load i32, i32* %3
%22 = sdiv i32 %20, %21
%23 = call i32 @glOrtho(i32 -2, i32 2, i32 %18, i32 %22, i32 -10, i32 10)
br label %34
24: ; preds = %2
%25 = load i32, i32* %3
%26 = mul nsw i32 -2, %25
%27 = load i32, i32* %4
%28 = sdiv i32 %26, %27
%29 = load i32, i32* %3
%30 = mul nsw i32 2, %29
%31 = load i32, i32* %4
%32 = sdiv i32 %30, %31
%33 = call i32 @glOrtho(i32 %28, i32 %32, i32 -2, i32 2, i32 -10, i32 10)
br label %34
34: ; preds = %24, %14
%35 = load i32, i32* @GL_MODELVIEW
%36 = call i32 @glMatrixMode(i32 %35)
%37 = call i32 (...) @glutPostRedisplay()
ret void
}

LLVM IR (-O2):
@GL_PROJECTION = global i32 0
@GL_MODELVIEW = global i32 0
define void @reshape(i32 %0, i32 %1) {
%3 = tail call i32 @glViewport(i32 0, i32 0, i32 %0, i32 %1)
%4 = load i32, i32* @GL_PROJECTION
%5 = tail call i32 @glMatrixMode(i32 %4)
%6 = tail call i32 (...) @glLoadIdentity()
%7 = icmp slt i32 %1, %0
br i1 %7, label %14, label %8
8: ; preds = %2
%9 = mul nsw i32 %1, -2
%10 = sdiv i32 %9, %0
%11 = shl nsw i32 %1, 1
%12 = sdiv i32 %11, %0
%13 = tail call i32 @glOrtho(i32 -2, i32 2, i32 %10, i32 %12, i32 -10, i32 10)
br label %20
14: ; preds = %2
%15 = mul nsw i32 %0, -2
%16 = sdiv i32 %15, %1
%17 = shl nsw i32 %0, 1
%18 = sdiv i32 %17, %1
%19 = tail call i32 @glOrtho(i32 %16, i32 %18, i32 -2, i32 2, i32 -10, i32 10)
br label %20
20: ; preds = %14, %8
%21 = load i32, i32* @GL_MODELVIEW
%22 = tail call i32 @glMatrixMode(i32 %21)
%23 = tail call i32 (...) @glutPostRedisplay()
ret void
}