#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 *, ...);
int main(int argc, char *argv[]) {
  printf("The name of this program is `%s'.\n", argv[0]);
  printf("This program was invoked with %d arguments.\n", argc - 1);
  if (argc > 1) {
    int i;
    printf("The arguments are:\n");
    for (i = 1; i < argc; ++i)
      printf("  %s\n", argv[i]);
  }
  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    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
sub    $0x1,%esi
lea    0xedb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x1,-0x8(%rbp)
jle    11a7 <main+0x97>
lea    0xef0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11a2 <main+0x92>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xed7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    116e <main+0x5e>
jmp    11a7 <main+0x97>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %edi,%r14d
mov    (%rsi),%rsi
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    -0x1(%r14),%esi
lea    0xed9(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x2,%r14d
jl     1197 <main+0x77>
lea    0xef8(%rip),%rdi
call   1030 <puts@plt>
mov    %r14d,%r12d
mov    $0x1,%ebx
lea    0xede(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r15,%rbx,8),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1180 <main+0x60>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [35 x i8] c"The name of this program is `%s'.\0A\00"
@.str.1 = [45 x i8] c"This program was invoked with %d arguments.\0A\00"
@.str.2 = [20 x i8] c"The arguments are:\0A\00"
@.str.3 = [6 x i8] c" %s\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 i8**, i8*** %5
%8 = getelementptr inbounds i8*, i8** %7, i64 0
%9 = load i8*, i8** %8
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = load i32, i32* %4
%12 = sub nsw i32 %11, 1
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = load i32, i32* %4
%15 = icmp sgt i32 %14, 1
br i1 %15, label %16, label %33
16: ; preds = %2
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %6
br label %18
18: ; preds = %29, %16
%19 = load i32, i32* %6
%20 = load i32, i32* %4
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %32
22: ; preds = %18
%23 = load i8**, i8*** %5
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8*, i8** %23, i64 %25
%27 = load i8*, i8** %26
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %27)
br label %29
29: ; preds = %22
%30 = load i32, i32* %6
%31 = add nsw i32 %30, 1
store i32 %31, i32* %6
br label %18
32: ; preds = %18
br label %33
33: ; preds = %32, %2
ret i32 0
}

LLVM IR (-O2):
@.str = [35 x i8] c"The name of this program is `%s'.\0A\00"
@.str.1 = [45 x i8] c"This program was invoked with %d arguments.\0A\00"
@.str.3 = [6 x i8] c" %s\0A\00"
@str = [19 x i8] c"The arguments are:\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = add nsw i32 %0, -1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = icmp sgt i32 %0, 1
br i1 %7, label %8, label %18
8: ; preds = %2
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%10 = zext i32 %0 to i64
br label %11
11: ; preds = %8, %11
%12 = phi i64 [ 1, %8 ], [ %16, %11 ]
%13 = getelementptr inbounds i8*, i8** %1, i64 %12
%14 = load i8*, i8** %13
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %14)
%16 = add nuw nsw i64 %12, 1
%17 = icmp eq i64 %16, %10
br i1 %17, label %18, label %11
18: ; preds = %11, %2
ret i32 0
}