#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 GL_COLOR_BUFFER_BIT;
int GL_DEPTH_BUFFER_BIT;
scalar_t__ GL_NO_ERROR;
int /*<<< orphan*/ draw_torus(int);
int get_secs();
int /*<<< orphan*/ glClear(int);
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_torus(degrees);
  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    0x2e51(%rip),%rax
mov    (%rax),%edi
mov    0x2e60(%rip),%rax
or     (%rax),%edi
call   1040 <glClear@plt>
mov    $0x0,%al
call   1030 <get_secs@plt>
mov    %eax,-0xc(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm1
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  0xe5d(%rip),%xmm2
divsd  %xmm2,%xmm0
cvttsd2si %xmm0,%eax
cvtsi2sd %eax,%xmm0
movsd  0xe51(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0xc(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  0xe2d(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe19(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
call   1090 <draw_torus@plt>
mov    $0x0,%al
call   1070 <glGetError@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x2dd0(%rip),%rcx
cmp    (%rcx),%rax
je     1231 <draw+0xc1>
mov    -0x8(%rbp),%rdi
call   1080 <gluErrorString@plt>
mov    %rax,%rsi
lea    0xdec(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <glutSwapBuffers@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw>:
push   %rax
mov    0x2e58(%rip),%rax
mov    0x2e69(%rip),%rcx
mov    (%rcx),%edi
or     (%rax),%edi
call   1040 <glClear@plt>
xor    %eax,%eax
call   1030 <get_secs@plt>
cvtsi2sd %eax,%xmm0
movsd  0xe65(%rip),%xmm1
movapd %xmm0,%xmm2
divsd  %xmm1,%xmm2
cvttpd2dq %xmm2,%xmm2
cvtdq2pd %xmm2,%xmm2
mulsd  0xe55(%rip),%xmm2
addsd  %xmm0,%xmm2
cvttpd2dq %xmm2,%xmm0
cvtdq2pd %xmm0,%xmm0
divsd  %xmm1,%xmm0
mulsd  0xe45(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1090 <draw_torus@plt>
xor    %eax,%eax
call   1070 <glGetError@plt>
mov    0x2dfe(%rip),%rcx
cmp    (%rcx),%rax
je     11fe <draw+0x8e>
mov    %rax,%rdi
call   1080 <gluErrorString@plt>
lea    0xe22(%rip),%rdi
mov    %rax,%rsi
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rcx
jmp    1060 <glutSwapBuffers@plt>

LLVM IR (-O0):
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_DEPTH_BUFFER_BIT = 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 = load i32, i32* %3
%24 = call i32 @draw_torus(i32 %23)
%25 = call i64 (...) @glGetError()
store i64 %25, i64* %1
%26 = load i64, i64* %1
%27 = load i64, i64* @GL_NO_ERROR
%28 = icmp ne i64 %26, %27
br i1 %28, label %29, label %33
29: ; preds = %0
%30 = load i64, i64* %1
%31 = call i8* @gluErrorString(i64 %30)
%32 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %31)
br label %33
33: ; preds = %29, %0
%34 = call i32 (...) @glutSwapBuffers()
ret void
}

LLVM IR (-O2):
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_DEPTH_BUFFER_BIT = 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_torus(i32 %15)
%17 = tail call i64 (...) @glGetError()
%18 = load i64, i64* @GL_NO_ERROR
%19 = icmp eq i64 %17, %18
br i1 %19, label %23, label %20
20: ; preds = %0
%21 = tail call i8* @gluErrorString(i64 %17)
%22 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %21)
br label %23
23: ; preds = %20, %0
%24 = tail call i32 (...) @glutSwapBuffers()
ret void
}