#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 */
double cheb(double, int);
double f0(double);
double f11(double);
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ scanf(char *, int);
double sqrt(double);
int main() {
  const double pi = 3.13;
  double step = 0.01;
  int i, j, n;
  double mnog, c, Q, e1, e, sko, a[20], Q1[314], F1[314];
  scanf("%d", n);
  a[0] = 0;
  c = 0;
  c += step;
  while (c <= pi) {
    a[0] += f0(c) * step * 2 / (f11(c) * 3.14 * 3.14);
    c += step;
  }
  printf("a[0]=%f", a[0]);
  for (i = 1; i <= n; i++) {
    a[i] = 0;
    c = 0;
    c += step;
    while (c <= pi) {
      mnog = cheb(c, i);
      a[i] += f0(c) * mnog * step * 4 / (f11(c) * 3.14 * 3.14);
      c += step;
    }
  }
  c = 0;
  j = 0;
  while (c <= pi) {
    Q = 0;
    for (i = 0; i <= n; i++) {
      mnog = cheb(c, i);
      Q = Q + a[i] * mnog;
    }
    Q1[j] = Q;
    F1[j] = f0(c);
    printf("c=%f    ", c);
    printf("Q=%f    ", Q1[j]);
    printf("F0=%f", F1[j]);
    c += step;
    j++;
  }
  sko = 0;
  for (i = 0; i <= pi * 100; i++)
    sko = sko + (F1[i] - Q1[i]) * (F1[i] - Q1[i]);
  sko = sqrt(sko / (pi * 100));
  printf("SKO=%f", sko);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x14b0,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xe8e(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe79(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x24(%rbp),%esi
lea    0xe9a(%rip),%rdi
call   1070 <scanf@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x100(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe43(%rip),%xmm0
ucomisd -0x38(%rbp),%xmm0
jb     1248 <main+0xe8>
movsd  -0x38(%rbp),%xmm0
call   1030 <f0@plt>
mulsd  -0x18(%rbp),%xmm0
movsd  0xe41(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x14a8(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
call   1050 <f11@plt>
movaps %xmm0,%xmm1
movsd  -0x14a8(%rbp),%xmm0
ff
movsd  0xe08(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xdfc(%rip),%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
addsd  -0x100(%rbp),%xmm0
ff
movsd  %xmm0,-0x100(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    11bd <main+0x5d>
movsd  -0x100(%rbp),%xmm0
ff
lea    0xddc(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jg     1351 <main+0x1f1>
movslq -0x1c(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x100(%rbp,%rax,8)
ff ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xd6a(%rip),%xmm0
ucomisd -0x38(%rbp),%xmm0
jb     133e <main+0x1de>
movsd  -0x38(%rbp),%xmm0
mov    -0x1c(%rbp),%edi
call   1060 <cheb@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1030 <f0@plt>
mulsd  -0x30(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  0xd49(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x14b0(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
call   1050 <f11@plt>
movaps %xmm0,%xmm1
movsd  -0x14b0(%rbp),%xmm0
ff
movsd  0xd18(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xd0c(%rip),%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movslq -0x1c(%rbp),%rax
addsd  -0x100(%rbp,%rax,8),%xmm0
ff ff
movsd  %xmm0,-0x100(%rbp,%rax,8)
ff ff
movsd  -0x18(%rbp),%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    1296 <main+0x136>
jmp    1343 <main+0x1e3>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1263 <main+0x103>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
movl   $0x0,-0x20(%rbp)
movsd  0xca0(%rip),%xmm0
ucomisd -0x38(%rbp),%xmm0
jb     145b <main+0x2fb>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jg     13d2 <main+0x272>
movsd  -0x38(%rbp),%xmm0
mov    -0x1c(%rbp),%edi
call   1060 <cheb@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x40(%rbp),%xmm1
movslq -0x1c(%rbp),%rax
movsd  -0x100(%rbp,%rax,8),%xmm0
ff ff
movsd  -0x30(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1382 <main+0x222>
movsd  -0x40(%rbp),%xmm0
movslq -0x20(%rbp),%rax
movsd  %xmm0,-0xad0(%rbp,%rax,8)
ff ff
movsd  -0x38(%rbp),%xmm0
call   1030 <f0@plt>
movslq -0x20(%rbp),%rax
movsd  %xmm0,-0x14a0(%rbp,%rax,8)
ff ff
movsd  -0x38(%rbp),%xmm0
lea    0xc34(%rip),%rdi
call   1040 <printf@plt>
movslq -0x20(%rbp),%rax
movsd  -0xad0(%rbp,%rax,8),%xmm0
ff ff
lea    0xc24(%rip),%rdi
call   1040 <printf@plt>
movslq -0x20(%rbp),%rax
movsd  -0x14a0(%rbp,%rax,8),%xmm0
ff ff
lea    0xc14(%rip),%rdi
call   1040 <printf@plt>
movsd  -0x18(%rbp),%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1360 <main+0x200>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
movl   $0x0,-0x1c(%rbp)
cvtsi2sdl -0x1c(%rbp),%xmm1
movsd  0xb99(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     14d5 <main+0x375>
movsd  -0x58(%rbp),%xmm1
movslq -0x1c(%rbp),%rax
movsd  -0x14a0(%rbp,%rax,8),%xmm0
ff ff
movslq -0x1c(%rbp),%rax
subsd  -0xad0(%rbp,%rax,8),%xmm0
ff ff
movslq -0x1c(%rbp),%rax
movsd  -0x14a0(%rbp,%rax,8),%xmm2
ff ff
movslq -0x1c(%rbp),%rax
subsd  -0xad0(%rbp,%rax,8),%xmm2
ff ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    146a <main+0x30a>
movsd  -0x58(%rbp),%xmm0
movsd  0xb2e(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1080 <sqrt@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
lea    0xb57(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x14b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xed4(%rip),%rdi
call   1070 <scanf@plt>
xorpd  %xmm0,%xmm0
movsd  0xe93(%rip),%xmm1
nopl   (%rax)
movsd  %xmm1,(%rsp)
movsd  %xmm0,0x8(%rsp)
movapd %xmm1,%xmm0
call   1030 <f0@plt>
movapd %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
call   1050 <f11@plt>
movapd 0x10(%rsp),%xmm1
unpcklpd %xmm0,%xmm1
mulpd  0xe6a(%rip),%xmm1
mulpd  0xe72(%rip),%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
divsd  %xmm0,%xmm1
movsd  0x8(%rsp),%xmm0
addsd  %xmm1,%xmm0
movsd  (%rsp),%xmm1
addsd  0xe2f(%rip),%xmm1
movsd  %xmm1,(%rsp)
movsd  0xe2a(%rip),%xmm1
ucomisd (%rsp),%xmm1
movsd  (%rsp),%xmm1
jae    1170 <main+0x20>
lea    0xe42(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%ebx
movsd  0xdfd(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movapd %xmm0,%xmm1
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  %xmm1,(%rsp)
movapd %xmm1,%xmm0
mov    %ebx,%edi
call   1060 <cheb@plt>
movsd  (%rsp),%xmm0
call   1030 <f0@plt>
movsd  (%rsp),%xmm0
call   1050 <f11@plt>
movsd  (%rsp),%xmm1
movsd  0xdaf(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xdab(%rip),%xmm2
ucomisd %xmm1,%xmm2
jae    1220 <main+0xd0>
add    $0x1,%rbx
jmp    1210 <main+0xc0>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [8 x i8] c"a[0]=%f\00"
@.str.2 = [9 x i8] c"c=%f \00"
@.str.3 = [9 x i8] c"Q=%f \00"
@.str.4 = [6 x i8] c"F0=%f\00"
@.str.5 = [7 x i8] c"SKO=%f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca [20 x double]
%14 = alloca [314 x double]
%15 = alloca [314 x double]
store i32 0, i32* %1
store double 3.130000e+00, double* %2
store double 1.000000e-02, double* %3
%16 = load i32, i32* %6
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = getelementptr inbounds [20 x double], [20 x double]* %13, i64 0, i64 0
store double 0.000000e+00, double* %18
store double 0.000000e+00, double* %8
%19 = load double, double* %3
%20 = load double, double* %8
%21 = fadd double %20, %19
store double %21, double* %8
br label %22
22: ; preds = %25, %0
%23 = load double, double* %8
%24 = fcmp ole double %23, 3.130000e+00
br i1 %24, label %25, label %42
25: ; preds = %22
%26 = load double, double* %8
%27 = call double @f0(double %26)
%28 = load double, double* %3
%29 = fmul double %27, %28
%30 = fmul double %29, 2.000000e+00
%31 = load double, double* %8
%32 = call double @f11(double %31)
%33 = fmul double %32, 3.140000e+00
%34 = fmul double %33, 3.140000e+00
%35 = fdiv double %30, %34
%36 = getelementptr inbounds [20 x double], [20 x double]* %13, i64 0, i64 0
%37 = load double, double* %36
%38 = fadd double %37, %35
store double %38, double* %36
%39 = load double, double* %3
%40 = load double, double* %8
%41 = fadd double %40, %39
store double %41, double* %8
br label %22
42: ; preds = %22
%43 = getelementptr inbounds [20 x double], [20 x double]* %13, i64 0, i64 0
%44 = load double, double* %43
%45 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %44)
store i32 1, i32* %4
br label %46
46: ; preds = %85, %42
%47 = load i32, i32* %4
%48 = load i32, i32* %6
%49 = icmp sle i32 %47, %48
br i1 %49, label %50, label %88
50: ; preds = %46
%51 = load i32, i32* %4
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [20 x double], [20 x double]* %13, i64 0, i64 %52
store double 0.000000e+00, double* %53
store double 0.000000e+00, double* %8
%54 = load double, double* %3
%55 = load double, double* %8
%56 = fadd double %55, %54
store double %56, double* %8
br label %57
57: ; preds = %60, %50
%58 = load double, double* %8
%59 = fcmp ole double %58, 3.130000e+00
br i1 %59, label %60, label %84
60: ; preds = %57
%61 = load double, double* %8
%62 = load i32, i32* %4
%63 = call double @cheb(double %61, i32 %62)
store double %63, double* %7
%64 = load double, double* %8
%65 = call double @f0(double %64)
%66 = load double, double* %7
%67 = fmul double %65, %66
%68 = load double, double* %3
%69 = fmul double %67, %68
%70 = fmul double %69, 4.000000e+00
%71 = load double, double* %8
%72 = call double @f11(double %71)
%73 = fmul double %72, 3.140000e+00
%74 = fmul double %73, 3.140000e+00
%75 = fdiv double %70, %74
%76 = load i32, i32* %4
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds [20 x double], [20 x double]* %13, i64 0, i64 %77
%79 = load double, double* %78
%80 = fadd double %79, %75
store double %80, double* %78
%81 = load double, double* %3
%82 = load double, double* %8
%83 = fadd double %82, %81
store double %83, double* %8
br label %57
84: ; preds = %57
br label %85
85: ; preds = %84
%86 = load i32, i32* %4
%87 = add nsw i32 %86, 1
store i32 %87, i32* %4
br label %46
88: ; preds = %46
store double 0.000000e+00, double* %8
store i32 0, i32* %5
br label %89
89: ; preds = %111, %88
%90 = load double, double* %8
%91 = fcmp ole double %90, 3.130000e+00
br i1 %91, label %92, label %138
92: ; preds = %89
store double 0.000000e+00, double* %9
store i32 0, i32* %4
br label %93
93: ; preds = %108, %92
%94 = load i32, i32* %4
%95 = load i32, i32* %6
%96 = icmp sle i32 %94, %95
br i1 %96, label %97, label %111
97: ; preds = %93
%98 = load double, double* %8
%99 = load i32, i32* %4
%100 = call double @cheb(double %98, i32 %99)
store double %100, double* %7
%101 = load double, double* %9
%102 = load i32, i32* %4
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds [20 x double], [20 x double]* %13, i64 0, i64 %103
%105 = load double, double* %104
%106 = load double, double* %7
%107 = call double @llvm.fmuladd.f64(double %105, double %106, double %101)
store double %107, double* %9
br label %108
108: ; preds = %97
%109 = load i32, i32* %4
%110 = add nsw i32 %109, 1
store i32 %110, i32* %4
br label %93
111: ; preds = %93
%112 = load double, double* %9
%113 = load i32, i32* %5
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds [314 x double], [314 x double]* %14, i64 0, i64 %114
store double %112, double* %115
%116 = load double, double* %8
%117 = call double @f0(double %116)
%118 = load i32, i32* %5
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds [314 x double], [314 x double]* %15, i64 0, i64 %119
store double %117, double* %120
%121 = load double, double* %8
%122 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), double %121)
%123 = load i32, i32* %5
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds [314 x double], [314 x double]* %14, i64 0, i64 %124
%126 = load double, double* %125
%127 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), double %126)
%128 = load i32, i32* %5
%129 = sext i32 %128 to i64
%130 = getelementptr inbounds [314 x double], [314 x double]* %15, i64 0, i64 %129
%131 = load double, double* %130
%132 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), double %131)
%133 = load double, double* %3
%134 = load double, double* %8
%135 = fadd double %134, %133
store double %135, double* %8
%136 = load i32, i32* %5
%137 = add nsw i32 %136, 1
store i32 %137, i32* %5
br label %89
138: ; preds = %89
store double 0.000000e+00, double* %12
store i32 0, i32* %4
br label %139
139: ; preds = %164, %138
%140 = load i32, i32* %4
%141 = sitofp i32 %140 to double
%142 = fcmp ole double %141, 3.130000e+02
br i1 %142, label %143, label %167
143: ; preds = %139
%144 = load double, double* %12
%145 = load i32, i32* %4
%146 = sext i32 %145 to i64
%147 = getelementptr inbounds [314 x double], [314 x double]* %15, i64 0, i64 %146
%148 = load double, double* %147
%149 = load i32, i32* %4
%150 = sext i32 %149 to i64
%151 = getelementptr inbounds [314 x double], [314 x double]* %14, i64 0, i64 %150
%152 = load double, double* %151
%153 = fsub double %148, %152
%154 = load i32, i32* %4
%155 = sext i32 %154 to i64
%156 = getelementptr inbounds [314 x double], [314 x double]* %15, i64 0, i64 %155
%157 = load double, double* %156
%158 = load i32, i32* %4
%159 = sext i32 %158 to i64
%160 = getelementptr inbounds [314 x double], [314 x double]* %14, i64 0, i64 %159
%161 = load double, double* %160
%162 = fsub double %157, %161
%163 = call double @llvm.fmuladd.f64(double %153, double %162, double %144)
store double %163, double* %12
br label %164
164: ; preds = %143
%165 = load i32, i32* %4
%166 = add nsw i32 %165, 1
store i32 %166, i32* %4
br label %139
167: ; preds = %139
%168 = load double, double* %12
%169 = fdiv double %168, 3.130000e+02
%170 = call double @sqrt(double %169)
store double %170, double* %12
%171 = load double, double* %12
%172 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), double %171)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [8 x i8] c"a[0]=%f\00"
define i32 @main() {
%1 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 undef)
br label %2
2: ; preds = %0, %2
%3 = phi double [ 1.000000e-02, %0 ], [ %15, %2 ]
%4 = phi double [ 0.000000e+00, %0 ], [ %14, %2 ]
%5 = tail call double @f0(double %3)
%6 = tail call double @f11(double %3)
%7 = insertelement <2 x double> poison, double %5, i64 0
%8 = insertelement <2 x double> %7, double %6, i64 1
%9 = fmul <2 x double> %8, <double 1.000000e-02, double 3.140000e+00>
%10 = fmul <2 x double> %9, <double 2.000000e+00, double 3.140000e+00>
%11 = extractelement <2 x double> %10, i64 0
%12 = extractelement <2 x double> %10, i64 1
%13 = fdiv double %11, %12
%14 = fadd double %4, %13
%15 = fadd double %3, 1.000000e-02
%16 = fcmp ugt double %15, 3.130000e+00
br i1 %16, label %17, label %2
17: ; preds = %2
%18 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %14)
br label %19
19: ; preds = %29, %17
%20 = phi i64 [ %30, %29 ], [ 1, %17 ]
%21 = trunc i64 %20 to i32
br label %22
22: ; preds = %19, %22
%23 = phi double [ 1.000000e-02, %19 ], [ %27, %22 ]
%24 = tail call double @cheb(double %23, i32 %21)
%25 = tail call double @f0(double %23)
%26 = tail call double @f11(double %23)
%27 = fadd double %23, 1.000000e-02
%28 = fcmp ugt double %27, 3.130000e+00
br i1 %28, label %29, label %22
29: ; preds = %22
%30 = add nuw i64 %20, 1
br label %19
}