char WhichColumnSort(int m, int s) {
  int sum = m + s;
  char c = 'x';
  if (m == 0)
    switch (sum) {
    case 1:
      c = '0';
      break;
    case 2:
      c = '2';
      break;
    case 3:
      c = '4';
      break;
    case 4:
      c = '1';
      break;
    case 5:
      c = '3';
      break;
    case 6:
      c = '5';
      break;
    case 7:
      c = '6';
    }
  else if (m == 1)
    switch (sum) {
    case 2:
      c = '0';
      break;
    case 3:
      c = '2';
      break;
    case 4:
      c = '4';
      break;
    case 5:
      c = '1';
      break;
    case 6:
      c = '3';
      break;
    case 7:
      c = '5';
      break;
    case 8:
      c = '6';
      break;
    case 9:
      c = '9';
    }
  else if (m == 2)
    switch (sum) {
    case 3:
      c = '0';
      break;
    case 4:
      c = '2';
      break;
    case 5:
      c = '4';
      break;
    case 6:
      c = '7';
    }
  else if (m == 3)
    switch (sum) {
    case 4:
      c = '1';
      break;
    case 5:
      c = '3';
      break;
    case 6:
      c = '5';
      break;
    case 7:
      c = '8';
    }
  else if (m == 4)
    switch (sum) {
    case 5:
      c = '0';
      break;
    case 6:
      c = '1';
    }
  return c;
}


x86 assembly (clang, -O0):
<WhichColumnSort>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
movb   $0x78,-0xd(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1189 <WhichColumnSort+0x89>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x6,%eax
ja     1184 <WhichColumnSort+0x84>
mov    -0x18(%rbp),%rax
lea    0xeff(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0x30,-0xd(%rbp)
jmp    1184 <WhichColumnSort+0x84>
movb   $0x32,-0xd(%rbp)
jmp    1184 <WhichColumnSort+0x84>
movb   $0x34,-0xd(%rbp)
jmp    1184 <WhichColumnSort+0x84>
movb   $0x31,-0xd(%rbp)
jmp    1184 <WhichColumnSort+0x84>
movb   $0x33,-0xd(%rbp)
jmp    1184 <WhichColumnSort+0x84>
movb   $0x35,-0xd(%rbp)
jmp    1184 <WhichColumnSort+0x84>
movb   $0x36,-0xd(%rbp)
jmp    1307 <WhichColumnSort+0x207>
cmpl   $0x1,-0x4(%rbp)
jne    1204 <WhichColumnSort+0x104>
mov    -0xc(%rbp),%eax
add    $0xfffffffe,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x7,%eax
ja     11ff <WhichColumnSort+0xff>
mov    -0x20(%rbp),%rax
lea    0xe6d(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0x30,-0xd(%rbp)
jmp    11ff <WhichColumnSort+0xff>
movb   $0x32,-0xd(%rbp)
jmp    11ff <WhichColumnSort+0xff>
movb   $0x34,-0xd(%rbp)
jmp    11ff <WhichColumnSort+0xff>
movb   $0x31,-0xd(%rbp)
jmp    11ff <WhichColumnSort+0xff>
movb   $0x33,-0xd(%rbp)
jmp    11ff <WhichColumnSort+0xff>
movb   $0x35,-0xd(%rbp)
jmp    11ff <WhichColumnSort+0xff>
movb   $0x36,-0xd(%rbp)
jmp    11ff <WhichColumnSort+0xff>
movb   $0x39,-0xd(%rbp)
jmp    1302 <WhichColumnSort+0x202>
cmpl   $0x2,-0x4(%rbp)
jne    125b <WhichColumnSort+0x15b>
mov    -0xc(%rbp),%eax
add    $0xfffffffd,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x3,%eax
ja     1256 <WhichColumnSort+0x156>
mov    -0x28(%rbp),%rax
lea    0xde2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0x30,-0xd(%rbp)
jmp    1256 <WhichColumnSort+0x156>
movb   $0x32,-0xd(%rbp)
jmp    1256 <WhichColumnSort+0x156>
movb   $0x34,-0xd(%rbp)
jmp    1256 <WhichColumnSort+0x156>
movb   $0x37,-0xd(%rbp)
jmp    12fd <WhichColumnSort+0x1fd>
cmpl   $0x3,-0x4(%rbp)
jne    12b2 <WhichColumnSort+0x1b2>
mov    -0xc(%rbp),%eax
add    $0xfffffffc,%eax
mov    %eax,%ecx
mov    %rcx,-0x30(%rbp)
sub    $0x3,%eax
ja     12ad <WhichColumnSort+0x1ad>
mov    -0x30(%rbp),%rax
lea    0xd7b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0x31,-0xd(%rbp)
jmp    12ad <WhichColumnSort+0x1ad>
movb   $0x33,-0xd(%rbp)
jmp    12ad <WhichColumnSort+0x1ad>
movb   $0x35,-0xd(%rbp)
jmp    12ad <WhichColumnSort+0x1ad>
movb   $0x38,-0xd(%rbp)
jmp    12f8 <WhichColumnSort+0x1f8>
cmpl   $0x4,-0x4(%rbp)
jne    12f3 <WhichColumnSort+0x1f3>
mov    -0xc(%rbp),%eax
mov    %eax,-0x34(%rbp)
sub    $0x5,%eax
je     12e1 <WhichColumnSort+0x1e1>
jmp    12d0 <WhichColumnSort+0x1d0>
mov    -0x34(%rbp),%eax
sub    $0x6,%eax
je     12ea <WhichColumnSort+0x1ea>
jmp    12ee <WhichColumnSort+0x1ee>
movb   $0x30,-0xd(%rbp)
jmp    12ee <WhichColumnSort+0x1ee>
movb   $0x31,-0xd(%rbp)
jmp    12f3 <WhichColumnSort+0x1f3>
jmp    12f8 <WhichColumnSort+0x1f8>
jmp    12fd <WhichColumnSort+0x1fd>
jmp    1302 <WhichColumnSort+0x202>
jmp    1307 <WhichColumnSort+0x207>
movsbl -0xd(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<WhichColumnSort>:
mov    $0x78,%al
cmp    $0x4,%edi
ja     1173 <WhichColumnSort+0x73>
add    %edi,%esi
mov    %edi,%ecx
lea    0xeee(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
add    $0xffffffff,%esi
cmp    $0x7,%esi
jae    1173 <WhichColumnSort+0x73>
shl    $0x3,%esi
movabs $0x36353331343230,%rax
jmp    1147 <WhichColumnSort+0x47>
add    $0xfffffffe,%esi
cmp    $0x8,%esi
jae    1173 <WhichColumnSort+0x73>
shl    $0x3,%esi
movabs $0x3936353331343230,%rax
35 36 39
mov    %esi,%ecx
shr    %cl,%rax
ret
add    $0xfffffffd,%esi
cmp    $0x4,%esi
jae    1173 <WhichColumnSort+0x73>
shl    $0x3,%esi
mov    $0x37343230,%eax
jmp    116f <WhichColumnSort+0x6f>
add    $0xfffffffc,%esi
cmp    $0x4,%esi
jae    1173 <WhichColumnSort+0x73>
shl    $0x3,%esi
mov    $0x38353331,%eax
mov    %esi,%ecx
shr    %cl,%eax
ret
cmp    $0x6,%esi
mov    $0x31,%eax
mov    $0x78,%ecx
cmove  %eax,%ecx
cmp    $0x5,%esi
mov    $0x30,%eax
cmovne %ecx,%eax
ret

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

LLVM IR (-O2):
define signext i8 @WhichColumnSort(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
switch i32 %0, label %39 [
i32 0, label %4
i32 1, label %7
i32 2, label %10
i32 3, label %13
i32 4, label %16
]
4: ; preds = %2
%5 = add i32 %3, -1
%6 = icmp ult i32 %5, 7
br i1 %6, label %21, label %39
7: ; preds = %2
%8 = add i32 %3, -2
%9 = icmp ult i32 %8, 8
br i1 %9, label %26, label %39
10: ; preds = %2
%11 = add i32 %3, -3
%12 = icmp ult i32 %11, 4
br i1 %12, label %31, label %39
13: ; preds = %2
%14 = add i32 %3, -4
%15 = icmp ult i32 %14, 4
br i1 %15, label %35, label %39
16: ; preds = %2
%17 = icmp eq i32 %3, 6
%18 = select i1 %17, i8 49, i8 120
%19 = icmp eq i32 %3, 5
%20 = select i1 %19, i8 48, i8 %18
br label %39
21: ; preds = %4
%22 = zext i32 %5 to i56
%23 = shl nuw nsw i56 %22, 3
%24 = lshr i56 15258142727483952, %23
%25 = trunc i56 %24 to i8
br label %39
26: ; preds = %7
%27 = zext i32 %8 to i64
%28 = shl nuw nsw i64 %27, 3
%29 = lshr i64 4122541002889376304, %28
%30 = trunc i64 %29 to i8
br label %39
31: ; preds = %10
%32 = shl i32 %11, 3
%33 = lshr i32 926167600, %32
%34 = trunc i32 %33 to i8
br label %39
35: ; preds = %13
%36 = shl i32 %14, 3
%37 = lshr i32 943010609, %36
%38 = trunc i32 %37 to i8
br label %39
39: ; preds = %35, %13, %31, %10, %26, %7, %21, %4, %16, %2
%40 = phi i8 [ 120, %4 ], [ 120, %7 ], [ 120, %10 ], [ 120, %13 ], [ 120, %2 ], [ %20, %16 ], [ %25, %21 ], [ %30, %26 ], [ %34, %31 ], [ %38, %35 ]
ret i8 %40
}