#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 */

/* Variables and functions */
int /*<<< orphan*/ GL_PROJECTION;
int /*<<< orphan*/ glClearColor(double, double, double, double);
int /*<<< orphan*/ glColor3f(double, double, double);
int /*<<< orphan*/ glLoadIdentity();
int /*<<< orphan*/ glMatrixMode(int /*<<< orphan*/);
int /*<<< orphan*/ glOrtho(double, double, double, double, double, double);
int /*<<< orphan*/ glViewport(int, int, int, int);
void scene_reshape(int w, int h) {
  if (h < w)
    glViewport((w - h) / 2, 0, h, h);
  else
    glViewport(0, (h - w) / 2, w, w);
  glClearColor(0.0, 0.0, 0.0, 1.0);
  glColor3f(1.0, 1.0, 1.0);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
}


x86 assembly (clang, -O0):
<scene_reshape>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    119c <scene_reshape+0x3c>
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   1080 <glViewport@plt>
jmp    11b9 <scene_reshape+0x59>
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   1080 <glViewport@plt>
xorps  %xmm2,%xmm2
movsd  0xe44(%rip),%xmm3
movaps %xmm2,%xmm0
movaps %xmm2,%xmm1
call   1050 <glClearColor@plt>
movsd  0xe31(%rip),%xmm2
movaps %xmm2,%xmm0
movaps %xmm2,%xmm1
call   1070 <glColor3f@plt>
mov    0x2df7(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
mov    $0x0,%al
call   1060 <glLoadIdentity@plt>
movsd  0xe01(%rip),%xmm4
movsd  0xe01(%rip),%xmm5
movaps %xmm4,%xmm0
movaps %xmm5,%xmm1
movaps %xmm4,%xmm2
movaps %xmm5,%xmm3
call   1040 <glOrtho@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scene_reshape>:
push   %rax
mov    %edi,%ecx
mov    %esi,%eax
sub    %edi,%eax
jge    117c <scene_reshape+0x1c>
mov    %esi,%edx
sub    %esi,%ecx
mov    %ecx,%edi
shr    $0x1f,%edi
add    %ecx,%edi
sar    %edi
xor    %esi,%esi
mov    %edx,%ecx
jmp    1189 <scene_reshape+0x29>
mov    %eax,%esi
shr    $0x1f,%esi
add    %eax,%esi
sar    %esi
xor    %edi,%edi
mov    %ecx,%edx
call   1080 <glViewport@plt>
movsd  0xe6a(%rip),%xmm3
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
xorps  %xmm2,%xmm2
call   1050 <glClearColor@plt>
movsd  0xe54(%rip),%xmm0
movaps %xmm0,%xmm1
movaps %xmm0,%xmm2
call   1070 <glColor3f@plt>
mov    0x2e22(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
xor    %eax,%eax
call   1060 <glLoadIdentity@plt>
movsd  0xe34(%rip),%xmm0
movsd  0xe24(%rip),%xmm1
movaps %xmm0,%xmm2
movaps %xmm1,%xmm3
movaps %xmm1,%xmm5
movaps %xmm0,%xmm4
pop    %rax
jmp    1040 <glOrtho@plt>

LLVM IR (-O0):
@GL_PROJECTION = global i32 0
define void @scene_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 = load i32, i32* %3
%7 = icmp slt i32 %5, %6
br i1 %7, label %8, label %16
8: ; preds = %2
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = sub nsw i32 %9, %10
%12 = sdiv i32 %11, 2
%13 = load i32, i32* %4
%14 = load i32, i32* %4
%15 = call i32 @glViewport(i32 %12, i32 0, i32 %13, i32 %14)
br label %24
16: ; preds = %2
%17 = load i32, i32* %4
%18 = load i32, i32* %3
%19 = sub nsw i32 %17, %18
%20 = sdiv i32 %19, 2
%21 = load i32, i32* %3
%22 = load i32, i32* %3
%23 = call i32 @glViewport(i32 0, i32 %20, i32 %21, i32 %22)
br label %24
24: ; preds = %16, %8
%25 = call i32 @glClearColor(double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 1.000000e+00)
%26 = call i32 @glColor3f(double 1.000000e+00, double 1.000000e+00, double 1.000000e+00)
%27 = load i32, i32* @GL_PROJECTION
%28 = call i32 @glMatrixMode(i32 %27)
%29 = call i32 (...) @glLoadIdentity()
%30 = call i32 @glOrtho(double -1.000000e+00, double 1.000000e+00, double -1.000000e+00, double 1.000000e+00, double -1.000000e+00, double 1.000000e+00)
ret void
}

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