#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 vprintl(int *v, const size_t size) {
  printf("[");
  if (size != 0) {
    for (int i = 0; i < size; i++)
      printf("%i%s", v[i], (i != size - 1) ? ", " : "]");
  } else {
    printf("]");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<vprintl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpq   $0x0,-0x10(%rbp)
je     119b <vprintl+0x8b>
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1196 <vprintl+0x86>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
movslq -0x14(%rbp),%rcx
mov    -0x10(%rbp),%rdi
sub    $0x1,%rdi
lea    0xe9e(%rip),%rdx
lea    0xe94(%rip),%rax
cmp    %rdi,%rcx
cmovne %rax,%rdx
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1140 <vprintl+0x30>
jmp    11a9 <vprintl+0x99>
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vprintl>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r12
mov    %rdi,%r14
mov    $0x5b,%edi
call   1030 <putchar@plt>
test   %r12,%r12
je     118a <vprintl+0x6a>
lea    -0x1(%r12),%rbx
lea    0xeb9(%rip),%rbp
lea    0xead(%rip),%r15
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
mov    (%r14,%r13,4),%esi
cmp    %r13,%rbx
mov    %rbp,%rdx
lea    0xe97(%rip),%rax
cmove  %rax,%rdx
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r13
cmp    %r13,%r12
jne    1160 <vprintl+0x40>
jmp    1194 <vprintl+0x74>
mov    $0x5d,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"[\00"
@.str.1 = [5 x i8] c"%i%s\00"
@.str.2 = [3 x i8] c", \00"
@.str.3 = [2 x i8] c"]\00"
@.str.4 = [2 x i8] c"\0A\00"
define void @vprintl(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
%5 = alloca i32
store i32* %0, i32** %3
store i64 %1, i64* %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = load i64, i64* %4
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %33
9: ; preds = %2
store i32 0, i32* %5
br label %10
10: ; preds = %29, %9
%11 = load i32, i32* %5
%12 = sext i32 %11 to i64
%13 = load i64, i64* %4
%14 = icmp ult i64 %12, %13
br i1 %14, label %15, label %32
15: ; preds = %10
%16 = load i32*, i32** %3
%17 = load i32, i32* %5
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %16, i64 %18
%20 = load i32, i32* %19
%21 = load i32, i32* %5
%22 = sext i32 %21 to i64
%23 = load i64, i64* %4
%24 = sub i64 %23, 1
%25 = icmp ne i64 %22, %24
%26 = zext i1 %25 to i64
%27 = select i1 %25, 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)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %20, i8* %27)
br label %29
29: ; preds = %15
%30 = load i32, i32* %5
%31 = add nsw i32 %30, 1
store i32 %31, i32* %5
br label %10
32: ; preds = %10
br label %35
33: ; preds = %2
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %35
35: ; preds = %33, %32
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
ret void
}

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