#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*/ EXIT_FAILURE;
int EXIT_SUCCESS;
int atoi(char *);
scalar_t__ calloc(int, int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ free(int *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  if (argc != 3) {
    printf("USAGE: %s [taille] [valeur]\n", argv[0]);
    exit(EXIT_FAILURE);
  }
  int taille = atoi(argv[1]);
  int valeur = atoi(argv[2]);
  int *tabInt = (int *)calloc(taille, sizeof(int));
  int i;
  for (i = 0; i < taille; i++) {
    tabInt[i] = valeur;
    printf("tabInt[%i]=%i\n", i, tabInt[i]);
  }
  free(tabInt);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1193 <main+0x43>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2e54(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
mov    $0x4,%esi
call   1050 <calloc@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    120f <main+0xbf>
mov    -0x18(%rbp),%edx
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x24(%rbp),%esi
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xe23(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11cb <main+0x7b>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    0x2db9(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%rbx
cmp    $0x3,%edi
jne    11d5 <main+0x85>
mov    0x8(%rbx),%rdi
call   1060 <atoi@plt>
mov    %eax,%ebp
mov    0x10(%rbx),%rdi
call   1060 <atoi@plt>
mov    %eax,%ebx
mov    %ebp,%edi
mov    $0x4,%esi
call   1050 <calloc@plt>
mov    %rax,%r14
test   %ebp,%ebp
jle    11bb <main+0x6b>
mov    %ebp,%r12d
lea    0xe8a(%rip),%r15
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebx,(%r14,%rbp,4)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r12
jne    11a0 <main+0x50>
mov    %r14,%rdi
call   1030 <free@plt>
mov    0x2e0e(%rip),%rax
mov    (%rax),%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    (%rbx),%rsi
lea    0xe21(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2df3(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"USAGE: %s [taille] [valeur]\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [15 x i8] c"tabInt[%i]=%i\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 3
br i1 %11, label %12, label %19
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = load i32, i32* @EXIT_FAILURE
%18 = call i32 @exit(i32 %17)
unreachable
19: ; preds = %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i32 @atoi(i8* %22)
store i32 %23, i32* %6
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 2
%26 = load i8*, i8** %25
%27 = call i32 @atoi(i8* %26)
store i32 %27, i32* %7
%28 = load i32, i32* %6
%29 = call i64 @calloc(i32 %28, i32 4)
%30 = inttoptr i64 %29 to i32*
store i32* %30, i32** %8
store i32 0, i32* %9
br label %31
31: ; preds = %48, %19
%32 = load i32, i32* %9
%33 = load i32, i32* %6
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %51
35: ; preds = %31
%36 = load i32, i32* %7
%37 = load i32*, i32** %8
%38 = load i32, i32* %9
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i32, i32* %37, i64 %39
store i32 %36, i32* %40
%41 = load i32, i32* %9
%42 = load i32*, i32** %8
%43 = load i32, i32* %9
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i32, i32* %42, i64 %44
%46 = load i32, i32* %45
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %41, i32 %46)
br label %48
48: ; preds = %35
%49 = load i32, i32* %9
%50 = add nsw i32 %49, 1
store i32 %50, i32* %9
br label %31
51: ; preds = %31
%52 = load i32*, i32** %8
%53 = call i32 @free(i32* %52)
%54 = load i32, i32* @EXIT_SUCCESS
ret i32 %54
}

LLVM IR (-O2):
@.str = [29 x i8] c"USAGE: %s [taille] [valeur]\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [15 x i8] c"tabInt[%i]=%i\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 @atoi(i8* %11)
%13 = getelementptr inbounds i8*, i8** %1, i64 2
%14 = load i8*, i8** %13
%15 = tail call i32 @atoi(i8* %14)
%16 = tail call i64 @calloc(i32 %12, i32 4)
%17 = inttoptr i64 %16 to i32*
%18 = icmp sgt i32 %12, 0
br i1 %18, label %19, label %28
19: ; preds = %9
%20 = zext i32 %12 to i64
br label %21
21: ; preds = %19, %21
%22 = phi i64 [ 0, %19 ], [ %26, %21 ]
%23 = getelementptr inbounds i32, i32* %17, i64 %22
store i32 %15, i32* %23
%24 = trunc i64 %22 to i32
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %24, i32 %15)
%26 = add nuw nsw i64 %22, 1
%27 = icmp eq i64 %26, %20
br i1 %27, label %28, label %21
28: ; preds = %21, %9
%29 = tail call i32 @free(i32* %17)
%30 = load i32, i32* @EXIT_SUCCESS
ret i32 %30
}