#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 log1p(double);
double log2v(double a, double b) {
  double max, min;
  max = (a > b) ? a : b;
  min = (a <= b) ? a : b;
  return (log(max) + log1p(min / max));
}


x86 assembly (clang, -O0):
<log2v>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1151 <log2v+0x31>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    115b <log2v+0x3b>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1188 <log2v+0x68>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1192 <log2v+0x72>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <log@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
call   1040 <log1p@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
addsd  %xmm1,%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log2v>:
sub    $0x38,%rsp
movapd %xmm0,%xmm3
maxsd  %xmm1,%xmm3
movapd %xmm3,0x10(%rsp)
movapd %xmm0,%xmm2
cmplesd %xmm1,%xmm2
andpd  %xmm2,%xmm0
andnpd %xmm1,%xmm2
orpd   %xmm2,%xmm0
movapd %xmm0,0x20(%rsp)
movapd %xmm3,%xmm0
call   1030 <log@plt>
movsd  %xmm0,0x8(%rsp)
movapd 0x20(%rsp),%xmm0
divsd  0x10(%rsp),%xmm0
call   1040 <log1p@plt>
addsd  0x8(%rsp),%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
define double @log2v(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %3
store double %1, double* %4
%7 = load double, double* %3
%8 = load double, double* %4
%9 = fcmp ogt double %7, %8
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = load double, double* %3
br label %14
12: ; preds = %2
%13 = load double, double* %4
br label %14
14: ; preds = %12, %10
%15 = phi double [ %11, %10 ], [ %13, %12 ]
store double %15, double* %5
%16 = load double, double* %3
%17 = load double, double* %4
%18 = fcmp ole double %16, %17
br i1 %18, label %19, label %21
19: ; preds = %14
%20 = load double, double* %3
br label %23
21: ; preds = %14
%22 = load double, double* %4
br label %23
23: ; preds = %21, %19
%24 = phi double [ %20, %19 ], [ %22, %21 ]
store double %24, double* %6
%25 = load double, double* %5
%26 = call double @log(double %25)
%27 = load double, double* %6
%28 = load double, double* %5
%29 = fdiv double %27, %28
%30 = call double @log1p(double %29)
%31 = fadd double %26, %30
ret double %31
}

LLVM IR (-O2):
define double @log2v(double %0, double %1) {
%3 = fcmp ogt double %0, %1
%4 = select i1 %3, double %0, double %1
%5 = fcmp ole double %0, %1
%6 = select i1 %5, double %0, double %1
%7 = tail call double @log(double %4)
%8 = fdiv double %6, %4
%9 = tail call double @log1p(double %8)
%10 = fadd double %7, %9
ret double %10
}