#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 */
float ceil(float);
float calculateCharges(float hours) {
  float charges = 2.00;
  hours = ceil(hours);
  hours -= 3;
  while (hours > 0) {
    if (charges == 10.00)
      break;
    hours -= 1.0;
    charges += 0.5;
  }
  return charges;
}


x86 assembly (clang, -O0):
<calculateCharges>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  0xedf(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <ceil@plt>
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xeba(%rip),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    11c7 <calculateCharges+0xb7>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe97(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1186 <calculateCharges+0x76>
jp     1186 <calculateCharges+0x76>
jmp    11c7 <calculateCharges+0xb7>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe81(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe5b(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    114f <calculateCharges+0x3f>
movss  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculateCharges>:
push   %rax
call   1030 <ceilf@plt>
movaps %xmm0,%xmm1
addss  0xedf(%rip),%xmm1
xorps  %xmm2,%xmm2
movss  0xed8(%rip),%xmm0
ucomiss %xmm2,%xmm1
jbe    1164 <calculateCharges+0x54>
movss  0xecf(%rip),%xmm3
movss  0xecb(%rip),%xmm4
movss  0xec7(%rip),%xmm5
nopl   0x0(%rax)
addss  %xmm3,%xmm1
addss  %xmm4,%xmm0
ucomiss %xmm2,%xmm1
jbe    1164 <calculateCharges+0x54>
ucomiss %xmm5,%xmm0
jne    1150 <calculateCharges+0x40>
jp     1150 <calculateCharges+0x40>
pop    %rax
ret

LLVM IR (-O0):
define float @calculateCharges(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %2
store float 2.000000e+00, float* %3
%4 = load float, float* %2
%5 = call float @ceil(float %4)
store float %5, float* %2
%6 = load float, float* %2
%7 = fsub float %6, 3.000000e+00
store float %7, float* %2
br label %8
8: ; preds = %16, %1
%9 = load float, float* %2
%10 = fcmp ogt float %9, 0.000000e+00
br i1 %10, label %11, label %25
11: ; preds = %8
%12 = load float, float* %3
%13 = fpext float %12 to double
%14 = fcmp oeq double %13, 1.000000e+01
br i1 %14, label %15, label %16
15: ; preds = %11
br label %25
16: ; preds = %11
%17 = load float, float* %2
%18 = fpext float %17 to double
%19 = fsub double %18, 1.000000e+00
%20 = fptrunc double %19 to float
store float %20, float* %2
%21 = load float, float* %3
%22 = fpext float %21 to double
%23 = fadd double %22, 5.000000e-01
%24 = fptrunc double %23 to float
store float %24, float* %3
br label %8
25: ; preds = %15, %8
%26 = load float, float* %3
ret float %26
}

LLVM IR (-O2):
define float @calculateCharges(float %0) {
%2 = tail call float @llvm.ceil.f32(float %0)
%3 = fadd float %2, -3.000000e+00
%4 = fcmp ule float %3, 0.000000e+00
br i1 %4, label %13, label %5
5: ; preds = %1, %5
%6 = phi float [ %9, %5 ], [ 2.000000e+00, %1 ]
%7 = phi float [ %8, %5 ], [ %3, %1 ]
%8 = fadd float %7, -1.000000e+00
%9 = fadd float %6, 5.000000e-01
%10 = fcmp ule float %8, 0.000000e+00
%11 = fcmp oeq float %9, 1.000000e+01
%12 = select i1 %10, i1 true, i1 %11
br i1 %12, label %13, label %5
13: ; preds = %5, %1
%14 = phi float [ 2.000000e+00, %1 ], [ %9, %5 ]
ret float %14
}