#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
void main(int argc, char *argv[], char *env[]) {
  printf("ВЫВОДИМ аргументы переданые в main \n В массиве argv %d элементов:\n",
         argc);
  int i = 0;
  while (i < argc) {
    printf("%d. %s \n ", i, argv[i]);
    i++;
  }
  printf("Массив env: \n");
  int j = 0;
  while (env[j] != NULL) {
    printf("%d. %s\n", j, env[j]);
    j++;
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%esi
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1182 <main+0x62>
mov    -0x1c(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xf01(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114b <main+0x2b>
lea    0xeef(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     11d5 <main+0xb5>
mov    -0x20(%rbp),%esi
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1197 <main+0x77>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r12
mov    %edi,%ebx
lea    0xeb8(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebx,%ebx
jle    1189 <main+0x59>
mov    %ebx,%r13d
lea    0xf0f(%rip),%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r12,%rbx,8),%rdx
mov    %r15,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1170 <main+0x40>
lea    0xef0(%rip),%rdi
call   1030 <puts@plt>
mov    (%r14),%rdx
test   %rdx,%rdx
je     11ca <main+0x9a>
lea    0xed4(%rip),%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%r14,%rbx,8),%rdx
add    $0x1,%rbx
test   %rdx,%rdx
jne    11b0 <main+0x80>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [110 x i8] c"\D0\92\D0\AB\D0\92\D0\9E\D0\94\D0\98\D0\9C \D0\B0\D1\80\D0\B3\D1\83\D0\BC\D0\B5\D0\BD\D1\82\D1\8B \D0\BF\D0\B5\D1\80\D0\B5\D0\B4\D0\B0\D0\BD\D1\8B\D0\B5 \D0\B2 main \0A \D0\92 \D0\BC\D0\B0\D1\81\D1\81\D0\B8\D0\B2\D0\B5 argv %d \D1\8D\D0\BB\D0\B5\D0\BC\D0\B5\D0\BD\D1\82\D0\BE\D0\B2:\0A\00"
@.str.1 = [10 x i8] c"%d. %s \0A \00"
@.str.2 = [20 x i8] c"\D0\9C\D0\B0\D1\81\D1\81\D0\B8\D0\B2 env: \0A\00"
@.str.3 = [8 x i8] c"%d. %s\0A\00"
define void @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8**
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8** %2, i8*** %6
%9 = load i32, i32* %4
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([110 x i8], [110 x i8]* @.str, i64 0, i64 0), i32 %9)
store i32 0, i32* %7
br label %11
11: ; preds = %15, %3
%12 = load i32, i32* %7
%13 = load i32, i32* %4
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %25
15: ; preds = %11
%16 = load i32, i32* %7
%17 = load i8**, i8*** %5
%18 = load i32, i32* %7
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8*, i8** %17, i64 %19
%21 = load i8*, i8** %20
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %16, i8* %21)
%23 = load i32, i32* %7
%24 = add nsw i32 %23, 1
store i32 %24, i32* %7
br label %11
25: ; preds = %11
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %8
br label %27
27: ; preds = %34, %25
%28 = load i8**, i8*** %6
%29 = load i32, i32* %8
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8*, i8** %28, i64 %30
%32 = load i8*, i8** %31
%33 = icmp ne i8* %32, null
br i1 %33, label %34, label %44
34: ; preds = %27
%35 = load i32, i32* %8
%36 = load i8**, i8*** %6
%37 = load i32, i32* %8
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8*, i8** %36, i64 %38
%40 = load i8*, i8** %39
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 %35, i8* %40)
%42 = load i32, i32* %8
%43 = add nsw i32 %42, 1
store i32 %43, i32* %8
br label %27
44: ; preds = %27
%45 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [110 x i8] c"\D0\92\D0\AB\D0\92\D0\9E\D0\94\D0\98\D0\9C \D0\B0\D1\80\D0\B3\D1\83\D0\BC\D0\B5\D0\BD\D1\82\D1\8B \D0\BF\D0\B5\D1\80\D0\B5\D0\B4\D0\B0\D0\BD\D1\8B\D0\B5 \D0\B2 main \0A \D0\92 \D0\BC\D0\B0\D1\81\D1\81\D0\B8\D0\B2\D0\B5 argv %d \D1\8D\D0\BB\D0\B5\D0\BC\D0\B5\D0\BD\D1\82\D0\BE\D0\B2:\0A\00"
@.str.1 = [10 x i8] c"%d. %s \0A \00"
@.str.3 = [8 x i8] c"%d. %s\0A\00"
@str = [19 x i8] c"\D0\9C\D0\B0\D1\81\D1\81\D0\B8\D0\B2 env: \00"
define void @main(i32 %0, i8** nocapture %1, i8** nocapture %2) {
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([110 x i8], [110 x i8]* @.str, i64 0, i64 0), i32 %0)
%5 = icmp sgt i32 %0, 0
br i1 %5, label %6, label %16
6: ; preds = %3
%7 = zext i32 %0 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ 0, %6 ], [ %14, %8 ]
%10 = getelementptr inbounds i8*, i8** %1, i64 %9
%11 = load i8*, i8** %10
%12 = trunc i64 %9 to i32
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %12, i8* %11)
%14 = add nuw nsw i64 %9, 1
%15 = icmp eq i64 %14, %7
br i1 %15, label %16, label %8
16: ; preds = %8, %3
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%18 = load i8*, i8** %2
%19 = icmp eq i8* %18, null
br i1 %19, label %29, label %20
20: ; preds = %16, %20
%21 = phi i64 [ %25, %20 ], [ 0, %16 ]
%22 = phi i8* [ %27, %20 ], [ %18, %16 ]
%23 = trunc i64 %21 to i32
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 %23, i8* %22)
%25 = add nuw i64 %21, 1
%26 = getelementptr inbounds i8*, i8** %2, i64 %25
%27 = load i8*, i8** %26
%28 = icmp eq i8* %27, null
br i1 %28, label %29, label %20
29: ; preds = %20, %16
%30 = tail call i32 @exit(i32 0)
unreachable
}