#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(int);
int /*<<< orphan*/ printf(char *, float);
int /*<<< orphan*/ scanf(char *, int *);
int third_digit(float);
int main() {
  int x = -1;
  float result;
  while (x <= 0 || x >= 10)
    scanf("%d", &x);
  float arr[9];
  for (int i = 0; i <= 10; i++) {
    for (int count = 0;; count++) {
      result = cos(count);
      if (third_digit(result) == 1) {
        arr[i] = result;
        i++;
      }
      if (i == 10)
        break;
    }
  }
  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    116f <main+0x2f>
cmpl   $0xa,-0x8(%rbp)
setge  %al
mov    %al,-0x3d(%rbp)
mov    -0x3d(%rbp),%al
test   $0x1,%al
jne    117f <main+0x3f>
jmp    1194 <main+0x54>
lea    0xe7a(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
jmp    1156 <main+0x16>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jg     1219 <main+0xd9>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%edi
call   1060 <cos@plt>
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <third_digit@plt>
cmp    $0x1,%eax
jne    11e4 <main+0xa4>
movss  -0xc(%rbp),%xmm0
movslq -0x34(%rbp),%rax
movss  %xmm0,-0x30(%rbp,%rax,4)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jne    11f3 <main+0xb3>
jmp    1206 <main+0xc6>
jmp    11f8 <main+0xb8>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11ac <main+0x6c>
jmp    120b <main+0xcb>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    119b <main+0x5b>
movl   $0x0,-0x3c(%rbp)
cmpl   $0xa,-0x3c(%rbp)
jge    124e <main+0x10e>
movslq -0x3c(%rbp),%rax
movss  -0x30(%rbp,%rax,4),%xmm0
lea    0xdc8(%rip),%rdi
call   1040 <printf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1220 <main+0xe0>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
movl   $0xffffffff,0x8(%rsp)
ff
lea    0xeaa(%rip),%r14
lea    0x8(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    0x8(%rsp),%eax
add    $0xfffffff6,%eax
cmp    $0xfffffff7,%eax
jb     1160 <main+0x20>
xor    %r14d,%r14d
xor    %ebx,%ebx
jmp    1189 <main+0x49>
xchg   %ax,%ax
add    $0x1,%ebx
cmp    $0xa,%r14d
je     11b6 <main+0x76>
mov    %ebx,%edi
call   1060 <cos@plt>
movss  %xmm0,0xc(%rsp)
call   1030 <third_digit@plt>
cmp    $0x1,%eax
jne    1180 <main+0x40>
movslq %r14d,%r14
movss  0xc(%rsp),%xmm0
movss  %xmm0,0x10(%rsp,%r14,4)
add    $0x1,%r14d
jmp    1180 <main+0x40>
movss  0x10(%rsp),%xmm0
lea    0xe40(%rip),%rbx
mov    %rbx,%rdi
call   1040 <printf@plt>
movss  0x14(%rsp),%xmm0
mov    %rbx,%rdi
call   1040 <printf@plt>
movss  0x18(%rsp),%xmm0
mov    %rbx,%rdi
call   1040 <printf@plt>
movss  0x1c(%rsp),%xmm0
mov    %rbx,%rdi
call   1040 <printf@plt>
movss  0x20(%rsp),%xmm0
mov    %rbx,%rdi
call   1040 <printf@plt>
movss  0x24(%rsp),%xmm0
mov    %rbx,%rdi
call   1040 <printf@plt>
movss  0x28(%rsp),%xmm0
mov    %rbx,%rdi
call   1040 <printf@plt>
movss  0x2c(%rsp),%xmm0
mov    %rbx,%rdi
call   1040 <printf@plt>
movss  0x30(%rsp),%xmm0
mov    %rbx,%rdi
call   1040 <printf@plt>
movss  0x34(%rsp),%xmm0
mov    %rbx,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x38,%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 float
%4 = alloca [9 x float]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 -1, i32* %2
br label %8
8: ; preds = %16, %0
%9 = load i32, i32* %2
%10 = icmp sle i32 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %8
%12 = load i32, i32* %2
%13 = icmp sge i32 %12, 10
br label %14
14: ; preds = %11, %8
%15 = phi i1 [ true, %8 ], [ %13, %11 ]
br i1 %15, label %16, label %18
16: ; preds = %14
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %8
18: ; preds = %14
store i32 0, i32* %5
br label %19
19: ; preds = %45, %18
%20 = load i32, i32* %5
%21 = icmp sle i32 %20, 10
br i1 %21, label %22, label %48
22: ; preds = %19
store i32 0, i32* %6
br label %23
23: ; preds = %41, %22
%24 = load i32, i32* %6
%25 = call float @cos(i32 %24)
store float %25, float* %3
%26 = load float, float* %3
%27 = call i32 @third_digit(float %26)
%28 = icmp eq i32 %27, 1
br i1 %28, label %29, label %36
29: ; preds = %23
%30 = load float, float* %3
%31 = load i32, i32* %5
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [9 x float], [9 x float]* %4, i64 0, i64 %32
store float %30, float* %33
%34 = load i32, i32* %5
%35 = add nsw i32 %34, 1
store i32 %35, i32* %5
br label %36
36: ; preds = %29, %23
%37 = load i32, i32* %5
%38 = icmp eq i32 %37, 10
br i1 %38, label %39, label %40
39: ; preds = %36
br label %44
40: ; preds = %36
br label %41
41: ; preds = %40
%42 = load i32, i32* %6
%43 = add nsw i32 %42, 1
store i32 %43, i32* %6
br label %23
44: ; preds = %39
br label %45
45: ; preds = %44
%46 = load i32, i32* %5
%47 = add nsw i32 %46, 1
store i32 %47, i32* %5
br label %19
48: ; preds = %19
store i32 0, i32* %7
br label %49
49: ; preds = %58, %48
%50 = load i32, i32* %7
%51 = icmp slt i32 %50, 10
br i1 %51, label %52, label %61
52: ; preds = %49
%53 = load i32, i32* %7
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [9 x float], [9 x float]* %4, i64 0, i64 %54
%56 = load float, float* %55
%57 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), float %56)
br label %58
58: ; preds = %52
%59 = load i32, i32* %7
%60 = add nsw i32 %59, 1
store i32 %60, i32* %7
br label %49
61: ; preds = %49
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 = alloca [9 x float]
%3 = bitcast i32* %1 to i8*
store i32 -1, i32* %1
br label %4
4: ; preds = %0, %4
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = add i32 %6, -10
%8 = icmp ult i32 %7, -9
br i1 %8, label %4, label %9
9: ; preds = %4
%10 = bitcast [9 x float]* %2 to i8*
br label %11
11: ; preds = %21, %9
%12 = phi i32 [ %22, %21 ], [ 0, %9 ]
%13 = phi i32 [ %24, %21 ], [ 0, %9 ]
%14 = call float @cos(i32 %13)
%15 = call i32 @third_digit(float %14)
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %21
17: ; preds = %11
%18 = sext i32 %12 to i64
%19 = getelementptr inbounds [9 x float], [9 x float]* %2, i64 0, i64 %18
store float %14, float* %19
%20 = add nsw i32 %12, 1
br label %21
21: ; preds = %17, %11
%22 = phi i32 [ %20, %17 ], [ %12, %11 ]
%23 = icmp eq i32 %22, 10
%24 = add nuw nsw i32 %13, 1
br i1 %23, label %25, label %11
25: ; preds = %21
%26 = getelementptr inbounds [9 x float], [9 x float]* %2, i64 0, i64 0
%27 = load float, float* %26
%28 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), float %27)
%29 = getelementptr inbounds [9 x float], [9 x float]* %2, i64 0, i64 1
%30 = load float, float* %29
%31 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), float %30)
%32 = getelementptr inbounds [9 x float], [9 x float]* %2, i64 0, i64 2
%33 = load float, float* %32
%34 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), float %33)
%35 = getelementptr inbounds [9 x float], [9 x float]* %2, i64 0, i64 3
%36 = load float, float* %35
%37 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), float %36)
%38 = getelementptr inbounds [9 x float], [9 x float]* %2, i64 0, i64 4
%39 = load float, float* %38
%40 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), float %39)
%41 = getelementptr inbounds [9 x float], [9 x float]* %2, i64 0, i64 5
%42 = load float, float* %41
%43 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), float %42)
%44 = getelementptr inbounds [9 x float], [9 x float]* %2, i64 0, i64 6
%45 = load float, float* %44
%46 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), float %45)
%47 = getelementptr inbounds [9 x float], [9 x float]* %2, i64 0, i64 7
%48 = load float, float* %47
%49 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), float %48)
%50 = getelementptr inbounds [9 x float], [9 x float]* %2, i64 0, i64 8
%51 = load float, float* %50
%52 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), float %51)
%53 = getelementptr inbounds [9 x float], [9 x float]* %2, i64 0, i64 9
%54 = load float, float* %53
%55 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), float %54)
ret i32 0
}