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

/* Variables and functions */
int /*<<< orphan*/ GL_MODELVIEW;
int /*<<< orphan*/ GL_PROJECTION;
int /*<<< orphan*/ glLoadIdentity();
int /*<<< orphan*/ glMatrixMode(int /*<<< orphan*/);
int /*<<< orphan*/ glOrtho(double, double, double, double, double, double);
void reshapeOpenGLState(int w, int h) {
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  if (w <= h)
    glOrtho(-2.5, 2.5, -2.5 * (GLfloat)h / (GLfloat)w,
            2.5 * (GLfloat)h / (GLfloat)w, -10.0, 10.0);
  else
    glOrtho(-2.5 * (GLfloat)w / (GLfloat)h, 2.5 * (GLfloat)w / (GLfloat)h, -2.5,
            2.5, -10.0, 10.0);
  glMatrixMode(GL_MODELVIEW);
}


x86 assembly (clang, -O0):
<reshapeOpenGLState>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    0x2e93(%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     11bd <reshapeOpenGLState+0x8d>
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xe94(%rip),%xmm2
mulsd  %xmm0,%xmm2
cvtsi2sdl -0x4(%rbp),%xmm0
divsd  %xmm0,%xmm2
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xe82(%rip),%xmm3
mulsd  %xmm0,%xmm3
cvtsi2sdl -0x4(%rbp),%xmm0
divsd  %xmm0,%xmm3
movsd  0xe65(%rip),%xmm0
movsd  0xe65(%rip),%xmm1
movsd  0xe65(%rip),%xmm4
movsd  0xe65(%rip),%xmm5
call   1040 <glOrtho@plt>
jmp    1216 <reshapeOpenGLState+0xe6>
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xe36(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvtsi2sdl -0x4(%rbp),%xmm2
movsd  0xe24(%rip),%xmm1
mulsd  %xmm2,%xmm1
cvtsi2sdl -0x8(%rbp),%xmm2
divsd  %xmm2,%xmm1
movsd  0xe07(%rip),%xmm2
movsd  0xe07(%rip),%xmm3
movsd  0xe07(%rip),%xmm4
movsd  0xe07(%rip),%xmm5
call   1040 <glOrtho@plt>
mov    0x2dcb(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reshapeOpenGLState>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
xor    %eax,%eax
call   1050 <glLoadIdentity@plt>
cmp    %ebx,%ebp
jle    117e <reshapeOpenGLState+0x4e>
cvtsi2sd %ebp,%xmm1
movsd  0xea4(%rip),%xmm2
movapd %xmm1,%xmm0
mulsd  %xmm2,%xmm0
cvtsi2sd %ebx,%xmm4
divsd  %xmm4,%xmm0
movsd  0xe94(%rip),%xmm3
mulsd  %xmm3,%xmm1
divsd  %xmm4,%xmm1
jmp    11aa <reshapeOpenGLState+0x7a>
cvtsi2sd %ebx,%xmm3
movsd  0xe76(%rip),%xmm0
movapd %xmm3,%xmm2
mulsd  %xmm0,%xmm2
cvtsi2sd %ebp,%xmm4
divsd  %xmm4,%xmm2
movsd  0xe66(%rip),%xmm1
mulsd  %xmm1,%xmm3
divsd  %xmm4,%xmm3
movsd  0xe5e(%rip),%xmm4
movsd  0xe5e(%rip),%xmm5
call   1040 <glOrtho@plt>
mov    0x2e22(%rip),%rax
mov    (%rax),%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <glMatrixMode@plt>

LLVM IR (-O0):
@GL_PROJECTION = global i32 0
@GL_MODELVIEW = global i32 0
define void @reshapeOpenGLState(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* @GL_PROJECTION
%6 = call i32 @glMatrixMode(i32 %5)
%7 = call i32 (...) @glLoadIdentity()
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = icmp sle i32 %8, %9
br i1 %10, label %11, label %25
11: ; preds = %2
%12 = load i32, i32* %4
%13 = sitofp i32 %12 to double
%14 = fmul double -2.500000e+00, %13
%15 = load i32, i32* %3
%16 = sitofp i32 %15 to double
%17 = fdiv double %14, %16
%18 = load i32, i32* %4
%19 = sitofp i32 %18 to double
%20 = fmul double 2.500000e+00, %19
%21 = load i32, i32* %3
%22 = sitofp i32 %21 to double
%23 = fdiv double %20, %22
%24 = call i32 @glOrtho(double -2.500000e+00, double 2.500000e+00, double %17, double %23, double -1.000000e+01, double 1.000000e+01)
br label %39
25: ; preds = %2
%26 = load i32, i32* %3
%27 = sitofp i32 %26 to double
%28 = fmul double -2.500000e+00, %27
%29 = load i32, i32* %4
%30 = sitofp i32 %29 to double
%31 = fdiv double %28, %30
%32 = load i32, i32* %3
%33 = sitofp i32 %32 to double
%34 = fmul double 2.500000e+00, %33
%35 = load i32, i32* %4
%36 = sitofp i32 %35 to double
%37 = fdiv double %34, %36
%38 = call i32 @glOrtho(double %31, double %37, double -2.500000e+00, double 2.500000e+00, double -1.000000e+01, double 1.000000e+01)
br label %39
39: ; preds = %25, %11
%40 = load i32, i32* @GL_MODELVIEW
%41 = call i32 @glMatrixMode(i32 %40)
ret void
}

LLVM IR (-O2):
@GL_PROJECTION = global i32 0
@GL_MODELVIEW = global i32 0
define void @reshapeOpenGLState(i32 %0, i32 %1) {
%3 = load i32, i32* @GL_PROJECTION
%4 = tail call i32 @glMatrixMode(i32 %3)
%5 = tail call i32 (...) @glLoadIdentity()
%6 = icmp sgt i32 %0, %1
br i1 %6, label %15, label %7
7: ; preds = %2
%8 = sitofp i32 %1 to double
%9 = fmul double %8, -2.500000e+00
%10 = sitofp i32 %0 to double
%11 = fdiv double %9, %10
%12 = fmul double %8, 2.500000e+00
%13 = fdiv double %12, %10
%14 = tail call i32 @glOrtho(double -2.500000e+00, double 2.500000e+00, double %11, double %13, double -1.000000e+01, double 1.000000e+01)
br label %23
15: ; preds = %2
%16 = sitofp i32 %0 to double
%17 = fmul double %16, -2.500000e+00
%18 = sitofp i32 %1 to double
%19 = fdiv double %17, %18
%20 = fmul double %16, 2.500000e+00
%21 = fdiv double %20, %18
%22 = tail call i32 @glOrtho(double %19, double %21, double -2.500000e+00, double 2.500000e+00, double -1.000000e+01, double 1.000000e+01)
br label %23
23: ; preds = %15, %7
%24 = load i32, i32* @GL_MODELVIEW
%25 = tail call i32 @glMatrixMode(i32 %24)
ret void
}