#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 scalar_t__ 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, double, float, float, double, float);
int /*<<< orphan*/ glViewport(int /*<<< orphan*/, int /*<<< orphan*/,
                              scalar_t__, scalar_t__);
void reshape(GLsizei w, GLsizei h) {
  glViewport(0, 0, w, h);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  if (w <= h) {
    glOrtho(-50.0f, 50.0f, -50.0f * (GLfloat)h / (GLfloat)w,
            50.0f * (GLfloat)h / (GLfloat)w, -1.0, 1.0);
  } else {
    glOrtho(-50.0f * (GLfloat)w / (GLfloat)h, 50.0 * (GLfloat)w / (GLfloat)h,
            -50.0f, 50.0f, -1.0, 1.0f);
  }
  glMatrixMode(GL_MODELVIEW);
}


x86 assembly (clang, -O0):
<reshape>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
xor    %esi,%esi
mov    %esi,%edi
call   1060 <glViewport@plt>
mov    0x2e70(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
mov    $0x0,%al
call   1050 <glLoadIdentity@plt>
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jg     11e6 <reshape+0xa6>
cvtsi2ssq -0x10(%rbp),%xmm0
movss  0xe6e(%rip),%xmm2
mulss  %xmm0,%xmm2
cvtsi2ssq -0x8(%rbp),%xmm0
divss  %xmm0,%xmm2
cvtsi2ssq -0x10(%rbp),%xmm0
movss  0xe56(%rip),%xmm3
mulss  %xmm0,%xmm3
cvtsi2ssq -0x8(%rbp),%xmm0
divss  %xmm0,%xmm3
movss  0xe3c(%rip),%xmm0
movsd  0xe4c(%rip),%xmm1
movsd  0xe3c(%rip),%xmm4
movss  0xe2c(%rip),%xmm5
call   1040 <glOrtho@plt>
jmp    124b <reshape+0x10b>
cvtsi2ssq -0x8(%rbp),%xmm1
movss  0xe0c(%rip),%xmm0
mulss  %xmm1,%xmm0
cvtsi2ssq -0x10(%rbp),%xmm1
divss  %xmm1,%xmm0
cvtsi2ssq -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movsd  0xe04(%rip),%xmm1
mulsd  %xmm2,%xmm1
cvtsi2ssq -0x10(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
divsd  %xmm2,%xmm1
movss  0xdd2(%rip),%xmm2
movss  0xdce(%rip),%xmm3
movsd  0xdd2(%rip),%xmm4
movss  0xdc2(%rip),%xmm5
call   1040 <glOrtho@plt>
mov    0x2d96(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reshape>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %edi,%edi
xor    %esi,%esi
mov    %rbx,%rdx
mov    %r14,%rcx
call   1060 <glViewport@plt>
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
xor    %eax,%eax
call   1050 <glLoadIdentity@plt>
cmp    %r14,%rbx
jle    11ab <reshape+0x6b>
cvtsi2ss %rbx,%xmm0
movss  0xe80(%rip),%xmm2
cvtss2sd %xmm0,%xmm1
mulss  %xmm2,%xmm0
cvtsi2ss %r14,%xmm3
divss  %xmm3,%xmm0
mulsd  0xe77(%rip),%xmm1
cvtss2sd %xmm3,%xmm3
divsd  %xmm3,%xmm1
movss  0xe5b(%rip),%xmm3
jmp    11dc <reshape+0x9c>
cvtsi2ss %r14,%xmm3
movss  0xe48(%rip),%xmm0
movaps %xmm3,%xmm2
mulss  %xmm0,%xmm2
cvtsi2ss %rbx,%xmm1
divss  %xmm1,%xmm2
mulss  0xe34(%rip),%xmm3
divss  %xmm1,%xmm3
movsd  0xe34(%rip),%xmm1
movsd  0xe34(%rip),%xmm4
movss  0xe1c(%rip),%xmm5
call   1040 <glOrtho@plt>
mov    0x2df0(%rip),%rax
mov    (%rax),%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <glMatrixMode@plt>

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

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