#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*/ execlp(char *, char *, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ sscanf(char *, char *, int *);
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  char compteur[2];
  int i;
  i = 0;
  if (argc == 2)
    sscanf(argv[1], "%d", &i);
  if (i < 5) {
    i++;
    sprintf(compteur, "%d", i);
    fprintf(stdout, "execlp (%s, %s, %s, NULL)\n", argv[0], argv[0], compteur);
    execlp(argv[0], argv[0], compteur, NULL);
  }
  return (0);
}


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)
movl   $0x0,-0x18(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    117f <main+0x3f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe8a(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1040 <sscanf@plt>
cmpl   $0x5,-0x18(%rbp)
jge    11e7 <main+0xa7>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
lea    -0x12(%rbp),%rdi
mov    -0x18(%rbp),%edx
lea    0xe60(%rip),%rsi
call   1050 <sprintf@plt>
mov    0x2e34(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
lea    -0x12(%rbp),%r8
lea    0xe3c(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    -0x12(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%ecx
call   1060 <execlp@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
movl   $0x0,(%rsp)
xor    %edx,%edx
cmp    $0x2,%edi
jne    1170 <main+0x30>
mov    0x8(%rbx),%rdi
lea    0xea0(%rip),%rsi
mov    %rsp,%rdx
call   1040 <sscanf@plt>
mov    (%rsp),%edx
cmp    $0x4,%edx
jg     11b8 <main+0x78>
add    $0x1,%edx
mov    %edx,(%rsp)
lea    0xe83(%rip),%rsi
lea    0x6(%rsp),%r14
mov    %r14,%rdi
call   1050 <sprintf@plt>
mov    0x2e4f(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rcx
lea    0xe66(%rip),%rsi
mov    %rcx,%rdx
mov    %r14,%r8
call   1030 <fprintf@plt>
mov    (%rbx),%rdi
mov    %rdi,%rsi
mov    %r14,%rdx
xor    %ecx,%ecx
call   1060 <execlp@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@stdout = global i32 0
@.str.1 = [27 x i8] c"execlp (%s, %s, %s, NULL)\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [2 x i8]
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 2
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @sscanf(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
br label %15
15: ; preds = %10, %2
%16 = load i32, i32* %7
%17 = icmp slt i32 %16, 5
br i1 %17, label %18, label %41
18: ; preds = %15
%19 = load i32, i32* %7
%20 = add nsw i32 %19, 1
store i32 %20, i32* %7
%21 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 0
%22 = load i32, i32* %7
%23 = call i32 @sprintf(i8* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %22)
%24 = load i32, i32* @stdout
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 0
%27 = load i8*, i8** %26
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 0
%30 = load i8*, i8** %29
%31 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 0
%32 = call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %27, i8* %30, i8* %31)
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 0
%35 = load i8*, i8** %34
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 0
%38 = load i8*, i8** %37
%39 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 0
%40 = call i32 @execlp(i8* %35, i8* %38, i8* %39, i32* null)
br label %41
41: ; preds = %18, %15
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@stdout = global i32 0
@.str.1 = [27 x i8] c"execlp (%s, %s, %s, NULL)\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [2 x i8]
%4 = alloca i32
%5 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%6 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%7 = icmp eq i32 %0, 2
br i1 %7, label %8, label %14
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = call i32 @sscanf(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 5
br i1 %13, label %14, label %23
14: ; preds = %2, %8
%15 = phi i32 [ %12, %8 ], [ 0, %2 ]
%16 = add nsw i32 %15, 1
store i32 %16, i32* %4
%17 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = load i32, i32* @stdout
%19 = load i8*, i8** %1
%20 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %19, i8* %19, i8* %5)
%21 = load i8*, i8** %1
%22 = call i32 @execlp(i8* %21, i8* %21, i8* %5, i32* null)
br label %23
23: ; preds = %14, %8
ret i32 0
}