#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*/ fprintf(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  fprintf(stdout,
          "There are %d arguments given, excluding the intial shell arg "
          "%s\nArgs:\n",
          argc, argv[0]);
  for (int i = 0; i < argc; i++) {
    fprintf(stdout, "Argument %d: \"%s\"\n", i, argv[i]);
  }
}


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    0x2eb3(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    118a <main+0x7a>
mov    0x2e81(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114c <main+0x3c>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebx
mov    0x2ebb(%rip),%r12
mov    (%r12),%edi
mov    (%rsi),%rcx
lea    0xecd(%rip),%rsi
mov    %ebx,%edx
call   1030 <fprintf@plt>
test   %ebx,%ebx
jle    116b <main+0x5b>
mov    %ebx,%r13d
xor    %ebx,%ebx
lea    0xefd(%rip),%r15
nopw   0x0(%rax,%rax,1)
mov    (%r12),%edi
mov    (%r14,%rbx,8),%rcx
mov    %r15,%rsi
mov    %ebx,%edx
call   1030 <fprintf@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1150 <main+0x40>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [71 x i8] c"There are %d arguments given, excluding the intial shell arg %s\0AArgs:\0A\00"
@.str.1 = [19 x i8] c"Argument %d: \22%s\22\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* @stdout
%8 = load i32, i32* %4
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0), i32 %8, i8* %11)
store i32 0, i32* %6
br label %13
13: ; preds = %26, %2
%14 = load i32, i32* %6
%15 = load i32, i32* %4
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %29
17: ; preds = %13
%18 = load i32, i32* @stdout
%19 = load i32, i32* %6
%20 = load i8**, i8*** %5
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8*, i8** %20, i64 %22
%24 = load i8*, i8** %23
%25 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %19, i8* %24)
br label %26
26: ; preds = %17
%27 = load i32, i32* %6
%28 = add nsw i32 %27, 1
store i32 %28, i32* %6
br label %13
29: ; preds = %13
%30 = load i32, i32* %3
ret i32 %30
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [71 x i8] c"There are %d arguments given, excluding the intial shell arg %s\0AArgs:\0A\00"
@.str.1 = [19 x i8] c"Argument %d: \22%s\22\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i32, i32* @stdout
%4 = load i8*, i8** %1
%5 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0), i32 %0, i8* %4)
%6 = icmp sgt i32 %0, 0
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = zext i32 %0 to i64
br label %10
9: ; preds = %10, %2
ret i32 0
10: ; preds = %7, %10
%11 = phi i64 [ 0, %7 ], [ %17, %10 ]
%12 = load i32, i32* @stdout
%13 = getelementptr inbounds i8*, i8** %1, i64 %11
%14 = load i8*, i8** %13
%15 = trunc i64 %11 to i32
%16 = tail call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %15, i8* %14)
%17 = add nuw nsw i64 %11, 1
%18 = icmp eq i64 %17, %8
br i1 %18, label %9, label %10
}