#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 *, double);
scalar_t__ scanf(char *, double *);
int main() {
  double s, sn, total = 0;
  while (scanf("%lf", &s)) {
    if (s < 0)
      break;
    if (s < 500)
      sn = s * 1.15;
    if (s >= 500 && s <= 1000)
      sn = s * 1.10;
    if (s > 1000)
      sn = s * 1.05;
    printf("%.2lf\n", sn);
    total += sn;
  }
  printf("%.2lf", total);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
lea    0xeea(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
cmp    $0x0,%rax
je     1213 <main+0xf3>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1164 <main+0x44>
jmp    1213 <main+0xf3>
movsd  0xe94(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1189 <main+0x69>
movsd  0xe89(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe6a(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     11c5 <main+0xa5>
movsd  0xe68(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     11c5 <main+0xa5>
movsd  0xe5d(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe3e(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11ee <main+0xce>
movsd  0xe3c(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xe32(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x18(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1137 <main+0x17>
movsd  -0x20(%rbp),%xmm0
lea    0xe14(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
lea    0xf00(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
xorps  %xmm0,%xmm0
test   %rax,%rax
je     1257 <main+0x137>
movsd  0x8(%rsp),%xmm2
xorpd  %xmm1,%xmm1
ucomisd %xmm2,%xmm1
ja     1257 <main+0x137>
lea    0xed3(%rip),%r14
lea    0xec8(%rip),%r15
lea    0x8(%rsp),%rbx
xorps  %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
movapd %xmm2,%xmm1
mulsd  0xe7e(%rip),%xmm1
movapd %xmm2,%xmm6
movsd  0xe7a(%rip),%xmm3
cmpltsd %xmm3,%xmm2
andpd  %xmm2,%xmm1
andnpd %xmm4,%xmm2
orpd   %xmm1,%xmm2
movapd %xmm6,%xmm0
mulsd  0xe65(%rip),%xmm0
movapd %xmm3,%xmm1
cmplesd %xmm6,%xmm1
movapd %xmm6,%xmm3
movsd  0xe58(%rip),%xmm5
cmplesd %xmm5,%xmm3
movapd %xmm3,%xmm4
andnpd %xmm2,%xmm4
andpd  %xmm0,%xmm3
orpd   %xmm4,%xmm3
andpd  %xmm1,%xmm3
andnpd %xmm2,%xmm1
orpd   %xmm1,%xmm3
movapd %xmm5,%xmm0
cmpltsd %xmm6,%xmm0
mulsd  0xe2e(%rip),%xmm6
andpd  %xmm0,%xmm6
andnpd %xmm3,%xmm0
orpd   %xmm0,%xmm6
movapd %xmm6,0x20(%rsp)
mov    %r14,%rdi
movapd %xmm6,%xmm0
call   1030 <printf@plt>
movapd 0x20(%rsp),%xmm0
addsd  0x10(%rsp),%xmm0
movapd %xmm0,0x10(%rsp)
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
test   %rax,%rax
je     1252 <main+0x132>
movaps 0x20(%rsp),%xmm4
movsd  0x8(%rsp),%xmm2
xorpd  %xmm1,%xmm1
ucomisd %xmm2,%xmm1
movaps 0x10(%rsp),%xmm0
jbe    1170 <main+0x50>
jmp    1257 <main+0x137>
movaps 0x10(%rsp),%xmm0
lea    0xddd(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [7 x i8] c"%.2lf\0A\00"
@.str.2 = [6 x i8] c"%.2lf\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
store i32 0, i32* %1
store double 0.000000e+00, double* %4
br label %5
5: ; preds = %33, %0
%6 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %2)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %39
8: ; preds = %5
%9 = load double, double* %2
%10 = fcmp olt double %9, 0.000000e+00
br i1 %10, label %11, label %12
11: ; preds = %8
br label %39
12: ; preds = %8
%13 = load double, double* %2
%14 = fcmp olt double %13, 5.000000e+02
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = load double, double* %2
%17 = fmul double %16, 1.150000e+00
store double %17, double* %3
br label %18
18: ; preds = %15, %12
%19 = load double, double* %2
%20 = fcmp oge double %19, 5.000000e+02
br i1 %20, label %21, label %27
21: ; preds = %18
%22 = load double, double* %2
%23 = fcmp ole double %22, 1.000000e+03
br i1 %23, label %24, label %27
24: ; preds = %21
%25 = load double, double* %2
%26 = fmul double %25, 1.100000e+00
store double %26, double* %3
br label %27
27: ; preds = %24, %21, %18
%28 = load double, double* %2
%29 = fcmp ogt double %28, 1.000000e+03
br i1 %29, label %30, label %33
30: ; preds = %27
%31 = load double, double* %2
%32 = fmul double %31, 1.050000e+00
store double %32, double* %3
br label %33
33: ; preds = %30, %27
%34 = load double, double* %3
%35 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %34)
%36 = load double, double* %3
%37 = load double, double* %4
%38 = fadd double %37, %36
store double %38, double* %4
br label %5
39: ; preds = %11, %5
%40 = load double, double* %4
%41 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %40)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [7 x i8] c"%.2lf\0A\00"
@.str.2 = [6 x i8] c"%.2lf\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
%3 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%4 = icmp eq i64 %3, 0
%5 = load double, double* %1
%6 = fcmp olt double %5, 0.000000e+00
%7 = select i1 %4, i1 true, i1 %6
br i1 %7, label %30, label %8
8: ; preds = %0, %8
%9 = phi double [ %27, %8 ], [ %5, %0 ]
%10 = phi double [ %24, %8 ], [ 0.000000e+00, %0 ]
%11 = phi double [ %22, %8 ], [ undef, %0 ]
%12 = fcmp olt double %9, 5.000000e+02
%13 = fmul double %9, 1.150000e+00
%14 = select i1 %12, double %13, double %11
%15 = fcmp oge double %9, 5.000000e+02
%16 = fcmp ole double %9, 1.000000e+03
%17 = and i1 %15, %16
%18 = fmul double %9, 1.100000e+00
%19 = select i1 %17, double %18, double %14
%20 = fcmp ogt double %9, 1.000000e+03
%21 = fmul double %9, 1.050000e+00
%22 = select i1 %20, double %21, double %19
%23 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %22)
%24 = fadd double %10, %22
%25 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%26 = icmp eq i64 %25, 0
%27 = load double, double* %1
%28 = fcmp olt double %27, 0.000000e+00
%29 = select i1 %26, i1 true, i1 %28
br i1 %29, label %30, label %8
30: ; preds = %8, %0
%31 = phi double [ 0.000000e+00, %0 ], [ %24, %8 ]
%32 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %31)
ret i32 0
}