#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*/ printf(char *, char *, int, double, char *);
void printAnalog(char *prefix, char *suffix, int numChannels, double *values) {
  int i;
  for (i = 0; i < numChannels; i++) {
    printf("\r%s%d: %+02.3f%s", prefix, i, values[i], suffix);
  }
}


x86 assembly (clang, -O0):
<printAnalog>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    116c <printAnalog+0x5c>
mov    -0x8(%rbp),%rsi
mov    -0x24(%rbp),%edx
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rcx
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    112e <printAnalog+0x1e>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printAnalog>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edx,%edx
jle    115f <printAnalog+0x4f>
mov    %rcx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
mov    %edx,%ebp
xor    %ebx,%ebx
lea    0xecd(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  (%r14,%rbx,8),%xmm0
mov    %r13,%rdi
mov    %r12,%rsi
mov    %ebx,%edx
mov    %r15,%rcx
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1140 <printAnalog+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"\0D%s%d: %+02.3f%s\00"
define void @printAnalog(i8* %0, i8* %1, i32 %2, double* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca double*
%9 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store double* %3, double** %8
store i32 0, i32* %9
br label %10
10: ; preds = %24, %4
%11 = load i32, i32* %9
%12 = load i32, i32* %7
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %27
14: ; preds = %10
%15 = load i8*, i8** %5
%16 = load i32, i32* %9
%17 = load double*, double** %8
%18 = load i32, i32* %9
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds double, double* %17, i64 %19
%21 = load double, double* %20
%22 = load i8*, i8** %6
%23 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %15, i32 %16, double %21, i8* %22)
br label %24
24: ; preds = %14
%25 = load i32, i32* %9
%26 = add nsw i32 %25, 1
store i32 %26, i32* %9
br label %10
27: ; preds = %10
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"\0D%s%d: %+02.3f%s\00"
define void @printAnalog(i8* %0, i8* %1, i32 %2, double* nocapture %3) {
%5 = icmp sgt i32 %2, 0
br i1 %5, label %6, label %16
6: ; preds = %4
%7 = zext i32 %2 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ 0, %6 ], [ %14, %8 ]
%10 = getelementptr inbounds double, double* %3, i64 %9
%11 = load double, double* %10
%12 = trunc i64 %9 to i32
%13 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %12, double %11, i8* %1)
%14 = add nuw nsw i64 %9, 1
%15 = icmp eq i64 %14, %7
br i1 %15, label %16, label %8
16: ; preds = %8, %4
ret void
}