#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*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char *argv[], char *envp[]) {
  for (char **p = argv; *p != NULL; ++p)
    printf("arg: %s\n", *p);
  for (char **p = envp; *p != NULL; ++p)
    printf("env: %s\n", *p);
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmpq   $0x0,(%rax)
je     1174 <main+0x54>
mov    -0x20(%rbp),%rax
mov    (%rax),%rsi
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x20(%rbp)
jmp    1142 <main+0x22>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmpq   $0x0,(%rax)
je     11ae <main+0x8e>
mov    -0x28(%rbp),%rax
mov    (%rax),%rsi
lea    0xe71(%rip),%rdi
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x28(%rbp)
jmp    117c <main+0x5c>
mov    0x2e2b(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    (%rsi),%rsi
test   %rsi,%rsi
je     1154 <main+0x34>
add    $0x8,%rbx
lea    0xec2(%rip),%r15
xchg   %ax,%ax
mov    %r15,%rdi
call   1030 <printf@plt>
mov    (%rbx),%rsi
add    $0x8,%rbx
test   %rsi,%rsi
jne    1140 <main+0x20>
mov    (%r14),%rsi
test   %rsi,%rsi
je     1184 <main+0x64>
add    $0x8,%r14
lea    0xea2(%rip),%rbx
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    (%r14),%rsi
add    $0x8,%r14
test   %rsi,%rsi
jne    1170 <main+0x50>
mov    0x2e55(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

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

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