#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 log(double);
double qacc_rw(double w, double v, double s, double a1, double a2, double a3) {
  double r;
  r = s / (s - 1.0);
  return (a1 + 1.0) * log(w / v) + a3 * log((r + w) / (r + v)) -
         (a1 + a2 + a3 + 2.0) * log((1.0 + w) / (1.0 + v));
}


x86 assembly (clang, -O0):
<qacc_rw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0xeb8(%rip),%xmm2
subsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xea3(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x8(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
call   1030 <log@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x38(%rbp),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
addsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
call   1030 <log@plt>
movsd  -0x60(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x50(%rbp),%xmm0
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x20(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  0xe2c(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe13(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  0xe06(%rip),%xmm1
addsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
call   1030 <log@plt>
movsd  -0x48(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x40(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qacc_rw>:
sub    $0x48,%rsp
movsd  %xmm5,0x8(%rsp)
movsd  %xmm4,0x10(%rsp)
movsd  %xmm3,0x40(%rsp)
movsd  %xmm1,0x20(%rsp)
movsd  %xmm0,0x18(%rsp)
movsd  0xec6(%rip),%xmm4
addsd  %xmm2,%xmm4
divsd  %xmm4,%xmm2
movsd  %xmm2,0x28(%rsp)
addsd  0xeb8(%rip),%xmm3
movsd  %xmm3,0x38(%rsp)
divsd  %xmm1,%xmm0
call   1030 <log@plt>
movsd  %xmm0,0x30(%rsp)
movsd  0x28(%rsp),%xmm1
movapd %xmm1,%xmm0
addsd  0x18(%rsp),%xmm0
addsd  0x20(%rsp),%xmm1
divsd  %xmm1,%xmm0
call   1030 <log@plt>
movsd  0x8(%rsp),%xmm1
mulsd  %xmm1,%xmm0
movapd %xmm0,%xmm2
movsd  0x30(%rsp),%xmm3
mulsd  0x38(%rsp),%xmm3
movsd  0x10(%rsp),%xmm0
addsd  0x40(%rsp),%xmm0
addsd  %xmm1,%xmm0
addsd  0xe5a(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
addsd  %xmm3,%xmm2
movsd  %xmm2,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
movsd  0xe34(%rip),%xmm2
addsd  %xmm2,%xmm0
movsd  0x20(%rsp),%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
call   1030 <log@plt>
mulsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x48,%rsp
ret

LLVM IR (-O0):
define double @qacc_rw(double %0, double %1, double %2, double %3, double %4, double %5) {
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
store double %0, double* %7
store double %1, double* %8
store double %2, double* %9
store double %3, double* %10
store double %4, double* %11
store double %5, double* %12
%14 = load double, double* %9
%15 = load double, double* %9
%16 = fsub double %15, 1.000000e+00
%17 = fdiv double %14, %16
store double %17, double* %13
%18 = load double, double* %10
%19 = fadd double %18, 1.000000e+00
%20 = load double, double* %7
%21 = load double, double* %8
%22 = fdiv double %20, %21
%23 = call double @log(double %22)
%24 = load double, double* %12
%25 = load double, double* %13
%26 = load double, double* %7
%27 = fadd double %25, %26
%28 = load double, double* %13
%29 = load double, double* %8
%30 = fadd double %28, %29
%31 = fdiv double %27, %30
%32 = call double @log(double %31)
%33 = fmul double %24, %32
%34 = call double @llvm.fmuladd.f64(double %19, double %23, double %33)
%35 = load double, double* %10
%36 = load double, double* %11
%37 = fadd double %35, %36
%38 = load double, double* %12
%39 = fadd double %37, %38
%40 = fadd double %39, 2.000000e+00
%41 = load double, double* %7
%42 = fadd double 1.000000e+00, %41
%43 = load double, double* %8
%44 = fadd double 1.000000e+00, %43
%45 = fdiv double %42, %44
%46 = call double @log(double %45)
%47 = fneg double %40
%48 = call double @llvm.fmuladd.f64(double %47, double %46, double %34)
ret double %48
}

LLVM IR (-O2):
define double @qacc_rw(double %0, double %1, double %2, double %3, double %4, double %5) {
%7 = fadd double %2, -1.000000e+00
%8 = fdiv double %2, %7
%9 = fadd double %3, 1.000000e+00
%10 = fdiv double %0, %1
%11 = tail call double @log(double %10)
%12 = fadd double %8, %0
%13 = fadd double %8, %1
%14 = fdiv double %12, %13
%15 = tail call double @log(double %14)
%16 = fmul double %15, %5
%17 = tail call double @llvm.fmuladd.f64(double %9, double %11, double %16)
%18 = fadd double %3, %4
%19 = fadd double %18, %5
%20 = fadd double %19, 2.000000e+00
%21 = fadd double %0, 1.000000e+00
%22 = fadd double %1, 1.000000e+00
%23 = fdiv double %21, %22
%24 = tail call double @log(double %23)
%25 = fneg double %20
%26 = tail call double @llvm.fmuladd.f64(double %25, double %24, double %17)
ret double %26
}