#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 DBL_MIN;
double mismatch_rdp_assembled(double p, double q, void *data) {
  (void)data;
  double min = (p <= q) ? p : q;
  double value = 1 - (min - p * q / 3.0) / (p + q - 4.0 / 3.0 * p * q);
  return (value == 0) ? DBL_MIN : value;
}


x86 assembly (clang, -O0):
<mismatch_rdp_assembled>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1135 <mismatch_rdp_assembled+0x35>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    113f <mismatch_rdp_assembled+0x3f>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  0xeb0(%rip),%xmm2
divsd  %xmm2,%xmm0
subsd  %xmm0,%xmm1
movsd  -0x8(%rbp),%xmm2
addsd  -0x10(%rbp),%xmm2
movsd  0xe8e(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm3
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm3,%xmm0
addsd  %xmm2,%xmm0
divsd  %xmm0,%xmm1
movsd  0xe51(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11e5 <mismatch_rdp_assembled+0xe5>
jp     11e5 <mismatch_rdp_assembled+0xe5>
mov    0x2e09(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    11ef <mismatch_rdp_assembled+0xef>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<mismatch_rdp_assembled>:
movapd %xmm0,%xmm2
cmplesd %xmm1,%xmm2
movapd %xmm2,%xmm3
andpd  %xmm0,%xmm3
andnpd %xmm1,%xmm2
orpd   %xmm3,%xmm2
movapd %xmm0,%xmm3
mulsd  %xmm1,%xmm3
divsd  0xed7(%rip),%xmm3
addsd  %xmm2,%xmm3
movapd %xmm0,%xmm2
addsd  %xmm1,%xmm2
mulsd  0xecb(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  %xmm2,%xmm0
divsd  %xmm0,%xmm3
movsd  0xebf(%rip),%xmm1
subsd  %xmm3,%xmm1
mov    0x2e84(%rip),%rax
xorpd  %xmm2,%xmm2
cmpeqsd %xmm1,%xmm2
movsd  (%rax),%xmm0
andpd  %xmm2,%xmm0
andnpd %xmm1,%xmm2
orpd   %xmm2,%xmm0
ret

LLVM IR (-O0):
@DBL_MIN = global double 0.000000e+00
define double @mismatch_rdp_assembled(double %0, double %1, i8* %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca i8*
%7 = alloca double
%8 = alloca double
store double %0, double* %4
store double %1, double* %5
store i8* %2, i8** %6
%9 = load i8*, i8** %6
%10 = load double, double* %4
%11 = load double, double* %5
%12 = fcmp ole double %10, %11
br i1 %12, label %13, label %15
13: ; preds = %3
%14 = load double, double* %4
br label %17
15: ; preds = %3
%16 = load double, double* %5
br label %17
17: ; preds = %15, %13
%18 = phi double [ %14, %13 ], [ %16, %15 ]
store double %18, double* %7
%19 = load double, double* %7
%20 = load double, double* %4
%21 = load double, double* %5
%22 = fmul double %20, %21
%23 = fdiv double %22, 3.000000e+00
%24 = fsub double %19, %23
%25 = load double, double* %4
%26 = load double, double* %5
%27 = fadd double %25, %26
%28 = load double, double* %4
%29 = fmul double 0x3FF5555555555555, %28
%30 = load double, double* %5
%31 = fneg double %29
%32 = call double @llvm.fmuladd.f64(double %31, double %30, double %27)
%33 = fdiv double %24, %32
%34 = fsub double 1.000000e+00, %33
store double %34, double* %8
%35 = load double, double* %8
%36 = fcmp oeq double %35, 0.000000e+00
br i1 %36, label %37, label %39
37: ; preds = %17
%38 = load double, double* @DBL_MIN
br label %41
39: ; preds = %17
%40 = load double, double* %8
br label %41
41: ; preds = %39, %37
%42 = phi double [ %38, %37 ], [ %40, %39 ]
ret double %42
}

LLVM IR (-O2):
@DBL_MIN = global double 0.000000e+00
define double @mismatch_rdp_assembled(double %0, double %1, i8* nocapture readnone %2) {
%4 = fcmp ole double %0, %1
%5 = select i1 %4, double %0, double %1
%6 = fmul double %0, %1
%7 = fdiv double %6, 3.000000e+00
%8 = fsub double %5, %7
%9 = fadd double %0, %1
%10 = fmul double %0, 0xBFF5555555555555
%11 = tail call double @llvm.fmuladd.f64(double %10, double %1, double %9)
%12 = fdiv double %8, %11
%13 = fsub double 1.000000e+00, %12
%14 = fcmp oeq double %13, 0.000000e+00
%15 = load double, double* @DBL_MIN
%16 = select i1 %14, double %15, double %13
ret double %16
}