#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[], char *envp[]) {
  printf("\n### ARGC ###\n%d\n", argc);
  printf("\n### ARGV ###\n");
  while (*argv)
    printf("%s\n", *(argv++));
  printf("\n### ENVP ###\n");
  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    0xed0(%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    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1149 <main+0x39>
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
je     11bd <main+0xad>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x18(%rbp)
mov    (%rax),%rsi
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    118a <main+0x7a>
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    0xed1(%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>
lea    0xea8(%rip),%rdi
call   1030 <puts@plt>
mov    (%r14),%rdi
test   %rdi,%rdi
je     11a1 <main+0x81>
add    $0x8,%r14
nopl   0x0(%rax)
call   1030 <puts@plt>
mov    (%r14),%rdi
add    $0x8,%r14
test   %rdi,%rdi
jne    1190 <main+0x70>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [18 x i8] c"\0A### ARGC ###\0A%d\0A\00"
@.str.1 = [15 x i8] c"\0A### ARGV ###\0A\00"
@.str.2 = [4 x i8] c"%s\0A\00"
@.str.3 = [15 x i8] c"\0A### ENVP ###\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 ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 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
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %22
22: ; preds = %26, %20
%23 = load i8**, i8*** %7
%24 = load i8*, i8** %23
%25 = icmp ne i8* %24, null
br i1 %25, label %26, label %31
26: ; preds = %22
%27 = load i8**, i8*** %7
%28 = getelementptr inbounds i8*, i8** %27, i32 1
store i8** %28, i8*** %7
%29 = load i8*, i8** %27
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %29)
br label %22
31: ; preds = %22
ret i32 0
}

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