#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 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, int);
void myReshape(int w, int h) {
  glViewport(0, 0, w, h);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  if (w <= (h * 2))
    glOrtho(-6.0, 6.0, -3.0 * ((GLfloat)h * 2) / (GLfloat)w,
            3.0 * ((GLfloat)h * 2) / (GLfloat)w, -10.0, 10.0);
  else
    glOrtho(-6.0 * (GLfloat)w / ((GLfloat)h * 2),
            6.0 * (GLfloat)w / ((GLfloat)h * 2), -3.0, 3.0, -10.0, 10.0);
  glMatrixMode(GL_MODELVIEW);
}


x86 assembly (clang, -O0):
<myReshape>:
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
mov    -0x8(%rbp),%ecx
shl    $0x1,%ecx
cmp    %ecx,%eax
jg     11eb <myReshape+0xab>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  0xe6b(%rip),%xmm2
mulsd  %xmm0,%xmm2
cvtsi2sdl -0x4(%rbp),%xmm0
divsd  %xmm0,%xmm2
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  0xe54(%rip),%xmm3
mulsd  %xmm0,%xmm3
cvtsi2sdl -0x4(%rbp),%xmm0
divsd  %xmm0,%xmm3
movsd  0xe5f(%rip),%xmm0
movsd  0xe4f(%rip),%xmm1
movsd  0xe37(%rip),%xmm4
movsd  0xe37(%rip),%xmm5
call   1040 <glOrtho@plt>
jmp    124e <myReshape+0x10e>
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xe30(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
cvtsi2sdl -0x4(%rbp),%xmm2
movsd  0xe09(%rip),%xmm1
mulsd  %xmm2,%xmm1
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm2
divsd  %xmm2,%xmm1
movsd  0xdcf(%rip),%xmm2
movsd  0xdcf(%rip),%xmm3
movsd  0xdcf(%rip),%xmm4
movsd  0xdcf(%rip),%xmm5
call   1040 <glOrtho@plt>
mov    0x2d93(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myReshape>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %edi,%edi
xor    %esi,%esi
mov    %ebp,%edx
mov    %ebx,%ecx
call   1060 <glViewport@plt>
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
xor    %eax,%eax
call   1050 <glLoadIdentity@plt>
add    %ebx,%ebx
cmp    %ebp,%ebx
jge    11a5 <myReshape+0x65>
cvtsi2sd %ebp,%xmm1
movsd  0xe95(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsi2sd %ebx,%xmm2
divsd  %xmm2,%xmm0
mulsd  0xe89(%rip),%xmm1
divsd  %xmm2,%xmm1
movsd  0xe65(%rip),%xmm2
movsd  0xe65(%rip),%xmm3
jmp    11d9 <myReshape+0x99>
cvtsi2sd %ebx,%xmm3
movsd  0xe4f(%rip),%xmm2
mulsd  %xmm3,%xmm2
cvtsi2sd %ebp,%xmm0
divsd  %xmm0,%xmm2
mulsd  0xe43(%rip),%xmm3
divsd  %xmm0,%xmm3
movsd  0xe3f(%rip),%xmm0
movsd  0xe3f(%rip),%xmm1
movsd  0xe3f(%rip),%xmm4
movsd  0xe3f(%rip),%xmm5
call   1040 <glOrtho@plt>
mov    0x2df3(%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 @myReshape(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 = mul nsw i32 %12, 2
%14 = icmp sle i32 %11, %13
br i1 %14, label %15, label %31
15: ; preds = %2
%16 = load i32, i32* %4
%17 = mul nsw i32 %16, 2
%18 = sitofp i32 %17 to double
%19 = fmul double -3.000000e+00, %18
%20 = load i32, i32* %3
%21 = sitofp i32 %20 to double
%22 = fdiv double %19, %21
%23 = load i32, i32* %4
%24 = mul nsw i32 %23, 2
%25 = sitofp i32 %24 to double
%26 = fmul double 3.000000e+00, %25
%27 = load i32, i32* %3
%28 = sitofp i32 %27 to double
%29 = fdiv double %26, %28
%30 = call i32 @glOrtho(double -6.000000e+00, double 6.000000e+00, double %22, double %29, double -1.000000e+01, double 1.000000e+01)
br label %47
31: ; preds = %2
%32 = load i32, i32* %3
%33 = sitofp i32 %32 to double
%34 = fmul double -6.000000e+00, %33
%35 = load i32, i32* %4
%36 = mul nsw i32 %35, 2
%37 = sitofp i32 %36 to double
%38 = fdiv double %34, %37
%39 = load i32, i32* %3
%40 = sitofp i32 %39 to double
%41 = fmul double 6.000000e+00, %40
%42 = load i32, i32* %4
%43 = mul nsw i32 %42, 2
%44 = sitofp i32 %43 to double
%45 = fdiv double %41, %44
%46 = call i32 @glOrtho(double %38, double %45, double -3.000000e+00, double 3.000000e+00, double -1.000000e+01, double 1.000000e+01)
br label %47
47: ; preds = %31, %15
%48 = load i32, i32* @GL_MODELVIEW
%49 = call i32 @glMatrixMode(i32 %48)
ret void
}

LLVM IR (-O2):
@GL_PROJECTION = global i32 0
@GL_MODELVIEW = global i32 0
define void @myReshape(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 = shl nsw i32 %1, 1
%8 = icmp slt i32 %7, %0
br i1 %8, label %17, label %9
9: ; preds = %2
%10 = sitofp i32 %7 to double
%11 = fmul double %10, -3.000000e+00
%12 = sitofp i32 %0 to double
%13 = fdiv double %11, %12
%14 = fmul double %10, 3.000000e+00
%15 = fdiv double %14, %12
%16 = tail call i32 @glOrtho(double -6.000000e+00, double 6.000000e+00, double %13, double %15, double -1.000000e+01, double 1.000000e+01)
br label %25
17: ; preds = %2
%18 = sitofp i32 %0 to double
%19 = fmul double %18, -6.000000e+00
%20 = sitofp i32 %7 to double
%21 = fdiv double %19, %20
%22 = fmul double %18, 6.000000e+00
%23 = fdiv double %22, %20
%24 = tail call i32 @glOrtho(double %21, double %23, double -3.000000e+00, double 3.000000e+00, double -1.000000e+01, double 1.000000e+01)
br label %25
25: ; preds = %17, %9
%26 = load i32, i32* @GL_MODELVIEW
%27 = tail call i32 @glMatrixMode(i32 %26)
ret void
}