#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);
  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>
mov    0x2d7c(%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    0x2d37(%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    0x2d12(%rip),%rax
mov    (%rax),%edi
call   10d0 <glDisable@plt>
mov    0x2d2c(%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    0x2cff(%rip),%rcx
cmp    (%rcx),%rax
je     12f2 <draw+0x132>
mov    -0x8(%rbp),%rdi
call   10c0 <gluErrorString@plt>
mov    %rax,%rsi
lea    0xd2b(%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>
xor    %eax,%eax
call   1050 <draw_cone@plt>
mov    %ebx,%edi
call   10b0 <draw_sphere@plt>
mov    0x2d55(%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    0x2d32(%rip),%rcx
cmp    (%rcx),%rax
je     12ba <draw+0xfa>
mov    %rax,%rdi
call   10c0 <gluErrorString@plt>
lea    0xd66(%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* @GL_FRONT
%29 = call i32 @glCullFace(i32 %28)
%30 = call i32 (...) @draw_cone()
%31 = load i32, i32* %3
%32 = call i32 @draw_sphere(i32 %31)
%33 = load i32, i32* @GL_BACK
%34 = call i32 @glCullFace(i32 %33)
%35 = call i32 (...) @draw_cone()
%36 = load i32, i32* %3
%37 = call i32 @draw_sphere(i32 %36)
%38 = load i32, i32* @GL_CULL_FACE
%39 = call i32 @glDisable(i32 %38)
%40 = load i32, i32* @GL_BLEND
%41 = call i32 @glDisable(i32 %40)
%42 = call i64 (...) @glGetError()
store i64 %42, i64* %1
%43 = load i64, i64* %1
%44 = load i64, i64* @GL_NO_ERROR
%45 = icmp ne i64 %43, %44
br i1 %45, label %46, label %50
46: ; preds = %0
%47 = load i64, i64* %1
%48 = call i8* @gluErrorString(i64 %47)
%49 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %48)
br label %50
50: ; preds = %46, %0
%51 = 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 = load i32, i32* @GL_FRONT
%22 = tail call i32 @glCullFace(i32 %21)
%23 = tail call i32 (...) @draw_cone()
%24 = tail call i32 @draw_sphere(i32 %15)
%25 = load i32, i32* @GL_BACK
%26 = tail call i32 @glCullFace(i32 %25)
%27 = tail call i32 (...) @draw_cone()
%28 = tail call i32 @draw_sphere(i32 %15)
%29 = load i32, i32* @GL_CULL_FACE
%30 = tail call i32 @glDisable(i32 %29)
%31 = load i32, i32* @GL_BLEND
%32 = tail call i32 @glDisable(i32 %31)
%33 = tail call i64 (...) @glGetError()
%34 = load i64, i64* @GL_NO_ERROR
%35 = icmp eq i64 %33, %34
br i1 %35, label %39, label %36
36: ; preds = %0
%37 = tail call i8* @gluErrorString(i64 %33)
%38 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %37)
br label %39
39: ; preds = %36, %0
%40 = tail call i32 (...) @glutSwapBuffers()
ret void
}