#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 */
float cos_sum_range(float, int);
int /*<<< orphan*/ printf(char *, float);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int x = -1;
  while (x <= 0 || x >= 10)
    scanf("%d", &x);
  float arr[9], start = 0;
  for (int i = 0; i < 10; i++) {
    arr[i] = cos_sum_range(start, x);
    start = x;
    x *= 2;
  }
  for (int i = 0; i < 10; ++i)
    printf("%f\n", arr[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffff,-0x8(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x3d(%rbp)
jle    115f <main+0x2f>
cmpl   $0xa,-0x8(%rbp)
setge  %al
mov    %al,-0x3d(%rbp)
mov    -0x3d(%rbp),%al
test   $0x1,%al
jne    116f <main+0x3f>
jmp    1184 <main+0x54>
lea    0xe8a(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
jmp    1146 <main+0x16>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
cmpl   $0xa,-0x38(%rbp)
jge    11d5 <main+0xa5>
movss  -0x34(%rbp),%xmm0
mov    -0x8(%rbp),%edi
call   1040 <cos_sum_range@plt>
movslq -0x38(%rbp),%rax
movss  %xmm0,-0x30(%rbp,%rax,4)
cvtsi2ssl -0x8(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1193 <main+0x63>
movl   $0x0,-0x3c(%rbp)
cmpl   $0xa,-0x3c(%rbp)
jge    120a <main+0xda>
movslq -0x3c(%rbp),%rax
movss  -0x30(%rbp,%rax,4),%xmm0
lea    0xe0c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11dc <main+0xac>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
movl   $0xffffffff,(%rsp)
lea    0xebb(%rip),%r14
mov    %rsp,%rbx
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    (%rsp),%edi
lea    -0xa(%rdi),%eax
cmp    $0xfffffff7,%eax
jb     1150 <main+0x20>
xorps  %xmm0,%xmm0
call   1040 <cos_sum_range@plt>
mov    (%rsp),%edi
cvtsi2ss %edi,%xmm1
movss  %xmm0,0x24(%rsp)
add    %edi,%edi
mov    %edi,(%rsp)
movaps %xmm1,%xmm0
call   1040 <cos_sum_range@plt>
mov    (%rsp),%edi
xorps  %xmm1,%xmm1
cvtsi2ss %edi,%xmm1
movss  %xmm0,0x20(%rsp)
add    %edi,%edi
mov    %edi,(%rsp)
movaps %xmm1,%xmm0
call   1040 <cos_sum_range@plt>
mov    (%rsp),%edi
xorps  %xmm1,%xmm1
cvtsi2ss %edi,%xmm1
movss  %xmm0,0x1c(%rsp)
add    %edi,%edi
mov    %edi,(%rsp)
movaps %xmm1,%xmm0
call   1040 <cos_sum_range@plt>
mov    (%rsp),%edi
xorps  %xmm1,%xmm1
cvtsi2ss %edi,%xmm1
movss  %xmm0,0x18(%rsp)
add    %edi,%edi
mov    %edi,(%rsp)
movaps %xmm1,%xmm0
call   1040 <cos_sum_range@plt>
mov    (%rsp),%edi
xorps  %xmm1,%xmm1
cvtsi2ss %edi,%xmm1
movss  %xmm0,0x14(%rsp)
add    %edi,%edi
mov    %edi,(%rsp)
movaps %xmm1,%xmm0
call   1040 <cos_sum_range@plt>
mov    (%rsp),%edi
xorps  %xmm1,%xmm1
cvtsi2ss %edi,%xmm1
movss  %xmm0,0x10(%rsp)
add    %edi,%edi
mov    %edi,(%rsp)
movaps %xmm1,%xmm0
call   1040 <cos_sum_range@plt>
mov    (%rsp),%edi
xorps  %xmm1,%xmm1
cvtsi2ss %edi,%xmm1
movss  %xmm0,0xc(%rsp)
add    %edi,%edi
mov    %edi,(%rsp)
movaps %xmm1,%xmm0
call   1040 <cos_sum_range@plt>
mov    (%rsp),%edi
xorps  %xmm1,%xmm1
cvtsi2ss %edi,%xmm1
movss  %xmm0,0x8(%rsp)
add    %edi,%edi
mov    %edi,(%rsp)
movaps %xmm1,%xmm0
call   1040 <cos_sum_range@plt>
mov    (%rsp),%edi
xorps  %xmm1,%xmm1
cvtsi2ss %edi,%xmm1
movss  %xmm0,0x4(%rsp)
add    %edi,%edi
mov    %edi,(%rsp)
movaps %xmm1,%xmm0
call   1040 <cos_sum_range@plt>
shll   (%rsp)
lea    0xd89(%rip),%rbx
mov    %rbx,%rdi
movss  0x24(%rsp),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
movss  0x20(%rsp),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
movss  0x1c(%rsp),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
movss  0x18(%rsp),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
movss  0x14(%rsp),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
movss  0x10(%rsp),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
movss  0xc(%rsp),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
movss  0x8(%rsp),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
movss  0x4(%rsp),%xmm0
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [9 x float]
%4 = alloca float
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 -1, i32* %2
br label %7
7: ; preds = %15, %0
%8 = load i32, i32* %2
%9 = icmp sle i32 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = load i32, i32* %2
%12 = icmp sge i32 %11, 10
br label %13
13: ; preds = %10, %7
%14 = phi i1 [ true, %7 ], [ %12, %10 ]
br i1 %14, label %15, label %17
15: ; preds = %13
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %7
17: ; preds = %13
store float 0.000000e+00, float* %4
store i32 0, i32* %5
br label %18
18: ; preds = %32, %17
%19 = load i32, i32* %5
%20 = icmp slt i32 %19, 10
br i1 %20, label %21, label %35
21: ; preds = %18
%22 = load float, float* %4
%23 = load i32, i32* %2
%24 = call float @cos_sum_range(float %22, i32 %23)
%25 = load i32, i32* %5
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [9 x float], [9 x float]* %3, i64 0, i64 %26
store float %24, float* %27
%28 = load i32, i32* %2
%29 = sitofp i32 %28 to float
store float %29, float* %4
%30 = load i32, i32* %2
%31 = mul nsw i32 %30, 2
store i32 %31, i32* %2
br label %32
32: ; preds = %21
%33 = load i32, i32* %5
%34 = add nsw i32 %33, 1
store i32 %34, i32* %5
br label %18
35: ; preds = %18
store i32 0, i32* %6
br label %36
36: ; preds = %45, %35
%37 = load i32, i32* %6
%38 = icmp slt i32 %37, 10
br i1 %38, label %39, label %48
39: ; preds = %36
%40 = load i32, i32* %6
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [9 x float], [9 x float]* %3, i64 0, i64 %41
%43 = load float, float* %42
%44 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), float %43)
br label %45
45: ; preds = %39
%46 = load i32, i32* %6
%47 = add nsw i32 %46, 1
store i32 %47, i32* %6
br label %36
48: ; preds = %36
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 -1, i32* %1
br label %3
3: ; preds = %0, %3
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = add i32 %5, -10
%7 = icmp ult i32 %6, -9
br i1 %7, label %3, label %8
8: ; preds = %3
%9 = call float @cos_sum_range(float 0.000000e+00, i32 %5)
%10 = load i32, i32* %1
%11 = sitofp i32 %10 to float
%12 = shl nsw i32 %10, 1
store i32 %12, i32* %1
%13 = call float @cos_sum_range(float %11, i32 %12)
%14 = load i32, i32* %1
%15 = sitofp i32 %14 to float
%16 = shl nsw i32 %14, 1
store i32 %16, i32* %1
%17 = call float @cos_sum_range(float %15, i32 %16)
%18 = load i32, i32* %1
%19 = sitofp i32 %18 to float
%20 = shl nsw i32 %18, 1
store i32 %20, i32* %1
%21 = call float @cos_sum_range(float %19, i32 %20)
%22 = load i32, i32* %1
%23 = sitofp i32 %22 to float
%24 = shl nsw i32 %22, 1
store i32 %24, i32* %1
%25 = call float @cos_sum_range(float %23, i32 %24)
%26 = load i32, i32* %1
%27 = sitofp i32 %26 to float
%28 = shl nsw i32 %26, 1
store i32 %28, i32* %1
%29 = call float @cos_sum_range(float %27, i32 %28)
%30 = load i32, i32* %1
%31 = sitofp i32 %30 to float
%32 = shl nsw i32 %30, 1
store i32 %32, i32* %1
%33 = call float @cos_sum_range(float %31, i32 %32)
%34 = load i32, i32* %1
%35 = sitofp i32 %34 to float
%36 = shl nsw i32 %34, 1
store i32 %36, i32* %1
%37 = call float @cos_sum_range(float %35, i32 %36)
%38 = load i32, i32* %1
%39 = sitofp i32 %38 to float
%40 = shl nsw i32 %38, 1
store i32 %40, i32* %1
%41 = call float @cos_sum_range(float %39, i32 %40)
%42 = load i32, i32* %1
%43 = sitofp i32 %42 to float
%44 = shl nsw i32 %42, 1
store i32 %44, i32* %1
%45 = call float @cos_sum_range(float %43, i32 %44)
%46 = load i32, i32* %1
%47 = shl nsw i32 %46, 1
store i32 %47, i32* %1
%48 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), float %9)
%49 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), float %13)
%50 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), float %17)
%51 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), float %21)
%52 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), float %25)
%53 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), float %29)
%54 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), float %33)
%55 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), float %37)
%56 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), float %41)
%57 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), float poison)
ret i32 0
}