int half_stereo_bond_action(int nParity, int bUnknown, int bIsotopic) {
  int nAction;
  if (nParity == 0)
    return 0;
  if (nParity == 4)
    nParity = 1 | 0x20;
  if (nParity == -4)
    nParity = 1 | 0x20 | 0x10;
  if (nParity < 0)
    nParity = ((nParity == -2) ? 1 : (-nParity)) | 0x10;
  else if (nParity == 2)
    nParity = 1;
  if (bUnknown)
    nParity |= 0x20;
  if (bIsotopic) {
    switch (nParity) {
    case 1:
    case 1 | 0x10:
      nAction = 6;
      break;
    case 1 | 0x20:
    case 4 | 0x20:
    case 1 | 0x20 | 0x10:
    case 4 | 0x20 | 0x10:
      nAction = 4;
      break;
    case 5:
    case 5 | 0x20:
      nAction = 0;
      break;
    case 4:
    case 4 | 0x10:
      nAction = 4;
      break;
    default:
      nAction = -1;
    }
  } else {
    switch (nParity) {
    case 1:
      nAction = 6;
      break;
    case 1 | 0x20:
    case 4 | 0x20:
      nAction = 4;
      break;
    case 4:
      nAction = 4;
      break;
    case 1 | 0x20 | 0x10:
    case 1 | 0x10:
    case 5:
    case 5 | 0x20:
    case 4 | 0x10:
    case 4 | 0x20 | 0x10:
      nAction = 0;
      break;
    default:
      nAction = -1;
    }
  }
  return nAction;
}


x86 assembly (clang, -O0):
<half_stereo_bond_action>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1123 <half_stereo_bond_action+0x23>
movl   $0x0,-0x4(%rbp)
jmp    127f <half_stereo_bond_action+0x17f>
cmpl   $0x4,-0x8(%rbp)
jne    1134 <half_stereo_bond_action+0x34>
movl   $0x21,-0x8(%rbp)
cmpl   $0xfffffffc,-0x8(%rbp)
jne    1145 <half_stereo_bond_action+0x45>
movl   $0x31,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    117c <half_stereo_bond_action+0x7c>
cmpl   $0xfffffffe,-0x8(%rbp)
jne    1166 <half_stereo_bond_action+0x66>
mov    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    116e <half_stereo_bond_action+0x6e>
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
or     $0x10,%eax
mov    %eax,-0x8(%rbp)
jmp    1192 <half_stereo_bond_action+0x92>
cmpl   $0x2,-0x8(%rbp)
jne    118d <half_stereo_bond_action+0x8d>
movl   $0x1,-0x8(%rbp)
jmp    1192 <half_stereo_bond_action+0x92>
cmpl   $0x0,-0xc(%rbp)
je     11a5 <half_stereo_bond_action+0xa5>
mov    -0x8(%rbp),%eax
or     $0x20,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     1214 <half_stereo_bond_action+0x114>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x33,%eax
ja     1208 <half_stereo_bond_action+0x108>
mov    -0x20(%rbp),%rax
lea    0xf01(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x6,-0x14(%rbp)
jmp    120f <half_stereo_bond_action+0x10f>
movl   $0x4,-0x14(%rbp)
jmp    120f <half_stereo_bond_action+0x10f>
movl   $0x0,-0x14(%rbp)
jmp    120f <half_stereo_bond_action+0x10f>
movl   $0x4,-0x14(%rbp)
jmp    120f <half_stereo_bond_action+0x10f>
movl   $0xffffffff,-0x14(%rbp)
jmp    1279 <half_stereo_bond_action+0x179>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x33,%eax
ja     126d <half_stereo_bond_action+0x16d>
mov    -0x28(%rbp),%rax
lea    0xdcc(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x6,-0x14(%rbp)
jmp    1274 <half_stereo_bond_action+0x174>
movl   $0x4,-0x14(%rbp)
jmp    1274 <half_stereo_bond_action+0x174>
movl   $0x4,-0x14(%rbp)
jmp    1274 <half_stereo_bond_action+0x174>
movl   $0x0,-0x14(%rbp)
jmp    1274 <half_stereo_bond_action+0x174>
movl   $0xffffffff,-0x14(%rbp)
jmp    1279 <half_stereo_bond_action+0x179>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<half_stereo_bond_action>:
xor    %eax,%eax
test   %edi,%edi
je     116a <half_stereo_bond_action+0x6a>
cmp    $0x4,%edi
mov    $0x21,%ecx
cmovne %edi,%ecx
cmp    $0xfffffffc,%ecx
mov    $0x31,%eax
cmovne %ecx,%eax
test   %eax,%eax
js     112d <half_stereo_bond_action+0x2d>
cmp    $0x2,%eax
mov    $0x1,%edi
cmovne %eax,%edi
jmp    113f <half_stereo_bond_action+0x3f>
mov    %eax,%ecx
neg    %ecx
or     $0x10,%ecx
cmp    $0xfffffffe,%eax
mov    $0x11,%edi
cmovne %ecx,%edi
mov    %edi,%ecx
or     $0x20,%ecx
test   %esi,%esi
cmove  %edi,%ecx
add    $0xffffffff,%ecx
test   %edx,%edx
je     116b <half_stereo_bond_action+0x6b>
cmp    $0x33,%ecx
ja     118e <half_stereo_bond_action+0x8e>
mov    $0x6,%eax
lea    0xe9f(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
ret
cmp    $0x33,%ecx
ja     118e <half_stereo_bond_action+0x8e>
mov    $0x6,%eax
lea    0xf54(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
xor    %eax,%eax
ret
mov    $0x4,%eax
ret
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @half_stereo_bond_action(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%9 = load i32, i32* %5
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %3
store i32 0, i32* %4
br label %65
12: ; preds = %3
%13 = load i32, i32* %5
%14 = icmp eq i32 %13, 4
br i1 %14, label %15, label %16
15: ; preds = %12
store i32 33, i32* %5
br label %16
16: ; preds = %15, %12
%17 = load i32, i32* %5
%18 = icmp eq i32 %17, -4
br i1 %18, label %19, label %20
19: ; preds = %16
store i32 49, i32* %5
br label %20
20: ; preds = %19, %16
%21 = load i32, i32* %5
%22 = icmp slt i32 %21, 0
br i1 %22, label %23, label %33
23: ; preds = %20
%24 = load i32, i32* %5
%25 = icmp eq i32 %24, -2
br i1 %25, label %26, label %27
26: ; preds = %23
br label %30
27: ; preds = %23
%28 = load i32, i32* %5
%29 = sub nsw i32 0, %28
br label %30
30: ; preds = %27, %26
%31 = phi i32 [ 1, %26 ], [ %29, %27 ]
%32 = or i32 %31, 16
store i32 %32, i32* %5
br label %38
33: ; preds = %20
%34 = load i32, i32* %5
%35 = icmp eq i32 %34, 2
br i1 %35, label %36, label %37
36: ; preds = %33
store i32 1, i32* %5
br label %37
37: ; preds = %36, %33
br label %38
38: ; preds = %37, %30
%39 = load i32, i32* %6
%40 = icmp ne i32 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %38
%42 = load i32, i32* %5
%43 = or i32 %42, 32
store i32 %43, i32* %5
br label %44
44: ; preds = %41, %38
%45 = load i32, i32* %7
%46 = icmp ne i32 %45, 0
br i1 %46, label %47, label %55
47: ; preds = %44
%48 = load i32, i32* %5
switch i32 %48, label %53 [
i32 1, label %49
i32 17, label %49
i32 33, label %50
i32 36, label %50
i32 49, label %50
i32 52, label %50
i32 5, label %51
i32 37, label %51
i32 4, label %52
i32 20, label %52
]
49: ; preds = %47, %47
store i32 6, i32* %8
br label %54
50: ; preds = %47, %47, %47, %47
store i32 4, i32* %8
br label %54
51: ; preds = %47, %47
store i32 0, i32* %8
br label %54
52: ; preds = %47, %47
store i32 4, i32* %8
br label %54
53: ; preds = %47
store i32 -1, i32* %8
br label %54
54: ; preds = %53, %52, %51, %50, %49
br label %63
55: ; preds = %44
%56 = load i32, i32* %5
switch i32 %56, label %61 [
i32 1, label %57
i32 33, label %58
i32 36, label %58
i32 4, label %59
i32 49, label %60
i32 17, label %60
i32 5, label %60
i32 37, label %60
i32 20, label %60
i32 52, label %60
]
57: ; preds = %55
store i32 6, i32* %8
br label %62
58: ; preds = %55, %55
store i32 4, i32* %8
br label %62
59: ; preds = %55
store i32 4, i32* %8
br label %62
60: ; preds = %55, %55, %55, %55, %55, %55
store i32 0, i32* %8
br label %62
61: ; preds = %55
store i32 -1, i32* %8
br label %62
62: ; preds = %61, %60, %59, %58, %57
br label %63
63: ; preds = %62, %54
%64 = load i32, i32* %8
store i32 %64, i32* %4
br label %65
65: ; preds = %63, %11
%66 = load i32, i32* %4
ret i32 %66
}

LLVM IR (-O2):
define i32 @half_stereo_bond_action(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %0, 0
br i1 %4, label %35, label %5
5: ; preds = %3
%6 = icmp eq i32 %0, 4
%7 = select i1 %6, i32 33, i32 %0
%8 = icmp eq i32 %7, -4
%9 = select i1 %8, i32 49, i32 %7
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %16
11: ; preds = %5
%12 = icmp eq i32 %9, -2
%13 = sub nsw i32 0, %9
%14 = or i32 %13, 16
%15 = select i1 %12, i32 17, i32 %14
br label %19
16: ; preds = %5
%17 = icmp eq i32 %9, 2
%18 = select i1 %17, i32 1, i32 %9
br label %19
19: ; preds = %16, %11
%20 = phi i32 [ %15, %11 ], [ %18, %16 ]
%21 = icmp eq i32 %1, 0
%22 = or i32 %20, 32
%23 = select i1 %21, i32 %20, i32 %22
%24 = icmp eq i32 %2, 0
br i1 %24, label %30, label %25
25: ; preds = %19
switch i32 %23, label %29 [
i32 1, label %35
i32 17, label %35
i32 33, label %26
i32 36, label %26
i32 49, label %26
i32 52, label %26
i32 5, label %27
i32 37, label %27
i32 4, label %28
i32 20, label %28
]
26: ; preds = %25, %25, %25, %25
br label %35
27: ; preds = %25, %25
br label %35
28: ; preds = %25, %25
br label %35
29: ; preds = %25
br label %35
30: ; preds = %19
switch i32 %23, label %34 [
i32 1, label %35
i32 33, label %31
i32 36, label %31
i32 4, label %32
i32 49, label %33
i32 17, label %33
i32 5, label %33
i32 37, label %33
i32 20, label %33
i32 52, label %33
]
31: ; preds = %30, %30
br label %35
32: ; preds = %30
br label %35
33: ; preds = %30, %30, %30, %30, %30, %30
br label %35
34: ; preds = %30
br label %35
35: ; preds = %29, %28, %27, %26, %34, %33, %32, %31, %25, %25, %30, %3
%36 = phi i32 [ 0, %3 ], [ -1, %29 ], [ 4, %28 ], [ 0, %27 ], [ 4, %26 ], [ -1, %34 ], [ 0, %33 ], [ 4, %32 ], [ 4, %31 ], [ 6, %25 ], [ 6, %25 ], [ 6, %30 ]
ret i32 %36
}