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


x86 assembly (clang, -O0):
<f>:
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  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  0xebd(%rip),%xmm2
subsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xea8(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <log@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x30(%rbp),%xmm0
addsd  -0x8(%rbp),%xmm0
call   1030 <log@plt>
movsd  -0x58(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  0xe44(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe2b(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
call   1030 <log@plt>
movsd  -0x40(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x38(%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):
<f>:
sub    $0x38,%rsp
movsd  %xmm4,0x30(%rsp)
movsd  %xmm3,0x8(%rsp)
movsd  %xmm2,0x28(%rsp)
movsd  %xmm0,0x10(%rsp)
movsd  0xecc(%rip),%xmm3
addsd  %xmm1,%xmm3
divsd  %xmm3,%xmm1
movsd  %xmm1,0x18(%rsp)
addsd  0xebe(%rip),%xmm2
movsd  %xmm2,(%rsp)
call   1030 <log@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x18(%rsp),%xmm0
addsd  0x10(%rsp),%xmm0
call   1030 <log@plt>
movsd  0x30(%rsp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0x20(%rsp),%xmm2
mulsd  (%rsp),%xmm2
addsd  %xmm2,%xmm0
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  0x28(%rsp),%xmm0
addsd  %xmm1,%xmm0
addsd  0xe6f(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
addsd  0xe53(%rip),%xmm0
call   1030 <log@plt>
mulsd  0x8(%rsp),%xmm0
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x38,%rsp
ret

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

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