#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
size_t abs(int);
int sizeOfNum(int a, int b) {
  size_t sz;
  switch (abs(b) % 8) {
  case 0:
    sz = sizeof(char);
    break;
  case 1:
    sz = sizeof(signed char);
    break;
  case 2:
    sz = sizeof(short);
    break;
  case 3:
    sz = sizeof(unsigned int);
    break;
  case 4:
    sz = sizeof(long);
    break;
  case 5:
    sz = sizeof(unsigned long long);
    break;
  case 6:
    sz = sizeof(float);
    break;
  case 7:
    sz = sizeof(double);
    break;
  }
  return sz * abs(a);
}


x86 assembly (clang, -O0):
<sizeOfNum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <abs@plt>
and    $0x7,%eax
mov    %rax,-0x18(%rbp)
sub    $0x7,%rax
ja     11ae <sizeOfNum+0x9e>
mov    -0x18(%rbp),%rax
lea    0xebe(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movq   $0x1,-0x10(%rbp)
jmp    11ae <sizeOfNum+0x9e>
movq   $0x1,-0x10(%rbp)
jmp    11ae <sizeOfNum+0x9e>
movq   $0x2,-0x10(%rbp)
jmp    11ae <sizeOfNum+0x9e>
movq   $0x4,-0x10(%rbp)
jmp    11ae <sizeOfNum+0x9e>
movq   $0x8,-0x10(%rbp)
jmp    11ae <sizeOfNum+0x9e>
movq   $0x8,-0x10(%rbp)
jmp    11ae <sizeOfNum+0x9e>
movq   $0x4,-0x10(%rbp)
jmp    11ae <sizeOfNum+0x9e>
movq   $0x8,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <abs@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
imul   %rcx,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sizeOfNum>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebp
mov    %esi,%edi
call   1030 <abs@plt>
mov    %rax,%rbx
and    $0x7,%ebx
lea    0xed6(%rip),%r14
mov    %ebp,%edi
call   1030 <abs@plt>
imul   (%r14,%rbx,8),%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @sizeOfNum(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i64
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = call i64 @abs(i32 %6)
%8 = urem i64 %7, 8
switch i64 %8, label %17 [
i64 0, label %9
i64 1, label %10
i64 2, label %11
i64 3, label %12
i64 4, label %13
i64 5, label %14
i64 6, label %15
i64 7, label %16
]
9: ; preds = %2
store i64 1, i64* %5
br label %17
10: ; preds = %2
store i64 1, i64* %5
br label %17
11: ; preds = %2
store i64 2, i64* %5
br label %17
12: ; preds = %2
store i64 4, i64* %5
br label %17
13: ; preds = %2
store i64 8, i64* %5
br label %17
14: ; preds = %2
store i64 8, i64* %5
br label %17
15: ; preds = %2
store i64 4, i64* %5
br label %17
16: ; preds = %2
store i64 8, i64* %5
br label %17
17: ; preds = %2, %16, %15, %14, %13, %12, %11, %10, %9
%18 = load i64, i64* %5
%19 = load i32, i32* %3
%20 = call i64 @abs(i32 %19)
%21 = mul i64 %18, %20
%22 = trunc i64 %21 to i32
ret i32 %22
}

LLVM IR (-O2):
@switch.table.sizeOfNum = [8 x i64] [i64 1, i64 1, i64 2, i64 4, i64 8, i64 8, i64 4, i64 8]
define i32 @sizeOfNum(i32 %0, i32 %1) {
%3 = tail call i64 @abs(i32 %1)
%4 = and i64 %3, 7
%5 = getelementptr inbounds [8 x i64], [8 x i64]* @switch.table.sizeOfNum, i64 0, i64 %4
%6 = load i64, i64* %5
%7 = tail call i64 @abs(i32 %0)
%8 = mul i64 %7, %6
%9 = trunc i64 %8 to i32
ret i32 %9
}