#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*/ nextBelt(double, double);
int /*<<< orphan*/ nextState(double, double);
int /*<<< orphan*/ paintRobotImg(char *, double, double);
int /*<<< orphan*/ paintTrace();
int /*<<< orphan*/ readControl();
int /*<<< orphan*/ sleep_ms(int);
double time_elapsed();
int /*<<< orphan*/ writeState();
void loop() {
  readControl();
  double dt = time_elapsed();
  nextState(dt, 0.1);
  nextBelt(dt, 0.16);
  writeState();
  paintRobotImg("./robots/belt/imgs/shipD.png", 0.1, 0.16);
  paintTrace();
  sleep_ms((10));
}


x86 assembly (clang, -O0):
<loop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1080 <readControl@plt>
mov    $0x0,%al
call   1030 <time_elapsed@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe58(%rip),%xmm1
call   1040 <nextState@plt>
movsd  -0x8(%rbp),%xmm0
movsd  0xe4e(%rip),%xmm1
call   1070 <nextBelt@plt>
mov    $0x0,%al
call   1050 <writeState@plt>
lea    0xe43(%rip),%rdi
movsd  0xe2b(%rip),%xmm0
movsd  0xe2b(%rip),%xmm1
call   10a0 <paintRobotImg@plt>
mov    $0x0,%al
call   1090 <paintTrace@plt>
mov    $0xa,%edi
call   1060 <sleep_ms@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<loop>:
push   %rax
xor    %eax,%eax
call   1080 <readControl@plt>
xor    %eax,%eax
call   1030 <time_elapsed@plt>
movsd  %xmm0,(%rsp)
movsd  0xe64(%rip),%xmm1
call   1040 <nextState@plt>
movsd  0xe5f(%rip),%xmm1
movsd  (%rsp),%xmm0
call   1070 <nextBelt@plt>
xor    %eax,%eax
call   1050 <writeState@plt>
lea    0xe4f(%rip),%rdi
movsd  0xe37(%rip),%xmm0
movsd  0xe37(%rip),%xmm1
call   10a0 <paintRobotImg@plt>
xor    %eax,%eax
call   1090 <paintTrace@plt>
mov    $0xa,%edi
pop    %rax
jmp    1060 <sleep_ms@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"./robots/belt/imgs/shipD.png\00"
define void @loop() {
%1 = alloca double
%2 = call i32 (...) @readControl()
%3 = call double (...) @time_elapsed()
store double %3, double* %1
%4 = load double, double* %1
%5 = call i32 @nextState(double %4, double 1.000000e-01)
%6 = load double, double* %1
%7 = call i32 @nextBelt(double %6, double 1.600000e-01)
%8 = call i32 (...) @writeState()
%9 = call i32 @paintRobotImg(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), double 1.000000e-01, double 1.600000e-01)
%10 = call i32 (...) @paintTrace()
%11 = call i32 @sleep_ms(i32 10)
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"./robots/belt/imgs/shipD.png\00"
define void @loop() {
%1 = tail call i32 (...) @readControl()
%2 = tail call double (...) @time_elapsed()
%3 = tail call i32 @nextState(double %2, double 1.000000e-01)
%4 = tail call i32 @nextBelt(double %2, double 1.600000e-01)
%5 = tail call i32 (...) @writeState()
%6 = tail call i32 @paintRobotImg(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), double 1.000000e-01, double 1.600000e-01)
%7 = tail call i32 (...) @paintTrace()
%8 = tail call i32 @sleep_ms(i32 10)
ret void
}