#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 scalar_t__ GLenum;
typedef int GLdouble;

/* Variables and functions */
int /*<<< orphan*/ GL_BACK;
int /*<<< orphan*/ GL_BLEND;
int GL_COLOR_BUFFER_BIT;
int /*<<< orphan*/ GL_CULL_FACE;
int GL_DEPTH_BUFFER_BIT;
int /*<<< orphan*/ GL_FRONT;
scalar_t__ GL_NO_ERROR;
int /*<<< orphan*/ draw_cone();
int /*<<< orphan*/ draw_room();
int /*<<< orphan*/ draw_sphere(int);
int get_secs();
int /*<<< orphan*/ glClear(int);
int /*<<< orphan*/ glCullFace(int /*<<< orphan*/);
int /*<<< orphan*/ glDisable(int /*<<< orphan*/);
int /*<<< orphan*/ glEnable(int /*<<< orphan*/);
scalar_t__ glGetError();
char *gluErrorString(scalar_t__);
int /*<<< orphan*/ glutSwapBuffers();
int /*<<< orphan*/ printf(char *, char *);
void draw(void) {
  GLenum err;
  GLdouble secs, degrees;
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  secs = get_secs();
  secs = secs - 10. * ((double)((int)(secs / 10.)));
  degrees = (secs / 10.) * (360.);
  draw_room();
  glEnable(GL_BLEND);
  glEnable(GL_CULL_FACE);
  if (degrees < 180) {
    glCullFace(GL_FRONT);
    draw_sphere(degrees);
    draw_cone();
    glCullFace(GL_BACK);
    draw_sphere(degrees);
    draw_cone();
  } else {
    glCullFace(GL_FRONT);
    draw_cone();
    draw_sphere(degrees);
    glCullFace(GL_BACK);
    draw_cone();
    draw_sphere(degrees);
  }
  glDisable(GL_CULL_FACE);
  glDisable(GL_BLEND);
  err = glGetError();
  if (err != GL_NO_ERROR)
    printf("Error:  %s\n", gluErrorString(err));
  glutSwapBuffers();
}


x86 assembly (clang, -O0):
<draw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2de1(%rip),%rax
mov    (%rax),%edi
mov    0x2e00(%rip),%rax
or     (%rax),%edi
call   1060 <glClear@plt>
mov    $0x0,%al
call   1030 <get_secs@plt>
mov    %eax,-0xc(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm1
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  0xe0d(%rip),%xmm2
divsd  %xmm2,%xmm0
cvttsd2si %xmm0,%eax
cvtsi2sd %eax,%xmm0
movsd  0xe01(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0xc(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  0xddd(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xdc9(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1040 <draw_room@plt>
mov    0x2d90(%rip),%rax
mov    (%rax),%edi
call   1080 <glEnable@plt>
mov    0x2d5a(%rip),%rax
mov    (%rax),%edi
call   1080 <glEnable@plt>
cmpl   $0xb4,-0x10(%rbp)
jge    12b1 <draw+0xf1>
mov    0x2d6f(%rip),%rax
mov    (%rax),%edi
call   10e0 <glCullFace@plt>
mov    -0x10(%rbp),%edi
call   10b0 <draw_sphere@plt>
mov    $0x0,%al
call   1050 <draw_cone@plt>
mov    0x2d2a(%rip),%rax
mov    (%rax),%edi
call   10e0 <glCullFace@plt>
mov    -0x10(%rbp),%edi
call   10b0 <draw_sphere@plt>
mov    $0x0,%al
call   1050 <draw_cone@plt>
jmp    12eb <draw+0x12b>
mov    0x2d30(%rip),%rax
mov    (%rax),%edi
call   10e0 <glCullFace@plt>
mov    $0x0,%al
call   1050 <draw_cone@plt>
mov    -0x10(%rbp),%edi
call   10b0 <draw_sphere@plt>
mov    0x2ceb(%rip),%rax
mov    (%rax),%edi
call   10e0 <glCullFace@plt>
mov    $0x0,%al
call   1050 <draw_cone@plt>
mov    -0x10(%rbp),%edi
call   10b0 <draw_sphere@plt>
mov    0x2cc6(%rip),%rax
mov    (%rax),%edi
call   10d0 <glDisable@plt>
mov    0x2ce0(%rip),%rax
mov    (%rax),%edi
call   10d0 <glDisable@plt>
mov    $0x0,%al
call   10a0 <glGetError@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x2cb3(%rip),%rcx
cmp    (%rcx),%rax
je     133e <draw+0x17e>
mov    -0x8(%rbp),%rdi
call   10c0 <gluErrorString@plt>
mov    %rax,%rsi
lea    0xcdf(%rip),%rdi
call   1070 <printf@plt>
mov    $0x0,%al
call   1090 <glutSwapBuffers@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw>:
push   %r15
push   %r14
push   %rbx
mov    0x2de4(%rip),%rax
mov    0x2e05(%rip),%rcx
mov    (%rcx),%edi
or     (%rax),%edi
call   1060 <glClear@plt>
xor    %eax,%eax
call   1030 <get_secs@plt>
cvtsi2sd %eax,%xmm0
movsd  0xe11(%rip),%xmm1
movapd %xmm0,%xmm2
divsd  %xmm1,%xmm2
cvttpd2dq %xmm2,%xmm2
cvtdq2pd %xmm2,%xmm2
mulsd  0xe01(%rip),%xmm2
addsd  %xmm0,%xmm2
cvttpd2dq %xmm2,%xmm0
cvtdq2pd %xmm0,%xmm0
divsd  %xmm1,%xmm0
mulsd  0xdf1(%rip),%xmm0
cvttsd2si %xmm0,%ebx
xor    %eax,%eax
call   1040 <draw_room@plt>
mov    0x2daf(%rip),%r14
mov    (%r14),%edi
call   1080 <glEnable@plt>
mov    0x2d78(%rip),%r15
mov    (%r15),%edi
call   1080 <glEnable@plt>
mov    0x2d99(%rip),%rax
mov    (%rax),%edi
call   10e0 <glCullFace@plt>
cmp    $0xb3,%ebx
jg     128a <draw+0xca>
mov    %ebx,%edi
call   10b0 <draw_sphere@plt>
xor    %eax,%eax
call   1050 <draw_cone@plt>
mov    0x2d4d(%rip),%rax
mov    (%rax),%edi
call   10e0 <glCullFace@plt>
mov    %ebx,%edi
call   10b0 <draw_sphere@plt>
xor    %eax,%eax
call   1050 <draw_cone@plt>
jmp    12b4 <draw+0xf4>
xor    %eax,%eax
call   1050 <draw_cone@plt>
mov    %ebx,%edi
call   10b0 <draw_sphere@plt>
mov    0x2d21(%rip),%rax
mov    (%rax),%edi
call   10e0 <glCullFace@plt>
xor    %eax,%eax
call   1050 <draw_cone@plt>
mov    %ebx,%edi
call   10b0 <draw_sphere@plt>
mov    (%r15),%edi
call   10d0 <glDisable@plt>
mov    (%r14),%edi
call   10d0 <glDisable@plt>
xor    %eax,%eax
call   10a0 <glGetError@plt>
mov    0x2cfe(%rip),%rcx
cmp    (%rcx),%rax
je     12ee <draw+0x12e>
mov    %rax,%rdi
call   10c0 <gluErrorString@plt>
lea    0xd32(%rip),%rdi
mov    %rax,%rsi
call   1070 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1090 <glutSwapBuffers@plt>

LLVM IR (-O0):
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_DEPTH_BUFFER_BIT = global i32 0
@GL_BLEND = global i32 0
@GL_CULL_FACE = global i32 0
@GL_FRONT = global i32 0
@GL_BACK = global i32 0
@GL_NO_ERROR = global i64 0
@.str = [12 x i8] c"Error: %s\0A\00"
define void @draw() {
%1 = alloca i64
%2 = alloca i32
%3 = alloca i32
%4 = load i32, i32* @GL_COLOR_BUFFER_BIT
%5 = load i32, i32* @GL_DEPTH_BUFFER_BIT
%6 = or i32 %4, %5
%7 = call i32 @glClear(i32 %6)
%8 = call i32 (...) @get_secs()
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = sitofp i32 %9 to double
%11 = load i32, i32* %2
%12 = sitofp i32 %11 to double
%13 = fdiv double %12, 1.000000e+01
%14 = fptosi double %13 to i32
%15 = sitofp i32 %14 to double
%16 = call double @llvm.fmuladd.f64(double -1.000000e+01, double %15, double %10)
%17 = fptosi double %16 to i32
store i32 %17, i32* %2
%18 = load i32, i32* %2
%19 = sitofp i32 %18 to double
%20 = fdiv double %19, 1.000000e+01
%21 = fmul double %20, 3.600000e+02
%22 = fptosi double %21 to i32
store i32 %22, i32* %3
%23 = call i32 (...) @draw_room()
%24 = load i32, i32* @GL_BLEND
%25 = call i32 @glEnable(i32 %24)
%26 = load i32, i32* @GL_CULL_FACE
%27 = call i32 @glEnable(i32 %26)
%28 = load i32, i32* %3
%29 = icmp slt i32 %28, 180
br i1 %29, label %30, label %41
30: ; preds = %0
%31 = load i32, i32* @GL_FRONT
%32 = call i32 @glCullFace(i32 %31)
%33 = load i32, i32* %3
%34 = call i32 @draw_sphere(i32 %33)
%35 = call i32 (...) @draw_cone()
%36 = load i32, i32* @GL_BACK
%37 = call i32 @glCullFace(i32 %36)
%38 = load i32, i32* %3
%39 = call i32 @draw_sphere(i32 %38)
%40 = call i32 (...) @draw_cone()
br label %52
41: ; preds = %0
%42 = load i32, i32* @GL_FRONT
%43 = call i32 @glCullFace(i32 %42)
%44 = call i32 (...) @draw_cone()
%45 = load i32, i32* %3
%46 = call i32 @draw_sphere(i32 %45)
%47 = load i32, i32* @GL_BACK
%48 = call i32 @glCullFace(i32 %47)
%49 = call i32 (...) @draw_cone()
%50 = load i32, i32* %3
%51 = call i32 @draw_sphere(i32 %50)
br label %52
52: ; preds = %41, %30
%53 = load i32, i32* @GL_CULL_FACE
%54 = call i32 @glDisable(i32 %53)
%55 = load i32, i32* @GL_BLEND
%56 = call i32 @glDisable(i32 %55)
%57 = call i64 (...) @glGetError()
store i64 %57, i64* %1
%58 = load i64, i64* %1
%59 = load i64, i64* @GL_NO_ERROR
%60 = icmp ne i64 %58, %59
br i1 %60, label %61, label %65
61: ; preds = %52
%62 = load i64, i64* %1
%63 = call i8* @gluErrorString(i64 %62)
%64 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %63)
br label %65
65: ; preds = %61, %52
%66 = call i32 (...) @glutSwapBuffers()
ret void
}

LLVM IR (-O2):
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_DEPTH_BUFFER_BIT = global i32 0
@GL_BLEND = global i32 0
@GL_CULL_FACE = global i32 0
@GL_FRONT = global i32 0
@GL_BACK = global i32 0
@GL_NO_ERROR = global i64 0
@.str = [12 x i8] c"Error: %s\0A\00"
define void @draw() {
%1 = load i32, i32* @GL_COLOR_BUFFER_BIT
%2 = load i32, i32* @GL_DEPTH_BUFFER_BIT
%3 = or i32 %2, %1
%4 = tail call i32 @glClear(i32 %3)
%5 = tail call i32 (...) @get_secs()
%6 = sitofp i32 %5 to double
%7 = fdiv double %6, 1.000000e+01
%8 = fptosi double %7 to i32
%9 = sitofp i32 %8 to double
%10 = tail call double @llvm.fmuladd.f64(double %9, double -1.000000e+01, double %6)
%11 = fptosi double %10 to i32
%12 = sitofp i32 %11 to double
%13 = fdiv double %12, 1.000000e+01
%14 = fmul double %13, 3.600000e+02
%15 = fptosi double %14 to i32
%16 = tail call i32 (...) @draw_room()
%17 = load i32, i32* @GL_BLEND
%18 = tail call i32 @glEnable(i32 %17)
%19 = load i32, i32* @GL_CULL_FACE
%20 = tail call i32 @glEnable(i32 %19)
%21 = icmp slt i32 %15, 180
%22 = load i32, i32* @GL_FRONT
%23 = tail call i32 @glCullFace(i32 %22)
br i1 %21, label %24, label %31
24: ; preds = %0
%25 = tail call i32 @draw_sphere(i32 %15)
%26 = tail call i32 (...) @draw_cone()
%27 = load i32, i32* @GL_BACK
%28 = tail call i32 @glCullFace(i32 %27)
%29 = tail call i32 @draw_sphere(i32 %15)
%30 = tail call i32 (...) @draw_cone()
br label %38
31: ; preds = %0
%32 = tail call i32 (...) @draw_cone()
%33 = tail call i32 @draw_sphere(i32 %15)
%34 = load i32, i32* @GL_BACK
%35 = tail call i32 @glCullFace(i32 %34)
%36 = tail call i32 (...) @draw_cone()
%37 = tail call i32 @draw_sphere(i32 %15)
br label %38
38: ; preds = %31, %24
%39 = load i32, i32* @GL_CULL_FACE
%40 = tail call i32 @glDisable(i32 %39)
%41 = load i32, i32* @GL_BLEND
%42 = tail call i32 @glDisable(i32 %41)
%43 = tail call i64 (...) @glGetError()
%44 = load i64, i64* @GL_NO_ERROR
%45 = icmp eq i64 %43, %44
br i1 %45, label %49, label %46
46: ; preds = %38
%47 = tail call i8* @gluErrorString(i64 %43)
%48 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %47)
br label %49
49: ; preds = %46, %38
%50 = tail call i32 (...) @glutSwapBuffers()
ret void
}