#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*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void pn_environ_print(char **environ) {
  if (environ) {
    char **env;
    for (env = environ; *env; ++env) {
      fprintf(stderr, "  %s\n", *env);
    }
  }
}


x86 assembly (clang, -O0):
<pn_environ_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     116f <pn_environ_print+0x5f>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     116a <pn_environ_print+0x5a>
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xeac(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    112f <pn_environ_print+0x1f>
jmp    116f <pn_environ_print+0x5f>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pn_environ_print>:
push   %r15
push   %r14
push   %rbx
test   %rdi,%rdi
je     1157 <pn_environ_print+0x47>
mov    %rdi,%rbx
mov    (%rdi),%rdx
test   %rdx,%rdx
je     1157 <pn_environ_print+0x47>
add    $0x8,%rbx
mov    0x2eb0(%rip),%r15
lea    0xec9(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    (%r15),%edi
mov    %r14,%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%rdx
add    $0x8,%rbx
test   %rdx,%rdx
jne    1140 <pn_environ_print+0x30>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [6 x i8] c" %s\0A\00"
define void @pn_environ_print(i8** %0) {
%2 = alloca i8**
%3 = alloca i8**
store i8** %0, i8*** %2
%4 = load i8**, i8*** %2
%5 = icmp ne i8** %4, null
br i1 %5, label %6, label %21
6: ; preds = %1
%7 = load i8**, i8*** %2
store i8** %7, i8*** %3
br label %8
8: ; preds = %17, %6
%9 = load i8**, i8*** %3
%10 = load i8*, i8** %9
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %20
12: ; preds = %8
%13 = load i32, i32* @stderr
%14 = load i8**, i8*** %3
%15 = load i8*, i8** %14
%16 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %15)
br label %17
17: ; preds = %12
%18 = load i8**, i8*** %3
%19 = getelementptr inbounds i8*, i8** %18, i32 1
store i8** %19, i8*** %3
br label %8
20: ; preds = %8
br label %21
21: ; preds = %20, %1
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [6 x i8] c" %s\0A\00"
define void @pn_environ_print(i8** %0) {
%2 = icmp eq i8** %0, null
br i1 %2, label %14, label %3
3: ; preds = %1
%4 = load i8*, i8** %0
%5 = icmp eq i8* %4, null
br i1 %5, label %14, label %6
6: ; preds = %3, %6
%7 = phi i8* [ %12, %6 ], [ %4, %3 ]
%8 = phi i8** [ %11, %6 ], [ %0, %3 ]
%9 = load i32, i32* @stderr
%10 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %7)
%11 = getelementptr inbounds i8*, i8** %8, i64 1
%12 = load i8*, i8** %11
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %6
14: ; preds = %6, %3, %1
ret void
}