int otherLinesInBox(const int line, int *line1, int *line2) {
  switch (line % 3) {
  case 0:
    *line1 = line + 1;
    *line2 = line + 2;
    break;
  case 1:
    *line1 = line - 1;
    *line2 = line + 1;
    break;
  default:
    *line1 = line - 2;
    *line2 = line - 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<otherLinesInBox>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movslq -0x4(%rbp),%rcx
mov    %ecx,%eax
imul   $0x55555556,%rcx,%rdx
mov    %rdx,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rdx
add    %ecx,%edx
mov    %edx,%ecx
lea    (%rcx,%rcx,2),%ecx
sub    %ecx,%eax
mov    %eax,-0x1c(%rbp)
je     114f <otherLinesInBox+0x4f>
jmp    113e <otherLinesInBox+0x3e>
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
je     116c <otherLinesInBox+0x6c>
jmp    1189 <otherLinesInBox+0x89>
mov    -0x4(%rbp),%ecx
add    $0x1,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%ecx
add    $0x2,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    11a1 <otherLinesInBox+0xa1>
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%ecx
add    $0x1,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    11a1 <otherLinesInBox+0xa1>
mov    -0x4(%rbp),%ecx
sub    $0x2,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<otherLinesInBox>:
movslq %edi,%r8
imul   $0x55555556,%r8,%rcx
mov    %rcx,%rax
shr    $0x3f,%rax
shr    $0x20,%rcx
add    %eax,%ecx
lea    (%rcx,%rcx,2),%eax
sub    %eax,%r8d
je     1131 <otherLinesInBox+0x31>
cmp    $0x1,%r8d
jne    113d <otherLinesInBox+0x3d>
mov    $0x1,%eax
mov    $0xffffffff,%ecx
jmp    1147 <otherLinesInBox+0x47>
mov    $0x2,%eax
mov    $0x1,%ecx
jmp    1147 <otherLinesInBox+0x47>
mov    $0xffffffff,%eax
mov    $0xfffffffe,%ecx
add    %edi,%ecx
mov    %ecx,(%rsi)
add    %edi,%eax
mov    %eax,(%rdx)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @otherLinesInBox(i32 %0, i32* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
store i32 %0, i32* %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%7 = load i32, i32* %4
%8 = srem i32 %7, 3
switch i32 %8, label %23 [
i32 0, label %9
i32 1, label %16
]
9: ; preds = %3
%10 = load i32, i32* %4
%11 = add nsw i32 %10, 1
%12 = load i32*, i32** %5
store i32 %11, i32* %12
%13 = load i32, i32* %4
%14 = add nsw i32 %13, 2
%15 = load i32*, i32** %6
store i32 %14, i32* %15
br label %30
16: ; preds = %3
%17 = load i32, i32* %4
%18 = sub nsw i32 %17, 1
%19 = load i32*, i32** %5
store i32 %18, i32* %19
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
%22 = load i32*, i32** %6
store i32 %21, i32* %22
br label %30
23: ; preds = %3
%24 = load i32, i32* %4
%25 = sub nsw i32 %24, 2
%26 = load i32*, i32** %5
store i32 %25, i32* %26
%27 = load i32, i32* %4
%28 = sub nsw i32 %27, 1
%29 = load i32*, i32** %6
store i32 %28, i32* %29
br label %30
30: ; preds = %23, %16, %9
ret i32 0
}

LLVM IR (-O2):
define i32 @otherLinesInBox(i32 %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2) {
%4 = srem i32 %0, 3
switch i32 %4, label %6 [
i32 0, label %7
i32 1, label %5
]
5: ; preds = %3
br label %7
6: ; preds = %3
br label %7
7: ; preds = %3, %6, %5
%8 = phi i32 [ -2, %6 ], [ -1, %5 ], [ 1, %3 ]
%9 = phi i32 [ -1, %6 ], [ 1, %5 ], [ 2, %3 ]
%10 = add nsw i32 %8, %0
store i32 %10, i32* %1
%11 = add nsw i32 %9, %0
store i32 %11, i32* %2
ret i32 0
}