int outcode(double x, double y, double r[4]) {
  int code = 0;
  if (x < r[0]) {
    code |= 1;
  } else if (x > r[1]) {
    code |= 2;
  }
  if (y < r[2]) {
    code |= 4;
  } else if (y > r[3]) {
    code |= 8;
  }
  return code;
}


x86 assembly (clang, -O0):
<outcode>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movsd  -0x8(%rbp),%xmm1
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    113e <outcode+0x3e>
mov    -0x1c(%rbp),%eax
or     $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1160 <outcode+0x60>
movsd  -0x8(%rbp),%xmm0
mov    -0x18(%rbp),%rax
ucomisd 0x8(%rax),%xmm0
jbe    115b <outcode+0x5b>
mov    -0x1c(%rbp),%eax
or     $0x2,%eax
mov    %eax,-0x1c(%rbp)
jmp    1160 <outcode+0x60>
movsd  -0x10(%rbp),%xmm1
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    1186 <outcode+0x86>
mov    -0x1c(%rbp),%eax
or     $0x4,%eax
mov    %eax,-0x1c(%rbp)
jmp    11a8 <outcode+0xa8>
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
ucomisd 0x18(%rax),%xmm0
jbe    11a3 <outcode+0xa3>
mov    -0x1c(%rbp),%eax
or     $0x8,%eax
mov    %eax,-0x1c(%rbp)
jmp    11a8 <outcode+0xa8>
mov    -0x1c(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<outcode>:
movsd  (%rdi),%xmm2
mov    $0x1,%eax
ucomisd %xmm0,%xmm2
ja     111d <outcode+0x1d>
xor    %eax,%eax
ucomisd 0x8(%rdi),%xmm0
jbe    111d <outcode+0x1d>
mov    $0x2,%eax
movsd  0x10(%rdi),%xmm0
ucomisd %xmm1,%xmm0
jbe    112c <outcode+0x2c>
or     $0x4,%eax
ret
ucomisd 0x18(%rdi),%xmm1
jbe    1136 <outcode+0x36>
or     $0x8,%eax
ret

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

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