#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*/ beginScene(int);
int /*<<< orphan*/ control_to(double, double, double, double, double, double *,
                              double *);
int /*<<< orphan*/ drawLine(char *, double, double, double, double);
int /*<<< orphan*/ endScene();
int /*<<< orphan*/ paintPoint(char *, double, double);
double readDbl(char *);
int /*<<< orphan*/ setColor(char *, int /*<<< orphan*/, int /*<<< orphan*/, int,
                            int);
int /*<<< orphan*/ setStroke(char *, double);
int /*<<< orphan*/ sleep_ms(int);
int /*<<< orphan*/ writeDbl(char *, double);
void loop() {
  double px = readDbl("robot.px");
  double py = readDbl("robot.py");
  double vel = readDbl("robot.vel");
  double theta = readDbl("robot.theta");
  int N = 5;
  double waypoints[N][2];
  waypoints[0][0] = 0;
  waypoints[0][1] = 0;
  waypoints[1][0] = 6;
  waypoints[1][1] = 0;
  waypoints[2][0] = 6;
  waypoints[2][1] = 4;
  waypoints[3][0] = 3;
  waypoints[3][1] = 2;
  waypoints[4][0] = 0;
  waypoints[4][1] = 4;
  int n, t;
  beginScene(50);
  setColor("route", 0, 0, 255, 255);
  setStroke("route", 2.0);
  for (n = 0; n < N; n++) {
    t = (n + 1) % N;
    drawLine("route", waypoints[n][0], waypoints[n][1], waypoints[t][0],
             waypoints[t][1]);
  }
  endScene();
  for (n = 0; n < N; n++) {
    for (t = 0; t < 100; t++) {
      double lambda = t / 100.0;
      double dx =
          waypoints[n][0] * (1 - lambda) + waypoints[(n + 1) % N][0] * lambda;
      double dy =
          waypoints[n][1] * (1 - lambda) + waypoints[(n + 1) % N][1] * lambda;
      double thrust, aileron;
      control_to(px, py, theta, dx, dy, &thrust, &aileron);
      writeDbl("thrust", thrust);
      writeDbl("aileron", aileron);
      paintPoint("destine", dx, dy);
      sleep_ms(100);
      px = readDbl("robot.px");
      py = readDbl("robot.py");
      vel = readDbl("robot.vel");
      theta = readDbl("robot.theta");
    }
  }
}


x86 assembly (clang, -O0):
<loop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
lea    0xe81(%rip),%rdi
call   10b0 <readDbl@plt>
movsd  %xmm0,-0x8(%rbp)
lea    0xe79(%rip),%rdi
call   10b0 <readDbl@plt>
movsd  %xmm0,-0x10(%rbp)
lea    0xe71(%rip),%rdi
call   10b0 <readDbl@plt>
movsd  %xmm0,-0x18(%rbp)
lea    0xe6a(%rip),%rdi
call   10b0 <readDbl@plt>
movsd  %xmm0,-0x20(%rbp)
movl   $0x5,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,%ecx
mov    %rsp,%rax
mov    %rax,-0x30(%rbp)
mov    %rcx,%rdx
shl    $0x4,%rdx
mov    %rsp,%rax
sub    %rdx,%rax
mov    %rax,-0x70(%rbp)
mov    %rax,%rsp
mov    %rcx,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rax)
movsd  0xdea(%rip),%xmm0
movsd  %xmm0,0x10(%rax)
xorps  %xmm0,%xmm0
movsd  %xmm0,0x18(%rax)
movsd  0xdd5(%rip),%xmm0
movsd  %xmm0,0x20(%rax)
movsd  0xdb8(%rip),%xmm0
movsd  %xmm0,0x28(%rax)
movsd  0xdb3(%rip),%xmm0
movsd  %xmm0,0x30(%rax)
movsd  0xd96(%rip),%xmm0
movsd  %xmm0,0x38(%rax)
xorps  %xmm0,%xmm0
movsd  %xmm0,0x40(%rax)
movsd  0xd89(%rip),%xmm0
movsd  %xmm0,0x48(%rax)
mov    $0x32,%edi
call   1040 <beginScene@plt>
lea    0xdc3(%rip),%rdi
xor    %edx,%edx
mov    $0xff,%r8d
mov    %edx,%esi
mov    %r8d,%ecx
call   10c0 <setColor@plt>
lea    0xdaa(%rip),%rdi
movsd  0xd4a(%rip),%xmm0
call   1050 <setStroke@plt>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1340 <loop+0x1a0>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
cltd
idivl  -0x24(%rbp)
mov    -0x70(%rbp),%rax
mov    %edx,-0x40(%rbp)
movslq -0x3c(%rbp),%rdx
shl    $0x4,%rdx
mov    %rax,%rcx
add    %rdx,%rcx
movsd  (%rcx),%xmm0
movslq -0x3c(%rbp),%rdx
shl    $0x4,%rdx
mov    %rax,%rcx
add    %rdx,%rcx
movsd  0x8(%rcx),%xmm1
movslq -0x40(%rbp),%rdx
shl    $0x4,%rdx
mov    %rax,%rcx
add    %rdx,%rcx
movsd  (%rcx),%xmm2
movslq -0x40(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movsd  0x8(%rax),%xmm3
lea    0xd2b(%rip),%rdi
call   1060 <drawLine@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    12c2 <loop+0x122>
mov    $0x0,%al
call   1030 <endScene@plt>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    14eb <loop+0x34b>
movl   $0x0,-0x40(%rbp)
cmpl   $0x64,-0x40(%rbp)
jge    14d8 <loop+0x338>
mov    -0x70(%rbp),%rax
cvtsi2sdl -0x40(%rbp),%xmm0
movsd  0xcac(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movslq -0x3c(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm0
movsd  0xc84(%rip),%xmm2
subsd  -0x48(%rbp),%xmm2
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
cltd
idivl  -0x24(%rbp)
mov    -0x70(%rbp),%rax
movslq %edx,%rdx
shl    $0x4,%rdx
mov    %rax,%rcx
add    %rdx,%rcx
movsd  (%rcx),%xmm1
mulsd  -0x48(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movslq -0x3c(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movsd  0x8(%rax),%xmm0
movsd  0xc36(%rip),%xmm2
subsd  -0x48(%rbp),%xmm2
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
cltd
idivl  -0x24(%rbp)
mov    -0x70(%rbp),%rax
movslq %edx,%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movsd  0x8(%rax),%xmm1
mulsd  -0x48(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm3
movsd  -0x58(%rbp),%xmm4
lea    -0x60(%rbp),%rdi
lea    -0x68(%rbp),%rsi
call   10a0 <control_to@plt>
movsd  -0x60(%rbp),%xmm0
lea    0xc0e(%rip),%rdi
call   1080 <writeDbl@plt>
movsd  -0x68(%rbp),%xmm0
lea    0xc04(%rip),%rdi
call   1080 <writeDbl@plt>
movsd  -0x50(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm1
lea    0xbf6(%rip),%rdi
call   1070 <paintPoint@plt>
mov    $0x64,%edi
call   1090 <sleep_ms@plt>
lea    0xba3(%rip),%rdi
call   10b0 <readDbl@plt>
movsd  %xmm0,-0x8(%rbp)
lea    0xb9b(%rip),%rdi
call   10b0 <readDbl@plt>
movsd  %xmm0,-0x10(%rbp)
lea    0xb93(%rip),%rdi
call   10b0 <readDbl@plt>
movsd  %xmm0,-0x18(%rbp)
lea    0xb8c(%rip),%rdi
call   10b0 <readDbl@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    1361 <loop+0x1c1>
jmp    14dd <loop+0x33d>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    134e <loop+0x1ae>
mov    -0x30(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<loop>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
lea    0xe98(%rip),%rdi
call   10b0 <readDbl@plt>
movsd  %xmm0,0x8(%rsp)
lea    0xe8f(%rip),%rdi
call   10b0 <readDbl@plt>
movsd  %xmm0,(%rsp)
lea    0xe87(%rip),%rdi
call   10b0 <readDbl@plt>
lea    0xe85(%rip),%rdi
call   10b0 <readDbl@plt>
movsd  %xmm0,0x10(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x50(%rsp)
movsd  0xdfe(%rip),%xmm1
movaps %xmm1,0x60(%rsp)
movaps 0xe22(%rip),%xmm1
movaps %xmm1,0x70(%rsp)
movaps 0xe26(%rip),%xmm1
movaps %xmm1,0x80(%rsp)
movsd  0xdde(%rip),%xmm1
movlhps %xmm1,%xmm0
movaps %xmm0,0x90(%rsp)
mov    $0x32,%edi
call   1040 <beginScene@plt>
lea    0xe32(%rip),%rbx
xor    %ebp,%ebp
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
mov    $0xff,%ecx
mov    $0xff,%r8d
call   10c0 <setColor@plt>
movsd  0xda9(%rip),%xmm0
mov    %rbx,%rdi
call   1050 <setStroke@plt>
movsd  0xd89(%rip),%xmm2
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
xorps  %xmm3,%xmm3
mov    %rbx,%rdi
call   1060 <drawLine@plt>
xorps  %xmm1,%xmm1
mov    %rbx,%rdi
movsd  0xd6a(%rip),%xmm0
movaps %xmm0,%xmm2
movsd  0xd67(%rip),%xmm3
call   1060 <drawLine@plt>
movsd  0xd6a(%rip),%xmm2
mov    %rbx,%rdi
movsd  0xd47(%rip),%xmm0
movsd  0xd47(%rip),%xmm1
movsd  0xd47(%rip),%xmm3
call   1060 <drawLine@plt>
xorpd  %xmm2,%xmm2
mov    %rbx,%rdi
movsd  0xd3b(%rip),%xmm0
movsd  0xd2b(%rip),%xmm1
movsd  0xd1b(%rip),%xmm3
call   1060 <drawLine@plt>
xorpd  %xmm0,%xmm0
xorpd  %xmm2,%xmm2
xorps  %xmm3,%xmm3
mov    %rbx,%rdi
movsd  0xd00(%rip),%xmm1
call   1060 <drawLine@plt>
xor    %eax,%eax
call   1030 <endScene@plt>
movsd  0x10(%rsp),%xmm3
xorpd  %xmm2,%xmm2
movsd  0xcfa(%rip),%xmm1
movsd  0xcfa(%rip),%xmm4
lea    0x48(%rsp),%r12
lea    0x40(%rsp),%rbx
xorpd  %xmm5,%xmm5
nopl   0x0(%rax)
add    $0x1,%rbp
cmp    $0x5,%rbp
mov    %rbp,0x18(%rsp)
mov    %ebp,%eax
mov    $0x0,%ecx
cmovne %rax,%rcx
shl    $0x4,%rcx
movsd  0x50(%rsp,%rcx,1),%xmm0
movsd  %xmm0,0x28(%rsp)
movsd  0x58(%rsp,%rcx,1),%xmm0
movsd  %xmm0,0x20(%rsp)
mov    $0x64,%r13d
xorps  %xmm0,%xmm0
movsd  0x8(%rsp),%xmm6
movsd  (%rsp),%xmm7
lea    0xcef(%rip),%rbp
lea    0xcef(%rip),%r14
lea    0xcf0(%rip),%r15
movsd  %xmm2,0x38(%rsp)
movsd  %xmm5,0x30(%rsp)
nopl   0x0(%rax)
movsd  %xmm0,0x10(%rsp)
movsd  0x10(%rsp),%xmm0
divsd  %xmm1,%xmm0
subsd  %xmm0,%xmm4
movapd %xmm0,%xmm1
mulsd  0x28(%rsp),%xmm1
mulsd  %xmm4,%xmm5
addsd  %xmm1,%xmm5
movsd  %xmm5,(%rsp)
mulsd  0x20(%rsp),%xmm0
mulsd  %xmm2,%xmm4
addsd  %xmm0,%xmm4
movsd  %xmm4,0x8(%rsp)
movaps %xmm6,%xmm0
movaps %xmm7,%xmm1
movaps %xmm3,%xmm2
movapd %xmm5,%xmm3
mov    %r12,%rdi
mov    %rbx,%rsi
call   10a0 <control_to@plt>
movsd  0x48(%rsp),%xmm0
mov    %rbp,%rdi
call   1080 <writeDbl@plt>
movsd  0x40(%rsp),%xmm0
mov    %r14,%rdi
call   1080 <writeDbl@plt>
mov    %r15,%rdi
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
call   1070 <paintPoint@plt>
mov    $0x64,%edi
call   1090 <sleep_ms@plt>
lea    0xc09(%rip),%rdi
call   10b0 <readDbl@plt>
movsd  %xmm0,0x8(%rsp)
lea    0xc00(%rip),%rdi
call   10b0 <readDbl@plt>
movsd  %xmm0,(%rsp)
lea    0xbf8(%rip),%rdi
call   10b0 <readDbl@plt>
lea    0xbf6(%rip),%rdi
call   10b0 <readDbl@plt>
movsd  (%rsp),%xmm7
movsd  0x8(%rsp),%xmm6
movsd  0x30(%rsp),%xmm5
movsd  0xb94(%rip),%xmm4
movsd  0xb84(%rip),%xmm1
movsd  0x38(%rsp),%xmm2
movaps %xmm0,%xmm3
movsd  0x10(%rsp),%xmm0
addsd  %xmm4,%xmm0
add    $0xffffffff,%r13d
jne    13b0 <loop+0x210>
mov    0x18(%rsp),%rbp
cmp    $0x5,%rbp
je     14dc <loop+0x33c>
mov    %rbp,%rax
shl    $0x4,%rax
movsd  0x50(%rsp,%rax,1),%xmm5
movsd  0x58(%rsp,%rax,1),%xmm2
jmp    1340 <loop+0x1a0>
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"robot.px\00"
@.str.1 = [9 x i8] c"robot.py\00"
@.str.2 = [10 x i8] c"robot.vel\00"
@.str.3 = [12 x i8] c"robot.theta\00"
@.str.4 = [6 x i8] c"route\00"
@.str.5 = [7 x i8] c"thrust\00"
@.str.6 = [8 x i8] c"aileron\00"
@.str.7 = [8 x i8] c"destine\00"
define void @loop() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
%9 = alloca i32
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = call double @readDbl(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store double %15, double* %1
%16 = call double @readDbl(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
store double %16, double* %2
%17 = call double @readDbl(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
store double %17, double* %3
%18 = call double @readDbl(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
store double %18, double* %4
store i32 5, i32* %5
%19 = load i32, i32* %5
%20 = zext i32 %19 to i64
%21 = call i8* @llvm.stacksave()
store i8* %21, i8** %6
%22 = alloca [2 x double], i64 %20
store i64 %20, i64* %7
%23 = getelementptr inbounds [2 x double], [2 x double]* %22, i64 0
%24 = getelementptr inbounds [2 x double], [2 x double]* %23, i64 0, i64 0
store double 0.000000e+00, double* %24
%25 = getelementptr inbounds [2 x double], [2 x double]* %22, i64 0
%26 = getelementptr inbounds [2 x double], [2 x double]* %25, i64 0, i64 1
store double 0.000000e+00, double* %26
%27 = getelementptr inbounds [2 x double], [2 x double]* %22, i64 1
%28 = getelementptr inbounds [2 x double], [2 x double]* %27, i64 0, i64 0
store double 6.000000e+00, double* %28
%29 = getelementptr inbounds [2 x double], [2 x double]* %22, i64 1
%30 = getelementptr inbounds [2 x double], [2 x double]* %29, i64 0, i64 1
store double 0.000000e+00, double* %30
%31 = getelementptr inbounds [2 x double], [2 x double]* %22, i64 2
%32 = getelementptr inbounds [2 x double], [2 x double]* %31, i64 0, i64 0
store double 6.000000e+00, double* %32
%33 = getelementptr inbounds [2 x double], [2 x double]* %22, i64 2
%34 = getelementptr inbounds [2 x double], [2 x double]* %33, i64 0, i64 1
store double 4.000000e+00, double* %34
%35 = getelementptr inbounds [2 x double], [2 x double]* %22, i64 3
%36 = getelementptr inbounds [2 x double], [2 x double]* %35, i64 0, i64 0
store double 3.000000e+00, double* %36
%37 = getelementptr inbounds [2 x double], [2 x double]* %22, i64 3
%38 = getelementptr inbounds [2 x double], [2 x double]* %37, i64 0, i64 1
store double 2.000000e+00, double* %38
%39 = getelementptr inbounds [2 x double], [2 x double]* %22, i64 4
%40 = getelementptr inbounds [2 x double], [2 x double]* %39, i64 0, i64 0
store double 0.000000e+00, double* %40
%41 = getelementptr inbounds [2 x double], [2 x double]* %22, i64 4
%42 = getelementptr inbounds [2 x double], [2 x double]* %41, i64 0, i64 1
store double 4.000000e+00, double* %42
%43 = call i32 @beginScene(i32 50)
%44 = call i32 @setColor(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 0, i32 0, i32 255, i32 255)
%45 = call i32 @setStroke(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), double 2.000000e+00)
store i32 0, i32* %8
br label %46
46: ; preds = %76, %0
%47 = load i32, i32* %8
%48 = load i32, i32* %5
%49 = icmp slt i32 %47, %48
br i1 %49, label %50, label %79
50: ; preds = %46
%51 = load i32, i32* %8
%52 = add nsw i32 %51, 1
%53 = load i32, i32* %5
%54 = srem i32 %52, %53
store i32 %54, i32* %9
%55 = load i32, i32* %8
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [2 x double], [2 x double]* %22, i64 %56
%58 = getelementptr inbounds [2 x double], [2 x double]* %57, i64 0, i64 0
%59 = load double, double* %58
%60 = load i32, i32* %8
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [2 x double], [2 x double]* %22, i64 %61
%63 = getelementptr inbounds [2 x double], [2 x double]* %62, i64 0, i64 1
%64 = load double, double* %63
%65 = load i32, i32* %9
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [2 x double], [2 x double]* %22, i64 %66
%68 = getelementptr inbounds [2 x double], [2 x double]* %67, i64 0, i64 0
%69 = load double, double* %68
%70 = load i32, i32* %9
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [2 x double], [2 x double]* %22, i64 %71
%73 = getelementptr inbounds [2 x double], [2 x double]* %72, i64 0, i64 1
%74 = load double, double* %73
%75 = call i32 @drawLine(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), double %59, double %64, double %69, double %74)
br label %76
76: ; preds = %50
%77 = load i32, i32* %8
%78 = add nsw i32 %77, 1
store i32 %78, i32* %8
br label %46
79: ; preds = %46
%80 = call i32 (...) @endScene()
store i32 0, i32* %8
br label %81
81: ; preds = %151, %79
%82 = load i32, i32* %8
%83 = load i32, i32* %5
%84 = icmp slt i32 %82, %83
br i1 %84, label %85, label %154
85: ; preds = %81
store i32 0, i32* %9
br label %86
86: ; preds = %147, %85
%87 = load i32, i32* %9
%88 = icmp slt i32 %87, 100
br i1 %88, label %89, label %150
89: ; preds = %86
%90 = load i32, i32* %9
%91 = sitofp i32 %90 to double
%92 = fdiv double %91, 1.000000e+02
store double %92, double* %10
%93 = load i32, i32* %8
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds [2 x double], [2 x double]* %22, i64 %94
%96 = getelementptr inbounds [2 x double], [2 x double]* %95, i64 0, i64 0
%97 = load double, double* %96
%98 = load double, double* %10
%99 = fsub double 1.000000e+00, %98
%100 = load i32, i32* %8
%101 = add nsw i32 %100, 1
%102 = load i32, i32* %5
%103 = srem i32 %101, %102
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds [2 x double], [2 x double]* %22, i64 %104
%106 = getelementptr inbounds [2 x double], [2 x double]* %105, i64 0, i64 0
%107 = load double, double* %106
%108 = load double, double* %10
%109 = fmul double %107, %108
%110 = call double @llvm.fmuladd.f64(double %97, double %99, double %109)
store double %110, double* %11
%111 = load i32, i32* %8
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds [2 x double], [2 x double]* %22, i64 %112
%114 = getelementptr inbounds [2 x double], [2 x double]* %113, i64 0, i64 1
%115 = load double, double* %114
%116 = load double, double* %10
%117 = fsub double 1.000000e+00, %116
%118 = load i32, i32* %8
%119 = add nsw i32 %118, 1
%120 = load i32, i32* %5
%121 = srem i32 %119, %120
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds [2 x double], [2 x double]* %22, i64 %122
%124 = getelementptr inbounds [2 x double], [2 x double]* %123, i64 0, i64 1
%125 = load double, double* %124
%126 = load double, double* %10
%127 = fmul double %125, %126
%128 = call double @llvm.fmuladd.f64(double %115, double %117, double %127)
store double %128, double* %12
%129 = load double, double* %1
%130 = load double, double* %2
%131 = load double, double* %4
%132 = load double, double* %11
%133 = load double, double* %12
%134 = call i32 @control_to(double %129, double %130, double %131, double %132, double %133, double* %13, double* %14)
%135 = load double, double* %13
%136 = call i32 @writeDbl(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), double %135)
%137 = load double, double* %14
%138 = call i32 @writeDbl(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), double %137)
%139 = load double, double* %11
%140 = load double, double* %12
%141 = call i32 @paintPoint(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), double %139, double %140)
%142 = call i32 @sleep_ms(i32 100)
%143 = call double @readDbl(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store double %143, double* %1
%144 = call double @readDbl(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
store double %144, double* %2
%145 = call double @readDbl(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
store double %145, double* %3
%146 = call double @readDbl(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
store double %146, double* %4
br label %147
147: ; preds = %89
%148 = load i32, i32* %9
%149 = add nsw i32 %148, 1
store i32 %149, i32* %9
br label %86
150: ; preds = %86
br label %151
151: ; preds = %150
%152 = load i32, i32* %8
%153 = add nsw i32 %152, 1
store i32 %153, i32* %8
br label %81
154: ; preds = %81
%155 = load i8*, i8** %6
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"robot.px\00"
@.str.1 = [9 x i8] c"robot.py\00"
@.str.2 = [10 x i8] c"robot.vel\00"
@.str.3 = [12 x i8] c"robot.theta\00"
@.str.4 = [6 x i8] c"route\00"
@.str.5 = [7 x i8] c"thrust\00"
@.str.6 = [8 x i8] c"aileron\00"
@.str.7 = [8 x i8] c"destine\00"
define void @loop() {
%1 = alloca double
%2 = alloca double
%3 = tail call double @readDbl(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%4 = tail call double @readDbl(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call double @readDbl(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call double @readDbl(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%7 = alloca [5 x [2 x double]]
%8 = getelementptr inbounds [5 x [2 x double]], [5 x [2 x double]]* %7, i64 0, i64 1, i64 0
%9 = bitcast [5 x [2 x double]]* %7 to i8*
%10 = bitcast double* %8 to <2 x double>*
store <2 x double> <double 6.000000e+00, double 0.000000e+00>, <2 x double>* %10
%11 = getelementptr inbounds [5 x [2 x double]], [5 x [2 x double]]* %7, i64 0, i64 2, i64 0
%12 = bitcast double* %11 to <2 x double>*
store <2 x double> <double 6.000000e+00, double 4.000000e+00>, <2 x double>* %12
%13 = getelementptr inbounds [5 x [2 x double]], [5 x [2 x double]]* %7, i64 0, i64 3, i64 0
%14 = bitcast double* %13 to <2 x double>*
store <2 x double> <double 3.000000e+00, double 2.000000e+00>, <2 x double>* %14
%15 = getelementptr inbounds [5 x [2 x double]], [5 x [2 x double]]* %7, i64 0, i64 4, i64 0
%16 = bitcast double* %15 to <2 x double>*
store <2 x double> <double 0.000000e+00, double 4.000000e+00>, <2 x double>* %16
%17 = tail call i32 @beginScene(i32 50)
%18 = tail call i32 @setColor(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 0, i32 0, i32 255, i32 255)
%19 = tail call i32 @setStroke(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), double 2.000000e+00)
%20 = tail call i32 @drawLine(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), double 0.000000e+00, double 0.000000e+00, double 6.000000e+00, double 0.000000e+00)
%21 = tail call i32 @drawLine(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), double 6.000000e+00, double 0.000000e+00, double 6.000000e+00, double 4.000000e+00)
%22 = tail call i32 @drawLine(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), double 6.000000e+00, double 4.000000e+00, double 3.000000e+00, double 2.000000e+00)
%23 = tail call i32 @drawLine(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), double 3.000000e+00, double 2.000000e+00, double 0.000000e+00, double 4.000000e+00)
%24 = tail call i32 @drawLine(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), double 0.000000e+00, double 4.000000e+00, double 0.000000e+00, double 0.000000e+00)
%25 = tail call i32 (...) @endScene()
%26 = bitcast double* %1 to i8*
%27 = bitcast double* %2 to i8*
br label %28
28: ; preds = %70, %0
%29 = phi double [ 0.000000e+00, %0 ], [ %74, %70 ]
%30 = phi double [ 0.000000e+00, %0 ], [ %72, %70 ]
%31 = phi i64 [ 0, %0 ], [ %35, %70 ]
%32 = phi double [ %3, %0 ], [ %62, %70 ]
%33 = phi double [ %4, %0 ], [ %63, %70 ]
%34 = phi double [ %6, %0 ], [ %65, %70 ]
%35 = add nuw nsw i64 %31, 1
%36 = icmp eq i64 %35, 5
%37 = and i64 %35, 4294967295
%38 = select i1 %36, i64 0, i64 %37
%39 = getelementptr inbounds [5 x [2 x double]], [5 x [2 x double]]* %7, i64 0, i64 %38, i64 0
%40 = load double, double* %39
%41 = getelementptr inbounds [5 x [2 x double]], [5 x [2 x double]]* %7, i64 0, i64 %38, i64 1
%42 = load double, double* %41
br label %43
43: ; preds = %28, %43
%44 = phi double [ %32, %28 ], [ %62, %43 ]
%45 = phi double [ %33, %28 ], [ %63, %43 ]
%46 = phi i32 [ 0, %28 ], [ %66, %43 ]
%47 = phi double [ %34, %28 ], [ %65, %43 ]
%48 = sitofp i32 %46 to double
%49 = fdiv double %48, 1.000000e+02
%50 = fsub double 1.000000e+00, %49
%51 = fmul double %49, %40
%52 = call double @llvm.fmuladd.f64(double %30, double %50, double %51)
%53 = fmul double %49, %42
%54 = call double @llvm.fmuladd.f64(double %29, double %50, double %53)
%55 = call i32 @control_to(double %44, double %45, double %47, double %52, double %54, double* %1, double* %2)
%56 = load double, double* %1
%57 = call i32 @writeDbl(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), double %56)
%58 = load double, double* %2
%59 = call i32 @writeDbl(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), double %58)
%60 = call i32 @paintPoint(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), double %52, double %54)
%61 = call i32 @sleep_ms(i32 100)
%62 = call double @readDbl(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%63 = call double @readDbl(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%64 = call double @readDbl(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%65 = call double @readDbl(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%66 = add nuw nsw i32 %46, 1
%67 = icmp eq i32 %66, 100
br i1 %67, label %68, label %43
68: ; preds = %43
%69 = icmp eq i64 %35, 5
br i1 %69, label %75, label %70
70: ; preds = %68
%71 = getelementptr inbounds [5 x [2 x double]], [5 x [2 x double]]* %7, i64 0, i64 %35, i64 0
%72 = load double, double* %71
%73 = getelementptr inbounds [5 x [2 x double]], [5 x [2 x double]]* %7, i64 0, i64 %35, i64 1
%74 = load double, double* %73
br label %28
75: ; preds = %68
ret void
}