void restrict_boundbox(const double *restrict grid_bound_box,
                       double *restrict bound_box) {
  if (bound_box[0] < grid_bound_box[0] && bound_box[1] > grid_bound_box[0])
    bound_box[0] = grid_bound_box[0];
  if (bound_box[1] > grid_bound_box[1] && bound_box[0] < grid_bound_box[1])
    bound_box[1] = grid_bound_box[1];
}


x86 assembly (clang, -O0):
<restrict_boundbox>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    114d <restrict_boundbox+0x4d>
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
ucomisd (%rax),%xmm0
jbe    114d <restrict_boundbox+0x4d>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
ucomisd 0x8(%rax),%xmm0
jbe    1192 <restrict_boundbox+0x92>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    1192 <restrict_boundbox+0x92>
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<restrict_boundbox>:
movsd  (%rsi),%xmm0
movsd  0x8(%rsi),%xmm1
movsd  (%rdi),%xmm2
ucomisd %xmm0,%xmm2
jbe    1121 <restrict_boundbox+0x21>
ucomisd %xmm2,%xmm1
jbe    1121 <restrict_boundbox+0x21>
movsd  %xmm2,(%rsi)
movapd %xmm2,%xmm0
movsd  0x8(%rdi),%xmm2
ucomisd %xmm2,%xmm1
jbe    1137 <restrict_boundbox+0x37>
ucomisd %xmm0,%xmm2
jbe    1137 <restrict_boundbox+0x37>
movsd  %xmm2,0x8(%rsi)
ret

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

LLVM IR (-O2):
define void @restrict_boundbox(double* noalias nocapture %0, double* noalias nocapture %1) {
%3 = load double, double* %1
%4 = load double, double* %0
%5 = fcmp olt double %3, %4
%6 = getelementptr inbounds double, double* %1, i64 1
%7 = load double, double* %6
%8 = fcmp ogt double %7, %4
%9 = select i1 %5, i1 %8, i1 false
br i1 %9, label %10, label %11
10: ; preds = %2
store double %4, double* %1
br label %11
11: ; preds = %2, %10
%12 = phi double [ %4, %10 ], [ %3, %2 ]
%13 = getelementptr inbounds double, double* %0, i64 1
%14 = load double, double* %13
%15 = fcmp ogt double %7, %14
%16 = fcmp olt double %12, %14
%17 = select i1 %15, i1 %16, i1 false
br i1 %17, label %18, label %20
18: ; preds = %11
%19 = getelementptr inbounds double, double* %1, i64 1
store double %14, double* %19
br label %20
20: ; preds = %18, %11
ret void
}