#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 *, char *);
int /*<<< orphan*/ puts(char *);
int main(int argc, char **argv, char **envp) {
  while (*(++argv)) {
    printf("ARGV : {%s}\n", *argv);
  }
  puts("");
  do {
    printf("ENVP : {%s}\n", *envp);
  } while (*(++envp));
  puts("");
  puts("Hello Friends !!");
  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)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
cmpq   $0x0,0x8(%rax)
je     116c <main+0x4c>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe9e(%rip),%rdi
call   1040 <printf@plt>
jmp    113a <main+0x1a>
lea    0xea6(%rip),%rdi
call   1030 <puts@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
lea    0xe87(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x18(%rbp)
cmpq   $0x0,0x8(%rax)
jne    1178 <main+0x58>
lea    0xe6d(%rip),%rdi
call   1030 <puts@plt>
lea    0xe62(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r14
mov    0x8(%rsi),%rsi
test   %rsi,%rsi
je     1164 <main+0x34>
add    $0x10,%r14
lea    0xeb1(%rip),%r15
nop
mov    %r15,%rdi
call   1050 <printf@plt>
mov    (%r14),%rsi
add    $0x8,%r14
test   %rsi,%rsi
jne    1150 <main+0x20>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    (%rbx),%rsi
add    $0x8,%rbx
lea    0xe91(%rip),%r14
nopl   0x0(%rax)
mov    %r14,%rdi
call   1050 <printf@plt>
mov    (%rbx),%rsi
add    $0x8,%rbx
test   %rsi,%rsi
jne    1180 <main+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe75(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [13 x i8] c"ARGV : {%s}\0A\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [13 x i8] c"ENVP : {%s}\0A\00"
@.str.3 = [17 x i8] c"Hello Friends !!\00"
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
br label %8
8: ; preds = %13, %3
%9 = load i8**, i8*** %6
%10 = getelementptr inbounds i8*, i8** %9, i32 1
store i8** %10, i8*** %6
%11 = load i8*, i8** %10
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %17
13: ; preds = %8
%14 = load i8**, i8*** %6
%15 = load i8*, i8** %14
%16 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %15)
br label %8
17: ; preds = %8
%18 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
br label %19
19: ; preds = %23, %17
%20 = load i8**, i8*** %7
%21 = load i8*, i8** %20
%22 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %21)
br label %23
23: ; preds = %19
%24 = load i8**, i8*** %7
%25 = getelementptr inbounds i8*, i8** %24, i32 1
store i8** %25, i8*** %7
%26 = load i8*, i8** %25
%27 = icmp ne i8* %26, null
br i1 %27, label %19, label %28
28: ; preds = %23
%29 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%30 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

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