#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 *, int);
int rand();
int /*<<< orphan*/ srand(unsigned int);
scalar_t__ time(int /*<<< orphan*/ *);
int main() {
  int number, n[10], min, max;
  float sum;
  srand((unsigned)time(NULL));
  int i;
  for (i = 0; i < 10; i++) {
    number = rand() % 100 + 1;
    if (!i)
      min = max = number;
    sum += n[i] = number;
  }
  for (i = 0; i < 10; i++) {
    if (n[i] > max)
      max = n[i];
    if (n[i] < min)
      min = n[i];
  }
  printf("average: %.2f\n", sum / 10.);
  printf("maximum: %d\n", max);
  printf("minimum: %d", min);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
movl   $0x0,-0x40(%rbp)
cmpl   $0xa,-0x40(%rbp)
jge    11bf <main+0x7f>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x8(%rbp)
cmpl   $0x0,-0x40(%rbp)
jne    1198 <main+0x58>
mov    -0x8(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%eax
movslq -0x40(%rbp),%rcx
mov    %eax,-0x30(%rbp,%rcx,4)
cvtsi2ss %eax,%xmm0
addss  -0x3c(%rbp),%xmm0
movss  %xmm0,-0x3c(%rbp)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    1166 <main+0x26>
movl   $0x0,-0x40(%rbp)
cmpl   $0xa,-0x40(%rbp)
jge    121b <main+0xdb>
movslq -0x40(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
cmp    -0x38(%rbp),%eax
jle    11ec <main+0xac>
movslq -0x40(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x38(%rbp)
movslq -0x40(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
cmp    -0x34(%rbp),%eax
jge    1208 <main+0xc8>
movslq -0x40(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x34(%rbp)
jmp    120d <main+0xcd>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    11c6 <main+0x86>
movss  -0x3c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdd4(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
lea    0xdcd(%rip),%rdi
call   1030 <printf@plt>
mov    -0x38(%rbp),%esi
lea    0xdcd(%rip),%rdi
call   1030 <printf@plt>
mov    -0x34(%rbp),%esi
lea    0xdcb(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%ebx
add    $0x1,%ebx
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%ebp
add    $0x1,%ebp
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
neg    %ecx
add    %ecx,%eax
add    $0x1,%eax
mov    %eax,0x14(%rsp)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
neg    %ecx
add    %ecx,%eax
add    $0x1,%eax
mov    %eax,0x10(%rsp)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
neg    %ecx
add    %ecx,%eax
add    $0x1,%eax
mov    %eax,0xc(%rsp)
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%r14d
add    $0x1,%r14d
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%r15d
add    $0x1,%r15d
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%r12d
add    $0x1,%r12d
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%r13d
add    $0x1,%r13d
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
neg    %ecx
mov    %ebp,%edx
cmp    %ebx,%ebp
mov    %ebx,%ebp
cmovg  %edx,%ebp
cmovl  %edx,%ebx
mov    0x14(%rsp),%edx
cmp    %ebp,%edx
cmovg  %edx,%ebp
cmp    %ebx,%edx
cmovl  %edx,%ebx
mov    0x10(%rsp),%edx
cmp    %ebp,%edx
cmovg  %edx,%ebp
cmp    %ebx,%edx
cmovl  %edx,%ebx
mov    0xc(%rsp),%edx
cmp    %ebp,%edx
cmovg  %edx,%ebp
cmp    %ebx,%edx
cmovl  %edx,%ebx
cmp    %ebp,%r14d
cmovg  %r14d,%ebp
cmp    %ebx,%r14d
cmovl  %r14d,%ebx
cmp    %ebp,%r15d
cmovg  %r15d,%ebp
cmp    %ebx,%r15d
cmovl  %r15d,%ebx
cmp    %ebp,%r12d
cmovg  %r12d,%ebp
cmp    %ebx,%r12d
cmovl  %r12d,%ebx
cmp    %ebp,%r13d
cmovg  %r13d,%ebp
cmp    %ebx,%r13d
cmovl  %r13d,%ebx
add    %ecx,%eax
add    $0x1,%eax
cmp    %ebp,%eax
cmovg  %eax,%ebp
cmp    %ebx,%eax
cmovl  %eax,%ebx
lea    0xc85(%rip),%rdi
call   1030 <printf@plt>
lea    0xc88(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
lea    0xc87(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"average: %.2f\0A\00"
@.str.1 = [13 x i8] c"maximum: %d\0A\00"
@.str.2 = [12 x i8] c"minimum: %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [10 x i32]
%4 = alloca i32
%5 = alloca i32
%6 = alloca float
%7 = alloca i32
store i32 0, i32* %1
%8 = call i64 @time(i32* null)
%9 = trunc i64 %8 to i32
%10 = call i32 @srand(i32 %9)
store i32 0, i32* %7
br label %11
11: ; preds = %30, %0
%12 = load i32, i32* %7
%13 = icmp slt i32 %12, 10
br i1 %13, label %14, label %33
14: ; preds = %11
%15 = call i32 (...) @rand()
%16 = srem i32 %15, 100
%17 = add nsw i32 %16, 1
store i32 %17, i32* %2
%18 = load i32, i32* %7
%19 = icmp ne i32 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %14
%21 = load i32, i32* %2
store i32 %21, i32* %5
store i32 %21, i32* %4
br label %22
22: ; preds = %20, %14
%23 = load i32, i32* %2
%24 = load i32, i32* %7
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %25
store i32 %23, i32* %26
%27 = sitofp i32 %23 to float
%28 = load float, float* %6
%29 = fadd float %28, %27
store float %29, float* %6
br label %30
30: ; preds = %22
%31 = load i32, i32* %7
%32 = add nsw i32 %31, 1
store i32 %32, i32* %7
br label %11
33: ; preds = %11
store i32 0, i32* %7
br label %34
34: ; preds = %62, %33
%35 = load i32, i32* %7
%36 = icmp slt i32 %35, 10
br i1 %36, label %37, label %65
37: ; preds = %34
%38 = load i32, i32* %7
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %39
%41 = load i32, i32* %40
%42 = load i32, i32* %5
%43 = icmp sgt i32 %41, %42
br i1 %43, label %44, label %49
44: ; preds = %37
%45 = load i32, i32* %7
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %46
%48 = load i32, i32* %47
store i32 %48, i32* %5
br label %49
49: ; preds = %44, %37
%50 = load i32, i32* %7
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %51
%53 = load i32, i32* %52
%54 = load i32, i32* %4
%55 = icmp slt i32 %53, %54
br i1 %55, label %56, label %61
56: ; preds = %49
%57 = load i32, i32* %7
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %58
%60 = load i32, i32* %59
store i32 %60, i32* %4
br label %61
61: ; preds = %56, %49
br label %62
62: ; preds = %61
%63 = load i32, i32* %7
%64 = add nsw i32 %63, 1
store i32 %64, i32* %7
br label %34
65: ; preds = %34
%66 = load float, float* %6
%67 = fpext float %66 to double
%68 = fdiv double %67, 1.000000e+01
%69 = fptosi double %68 to i32
%70 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %69)
%71 = load i32, i32* %5
%72 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %71)
%73 = load i32, i32* %4
%74 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %73)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"average: %.2f\0A\00"
@.str.1 = [13 x i8] c"maximum: %d\0A\00"
@.str.2 = [12 x i8] c"minimum: %d\00"
define i32 @main() {
%1 = tail call i64 @time(i32* null)
%2 = trunc i64 %1 to i32
%3 = tail call i32 @srand(i32 %2)
%4 = tail call i32 (...) @rand()
%5 = srem i32 %4, 100
%6 = add nsw i32 %5, 1
%7 = tail call i32 (...) @rand()
%8 = srem i32 %7, 100
%9 = add nsw i32 %8, 1
%10 = tail call i32 (...) @rand()
%11 = srem i32 %10, 100
%12 = add nsw i32 %11, 1
%13 = tail call i32 (...) @rand()
%14 = srem i32 %13, 100
%15 = add nsw i32 %14, 1
%16 = tail call i32 (...) @rand()
%17 = srem i32 %16, 100
%18 = add nsw i32 %17, 1
%19 = tail call i32 (...) @rand()
%20 = srem i32 %19, 100
%21 = add nsw i32 %20, 1
%22 = tail call i32 (...) @rand()
%23 = srem i32 %22, 100
%24 = add nsw i32 %23, 1
%25 = tail call i32 (...) @rand()
%26 = srem i32 %25, 100
%27 = add nsw i32 %26, 1
%28 = tail call i32 (...) @rand()
%29 = srem i32 %28, 100
%30 = add nsw i32 %29, 1
%31 = tail call i32 (...) @rand()
%32 = srem i32 %31, 100
%33 = add nsw i32 %32, 1
%34 = icmp sgt i32 %9, %6
%35 = select i1 %34, i32 %9, i32 %6
%36 = icmp slt i32 %9, %6
%37 = select i1 %36, i32 %9, i32 %6
%38 = icmp sgt i32 %12, %35
%39 = select i1 %38, i32 %12, i32 %35
%40 = icmp slt i32 %12, %37
%41 = select i1 %40, i32 %12, i32 %37
%42 = icmp sgt i32 %15, %39
%43 = select i1 %42, i32 %15, i32 %39
%44 = icmp slt i32 %15, %41
%45 = select i1 %44, i32 %15, i32 %41
%46 = icmp sgt i32 %18, %43
%47 = select i1 %46, i32 %18, i32 %43
%48 = icmp slt i32 %18, %45
%49 = select i1 %48, i32 %18, i32 %45
%50 = icmp sgt i32 %21, %47
%51 = select i1 %50, i32 %21, i32 %47
%52 = icmp slt i32 %21, %49
%53 = select i1 %52, i32 %21, i32 %49
%54 = icmp sgt i32 %24, %51
%55 = select i1 %54, i32 %24, i32 %51
%56 = icmp slt i32 %24, %53
%57 = select i1 %56, i32 %24, i32 %53
%58 = icmp sgt i32 %27, %55
%59 = select i1 %58, i32 %27, i32 %55
%60 = icmp slt i32 %27, %57
%61 = select i1 %60, i32 %27, i32 %57
%62 = icmp sgt i32 %30, %59
%63 = select i1 %62, i32 %30, i32 %59
%64 = icmp slt i32 %30, %61
%65 = select i1 %64, i32 %30, i32 %61
%66 = icmp sgt i32 %33, %63
%67 = select i1 %66, i32 %33, i32 %63
%68 = icmp slt i32 %33, %65
%69 = select i1 %68, i32 %33, i32 %65
%70 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 poison)
%71 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %67)
%72 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %69)
ret i32 0
}