#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 */
bool overlap(double from_1, double to_1, double from_2, double to_2) {
  return (from_1 > from_2 && to_1 < to_2) || (from_2 > from_1 && to_2 < to_1) ||
         (to_2 > from_1 && to_2 < to_1) || (to_1 > from_2 && to_1 < to_2);
}


x86 assembly (clang, -O0):
<overlap>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1141 <overlap+0x41>
movsd  -0x10(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
mov    $0x1,%al
ucomisd %xmm1,%xmm0
mov    %al,-0x21(%rbp)
ja     11c2 <overlap+0xc2>
movsd  -0x18(%rbp),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    116a <overlap+0x6a>
movsd  -0x20(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
mov    $0x1,%al
ucomisd %xmm1,%xmm0
mov    %al,-0x21(%rbp)
ja     11c2 <overlap+0xc2>
movsd  -0x20(%rbp),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1193 <overlap+0x93>
movsd  -0x20(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
mov    $0x1,%al
ucomisd %xmm1,%xmm0
mov    %al,-0x21(%rbp)
ja     11c2 <overlap+0xc2>
movsd  -0x10(%rbp),%xmm0
xor    %eax,%eax
ucomisd -0x18(%rbp),%xmm0
mov    %al,-0x22(%rbp)
jbe    11bc <overlap+0xbc>
movsd  -0x10(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
mov    %al,-0x22(%rbp)
mov    -0x22(%rbp),%al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<overlap>:
ucomisd %xmm2,%xmm0
mov    $0x1,%eax
jbe    1112 <overlap+0x12>
ucomisd %xmm1,%xmm3
jbe    1112 <overlap+0x12>
ret
ucomisd %xmm0,%xmm2
seta   %cl
ucomisd %xmm0,%xmm3
seta   %dl
ucomisd %xmm3,%xmm1
jbe    112a <overlap+0x2a>
or     %dl,%cl
jne    1111 <overlap+0x11>
ucomisd %xmm1,%xmm3
seta   %al
ucomisd %xmm2,%xmm1
seta   %cl
and    %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @overlap(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%9 = load double, double* %5
%10 = load double, double* %7
%11 = fcmp ogt double %9, %10
br i1 %11, label %12, label %16
12: ; preds = %4
%13 = load double, double* %6
%14 = load double, double* %8
%15 = fcmp olt double %13, %14
br i1 %15, label %42, label %16
16: ; preds = %12, %4
%17 = load double, double* %7
%18 = load double, double* %5
%19 = fcmp ogt double %17, %18
br i1 %19, label %20, label %24
20: ; preds = %16
%21 = load double, double* %8
%22 = load double, double* %6
%23 = fcmp olt double %21, %22
br i1 %23, label %42, label %24
24: ; preds = %20, %16
%25 = load double, double* %8
%26 = load double, double* %5
%27 = fcmp ogt double %25, %26
br i1 %27, label %28, label %32
28: ; preds = %24
%29 = load double, double* %8
%30 = load double, double* %6
%31 = fcmp olt double %29, %30
br i1 %31, label %42, label %32
32: ; preds = %28, %24
%33 = load double, double* %6
%34 = load double, double* %7
%35 = fcmp ogt double %33, %34
br i1 %35, label %36, label %40
36: ; preds = %32
%37 = load double, double* %6
%38 = load double, double* %8
%39 = fcmp olt double %37, %38
br label %40
40: ; preds = %36, %32
%41 = phi i1 [ false, %32 ], [ %39, %36 ]
br label %42
42: ; preds = %40, %28, %20, %12
%43 = phi i1 [ true, %28 ], [ true, %20 ], [ true, %12 ], [ %41, %40 ]
%44 = zext i1 %43 to i32
ret i32 %44
}

LLVM IR (-O2):
define i32 @overlap(double %0, double %1, double %2, double %3) {
%5 = fcmp ogt double %0, %2
%6 = fcmp olt double %1, %3
%7 = and i1 %5, %6
br i1 %7, label %18, label %8
8: ; preds = %4
%9 = fcmp ogt double %2, %0
%10 = fcmp olt double %3, %1
%11 = fcmp ogt double %3, %0
%12 = or i1 %9, %11
%13 = and i1 %10, %12
br i1 %13, label %18, label %14
14: ; preds = %8
%15 = fcmp ogt double %1, %2
%16 = and i1 %15, %6
%17 = zext i1 %16 to i32
br label %18
18: ; preds = %8, %4, %14
%19 = phi i32 [ %17, %14 ], [ 1, %4 ], [ 1, %8 ]
ret i32 %19
}