#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 sqrt(double);
double f(double t, double a, double b) {
  double dx = (b - a) / 2;
  double x = ((b - a) / 2) * t + (b + a) / 2;
  return (sqrt(x) * log(x * x + 1) * dx);
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  0xebf(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  0xea4(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm1
addsd  -0x10(%rbp),%xmm1
movsd  0xe89(%rip),%xmm3
divsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1040 <sqrt@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe4b(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1030 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mulsd  -0x20(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
sub    $0x18,%rsp
movapd %xmm0,%xmm4
movapd %xmm2,%xmm3
subsd  %xmm1,%xmm3
movsd  0xec8(%rip),%xmm0
mulsd  %xmm0,%xmm3
addsd  %xmm2,%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm3,0x10(%rsp)
mulsd  %xmm3,%xmm4
addsd  %xmm1,%xmm4
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm4
jb     1165 <f+0x45>
xorps  %xmm0,%xmm0
sqrtsd %xmm4,%xmm0
jmp    117a <f+0x5a>
movapd %xmm4,%xmm0
movsd  %xmm4,0x8(%rsp)
call   1040 <sqrt@plt>
movsd  0x8(%rsp),%xmm4
movsd  %xmm0,(%rsp)
mulsd  %xmm4,%xmm4
addsd  0xe7d(%rip),%xmm4
movapd %xmm4,%xmm0
call   1030 <log@plt>
mulsd  (%rsp),%xmm0
mulsd  0x10(%rsp),%xmm0
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
define double @f(double %0, double %1, double %2) {
%4 = fsub double %2, %1
%5 = fmul double %4, 5.000000e-01
%6 = fadd double %1, %2
%7 = fmul double %6, 5.000000e-01
%8 = tail call double @llvm.fmuladd.f64(double %5, double %0, double %7)
%9 = tail call double @sqrt(double %8)
%10 = tail call double @llvm.fmuladd.f64(double %8, double %8, double 1.000000e+00)
%11 = tail call double @log(double %10)
%12 = fmul double %9, %11
%13 = fmul double %5, %12
ret double %13
}