#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 /*<<< orphan*/ printf(char *, float);
int scanf(char *, int *);
int main(int argc, char const *argv[]) {
  int val, ct = 0, time = 0;
  float value = 10.0;
  while (scanf("%d", &val), val != 0) {
    if (ct < 10) {
      time += val;
      if (time > 40) {
        value += 0.2 * (time - 40);
        time = 40;
      }
    } else {
      value += 0.2 * val;
    }
    ct++;
  }
  printf("%.2f\n", value);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movss  0xeb4(%rip),%xmm0
movss  %xmm0,-0x20(%rbp)
lea    0xeb8(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x14(%rbp)
je     11f5 <main+0xd5>
cmpl   $0xa,-0x18(%rbp)
jge    11c0 <main+0xa0>
mov    -0x14(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x28,-0x1c(%rbp)
jle    11bb <main+0x9b>
mov    -0x1c(%rbp),%eax
sub    $0x28,%eax
cvtsi2sd %eax,%xmm0
movss  -0x20(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xe65(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
movl   $0x28,-0x1c(%rbp)
jmp    11e7 <main+0xc7>
cvtsi2sdl -0x14(%rbp),%xmm0
movss  -0x20(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xe32(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1151 <main+0x31>
movss  -0x20(%rbp),%xmm0
lea    0xe12(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xee2(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
je     11e6 <main+0xc6>
xor    %ebp,%ebp
movss  0xeb2(%rip),%xmm0
movss  %xmm0,(%rsp)
lea    0xeb6(%rip),%r14
lea    0x4(%rsp),%r15
xor    %ebx,%ebx
jmp    11ab <main+0x8b>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movss  (%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  0xe80(%rip),%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%rsp)
add    $0x1,%ebx
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
je     11f3 <main+0xd3>
cmp    $0x9,%ebx
ja     1170 <main+0x50>
add    %eax,%ebp
cmp    $0x29,%ebp
jl     1195 <main+0x75>
add    $0xffffffd8,%ebp
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
movss  (%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  0xe36(%rip),%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%rsp)
mov    $0x28,%ebp
jmp    1195 <main+0x75>
movss  0xe12(%rip),%xmm0
movss  %xmm0,(%rsp)
lea    0xe19(%rip),%rdi
movss  (%rsp),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"%.2f\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%6 = load i32, i32* %3
%7 = icmp eq i32 %6, 0
br i1 %7, label %35, label %8
8: ; preds = %2, %28
%9 = phi i32 [ %33, %28 ], [ %6, %2 ]
%10 = phi float [ %30, %28 ], [ 1.000000e+01, %2 ]
%11 = phi i32 [ %29, %28 ], [ 0, %2 ]
%12 = phi i32 [ %31, %28 ], [ 0, %2 ]
%13 = icmp ult i32 %12, 10
br i1 %13, label %14, label %23
14: ; preds = %8
%15 = add nsw i32 %9, %11
%16 = icmp sgt i32 %15, 40
br i1 %16, label %17, label %28
17: ; preds = %14
%18 = add nsw i32 %15, -40
%19 = sitofp i32 %18 to double
%20 = fpext float %10 to double
%21 = call double @llvm.fmuladd.f64(double %19, double 2.000000e-01, double %20)
%22 = fptrunc double %21 to float
br label %28
23: ; preds = %8
%24 = sitofp i32 %9 to double
%25 = fpext float %10 to double
%26 = call double @llvm.fmuladd.f64(double %24, double 2.000000e-01, double %25)
%27 = fptrunc double %26 to float
br label %28
28: ; preds = %14, %17, %23
%29 = phi i32 [ 40, %17 ], [ %15, %14 ], [ %11, %23 ]
%30 = phi float [ %22, %17 ], [ %10, %14 ], [ %27, %23 ]
%31 = add nuw nsw i32 %12, 1
%32 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%33 = load i32, i32* %3
%34 = icmp eq i32 %33, 0
br i1 %34, label %35, label %8
35: ; preds = %28, %2
%36 = phi float [ 1.000000e+01, %2 ], [ %30, %28 ]
%37 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), float %36)
ret i32 0
}