#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 *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int base;
  float price;
  printf("How many units were consumed? [E.g 400] : ");
  scanf("%d", &base);
  if (base >= 1 && base <= 100) {
    price = base * 2.30;
    printf("Total Amount Due: = %1.f\n", price);
  } else if (base >= 101 && base <= 400) {
    price = base * 2.70;
    printf("Total Amount Due: = %1.f\n", price);
  } else if (base >= 401 && base <= 1000) {
    price = base * 4.50;
    printf("Total Amount Due: = %1.f\n", price);
  } else if (base > 1000) {
    price = base * 6.00;
    printf("Total Amount Due: = %1.f\n", price);
  } else
    printf("Your input did not matched or = 0.\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeea(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf07(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x1,-0x8(%rbp)
jl     1197 <main+0x77>
cmpl   $0x64,-0x8(%rbp)
jg     1197 <main+0x77>
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xeaa(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xec3(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1294 <main+0x174>
cmpl   $0x65,-0x8(%rbp)
jl     11e4 <main+0xc4>
cmpl   $0x190,-0x8(%rbp)
jg     11e4 <main+0xc4>
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xe55(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe76(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    128f <main+0x16f>
cmpl   $0x191,-0x8(%rbp)
jl     1234 <main+0x114>
cmpl   $0x3e8,-0x8(%rbp)
jg     1234 <main+0x114>
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xdfd(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe26(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    128a <main+0x16a>
cmpl   $0x3e8,-0x8(%rbp)
jle    1277 <main+0x157>
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xdb2(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xde3(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1285 <main+0x165>
lea    0xdea(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    128a <main+0x16a>
jmp    128f <main+0x16f>
jmp    1294 <main+0x174>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf05(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
lea    -0x1(%rax),%ecx
cmp    $0x63,%ecx
ja     116a <main+0x3a>
cvtsi2sd %eax,%xmm0
mulsd  0xeb0(%rip),%xmm0
jmp    11b2 <main+0x82>
lea    -0x65(%rax),%ecx
cmp    $0x12b,%ecx
ja     1183 <main+0x53>
cvtsi2sd %eax,%xmm0
mulsd  0xe8f(%rip),%xmm0
jmp    11b2 <main+0x82>
lea    -0x191(%rax),%ecx
cmp    $0x257,%ecx
ja     119f <main+0x6f>
cvtsi2sd %eax,%xmm0
mulsd  0xe6b(%rip),%xmm0
jmp    11b2 <main+0x82>
cmp    $0x3e9,%eax
jl     11cc <main+0x9c>
cvtsi2sd %eax,%xmm0
mulsd  0xe4e(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe8d(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0xe95(%rip),%rdi
call   1030 <puts@plt>
jmp    11c8 <main+0x98>

LLVM IR (-O0):
@.str = [43 x i8] c"How many units were consumed? [E.g 400] : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [26 x i8] c"Total Amount Due: = %1.f\0A\00"
@.str.3 = [36 x i8] c"Your input did not matched or = 0.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = icmp sge i32 %6, 1
br i1 %7, label %8, label %19
8: ; preds = %0
%9 = load i32, i32* %2
%10 = icmp sle i32 %9, 100
br i1 %10, label %11, label %19
11: ; preds = %8
%12 = load i32, i32* %2
%13 = sitofp i32 %12 to double
%14 = fmul double %13, 2.300000e+00
%15 = fptrunc double %14 to float
store float %15, float* %3
%16 = load float, float* %3
%17 = fpext float %16 to double
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), double %17)
br label %63
19: ; preds = %8, %0
%20 = load i32, i32* %2
%21 = icmp sge i32 %20, 101
br i1 %21, label %22, label %33
22: ; preds = %19
%23 = load i32, i32* %2
%24 = icmp sle i32 %23, 400
br i1 %24, label %25, label %33
25: ; preds = %22
%26 = load i32, i32* %2
%27 = sitofp i32 %26 to double
%28 = fmul double %27, 2.700000e+00
%29 = fptrunc double %28 to float
store float %29, float* %3
%30 = load float, float* %3
%31 = fpext float %30 to double
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), double %31)
br label %62
33: ; preds = %22, %19
%34 = load i32, i32* %2
%35 = icmp sge i32 %34, 401
br i1 %35, label %36, label %47
36: ; preds = %33
%37 = load i32, i32* %2
%38 = icmp sle i32 %37, 1000
br i1 %38, label %39, label %47
39: ; preds = %36
%40 = load i32, i32* %2
%41 = sitofp i32 %40 to double
%42 = fmul double %41, 4.500000e+00
%43 = fptrunc double %42 to float
store float %43, float* %3
%44 = load float, float* %3
%45 = fpext float %44 to double
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), double %45)
br label %61
47: ; preds = %36, %33
%48 = load i32, i32* %2
%49 = icmp sgt i32 %48, 1000
br i1 %49, label %50, label %58
50: ; preds = %47
%51 = load i32, i32* %2
%52 = sitofp i32 %51 to double
%53 = fmul double %52, 6.000000e+00
%54 = fptrunc double %53 to float
store float %54, float* %3
%55 = load float, float* %3
%56 = fpext float %55 to double
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), double %56)
br label %60
58: ; preds = %47
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0))
br label %60
60: ; preds = %58, %50
br label %61
61: ; preds = %60, %39
br label %62
62: ; preds = %61, %25
br label %63
63: ; preds = %62, %11
ret i32 0
}

LLVM IR (-O2):
@.str = [43 x i8] c"How many units were consumed? [E.g 400] : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [26 x i8] c"Total Amount Due: = %1.f\0A\00"
@str = [35 x i8] c"Your input did not matched or = 0.\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = add i32 %5, -1
%7 = icmp ult i32 %6, 100
br i1 %7, label %8, label %14
8: ; preds = %0
%9 = sitofp i32 %5 to double
%10 = fmul double %9, 2.300000e+00
%11 = fptrunc double %10 to float
%12 = fpext float %11 to double
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), double %12)
br label %42
14: ; preds = %0
%15 = add i32 %5, -101
%16 = icmp ult i32 %15, 300
br i1 %16, label %17, label %23
17: ; preds = %14
%18 = sitofp i32 %5 to double
%19 = fmul double %18, 2.700000e+00
%20 = fptrunc double %19 to float
%21 = fpext float %20 to double
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), double %21)
br label %42
23: ; preds = %14
%24 = add i32 %5, -401
%25 = icmp ult i32 %24, 600
br i1 %25, label %26, label %32
26: ; preds = %23
%27 = sitofp i32 %5 to double
%28 = fmul double %27, 4.500000e+00
%29 = fptrunc double %28 to float
%30 = fpext float %29 to double
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), double %30)
br label %42
32: ; preds = %23
%33 = icmp sgt i32 %5, 1000
br i1 %33, label %34, label %40
34: ; preds = %32
%35 = sitofp i32 %5 to double
%36 = fmul double %35, 6.000000e+00
%37 = fptrunc double %36 to float
%38 = fpext float %37 to double
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), double %38)
br label %42
40: ; preds = %32
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
br label %42
42: ; preds = %17, %34, %40, %26, %8
ret i32 0
}