#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 tab_print(int *tab) {
  int res, i;
  printf("tab[0..%d]= {", 100);
  for (i = 0; i < 100; i++) {
    printf("%d,", tab[i]);
  }
  printf("}\n");
}


x86 assembly (clang, -O0):
<tab_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x64,%esi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0x64,-0x10(%rbp)
jge    1167 <tab_print+0x57>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1136 <tab_print+0x26>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tab_print>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
lea    0xed1(%rip),%rdi
mov    $0x64,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xecc(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    $0x64,%rbx
jne    1150 <tab_print+0x30>
lea    0xea3(%rip),%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"tab[0..%d]= {\00"
@.str.1 = [4 x i8] c"%d,\00"
@.str.2 = [3 x i8] c"}\0A\00"
define void @tab_print(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32* %0, i32** %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 100)
store i32 0, i32* %4
br label %6
6: ; preds = %16, %1
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 100
br i1 %8, label %9, label %19
9: ; preds = %6
%10 = load i32*, i32** %2
%11 = load i32, i32* %4
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i32, i32* %10, i64 %12
%14 = load i32, i32* %13
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %14)
br label %16
16: ; preds = %9
%17 = load i32, i32* %4
%18 = add nsw i32 %17, 1
store i32 %18, i32* %4
br label %6
19: ; preds = %6
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"tab[0..%d]= {\00"
@.str.1 = [4 x i8] c"%d,\00"
@str = [2 x i8] c"}\00"
define void @tab_print(i32* nocapture %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 100)
br label %3
3: ; preds = %1, %3
%4 = phi i64 [ 0, %1 ], [ %8, %3 ]
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = add nuw nsw i64 %4, 1
%9 = icmp eq i64 %8, 100
br i1 %9, label %10, label %3
10: ; preds = %3
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret void
}