#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*/ calls(char *, int *, int);
int /*<<< orphan*/ printf(char *);
int rand();
int /*<<< orphan*/ srand(int);
int main() {
  int tb[100], i = 0;
  srand(1010);
  for (; i < 100; ++i)
    tb[i] = 100 - i;
  printf("Initialization done.\n");
  calls("reversed array", tb, 100);
  for (i = 0; i < 100; ++i)
    tb[i] = rand() % 20;
  calls("random array", tb, 100);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1a4(%rbp)
mov    $0x3f2,%edi
call   1040 <srand@plt>
cmpl   $0x64,-0x1a4(%rbp)
jge    11a0 <main+0x60>
mov    $0x64,%ecx
sub    -0x1a4(%rbp),%ecx
movslq -0x1a4(%rbp),%rax
mov    %ecx,-0x1a0(%rbp,%rax,4)
mov    -0x1a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a4(%rbp)
jmp    1166 <main+0x26>
lea    0xe59(%rip),%rdi
call   1030 <printf@plt>
lea    -0x1a0(%rbp),%rsi
lea    0xe5c(%rip),%rdi
mov    $0x64,%edx
call   1050 <calls@plt>
movl   $0x0,-0x1a4(%rbp)
cmpl   $0x64,-0x1a4(%rbp)
jge    120c <main+0xcc>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x14,%ecx
cltd
idiv   %ecx
movslq -0x1a4(%rbp),%rax
mov    %edx,-0x1a0(%rbp,%rax,4)
mov    -0x1a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a4(%rbp)
jmp    11ce <main+0x8e>
lea    -0x1a0(%rbp),%rsi
lea    0xe0b(%rip),%rdi
mov    $0x64,%edx
call   1050 <calls@plt>
xor    %eax,%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x190,%rsp
mov    $0x3f2,%edi
call   1040 <srand@plt>
movaps 0xea7(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xeac(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeb0(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xeb4(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xeb8(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xebc(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xec0(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xec4(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,0x90(%rsp)
movaps 0xeca(%rip),%xmm0
movaps %xmm0,0xa0(%rsp)
movaps 0xecb(%rip),%xmm0
movaps %xmm0,0xb0(%rsp)
movaps 0xecc(%rip),%xmm0
movaps %xmm0,0xc0(%rsp)
movaps 0xecd(%rip),%xmm0
movaps %xmm0,0xd0(%rsp)
movaps 0xece(%rip),%xmm0
movaps %xmm0,0xe0(%rsp)
movaps 0xecf(%rip),%xmm0
movaps %xmm0,0xf0(%rsp)
movaps 0xed0(%rip),%xmm0
movaps %xmm0,0x100(%rsp)
movaps 0xed1(%rip),%xmm0
movaps %xmm0,0x110(%rsp)
movaps 0xed2(%rip),%xmm0
movaps %xmm0,0x120(%rsp)
movaps 0xed3(%rip),%xmm0
movaps %xmm0,0x130(%rsp)
movaps 0xed4(%rip),%xmm0
movaps %xmm0,0x140(%rsp)
movaps 0xed5(%rip),%xmm0
movaps %xmm0,0x150(%rsp)
movaps 0xed6(%rip),%xmm0
movaps %xmm0,0x160(%rsp)
movaps 0xed7(%rip),%xmm0
movaps %xmm0,0x170(%rsp)
movaps 0xed8(%rip),%xmm0
movaps %xmm0,0x180(%rsp)
lea    0xef5(%rip),%rdi
call   1030 <puts@plt>
lea    0xecd(%rip),%rdi
mov    %rsp,%rsi
mov    $0x64,%edx
call   1050 <calls@plt>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
mov    %eax,(%rsp,%rbx,4)
add    $0x1,%rbx
cmp    $0x64,%rbx
jne    12e0 <main+0x1a0>
lea    0xe86(%rip),%rdi
mov    %rsp,%rsi
mov    $0x64,%edx
call   1050 <calls@plt>
xor    %eax,%eax
add    $0x190,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Initialization done.\0A\00"
@.str.1 = [15 x i8] c"reversed array\00"
@.str.2 = [13 x i8] c"random array\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i32]
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
%4 = call i32 @srand(i32 1010)
br label %5
5: ; preds = %14, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 100
br i1 %7, label %8, label %17
8: ; preds = %5
%9 = load i32, i32* %3
%10 = sub nsw i32 100, %9
%11 = load i32, i32* %3
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %12
store i32 %10, i32* %13
br label %14
14: ; preds = %8
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %5
17: ; preds = %5
%18 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%19 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%20 = call i32 @calls(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32* %19, i32 100)
store i32 0, i32* %3
br label %21
21: ; preds = %30, %17
%22 = load i32, i32* %3
%23 = icmp slt i32 %22, 100
br i1 %23, label %24, label %33
24: ; preds = %21
%25 = call i32 (...) @rand()
%26 = srem i32 %25, 20
%27 = load i32, i32* %3
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %28
store i32 %26, i32* %29
br label %30
30: ; preds = %24
%31 = load i32, i32* %3
%32 = add nsw i32 %31, 1
store i32 %32, i32* %3
br label %21
33: ; preds = %21
%34 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%35 = call i32 @calls(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32* %34, i32 100)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [15 x i8] c"reversed array\00"
@.str.2 = [13 x i8] c"random array\00"
@str = [21 x i8] c"Initialization done.\00"
define i32 @main() {
%1 = alloca [100 x i32]
%2 = bitcast [100 x i32]* %1 to i8*
%3 = tail call i32 @srand(i32 1010)
%4 = bitcast [100 x i32]* %1 to <4 x i32>*
store <4 x i32> <i32 100, i32 99, i32 98, i32 97>, <4 x i32>* %4
%5 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 4
%6 = bitcast i32* %5 to <4 x i32>*
store <4 x i32> <i32 96, i32 95, i32 94, i32 93>, <4 x i32>* %6
%7 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 8
%8 = bitcast i32* %7 to <4 x i32>*
store <4 x i32> <i32 92, i32 91, i32 90, i32 89>, <4 x i32>* %8
%9 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 12
%10 = bitcast i32* %9 to <4 x i32>*
store <4 x i32> <i32 88, i32 87, i32 86, i32 85>, <4 x i32>* %10
%11 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 16
%12 = bitcast i32* %11 to <4 x i32>*
store <4 x i32> <i32 84, i32 83, i32 82, i32 81>, <4 x i32>* %12
%13 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 20
%14 = bitcast i32* %13 to <4 x i32>*
store <4 x i32> <i32 80, i32 79, i32 78, i32 77>, <4 x i32>* %14
%15 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 24
%16 = bitcast i32* %15 to <4 x i32>*
store <4 x i32> <i32 76, i32 75, i32 74, i32 73>, <4 x i32>* %16
%17 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 28
%18 = bitcast i32* %17 to <4 x i32>*
store <4 x i32> <i32 72, i32 71, i32 70, i32 69>, <4 x i32>* %18
%19 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 32
%20 = bitcast i32* %19 to <4 x i32>*
store <4 x i32> <i32 68, i32 67, i32 66, i32 65>, <4 x i32>* %20
%21 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 36
%22 = bitcast i32* %21 to <4 x i32>*
store <4 x i32> <i32 64, i32 63, i32 62, i32 61>, <4 x i32>* %22
%23 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 40
%24 = bitcast i32* %23 to <4 x i32>*
store <4 x i32> <i32 60, i32 59, i32 58, i32 57>, <4 x i32>* %24
%25 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 44
%26 = bitcast i32* %25 to <4 x i32>*
store <4 x i32> <i32 56, i32 55, i32 54, i32 53>, <4 x i32>* %26
%27 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 48
%28 = bitcast i32* %27 to <4 x i32>*
store <4 x i32> <i32 52, i32 51, i32 50, i32 49>, <4 x i32>* %28
%29 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 52
%30 = bitcast i32* %29 to <4 x i32>*
store <4 x i32> <i32 48, i32 47, i32 46, i32 45>, <4 x i32>* %30
%31 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 56
%32 = bitcast i32* %31 to <4 x i32>*
store <4 x i32> <i32 44, i32 43, i32 42, i32 41>, <4 x i32>* %32
%33 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 60
%34 = bitcast i32* %33 to <4 x i32>*
store <4 x i32> <i32 40, i32 39, i32 38, i32 37>, <4 x i32>* %34
%35 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 64
%36 = bitcast i32* %35 to <4 x i32>*
store <4 x i32> <i32 36, i32 35, i32 34, i32 33>, <4 x i32>* %36
%37 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 68
%38 = bitcast i32* %37 to <4 x i32>*
store <4 x i32> <i32 32, i32 31, i32 30, i32 29>, <4 x i32>* %38
%39 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 72
%40 = bitcast i32* %39 to <4 x i32>*
store <4 x i32> <i32 28, i32 27, i32 26, i32 25>, <4 x i32>* %40
%41 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 76
%42 = bitcast i32* %41 to <4 x i32>*
store <4 x i32> <i32 24, i32 23, i32 22, i32 21>, <4 x i32>* %42
%43 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 80
%44 = bitcast i32* %43 to <4 x i32>*
store <4 x i32> <i32 20, i32 19, i32 18, i32 17>, <4 x i32>* %44
%45 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 84
%46 = bitcast i32* %45 to <4 x i32>*
store <4 x i32> <i32 16, i32 15, i32 14, i32 13>, <4 x i32>* %46
%47 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 88
%48 = bitcast i32* %47 to <4 x i32>*
store <4 x i32> <i32 12, i32 11, i32 10, i32 9>, <4 x i32>* %48
%49 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 92
%50 = bitcast i32* %49 to <4 x i32>*
store <4 x i32> <i32 8, i32 7, i32 6, i32 5>, <4 x i32>* %50
%51 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 96
%52 = bitcast i32* %51 to <4 x i32>*
store <4 x i32> <i32 4, i32 3, i32 2, i32 1>, <4 x i32>* %52
%53 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%54 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 0
%55 = call i32 @calls(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32* %54, i32 100)
br label %56
56: ; preds = %0, %56
%57 = phi i64 [ 0, %0 ], [ %61, %56 ]
%58 = call i32 (...) @rand()
%59 = srem i32 %58, 20
%60 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %57
store i32 %59, i32* %60
%61 = add nuw nsw i64 %57, 1
%62 = icmp eq i64 %61, 100
br i1 %62, label %63, label %56
63: ; preds = %56
%64 = call i32 @calls(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32* %54, i32 100)
ret i32 0
}