#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 main() {
  int i = 0;
  im_start();
  while (1) {
    double *array = im_getSnapshot(1);
    printf("audio_data:");
    for (i = 0; i < 256; i++)
      printf("%.4f,", array[i]);
    printf("\n");
    fflush(stdout);
  }
  im_stop();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1040 <im_start@plt>
mov    $0x1,%edi
call   1060 <im_getSnapshot@plt>
mov    %rax,-0x10(%rbp)
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x100,-0x8(%rbp)
jge    11b6 <main+0x76>
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe6b(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1180 <main+0x40>
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e15(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
jmp    115d <main+0x1d>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
xor    %eax,%eax
call   1050 <im_start@plt>
lea    0xe99(%rip),%r14
lea    0xe9e(%rip),%r15
mov    0x2e6b(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x1,%edi
call   1070 <im_getSnapshot@plt>
mov    %rax,%r13
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %ebx,%ebx
nopl   0x0(%rax)
movsd  0x0(%r13,%rbx,8),%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    $0x100,%rbx
jne    11a0 <main+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    (%r12),%edi
call   1060 <fflush@plt>
jmp    1180 <main+0x30>

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

LLVM IR (-O2):
@.str = [12 x i8] c"audio_data:\00"
@.str.1 = [6 x i8] c"%.4f,\00"
@stdout = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @im_start()
br label %2
2: ; preds = %12, %0
%3 = tail call double* @im_getSnapshot(i32 1)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %2, %5
%6 = phi i64 [ 0, %2 ], [ %10, %5 ]
%7 = getelementptr inbounds double, double* %3, i64 %6
%8 = load double, double* %7
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %8)
%10 = add nuw nsw i64 %6, 1
%11 = icmp eq i64 %10, 256
br i1 %11, label %12, label %5
12: ; preds = %5
%13 = tail call i32 @putchar(i32 10)
%14 = load i32, i32* @stdout
%15 = tail call i32 @fflush(i32 %14)
br label %2
}