#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 *, ...);
void vlprint(int l, double v[l]) {
  printf("[");
  for (int i = 0; i < l; i++) {
    printf("%lf%s", v[i], (i == (l - 1)) ? "]\n" : ";");
  }
}


x86 assembly (clang, -O0):
<vlprint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1186 <vlprint+0x76>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x14(%rbp),%ecx
mov    -0x4(%rbp),%edx
sub    $0x1,%edx
lea    0xeae(%rip),%rsi
lea    0xea4(%rip),%rax
cmp    %edx,%ecx
cmove  %rax,%rsi
lea    0xe91(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1134 <vlprint+0x24>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vlprint>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %edi,%r14d
mov    $0x5b,%edi
call   1030 <putchar@plt>
test   %r14d,%r14d
jle    118a <vlprint+0x6a>
lea    -0x1(%r14),%r12d
mov    %r14d,%r13d
xor    %ebx,%ebx
lea    0xeb9(%rip),%rbp
lea    0xea9(%rip),%r14
nopw   0x0(%rax,%rax,1)
movsd  (%r15,%rbx,8),%xmm0
cmp    %rbx,%r12
mov    %rbp,%rsi
lea    0xe93(%rip),%rax
cmove  %rax,%rsi
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1160 <vlprint+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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