#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_MODELVIEW;
int M_PI;
int cos(double);
int /*<<< orphan*/ glLoadIdentity();
int /*<<< orphan*/ glMatrixMode(int /*<<< orphan*/);
int /*<<< orphan*/ gluLookAt(int, int, int, int /*<<< orphan*/,
                             int /*<<< orphan*/, int /*<<< orphan*/,
                             int /*<<< orphan*/, int, int /*<<< orphan*/);
int /*<<< orphan*/ glutPostRedisplay();
int /*<<< orphan*/ glutTimerFunc(int, void (*)(int), int);
int sin(double);
void timer(int v) {
  double kat_obrotu = M_PI / 360;
  static double alfa = 0;
  alfa += kat_obrotu;
  if (alfa >= 2 * M_PI)
    alfa -= 2 * M_PI;
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  gluLookAt(20 * cos(alfa), 7, 20 * sin(alfa), 0, 0, 0, 0, 1, 0);
  glutPostRedisplay();
  glutTimerFunc(15, timer, v);
}


x86 assembly (clang, -O0):
<timer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2e66(%rip),%rax
mov    (%rax),%eax
mov    $0x168,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
addsd  0x2ec6(%rip),%xmm0
movsd  %xmm0,0x2ebe(%rip)
movsd  0x2eb6(%rip),%xmm0
mov    0x2e2f(%rip),%rax
mov    (%rax),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm1
ucomisd %xmm1,%xmm0
jb     11f0 <timer+0x80>
mov    0x2e15(%rip),%rax
mov    (%rax),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm1
movsd  0x2e84(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,0x2e78(%rip)
mov    0x2de9(%rip),%rax
mov    (%rax),%edi
call   1040 <glMatrixMode@plt>
mov    $0x0,%al
call   1070 <glLoadIdentity@plt>
movsd  0x2e5b(%rip),%xmm0
call   1090 <cos@plt>
imul   $0x14,%eax,%eax
mov    %eax,-0x14(%rbp)
movsd  0x2e48(%rip),%xmm0
call   1060 <sin@plt>
mov    -0x14(%rbp),%edi
imul   $0x14,%eax,%edx
mov    $0x7,%esi
xor    %r9d,%r9d
mov    %r9d,%ecx
mov    %r9d,%r8d
movl   $0x0,(%rsp)
movl   $0x1,0x8(%rsp)
movl   $0x0,0x10(%rsp)
call   1030 <gluLookAt@plt>
mov    $0x0,%al
call   1080 <glutPostRedisplay@plt>
mov    -0x4(%rbp),%edx
mov    $0xf,%edi
mov    0x2d65(%rip),%rsi
call   1050 <glutTimerFunc@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timer>:
push   %rbp
push   %rbx
push   %rax
mov    0x2e6e(%rip),%rax
movslq (%rax),%rax
imul   $0xffffffffb60b60b7,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x8,%ecx
add    %edx,%ecx
cvtsi2sd %ecx,%xmm0
mov    %edi,%ebx
addsd  0x2ec6(%rip),%xmm0
add    %eax,%eax
cvtsi2sd %eax,%xmm1
movapd %xmm1,%xmm2
cmpnlesd %xmm0,%xmm2
andnpd %xmm1,%xmm2
subsd  %xmm2,%xmm0
movsd  %xmm0,0x2ea7(%rip)
mov    0x2e18(%rip),%rax
mov    (%rax),%edi
call   1040 <glMatrixMode@plt>
xor    %eax,%eax
call   1070 <glLoadIdentity@plt>
movsd  0x2e8a(%rip),%xmm0
call   1090 <cos@plt>
shl    $0x2,%eax
lea    (%rax,%rax,4),%ebp
movsd  0x2e77(%rip),%xmm0
call   1060 <sin@plt>
shl    $0x2,%eax
lea    (%rax,%rax,4),%edx
sub    $0x8,%rsp
mov    %ebp,%edi
mov    $0x7,%esi
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
push   $0x0
push   $0x1
push   $0x0
call   1030 <gluLookAt@plt>
add    $0x20,%rsp
xor    %eax,%eax
call   1080 <glutPostRedisplay@plt>
mov    0x2da4(%rip),%rsi
mov    $0xf,%edi
mov    %ebx,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <glutTimerFunc@plt>

LLVM IR (-O0):
@M_PI = global i32 0
@timer.alfa = internal global double 0.000000e+00
@GL_MODELVIEW = global i32 0
define void @timer(i32 %0) {
%2 = alloca i32
%3 = alloca double
store i32 %0, i32* %2
%4 = load i32, i32* @M_PI
%5 = sdiv i32 %4, 360
%6 = sitofp i32 %5 to double
store double %6, double* %3
%7 = load double, double* %3
%8 = load double, double* @timer.alfa
%9 = fadd double %8, %7
store double %9, double* @timer.alfa
%10 = load double, double* @timer.alfa
%11 = load i32, i32* @M_PI
%12 = mul nsw i32 2, %11
%13 = sitofp i32 %12 to double
%14 = fcmp oge double %10, %13
br i1 %14, label %15, label %21
15: ; preds = %1
%16 = load i32, i32* @M_PI
%17 = mul nsw i32 2, %16
%18 = sitofp i32 %17 to double
%19 = load double, double* @timer.alfa
%20 = fsub double %19, %18
store double %20, double* @timer.alfa
br label %21
21: ; preds = %15, %1
%22 = load i32, i32* @GL_MODELVIEW
%23 = call i32 @glMatrixMode(i32 %22)
%24 = call i32 (...) @glLoadIdentity()
%25 = load double, double* @timer.alfa
%26 = call i32 @cos(double %25)
%27 = mul nsw i32 20, %26
%28 = load double, double* @timer.alfa
%29 = call i32 @sin(double %28)
%30 = mul nsw i32 20, %29
%31 = call i32 @gluLookAt(i32 %27, i32 7, i32 %30, i32 0, i32 0, i32 0, i32 0, i32 1, i32 0)
%32 = call i32 (...) @glutPostRedisplay()
%33 = load i32, i32* %2
%34 = call i32 @glutTimerFunc(i32 15, void (i32)* @timer, i32 %33)
ret void
}

LLVM IR (-O2):
@M_PI = global i32 0
@timer.alfa = internal unnamed_addr global double 0.000000e+00
@GL_MODELVIEW = global i32 0
define void @timer(i32 %0) {
%2 = load i32, i32* @M_PI
%3 = sdiv i32 %2, 360
%4 = sitofp i32 %3 to double
%5 = load double, double* @timer.alfa
%6 = fadd double %5, %4
%7 = shl nsw i32 %2, 1
%8 = sitofp i32 %7 to double
%9 = fcmp ult double %6, %8
%10 = select i1 %9, double 0.000000e+00, double %8
%11 = fsub double %6, %10
store double %11, double* @timer.alfa
%12 = load i32, i32* @GL_MODELVIEW
%13 = tail call i32 @glMatrixMode(i32 %12)
%14 = tail call i32 (...) @glLoadIdentity()
%15 = load double, double* @timer.alfa
%16 = tail call i32 @cos(double %15)
%17 = mul nsw i32 %16, 20
%18 = load double, double* @timer.alfa
%19 = tail call i32 @sin(double %18)
%20 = mul nsw i32 %19, 20
%21 = tail call i32 @gluLookAt(i32 %17, i32 7, i32 %20, i32 0, i32 0, i32 0, i32 0, i32 1, i32 0)
%22 = tail call i32 (...) @glutPostRedisplay()
%23 = tail call i32 @glutTimerFunc(i32 15, void (i32)* @timer, i32 %0)
ret void
}