#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*/ glOrtho(int, int, int, int, int, int);
int /*<<< orphan*/ glViewport(int /*<<< orphan*/, int /*<<< orphan*/,
                              int /*<<< orphan*/, int /*<<< orphan*/);
void reshape(int width, int height) {
  GLfloat range = 100.0f;
  if (height == 0) {
    height = 1;
  }
  glViewport(0, 0, (GLsizei)width, (GLsizei)height);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  if (width <= height) {
    glOrtho(-range, range, -range * height / width, range * height / width,
            -range, range);
  } else {
    glOrtho(-range * width / height, range * width / height, -range, range,
            -range, range);
  }
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
}


x86 assembly (clang, -O0):
<reshape>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x64,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1166 <reshape+0x26>
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
xor    %esi,%esi
mov    %esi,%edi
call   1060 <glViewport@plt>
mov    0x2e5c(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
mov    $0x0,%al
call   1050 <glLoadIdentity@plt>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11d3 <reshape+0x93>
xor    %edi,%edi
sub    -0xc(%rbp),%edi
mov    -0xc(%rbp),%esi
xor    %eax,%eax
sub    -0xc(%rbp),%eax
imul   -0x8(%rbp),%eax
cltd
idivl  -0x4(%rbp)
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
imul   -0x8(%rbp),%eax
cltd
idivl  -0x4(%rbp)
mov    -0x10(%rbp),%edx
mov    %eax,%ecx
xor    %r8d,%r8d
sub    -0xc(%rbp),%r8d
mov    -0xc(%rbp),%r9d
call   1040 <glOrtho@plt>
jmp    1207 <reshape+0xc7>
xor    %eax,%eax
sub    -0xc(%rbp),%eax
imul   -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,%edi
mov    -0xc(%rbp),%eax
imul   -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,%esi
xor    %edx,%edx
sub    -0xc(%rbp),%edx
mov    -0xc(%rbp),%ecx
xor    %r8d,%r8d
sub    -0xc(%rbp),%r8d
mov    -0xc(%rbp),%r9d
call   1040 <glOrtho@plt>
mov    0x2dda(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
mov    $0x0,%al
call   1050 <glLoadIdentity@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reshape>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
test   %esi,%esi
mov    $0x1,%ebp
cmovne %esi,%ebp
xor    %edi,%edi
xor    %esi,%esi
mov    %ebx,%edx
mov    %ebp,%ecx
call   1060 <glViewport@plt>
mov    0x2e75(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
xor    %eax,%eax
call   1050 <glLoadIdentity@plt>
cmp    %ebx,%ebp
jge    1191 <reshape+0x51>
imul   $0xffffff9c,%ebx,%eax
cltd
idiv   %ebp
mov    %eax,%edi
imul   $0x64,%ebx,%eax
cltd
idiv   %ebp
mov    %eax,%esi
mov    $0xffffff9c,%edx
mov    $0x64,%ecx
jmp    11ad <reshape+0x6d>
imul   $0xffffff9c,%ebp,%eax
cltd
idiv   %ebx
mov    %eax,%ecx
imul   $0x64,%ebp,%eax
cltd
idiv   %ebx
mov    $0xffffff9c,%edi
mov    $0x64,%esi
mov    %ecx,%edx
mov    %eax,%ecx
mov    $0xffffff9c,%r8d
mov    $0x64,%r9d
call   1040 <glOrtho@plt>
mov    0x2e23(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <glLoadIdentity@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
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 100, i32* %5
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %2
store i32 1, i32* %4
br label %9
9: ; preds = %8, %2
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = call i32 @glViewport(i32 0, i32 0, i32 %10, i32 %11)
%13 = load i32, i32* @GL_PROJECTION
%14 = call i32 @glMatrixMode(i32 %13)
%15 = call i32 (...) @glLoadIdentity()
%16 = load i32, i32* %3
%17 = load i32, i32* %4
%18 = icmp sle i32 %16, %17
br i1 %18, label %19, label %38
19: ; preds = %9
%20 = load i32, i32* %5
%21 = sub nsw i32 0, %20
%22 = load i32, i32* %5
%23 = load i32, i32* %5
%24 = sub nsw i32 0, %23
%25 = load i32, i32* %4
%26 = mul nsw i32 %24, %25
%27 = load i32, i32* %3
%28 = sdiv i32 %26, %27
%29 = load i32, i32* %5
%30 = load i32, i32* %4
%31 = mul nsw i32 %29, %30
%32 = load i32, i32* %3
%33 = sdiv i32 %31, %32
%34 = load i32, i32* %5
%35 = sub nsw i32 0, %34
%36 = load i32, i32* %5
%37 = call i32 @glOrtho(i32 %21, i32 %22, i32 %28, i32 %33, i32 %35, i32 %36)
br label %57
38: ; preds = %9
%39 = load i32, i32* %5
%40 = sub nsw i32 0, %39
%41 = load i32, i32* %3
%42 = mul nsw i32 %40, %41
%43 = load i32, i32* %4
%44 = sdiv i32 %42, %43
%45 = load i32, i32* %5
%46 = load i32, i32* %3
%47 = mul nsw i32 %45, %46
%48 = load i32, i32* %4
%49 = sdiv i32 %47, %48
%50 = load i32, i32* %5
%51 = sub nsw i32 0, %50
%52 = load i32, i32* %5
%53 = load i32, i32* %5
%54 = sub nsw i32 0, %53
%55 = load i32, i32* %5
%56 = call i32 @glOrtho(i32 %44, i32 %49, i32 %51, i32 %52, i32 %54, i32 %55)
br label %57
57: ; preds = %38, %19
%58 = load i32, i32* @GL_MODELVIEW
%59 = call i32 @glMatrixMode(i32 %58)
%60 = call i32 (...) @glLoadIdentity()
ret void
}

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