#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 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);
int /*<<< orphan*/ glViewport(int /*<<< orphan*/, int /*<<< orphan*/,
                              int /*<<< orphan*/, int /*<<< orphan*/);
void reshape(int w, int h) {
  glViewport(0, 0, (GLsizei)w, (GLsizei)h);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  if (w < h) {
    glOrtho(-1.5, 1.5, -1.5 * (GLfloat)h / (GLfloat)w,
            1.5 * (GLfloat)h / (GLfloat)w, -10, 10);
    glOrtho(-1.5 * (GLfloat)w / (GLfloat)h, 1.5 * (GLfloat)w / (GLfloat)h, -1.5,
            1.5, -10.0, 10.0);
    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)
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
xor    %esi,%esi
mov    %esi,%edi
call   1060 <glViewport@plt>
mov    0x2e74(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
mov    $0x0,%al
call   1050 <glLoadIdentity@plt>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1245 <reshape+0x105>
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xe75(%rip),%xmm2
mulsd  %xmm0,%xmm2
cvtsi2sdl -0x4(%rbp),%xmm0
divsd  %xmm0,%xmm2
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xe63(%rip),%xmm3
mulsd  %xmm0,%xmm3
cvtsi2sdl -0x4(%rbp),%xmm0
divsd  %xmm0,%xmm3
movsd  0xe46(%rip),%xmm0
movsd  0xe46(%rip),%xmm1
movsd  0xe46(%rip),%xmm4
movsd  0xe46(%rip),%xmm5
call   1040 <glOrtho@plt>
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xe1c(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvtsi2sdl -0x4(%rbp),%xmm2
movsd  0xe0a(%rip),%xmm1
mulsd  %xmm2,%xmm1
cvtsi2sdl -0x8(%rbp),%xmm2
divsd  %xmm2,%xmm1
movsd  0xded(%rip),%xmm2
movsd  0xded(%rip),%xmm3
movsd  0xded(%rip),%xmm4
movsd  0xded(%rip),%xmm5
call   1040 <glOrtho@plt>
mov    0x2db1(%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
sub    $0x18,%rsp
mov    %esi,%ebp
mov    %edi,%ebx
xor    %edi,%edi
xor    %esi,%esi
mov    %ebx,%edx
mov    %ebp,%ecx
call   1060 <glViewport@plt>
mov    0x2e7a(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
xor    %eax,%eax
call   1050 <glLoadIdentity@plt>
cmp    %ebp,%ebx
jge    1221 <reshape+0xe1>
cvtsi2sd %ebp,%xmm3
movsd  %xmm3,0x10(%rsp)
movsd  0xe7a(%rip),%xmm0
movapd %xmm3,%xmm2
mulsd  %xmm0,%xmm2
cvtsi2sd %ebx,%xmm4
movsd  %xmm4,0x8(%rsp)
divsd  %xmm4,%xmm2
movsd  0xe64(%rip),%xmm1
mulsd  %xmm1,%xmm3
divsd  %xmm4,%xmm3
movsd  0xe5c(%rip),%xmm4
movsd  0xe5c(%rip),%xmm5
call   1040 <glOrtho@plt>
movsd  0x8(%rsp),%xmm1
movapd %xmm1,%xmm0
movsd  0xe2d(%rip),%xmm2
mulsd  %xmm2,%xmm0
movsd  0x10(%rsp),%xmm4
divsd  %xmm4,%xmm0
movsd  0xe1f(%rip),%xmm3
mulsd  %xmm3,%xmm1
divsd  %xmm4,%xmm1
movsd  0xe17(%rip),%xmm4
movsd  0xe17(%rip),%xmm5
call   1040 <glOrtho@plt>
mov    0x2ddb(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <glLoadIdentity@plt>
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

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
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call i32 @glViewport(i32 0, i32 0, i32 %5, i32 %6)
%8 = load i32, i32* @GL_PROJECTION
%9 = call i32 @glMatrixMode(i32 %8)
%10 = call i32 (...) @glLoadIdentity()
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %44
14: ; preds = %2
%15 = load i32, i32* %4
%16 = sitofp i32 %15 to double
%17 = fmul double -1.500000e+00, %16
%18 = load i32, i32* %3
%19 = sitofp i32 %18 to double
%20 = fdiv double %17, %19
%21 = load i32, i32* %4
%22 = sitofp i32 %21 to double
%23 = fmul double 1.500000e+00, %22
%24 = load i32, i32* %3
%25 = sitofp i32 %24 to double
%26 = fdiv double %23, %25
%27 = call i32 @glOrtho(double -1.500000e+00, double 1.500000e+00, double %20, double %26, double -1.000000e+01, double 1.000000e+01)
%28 = load i32, i32* %3
%29 = sitofp i32 %28 to double
%30 = fmul double -1.500000e+00, %29
%31 = load i32, i32* %4
%32 = sitofp i32 %31 to double
%33 = fdiv double %30, %32
%34 = load i32, i32* %3
%35 = sitofp i32 %34 to double
%36 = fmul double 1.500000e+00, %35
%37 = load i32, i32* %4
%38 = sitofp i32 %37 to double
%39 = fdiv double %36, %38
%40 = call i32 @glOrtho(double %33, double %39, double -1.500000e+00, double 1.500000e+00, double -1.000000e+01, double 1.000000e+01)
%41 = load i32, i32* @GL_MODELVIEW
%42 = call i32 @glMatrixMode(i32 %41)
%43 = call i32 (...) @glLoadIdentity()
br label %44
44: ; preds = %14, %2
ret void
}

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