#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*/ fflush(int /*<<< orphan*/);
double *im_getSnapshot(int);
int /*<<< orphan*/ im_start();
int /*<<< orphan*/ im_stop();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ usleep(int);
int main() {
  im_start();
  while (1) {
    usleep(1000000 / 30);
    double *array = im_getSnapshot(1);
    int i;
    for (i = 0; i < 256; i += 32)
      printf(" %.2f", array[i]);
    printf("\n");
    fflush(stdout);
  }
  im_stop();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <im_start@plt>
mov    $0x8235,%edi
call   1070 <usleep@plt>
mov    $0x1,%edi
call   1060 <im_getSnapshot@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x100,-0x14(%rbp)
jge    11bb <main+0x6b>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe5a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%eax
mov    %eax,-0x14(%rbp)
jmp    1185 <main+0x35>
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e10(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
jmp    1166 <main+0x16>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
call   1050 <im_start@plt>
lea    0xe8d(%rip),%r14
mov    0x2e66(%rip),%r15
nopw   0x0(%rax,%rax,1)
mov    $0x8235,%edi
call   1080 <usleep@plt>
mov    $0x1,%edi
call   1070 <im_getSnapshot@plt>
mov    %rax,%rbx
movsd  (%rax),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x100(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x200(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x300(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x400(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x500(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x600(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x700(%rbx),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    (%r15),%edi
call   1060 <fflush@plt>
jmp    1180 <main+0x20>

LLVM IR (-O0):
@.str = [6 x i8] c" %.2f\00"
@.str.1 = [2 x i8] c"\0A\00"
@stdout = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca double*
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (...) @im_start()
br label %5
5: ; preds = %0, %21
%6 = call i32 @usleep(i32 33333)
%7 = call double* @im_getSnapshot(i32 1)
store double* %7, double** %2
store i32 0, i32* %3
br label %8
8: ; preds = %18, %5
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 256
br i1 %10, label %11, label %21
11: ; preds = %8
%12 = load double*, double** %2
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds double, double* %12, i64 %14
%16 = load double, double* %15
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %16)
br label %18
18: ; preds = %11
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 32
store i32 %20, i32* %3
br label %8
21: ; preds = %8
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%23 = load i32, i32* @stdout
%24 = call i32 @fflush(i32 %23)
br label %5
}

LLVM IR (-O2):
@.str = [6 x i8] c" %.2f\00"
@stdout = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @im_start()
br label %2
2: ; preds = %0, %2
%3 = tail call i32 @usleep(i32 33333)
%4 = tail call double* @im_getSnapshot(i32 1)
%5 = load double, double* %4
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %5)
%7 = getelementptr inbounds double, double* %4, i64 32
%8 = load double, double* %7
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %8)
%10 = getelementptr inbounds double, double* %4, i64 64
%11 = load double, double* %10
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %11)
%13 = getelementptr inbounds double, double* %4, i64 96
%14 = load double, double* %13
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %14)
%16 = getelementptr inbounds double, double* %4, i64 128
%17 = load double, double* %16
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %17)
%19 = getelementptr inbounds double, double* %4, i64 160
%20 = load double, double* %19
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %20)
%22 = getelementptr inbounds double, double* %4, i64 192
%23 = load double, double* %22
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %23)
%25 = getelementptr inbounds double, double* %4, i64 224
%26 = load double, double* %25
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %26)
%28 = tail call i32 @putchar(i32 10)
%29 = load i32, i32* @stdout
%30 = tail call i32 @fflush(i32 %29)
br label %2
}