#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 *, unsigned int *);
int main() {
  unsigned units;
  double bill;
  printf("Enter units consumed:\n");
  scanf(" %u%*c", &units);
  if (units <= 50)
    bill = 0.5 * units;
  else if (units <= 150)
    bill = 0.5 * 50 + 0.75 * (units - 50);
  else if (units <= 250)
    bill = 0.5 * 50 + 0.75 * 100 + 1.2 * (units - 150);
  else
    bill = 0.5 * 50 + 0.75 * 100 + 1.2 * 100 + 1.5 * (units - 250);
  bill *= 1.3;
  printf("Bill: %.2lf\n", bill);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xf0a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf13(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x32,-0x8(%rbp)
ja     1175 <main+0x55>
mov    -0x8(%rbp),%eax
cvtsi2sd %rax,%xmm1
movsd  0xec9(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    121f <main+0xff>
cmpl   $0x96,-0x8(%rbp)
ja     11af <main+0x8f>
mov    -0x8(%rbp),%eax
add    $0xffffffce,%eax
cvtsi2sd %rax,%xmm0
movsd  0xe8b(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe87(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    121a <main+0xfa>
cmpl   $0xfa,-0x8(%rbp)
ja     11eb <main+0xcb>
mov    -0x8(%rbp),%eax
add    $0xffffff6a,%eax
cvtsi2sd %rax,%xmm0
movsd  0xe3f(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe3b(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1215 <main+0xf5>
mov    -0x8(%rbp),%eax
add    $0xffffff06,%eax
cvtsi2sd %rax,%xmm0
movsd  0xe00(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdfc(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    121a <main+0xfa>
jmp    121f <main+0xff>
movsd  0xe11(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
lea    0xe21(%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
lea    0xf1c(%rip),%rdi
call   1030 <puts@plt>
lea    0xefc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x32,%eax
ja     1168 <main+0x38>
mov    %eax,%eax
cvtsi2sd %rax,%xmm0
mulsd  0xeca(%rip),%xmm0
jmp    11c6 <main+0x96>
cmp    $0x96,%eax
ja     1189 <main+0x59>
add    $0xffffffce,%eax
cvtsi2sd %rax,%xmm0
mulsd  0xea1(%rip),%xmm0
addsd  0xea1(%rip),%xmm0
jmp    11c6 <main+0x96>
cmp    $0xfa,%eax
ja     11ac <main+0x7c>
add    $0xffffff6a,%eax
cvtsi2sd %rax,%xmm0
mulsd  0xe6e(%rip),%xmm0
addsd  0xe6e(%rip),%xmm0
jmp    11c6 <main+0x96>
add    $0xffffff06,%eax
cvtsi2sd %rax,%xmm0
mulsd  0xe42(%rip),%xmm0
addsd  0xe42(%rip),%xmm0
mulsd  0xe6a(%rip),%xmm0
lea    0xe72(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Enter units consumed:\0A\00"
@.str.1 = [7 x i8] c" %u%*c\00"
@.str.2 = [13 x i8] c"Bill: %.2lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = icmp ule i32 %6, 50
br i1 %7, label %8, label %12
8: ; preds = %0
%9 = load i32, i32* %2
%10 = uitofp i32 %9 to double
%11 = fmul double 5.000000e-01, %10
store double %11, double* %3
br label %35
12: ; preds = %0
%13 = load i32, i32* %2
%14 = icmp ule i32 %13, 150
br i1 %14, label %15, label %20
15: ; preds = %12
%16 = load i32, i32* %2
%17 = sub i32 %16, 50
%18 = uitofp i32 %17 to double
%19 = call double @llvm.fmuladd.f64(double 7.500000e-01, double %18, double 2.500000e+01)
store double %19, double* %3
br label %34
20: ; preds = %12
%21 = load i32, i32* %2
%22 = icmp ule i32 %21, 250
br i1 %22, label %23, label %28
23: ; preds = %20
%24 = load i32, i32* %2
%25 = sub i32 %24, 150
%26 = uitofp i32 %25 to double
%27 = call double @llvm.fmuladd.f64(double 1.200000e+00, double %26, double 1.000000e+02)
store double %27, double* %3
br label %33
28: ; preds = %20
%29 = load i32, i32* %2
%30 = sub i32 %29, 250
%31 = uitofp i32 %30 to double
%32 = call double @llvm.fmuladd.f64(double 1.500000e+00, double %31, double 2.200000e+02)
store double %32, double* %3
br label %33
33: ; preds = %28, %23
br label %34
34: ; preds = %33, %15
br label %35
35: ; preds = %34, %8
%36 = load double, double* %3
%37 = fmul double %36, 1.300000e+00
store double %37, double* %3
%38 = load double, double* %3
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), double %38)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [7 x i8] c" %u%*c\00"
@.str.2 = [13 x i8] c"Bill: %.2lf\0A\00"
@str = [22 x i8] c"Enter units consumed:\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp ult i32 %5, 51
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = uitofp i32 %5 to double
%9 = fmul double %8, 5.000000e-01
br label %26
10: ; preds = %0
%11 = icmp ult i32 %5, 151
br i1 %11, label %12, label %16
12: ; preds = %10
%13 = add nsw i32 %5, -50
%14 = uitofp i32 %13 to double
%15 = call double @llvm.fmuladd.f64(double %14, double 7.500000e-01, double 2.500000e+01)
br label %26
16: ; preds = %10
%17 = icmp ult i32 %5, 251
br i1 %17, label %18, label %22
18: ; preds = %16
%19 = add nsw i32 %5, -150
%20 = uitofp i32 %19 to double
%21 = call double @llvm.fmuladd.f64(double %20, double 1.200000e+00, double 1.000000e+02)
br label %26
22: ; preds = %16
%23 = add i32 %5, -250
%24 = uitofp i32 %23 to double
%25 = call double @llvm.fmuladd.f64(double %24, double 1.500000e+00, double 2.200000e+02)
br label %26
26: ; preds = %12, %22, %18, %7
%27 = phi double [ %9, %7 ], [ %15, %12 ], [ %21, %18 ], [ %25, %22 ]
%28 = fmul double %27, 1.300000e+00
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), double %28)
ret i32 0
}