#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_ALWAYS;
int /*<<< orphan*/ GL_MODELVIEW;
int /*<<< orphan*/ GL_PROJECTION;
int /*<<< orphan*/ GL_QUADS;
int /*<<< orphan*/ GL_REPLACE;
int /*<<< orphan*/ GL_STENCIL_BUFFER_BIT;
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glClear(int /*<<< orphan*/);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glLoadIdentity();
int /*<<< orphan*/ glMatrixMode(int /*<<< orphan*/);
int /*<<< orphan*/ glStencilFunc(int /*<<< orphan*/, int, int);
int /*<<< orphan*/ glStencilOp(int /*<<< orphan*/, int /*<<< orphan*/,
                               int /*<<< orphan*/);
int /*<<< orphan*/ glTranslatef(double, double, double);
int /*<<< orphan*/ glVertex2f(double, double);
int /*<<< orphan*/ glViewport(int /*<<< orphan*/, int /*<<< orphan*/,
                              int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ gluOrtho2D(double, double, double, double);
int /*<<< orphan*/ gluPerspective(double, double, double, double);
void reshape(int w, int h) {
  glViewport(0, 0, (GLsizei)w, (GLsizei)h);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  if (w <= h)
    gluOrtho2D(-3.0, 3.0, -3.0 * (GLfloat)h / (GLfloat)w,
               3.0 * (GLfloat)h / (GLfloat)w);
  else
    gluOrtho2D(-3.0 * (GLfloat)w / (GLfloat)h, 3.0 * (GLfloat)w / (GLfloat)h,
               -3.0, 3.0);
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  glClear(GL_STENCIL_BUFFER_BIT);
  glStencilFunc(GL_ALWAYS, 0x1, 0x1);
  glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);
  glBegin(GL_QUADS);
  glVertex2f(-1.0, 0.0);
  glVertex2f(0.0, 1.0);
  glVertex2f(1.0, 0.0);
  glVertex2f(0.0, -1.0);
  glEnd();
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  gluPerspective(45.0, (GLfloat)w / (GLfloat)h, 3.0, 7.0);
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  glTranslatef(0.0, 0.0, -5.0);
}


x86 assembly (clang, -O0):
<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   10e0 <glViewport@plt>
mov    0x2dd4(%rip),%rax
mov    (%rax),%edi
call   1050 <glMatrixMode@plt>
mov    $0x0,%al
call   1080 <glLoadIdentity@plt>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     124c <reshape+0x8c>
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xdf5(%rip),%xmm2
mulsd  %xmm0,%xmm2
cvtsi2sdl -0x4(%rbp),%xmm0
divsd  %xmm0,%xmm2
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xde3(%rip),%xmm3
mulsd  %xmm0,%xmm3
cvtsi2sdl -0x4(%rbp),%xmm0
divsd  %xmm0,%xmm3
movsd  0xdc6(%rip),%xmm0
movsd  0xdc6(%rip),%xmm1
call   10b0 <gluOrtho2D@plt>
jmp    1295 <reshape+0xd5>
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xda7(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvtsi2sdl -0x4(%rbp),%xmm2
movsd  0xd95(%rip),%xmm1
mulsd  %xmm2,%xmm1
cvtsi2sdl -0x8(%rbp),%xmm2
divsd  %xmm2,%xmm1
movsd  0xd78(%rip),%xmm2
movsd  0xd78(%rip),%xmm3
call   10b0 <gluOrtho2D@plt>
mov    0x2d44(%rip),%rax
mov    (%rax),%edi
call   1050 <glMatrixMode@plt>
mov    $0x0,%al
call   1080 <glLoadIdentity@plt>
mov    0x2d1f(%rip),%rax
mov    (%rax),%edi
call   1040 <glClear@plt>
mov    0x2d01(%rip),%rax
mov    (%rax),%edi
mov    $0x1,%edx
mov    %edx,%esi
call   10a0 <glStencilFunc@plt>
mov    0x2cf4(%rip),%rax
mov    (%rax),%edi
mov    0x2ceb(%rip),%rax
mov    (%rax),%esi
mov    0x2ce2(%rip),%rax
mov    (%rax),%edx
call   1030 <glStencilOp@plt>
mov    0x2cf4(%rip),%rax
mov    (%rax),%edi
call   10d0 <glBegin@plt>
movsd  0xd25(%rip),%xmm0
xorps  %xmm1,%xmm1
call   1090 <glVertex2f@plt>
xorps  %xmm0,%xmm0
movsd  0xd1a(%rip),%xmm1
call   1090 <glVertex2f@plt>
movsd  0xd0d(%rip),%xmm0
xorps  %xmm1,%xmm1
call   1090 <glVertex2f@plt>
xorps  %xmm0,%xmm0
movsd  0xcf2(%rip),%xmm1
call   1090 <glVertex2f@plt>
mov    $0x0,%al
call   1060 <glEnd@plt>
mov    0x2c6f(%rip),%rax
mov    (%rax),%edi
call   1050 <glMatrixMode@plt>
mov    $0x0,%al
call   1080 <glLoadIdentity@plt>
cvtsi2sdl -0x4(%rbp),%xmm1
cvtsi2sdl -0x8(%rbp),%xmm0
divsd  %xmm0,%xmm1
movsd  0xcab(%rip),%xmm0
movsd  0xc93(%rip),%xmm2
movsd  0xca3(%rip),%xmm3
call   1070 <gluPerspective@plt>
mov    0x2c57(%rip),%rax
mov    (%rax),%edi
call   1050 <glMatrixMode@plt>
mov    $0x0,%al
call   1080 <glLoadIdentity@plt>
xorps  %xmm1,%xmm1
movsd  0xc6e(%rip),%xmm2
movaps %xmm1,%xmm0
call   10c0 <glTranslatef@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reshape>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %esi,%ebx
mov    %edi,%ebp
xor    %edi,%edi
xor    %esi,%esi
mov    %ebp,%edx
mov    %ebx,%ecx
call   10e0 <glViewport@plt>
mov    0x2dd8(%rip),%r14
mov    (%r14),%edi
call   1050 <glMatrixMode@plt>
xor    %eax,%eax
call   1080 <glLoadIdentity@plt>
cmp    %ebx,%ebp
jle    122c <reshape+0x6c>
cvtsi2sd %ebp,%xmm1
movsd  0xe01(%rip),%xmm2
movapd %xmm1,%xmm0
mulsd  %xmm2,%xmm0
cvtsi2sd %ebx,%xmm4
divsd  %xmm4,%xmm0
movsd  0xdf1(%rip),%xmm3
movsd  %xmm1,(%rsp)
mulsd  %xmm3,%xmm1
movsd  %xmm4,0x8(%rsp)
divsd  %xmm4,%xmm1
jmp    1263 <reshape+0xa3>
cvtsi2sd %ebx,%xmm3
movsd  0xdc8(%rip),%xmm0
movapd %xmm3,%xmm2
mulsd  %xmm0,%xmm2
cvtsi2sd %ebp,%xmm4
divsd  %xmm4,%xmm2
movsd  0xdb8(%rip),%xmm1
movsd  %xmm3,0x8(%rsp)
mulsd  %xmm1,%xmm3
movsd  %xmm4,(%rsp)
divsd  %xmm4,%xmm3
call   10b0 <gluOrtho2D@plt>
movsd  (%rsp),%xmm0
divsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%rsp)
mov    0x2d61(%rip),%rbx
mov    (%rbx),%edi
call   1050 <glMatrixMode@plt>
xor    %eax,%eax
call   1080 <glLoadIdentity@plt>
mov    0x2d3c(%rip),%rax
mov    (%rax),%edi
call   1040 <glClear@plt>
mov    0x2d1e(%rip),%rax
mov    (%rax),%edi
mov    $0x1,%esi
mov    $0x1,%edx
call   10a0 <glStencilFunc@plt>
mov    0x2d0e(%rip),%rax
mov    (%rax),%edi
mov    %edi,%esi
mov    %edi,%edx
call   1030 <glStencilOp@plt>
mov    0x2d1c(%rip),%rax
mov    (%rax),%edi
call   10d0 <glBegin@plt>
movsd  0xd35(%rip),%xmm0
xorpd  %xmm1,%xmm1
call   1090 <glVertex2f@plt>
movsd  0xd2c(%rip),%xmm1
xorps  %xmm0,%xmm0
call   1090 <glVertex2f@plt>
xorps  %xmm1,%xmm1
movsd  0xd19(%rip),%xmm0
call   1090 <glVertex2f@plt>
xorps  %xmm0,%xmm0
movsd  0xd01(%rip),%xmm1
call   1090 <glVertex2f@plt>
xor    %eax,%eax
call   1060 <glEnd@plt>
mov    (%r14),%edi
call   1050 <glMatrixMode@plt>
xor    %eax,%eax
call   1080 <glLoadIdentity@plt>
movsd  0xcee(%rip),%xmm0
movsd  0xcce(%rip),%xmm2
movsd  0xce6(%rip),%xmm3
movsd  (%rsp),%xmm1
call   1070 <gluPerspective@plt>
mov    (%rbx),%edi
call   1050 <glMatrixMode@plt>
xor    %eax,%eax
call   1080 <glLoadIdentity@plt>
movsd  0xcce(%rip),%xmm2
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
jmp    10c0 <glTranslatef@plt>

LLVM IR (-O0):
@GL_PROJECTION = global i32 0
@GL_MODELVIEW = global i32 0
@GL_STENCIL_BUFFER_BIT = global i32 0
@GL_ALWAYS = global i32 0
@GL_REPLACE = global i32 0
@GL_QUADS = 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* %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 -3.000000e+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 3.000000e+00, %22
%24 = load i32, i32* %3
%25 = sitofp i32 %24 to double
%26 = fdiv double %23, %25
%27 = call i32 @gluOrtho2D(double -3.000000e+00, double 3.000000e+00, double %20, double %26)
br label %42
28: ; preds = %2
%29 = load i32, i32* %3
%30 = sitofp i32 %29 to double
%31 = fmul double -3.000000e+00, %30
%32 = load i32, i32* %4
%33 = sitofp i32 %32 to double
%34 = fdiv double %31, %33
%35 = load i32, i32* %3
%36 = sitofp i32 %35 to double
%37 = fmul double 3.000000e+00, %36
%38 = load i32, i32* %4
%39 = sitofp i32 %38 to double
%40 = fdiv double %37, %39
%41 = call i32 @gluOrtho2D(double %34, double %40, double -3.000000e+00, double 3.000000e+00)
br label %42
42: ; preds = %28, %14
%43 = load i32, i32* @GL_MODELVIEW
%44 = call i32 @glMatrixMode(i32 %43)
%45 = call i32 (...) @glLoadIdentity()
%46 = load i32, i32* @GL_STENCIL_BUFFER_BIT
%47 = call i32 @glClear(i32 %46)
%48 = load i32, i32* @GL_ALWAYS
%49 = call i32 @glStencilFunc(i32 %48, i32 1, i32 1)
%50 = load i32, i32* @GL_REPLACE
%51 = load i32, i32* @GL_REPLACE
%52 = load i32, i32* @GL_REPLACE
%53 = call i32 @glStencilOp(i32 %50, i32 %51, i32 %52)
%54 = load i32, i32* @GL_QUADS
%55 = call i32 @glBegin(i32 %54)
%56 = call i32 @glVertex2f(double -1.000000e+00, double 0.000000e+00)
%57 = call i32 @glVertex2f(double 0.000000e+00, double 1.000000e+00)
%58 = call i32 @glVertex2f(double 1.000000e+00, double 0.000000e+00)
%59 = call i32 @glVertex2f(double 0.000000e+00, double -1.000000e+00)
%60 = call i32 (...) @glEnd()
%61 = load i32, i32* @GL_PROJECTION
%62 = call i32 @glMatrixMode(i32 %61)
%63 = call i32 (...) @glLoadIdentity()
%64 = load i32, i32* %3
%65 = sitofp i32 %64 to double
%66 = load i32, i32* %4
%67 = sitofp i32 %66 to double
%68 = fdiv double %65, %67
%69 = call i32 @gluPerspective(double 4.500000e+01, double %68, double 3.000000e+00, double 7.000000e+00)
%70 = load i32, i32* @GL_MODELVIEW
%71 = call i32 @glMatrixMode(i32 %70)
%72 = call i32 (...) @glLoadIdentity()
%73 = call i32 @glTranslatef(double 0.000000e+00, double 0.000000e+00, double -5.000000e+00)
ret void
}

LLVM IR (-O2):
@GL_PROJECTION = global i32 0
@GL_MODELVIEW = global i32 0
@GL_STENCIL_BUFFER_BIT = global i32 0
@GL_ALWAYS = global i32 0
@GL_REPLACE = global i32 0
@GL_QUADS = global i32 0
define void @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
br i1 %7, label %16, label %8
8: ; preds = %2
%9 = sitofp i32 %1 to double
%10 = fmul double %9, -3.000000e+00
%11 = sitofp i32 %0 to double
%12 = fdiv double %10, %11
%13 = fmul double %9, 3.000000e+00
%14 = fdiv double %13, %11
%15 = tail call i32 @gluOrtho2D(double -3.000000e+00, double 3.000000e+00, double %12, double %14)
br label %24
16: ; preds = %2
%17 = sitofp i32 %0 to double
%18 = fmul double %17, -3.000000e+00
%19 = sitofp i32 %1 to double
%20 = fdiv double %18, %19
%21 = fmul double %17, 3.000000e+00
%22 = fdiv double %21, %19
%23 = tail call i32 @gluOrtho2D(double %20, double %22, double -3.000000e+00, double 3.000000e+00)
br label %24
24: ; preds = %16, %8
%25 = phi double [ %19, %16 ], [ %9, %8 ]
%26 = phi double [ %17, %16 ], [ %11, %8 ]
%27 = load i32, i32* @GL_MODELVIEW
%28 = tail call i32 @glMatrixMode(i32 %27)
%29 = tail call i32 (...) @glLoadIdentity()
%30 = load i32, i32* @GL_STENCIL_BUFFER_BIT
%31 = tail call i32 @glClear(i32 %30)
%32 = load i32, i32* @GL_ALWAYS
%33 = tail call i32 @glStencilFunc(i32 %32, i32 1, i32 1)
%34 = load i32, i32* @GL_REPLACE
%35 = tail call i32 @glStencilOp(i32 %34, i32 %34, i32 %34)
%36 = load i32, i32* @GL_QUADS
%37 = tail call i32 @glBegin(i32 %36)
%38 = tail call i32 @glVertex2f(double -1.000000e+00, double 0.000000e+00)
%39 = tail call i32 @glVertex2f(double 0.000000e+00, double 1.000000e+00)
%40 = tail call i32 @glVertex2f(double 1.000000e+00, double 0.000000e+00)
%41 = tail call i32 @glVertex2f(double 0.000000e+00, double -1.000000e+00)
%42 = tail call i32 (...) @glEnd()
%43 = load i32, i32* @GL_PROJECTION
%44 = tail call i32 @glMatrixMode(i32 %43)
%45 = tail call i32 (...) @glLoadIdentity()
%46 = fdiv double %26, %25
%47 = tail call i32 @gluPerspective(double 4.500000e+01, double %46, double 3.000000e+00, double 7.000000e+00)
%48 = load i32, i32* @GL_MODELVIEW
%49 = tail call i32 @glMatrixMode(i32 %48)
%50 = tail call i32 (...) @glLoadIdentity()
%51 = tail call i32 @glTranslatef(double 0.000000e+00, double 0.000000e+00, double -5.000000e+00)
ret void
}