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


x86 assembly (clang, -O0):
<quadric_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
jg     11dc <quadric_reshape+0x9c>
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>
jmp    1235 <quadric_reshape+0xf5>
cvtsi2sdl -0x8(%rbp),%xmm1
movsd  0xe17(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvtsi2sdl -0x8(%rbp),%xmm2
movsd  0xe05(%rip),%xmm1
mulsd  %xmm2,%xmm1
cvtsi2sdl -0x4(%rbp),%xmm2
divsd  %xmm2,%xmm1
movsd  0xde8(%rip),%xmm2
movsd  0xde8(%rip),%xmm3
movsd  0xde8(%rip),%xmm4
movsd  0xde8(%rip),%xmm5
call   1040 <glOrtho@plt>
mov    0x2dac(%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):
<quadric_reshape>:
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>
cvtsi2sd %ebx,%xmm7
movsd  0xe8b(%rip),%xmm6
mulsd  %xmm7,%xmm6
cvtsi2sd %ebp,%xmm0
divsd  %xmm0,%xmm6
mulsd  0xe7f(%rip),%xmm7
divsd  %xmm0,%xmm7
cmp    %ebx,%ebp
jle    11bb <quadric_reshape+0x7b>
movsd  0xe67(%rip),%xmm2
movsd  0xe67(%rip),%xmm3
movsd  0xe67(%rip),%xmm4
movsd  0xe67(%rip),%xmm5
movapd %xmm6,%xmm0
movapd %xmm7,%xmm1
jmp    11e3 <quadric_reshape+0xa3>
movsd  0xe3d(%rip),%xmm0
movsd  0xe3d(%rip),%xmm1
movsd  0xe3d(%rip),%xmm4
movsd  0xe3d(%rip),%xmm5
movapd %xmm6,%xmm2
movapd %xmm7,%xmm3
call   1040 <glOrtho@plt>
mov    0x2df9(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <glLoadIdentity@plt>

LLVM IR (-O0):
@GL_PROJECTION = global i32 0
@GL_MODELVIEW = global i32 0
define void @quadric_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 sle i32 %11, %12
br i1 %13, label %14, label %28
14: ; preds = %2
%15 = load i32, i32* %4
%16 = sitofp i32 %15 to double
%17 = fmul double -2.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 2.500000e+00, %22
%24 = load i32, i32* %3
%25 = sitofp i32 %24 to double
%26 = fdiv double %23, %25
%27 = call i32 @glOrtho(double -2.500000e+00, double 2.500000e+00, double %20, double %26, double -1.000000e+01, double 1.000000e+01)
br label %42
28: ; preds = %2
%29 = load i32, i32* %4
%30 = sitofp i32 %29 to double
%31 = fmul double -2.500000e+00, %30
%32 = load i32, i32* %3
%33 = sitofp i32 %32 to double
%34 = fdiv double %31, %33
%35 = load i32, i32* %4
%36 = sitofp i32 %35 to double
%37 = fmul double 2.500000e+00, %36
%38 = load i32, i32* %3
%39 = sitofp i32 %38 to double
%40 = fdiv double %37, %39
%41 = call i32 @glOrtho(double %34, double %40, double -2.500000e+00, double 2.500000e+00, double -1.000000e+01, double 1.000000e+01)
br label %42
42: ; preds = %28, %14
%43 = load i32, i32* @GL_MODELVIEW
%44 = call i32 @glMatrixMode(i32 %43)
%45 = call i32 (...) @glLoadIdentity()
ret void
}

LLVM IR (-O2):
@GL_PROJECTION = global i32 0
@GL_MODELVIEW = global i32 0
define void @quadric_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 sgt i32 %0, %1
%8 = sitofp i32 %1 to double
%9 = fmul double %8, -2.500000e+00
%10 = sitofp i32 %0 to double
%11 = fdiv double %9, %10
%12 = fmul double %8, 2.500000e+00
%13 = fdiv double %12, %10
br i1 %7, label %16, label %14
14: ; preds = %2
%15 = tail call i32 @glOrtho(double -2.500000e+00, double 2.500000e+00, double %11, double %13, double -1.000000e+01, double 1.000000e+01)
br label %18
16: ; preds = %2
%17 = tail call i32 @glOrtho(double %11, double %13, double -2.500000e+00, double 2.500000e+00, double -1.000000e+01, double 1.000000e+01)
br label %18
18: ; preds = %16, %14
%19 = load i32, i32* @GL_MODELVIEW
%20 = tail call i32 @glMatrixMode(i32 %19)
%21 = tail call i32 (...) @glLoadIdentity()
ret void
}