int reg_rectangle_overlap(double *xpos1, double *ypos1, double *xpos2,
                          double *ypos2) {
  if (xpos1[1] < xpos2[0] || xpos1[0] > xpos2[1] || ypos1[1] < ypos2[0] ||
      ypos1[0] > ypos2[1]) {
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<reg_rectangle_overlap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
ja     1178 <reg_rectangle_overlap+0x78>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x20(%rbp),%rax
ucomisd 0x8(%rax),%xmm0
ja     1178 <reg_rectangle_overlap+0x78>
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
ja     1178 <reg_rectangle_overlap+0x78>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x28(%rbp),%rax
ucomisd 0x8(%rax),%xmm0
jbe    1184 <reg_rectangle_overlap+0x84>
movl   $0x0,-0x4(%rbp)
jmp    118b <reg_rectangle_overlap+0x8b>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<reg_rectangle_overlap>:
movsd  (%rdx),%xmm0
xor    %eax,%eax
ucomisd 0x8(%rdi),%xmm0
ja     1133 <reg_rectangle_overlap+0x33>
movsd  (%rdi),%xmm0
ucomisd 0x8(%rdx),%xmm0
ja     1133 <reg_rectangle_overlap+0x33>
movsd  (%rcx),%xmm0
ucomisd 0x8(%rsi),%xmm0
ja     1133 <reg_rectangle_overlap+0x33>
movsd  (%rsi),%xmm0
ucomisd 0x8(%rcx),%xmm0
ja     1133 <reg_rectangle_overlap+0x33>
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @reg_rectangle_overlap(double* nocapture %0, double* nocapture %1, double* nocapture %2, double* nocapture %3) {
%5 = getelementptr inbounds double, double* %0, i64 1
%6 = load double, double* %5
%7 = load double, double* %2
%8 = fcmp olt double %6, %7
br i1 %8, label %25, label %9
9: ; preds = %4
%10 = load double, double* %0
%11 = getelementptr inbounds double, double* %2, i64 1
%12 = load double, double* %11
%13 = fcmp ogt double %10, %12
br i1 %13, label %25, label %14
14: ; preds = %9
%15 = getelementptr inbounds double, double* %1, i64 1
%16 = load double, double* %15
%17 = load double, double* %3
%18 = fcmp olt double %16, %17
br i1 %18, label %25, label %19
19: ; preds = %14
%20 = load double, double* %1
%21 = getelementptr inbounds double, double* %3, i64 1
%22 = load double, double* %21
%23 = fcmp ogt double %20, %22
br i1 %23, label %25, label %24
24: ; preds = %19
br label %25
25: ; preds = %4, %9, %14, %19, %24
%26 = phi i32 [ 1, %24 ], [ 0, %19 ], [ 0, %14 ], [ 0, %9 ], [ 0, %4 ]
ret i32 %26
}