#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 *, float *);
main() {
  float units = 0.0, bill = 0.0;
  printf("Enter the no.of units consumed");
  scanf("%f", &units);
  if (units < 50) {
    bill = (units * 2.0);
  } else if ((units >= 50) && (units < 100)) {
    bill = (50.0 * 2.0) * ((units - 50.0) * 3.0);
  } else if ((units >= 100) && (units < 200)) {
    bill = (50.0 * 2.0) + (50.0 * 3.0) + ((units - 100) * 5.0);
  } else {
    bill = (50.0 * 2.0) + (50.0 * 3.0) + (100.0 * 5.0) + ((units - 200) * 6.0);
  }
  printf("The electricity bull amount is %f", bill);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
lea    0xf0a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf3a(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movss  0xe9b(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    1192 <main+0x72>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xec8(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1298 <main+0x178>
movss  -0x8(%rbp),%xmm0
movss  0xe61(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     11f5 <main+0xd5>
movss  0xe54(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    11f5 <main+0xd5>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe75(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xe61(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xe4d(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1293 <main+0x173>
movss  -0x8(%rbp),%xmm0
movss  0xe02(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     1258 <main+0x138>
movss  0xdf5(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    1258 <main+0x138>
movss  -0x8(%rbp),%xmm0
movss  0xdda(%rip),%xmm1
subss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xde6(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xde2(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    128e <main+0x16e>
movss  -0x8(%rbp),%xmm0
movss  0xda3(%rip),%xmm1
subss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd9b(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd97(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1293 <main+0x173>
jmp    1298 <main+0x178>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdc7(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xf20(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf50(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movss  0x4(%rsp),%xmm0
movss  0xeaa(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    1168 <main+0x48>
cvtss2sd %xmm0,%xmm0
addsd  %xmm0,%xmm0
jmp    11ec <main+0xcc>
ucomiss 0xe91(%rip),%xmm0
jb     119c <main+0x7c>
movss  0xe8b(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    119c <main+0x7c>
cvtss2sd %xmm0,%xmm0
addsd  0xeae(%rip),%xmm0
mulsd  0xeae(%rip),%xmm0
mulsd  0xeae(%rip),%xmm0
jmp    11ec <main+0xcc>
ucomiss 0xe61(%rip),%xmm0
jb     11d0 <main+0xb0>
movss  0xe5b(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    11d0 <main+0xb0>
addss  0xe56(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xe62(%rip),%xmm0
addsd  0xe62(%rip),%xmm0
jmp    11ec <main+0xcc>
addss  0xe34(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xe34(%rip),%xmm0
addsd  0xe34(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe74(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Enter the no.of units consumed\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [34 x i8] c"The electricity bull amount is %f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
store i32 0, i32* %1
store float 0.000000e+00, float* %2
store float 0.000000e+00, float* %3
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 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), float* %2)
%6 = load float, float* %2
%7 = fcmp olt float %6, 5.000000e+01
br i1 %7, label %8, label %13
8: ; preds = %0
%9 = load float, float* %2
%10 = fpext float %9 to double
%11 = fmul double %10, 2.000000e+00
%12 = fptrunc double %11 to float
store float %12, float* %3
br label %46
13: ; preds = %0
%14 = load float, float* %2
%15 = fcmp oge float %14, 5.000000e+01
br i1 %15, label %16, label %26
16: ; preds = %13
%17 = load float, float* %2
%18 = fcmp olt float %17, 1.000000e+02
br i1 %18, label %19, label %26
19: ; preds = %16
%20 = load float, float* %2
%21 = fpext float %20 to double
%22 = fsub double %21, 5.000000e+01
%23 = fmul double %22, 3.000000e+00
%24 = fmul double 1.000000e+02, %23
%25 = fptrunc double %24 to float
store float %25, float* %3
br label %45
26: ; preds = %16, %13
%27 = load float, float* %2
%28 = fcmp oge float %27, 1.000000e+02
br i1 %28, label %29, label %38
29: ; preds = %26
%30 = load float, float* %2
%31 = fcmp olt float %30, 2.000000e+02
br i1 %31, label %32, label %38
32: ; preds = %29
%33 = load float, float* %2
%34 = fsub float %33, 1.000000e+02
%35 = fpext float %34 to double
%36 = call double @llvm.fmuladd.f64(double %35, double 5.000000e+00, double 2.500000e+02)
%37 = fptrunc double %36 to float
store float %37, float* %3
br label %44
38: ; preds = %29, %26
%39 = load float, float* %2
%40 = fsub float %39, 2.000000e+02
%41 = fpext float %40 to double
%42 = call double @llvm.fmuladd.f64(double %41, double 6.000000e+00, double 7.500000e+02)
%43 = fptrunc double %42 to float
store float %43, float* %3
br label %44
44: ; preds = %38, %32
br label %45
45: ; preds = %44, %19
br label %46
46: ; preds = %45, %8
%47 = load float, float* %3
%48 = fpext float %47 to double
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), double %48)
ret i32 0
}

LLVM IR (-O2):
@.str = [31 x i8] c"Enter the no.of units consumed\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [34 x i8] c"The electricity bull amount is %f\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
store float 0.000000e+00, float* %1
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 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), float* %1)
%5 = load float, float* %1
%6 = fcmp olt float %5, 5.000000e+01
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = fpext float %5 to double
%9 = fmul double %8, 2.000000e+00
br label %31
10: ; preds = %0
%11 = fcmp oge float %5, 5.000000e+01
%12 = fcmp olt float %5, 1.000000e+02
%13 = and i1 %11, %12
br i1 %13, label %14, label %19
14: ; preds = %10
%15 = fpext float %5 to double
%16 = fadd double %15, -5.000000e+01
%17 = fmul double %16, 3.000000e+00
%18 = fmul double %17, 1.000000e+02
br label %31
19: ; preds = %10
%20 = fcmp oge float %5, 1.000000e+02
%21 = fcmp olt float %5, 2.000000e+02
%22 = and i1 %20, %21
br i1 %22, label %23, label %27
23: ; preds = %19
%24 = fadd float %5, -1.000000e+02
%25 = fpext float %24 to double
%26 = call double @llvm.fmuladd.f64(double %25, double 5.000000e+00, double 2.500000e+02)
br label %31
27: ; preds = %19
%28 = fadd float %5, -2.000000e+02
%29 = fpext float %28 to double
%30 = call double @llvm.fmuladd.f64(double %29, double 6.000000e+00, double 7.500000e+02)
br label %31
31: ; preds = %14, %27, %23, %7
%32 = phi double [ %9, %7 ], [ %18, %14 ], [ %26, %23 ], [ %30, %27 ]
%33 = fptrunc double %32 to float
%34 = fpext float %33 to double
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), double %34)
ret i32 0
}