#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 atoi(char *);
int /*<<< orphan*/ execlp(char *, char *, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  int i = argc < 2 ? 1 : atoi(argv[1]);
  printf("%d\n", i);
  fflush(stdout);
  char buf[32];
  sprintf(buf, "%d", ++i);
  if (i <= 100)
    execlp(argv[0], argv[0], buf, NULL);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    117d <main+0x2d>
mov    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    118d <main+0x3d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe63(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e37(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
lea    -0x40(%rbp),%rdi
mov    -0x14(%rbp),%edx
add    $0x1,%edx
mov    %edx,-0x14(%rbp)
lea    0xe40(%rip),%rsi
call   1060 <sprintf@plt>
cmpl   $0x64,-0x14(%rbp)
jg     11ee <main+0x9e>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    -0x40(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%ecx
call   1070 <execlp@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r14
mov    $0x1,%ebx
cmp    $0x2,%edi
jl     116f <main+0x1f>
mov    0x8(%r14),%rdi
call   1050 <atoi@plt>
mov    %eax,%ebx
lea    0xe8a(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    0x2e5c(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
lea    0x1(%rbx),%edx
lea    0xe6f(%rip),%rsi
mov    %rsp,%rdi
call   1060 <sprintf@plt>
cmp    $0x63,%ebx
jg     11b2 <main+0x62>
mov    (%r14),%rdi
mov    %rsp,%rdx
mov    %rdi,%rsi
xor    %ecx,%ecx
call   1070 <execlp@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

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

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