#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 */

/* Variables and functions */
int /*<<< orphan*/ GL_ALWAYS;
int GL_COLOR_BUFFER_BIT;
int GL_DEPTH_BUFFER_BIT;
int /*<<< orphan*/ GL_DEPTH_TEST;
int /*<<< orphan*/ GL_DIFFUSE;
int /*<<< orphan*/ GL_KEEP;
int /*<<< orphan*/ GL_LIGHT0;
int /*<<< orphan*/ GL_LIGHT1;
int /*<<< orphan*/ GL_LIGHTING;
int /*<<< orphan*/ GL_NOTEQUAL;
int /*<<< orphan*/ GL_POSITION;
int /*<<< orphan*/ GL_REPLACE;
int /*<<< orphan*/ GL_SMOOTH;
int GL_STENCIL_BUFFER_BIT;
int /*<<< orphan*/ GL_STENCIL_TEST;
int /*<<< orphan*/ glClear(int);
int /*<<< orphan*/ glClearColor(double, double, double, double);
int /*<<< orphan*/ glEnable(int /*<<< orphan*/);
int /*<<< orphan*/ glFinish();
int /*<<< orphan*/ glLightfv(int /*<<< orphan*/, int /*<<< orphan*/, float *);
int /*<<< orphan*/ glPopMatrix();
int /*<<< orphan*/ glPushMatrix();
int /*<<< orphan*/ glRotatef(double, double, double, double);
int /*<<< orphan*/ glShadeModel(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*/ glutSolidCube(double);
int /*<<< orphan*/ glutSolidSphere(double, int, int);
void Redraw(void) {
  static float red_light[4] = {1.0, 0.0, 0.0, 1.0};
  static float red_pos[4] = {1.0, 1.0, 1.0, 0.0};
  static float blue_light[4] = {0.0, 0.0, 1.0, 1.0};
  static float blue_pos[4] = {-1.0, -1.0, -1.0, 0.0};
  glEnable(GL_DEPTH_TEST);
  glEnable(GL_STENCIL_TEST);
  glEnable(GL_LIGHTING);
  glEnable(GL_LIGHT0);
  glEnable(GL_LIGHT1);
  glShadeModel(GL_SMOOTH);
  glClearColor(0.0, 0.0, 0.0, 0.0);
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
  glStencilFunc(GL_ALWAYS, 1, 1);
  glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);
  glPushMatrix();
  glTranslatef(-0.5, 0.0, -20.0);
  glutSolidSphere(1.0, 36, 18);
  glPopMatrix();
  glClearColor(0.0, 0.0, 0.0, 0.0);
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  glStencilFunc(GL_NOTEQUAL, 1, 1);
  glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
  glLightfv(GL_LIGHT0, GL_DIFFUSE, red_light);
  glLightfv(GL_LIGHT0, GL_POSITION, red_pos);
  glLightfv(GL_LIGHT1, GL_DIFFUSE, blue_light);
  glLightfv(GL_LIGHT1, GL_POSITION, blue_pos);
  glPushMatrix();
  glTranslatef(0.5, 0.0, -20.0);
  glRotatef(15.0, 0.0, 1.0, 0.0);
  glRotatef(15.0, 0.0, 0.0, 1.0);
  glutSolidCube(2.0);
  glPopMatrix();
  glFinish();
}


x86 assembly (clang, -O0):
<Redraw>:
push   %rbp
mov    %rsp,%rbp
mov    0x2d8d(%rip),%rax
mov    (%rax),%edi
call   1060 <glEnable@plt>
mov    0x2d9f(%rip),%rax
mov    (%rax),%edi
call   1060 <glEnable@plt>
mov    0x2d99(%rip),%rax
mov    (%rax),%edi
call   1060 <glEnable@plt>
mov    0x2dc3(%rip),%rax
mov    (%rax),%edi
call   1060 <glEnable@plt>
mov    0x2d4d(%rip),%rax
mov    (%rax),%edi
call   1060 <glEnable@plt>
mov    0x2d4f(%rip),%rax
mov    (%rax),%edi
call   10f0 <glShadeModel@plt>
xorps  %xmm3,%xmm3
movaps %xmm3,%xmm0
movaps %xmm3,%xmm1
movaps %xmm3,%xmm2
call   1090 <glClearColor@plt>
mov    0x2d38(%rip),%rax
mov    (%rax),%edi
mov    0x2d87(%rip),%rax
or     (%rax),%edi
mov    0x2d66(%rip),%rax
or     (%rax),%edi
call   1050 <glClear@plt>
mov    0x2d38(%rip),%rax
mov    (%rax),%edi
mov    $0x1,%edx
mov    %edx,%esi
call   10d0 <glStencilFunc@plt>
mov    0x2d33(%rip),%rax
mov    (%rax),%edi
mov    0x2d2a(%rip),%rax
mov    (%rax),%esi
mov    0x2d21(%rip),%rax
mov    (%rax),%edx
call   1040 <glStencilOp@plt>
mov    $0x0,%al
call   10b0 <glPushMatrix@plt>
movsd  0xd7b(%rip),%xmm0
xorps  %xmm1,%xmm1
movsd  0xd68(%rip),%xmm2
call   10e0 <glTranslatef@plt>
movsd  0xd4b(%rip),%xmm0
mov    $0x24,%edi
mov    $0x12,%esi
call   10c0 <glutSolidSphere@plt>
mov    $0x0,%al
call   10a0 <glPopMatrix@plt>
xorps  %xmm3,%xmm3
movaps %xmm3,%xmm0
movaps %xmm3,%xmm1
movaps %xmm3,%xmm2
call   1090 <glClearColor@plt>
mov    0x2c95(%rip),%rax
mov    (%rax),%edi
mov    0x2ce4(%rip),%rax
or     (%rax),%edi
call   1050 <glClear@plt>
mov    0x2cb6(%rip),%rax
mov    (%rax),%edi
mov    $0x1,%edx
mov    %edx,%esi
call   10d0 <glStencilFunc@plt>
mov    0x2cc9(%rip),%rax
mov    (%rax),%edi
mov    0x2cc0(%rip),%rax
mov    (%rax),%esi
mov    0x2cb7(%rip),%rax
mov    (%rax),%edx
call   1040 <glStencilOp@plt>
mov    0x2c99(%rip),%rax
mov    (%rax),%edi
mov    0x2c48(%rip),%rax
mov    (%rax),%esi
lea    0x2d4f(%rip),%rdx
call   1030 <glLightfv@plt>
mov    0x2c7b(%rip),%rax
mov    (%rax),%edi
mov    0x2c4a(%rip),%rax
mov    (%rax),%esi
lea    0x2d41(%rip),%rdx
call   1030 <glLightfv@plt>
mov    0x2bf5(%rip),%rax
mov    (%rax),%edi
mov    0x2c0c(%rip),%rax
mov    (%rax),%esi
lea    0x2d33(%rip),%rdx
call   1030 <glLightfv@plt>
mov    0x2bd7(%rip),%rax
mov    (%rax),%edi
mov    0x2c0e(%rip),%rax
mov    (%rax),%esi
lea    0x2d25(%rip),%rdx
call   1030 <glLightfv@plt>
mov    $0x0,%al
call   10b0 <glPushMatrix@plt>
movsd  0xc59(%rip),%xmm0
xorps  %xmm1,%xmm1
movsd  0xc56(%rip),%xmm2
call   10e0 <glTranslatef@plt>
movsd  0xc31(%rip),%xmm0
xorps  %xmm3,%xmm3
movsd  0xc2e(%rip),%xmm2
movaps %xmm3,%xmm1
call   1100 <glRotatef@plt>
movsd  0xc16(%rip),%xmm0
xorps  %xmm2,%xmm2
movsd  0xc13(%rip),%xmm3
movaps %xmm2,%xmm1
call   1100 <glRotatef@plt>
movsd  0xbf3(%rip),%xmm0
call   1080 <glutSolidCube@plt>
mov    $0x0,%al
call   10a0 <glPopMatrix@plt>
mov    $0x0,%al
call   1070 <glFinish@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Redraw>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    0x2d89(%rip),%rax
mov    (%rax),%edi
call   1060 <glEnable@plt>
mov    0x2d9b(%rip),%rax
mov    (%rax),%edi
call   1060 <glEnable@plt>
mov    0x2d95(%rip),%rax
mov    (%rax),%edi
call   1060 <glEnable@plt>
mov    0x2dbf(%rip),%r15
mov    (%r15),%edi
call   1060 <glEnable@plt>
mov    0x2d48(%rip),%r14
mov    (%r14),%edi
call   1060 <glEnable@plt>
mov    0x2d49(%rip),%rax
mov    (%rax),%edi
call   10f0 <glShadeModel@plt>
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
xorps  %xmm2,%xmm2
xorps  %xmm3,%xmm3
call   1090 <glClearColor@plt>
mov    0x2d32(%rip),%r12
mov    0x2d83(%rip),%rbx
mov    (%rbx),%edi
or     (%r12),%edi
mov    0x2d5e(%rip),%rax
or     (%rax),%edi
call   1050 <glClear@plt>
mov    0x2d30(%rip),%rax
mov    (%rax),%edi
mov    $0x1,%esi
mov    $0x1,%edx
call   10d0 <glStencilFunc@plt>
mov    0x2d28(%rip),%rax
mov    (%rax),%edi
mov    %edi,%esi
mov    %edi,%edx
call   1040 <glStencilOp@plt>
xor    %eax,%eax
call   10b0 <glPushMatrix@plt>
movsd  0xd56(%rip),%xmm0
movsd  0xd56(%rip),%xmm2
xorps  %xmm1,%xmm1
call   10e0 <glTranslatef@plt>
movsd  0xd4e(%rip),%xmm0
mov    $0x24,%edi
mov    $0x12,%esi
call   10c0 <glutSolidSphere@plt>
xor    %eax,%eax
call   10a0 <glPopMatrix@plt>
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
xorps  %xmm2,%xmm2
xorps  %xmm3,%xmm3
call   1090 <glClearColor@plt>
mov    (%rbx),%edi
or     (%r12),%edi
call   1050 <glClear@plt>
mov    0x2cc5(%rip),%rax
mov    (%rax),%edi
mov    $0x1,%esi
mov    $0x1,%edx
call   10d0 <glStencilFunc@plt>
mov    0x2cd5(%rip),%rax
mov    (%rax),%edi
mov    %edi,%esi
mov    %edi,%edx
call   1040 <glStencilOp@plt>
mov    (%r15),%edi
mov    0x2c68(%rip),%r12
mov    (%r12),%esi
lea    0x2d6d(%rip),%rdx
call   1030 <glLightfv@plt>
mov    (%r15),%edi
mov    0x2c6e(%rip),%rbx
mov    (%rbx),%esi
lea    0x2d65(%rip),%rdx
call   1030 <glLightfv@plt>
mov    (%r14),%edi
mov    (%r12),%esi
lea    0x2d62(%rip),%rdx
call   1030 <glLightfv@plt>
mov    (%r14),%edi
mov    (%rbx),%esi
lea    0x2d61(%rip),%rdx
call   1030 <glLightfv@plt>
xor    %eax,%eax
call   10b0 <glPushMatrix@plt>
movsd  0xc95(%rip),%xmm0
xorps  %xmm1,%xmm1
movsd  0xc7a(%rip),%xmm2
call   10e0 <glTranslatef@plt>
movsd  0xc85(%rip),%xmm0
xorps  %xmm1,%xmm1
xorps  %xmm3,%xmm3
movsd  0xc67(%rip),%xmm2
call   1100 <glRotatef@plt>
xorps  %xmm1,%xmm1
xorps  %xmm2,%xmm2
movsd  0xc64(%rip),%xmm0
movsd  0xc4c(%rip),%xmm3
call   1100 <glRotatef@plt>
movsd  0xc57(%rip),%xmm0
call   1080 <glutSolidCube@plt>
xor    %eax,%eax
call   10a0 <glPopMatrix@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1070 <glFinish@plt>

LLVM IR (-O0):
@Redraw.red_light = internal global [4 x float] [float 1.000000e+00, float 0.000000e+00, float 0.000000e+00, float 1.000000e+00]
@Redraw.red_pos = internal global [4 x float] [float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 0.000000e+00]
@Redraw.blue_light = internal global [4 x float] [float 0.000000e+00, float 0.000000e+00, float 1.000000e+00, float 1.000000e+00]
@Redraw.blue_pos = internal global [4 x float] [float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float 0.000000e+00]
@GL_DEPTH_TEST = global i32 0
@GL_STENCIL_TEST = global i32 0
@GL_LIGHTING = global i32 0
@GL_LIGHT0 = global i32 0
@GL_LIGHT1 = global i32 0
@GL_SMOOTH = global i32 0
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_DEPTH_BUFFER_BIT = global i32 0
@GL_STENCIL_BUFFER_BIT = global i32 0
@GL_ALWAYS = global i32 0
@GL_REPLACE = global i32 0
@GL_NOTEQUAL = global i32 0
@GL_KEEP = global i32 0
@GL_DIFFUSE = global i32 0
@GL_POSITION = global i32 0
define void @Redraw() {
%1 = load i32, i32* @GL_DEPTH_TEST
%2 = call i32 @glEnable(i32 %1)
%3 = load i32, i32* @GL_STENCIL_TEST
%4 = call i32 @glEnable(i32 %3)
%5 = load i32, i32* @GL_LIGHTING
%6 = call i32 @glEnable(i32 %5)
%7 = load i32, i32* @GL_LIGHT0
%8 = call i32 @glEnable(i32 %7)
%9 = load i32, i32* @GL_LIGHT1
%10 = call i32 @glEnable(i32 %9)
%11 = load i32, i32* @GL_SMOOTH
%12 = call i32 @glShadeModel(i32 %11)
%13 = call i32 @glClearColor(double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00)
%14 = load i32, i32* @GL_COLOR_BUFFER_BIT
%15 = load i32, i32* @GL_DEPTH_BUFFER_BIT
%16 = or i32 %14, %15
%17 = load i32, i32* @GL_STENCIL_BUFFER_BIT
%18 = or i32 %16, %17
%19 = call i32 @glClear(i32 %18)
%20 = load i32, i32* @GL_ALWAYS
%21 = call i32 @glStencilFunc(i32 %20, i32 1, i32 1)
%22 = load i32, i32* @GL_REPLACE
%23 = load i32, i32* @GL_REPLACE
%24 = load i32, i32* @GL_REPLACE
%25 = call i32 @glStencilOp(i32 %22, i32 %23, i32 %24)
%26 = call i32 (...) @glPushMatrix()
%27 = call i32 @glTranslatef(double -5.000000e-01, double 0.000000e+00, double -2.000000e+01)
%28 = call i32 @glutSolidSphere(double 1.000000e+00, i32 36, i32 18)
%29 = call i32 (...) @glPopMatrix()
%30 = call i32 @glClearColor(double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00)
%31 = load i32, i32* @GL_COLOR_BUFFER_BIT
%32 = load i32, i32* @GL_DEPTH_BUFFER_BIT
%33 = or i32 %31, %32
%34 = call i32 @glClear(i32 %33)
%35 = load i32, i32* @GL_NOTEQUAL
%36 = call i32 @glStencilFunc(i32 %35, i32 1, i32 1)
%37 = load i32, i32* @GL_KEEP
%38 = load i32, i32* @GL_KEEP
%39 = load i32, i32* @GL_KEEP
%40 = call i32 @glStencilOp(i32 %37, i32 %38, i32 %39)
%41 = load i32, i32* @GL_LIGHT0
%42 = load i32, i32* @GL_DIFFUSE
%43 = call i32 @glLightfv(i32 %41, i32 %42, float* getelementptr inbounds ([4 x float], [4 x float]* @Redraw.red_light, i64 0, i64 0))
%44 = load i32, i32* @GL_LIGHT0
%45 = load i32, i32* @GL_POSITION
%46 = call i32 @glLightfv(i32 %44, i32 %45, float* getelementptr inbounds ([4 x float], [4 x float]* @Redraw.red_pos, i64 0, i64 0))
%47 = load i32, i32* @GL_LIGHT1
%48 = load i32, i32* @GL_DIFFUSE
%49 = call i32 @glLightfv(i32 %47, i32 %48, float* getelementptr inbounds ([4 x float], [4 x float]* @Redraw.blue_light, i64 0, i64 0))
%50 = load i32, i32* @GL_LIGHT1
%51 = load i32, i32* @GL_POSITION
%52 = call i32 @glLightfv(i32 %50, i32 %51, float* getelementptr inbounds ([4 x float], [4 x float]* @Redraw.blue_pos, i64 0, i64 0))
%53 = call i32 (...) @glPushMatrix()
%54 = call i32 @glTranslatef(double 5.000000e-01, double 0.000000e+00, double -2.000000e+01)
%55 = call i32 @glRotatef(double 1.500000e+01, double 0.000000e+00, double 1.000000e+00, double 0.000000e+00)
%56 = call i32 @glRotatef(double 1.500000e+01, double 0.000000e+00, double 0.000000e+00, double 1.000000e+00)
%57 = call i32 @glutSolidCube(double 2.000000e+00)
%58 = call i32 (...) @glPopMatrix()
%59 = call i32 (...) @glFinish()
ret void
}

LLVM IR (-O2):
@Redraw.red_light = internal global [4 x float] [float 1.000000e+00, float 0.000000e+00, float 0.000000e+00, float 1.000000e+00]
@Redraw.red_pos = internal global [4 x float] [float 1.000000e+00, float 1.000000e+00, float 1.000000e+00, float 0.000000e+00]
@Redraw.blue_light = internal global [4 x float] [float 0.000000e+00, float 0.000000e+00, float 1.000000e+00, float 1.000000e+00]
@Redraw.blue_pos = internal global [4 x float] [float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float 0.000000e+00]
@GL_DEPTH_TEST = global i32 0
@GL_STENCIL_TEST = global i32 0
@GL_LIGHTING = global i32 0
@GL_LIGHT0 = global i32 0
@GL_LIGHT1 = global i32 0
@GL_SMOOTH = global i32 0
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_DEPTH_BUFFER_BIT = global i32 0
@GL_STENCIL_BUFFER_BIT = global i32 0
@GL_ALWAYS = global i32 0
@GL_REPLACE = global i32 0
@GL_NOTEQUAL = global i32 0
@GL_KEEP = global i32 0
@GL_DIFFUSE = global i32 0
@GL_POSITION = global i32 0
define void @Redraw() {
%1 = load i32, i32* @GL_DEPTH_TEST
%2 = tail call i32 @glEnable(i32 %1)
%3 = load i32, i32* @GL_STENCIL_TEST
%4 = tail call i32 @glEnable(i32 %3)
%5 = load i32, i32* @GL_LIGHTING
%6 = tail call i32 @glEnable(i32 %5)
%7 = load i32, i32* @GL_LIGHT0
%8 = tail call i32 @glEnable(i32 %7)
%9 = load i32, i32* @GL_LIGHT1
%10 = tail call i32 @glEnable(i32 %9)
%11 = load i32, i32* @GL_SMOOTH
%12 = tail call i32 @glShadeModel(i32 %11)
%13 = tail call i32 @glClearColor(double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00)
%14 = load i32, i32* @GL_COLOR_BUFFER_BIT
%15 = load i32, i32* @GL_DEPTH_BUFFER_BIT
%16 = or i32 %15, %14
%17 = load i32, i32* @GL_STENCIL_BUFFER_BIT
%18 = or i32 %16, %17
%19 = tail call i32 @glClear(i32 %18)
%20 = load i32, i32* @GL_ALWAYS
%21 = tail call i32 @glStencilFunc(i32 %20, i32 1, i32 1)
%22 = load i32, i32* @GL_REPLACE
%23 = tail call i32 @glStencilOp(i32 %22, i32 %22, i32 %22)
%24 = tail call i32 (...) @glPushMatrix()
%25 = tail call i32 @glTranslatef(double -5.000000e-01, double 0.000000e+00, double -2.000000e+01)
%26 = tail call i32 @glutSolidSphere(double 1.000000e+00, i32 36, i32 18)
%27 = tail call i32 (...) @glPopMatrix()
%28 = tail call i32 @glClearColor(double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00)
%29 = load i32, i32* @GL_COLOR_BUFFER_BIT
%30 = load i32, i32* @GL_DEPTH_BUFFER_BIT
%31 = or i32 %30, %29
%32 = tail call i32 @glClear(i32 %31)
%33 = load i32, i32* @GL_NOTEQUAL
%34 = tail call i32 @glStencilFunc(i32 %33, i32 1, i32 1)
%35 = load i32, i32* @GL_KEEP
%36 = tail call i32 @glStencilOp(i32 %35, i32 %35, i32 %35)
%37 = load i32, i32* @GL_LIGHT0
%38 = load i32, i32* @GL_DIFFUSE
%39 = tail call i32 @glLightfv(i32 %37, i32 %38, float* getelementptr inbounds ([4 x float], [4 x float]* @Redraw.red_light, i64 0, i64 0))
%40 = load i32, i32* @GL_LIGHT0
%41 = load i32, i32* @GL_POSITION
%42 = tail call i32 @glLightfv(i32 %40, i32 %41, float* getelementptr inbounds ([4 x float], [4 x float]* @Redraw.red_pos, i64 0, i64 0))
%43 = load i32, i32* @GL_LIGHT1
%44 = load i32, i32* @GL_DIFFUSE
%45 = tail call i32 @glLightfv(i32 %43, i32 %44, float* getelementptr inbounds ([4 x float], [4 x float]* @Redraw.blue_light, i64 0, i64 0))
%46 = load i32, i32* @GL_LIGHT1
%47 = load i32, i32* @GL_POSITION
%48 = tail call i32 @glLightfv(i32 %46, i32 %47, float* getelementptr inbounds ([4 x float], [4 x float]* @Redraw.blue_pos, i64 0, i64 0))
%49 = tail call i32 (...) @glPushMatrix()
%50 = tail call i32 @glTranslatef(double 5.000000e-01, double 0.000000e+00, double -2.000000e+01)
%51 = tail call i32 @glRotatef(double 1.500000e+01, double 0.000000e+00, double 1.000000e+00, double 0.000000e+00)
%52 = tail call i32 @glRotatef(double 1.500000e+01, double 0.000000e+00, double 0.000000e+00, double 1.000000e+00)
%53 = tail call i32 @glutSolidCube(double 2.000000e+00)
%54 = tail call i32 (...) @glPopMatrix()
%55 = tail call i32 (...) @glFinish()
ret void
}