#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 * 3))
    glOrtho(-6.0, 6.0, -2.0 * ((GLfloat)h * 3) / (GLfloat)w,
            2.0 * ((GLfloat)h * 3) / (GLfloat)w, 0.0, 10.0);
  else
    glOrtho(-6.0 * (GLfloat)w / ((GLfloat)h * 3),
            6.0 * (GLfloat)w / ((GLfloat)h * 3), -2.0, 2.0, 0.0, 10.0);
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
}


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
imul   $0x3,-0x8(%rbp),%ecx
cmp    %ecx,%eax
jg     11e0 <myReshape+0xa0>
imul   $0x3,-0x8(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  0xe6f(%rip),%xmm2
mulsd  %xmm0,%xmm2
cvtsi2sdl -0x4(%rbp),%xmm0
divsd  %xmm0,%xmm2
imul   $0x3,-0x8(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  0xe5a(%rip),%xmm3
mulsd  %xmm0,%xmm3
cvtsi2sdl -0x4(%rbp),%xmm0
divsd  %xmm0,%xmm3
movsd  0xe5d(%rip),%xmm0
movsd  0xe4d(%rip),%xmm1
xorps  %xmm4,%xmm4
movsd  0xe3a(%rip),%xmm5
call   1040 <glOrtho@plt>
jmp    123a <myReshape+0xfa>
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xe33(%rip),%xmm0
mulsd  %xmm1,%xmm0
imul   $0x3,-0x8(%rbp),%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
cvtsi2sdl -0x4(%rbp),%xmm2
movsd  0xe0e(%rip),%xmm1
mulsd  %xmm2,%xmm1
imul   $0x3,-0x8(%rbp),%eax
cvtsi2sd %eax,%xmm2
divsd  %xmm2,%xmm1
movsd  0xdde(%rip),%xmm2
movsd  0xdde(%rip),%xmm3
xorps  %xmm4,%xmm4
movsd  0xddb(%rip),%xmm5
call   1040 <glOrtho@plt>
mov    0x2da7(%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):
<myReshape>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %edi,%ebx
xor    %edi,%edi
xor    %esi,%esi
mov    %ebx,%edx
mov    %r14d,%ecx
call   1060 <glViewport@plt>
mov    0x2e7a(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
xor    %eax,%eax
call   1050 <glLoadIdentity@plt>
lea    (%r14,%r14,2),%eax
cmp    %ebx,%eax
jge    11aa <myReshape+0x6a>
cvtsi2sd %ebx,%xmm1
movsd  0xe88(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsi2sd %eax,%xmm2
divsd  %xmm2,%xmm0
mulsd  0xe7c(%rip),%xmm1
divsd  %xmm2,%xmm1
movsd  0xe60(%rip),%xmm2
movsd  0xe78(%rip),%xmm3
jmp    11da <myReshape+0x9a>
cvtsi2sd %eax,%xmm3
movsd  0xe4a(%rip),%xmm2
cvtsi2sd %ebx,%xmm0
mulsd  %xmm3,%xmm2
divsd  %xmm0,%xmm2
addsd  %xmm3,%xmm3
divsd  %xmm0,%xmm3
movsd  0xe36(%rip),%xmm0
movsd  0xe36(%rip),%xmm1
movsd  0xe36(%rip),%xmm5
xorps  %xmm4,%xmm4
call   1040 <glOrtho@plt>
mov    0x2df7(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <glLoadIdentity@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, 3
%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, 3
%18 = sitofp i32 %17 to double
%19 = fmul double -2.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, 3
%25 = sitofp i32 %24 to double
%26 = fmul double 2.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 0.000000e+00, 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, 3
%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, 3
%44 = sitofp i32 %43 to double
%45 = fdiv double %41, %44
%46 = call i32 @glOrtho(double %38, double %45, double -2.000000e+00, double 2.000000e+00, double 0.000000e+00, double 1.000000e+01)
br label %47
47: ; preds = %31, %15
%48 = load i32, i32* @GL_MODELVIEW
%49 = call i32 @glMatrixMode(i32 %48)
%50 = call i32 (...) @glLoadIdentity()
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 = mul nsw i32 %1, 3
%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, -2.000000e+00
%12 = sitofp i32 %0 to double
%13 = fdiv double %11, %12
%14 = fmul double %10, 2.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 0.000000e+00, 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 -2.000000e+00, double 2.000000e+00, double 0.000000e+00, double 1.000000e+01)
br label %25
25: ; preds = %17, %9
%26 = load i32, i32* @GL_MODELVIEW
%27 = tail call i32 @glMatrixMode(i32 %26)
%28 = tail call i32 (...) @glLoadIdentity()
ret void
}