int NumBytesAndFormatToNumType(int numBytesPerValue, int dataFormat,
                               int *numTypePtr) {
  int err = 0;
  switch (dataFormat) {
  case 3:
    switch (numBytesPerValue) {
    case 8:
      *numTypePtr = 4;
      break;
    case 4:
      *numTypePtr = 2;
      break;
    default:
      err = 17;
      break;
    }
    break;
  case 1:
    switch (numBytesPerValue) {
    case 4:
      *numTypePtr = 0x20;
      break;
    case 2:
      *numTypePtr = 0x10;
      break;
    case 1:
      *numTypePtr = 8;
      break;
    default:
      err = 17;
      break;
    }
    break;
  case 2:
    switch (numBytesPerValue) {
    case 4:
      *numTypePtr = 0x20 | 0x40;
      break;
    case 2:
      *numTypePtr = 0x10 | 0x40;
      break;
    case 1:
      *numTypePtr = 8 | 0x40;
      break;
    default:
      err = 17;
      break;
    }
    break;
  default:
    err = 17;
    break;
  }
  return err;
}


x86 assembly (clang, -O0):
<NumBytesAndFormatToNumType>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0x1,%eax
je     119a <NumBytesAndFormatToNumType+0x9a>
jmp    1129 <NumBytesAndFormatToNumType+0x29>
mov    -0x18(%rbp),%eax
sub    $0x2,%eax
je     1209 <NumBytesAndFormatToNumType+0x109>
jmp    113a <NumBytesAndFormatToNumType+0x3a>
mov    -0x18(%rbp),%eax
sub    $0x3,%eax
jne    1278 <NumBytesAndFormatToNumType+0x178>
jmp    114b <NumBytesAndFormatToNumType+0x4b>
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x4,%eax
je     117f <NumBytesAndFormatToNumType+0x7f>
jmp    115f <NumBytesAndFormatToNumType+0x5f>
mov    -0x1c(%rbp),%eax
sub    $0x8,%eax
jne    118e <NumBytesAndFormatToNumType+0x8e>
jmp    1170 <NumBytesAndFormatToNumType+0x70>
mov    -0x10(%rbp),%rax
movl   $0x4,(%rax)
jmp    1195 <NumBytesAndFormatToNumType+0x95>
mov    -0x10(%rbp),%rax
movl   $0x2,(%rax)
jmp    1195 <NumBytesAndFormatToNumType+0x95>
movl   $0x11,-0x14(%rbp)
jmp    127f <NumBytesAndFormatToNumType+0x17f>
mov    -0x4(%rbp),%eax
mov    %eax,-0x20(%rbp)
sub    $0x1,%eax
je     11ee <NumBytesAndFormatToNumType+0xee>
jmp    11ae <NumBytesAndFormatToNumType+0xae>
mov    -0x20(%rbp),%eax
sub    $0x2,%eax
je     11df <NumBytesAndFormatToNumType+0xdf>
jmp    11bf <NumBytesAndFormatToNumType+0xbf>
mov    -0x20(%rbp),%eax
sub    $0x4,%eax
jne    11fd <NumBytesAndFormatToNumType+0xfd>
jmp    11d0 <NumBytesAndFormatToNumType+0xd0>
mov    -0x10(%rbp),%rax
movl   $0x20,(%rax)
jmp    1204 <NumBytesAndFormatToNumType+0x104>
mov    -0x10(%rbp),%rax
movl   $0x10,(%rax)
jmp    1204 <NumBytesAndFormatToNumType+0x104>
mov    -0x10(%rbp),%rax
movl   $0x8,(%rax)
jmp    1204 <NumBytesAndFormatToNumType+0x104>
movl   $0x11,-0x14(%rbp)
jmp    127f <NumBytesAndFormatToNumType+0x17f>
mov    -0x4(%rbp),%eax
mov    %eax,-0x24(%rbp)
sub    $0x1,%eax
je     125d <NumBytesAndFormatToNumType+0x15d>
jmp    121d <NumBytesAndFormatToNumType+0x11d>
mov    -0x24(%rbp),%eax
sub    $0x2,%eax
je     124e <NumBytesAndFormatToNumType+0x14e>
jmp    122e <NumBytesAndFormatToNumType+0x12e>
mov    -0x24(%rbp),%eax
sub    $0x4,%eax
jne    126c <NumBytesAndFormatToNumType+0x16c>
jmp    123f <NumBytesAndFormatToNumType+0x13f>
mov    -0x10(%rbp),%rax
movl   $0x60,(%rax)
jmp    1273 <NumBytesAndFormatToNumType+0x173>
mov    -0x10(%rbp),%rax
movl   $0x50,(%rax)
jmp    1273 <NumBytesAndFormatToNumType+0x173>
mov    -0x10(%rbp),%rax
movl   $0x48,(%rax)
jmp    1273 <NumBytesAndFormatToNumType+0x173>
movl   $0x11,-0x14(%rbp)
jmp    127f <NumBytesAndFormatToNumType+0x17f>
movl   $0x11,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<NumBytesAndFormatToNumType>:
mov    $0x11,%eax
cmp    $0x1,%esi
je     1125 <NumBytesAndFormatToNumType+0x25>
cmp    $0x2,%esi
je     113b <NumBytesAndFormatToNumType+0x3b>
cmp    $0x3,%esi
jne    1176 <NumBytesAndFormatToNumType+0x76>
cmp    $0x8,%edi
je     1151 <NumBytesAndFormatToNumType+0x51>
cmp    $0x4,%edi
jne    1176 <NumBytesAndFormatToNumType+0x76>
mov    $0x2,%eax
jmp    1172 <NumBytesAndFormatToNumType+0x72>
cmp    $0x1,%edi
je     1158 <NumBytesAndFormatToNumType+0x58>
cmp    $0x4,%edi
je     115f <NumBytesAndFormatToNumType+0x5f>
cmp    $0x2,%edi
jne    1176 <NumBytesAndFormatToNumType+0x76>
mov    $0x10,%eax
jmp    1172 <NumBytesAndFormatToNumType+0x72>
cmp    $0x1,%edi
je     1166 <NumBytesAndFormatToNumType+0x66>
cmp    $0x4,%edi
je     116d <NumBytesAndFormatToNumType+0x6d>
cmp    $0x2,%edi
jne    1176 <NumBytesAndFormatToNumType+0x76>
mov    $0x50,%eax
jmp    1172 <NumBytesAndFormatToNumType+0x72>
mov    $0x4,%eax
jmp    1172 <NumBytesAndFormatToNumType+0x72>
mov    $0x8,%eax
jmp    1172 <NumBytesAndFormatToNumType+0x72>
mov    $0x20,%eax
jmp    1172 <NumBytesAndFormatToNumType+0x72>
mov    $0x48,%eax
jmp    1172 <NumBytesAndFormatToNumType+0x72>
mov    $0x60,%eax
mov    %eax,(%rdx)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @NumBytesAndFormatToNumType(i32 %0, i32 %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32* %2, i32** %6
store i32 0, i32* %7
%8 = load i32, i32* %5
switch i32 %8, label %37 [
i32 3, label %9
i32 1, label %17
i32 2, label %27
]
9: ; preds = %3
%10 = load i32, i32* %4
switch i32 %10, label %15 [
i32 8, label %11
i32 4, label %13
]
11: ; preds = %9
%12 = load i32*, i32** %6
store i32 4, i32* %12
br label %16
13: ; preds = %9
%14 = load i32*, i32** %6
store i32 2, i32* %14
br label %16
15: ; preds = %9
store i32 17, i32* %7
br label %16
16: ; preds = %15, %13, %11
br label %38
17: ; preds = %3
%18 = load i32, i32* %4
switch i32 %18, label %25 [
i32 4, label %19
i32 2, label %21
i32 1, label %23
]
19: ; preds = %17
%20 = load i32*, i32** %6
store i32 32, i32* %20
br label %26
21: ; preds = %17
%22 = load i32*, i32** %6
store i32 16, i32* %22
br label %26
23: ; preds = %17
%24 = load i32*, i32** %6
store i32 8, i32* %24
br label %26
25: ; preds = %17
store i32 17, i32* %7
br label %26
26: ; preds = %25, %23, %21, %19
br label %38
27: ; preds = %3
%28 = load i32, i32* %4
switch i32 %28, label %35 [
i32 4, label %29
i32 2, label %31
i32 1, label %33
]
29: ; preds = %27
%30 = load i32*, i32** %6
store i32 96, i32* %30
br label %36
31: ; preds = %27
%32 = load i32*, i32** %6
store i32 80, i32* %32
br label %36
33: ; preds = %27
%34 = load i32*, i32** %6
store i32 72, i32* %34
br label %36
35: ; preds = %27
store i32 17, i32* %7
br label %36
36: ; preds = %35, %33, %31, %29
br label %38
37: ; preds = %3
store i32 17, i32* %7
br label %38
38: ; preds = %37, %36, %26, %16
%39 = load i32, i32* %7
ret i32 %39
}

LLVM IR (-O2):
define i32 @NumBytesAndFormatToNumType(i32 %0, i32 %1, i32* nocapture writeonly %2) {
switch i32 %1, label %14 [
i32 3, label %4
i32 1, label %6
i32 2, label %9
]
4: ; preds = %3
switch i32 %0, label %14 [
i32 8, label %12
i32 4, label %5
]
5: ; preds = %4
br label %12
6: ; preds = %3
switch i32 %0, label %14 [
i32 4, label %12
i32 2, label %7
i32 1, label %8
]
7: ; preds = %6
br label %12
8: ; preds = %6
br label %12
9: ; preds = %3
switch i32 %0, label %14 [
i32 4, label %12
i32 2, label %10
i32 1, label %11
]
10: ; preds = %9
br label %12
11: ; preds = %9
br label %12
12: ; preds = %9, %6, %4, %5, %8, %7, %11, %10
%13 = phi i32 [ 80, %10 ], [ 72, %11 ], [ 16, %7 ], [ 8, %8 ], [ 2, %5 ], [ 4, %4 ], [ 32, %6 ], [ 96, %9 ]
store i32 %13, i32* %2
br label %14
14: ; preds = %12, %3, %9, %6, %4
%15 = phi i32 [ 17, %4 ], [ 17, %6 ], [ 17, %9 ], [ 17, %3 ], [ 0, %12 ]
ret i32 %15
}