#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*/ GLint;
typedef double GLfloat;

/* Variables and functions */
int /*<<< orphan*/ GL_MODELVIEW;
int /*<<< orphan*/ GL_PROJECTION;
int /*<<< orphan*/ glFrustum(double, double, double, double, double, double);
int /*<<< orphan*/ glLoadIdentity();
int /*<<< orphan*/ glMatrixMode(int /*<<< orphan*/);
int /*<<< orphan*/ glTranslatef(double, double, double);
int /*<<< orphan*/ glViewport(int /*<<< orphan*/, int /*<<< orphan*/,
                              int /*<<< orphan*/, int /*<<< orphan*/);
void reshape(int width, int height) {
  GLfloat h = (GLfloat)height / (GLfloat)width;
  glViewport(0, 0, (GLint)width, (GLint)height);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  if (h >= 1.0)
    glFrustum(-1.0, 1.0, -h, h, 5.0, 60.0);
  else
    glFrustum(-1.0 / h, 1.0 / h, -1.0, 1.0, 5.0, 60.0);
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  glTranslatef(0.0, 0.0, -40.0);
}


x86 assembly (clang, -O0):
<reshape>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
xor    %esi,%esi
mov    %esi,%edi
call   1070 <glViewport@plt>
mov    0x2e51(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
mov    $0x0,%al
call   1040 <glLoadIdentity@plt>
movsd  -0x10(%rbp),%xmm0
movsd  0xe5e(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     11f7 <reshape+0xa7>
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
movsd  -0x10(%rbp),%xmm3
movsd  0xe33(%rip),%xmm0
movsd  0xe23(%rip),%xmm1
movsd  0xe2b(%rip),%xmm4
movsd  0xe2b(%rip),%xmm5
call   1050 <glFrustum@plt>
jmp    1236 <reshape+0xe6>
movsd  0xe09(%rip),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  0xdf4(%rip),%xmm1
divsd  -0x10(%rbp),%xmm1
movsd  0xdef(%rip),%xmm2
movsd  0xddf(%rip),%xmm3
movsd  0xde7(%rip),%xmm4
movsd  0xde7(%rip),%xmm5
call   1050 <glFrustum@plt>
mov    0x2dab(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
mov    $0x0,%al
call   1040 <glLoadIdentity@plt>
xorps  %xmm1,%xmm1
movsd  0xdca(%rip),%xmm2
movaps %xmm1,%xmm0
call   1060 <glTranslatef@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reshape>:
sub    $0x18,%rsp
mov    %esi,%ecx
cvtsi2sd %esi,%xmm1
mov    %edi,%edx
cvtsi2sd %edi,%xmm0
divsd  %xmm0,%xmm1
movapd %xmm1,(%rsp)
xor    %edi,%edi
xor    %esi,%esi
call   1070 <glViewport@plt>
mov    0x2e5f(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
xor    %eax,%eax
call   1040 <glLoadIdentity@plt>
movapd (%rsp),%xmm6
ucomisd 0xe6c(%rip),%xmm6
jae    11c8 <reshape+0x78>
movsd  0xe6a(%rip),%xmm2
movapd %xmm2,%xmm0
divsd  %xmm6,%xmm0
movsd  0xe52(%rip),%xmm3
movapd %xmm3,%xmm1
divsd  %xmm6,%xmm1
movsd  0xe52(%rip),%xmm4
movsd  0xe52(%rip),%xmm5
jmp    11f8 <reshape+0xa8>
movapd 0xe60(%rip),%xmm2
xorpd  %xmm6,%xmm2
movsd  0xe2c(%rip),%xmm0
movsd  0xe1c(%rip),%xmm1
movsd  0xe24(%rip),%xmm4
movsd  0xe24(%rip),%xmm5
movapd %xmm6,%xmm3
call   1050 <glFrustum@plt>
mov    0x2de4(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
xor    %eax,%eax
call   1040 <glLoadIdentity@plt>
movsd  0xe06(%rip),%xmm2
xorpd  %xmm0,%xmm0
xorpd  %xmm1,%xmm1
add    $0x18,%rsp
jmp    1060 <glTranslatef@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
%5 = alloca double
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = sitofp i32 %6 to double
%8 = load i32, i32* %3
%9 = sitofp i32 %8 to double
%10 = fdiv double %7, %9
store double %10, double* %5
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = call i32 @glViewport(i32 0, i32 0, i32 %11, i32 %12)
%14 = load i32, i32* @GL_PROJECTION
%15 = call i32 @glMatrixMode(i32 %14)
%16 = call i32 (...) @glLoadIdentity()
%17 = load double, double* %5
%18 = fcmp oge double %17, 1.000000e+00
br i1 %18, label %19, label %24
19: ; preds = %2
%20 = load double, double* %5
%21 = fneg double %20
%22 = load double, double* %5
%23 = call i32 @glFrustum(double -1.000000e+00, double 1.000000e+00, double %21, double %22, double 5.000000e+00, double 6.000000e+01)
br label %30
24: ; preds = %2
%25 = load double, double* %5
%26 = fdiv double -1.000000e+00, %25
%27 = load double, double* %5
%28 = fdiv double 1.000000e+00, %27
%29 = call i32 @glFrustum(double %26, double %28, double -1.000000e+00, double 1.000000e+00, double 5.000000e+00, double 6.000000e+01)
br label %30
30: ; preds = %24, %19
%31 = load i32, i32* @GL_MODELVIEW
%32 = call i32 @glMatrixMode(i32 %31)
%33 = call i32 (...) @glLoadIdentity()
%34 = call i32 @glTranslatef(double 0.000000e+00, double 0.000000e+00, double -4.000000e+01)
ret void
}

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