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


x86 assembly (clang, -O0):
<print_int_vector>:
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>
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    118b <print_int_vector+0x7b>
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    0xea9(%rip),%rdx
lea    0xe9f(%rip),%rax
cmp    %rdi,%rcx
cmovne %rax,%rdx
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1135 <print_int_vector+0x25>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_int_vector>:
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     1188 <print_int_vector+0x68>
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 <print_int_vector+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 = [5 x i8] c"%i%s\00"
@.str.2 = [3 x i8] c", \00"
@.str.3 = [2 x i8] c"]\00"
define void @print_int_vector(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))
store i32 0, i32* %5
br label %7
7: ; preds = %26, %2
%8 = load i32, i32* %5
%9 = sext i32 %8 to i64
%10 = load i64, i64* %4
%11 = icmp ult i64 %9, %10
br i1 %11, label %12, label %29
12: ; preds = %7
%13 = load i32*, i32** %3
%14 = load i32, i32* %5
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %13, i64 %15
%17 = load i32, i32* %16
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = load i64, i64* %4
%21 = sub i64 %20, 1
%22 = icmp ne i64 %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 ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %17, i8* %24)
br label %26
26: ; preds = %12
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
store i32 %28, i32* %5
br label %7
29: ; preds = %7
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 @print_int_vector(i32* nocapture %0, i64 %1) {
%3 = tail call i32 @putchar(i32 91)
%4 = icmp eq i64 %1, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = add i64 %1, -1
br label %8
7: ; preds = %8, %2
ret void
8: ; preds = %5, %8
%9 = phi i64 [ 0, %5 ], [ %15, %8 ]
%10 = getelementptr inbounds i32, i32* %0, i64 %9
%11 = load i32, i32* %10
%12 = icmp eq i64 %6, %9
%13 = select i1 %12, 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)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %11, i8* %13)
%15 = add nuw i64 %9, 1
%16 = icmp eq i64 %15, %1
br i1 %16, label %7, label %8
}