#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 *, double *);
int main() {
  double kwh;
  double bill;
  printf("Please enter the kwh used.\n");
  scanf("%lf", &kwh);
  if (kwh <= 360.0)
    bill = (0.13230 * 360.0) * kwh;
  else if (kwh <= 468.0)
    bill = (0.13230 * 360.0) + (0.15040 * (kwh - 360.0));
  else if (kwh <= 720.0)
    bill = ((0.13230 * 360.0) + (0.15040 * (468.0 - 360.0))) +
           (0.30025 * (kwh - 468.0));
  else
    bill =
        ((0.13230 * 360.0) + ((0.13230 * 360.0) + (0.15040 * (468.0 - 360.0))) +
         (0.30025 * (720.0 - 468.0))) +
        (0.34025 * (kwh - 720.0));
  printf("The charge for %.lf kwh is $%1.2f.\n", kwh, bill);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xf12(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf20(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movsd  0xeab(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     1177 <main+0x57>
movsd  0xed8(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    123b <main+0x11b>
movsd  0xe89(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     11bd <main+0x9d>
movsd  -0x10(%rbp),%xmm0
movsd  0xe69(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe95(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe91(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1236 <main+0x116>
movsd  0xe4b(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     1203 <main+0xe3>
movsd  -0x10(%rbp),%xmm0
movsd  0xe2b(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe3f(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe3b(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1231 <main+0x111>
movsd  -0x10(%rbp),%xmm0
movsd  0xe00(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xdfc(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdf8(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1236 <main+0x116>
jmp    123b <main+0x11b>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    0xe1c(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf50(%rip),%rdi
call   1030 <puts@plt>
lea    0xf1c(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
movsd  (%rsp),%xmm0
movsd  0xea7(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    1199 <main+0x69>
movsd  0xea9(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    11a7 <main+0x77>
movsd  0xeb3(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    11c5 <main+0x95>
movsd  0xec5(%rip),%xmm1
addsd  %xmm0,%xmm1
mulsd  0xec1(%rip),%xmm1
addsd  0xec1(%rip),%xmm1
jmp    11e1 <main+0xb1>
movsd  0xe67(%rip),%xmm1
mulsd  %xmm0,%xmm1
jmp    11e1 <main+0xb1>
movsd  0xe69(%rip),%xmm1
addsd  %xmm0,%xmm1
mulsd  0xe65(%rip),%xmm1
addsd  0xe45(%rip),%xmm1
jmp    11e1 <main+0xb1>
movsd  0xe63(%rip),%xmm1
addsd  %xmm0,%xmm1
mulsd  0xe5f(%rip),%xmm1
addsd  0xe5f(%rip),%xmm1
lea    0xe7c(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Please enter the kwh used.\0A\00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [36 x i8] c"The charge for %.lf kwh is $%1.2f.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%6 = load double, double* %2
%7 = fcmp ole double %6, 3.600000e+02
br i1 %7, label %8, label %11
8: ; preds = %0
%9 = load double, double* %2
%10 = fmul double 4.762800e+01, %9
store double %10, double* %3
br label %31
11: ; preds = %0
%12 = load double, double* %2
%13 = fcmp ole double %12, 4.680000e+02
br i1 %13, label %14, label %18
14: ; preds = %11
%15 = load double, double* %2
%16 = fsub double %15, 3.600000e+02
%17 = call double @llvm.fmuladd.f64(double 1.504000e-01, double %16, double 4.762800e+01)
store double %17, double* %3
br label %30
18: ; preds = %11
%19 = load double, double* %2
%20 = fcmp ole double %19, 7.200000e+02
br i1 %20, label %21, label %25
21: ; preds = %18
%22 = load double, double* %2
%23 = fsub double %22, 4.680000e+02
%24 = call double @llvm.fmuladd.f64(double 3.002500e-01, double %23, double 6.387120e+01)
store double %24, double* %3
br label %29
25: ; preds = %18
%26 = load double, double* %2
%27 = fsub double %26, 7.200000e+02
%28 = call double @llvm.fmuladd.f64(double 3.402500e-01, double %27, double 0x40676530BE0DED29)
store double %28, double* %3
br label %29
29: ; preds = %25, %21
br label %30
30: ; preds = %29, %14
br label %31
31: ; preds = %30, %8
%32 = load double, double* %2
%33 = load double, double* %3
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), double %32, double %33)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [36 x i8] c"The charge for %.lf kwh is $%1.2f.\0A\00"
@str = [27 x i8] c"Please enter the kwh used.\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%5 = load double, double* %1
%6 = fcmp ugt double %5, 3.600000e+02
br i1 %6, label %9, label %7
7: ; preds = %0
%8 = fmul double %5, 4.762800e+01
br label %22
9: ; preds = %0
%10 = fcmp ugt double %5, 4.680000e+02
br i1 %10, label %14, label %11
11: ; preds = %9
%12 = fadd double %5, -3.600000e+02
%13 = call double @llvm.fmuladd.f64(double %12, double 1.504000e-01, double 4.762800e+01)
br label %22
14: ; preds = %9
%15 = fcmp ugt double %5, 7.200000e+02
br i1 %15, label %19, label %16
16: ; preds = %14
%17 = fadd double %5, -4.680000e+02
%18 = call double @llvm.fmuladd.f64(double %17, double 3.002500e-01, double 6.387120e+01)
br label %22
19: ; preds = %14
%20 = fadd double %5, -7.200000e+02
%21 = call double @llvm.fmuladd.f64(double %20, double 3.402500e-01, double 0x40676530BE0DED29)
br label %22
22: ; preds = %11, %19, %16, %7
%23 = phi double [ %8, %7 ], [ %13, %11 ], [ %18, %16 ], [ %21, %19 ]
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), double %5, double %23)
ret i32 0
}