#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*/ _IO_puts(char *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
void print_arg_env(char **argv, char **envp) {
  _IO_puts("----------ARGS----------");
  while (*argv) {
    _IO_puts(*(argv++));
  }
  _IO_puts("----------ENV----------");
  while (*envp) {
    _IO_puts(*(envp++));
  }
  fflush(NULL);
  return;
}


x86 assembly (clang, -O0):
<print_arg_env>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec9(%rip),%rdi
call   1030 <_IO_puts@plt>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1166 <print_arg_env+0x46>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%rdi
call   1030 <_IO_puts@plt>
jmp    113c <print_arg_env+0x1c>
lea    0xeac(%rip),%rdi
call   1030 <_IO_puts@plt>
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     119c <print_arg_env+0x7c>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%rdi
call   1030 <_IO_puts@plt>
jmp    1172 <print_arg_env+0x52>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <fflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_arg_env>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xecf(%rip),%rdi
call   1030 <_IO_puts@plt>
mov    (%rbx),%rdi
test   %rdi,%rdi
je     1161 <print_arg_env+0x41>
add    $0x8,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
call   1030 <_IO_puts@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1150 <print_arg_env+0x30>
lea    0xeb1(%rip),%rdi
call   1030 <_IO_puts@plt>
mov    (%r14),%rdi
test   %rdi,%rdi
je     1191 <print_arg_env+0x71>
add    $0x8,%r14
nopl   0x0(%rax)
call   1030 <_IO_puts@plt>
mov    (%r14),%rdi
add    $0x8,%r14
test   %rdi,%rdi
jne    1180 <print_arg_env+0x60>
xor    %edi,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <fflush@plt>

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

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