#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 blz_btparse_workmem_size(size_t);
size_t blz_hashbucket_workmem_size(size_t, int);
size_t blz_lazy_workmem_size(size_t);
size_t blz_leparse_workmem_size(size_t);
size_t blz_workmem_size(size_t);
size_t blz_workmem_size_level(size_t src_size, int level) {
  switch (level) {
  case 1:
    return blz_workmem_size(src_size);
  case 2:
    return blz_lazy_workmem_size(src_size);
  case 3:
    return blz_hashbucket_workmem_size(src_size, 2);
  case 4:
    return blz_hashbucket_workmem_size(src_size, 4);
  case 5:
  case 6:
  case 7:
    return blz_leparse_workmem_size(src_size);
  case 8:
  case 9:
  case 10:
    return blz_btparse_workmem_size(src_size);
  default:
    return (size_t)-1;
  }
}


x86 assembly (clang, -O0):
<blz_workmem_size_level>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x9,%eax
ja     11fe <blz_workmem_size_level+0xae>
mov    -0x20(%rbp),%rax
lea    0xe81(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rdi
call   1040 <blz_workmem_size@plt>
mov    %rax,-0x8(%rbp)
jmp    1206 <blz_workmem_size_level+0xb6>
mov    -0x10(%rbp),%rdi
call   1050 <blz_lazy_workmem_size@plt>
mov    %rax,-0x8(%rbp)
jmp    1206 <blz_workmem_size_level+0xb6>
mov    -0x10(%rbp),%rdi
mov    $0x2,%esi
call   1070 <blz_hashbucket_workmem_size@plt>
mov    %rax,-0x8(%rbp)
jmp    1206 <blz_workmem_size_level+0xb6>
mov    -0x10(%rbp),%rdi
mov    $0x4,%esi
call   1070 <blz_hashbucket_workmem_size@plt>
mov    %rax,-0x8(%rbp)
jmp    1206 <blz_workmem_size_level+0xb6>
mov    -0x10(%rbp),%rdi
call   1060 <blz_leparse_workmem_size@plt>
mov    %rax,-0x8(%rbp)
jmp    1206 <blz_workmem_size_level+0xb6>
mov    -0x10(%rbp),%rdi
call   1030 <blz_btparse_workmem_size@plt>
mov    %rax,-0x8(%rbp)
jmp    1206 <blz_workmem_size_level+0xb6>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<blz_workmem_size_level>:
add    $0xffffffff,%esi
cmp    $0x9,%esi
ja     1190 <blz_workmem_size_level+0x40>
lea    0xea1(%rip),%rax
movslq (%rax,%rsi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
jmp    1060 <blz_leparse_workmem_size@plt>
jmp    1030 <blz_btparse_workmem_size@plt>
jmp    1040 <blz_workmem_size@plt>
jmp    1050 <blz_lazy_workmem_size@plt>
mov    $0x2,%esi
jmp    1070 <blz_hashbucket_workmem_size@plt>
mov    $0x4,%esi
jmp    1070 <blz_hashbucket_workmem_size@plt>
mov    $0xffffffffffffffff,%rax
ret

LLVM IR (-O0):
define i64 @blz_workmem_size_level(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i32
store i64 %0, i64* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
switch i32 %6, label %25 [
i32 1, label %7
i32 2, label %10
i32 3, label %13
i32 4, label %16
i32 5, label %19
i32 6, label %19
i32 7, label %19
i32 8, label %22
i32 9, label %22
i32 10, label %22
]
7: ; preds = %2
%8 = load i64, i64* %4
%9 = call i64 @blz_workmem_size(i64 %8)
store i64 %9, i64* %3
br label %26
10: ; preds = %2
%11 = load i64, i64* %4
%12 = call i64 @blz_lazy_workmem_size(i64 %11)
store i64 %12, i64* %3
br label %26
13: ; preds = %2
%14 = load i64, i64* %4
%15 = call i64 @blz_hashbucket_workmem_size(i64 %14, i32 2)
store i64 %15, i64* %3
br label %26
16: ; preds = %2
%17 = load i64, i64* %4
%18 = call i64 @blz_hashbucket_workmem_size(i64 %17, i32 4)
store i64 %18, i64* %3
br label %26
19: ; preds = %2, %2, %2
%20 = load i64, i64* %4
%21 = call i64 @blz_leparse_workmem_size(i64 %20)
store i64 %21, i64* %3
br label %26
22: ; preds = %2, %2, %2
%23 = load i64, i64* %4
%24 = call i64 @blz_btparse_workmem_size(i64 %23)
store i64 %24, i64* %3
br label %26
25: ; preds = %2
store i64 -1, i64* %3
br label %26
26: ; preds = %25, %22, %19, %16, %13, %10, %7
%27 = load i64, i64* %3
ret i64 %27
}

LLVM IR (-O2):
define i64 @blz_workmem_size_level(i64 %0, i32 %1) {
switch i32 %1, label %15 [
i32 1, label %3
i32 2, label %5
i32 3, label %7
i32 4, label %9
i32 5, label %11
i32 6, label %11
i32 7, label %11
i32 8, label %13
i32 9, label %13
i32 10, label %13
]
3: ; preds = %2
%4 = tail call i64 @blz_workmem_size(i64 %0)
br label %15
5: ; preds = %2
%6 = tail call i64 @blz_lazy_workmem_size(i64 %0)
br label %15
7: ; preds = %2
%8 = tail call i64 @blz_hashbucket_workmem_size(i64 %0, i32 2)
br label %15
9: ; preds = %2
%10 = tail call i64 @blz_hashbucket_workmem_size(i64 %0, i32 4)
br label %15
11: ; preds = %2, %2, %2
%12 = tail call i64 @blz_leparse_workmem_size(i64 %0)
br label %15
13: ; preds = %2, %2, %2
%14 = tail call i64 @blz_btparse_workmem_size(i64 %0)
br label %15
15: ; preds = %2, %13, %11, %9, %7, %5, %3
%16 = phi i64 [ %14, %13 ], [ %12, %11 ], [ %10, %9 ], [ %8, %7 ], [ %6, %5 ], [ %4, %3 ], [ -1, %2 ]
ret i64 %16
}