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

/* Variables and functions */
int /*<<< orphan*/ GL_MODELVIEW;
int /*<<< orphan*/ GL_PROJECTION;
int /*<<< orphan*/ glLoadIdentity();
int /*<<< orphan*/ glMatrixMode(int /*<<< orphan*/);
int /*<<< orphan*/ glViewport(int, int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ gluOrtho2D(double, double, double, double);
void reshape(int w, int h) {
  if (w <= h)
    glViewport(0, (h - w) / 2, (GLsizei)w, (GLsizei)w);
  else
    glViewport((w - h) / 2, 0, (GLsizei)h, (GLsizei)h);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  gluOrtho2D(0.0, 30.0, 0.0, 30.0);
  glMatrixMode(GL_MODELVIEW);
}


x86 assembly (clang, -O0):
<reshape>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     117c <reshape+0x3c>
mov    -0x8(%rbp),%eax
sub    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
mov    -0x4(%rbp),%edx
mov    -0x4(%rbp),%ecx
xor    %edi,%edi
call   1060 <glViewport@plt>
jmp    1199 <reshape+0x59>
mov    -0x4(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
mov    -0x8(%rbp),%edx
mov    -0x8(%rbp),%ecx
xor    %esi,%esi
call   1060 <glViewport@plt>
mov    0x2e38(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
mov    $0x0,%al
call   1040 <glLoadIdentity@plt>
xorps  %xmm2,%xmm2
movsd  0xe47(%rip),%xmm3
movaps %xmm2,%xmm0
movaps %xmm3,%xmm1
call   1050 <gluOrtho2D@plt>
mov    0x2e1d(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reshape>:
push   %rax
mov    %esi,%ecx
mov    %edi,%eax
sub    %esi,%eax
jle    1158 <reshape+0x18>
mov    %eax,%edi
shr    $0x1f,%edi
add    %eax,%edi
sar    %edi
xor    %esi,%esi
mov    %ecx,%edx
jmp    1169 <reshape+0x29>
mov    %edi,%edx
sub    %edi,%ecx
mov    %ecx,%esi
shr    $0x1f,%esi
add    %ecx,%esi
sar    %esi
xor    %edi,%edi
mov    %edx,%ecx
call   1060 <glViewport@plt>
mov    0x2e63(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
xor    %eax,%eax
call   1040 <glLoadIdentity@plt>
movsd  0xe75(%rip),%xmm1
xorps  %xmm0,%xmm0
xorps  %xmm2,%xmm2
movaps %xmm1,%xmm3
call   1050 <gluOrtho2D@plt>
mov    0x2e48(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1030 <glMatrixMode@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 = icmp sle i32 %5, %6
br i1 %7, label %8, label %16
8: ; preds = %2
%9 = load i32, i32* %4
%10 = load i32, i32* %3
%11 = sub nsw i32 %9, %10
%12 = sdiv i32 %11, 2
%13 = load i32, i32* %3
%14 = load i32, i32* %3
%15 = call i32 @glViewport(i32 0, i32 %12, i32 %13, i32 %14)
br label %24
16: ; preds = %2
%17 = load i32, i32* %3
%18 = load i32, i32* %4
%19 = sub nsw i32 %17, %18
%20 = sdiv i32 %19, 2
%21 = load i32, i32* %4
%22 = load i32, i32* %4
%23 = call i32 @glViewport(i32 %20, i32 0, i32 %21, i32 %22)
br label %24
24: ; preds = %16, %8
%25 = load i32, i32* @GL_PROJECTION
%26 = call i32 @glMatrixMode(i32 %25)
%27 = call i32 (...) @glLoadIdentity()
%28 = call i32 @gluOrtho2D(double 0.000000e+00, double 3.000000e+01, double 0.000000e+00, double 3.000000e+01)
%29 = load i32, i32* @GL_MODELVIEW
%30 = call i32 @glMatrixMode(i32 %29)
ret void
}

LLVM IR (-O2):
@GL_PROJECTION = global i32 0
@GL_MODELVIEW = global i32 0
define void @reshape(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = sub nsw i32 %1, %0
%6 = sdiv i32 %5, 2
%7 = tail call i32 @glViewport(i32 0, i32 %6, i32 %0, i32 %0)
br label %12
8: ; preds = %2
%9 = sub nsw i32 %0, %1
%10 = sdiv i32 %9, 2
%11 = tail call i32 @glViewport(i32 %10, i32 0, i32 %1, i32 %1)
br label %12
12: ; preds = %8, %4
%13 = load i32, i32* @GL_PROJECTION
%14 = tail call i32 @glMatrixMode(i32 %13)
%15 = tail call i32 (...) @glLoadIdentity()
%16 = tail call i32 @gluOrtho2D(double 0.000000e+00, double 3.000000e+01, double 0.000000e+00, double 3.000000e+01)
%17 = load i32, i32* @GL_MODELVIEW
%18 = tail call i32 @glMatrixMode(i32 %17)
ret void
}