#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 *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[], char *env[]) {
  int i;
  fprintf(stderr, "Environment...\n");
  for (i = 0; env[i]; i++) {
    fprintf(stderr, "env[%d]: %s\n", i, env[i]);
  }
  fprintf(stdout, "Arguments...\n");
  for (i = 0; i < argc; i++) {
    fprintf(stdout, "argv[%d]: %s\n", i, argv[i]);
  }
}


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    0x2eaf(%rip),%rax
mov    (%rax),%edi
lea    0xec6(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     118f <main+0x7f>
mov    0x2e7e(%rip),%rax
mov    (%rax),%edi
mov    -0x1c(%rbp),%edx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
lea    0xe96(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1148 <main+0x38>
mov    0x2e42(%rip),%rax
mov    (%rax),%edi
lea    0xe7e(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11ed <main+0xdd>
mov    0x2e18(%rip),%rax
mov    (%rax),%edi
mov    -0x1c(%rbp),%edx
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
lea    0xe53(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11ad <main+0x9d>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%rbp
mov    %rsi,%r15
mov    %edi,%r14d
mov    0x2eb5(%rip),%r13
mov    0x0(%r13),%edi
lea    0xeca(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    0x0(%rbp),%rcx
test   %rcx,%rcx
je     116e <main+0x5e>
lea    0xec3(%rip),%r12
xor    %ebx,%ebx
nop
mov    0x0(%r13),%edi
mov    %r12,%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    0x8(%rbp,%rbx,8),%rcx
add    $0x1,%rbx
test   %rcx,%rcx
jne    1150 <main+0x40>
mov    0x2e63(%rip),%r12
mov    (%r12),%edi
lea    0xe9d(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
test   %r14d,%r14d
jle    11bd <main+0xad>
mov    %r14d,%ebx
lea    0xe95(%rip),%r14
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    (%r12),%edi
mov    (%r15,%rbp,8),%rcx
mov    %r14,%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    11a0 <main+0x90>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [16 x i8] c"Environment...\0A\00"
@.str.1 = [13 x i8] c"env[%d]: %s\0A\00"
@stdout = global i32 0
@.str.2 = [14 x i8] c"Arguments...\0A\00"
@.str.3 = [14 x i8] c"argv[%d]: %s\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 = load i32, i32* @stderr
%10 = call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %8
br label %11
11: ; preds = %27, %3
%12 = load i8**, i8*** %7
%13 = load i32, i32* %8
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8*, i8** %12, i64 %14
%16 = load i8*, i8** %15
%17 = icmp ne i8* %16, null
br i1 %17, label %18, label %30
18: ; preds = %11
%19 = load i32, i32* @stderr
%20 = load i32, i32* %8
%21 = load i8**, i8*** %7
%22 = load i32, i32* %8
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8*, i8** %21, i64 %23
%25 = load i8*, i8** %24
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %20, i8* %25)
br label %27
27: ; preds = %18
%28 = load i32, i32* %8
%29 = add nsw i32 %28, 1
store i32 %29, i32* %8
br label %11
30: ; preds = %11
%31 = load i32, i32* @stdout
%32 = call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %8
br label %33
33: ; preds = %46, %30
%34 = load i32, i32* %8
%35 = load i32, i32* %5
%36 = icmp slt i32 %34, %35
br i1 %36, label %37, label %49
37: ; preds = %33
%38 = load i32, i32* @stdout
%39 = load i32, i32* %8
%40 = load i8**, i8*** %6
%41 = load i32, i32* %8
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8*, i8** %40, i64 %42
%44 = load i8*, i8** %43
%45 = call i32 (i32, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %39, i8* %44)
br label %46
46: ; preds = %37
%47 = load i32, i32* %8
%48 = add nsw i32 %47, 1
store i32 %48, i32* %8
br label %33
49: ; preds = %33
%50 = load i32, i32* %4
ret i32 %50
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [16 x i8] c"Environment...\0A\00"
@.str.1 = [13 x i8] c"env[%d]: %s\0A\00"
@stdout = global i32 0
@.str.2 = [14 x i8] c"Arguments...\0A\00"
@.str.3 = [14 x i8] c"argv[%d]: %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1, i8** nocapture %2) {
%4 = load i32, i32* @stderr
%5 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%6 = load i8*, i8** %2
%7 = icmp eq i8* %6, null
br i1 %7, label %18, label %8
8: ; preds = %3, %8
%9 = phi i64 [ %14, %8 ], [ 0, %3 ]
%10 = phi i8* [ %16, %8 ], [ %6, %3 ]
%11 = load i32, i32* @stderr
%12 = trunc i64 %9 to i32
%13 = tail call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %12, i8* %10)
%14 = add nuw i64 %9, 1
%15 = getelementptr inbounds i8*, i8** %2, i64 %14
%16 = load i8*, i8** %15
%17 = icmp eq i8* %16, null
br i1 %17, label %18, label %8
18: ; preds = %8, %3
%19 = load i32, i32* @stdout
%20 = tail call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%21 = icmp sgt i32 %0, 0
br i1 %21, label %22, label %33
22: ; preds = %18
%23 = zext i32 %0 to i64
br label %24
24: ; preds = %22, %24
%25 = phi i64 [ 0, %22 ], [ %31, %24 ]
%26 = load i32, i32* @stdout
%27 = getelementptr inbounds i8*, i8** %1, i64 %25
%28 = load i8*, i8** %27
%29 = trunc i64 %25 to i32
%30 = tail call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %29, i8* %28)
%31 = add nuw nsw i64 %25, 1
%32 = icmp eq i64 %31, %23
br i1 %32, label %33, label %24
33: ; preds = %24, %18
ret i32 0
}