#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 **environp) {
  int i;
  printf(" ** argv (one per line):\n");
  for (i = 0; i < argc; i++) {
    printf("%s\n", argv[i]);
  }
  printf(" ** environ (one per line):\n");
  for (i = 0; environp[i]; i++) {
    printf("%s\n", environp[i]);
  }
  printf(" ** done\n");
  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)
lea    0xecf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1173 <main+0x63>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113f <main+0x2f>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     11c3 <main+0xb3>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1188 <main+0x78>
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %edi,%ebp
lea    0xeda(%rip),%rdi
call   1030 <puts@plt>
test   %ebp,%ebp
jle    1152 <main+0x42>
mov    %ebp,%r15d
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%r14,%rbp,8),%rdi
call   1030 <puts@plt>
add    $0x1,%rbp
cmp    %rbp,%r15
jne    1140 <main+0x30>
lea    0xec0(%rip),%rdi
call   1030 <puts@plt>
mov    (%rbx),%rdi
test   %rdi,%rdi
je     1181 <main+0x71>
add    $0x8,%rbx
nopw   0x0(%rax,%rax,1)
call   1030 <puts@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1170 <main+0x60>
lea    0xead(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [26 x i8] c" ** argv (one per line):\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [29 x i8] c" ** environ (one per line):\0A\00"
@.str.3 = [10 x i8] c" ** done\0A\00"
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i32
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %8
br label %10
10: ; preds = %21, %3
%11 = load i32, i32* %8
%12 = load i32, i32* %5
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %24
14: ; preds = %10
%15 = load i8**, i8*** %6
%16 = load i32, i32* %8
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8*, i8** %15, i64 %17
%19 = load i8*, i8** %18
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %19)
br label %21
21: ; preds = %14
%22 = load i32, i32* %8
%23 = add nsw i32 %22, 1
store i32 %23, i32* %8
br label %10
24: ; preds = %10
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %8
br label %26
26: ; preds = %40, %24
%27 = load i8**, i8*** %7
%28 = load i32, i32* %8
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8*, i8** %27, i64 %29
%31 = load i8*, i8** %30
%32 = icmp ne i8* %31, null
br i1 %32, label %33, label %43
33: ; preds = %26
%34 = load i8**, i8*** %7
%35 = load i32, i32* %8
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8*, i8** %34, i64 %36
%38 = load i8*, i8** %37
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %38)
br label %40
40: ; preds = %33
%41 = load i32, i32* %8
%42 = add nsw i32 %41, 1
store i32 %42, i32* %8
br label %26
43: ; preds = %26
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [25 x i8] c" ** argv (one per line):\00"
@str.4 = [28 x i8] c" ** environ (one per line):\00"
@str.5 = [9 x i8] c" ** done\00"
define i32 @main(i32 %0, i8** nocapture %1, i8** nocapture %2) {
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%5 = icmp sgt i32 %0, 0
br i1 %5, label %6, label %15
6: ; preds = %3
%7 = zext i32 %0 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ 0, %6 ], [ %13, %8 ]
%10 = getelementptr inbounds i8*, i8** %1, i64 %9
%11 = load i8*, i8** %10
%12 = tail call i32 @puts(i8* dereferenceable(1) %11)
%13 = add nuw nsw i64 %9, 1
%14 = icmp eq i64 %13, %7
br i1 %14, label %15, label %8
15: ; preds = %8, %3
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.4, i64 0, i64 0))
%17 = load i8*, i8** %2
%18 = icmp eq i8* %17, null
br i1 %18, label %27, label %19
19: ; preds = %15, %19
%20 = phi i64 [ %23, %19 ], [ 0, %15 ]
%21 = phi i8* [ %25, %19 ], [ %17, %15 ]
%22 = tail call i32 @puts(i8* %21)
%23 = add nuw i64 %20, 1
%24 = getelementptr inbounds i8*, i8** %2, i64 %23
%25 = load i8*, i8** %24
%26 = icmp eq i8* %25, null
br i1 %26, label %27, label %19
27: ; preds = %19, %15
%28 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.5, i64 0, i64 0))
ret i32 0
}