#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 */
double round_money(double);
void charges(int hours, double *charge, double *average_cost) {
  int temp_hours = hours;
  double money = 7.99, average = 0.0;
  if (hours > 10) {
    temp_hours -= 10;
    money = money + (temp_hours * 1.99);
  }
  average = money / hours;
  money = round_money(money);
  average = round_money(average);
  *charge = money;
  *average_cost = average;
}


x86 assembly (clang, -O0):
<charges>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
movsd  0xecf(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
cmpl   $0xa,-0x4(%rbp)
jle    1170 <charges+0x60>
mov    -0x1c(%rbp),%eax
sub    $0xa,%eax
mov    %eax,-0x1c(%rbp)
movsd  -0x28(%rbp),%xmm1
cvtsi2sdl -0x1c(%rbp),%xmm0
movsd  0xea5(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1030 <round_money@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1030 <round_money@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x30(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<charges>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
movsd  0xee3(%rip),%xmm0
cmp    $0xb,%edi
jl     113d <charges+0x2d>
lea    -0xa(%rdi),%eax
cvtsi2sd %eax,%xmm1
mulsd  0xec7(%rip),%xmm1
addsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %edi,%xmm1
movapd %xmm0,%xmm2
divsd  %xmm1,%xmm2
movsd  %xmm2,0x10(%rsp)
call   1030 <round_money@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <round_money@plt>
movsd  0x8(%rsp),%xmm1
movsd  %xmm1,(%rbx)
movsd  %xmm0,(%r14)
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @charges(i32 %0, double* %1, double* %2) {
%4 = alloca i32
%5 = alloca double*
%6 = alloca double*
%7 = alloca i32
%8 = alloca double
%9 = alloca double
store i32 %0, i32* %4
store double* %1, double** %5
store double* %2, double** %6
%10 = load i32, i32* %4
store i32 %10, i32* %7
store double 7.990000e+00, double* %8
store double 0.000000e+00, double* %9
%11 = load i32, i32* %4
%12 = icmp sgt i32 %11, 10
br i1 %12, label %13, label %20
13: ; preds = %3
%14 = load i32, i32* %7
%15 = sub nsw i32 %14, 10
store i32 %15, i32* %7
%16 = load double, double* %8
%17 = load i32, i32* %7
%18 = sitofp i32 %17 to double
%19 = call double @llvm.fmuladd.f64(double %18, double 1.990000e+00, double %16)
store double %19, double* %8
br label %20
20: ; preds = %13, %3
%21 = load double, double* %8
%22 = load i32, i32* %4
%23 = sitofp i32 %22 to double
%24 = fdiv double %21, %23
store double %24, double* %9
%25 = load double, double* %8
%26 = call double @round_money(double %25)
store double %26, double* %8
%27 = load double, double* %9
%28 = call double @round_money(double %27)
store double %28, double* %9
%29 = load double, double* %8
%30 = load double*, double** %5
store double %29, double* %30
%31 = load double, double* %9
%32 = load double*, double** %6
store double %31, double* %32
ret void
}

LLVM IR (-O2):
define void @charges(i32 %0, double* nocapture writeonly %1, double* nocapture writeonly %2) {
%4 = icmp sgt i32 %0, 10
%5 = add nsw i32 %0, -10
%6 = sitofp i32 %5 to double
%7 = tail call double @llvm.fmuladd.f64(double %6, double 1.990000e+00, double 7.990000e+00)
%8 = select i1 %4, double %7, double 7.990000e+00
%9 = sitofp i32 %0 to double
%10 = fdiv double %8, %9
%11 = tail call double @round_money(double %8)
%12 = tail call double @round_money(double %10)
store double %11, double* %1
store double %12, double* %2
ret void
}