#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 *, ...);
int main(int argc, char *argv[], char *envp[]) {
  int i = 0;
  while (i != argc) {
    printf("Вывод значений аргументов в функции main\n");
    printf("%s\n", argv[i]);
    i++;
  }
  i = 0;
  while (envp[i] != NULL) {
    printf("%s\n", envp[i]);
    i++;
  }
  exit(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)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
je     1183 <main+0x63>
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xedb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1141 <main+0x21>
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     11c5 <main+0xa5>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    118a <main+0x6a>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdx,%r13
test   %edi,%edi
je     115a <main+0x3a>
mov    %rsi,%r14
mov    %edi,%r12d
xor    %ebx,%ebx
lea    0xec1(%rip),%r15
nop
mov    %r15,%rdi
call   1030 <puts@plt>
mov    (%r14,%rbx,8),%rdi
call   1030 <puts@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <main+0x20>
mov    0x0(%r13),%rdi
test   %rdi,%rdi
je     1182 <main+0x62>
add    $0x8,%r13
nopw   0x0(%rax,%rax,1)
call   1030 <puts@plt>
mov    0x0(%r13),%rdi
add    $0x8,%r13
test   %rdi,%rdi
jne    1170 <main+0x50>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [73 x i8] c"\D0\92\D1\8B\D0\B2\D0\BE\D0\B4 \D0\B7\D0\BD\D0\B0\D1\87\D0\B5\D0\BD\D0\B8\D0\B9 \D0\B0\D1\80\D0\B3\D1\83\D0\BC\D0\B5\D0\BD\D1\82\D0\BE\D0\B2 \D0\B2 \D1\84\D1\83\D0\BD\D0\BA\D1\86\D0\B8\D0\B8 main\0A\00"
@.str.1 = [4 x i8] c"%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
store i32 0, i32* %8
br label %9
9: ; preds = %13, %3
%10 = load i32, i32* %8
%11 = load i32, i32* %5
%12 = icmp ne i32 %10, %11
br i1 %12, label %13, label %23
13: ; preds = %9
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str, i64 0, i64 0))
%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)
%21 = load i32, i32* %8
%22 = add nsw i32 %21, 1
store i32 %22, i32* %8
br label %9
23: ; preds = %9
store i32 0, i32* %8
br label %24
24: ; preds = %31, %23
%25 = load i8**, i8*** %7
%26 = load i32, i32* %8
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8*, i8** %25, i64 %27
%29 = load i8*, i8** %28
%30 = icmp ne i8* %29, null
br i1 %30, label %31, label %40
31: ; preds = %24
%32 = load i8**, i8*** %7
%33 = load i32, i32* %8
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8*, i8** %32, i64 %34
%36 = load i8*, i8** %35
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %36)
%38 = load i32, i32* %8
%39 = add nsw i32 %38, 1
store i32 %39, i32* %8
br label %24
40: ; preds = %24
%41 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [72 x i8] c"\D0\92\D1\8B\D0\B2\D0\BE\D0\B4 \D0\B7\D0\BD\D0\B0\D1\87\D0\B5\D0\BD\D0\B8\D0\B9 \D0\B0\D1\80\D0\B3\D1\83\D0\BC\D0\B5\D0\BD\D1\82\D0\BE\D0\B2 \D0\B2 \D1\84\D1\83\D0\BD\D0\BA\D1\86\D0\B8\D0\B8 main\00"
define i32 @main(i32 %0, i8** nocapture %1, i8** nocapture %2) {
%4 = icmp eq i32 %0, 0
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = zext i32 %0 to i64
br label %10
7: ; preds = %10, %3
%8 = load i8*, i8** %2
%9 = icmp eq i8* %8, null
br i1 %9, label %26, label %18
10: ; preds = %5, %10
%11 = phi i64 [ 0, %5 ], [ %16, %10 ]
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([72 x i8], [72 x i8]* @str, i64 0, i64 0))
%13 = getelementptr inbounds i8*, i8** %1, i64 %11
%14 = load i8*, i8** %13
%15 = tail call i32 @puts(i8* dereferenceable(1) %14)
%16 = add nuw nsw i64 %11, 1
%17 = icmp eq i64 %16, %6
br i1 %17, label %7, label %10
18: ; preds = %7, %18
%19 = phi i64 [ %22, %18 ], [ 0, %7 ]
%20 = phi i8* [ %24, %18 ], [ %8, %7 ]
%21 = tail call i32 @puts(i8* %20)
%22 = add nuw i64 %19, 1
%23 = getelementptr inbounds i8*, i8** %2, i64 %22
%24 = load i8*, i8** %23
%25 = icmp eq i8* %24, null
br i1 %25, label %26, label %18
26: ; preds = %18, %7
%27 = tail call i32 @exit(i32 0)
unreachable
}