#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 *, unsigned long);
int /*<<< orphan*/ sleep(unsigned long);
unsigned long strtoll(char *, int /*<<< orphan*/ *, int /*<<< orphan*/);
int main(int argc, char **argv) {
  unsigned long i, max, sleep_time;
  if (argc > 1) {
    max = strtoll(argv[1], NULL, 0);
  } else {
    max = 1;
  }
  if (argc > 2) {
    sleep_time = strtoll(argv[2], NULL, 0);
  } else {
    sleep_time = 2;
  }
  i = 0;
  while (i < max) {
    printf("%lu\n", i);
    i++;
    sleep(sleep_time);
  }
}


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   $0x1,-0x8(%rbp)
jle    116c <main+0x3c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1040 <strtoll@plt>
mov    %rax,-0x20(%rbp)
jmp    1174 <main+0x44>
movq   $0x1,-0x20(%rbp)
cmpl   $0x2,-0x8(%rbp)
jle    119a <main+0x6a>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1040 <strtoll@plt>
mov    %rax,-0x28(%rbp)
jmp    11a2 <main+0x72>
movq   $0x2,-0x28(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    11e2 <main+0xb2>
mov    -0x18(%rbp),%rsi
lea    0xe3d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x28(%rbp),%rdi
call   1050 <sleep@plt>
jmp    11aa <main+0x7a>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jl     1174 <main+0x44>
mov    %rsi,%r15
mov    %edi,%ebx
mov    0x8(%rsi),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1040 <strtoll@plt>
mov    %rax,%r14
mov    $0x2,%r12d
cmp    $0x2,%ebx
je     116d <main+0x3d>
mov    0x10(%r15),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1040 <strtoll@plt>
mov    %rax,%r12
test   %r14,%r14
jne    1180 <main+0x50>
jmp    11ac <main+0x7c>
mov    $0x1,%r14d
mov    $0x2,%r12d
xor    %ebx,%ebx
lea    0xe77(%rip),%r15
nopl   0x0(%rax)
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
add    $0x1,%rbx
mov    %r12,%rdi
call   1050 <sleep@plt>
cmp    %rbx,%r14
jne    1190 <main+0x60>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%lu\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp sgt i32 %9, 1
br i1 %10, label %11, 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 i64 @strtoll(i8* %14, i32* null, i32 0)
store i64 %15, i64* %7
br label %17
16: ; preds = %2
store i64 1, i64* %7
br label %17
17: ; preds = %16, %11
%18 = load i32, i32* %4
%19 = icmp sgt i32 %18, 2
br i1 %19, label %20, label %25
20: ; preds = %17
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 2
%23 = load i8*, i8** %22
%24 = call i64 @strtoll(i8* %23, i32* null, i32 0)
store i64 %24, i64* %8
br label %26
25: ; preds = %17
store i64 2, i64* %8
br label %26
26: ; preds = %25, %20
store i64 0, i64* %6
br label %27
27: ; preds = %31, %26
%28 = load i64, i64* %6
%29 = load i64, i64* %7
%30 = icmp ult i64 %28, %29
br i1 %30, label %31, label %38
31: ; preds = %27
%32 = load i64, i64* %6
%33 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %32)
%34 = load i64, i64* %6
%35 = add i64 %34, 1
store i64 %35, i64* %6
%36 = load i64, i64* %8
%37 = call i32 @sleep(i64 %36)
br label %27
38: ; preds = %27
%39 = load i32, i32* %3
ret i32 %39
}

LLVM IR (-O2):
@.str = [5 x i8] c"%lu\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %16
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i64 @strtoll(i8* nocapture %6, i32* null, i32 0)
%8 = icmp eq i32 %0, 2
br i1 %8, label %13, label %9
9: ; preds = %4
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = tail call i64 @strtoll(i8* nocapture %11, i32* null, i32 0)
br label %13
13: ; preds = %4, %9
%14 = phi i64 [ %12, %9 ], [ 2, %4 ]
%15 = icmp eq i64 %7, 0
br i1 %15, label %25, label %16
16: ; preds = %2, %13
%17 = phi i64 [ %14, %13 ], [ 2, %2 ]
%18 = phi i64 [ %7, %13 ], [ 1, %2 ]
br label %19
19: ; preds = %16, %19
%20 = phi i64 [ %22, %19 ], [ 0, %16 ]
%21 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %20)
%22 = add nuw i64 %20, 1
%23 = tail call i32 @sleep(i64 %17)
%24 = icmp eq i64 %22, %18
br i1 %24, label %25, label %19
25: ; preds = %19, %13
ret i32 0
}