#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 rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  float k, l, mass[10000000];
  int i;
  srand(time(NULL));
  for (i = 0; i < 10000000; i++) {
    mass[i] = rand() % 100;
    printf("%.1f ", mass[i]);
  }
  printf("\n");
  k = mass[0];
  for (i = l; i < 10000000 - 1; i++) {
    l = mass[i];
    mass[i] = (k + mass[i + 1]) / 2;
    k = l;
  }
  for (i = 0; i < 10000000; i++)
    printf("%.1f ", mass[i]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2625a20,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
movl   $0x0,-0x2625a14(%rbp)
cmpl   $0x989680,-0x2625a14(%rbp)
jge    11d5 <main+0x95>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
cvtsi2ss %edx,%xmm0
movslq -0x2625a14(%rbp),%rax
movss  %xmm0,-0x2625a10(%rbp,%rax,4)
9d fd
movslq -0x2625a14(%rbp),%rax
movss  -0x2625a10(%rbp,%rax,4),%xmm0
9d fd
cvtss2sd %xmm0,%xmm0
lea    0xe4a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x2625a14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2625a14(%rbp)
jmp    116c <main+0x2c>
lea    0xe2e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x2625a10(%rbp),%xmm0
fd
movss  %xmm0,-0x8(%rbp)
cvttss2si -0xc(%rbp),%eax
mov    %eax,-0x2625a14(%rbp)
cmpl   $0x98967f,-0x2625a14(%rbp)
jge    1273 <main+0x133>
movslq -0x2625a14(%rbp),%rax
movss  -0x2625a10(%rbp,%rax,4),%xmm0
9d fd
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
mov    -0x2625a14(%rbp),%eax
add    $0x1,%eax
cltq
addss  -0x2625a10(%rbp,%rax,4),%xmm0
9d fd
movss  0xdbf(%rip),%xmm1
divss  %xmm1,%xmm0
movslq -0x2625a14(%rbp),%rax
movss  %xmm0,-0x2625a10(%rbp,%rax,4)
9d fd
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
mov    -0x2625a14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2625a14(%rbp)
jmp    11fb <main+0xbb>
movl   $0x0,-0x2625a14(%rbp)
cmpl   $0x989680,-0x2625a14(%rbp)
jge    12c3 <main+0x183>
movslq -0x2625a14(%rbp),%rax
movss  -0x2625a10(%rbp,%rax,4),%xmm0
9d fd
cvtss2sd %xmm0,%xmm0
lea    0xd5c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x2625a14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2625a14(%rbp)
jmp    127d <main+0x13d>
mov    -0x4(%rbp),%eax
add    $0x2625a20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x2625a08,%rsp
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
lea    0xe91(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,(%rsp,%rbx,4)
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    $0x989680,%rbx
jne    1180 <main+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %ebx,%ebx
lea    0xe24(%rip),%r14
nopl   0x0(%rax)
movss  (%rsp,%rbx,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    $0x989680,%rbx
jne    11e0 <main+0x90>
xor    %eax,%eax
add    $0x2625a08,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"%.1f \00"
define i32 @main() {
%1 = alloca [10000000 x float]
%2 = bitcast [10000000 x float]* %1 to i8*
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand(i32 %3)
br label %5
5: ; preds = %0, %5
%6 = phi i64 [ 0, %0 ], [ %13, %5 ]
%7 = tail call i32 (...) @rand()
%8 = srem i32 %7, 100
%9 = sitofp i32 %8 to float
%10 = getelementptr inbounds [10000000 x float], [10000000 x float]* %1, i64 0, i64 %6
store float %9, float* %10
%11 = fpext float %9 to double
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %11)
%13 = add nuw nsw i64 %6, 1
%14 = icmp eq i64 %13, 10000000
br i1 %14, label %15, label %5
15: ; preds = %5
%16 = tail call i32 @putchar(i32 10)
br label %17
17: ; preds = %15, %17
%18 = phi i64 [ 0, %15 ], [ %23, %17 ]
%19 = getelementptr inbounds [10000000 x float], [10000000 x float]* %1, i64 0, i64 %18
%20 = load float, float* %19
%21 = fpext float %20 to double
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %21)
%23 = add nuw nsw i64 %18, 1
%24 = icmp eq i64 %23, 10000000
br i1 %24, label %25, label %17
25: ; preds = %17
ret i32 0
}