#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 */
typedef int /*<<< orphan*/ numbers;

/* Variables and functions */
int greatest_numers_in_array(int *, int);
int /*<<< orphan*/ printf(char *, int, int, int, int, int, int, int, int, int,
                          int, int);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, const char *argv[]) {
  int numbers[10] = {0x00};
  srand(time(NULL));
  for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
      numbers[j] = rand() % 1000;
    }
    printf("Greatest among (%d,%d,%d,%d,%d,%d,%d,%d,%d,%d) is %d\n", numbers[0],
           numbers[1], numbers[2], numbers[3], numbers[4], numbers[5],
           numbers[6], numbers[7], numbers[8], numbers[9],
           greatest_numers_in_array(numbers,
                                    (sizeof(numbers) / sizeof(numbers[0]))));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
sub    $0x98,%rsp
movl   $0x0,-0x1c(%rbp)
mov    %edi,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
movl   $0x0,-0x54(%rbp)
cmpl   $0xa,-0x54(%rbp)
jge    1276 <main+0x116>
movl   $0x0,-0x58(%rbp)
cmpl   $0xa,-0x58(%rbp)
jge    11e5 <main+0x85>
mov    $0x0,%al
call   1080 <rand@plt>
mov    $0x3e8,%ecx
cltd
idiv   %ecx
movslq -0x58(%rbp),%rax
mov    %edx,-0x50(%rbp,%rax,4)
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    11b6 <main+0x56>
mov    -0x50(%rbp),%eax
mov    %eax,-0x74(%rbp)
mov    -0x4c(%rbp),%eax
mov    %eax,-0x70(%rbp)
mov    -0x48(%rbp),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x44(%rbp),%eax
mov    %eax,-0x68(%rbp)
mov    -0x40(%rbp),%eax
mov    %eax,-0x64(%rbp)
mov    -0x3c(%rbp),%r15d
mov    -0x38(%rbp),%r14d
mov    -0x34(%rbp),%ebx
mov    -0x30(%rbp),%eax
mov    %eax,-0x60(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x5c(%rbp)
lea    -0x50(%rbp),%rdi
mov    $0xa,%esi
call   1040 <greatest_numers_in_array@plt>
mov    -0x74(%rbp),%esi
mov    -0x70(%rbp),%edx
mov    -0x6c(%rbp),%ecx
mov    -0x68(%rbp),%r8d
mov    -0x64(%rbp),%r9d
mov    -0x60(%rbp),%r11d
mov    -0x5c(%rbp),%r10d
lea    0xdb8(%rip),%rdi
mov    %r15d,(%rsp)
mov    %r14d,0x8(%rsp)
mov    %ebx,0x10(%rsp)
mov    %r11d,0x18(%rsp)
mov    %r10d,0x20(%rsp)
mov    %eax,0x28(%rsp)
call   1030 <printf@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    11a5 <main+0x45>
xor    %eax,%eax
add    $0x98,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movq   $0x0,0x20(%rsp)
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
mov    $0xa,%eax
cs nopw 0x0(%rax,%rax,1)
mov    %eax,0x34(%rsp)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x10624dd3,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    $0x6,%ecx
add    %edx,%ecx
imul   $0x3e8,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,(%rsp)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x10624dd3,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    $0x6,%ecx
add    %edx,%ecx
imul   $0x3e8,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,0x4(%rsp)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x10624dd3,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    $0x6,%ecx
add    %edx,%ecx
imul   $0x3e8,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,0x8(%rsp)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x10624dd3,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    $0x6,%ecx
add    %edx,%ecx
imul   $0x3e8,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,0xc(%rsp)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x10624dd3,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    $0x6,%ecx
add    %edx,%ecx
imul   $0x3e8,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,0x10(%rsp)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x10624dd3,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    $0x6,%ecx
add    %edx,%ecx
imul   $0x3e8,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,0x14(%rsp)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x10624dd3,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    $0x6,%ecx
add    %edx,%ecx
imul   $0x3e8,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,0x18(%rsp)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x10624dd3,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    $0x6,%ecx
add    %edx,%ecx
imul   $0x3e8,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,0x1c(%rsp)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x10624dd3,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    $0x6,%ecx
add    %edx,%ecx
imul   $0x3e8,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,0x20(%rsp)
xor    %eax,%eax
call   1070 <rand@plt>
movslq %eax,%r15
imul   $0x10624dd3,%r15,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
sar    $0x6,%eax
add    %ecx,%eax
imul   $0x3e8,%eax,%eax
sub    %eax,%r15d
mov    %r15d,0x24(%rsp)
mov    (%rsp),%ebp
mov    0x4(%rsp),%ebx
mov    0x8(%rsp),%r12d
mov    0xc(%rsp),%r13d
mov    0x10(%rsp),%r14d
mov    0x14(%rsp),%eax
mov    %rax,0x50(%rsp)
mov    0x18(%rsp),%eax
mov    %rax,0x48(%rsp)
mov    0x1c(%rsp),%eax
mov    %rax,0x40(%rsp)
mov    0x20(%rsp),%eax
mov    %rax,0x38(%rsp)
mov    %rsp,%rdi
mov    $0xa,%esi
call   1040 <greatest_numers_in_array@plt>
lea    0xc64(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %r12d,%ecx
mov    %r13d,%r8d
mov    %r14d,%r9d
push   %rax
push   %r15
push   0x48(%rsp)
push   0x58(%rsp)
push   0x68(%rsp)
push   0x78(%rsp)
call   1030 <printf@plt>
mov    0x64(%rsp),%eax
add    $0x30,%rsp
add    $0xffffffff,%eax
jne    1190 <main+0x40>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [54 x i8] c"Greatest among (%d,%d,%d,%d,%d,%d,%d,%d,%d,%d) is %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [10 x i32]
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = bitcast [10 x i32]* %6 to i8*
%10 = call i32 @time(i32* null)
%11 = call i32 @srand(i32 %10)
store i32 0, i32* %7
br label %12
12: ; preds = %52, %2
%13 = load i32, i32* %7
%14 = icmp slt i32 %13, 10
br i1 %14, label %15, label %55
15: ; preds = %12
store i32 0, i32* %8
br label %16
16: ; preds = %25, %15
%17 = load i32, i32* %8
%18 = icmp slt i32 %17, 10
br i1 %18, label %19, label %28
19: ; preds = %16
%20 = call i32 (...) @rand()
%21 = srem i32 %20, 1000
%22 = load i32, i32* %8
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 %23
store i32 %21, i32* %24
br label %25
25: ; preds = %19
%26 = load i32, i32* %8
%27 = add nsw i32 %26, 1
store i32 %27, i32* %8
br label %16
28: ; preds = %16
%29 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 0
%30 = load i32, i32* %29
%31 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 1
%32 = load i32, i32* %31
%33 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 2
%34 = load i32, i32* %33
%35 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 3
%36 = load i32, i32* %35
%37 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 4
%38 = load i32, i32* %37
%39 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 5
%40 = load i32, i32* %39
%41 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 6
%42 = load i32, i32* %41
%43 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 7
%44 = load i32, i32* %43
%45 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 8
%46 = load i32, i32* %45
%47 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 9
%48 = load i32, i32* %47
%49 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 0
%50 = call i32 @greatest_numers_in_array(i32* %49, i32 10)
%51 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i32 %30, i32 %32, i32 %34, i32 %36, i32 %38, i32 %40, i32 %42, i32 %44, i32 %46, i32 %48, i32 %50)
br label %52
52: ; preds = %28
%53 = load i32, i32* %7
%54 = add nsw i32 %53, 1
store i32 %54, i32* %7
br label %12
55: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
@.str = [54 x i8] c"Greatest among (%d,%d,%d,%d,%d,%d,%d,%d,%d,%d) is %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [10 x i32]
%4 = bitcast [10 x i32]* %3 to i8*
%5 = tail call i32 @time(i32* null)
%6 = tail call i32 @srand(i32 %5)
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 1
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 2
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 3
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 4
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 5
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 6
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 7
%15 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 8
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 9
br label %17
17: ; preds = %2, %17
%18 = phi i32 [ 0, %2 ], [ %50, %17 ]
%19 = call i32 (...) @rand()
%20 = srem i32 %19, 1000
store i32 %20, i32* %7
%21 = call i32 (...) @rand()
%22 = srem i32 %21, 1000
store i32 %22, i32* %8
%23 = call i32 (...) @rand()
%24 = srem i32 %23, 1000
store i32 %24, i32* %9
%25 = call i32 (...) @rand()
%26 = srem i32 %25, 1000
store i32 %26, i32* %10
%27 = call i32 (...) @rand()
%28 = srem i32 %27, 1000
store i32 %28, i32* %11
%29 = call i32 (...) @rand()
%30 = srem i32 %29, 1000
store i32 %30, i32* %12
%31 = call i32 (...) @rand()
%32 = srem i32 %31, 1000
store i32 %32, i32* %13
%33 = call i32 (...) @rand()
%34 = srem i32 %33, 1000
store i32 %34, i32* %14
%35 = call i32 (...) @rand()
%36 = srem i32 %35, 1000
store i32 %36, i32* %15
%37 = call i32 (...) @rand()
%38 = srem i32 %37, 1000
store i32 %38, i32* %16
%39 = load i32, i32* %7
%40 = load i32, i32* %8
%41 = load i32, i32* %9
%42 = load i32, i32* %10
%43 = load i32, i32* %11
%44 = load i32, i32* %12
%45 = load i32, i32* %13
%46 = load i32, i32* %14
%47 = load i32, i32* %15
%48 = call i32 @greatest_numers_in_array(i32* %7, i32 10)
%49 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0), i32 %39, i32 %40, i32 %41, i32 %42, i32 %43, i32 %44, i32 %45, i32 %46, i32 %47, i32 %38, i32 %48)
%50 = add nuw nsw i32 %18, 1
%51 = icmp eq i32 %50, 10
br i1 %51, label %52, label %17
52: ; preds = %17
ret i32 0
}