#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 const *argv[], char *envp[]) {
  printf("####  ARGC   ####\n%d\n", argc);
  printf("####  ARGV   ####\n");
  while (*argv)
    printf("%s\n", *(argv++));
  while (*envp)
    printf("%s\n", *(envp++));
  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    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%esi
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     117c <main+0x6c>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%rsi
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1149 <main+0x39>
jmp    1181 <main+0x71>
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
je     11b4 <main+0xa4>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x18(%rbp)
mov    (%rax),%rsi
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1181 <main+0x71>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %edi,%esi
lea    0xecd(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
mov    (%rbx),%rdi
test   %rdi,%rdi
je     1171 <main+0x51>
add    $0x8,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
call   1030 <puts@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1160 <main+0x40>
mov    (%r14),%rdi
test   %rdi,%rdi
je     1191 <main+0x71>
add    $0x8,%r14
nopl   (%rax)
call   1030 <puts@plt>
mov    (%r14),%rdi
add    $0x8,%r14
test   %rdi,%rdi
jne    1180 <main+0x60>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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