#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*/ glMatrixMode(int /*<<< orphan*/);
int /*<<< orphan*/ glOrtho(double, double, double, double, double, double);
void reshape(int w, int h) {
  glMatrixMode(GL_PROJECTION);
  if (w <= h)
    glOrtho(-5.0, 5.0, -5.0 * (GLfloat)h / (GLfloat)w,
            5.0 * (GLfloat)h / (GLfloat)w, -20.0, 20.0);
  else
    glOrtho(-5.0 * (GLfloat)w / (GLfloat)h, 5.0 * (GLfloat)w / (GLfloat)h, -5.0,
            5.0, -20.0, 20.0);
  glMatrixMode(GL_MODELVIEW);
}


x86 assembly (clang, -O0):
<reshape>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    0x2ea3(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11a6 <reshape+0x86>
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xeab(%rip),%xmm2
mulsd  %xmm0,%xmm2
cvtsi2sdl -0x4(%rbp),%xmm0
divsd  %xmm0,%xmm2
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xe99(%rip),%xmm3
mulsd  %xmm0,%xmm3
cvtsi2sdl -0x4(%rbp),%xmm0
divsd  %xmm0,%xmm3
movsd  0xe7c(%rip),%xmm0
movsd  0xe7c(%rip),%xmm1
movsd  0xe7c(%rip),%xmm4
movsd  0xe7c(%rip),%xmm5
call   1040 <glOrtho@plt>
jmp    11ff <reshape+0xdf>
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xe4d(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvtsi2sdl -0x4(%rbp),%xmm2
movsd  0xe3b(%rip),%xmm1
mulsd  %xmm2,%xmm1
cvtsi2sdl -0x8(%rbp),%xmm2
divsd  %xmm2,%xmm1
movsd  0xe1e(%rip),%xmm2
movsd  0xe1e(%rip),%xmm3
movsd  0xe1e(%rip),%xmm4
movsd  0xe1e(%rip),%xmm5
call   1040 <glOrtho@plt>
mov    0x2de2(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reshape>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
cmp    %ebx,%ebp
jle    1167 <reshape+0x47>
cvtsi2sd %ebp,%xmm1
movsd  0xebb(%rip),%xmm2
movapd %xmm1,%xmm0
mulsd  %xmm2,%xmm0
cvtsi2sd %ebx,%xmm4
divsd  %xmm4,%xmm0
movsd  0xeab(%rip),%xmm3
mulsd  %xmm3,%xmm1
divsd  %xmm4,%xmm1
jmp    1193 <reshape+0x73>
cvtsi2sd %ebx,%xmm3
movsd  0xe8d(%rip),%xmm0
movapd %xmm3,%xmm2
mulsd  %xmm0,%xmm2
cvtsi2sd %ebp,%xmm4
divsd  %xmm4,%xmm2
movsd  0xe7d(%rip),%xmm1
mulsd  %xmm1,%xmm3
divsd  %xmm4,%xmm3
movsd  0xe75(%rip),%xmm4
movsd  0xe75(%rip),%xmm5
call   1040 <glOrtho@plt>
mov    0x2e39(%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 @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* @GL_PROJECTION
%6 = call i32 @glMatrixMode(i32 %5)
%7 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = icmp sle i32 %7, %8
br i1 %9, label %10, label %24
10: ; preds = %2
%11 = load i32, i32* %4
%12 = sitofp i32 %11 to double
%13 = fmul double -5.000000e+00, %12
%14 = load i32, i32* %3
%15 = sitofp i32 %14 to double
%16 = fdiv double %13, %15
%17 = load i32, i32* %4
%18 = sitofp i32 %17 to double
%19 = fmul double 5.000000e+00, %18
%20 = load i32, i32* %3
%21 = sitofp i32 %20 to double
%22 = fdiv double %19, %21
%23 = call i32 @glOrtho(double -5.000000e+00, double 5.000000e+00, double %16, double %22, double -2.000000e+01, double 2.000000e+01)
br label %38
24: ; preds = %2
%25 = load i32, i32* %3
%26 = sitofp i32 %25 to double
%27 = fmul double -5.000000e+00, %26
%28 = load i32, i32* %4
%29 = sitofp i32 %28 to double
%30 = fdiv double %27, %29
%31 = load i32, i32* %3
%32 = sitofp i32 %31 to double
%33 = fmul double 5.000000e+00, %32
%34 = load i32, i32* %4
%35 = sitofp i32 %34 to double
%36 = fdiv double %33, %35
%37 = call i32 @glOrtho(double %30, double %36, double -5.000000e+00, double 5.000000e+00, double -2.000000e+01, double 2.000000e+01)
br label %38
38: ; preds = %24, %10
%39 = load i32, i32* @GL_MODELVIEW
%40 = call i32 @glMatrixMode(i32 %39)
ret void
}

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