#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 RAND_MAX;
int /*<<< orphan*/ printf(char *, float);
scalar_t__ rand();
int /*<<< orphan*/ srand(unsigned int);
int main(int argc, char **argv) {
  int i;
  float a[10], b[10], s;
  unsigned int seed = 10;
  srand(seed);
  for (i = 0; i < 10; ++i) {
    a[i] = (float)rand() / (float)(RAND_MAX / 10);
    b[i] = (float)rand() / (float)(RAND_MAX / 10);
  }
  for (i = 0; i < 10; ++i) {
    printf("a[i]"
           " ==> %f\n",
           a[i]);
    printf("b[i]"
           " ==> %f\n",
           b[i]);
  }
  s = 0.0;
  for (i = 0; i < 10; ++i) {
    s = s + a[i] * b[i];
  }
  printf("%f \n", s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xa,-0x78(%rbp)
mov    -0x78(%rbp),%edi
call   1040 <srand@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    11d5 <main+0xa5>
mov    $0x0,%al
call   1050 <rand@plt>
cvtsi2ss %rax,%xmm0
mov    0x2e6c(%rip),%rax
mov    (%rax),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm1
divss  %xmm1,%xmm0
movslq -0x14(%rbp),%rax
movss  %xmm0,-0x40(%rbp,%rax,4)
mov    $0x0,%al
call   1050 <rand@plt>
cvtsi2ss %rax,%xmm0
mov    0x2e3d(%rip),%rax
mov    (%rax),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm1
divss  %xmm1,%xmm0
movslq -0x14(%rbp),%rax
movss  %xmm0,-0x70(%rbp,%rax,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115f <main+0x2f>
movl   $0x0,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    1220 <main+0xf0>
movslq -0x14(%rbp),%rax
movss  -0x40(%rbp,%rax,4),%xmm0
lea    0xe09(%rip),%rdi
call   1030 <printf@plt>
movslq -0x14(%rbp),%rax
movss  -0x70(%rbp,%rax,4),%xmm0
lea    0xe00(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11dc <main+0xac>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x74(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    126d <main+0x13d>
movss  -0x74(%rbp),%xmm1
movslq -0x14(%rbp),%rax
movss  -0x40(%rbp,%rax,4),%xmm0
movslq -0x14(%rbp),%rax
movss  -0x70(%rbp,%rax,4),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x74(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    122f <main+0xff>
movss  -0x74(%rbp),%xmm0
lea    0xda1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0xa8,%rsp
mov    $0xa,%edi
call   1040 <srand@plt>
mov    0x2e9d(%rip),%r14
xor    %ebx,%ebx
nopl   (%rax)
xor    %eax,%eax
call   1050 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
movslq (%r14),%rax
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
xorps  %xmm1,%xmm1
cvtsi2ss %eax,%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,0x80(%rsp,%rbx,4)
xor    %eax,%eax
call   1050 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
movslq (%r14),%rax
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
xorps  %xmm1,%xmm1
cvtsi2ss %eax,%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,0x50(%rsp,%rbx,4)
add    $0x1,%rbx
cmp    $0xa,%rbx
jne    1150 <main+0x20>
movss  0x80(%rsp),%xmm0
movss  %xmm0,0x4c(%rsp)
lea    0xe1f(%rip),%r14
mov    %r14,%rdi
call   1030 <printf@plt>
movss  0x50(%rsp),%xmm0
movss  %xmm0,0x48(%rsp)
lea    0xe11(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
movss  0x84(%rsp),%xmm0
movss  %xmm0,0x44(%rsp)
mov    %r14,%rdi
call   1030 <printf@plt>
movss  0x54(%rsp),%xmm0
movss  %xmm0,0x40(%rsp)
mov    %rbx,%rdi
call   1030 <printf@plt>
movss  0x88(%rsp),%xmm0
movss  %xmm0,0x3c(%rsp)
mov    %r14,%rdi
call   1030 <printf@plt>
movss  0x58(%rsp),%xmm0
movss  %xmm0,0x38(%rsp)
mov    %rbx,%rdi
call   1030 <printf@plt>
movss  0x8c(%rsp),%xmm0
movss  %xmm0,0x34(%rsp)
mov    %r14,%rdi
call   1030 <printf@plt>
movss  0x5c(%rsp),%xmm0
movss  %xmm0,0x30(%rsp)
mov    %rbx,%rdi
call   1030 <printf@plt>
movss  0x90(%rsp),%xmm0
movss  %xmm0,0x2c(%rsp)
mov    %r14,%rdi
call   1030 <printf@plt>
movss  0x60(%rsp),%xmm0
movss  %xmm0,0x28(%rsp)
mov    %rbx,%rdi
call   1030 <printf@plt>
movss  0x94(%rsp),%xmm0
movss  %xmm0,0x24(%rsp)
mov    %r14,%rdi
call   1030 <printf@plt>
movss  0x64(%rsp),%xmm0
movss  %xmm0,0x20(%rsp)
mov    %rbx,%rdi
call   1030 <printf@plt>
movss  0x98(%rsp),%xmm0
movss  %xmm0,0x1c(%rsp)
mov    %r14,%rdi
call   1030 <printf@plt>
movss  0x68(%rsp),%xmm0
movss  %xmm0,0x18(%rsp)
mov    %rbx,%rdi
call   1030 <printf@plt>
movss  0x9c(%rsp),%xmm0
movss  %xmm0,0x14(%rsp)
mov    %r14,%rdi
call   1030 <printf@plt>
movss  0x6c(%rsp),%xmm0
movss  %xmm0,0x10(%rsp)
mov    %rbx,%rdi
call   1030 <printf@plt>
movss  0xa0(%rsp),%xmm0
movss  %xmm0,0xc(%rsp)
mov    %r14,%rdi
call   1030 <printf@plt>
movss  0x70(%rsp),%xmm0
movss  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
call   1030 <printf@plt>
movss  0xa4(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
mov    %r14,%rdi
call   1030 <printf@plt>
movss  0x74(%rsp),%xmm0
movss  %xmm0,(%rsp)
mov    %rbx,%rdi
call   1030 <printf@plt>
movss  0x4c(%rsp),%xmm1
mulss  0x48(%rsp),%xmm1
xorps  %xmm0,%xmm0
addss  %xmm1,%xmm0
movss  0x44(%rsp),%xmm1
mulss  0x40(%rsp),%xmm1
addss  %xmm0,%xmm1
movss  0x3c(%rsp),%xmm0
mulss  0x38(%rsp),%xmm0
addss  %xmm1,%xmm0
movss  0x34(%rsp),%xmm1
mulss  0x30(%rsp),%xmm1
addss  %xmm0,%xmm1
movss  0x2c(%rsp),%xmm0
mulss  0x28(%rsp),%xmm0
addss  %xmm1,%xmm0
movss  0x24(%rsp),%xmm1
mulss  0x20(%rsp),%xmm1
addss  %xmm0,%xmm1
movss  0x1c(%rsp),%xmm0
mulss  0x18(%rsp),%xmm0
addss  %xmm1,%xmm0
movss  0x14(%rsp),%xmm1
mulss  0x10(%rsp),%xmm1
addss  %xmm0,%xmm1
movss  0xc(%rsp),%xmm0
mulss  0x8(%rsp),%xmm0
addss  %xmm1,%xmm0
movss  0x4(%rsp),%xmm1
mulss  (%rsp),%xmm1
addss  %xmm0,%xmm1
movaps %xmm1,%xmm0
lea    0xbe8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xa8,%rsp
pop    %rbx
pop    %r14
ret

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

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