#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 float GLfloat;

/* Variables and functions */
int /*<<< orphan*/ GL_AMBIENT_AND_DIFFUSE;
int /*<<< orphan*/ GL_CULL_FACE;
int /*<<< orphan*/ GL_DEPTH_TEST;
int /*<<< orphan*/ GL_FRONT;
int /*<<< orphan*/ GL_LIGHT0;
int /*<<< orphan*/ GL_LIGHTING;
int /*<<< orphan*/ GL_MODELVIEW;
int /*<<< orphan*/ GL_NORMALIZE;
int /*<<< orphan*/ GL_POSITION;
int /*<<< orphan*/ GL_PROJECTION;
int /*<<< orphan*/ glEnable(int /*<<< orphan*/);
int /*<<< orphan*/ glFrustum(double, double, float, float, double, double);
int /*<<< orphan*/ glLightfv(int /*<<< orphan*/, int /*<<< orphan*/, float *);
int /*<<< orphan*/ glLoadIdentity();
int /*<<< orphan*/ glMaterialfv(int /*<<< orphan*/, int /*<<< orphan*/,
                                float *);
int /*<<< orphan*/ glMatrixMode(int /*<<< orphan*/);
int /*<<< orphan*/ glTranslatef(double, double, float);
int /*<<< orphan*/ glViewport(int /*<<< orphan*/, int /*<<< orphan*/, int, int);
void SampleReshape(int nWidth, int nHeight) {
  GLfloat fAspect = (GLfloat)nHeight / (GLfloat)nWidth;
  GLfloat fPos[4] = {0.0f, 0.0f, 10.0f, 0.0f};
  GLfloat fCol[4] = {0.5f, 1.0f, 0.0f, 1.0f};
  glViewport(0, 0, nWidth, nHeight);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  glFrustum(-1.0, 1.0, -fAspect, fAspect, 1.0, 80.0);
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  glTranslatef(0.0, 0.0, -40.0f);
  glEnable(GL_CULL_FACE);
  glEnable(GL_DEPTH_TEST);
  glEnable(GL_NORMALIZE);
  glLightfv(GL_LIGHT0, GL_POSITION, fPos);
  glEnable(GL_LIGHTING);
  glEnable(GL_LIGHT0);
  glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, fCol);
}


x86 assembly (clang, -O0):
<SampleReshape>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cvtsi2ssl -0x8(%rbp),%xmm0
cvtsi2ssl -0x4(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
mov    0xe78(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xe75(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xe72(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xe6f(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
xor    %esi,%esi
mov    %esi,%edi
call   10a0 <glViewport@plt>
mov    0x2dcd(%rip),%rax
mov    (%rax),%edi
call   1040 <glMatrixMode@plt>
mov    $0x0,%al
call   1060 <glLoadIdentity@plt>
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm2
movss  -0xc(%rbp),%xmm3
movsd  0xdf8(%rip),%xmm0
movsd  0xdf8(%rip),%xmm4
movsd  0xdf8(%rip),%xmm5
movaps %xmm4,%xmm1
call   1070 <glFrustum@plt>
mov    0x2da9(%rip),%rax
mov    (%rax),%edi
call   1040 <glMatrixMode@plt>
mov    $0x0,%al
call   1060 <glLoadIdentity@plt>
xorps  %xmm1,%xmm1
movss  0xdb8(%rip),%xmm2
movaps %xmm1,%xmm0
call   1080 <glTranslatef@plt>
mov    0x2d49(%rip),%rax
mov    (%rax),%edi
call   1050 <glEnable@plt>
mov    0x2d33(%rip),%rax
mov    (%rax),%edi
call   1050 <glEnable@plt>
mov    0x2d4d(%rip),%rax
mov    (%rax),%edi
call   1050 <glEnable@plt>
mov    0x2d5f(%rip),%rax
mov    (%rax),%edi
mov    0x2d3e(%rip),%rax
mov    (%rax),%esi
lea    -0x20(%rbp),%rdx
call   1030 <glLightfv@plt>
mov    0x2d0c(%rip),%rax
mov    (%rax),%edi
call   1050 <glEnable@plt>
mov    0x2d36(%rip),%rax
mov    (%rax),%edi
call   1050 <glEnable@plt>
mov    0x2d30(%rip),%rax
mov    (%rax),%edi
mov    0x2cf7(%rip),%rax
mov    (%rax),%esi
lea    -0x30(%rbp),%rdx
call   1090 <glMaterialfv@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SampleReshape>:
push   %rbx
sub    $0x30,%rsp
mov    %esi,%ecx
mov    %edi,%edx
cvtsi2ss %esi,%xmm1
cvtsi2ss %edi,%xmm0
divss  %xmm0,%xmm1
movaps %xmm1,(%rsp)
movaps 0xe70(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe74(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
xor    %edi,%edi
xor    %esi,%esi
call   10a0 <glViewport@plt>
mov    0x2def(%rip),%rax
mov    (%rax),%edi
call   1040 <glMatrixMode@plt>
xor    %eax,%eax
call   1060 <glLoadIdentity@plt>
movaps 0xe2a(%rip),%xmm2
movaps (%rsp),%xmm3
xorps  %xmm3,%xmm2
movsd  0xe4b(%rip),%xmm0
movsd  0xe4b(%rip),%xmm1
movsd  0xe4b(%rip),%xmm5
movaps %xmm1,%xmm4
call   1070 <glFrustum@plt>
mov    0x2dd4(%rip),%rax
mov    (%rax),%edi
call   1040 <glMatrixMode@plt>
xor    %eax,%eax
call   1060 <glLoadIdentity@plt>
movss  0xe2e(%rip),%xmm2
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
call   1080 <glTranslatef@plt>
mov    0x2d74(%rip),%rax
mov    (%rax),%edi
call   1050 <glEnable@plt>
mov    0x2d5e(%rip),%rax
mov    (%rax),%edi
call   1050 <glEnable@plt>
mov    0x2d78(%rip),%rax
mov    (%rax),%edi
call   1050 <glEnable@plt>
mov    0x2d8a(%rip),%rbx
mov    (%rbx),%edi
mov    0x2d69(%rip),%rax
mov    (%rax),%esi
lea    0x20(%rsp),%rdx
call   1030 <glLightfv@plt>
mov    0x2d36(%rip),%rax
mov    (%rax),%edi
call   1050 <glEnable@plt>
mov    (%rbx),%edi
call   1050 <glEnable@plt>
mov    0x2d61(%rip),%rax
mov    (%rax),%edi
mov    0x2d28(%rip),%rax
mov    (%rax),%esi
lea    0x10(%rsp),%rdx
call   1090 <glMaterialfv@plt>
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.SampleReshape.fPos = [4 x float] [float 0.000000e+00, float 0.000000e+00, float 1.000000e+01, float 0.000000e+00]
@__const.SampleReshape.fCol = [4 x float] [float 5.000000e-01, float 1.000000e+00, float 0.000000e+00, float 1.000000e+00]
@GL_PROJECTION = global i32 0
@GL_MODELVIEW = global i32 0
@GL_CULL_FACE = global i32 0
@GL_DEPTH_TEST = global i32 0
@GL_NORMALIZE = global i32 0
@GL_LIGHT0 = global i32 0
@GL_POSITION = global i32 0
@GL_LIGHTING = global i32 0
@GL_FRONT = global i32 0
@GL_AMBIENT_AND_DIFFUSE = global i32 0
define void @SampleReshape(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
%6 = alloca [4 x float]
%7 = alloca [4 x float]
store i32 %0, i32* %3
store i32 %1, i32* %4
%8 = load i32, i32* %4
%9 = sitofp i32 %8 to float
%10 = load i32, i32* %3
%11 = sitofp i32 %10 to float
%12 = fdiv float %9, %11
store float %12, float* %5
%13 = bitcast [4 x float]* %6 to i8*
%14 = bitcast [4 x float]* %7 to i8*
%15 = load i32, i32* %3
%16 = load i32, i32* %4
%17 = call i32 @glViewport(i32 0, i32 0, i32 %15, i32 %16)
%18 = load i32, i32* @GL_PROJECTION
%19 = call i32 @glMatrixMode(i32 %18)
%20 = call i32 (...) @glLoadIdentity()
%21 = load float, float* %5
%22 = fneg float %21
%23 = load float, float* %5
%24 = call i32 @glFrustum(double -1.000000e+00, double 1.000000e+00, float %22, float %23, double 1.000000e+00, double 8.000000e+01)
%25 = load i32, i32* @GL_MODELVIEW
%26 = call i32 @glMatrixMode(i32 %25)
%27 = call i32 (...) @glLoadIdentity()
%28 = call i32 @glTranslatef(double 0.000000e+00, double 0.000000e+00, float -4.000000e+01)
%29 = load i32, i32* @GL_CULL_FACE
%30 = call i32 @glEnable(i32 %29)
%31 = load i32, i32* @GL_DEPTH_TEST
%32 = call i32 @glEnable(i32 %31)
%33 = load i32, i32* @GL_NORMALIZE
%34 = call i32 @glEnable(i32 %33)
%35 = load i32, i32* @GL_LIGHT0
%36 = load i32, i32* @GL_POSITION
%37 = getelementptr inbounds [4 x float], [4 x float]* %6, i64 0, i64 0
%38 = call i32 @glLightfv(i32 %35, i32 %36, float* %37)
%39 = load i32, i32* @GL_LIGHTING
%40 = call i32 @glEnable(i32 %39)
%41 = load i32, i32* @GL_LIGHT0
%42 = call i32 @glEnable(i32 %41)
%43 = load i32, i32* @GL_FRONT
%44 = load i32, i32* @GL_AMBIENT_AND_DIFFUSE
%45 = getelementptr inbounds [4 x float], [4 x float]* %7, i64 0, i64 0
%46 = call i32 @glMaterialfv(i32 %43, i32 %44, float* %45)
ret void
}

LLVM IR (-O2):
@__const.SampleReshape.fPos = [4 x float] [float 0.000000e+00, float 0.000000e+00, float 1.000000e+01, float 0.000000e+00]
@__const.SampleReshape.fCol = [4 x float] [float 5.000000e-01, float 1.000000e+00, float 0.000000e+00, float 1.000000e+00]
@GL_PROJECTION = global i32 0
@GL_MODELVIEW = global i32 0
@GL_CULL_FACE = global i32 0
@GL_DEPTH_TEST = global i32 0
@GL_NORMALIZE = global i32 0
@GL_LIGHT0 = global i32 0
@GL_POSITION = global i32 0
@GL_LIGHTING = global i32 0
@GL_FRONT = global i32 0
@GL_AMBIENT_AND_DIFFUSE = global i32 0
define void @SampleReshape(i32 %0, i32 %1) {
%3 = alloca [4 x float]
%4 = alloca [4 x float]
%5 = sitofp i32 %1 to float
%6 = sitofp i32 %0 to float
%7 = fdiv float %5, %6
%8 = bitcast [4 x float]* %3 to i8*
%9 = bitcast [4 x float]* %4 to i8*
%10 = tail call i32 @glViewport(i32 0, i32 0, i32 %0, i32 %1)
%11 = load i32, i32* @GL_PROJECTION
%12 = tail call i32 @glMatrixMode(i32 %11)
%13 = tail call i32 (...) @glLoadIdentity()
%14 = fneg float %7
%15 = tail call i32 @glFrustum(double -1.000000e+00, double 1.000000e+00, float %14, float %7, double 1.000000e+00, double 8.000000e+01)
%16 = load i32, i32* @GL_MODELVIEW
%17 = tail call i32 @glMatrixMode(i32 %16)
%18 = tail call i32 (...) @glLoadIdentity()
%19 = tail call i32 @glTranslatef(double 0.000000e+00, double 0.000000e+00, float -4.000000e+01)
%20 = load i32, i32* @GL_CULL_FACE
%21 = tail call i32 @glEnable(i32 %20)
%22 = load i32, i32* @GL_DEPTH_TEST
%23 = tail call i32 @glEnable(i32 %22)
%24 = load i32, i32* @GL_NORMALIZE
%25 = tail call i32 @glEnable(i32 %24)
%26 = load i32, i32* @GL_LIGHT0
%27 = load i32, i32* @GL_POSITION
%28 = getelementptr inbounds [4 x float], [4 x float]* %3, i64 0, i64 0
%29 = call i32 @glLightfv(i32 %26, i32 %27, float* %28)
%30 = load i32, i32* @GL_LIGHTING
%31 = call i32 @glEnable(i32 %30)
%32 = load i32, i32* @GL_LIGHT0
%33 = call i32 @glEnable(i32 %32)
%34 = load i32, i32* @GL_FRONT
%35 = load i32, i32* @GL_AMBIENT_AND_DIFFUSE
%36 = getelementptr inbounds [4 x float], [4 x float]* %4, i64 0, i64 0
%37 = call i32 @glMaterialfv(i32 %34, i32 %35, float* %36)
ret void
}