#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("argc=%d program name=[\"%s\"]\n", argc, argv[0]);
  printf("%d \n", argc == ((argv + argc) - argv));
  if (argc < 2) {
    printf("No command-line arguments specified\n");
  } else {
    printf("Command-line arguments are \n");
    char **args = argv + 1;
    while (args < (argv + argc)) {
      printf("    %lu %s\n", (args - argv), *args);
      args++;
    }
  }
  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),%esi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq -0x8(%rbp),%rdx
shl    $0x3,%rdx
add    %rdx,%rcx
mov    -0x10(%rbp),%rdx
sub    %rdx,%rcx
sar    $0x3,%rcx
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%esi
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x2,-0x8(%rbp)
jge    1192 <main+0x82>
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1202 <main+0xf2>
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq -0x8(%rbp),%rdx
shl    $0x3,%rdx
add    %rdx,%rcx
cmp    %rcx,%rax
jae    11fd <main+0xed>
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rax
sub    %rax,%rsi
sar    $0x3,%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%rdx
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x18(%rbp)
jmp    11ac <main+0x9c>
jmp    1202 <main+0xf2>
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,%rbx
mov    %edi,%ebp
mov    (%rsi),%rdx
lea    0xeca(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed7(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x1,%ebp
jg     1165 <main+0x45>
lea    0xeec(%rip),%rdi
call   1030 <puts@plt>
jmp    11b6 <main+0x96>
movslq %ebp,%rax
lea    (%rbx,%rax,8),%r15
lea    0xebb(%rip),%rdi
call   1030 <puts@plt>
mov    $0x8,%ebp
lea    0xe9e(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbp,%rsi
sar    $0x3,%rsi
mov    (%rbx,%rbp,1),%rdx
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    (%rbx,%rbp,1),%rax
add    $0x8,%rax
add    $0x8,%rbp
cmp    %r15,%rax
jb     1190 <main+0x70>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [29 x i8] c"argc=%d program name=[\22%s\22]\0A\00"
@.str.1 = [5 x i8] c"%d \0A\00"
@.str.2 = [37 x i8] c"No command-line arguments specified\0A\00"
@.str.3 = [29 x i8] c"Command-line arguments are \0A\00"
@.str.4 = [12 x i8] c" %lu %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 0
%10 = load i8*, i8** %9
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %7, i8* %10)
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = load i8**, i8*** %5
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8*, i8** %14, i64 %16
%18 = load i8**, i8*** %5
%19 = ptrtoint i8** %17 to i64
%20 = ptrtoint i8** %18 to i64
%21 = sub i64 %19, %20
%22 = sdiv exact i64 %21, 8
%23 = icmp eq i64 %13, %22
%24 = zext i1 %23 to i32
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = load i32, i32* %4
%27 = icmp slt i32 %26, 2
br i1 %27, label %28, label %30
28: ; preds = %2
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
br label %54
30: ; preds = %2
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 1
store i8** %33, i8*** %6
br label %34
34: ; preds = %41, %30
%35 = load i8**, i8*** %6
%36 = load i8**, i8*** %5
%37 = load i32, i32* %4
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8*, i8** %36, i64 %38
%40 = icmp ult i8** %35, %39
br i1 %40, label %41, label %53
41: ; preds = %34
%42 = load i8**, i8*** %6
%43 = load i8**, i8*** %5
%44 = ptrtoint i8** %42 to i64
%45 = ptrtoint i8** %43 to i64
%46 = sub i64 %44, %45
%47 = sdiv exact i64 %46, 8
%48 = load i8**, i8*** %6
%49 = load i8*, i8** %48
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i64 %47, i8* %49)
%51 = load i8**, i8*** %6
%52 = getelementptr inbounds i8*, i8** %51, i32 1
store i8** %52, i8*** %6
br label %34
53: ; preds = %34
br label %54
54: ; preds = %53, %28
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"argc=%d program name=[\22%s\22]\0A\00"
@.str.1 = [5 x i8] c"%d \0A\00"
@.str.4 = [12 x i8] c" %lu %s\0A\00"
@str = [28 x i8] c"Command-line arguments are \00"
@str.5 = [36 x i8] c"No command-line arguments specified\00"
define i32 @main(i32 %0, i8** %1) {
%3 = load i8*, i8** %1
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %0, i8* %3)
%5 = sext i32 %0 to i64
%6 = getelementptr inbounds i8*, i8** %1, i64 %5
%7 = ptrtoint i8** %1 to i64
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 1)
%9 = icmp slt i32 %0, 2
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.5, i64 0, i64 0))
br label %24
12: ; preds = %2
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%14 = getelementptr inbounds i8*, i8** %1, i64 1
br label %15
15: ; preds = %12, %15
%16 = phi i8** [ %22, %15 ], [ %14, %12 ]
%17 = ptrtoint i8** %16 to i64
%18 = sub i64 %17, %7
%19 = ashr exact i64 %18, 3
%20 = load i8*, i8** %16
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i64 %19, i8* %20)
%22 = getelementptr inbounds i8*, i8** %16, i64 1
%23 = icmp ult i8** %22, %6
br i1 %23, label %15, label %24
24: ; preds = %15, %10
ret i32 0
}