#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 float GLsizei;
typedef float GLfloat;

/* Variables and functions */
int /*<<< orphan*/ GL_MODELVIEW;
int /*<<< orphan*/ GL_PROJECTION;
int /*<<< orphan*/ glLoadIdentity();
int /*<<< orphan*/ glMatrixMode(int /*<<< orphan*/);
int /*<<< orphan*/ glOrtho(float, float, float, float, float, float);
int /*<<< orphan*/ glViewport(int /*<<< orphan*/, int /*<<< orphan*/, float,
                              float);
void reshape(GLsizei w, GLsizei h) {
  GLfloat range = 120.f;
  if (h == 0) {
    h = 1;
  }
  if (w == 0) {
    w = 1;
  }
  GLfloat aspect = (GLfloat)w / (GLfloat)h;
  glViewport(0, 0, w, h);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  if (w <= h) {
    glOrtho(-range, range, -range * h / w, range * h / w, -range * 2.f,
            range * 2.f);
  } else {
    glOrtho(-range * w / h, range * w / h, -range, range, -range * 2.f,
            range * 2.f);
  }
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
}


x86 assembly (clang, -O0):
<reshape>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  0xea6(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1183 <reshape+0x43>
jp     1183 <reshape+0x43>
movss  0xe86(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    11a7 <reshape+0x67>
jp     11a7 <reshape+0x67>
movss  0xe62(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
divss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
xor    %esi,%esi
mov    %esi,%edi
call   1060 <glViewport@plt>
mov    0x2e08(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
mov    $0x0,%al
call   1050 <glLoadIdentity@plt>
movss  -0x4(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jb     1268 <reshape+0x128>
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  -0xc(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
movd   %xmm2,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm2
mulss  -0x8(%rbp),%xmm2
divss  -0x4(%rbp),%xmm2
movss  -0xc(%rbp),%xmm3
mulss  -0x8(%rbp),%xmm3
divss  -0x4(%rbp),%xmm3
movss  -0xc(%rbp),%xmm4
movd   %xmm4,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm4
movss  0xdbb(%rip),%xmm5
mulss  %xmm5,%xmm4
movss  0xdaf(%rip),%xmm5
mulss  -0xc(%rbp),%xmm5
call   1040 <glOrtho@plt>
jmp    12da <reshape+0x19a>
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  -0x4(%rbp),%xmm0
divss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
mulss  -0x4(%rbp),%xmm1
divss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
movd   %xmm2,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm2
movss  -0xc(%rbp),%xmm3
movss  -0xc(%rbp),%xmm4
movd   %xmm4,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm4
movss  0xd44(%rip),%xmm5
mulss  %xmm5,%xmm4
movss  0xd38(%rip),%xmm5
mulss  -0xc(%rbp),%xmm5
call   1040 <glOrtho@plt>
mov    0x2d07(%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>:
sub    $0x28,%rsp
xorps  %xmm2,%xmm2
movaps %xmm1,%xmm4
cmpeqss %xmm2,%xmm4
movss  0xea9(%rip),%xmm2
movaps %xmm4,%xmm3
andps  %xmm2,%xmm3
andnps %xmm1,%xmm4
orps   %xmm3,%xmm4
movaps %xmm4,(%rsp)
xorps  %xmm1,%xmm1
cmpeqss %xmm0,%xmm1
andps  %xmm1,%xmm2
andnps %xmm0,%xmm1
orps   %xmm2,%xmm1
movaps %xmm1,0x10(%rsp)
xor    %edi,%edi
xor    %esi,%esi
movaps %xmm1,%xmm0
movaps %xmm4,%xmm1
call   1060 <glViewport@plt>
mov    0x2e45(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
xor    %eax,%eax
call   1050 <glLoadIdentity@plt>
movaps 0x10(%rsp),%xmm7
movaps (%rsp),%xmm6
ucomiss %xmm7,%xmm6
jae    11e7 <reshape+0xa7>
movss  0xe4d(%rip),%xmm2
movaps %xmm7,%xmm0
mulss  %xmm2,%xmm0
divss  %xmm6,%xmm0
movss  0xe3e(%rip),%xmm3
mulss  %xmm3,%xmm7
divss  %xmm6,%xmm7
movss  0xe32(%rip),%xmm4
movss  0xe2e(%rip),%xmm5
movaps %xmm7,%xmm1
jmp    121d <reshape+0xdd>
movss  0xe15(%rip),%xmm0
movaps %xmm6,%xmm2
mulss  %xmm0,%xmm2
divss  %xmm7,%xmm2
movss  0xe06(%rip),%xmm1
mulss  %xmm1,%xmm6
divss  %xmm7,%xmm6
movss  0xdfa(%rip),%xmm4
movss  0xdf6(%rip),%xmm5
movaps %xmm6,%xmm3
call   1040 <glOrtho@plt>
mov    0x2dbf(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
xor    %eax,%eax
add    $0x28,%rsp
jmp    1050 <glLoadIdentity@plt>

LLVM IR (-O0):
@GL_PROJECTION = global i32 0
@GL_MODELVIEW = global i32 0
define void @reshape(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %3
store float %1, float* %4
store float 1.200000e+02, float* %5
%7 = load float, float* %4
%8 = fcmp oeq float %7, 0.000000e+00
br i1 %8, label %9, label %10
9: ; preds = %2
store float 1.000000e+00, float* %4
br label %10
10: ; preds = %9, %2
%11 = load float, float* %3
%12 = fcmp oeq float %11, 0.000000e+00
br i1 %12, label %13, label %14
13: ; preds = %10
store float 1.000000e+00, float* %3
br label %14
14: ; preds = %13, %10
%15 = load float, float* %3
%16 = load float, float* %4
%17 = fdiv float %15, %16
store float %17, float* %6
%18 = load float, float* %3
%19 = load float, float* %4
%20 = call i32 @glViewport(i32 0, i32 0, float %18, float %19)
%21 = load i32, i32* @GL_PROJECTION
%22 = call i32 @glMatrixMode(i32 %21)
%23 = call i32 (...) @glLoadIdentity()
%24 = load float, float* %3
%25 = load float, float* %4
%26 = fcmp ole float %24, %25
br i1 %26, label %27, label %48
27: ; preds = %14
%28 = load float, float* %5
%29 = fneg float %28
%30 = load float, float* %5
%31 = load float, float* %5
%32 = fneg float %31
%33 = load float, float* %4
%34 = fmul float %32, %33
%35 = load float, float* %3
%36 = fdiv float %34, %35
%37 = load float, float* %5
%38 = load float, float* %4
%39 = fmul float %37, %38
%40 = load float, float* %3
%41 = fdiv float %39, %40
%42 = load float, float* %5
%43 = fneg float %42
%44 = fmul float %43, 2.000000e+00
%45 = load float, float* %5
%46 = fmul float %45, 2.000000e+00
%47 = call i32 @glOrtho(float %29, float %30, float %36, float %41, float %44, float %46)
br label %69
48: ; preds = %14
%49 = load float, float* %5
%50 = fneg float %49
%51 = load float, float* %3
%52 = fmul float %50, %51
%53 = load float, float* %4
%54 = fdiv float %52, %53
%55 = load float, float* %5
%56 = load float, float* %3
%57 = fmul float %55, %56
%58 = load float, float* %4
%59 = fdiv float %57, %58
%60 = load float, float* %5
%61 = fneg float %60
%62 = load float, float* %5
%63 = load float, float* %5
%64 = fneg float %63
%65 = fmul float %64, 2.000000e+00
%66 = load float, float* %5
%67 = fmul float %66, 2.000000e+00
%68 = call i32 @glOrtho(float %54, float %59, float %61, float %62, float %65, float %67)
br label %69
69: ; preds = %48, %27
%70 = load i32, i32* @GL_MODELVIEW
%71 = call i32 @glMatrixMode(i32 %70)
%72 = call i32 (...) @glLoadIdentity()
ret void
}

LLVM IR (-O2):
@GL_PROJECTION = global i32 0
@GL_MODELVIEW = global i32 0
define void @reshape(float %0, float %1) {
%3 = fcmp oeq float %1, 0.000000e+00
%4 = select i1 %3, float 1.000000e+00, float %1
%5 = fcmp oeq float %0, 0.000000e+00
%6 = select i1 %5, float 1.000000e+00, float %0
%7 = tail call i32 @glViewport(i32 0, i32 0, float %6, float %4)
%8 = load i32, i32* @GL_PROJECTION
%9 = tail call i32 @glMatrixMode(i32 %8)
%10 = tail call i32 (...) @glLoadIdentity()
%11 = fcmp ugt float %6, %4
br i1 %11, label %18, label %12
12: ; preds = %2
%13 = fmul float %4, -1.200000e+02
%14 = fdiv float %13, %6
%15 = fmul float %4, 1.200000e+02
%16 = fdiv float %15, %6
%17 = tail call i32 @glOrtho(float -1.200000e+02, float 1.200000e+02, float %14, float %16, float -2.400000e+02, float 2.400000e+02)
br label %24
18: ; preds = %2
%19 = fmul float %6, -1.200000e+02
%20 = fdiv float %19, %4
%21 = fmul float %6, 1.200000e+02
%22 = fdiv float %21, %4
%23 = tail call i32 @glOrtho(float %20, float %22, float -1.200000e+02, float 1.200000e+02, float -2.400000e+02, float 2.400000e+02)
br label %24
24: ; preds = %18, %12
%25 = load i32, i32* @GL_MODELVIEW
%26 = tail call i32 @glMatrixMode(i32 %25)
%27 = tail call i32 (...) @glLoadIdentity()
ret void
}