#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_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[], char *env[]) {
  printf("Argv :\nNombre de parametres : %d\n", argc);
  for (int i = 0; i < argc; i++)
    printf("Param %d : %s\n", i, argv[i]);
  printf("\nEnv :\n");
  int i = 0;
  while (env[i] != NULL) {
    printf("Param %d : %s\n", i, env[i]);
    i++;
  }
  printf("Nombre de parametres : %d\n", i);
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1189 <main+0x69>
mov    -0x1c(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1152 <main+0x32>
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     11dc <main+0xbc>
mov    -0x20(%rbp),%esi
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    119e <main+0x7e>
mov    -0x20(%rbp),%esi
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2dec(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %edi,%ebx
lea    0xeb6(%rip),%rdi
xor    %r13d,%r13d
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebx,%ebx
jle    1189 <main+0x59>
mov    %ebx,%ebp
lea    0xebf(%rip),%r12
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r15,%rbx,8),%rdx
mov    %r12,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1170 <main+0x40>
lea    0xea1(%rip),%rdi
call   1030 <puts@plt>
mov    (%r14),%rdx
test   %rdx,%rdx
je     11cb <main+0x9b>
lea    0xe7e(%rip),%r15
xor    %r13d,%r13d
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%r14,%r13,8),%rdx
add    $0x1,%r13
test   %rdx,%rdx
jne    11b0 <main+0x80>
lea    0xe35(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2dfd(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

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

LLVM IR (-O2):
@.str = [34 x i8] c"Argv :\0ANombre de parametres : %d\0A\00"
@.str.1 = [15 x i8] c"Param %d : %s\0A\00"
@.str.3 = [27 x i8] c"Nombre de parametres : %d\0A\00"
@EXIT_SUCCESS = global i32 0
@str = [7 x i8] c"\0AEnv :\00"
define i32 @main(i32 %0, i8** nocapture %1, i8** nocapture %2) {
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %0)
%5 = icmp sgt i32 %0, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = zext i32 %0 to i64
br label %12
8: ; preds = %12, %3
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%10 = load i8*, i8** %2
%11 = icmp eq i8* %10, null
br i1 %11, label %31, label %20
12: ; preds = %6, %12
%13 = phi i64 [ 0, %6 ], [ %18, %12 ]
%14 = getelementptr inbounds i8*, i8** %1, i64 %13
%15 = load i8*, i8** %14
%16 = trunc i64 %13 to i32
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %16, i8* %15)
%18 = add nuw nsw i64 %13, 1
%19 = icmp eq i64 %18, %7
br i1 %19, label %8, label %12
20: ; preds = %8, %20
%21 = phi i64 [ %25, %20 ], [ 0, %8 ]
%22 = phi i8* [ %27, %20 ], [ %10, %8 ]
%23 = trunc i64 %21 to i32
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %23, i8* %22)
%25 = add nuw i64 %21, 1
%26 = getelementptr inbounds i8*, i8** %2, i64 %25
%27 = load i8*, i8** %26
%28 = icmp eq i8* %27, null
br i1 %28, label %29, label %20
29: ; preds = %20
%30 = trunc i64 %25 to i32
br label %31
31: ; preds = %29, %8
%32 = phi i32 [ 0, %8 ], [ %30, %29 ]
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 %32)
%34 = load i32, i32* @EXIT_SUCCESS
%35 = tail call i32 @exit(i32 %34)
unreachable
}