#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 G(double rtrs, double A, double alpha1, double beta1, double beta2,
         double beta3, double beta4, double *dGdrs) {
  double Q0 = -2.0 * A * (1.0 + alpha1 * rtrs * rtrs);
  double Q1 =
      2.0 * A * rtrs * (beta1 + rtrs * (beta2 + rtrs * (beta3 + rtrs * beta4)));
  double G1 = Q0 * log(1.0 + 1.0 / Q1);
  double dQ1drs = A * (beta1 / rtrs + 2.0 * beta2 +
                       rtrs * (3.0 * beta3 + 4.0 * beta4 * rtrs));
  *dGdrs = -2.0 * A * alpha1 * G1 / Q0 - Q0 * dQ1drs / (Q1 * (Q1 + 1.0));
  return G1;
}


x86 assembly (clang, -O0):
<G>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%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  %xmm6,-0x38(%rbp)
mov    %rdi,-0x40(%rbp)
movsd  0xec1(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe99(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xea4(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
movsd  -0x8(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm4
movsd  -0x8(%rbp),%xmm3
movsd  -0x30(%rbp),%xmm6
movsd  -0x8(%rbp),%xmm5
movsd  -0x38(%rbp),%xmm7
mulsd  %xmm7,%xmm5
addsd  %xmm6,%xmm5
mulsd  %xmm5,%xmm3
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  0xe24(%rip),%xmm1
divsd  -0x50(%rbp),%xmm1
movsd  0xe17(%rip),%xmm0
addsd  %xmm1,%xmm0
call   1030 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
divsd  -0x8(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
addsd  %xmm2,%xmm2
addsd  %xmm1,%xmm2
movsd  -0x8(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm3
movsd  0xde7(%rip),%xmm4
mulsd  -0x38(%rbp),%xmm4
mulsd  -0x8(%rbp),%xmm4
movsd  0xdcd(%rip),%xmm5
mulsd  %xmm5,%xmm3
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xda4(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
mulsd  -0x58(%rbp),%xmm0
divsd  -0x48(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
mulsd  -0x60(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm2
movsd  0xd71(%rip),%xmm3
addsd  -0x50(%rbp),%xmm3
mulsd  %xmm3,%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x58(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<G>:
push   %rbx
sub    $0x50,%rsp
mov    %rdi,%rbx
movsd  %xmm6,0x20(%rsp)
movsd  %xmm5,0x28(%rsp)
movsd  %xmm4,0x10(%rsp)
movsd  %xmm3,(%rsp)
movsd  %xmm2,0x48(%rsp)
movsd  %xmm1,0x38(%rsp)
movsd  0xebc(%rip),%xmm8
mulsd  %xmm1,%xmm8
movsd  %xmm8,0x40(%rsp)
movapd %xmm0,%xmm7
mulsd  %xmm2,%xmm7
mulsd  %xmm0,%xmm7
movsd  0xea4(%rip),%xmm2
addsd  %xmm2,%xmm7
mulsd  %xmm8,%xmm7
movsd  %xmm7,0x18(%rsp)
addsd  %xmm1,%xmm1
movsd  %xmm0,0x8(%rsp)
mulsd  %xmm0,%xmm1
movapd %xmm0,%xmm7
mulsd  %xmm6,%xmm7
addsd  %xmm5,%xmm7
mulsd  %xmm0,%xmm7
addsd  %xmm4,%xmm7
mulsd  %xmm0,%xmm7
addsd  %xmm3,%xmm7
mulsd  %xmm1,%xmm7
movsd  %xmm7,0x30(%rsp)
movapd %xmm2,%xmm0
divsd  %xmm7,%xmm0
addsd  %xmm2,%xmm0
call   1030 <log@plt>
movsd  0x18(%rsp),%xmm4
mulsd  %xmm4,%xmm0
movsd  (%rsp),%xmm2
movsd  0x8(%rsp),%xmm3
divsd  %xmm3,%xmm2
movsd  0x10(%rsp),%xmm1
addsd  %xmm1,%xmm1
addsd  %xmm2,%xmm1
movapd %xmm1,%xmm2
movsd  0x20(%rsp),%xmm1
mulsd  0xe1f(%rip),%xmm1
mulsd  %xmm3,%xmm1
movapd %xmm3,%xmm5
movapd %xmm1,%xmm3
movsd  0x28(%rsp),%xmm1
mulsd  0xe0d(%rip),%xmm1
addsd  %xmm3,%xmm1
mulsd  %xmm5,%xmm1
addsd  %xmm2,%xmm1
mulsd  0x38(%rsp),%xmm1
movsd  0x40(%rsp),%xmm2
mulsd  0x48(%rsp),%xmm2
mulsd  %xmm0,%xmm2
divsd  %xmm4,%xmm2
mulsd  %xmm4,%xmm1
movsd  0xdcb(%rip),%xmm3
movsd  0x30(%rsp),%xmm4
addsd  %xmm4,%xmm3
mulsd  %xmm4,%xmm3
divsd  %xmm3,%xmm1
subsd  %xmm1,%xmm2
movsd  %xmm2,(%rbx)
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @G(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double* %7) {
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double*
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
store double %0, double* %9
store double %1, double* %10
store double %2, double* %11
store double %3, double* %12
store double %4, double* %13
store double %5, double* %14
store double %6, double* %15
store double* %7, double** %16
%21 = load double, double* %10
%22 = fmul double -2.000000e+00, %21
%23 = load double, double* %11
%24 = load double, double* %9
%25 = fmul double %23, %24
%26 = load double, double* %9
%27 = call double @llvm.fmuladd.f64(double %25, double %26, double 1.000000e+00)
%28 = fmul double %22, %27
store double %28, double* %17
%29 = load double, double* %10
%30 = fmul double 2.000000e+00, %29
%31 = load double, double* %9
%32 = fmul double %30, %31
%33 = load double, double* %12
%34 = load double, double* %9
%35 = load double, double* %13
%36 = load double, double* %9
%37 = load double, double* %14
%38 = load double, double* %9
%39 = load double, double* %15
%40 = call double @llvm.fmuladd.f64(double %38, double %39, double %37)
%41 = call double @llvm.fmuladd.f64(double %36, double %40, double %35)
%42 = call double @llvm.fmuladd.f64(double %34, double %41, double %33)
%43 = fmul double %32, %42
store double %43, double* %18
%44 = load double, double* %17
%45 = load double, double* %18
%46 = fdiv double 1.000000e+00, %45
%47 = fadd double 1.000000e+00, %46
%48 = call double @log(double %47)
%49 = fmul double %44, %48
store double %49, double* %19
%50 = load double, double* %10
%51 = load double, double* %12
%52 = load double, double* %9
%53 = fdiv double %51, %52
%54 = load double, double* %13
%55 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %54, double %53)
%56 = load double, double* %9
%57 = load double, double* %14
%58 = load double, double* %15
%59 = fmul double 4.000000e+00, %58
%60 = load double, double* %9
%61 = fmul double %59, %60
%62 = call double @llvm.fmuladd.f64(double 3.000000e+00, double %57, double %61)
%63 = call double @llvm.fmuladd.f64(double %56, double %62, double %55)
%64 = fmul double %50, %63
store double %64, double* %20
%65 = load double, double* %10
%66 = fmul double -2.000000e+00, %65
%67 = load double, double* %11
%68 = fmul double %66, %67
%69 = load double, double* %19
%70 = fmul double %68, %69
%71 = load double, double* %17
%72 = fdiv double %70, %71
%73 = load double, double* %17
%74 = load double, double* %20
%75 = fmul double %73, %74
%76 = load double, double* %18
%77 = load double, double* %18
%78 = fadd double %77, 1.000000e+00
%79 = fmul double %76, %78
%80 = fdiv double %75, %79
%81 = fsub double %72, %80
%82 = load double*, double** %16
store double %81, double* %82
%83 = load double, double* %19
ret double %83
}

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