#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() {
  int i = 0;
  long c = 0;
  im_start();
  while (1) {
    usleep(1000000 / 30);
    double *array = im_getSnapshot(1);
    printf("%08lx: ", c++);
    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)
movl   $0x0,-0x8(%rbp)
movq   $0x0,-0x10(%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,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
mov    %rsi,%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x100,-0x8(%rbp)
jge    11e7 <main+0x97>
mov    -0x18(%rbp),%rax
movslq -0x8(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe36(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x20,%eax
mov    %eax,-0x8(%rbp)
jmp    11b1 <main+0x61>
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2de4(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
jmp    1175 <main+0x25>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
xor    %eax,%eax
call   1050 <im_start@plt>
lea    0xe89(%rip),%r14
lea    0xe8a(%rip),%r12
mov    0x2e5b(%rip),%r13
xor    %r15d,%r15d
nopl   0x0(%rax,%rax,1)
mov    $0x8235,%edi
call   1080 <usleep@plt>
mov    $0x1,%edi
call   1070 <im_getSnapshot@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
movsd  (%rbx),%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x100(%rbx),%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x200(%rbx),%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x300(%rbx),%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x400(%rbx),%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x500(%rbx),%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x600(%rbx),%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x700(%rbx),%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%r15
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x0(%r13),%edi
call   1060 <fflush@plt>
jmp    1190 <main+0x30>

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

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