#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);
void bill(unsigned units) {
  double bill;
  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);
}


x86 assembly (clang, -O0):
<bill>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x32,-0x4(%rbp)
ja     1143 <bill+0x33>
mov    -0x4(%rbp),%eax
cvtsi2sd %rax,%xmm1
movsd  0xefb(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    11ed <bill+0xdd>
cmpl   $0x96,-0x4(%rbp)
ja     117d <bill+0x6d>
mov    -0x4(%rbp),%eax
add    $0xffffffce,%eax
cvtsi2sd %rax,%xmm0
movsd  0xebd(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xeb9(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    11e8 <bill+0xd8>
cmpl   $0xfa,-0x4(%rbp)
ja     11b9 <bill+0xa9>
mov    -0x4(%rbp),%eax
add    $0xffffff6a,%eax
cvtsi2sd %rax,%xmm0
movsd  0xe71(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe6d(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    11e3 <bill+0xd3>
mov    -0x4(%rbp),%eax
add    $0xffffff06,%eax
cvtsi2sd %rax,%xmm0
movsd  0xe32(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe2e(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    11e8 <bill+0xd8>
jmp    11ed <bill+0xdd>
movsd  0xe43(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
lea    0xe35(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bill>:
cmp    $0x32,%edi
ja     1126 <bill+0x16>
mov    %edi,%eax
cvtsi2sd %rax,%xmm0
mulsd  0xf0c(%rip),%xmm0
jmp    1188 <bill+0x78>
cmp    $0x96,%edi
ja     1148 <bill+0x38>
add    $0xffffffce,%edi
cvtsi2sd %rdi,%xmm0
mulsd  0xee2(%rip),%xmm0
addsd  0xee2(%rip),%xmm0
jmp    1188 <bill+0x78>
cmp    $0xfa,%edi
ja     116d <bill+0x5d>
add    $0xffffff6a,%edi
cvtsi2sd %rdi,%xmm0
mulsd  0xead(%rip),%xmm0
addsd  0xead(%rip),%xmm0
jmp    1188 <bill+0x78>
add    $0xffffff06,%edi
cvtsi2sd %rdi,%xmm0
mulsd  0xe80(%rip),%xmm0
addsd  0xe80(%rip),%xmm0
mulsd  0xea8(%rip),%xmm0
lea    0xea9(%rip),%rdi
jmp    1030 <printf@plt>

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

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