#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*/ printf(char *, int, ...);
int main(int argc, char *argv[]) {
  int count = argc;
  count = atoi(argv[2]);
  printf("Repeating %d times..\n", count);
  for (int i = 0; i < count; ++i)
    printf("%3d - %s\n", i, argv[1]);
  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)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1197 <main+0x77>
mov    -0x18(%rbp),%esi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1164 <main+0x44>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r15
mov    0x10(%rsi),%rdi
call   1040 <atoi@plt>
mov    %eax,%ebp
lea    0xec4(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
test   %ebp,%ebp
jle    1177 <main+0x57>
lea    0xec6(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x8(%r15),%rdx
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    %ebx,%ebp
jne    1160 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Repeating %d times..\0A\00"
@.str.1 = [10 x i8] c"%3d - %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
store i32 %8, i32* %6
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 2
%11 = load i8*, i8** %10
%12 = call i32 @atoi(i8* %11)
store i32 %12, i32* %6
%13 = load i32, i32* %6
%14 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %13)
store i32 0, i32* %7
br label %15
15: ; preds = %25, %2
%16 = load i32, i32* %7
%17 = load i32, i32* %6
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %28
19: ; preds = %15
%20 = load i32, i32* %7
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %20, i8* %23)
br label %25
25: ; preds = %19
%26 = load i32, i32* %7
%27 = add nsw i32 %26, 1
store i32 %27, i32* %7
br label %15
28: ; preds = %15
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"Repeating %d times..\0A\00"
@.str.1 = [10 x i8] c"%3d - %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 2
%4 = load i8*, i8** %3
%5 = tail call i32 @atoi(i8* %4)
%6 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = icmp sgt i32 %5, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
br label %11
10: ; preds = %11, %2
ret i32 0
11: ; preds = %8, %11
%12 = phi i32 [ 0, %8 ], [ %15, %11 ]
%13 = load i8*, i8** %9
%14 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %12, i8* %13)
%15 = add nuw nsw i32 %12, 1
%16 = icmp eq i32 %15, %5
br i1 %16, label %10, label %11
}