int foo(int a, int b) {
  __label__ z;
  int x;
  int y;
  static void *p;
  switch (a) {
  case 2:
    x = 4;
    break;
  case 4:
    x = 6;
    break;
  case 8:
  case 10:
  case 13:
  case 11:
  case 17:
  case 19:
    x = 7;
    break;
  default:
    x = -1;
    break;
  }
  switch (b) {
  case 2:
    y = 4;
    break;
  case 4:
    y = 6;
    break;
  case 8:
  case 10:
  case 13:
  case 11:
  case 17:
  case 19:
    y = 7;
    break;
  default:
    y = -1;
    break;
  }
z:
  p = &&z;
  return x * y;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x2,%eax
je     1187 <foo+0x87>
jmp    111e <foo+0x1e>
mov    -0x14(%rbp),%eax
sub    $0x4,%eax
je     1193 <foo+0x93>
jmp    112f <foo+0x2f>
mov    -0x14(%rbp),%eax
sub    $0x8,%eax
je     119f <foo+0x9f>
jmp    1140 <foo+0x40>
mov    -0x14(%rbp),%eax
add    $0xfffffff6,%eax
sub    $0x2,%eax
jb     119f <foo+0x9f>
jmp    1154 <foo+0x54>
mov    -0x14(%rbp),%eax
sub    $0xd,%eax
je     119f <foo+0x9f>
jmp    1165 <foo+0x65>
mov    -0x14(%rbp),%eax
sub    $0x11,%eax
je     119f <foo+0x9f>
jmp    1176 <foo+0x76>
mov    -0x14(%rbp),%eax
sub    $0x13,%eax
je     119f <foo+0x9f>
jmp    11ab <foo+0xab>
movl   $0x4,-0xc(%rbp)
jmp    11b2 <foo+0xb2>
movl   $0x6,-0xc(%rbp)
jmp    11b2 <foo+0xb2>
movl   $0x7,-0xc(%rbp)
jmp    11b2 <foo+0xb2>
movl   $0xffffffff,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0x2,%eax
je     122f <foo+0x12f>
jmp    11c6 <foo+0xc6>
mov    -0x18(%rbp),%eax
sub    $0x4,%eax
je     123b <foo+0x13b>
jmp    11d7 <foo+0xd7>
mov    -0x18(%rbp),%eax
sub    $0x8,%eax
je     1247 <foo+0x147>
jmp    11e8 <foo+0xe8>
mov    -0x18(%rbp),%eax
add    $0xfffffff6,%eax
sub    $0x2,%eax
jb     1247 <foo+0x147>
jmp    11fc <foo+0xfc>
mov    -0x18(%rbp),%eax
sub    $0xd,%eax
je     1247 <foo+0x147>
jmp    120d <foo+0x10d>
mov    -0x18(%rbp),%eax
sub    $0x11,%eax
je     1247 <foo+0x147>
jmp    121e <foo+0x11e>
mov    -0x18(%rbp),%eax
sub    $0x13,%eax
je     1247 <foo+0x147>
jmp    1253 <foo+0x153>
movl   $0x4,-0x10(%rbp)
jmp    125a <foo+0x15a>
movl   $0x6,-0x10(%rbp)
jmp    125a <foo+0x15a>
movl   $0x7,-0x10(%rbp)
jmp    125a <foo+0x15a>
movl   $0xffffffff,-0x10(%rbp)
jmp    125f <foo+0x15f>
lea    -0x7(%rip),%rax
mov    %rax,0x2dbb(%rip)
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
add    $0xfffffffe,%edi
mov    $0xffffffff,%eax
mov    $0xffffffff,%ecx
cmp    $0x11,%edi
ja     111f <foo+0x1f>
movslq %edi,%rcx
lea    0xee4(%rip),%rdx
mov    (%rdx,%rcx,4),%ecx
add    $0xfffffffe,%esi
cmp    $0x11,%esi
ja     1134 <foo+0x34>
movslq %esi,%rax
lea    0xecf(%rip),%rdx
mov    (%rdx,%rax,4),%eax
imul   %ecx,%eax
ret

LLVM IR (-O0):
@foo.p = internal global i8* null
define i32 @foo(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
switch i32 %7, label %11 [
i32 2, label %8
i32 4, label %9
i32 8, label %10
i32 10, label %10
i32 13, label %10
i32 11, label %10
i32 17, label %10
i32 19, label %10
]
8: ; preds = %2
store i32 4, i32* %5
br label %12
9: ; preds = %2
store i32 6, i32* %5
br label %12
10: ; preds = %2, %2, %2, %2, %2, %2
store i32 7, i32* %5
br label %12
11: ; preds = %2
store i32 -1, i32* %5
br label %12
12: ; preds = %11, %10, %9, %8
%13 = load i32, i32* %4
switch i32 %13, label %17 [
i32 2, label %14
i32 4, label %15
i32 8, label %16
i32 10, label %16
i32 13, label %16
i32 11, label %16
i32 17, label %16
i32 19, label %16
]
14: ; preds = %12
store i32 4, i32* %6
br label %18
15: ; preds = %12
store i32 6, i32* %6
br label %18
16: ; preds = %12, %12, %12, %12, %12, %12
store i32 7, i32* %6
br label %18
17: ; preds = %12
store i32 -1, i32* %6
br label %18
18: ; preds = %17, %16, %15, %14
br label %19
19: ; preds = %23, %18
store i8* blockaddress(@foo, %19), i8** @foo.p
%20 = load i32, i32* %5
%21 = load i32, i32* %6
%22 = mul nsw i32 %20, %21
ret i32 %22
23: ; No predecessors!
indirectbr i8* undef, [label %19]
}

LLVM IR (-O2):
@switch.table.foo.1 = [18 x i32] [i32 4, i32 -1, i32 6, i32 -1, i32 -1, i32 -1, i32 7, i32 -1, i32 7, i32 7, i32 -1, i32 7, i32 -1, i32 -1, i32 -1, i32 7, i32 -1, i32 7]
define i32 @foo(i32 %0, i32 %1) {
%3 = add i32 %0, -2
%4 = icmp ult i32 %3, 18
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = sext i32 %3 to i64
%7 = getelementptr inbounds [18 x i32], [18 x i32]* @switch.table.foo.1, i64 0, i64 %6
%8 = load i32, i32* %7
br label %9
9: ; preds = %2, %5
%10 = phi i32 [ %8, %5 ], [ -1, %2 ]
%11 = add i32 %1, -2
%12 = icmp ult i32 %11, 18
br i1 %12, label %13, label %17
13: ; preds = %9
%14 = sext i32 %11 to i64
%15 = getelementptr inbounds [18 x i32], [18 x i32]* @switch.table.foo.1, i64 0, i64 %14
%16 = load i32, i32* %15
br label %17
17: ; preds = %9, %13
%18 = phi i32 [ %16, %13 ], [ -1, %9 ]
%19 = mul nsw i32 %18, %10
ret i32 %19
}