#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);
int /*<<< orphan*/ scanf(char *, double *);
int main() {
  double sm;
  scanf("%lf", &sm);
  if (sm <= 500) {
    printf("%.2f\n", sm * 0.0);
  }
  if (sm > 500 && sm <= 1000) {
    printf("%.2f\n", sm * 0.3);
  }
  if (sm > 1000 && sm <= 3000) {
    printf("%.2f\n", sm * 0.4);
  }
  if (sm > 3000) {
    printf("%.2f\n", sm * 0.5);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xefa(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movsd  0xeb9(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     1166 <main+0x46>
xorps  %xmm0,%xmm0
mulsd  -0x10(%rbp),%xmm0
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  0xe8d(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11a9 <main+0x89>
movsd  0xe83(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     11a9 <main+0x89>
movsd  0xe78(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  0xe52(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11ec <main+0xcc>
movsd  0xe50(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     11ec <main+0xcc>
movsd  0xe45(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
lea    0xe4d(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  0xe1f(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    121c <main+0xfc>
movsd  0xe1d(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
lea    0xe1d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf08(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
movsd  (%rsp),%xmm0
movsd  0xec3(%rip),%xmm1
ucomisd %xmm0,%xmm1
jb     115c <main+0x3c>
xorpd  %xmm1,%xmm1
mulsd  %xmm1,%xmm0
lea    0xee2(%rip),%rdi
call   1030 <printf@plt>
movsd  (%rsp),%xmm0
ucomisd 0xe9c(%rip),%xmm0
jbe    118d <main+0x6d>
movsd  0xe9a(%rip),%xmm1
ucomisd %xmm0,%xmm1
jb     118d <main+0x6d>
mulsd  0xe94(%rip),%xmm0
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
movsd  (%rsp),%xmm0
ucomisd 0xe73(%rip),%xmm0
jbe    11be <main+0x9e>
movsd  0xe79(%rip),%xmm1
ucomisd %xmm0,%xmm1
jb     11be <main+0x9e>
mulsd  0xe73(%rip),%xmm0
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
movsd  (%rsp),%xmm0
ucomisd 0xe52(%rip),%xmm0
jbe    11dc <main+0xbc>
mulsd  0xe58(%rip),%xmm0
lea    0xe5d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

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