#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 */
scalar_t__ pow(double, double);
int /*<<< orphan*/ printf(char *, double);
int main(void) {
  int data[] = {17, 39, 1, 9, 5, 24, 2, 11, 23, 6};
  int i, sum = 0;
  double avg, var = 0.0;
  for (i = 0; i < 10; i++) {
    sum += data[i];
  }
  avg = sum / 10.0;
  for (i = 0; i < 10; i++) {
    var += pow(avg - data[i], 2.0);
  }
  var /= 9.0;
  printf("平均: %f¥n", avg);
  printf("分散: %f¥n", var);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xed6(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
movl   $0x0,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    1190 <main+0x60>
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
add    -0x38(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    116a <main+0x3a>
cvtsi2sdl -0x38(%rbp),%xmm0
movsd  0xe63(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    11f4 <main+0xc4>
movsd  -0x40(%rbp),%xmm0
movslq -0x34(%rbp),%rax
cvtsi2sdl -0x30(%rbp,%rax,4),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe3e(%rip),%xmm1
call   1050 <pow@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11ad <main+0x7d>
movsd  -0x48(%rbp),%xmm0
movsd  0xe07(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
lea    0xe32(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x48(%rbp),%xmm0
lea    0xe2f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movsd  0xed7(%rip),%xmm0
movsd  0xed7(%rip),%xmm1
call   1040 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  %xmm0,(%rsp)
movsd  0xec5(%rip),%xmm0
movsd  0xeb5(%rip),%xmm1
call   1040 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0xea6(%rip),%xmm0
movsd  0xe8e(%rip),%xmm1
call   1040 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0xe87(%rip),%xmm0
movsd  0xe67(%rip),%xmm1
call   1040 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0xe68(%rip),%xmm0
movsd  0xe40(%rip),%xmm1
call   1040 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0xe49(%rip),%xmm0
movsd  0xe19(%rip),%xmm1
call   1040 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0xe2a(%rip),%xmm0
movsd  0xdf2(%rip),%xmm1
call   1040 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0xe0b(%rip),%xmm0
movsd  0xdcb(%rip),%xmm1
call   1040 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0xdec(%rip),%xmm0
movsd  0xda4(%rip),%xmm1
call   1040 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0xdcd(%rip),%xmm0
movsd  0xd7d(%rip),%xmm1
call   1040 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  (%rsp),%xmm0
divsd  0xdb3(%rip),%xmm0
movsd  %xmm0,(%rsp)
lea    0xdb7(%rip),%rdi
movsd  0xda7(%rip),%xmm0
call   1030 <printf@plt>
lea    0xdb1(%rip),%rdi
movsd  (%rsp),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.data = [10 x i32] [i32 17, i32 39, i32 1, i32 9, i32 5, i32 24, i32 2, i32 11, i32 23, i32 6]
@.str = [14 x i8] c"\E5\B9\B3\E5\9D\87: %f\C2\A5n\00"
@.str.1 = [14 x i8] c"\E5\88\86\E6\95\A3: %f\C2\A5n\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
%6 = alloca double
store i32 0, i32* %1
%7 = bitcast [10 x i32]* %2 to i8*
store i32 0, i32* %4
store double 0.000000e+00, double* %6
store i32 0, i32* %3
br label %8
8: ; preds = %18, %0
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 10
br i1 %10, label %11, label %21
11: ; preds = %8
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %13
%15 = load i32, i32* %14
%16 = load i32, i32* %4
%17 = add nsw i32 %16, %15
store i32 %17, i32* %4
br label %18
18: ; preds = %11
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %8
21: ; preds = %8
%22 = load i32, i32* %4
%23 = sitofp i32 %22 to double
%24 = fdiv double %23, 1.000000e+01
store double %24, double* %5
store i32 0, i32* %3
br label %25
25: ; preds = %40, %21
%26 = load i32, i32* %3
%27 = icmp slt i32 %26, 10
br i1 %27, label %28, label %43
28: ; preds = %25
%29 = load double, double* %5
%30 = load i32, i32* %3
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = sitofp i32 %33 to double
%35 = fsub double %29, %34
%36 = call i64 @pow(double %35, double 2.000000e+00)
%37 = sitofp i64 %36 to double
%38 = load double, double* %6
%39 = fadd double %38, %37
store double %39, double* %6
br label %40
40: ; preds = %28
%41 = load i32, i32* %3
%42 = add nsw i32 %41, 1
store i32 %42, i32* %3
br label %25
43: ; preds = %25
%44 = load double, double* %6
%45 = fdiv double %44, 9.000000e+00
store double %45, double* %6
%46 = load double, double* %5
%47 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), double %46)
%48 = load double, double* %6
%49 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), double %48)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"\E5\B9\B3\E5\9D\87: %f\C2\A5n\00"
@.str.1 = [14 x i8] c"\E5\88\86\E6\95\A3: %f\C2\A5n\00"
define i32 @main() {
%1 = tail call i64 @pow(double 0xC00A666666666668, double 2.000000e+00)
%2 = sitofp i64 %1 to double
%3 = tail call i64 @pow(double -2.530000e+01, double 2.000000e+00)
%4 = sitofp i64 %3 to double
%5 = fadd double %2, %4
%6 = tail call i64 @pow(double 1.270000e+01, double 2.000000e+00)
%7 = sitofp i64 %6 to double
%8 = fadd double %5, %7
%9 = tail call i64 @pow(double 0x4012CCCCCCCCCCCC, double 2.000000e+00)
%10 = sitofp i64 %9 to double
%11 = fadd double %8, %10
%12 = tail call i64 @pow(double 0x4021666666666666, double 2.000000e+00)
%13 = sitofp i64 %12 to double
%14 = fadd double %11, %13
%15 = tail call i64 @pow(double -1.030000e+01, double 2.000000e+00)
%16 = sitofp i64 %15 to double
%17 = fadd double %14, %16
%18 = tail call i64 @pow(double 1.170000e+01, double 2.000000e+00)
%19 = sitofp i64 %18 to double
%20 = fadd double %17, %19
%21 = tail call i64 @pow(double 0x4005999999999998, double 2.000000e+00)
%22 = sitofp i64 %21 to double
%23 = fadd double %20, %22
%24 = tail call i64 @pow(double -9.300000e+00, double 2.000000e+00)
%25 = sitofp i64 %24 to double
%26 = fadd double %23, %25
%27 = tail call i64 @pow(double 0x401ECCCCCCCCCCCC, double 2.000000e+00)
%28 = sitofp i64 %27 to double
%29 = fadd double %26, %28
%30 = fdiv double %29, 9.000000e+00
%31 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), double 1.370000e+01)
%32 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), double %30)
ret i32 0
}