#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 */
int /*<<< orphan*/ printf(char *);
int digest_alg_size(unsigned alg) {
  switch (alg) {
  case 1:
    return 16;
  case 2:
    return 20;
  case 3:
    return 20;
  case 8:
    return 32;
  case 10:
    return 64;
  case 6:
  case 100:
    return 24;
  default:
    printf("hash_any: bad algorithm\n");
    return 0;
  }
}


x86 assembly (clang, -O0):
<digest_alg_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x1,%eax
je     1195 <digest_alg_size+0x85>
jmp    112f <digest_alg_size+0x1f>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     11a1 <digest_alg_size+0x91>
jmp    1140 <digest_alg_size+0x30>
mov    -0xc(%rbp),%eax
sub    $0x3,%eax
je     11ad <digest_alg_size+0x9d>
jmp    1151 <digest_alg_size+0x41>
mov    -0xc(%rbp),%eax
sub    $0x6,%eax
je     11d1 <digest_alg_size+0xc1>
jmp    1162 <digest_alg_size+0x52>
mov    -0xc(%rbp),%eax
sub    $0x8,%eax
je     11b9 <digest_alg_size+0xa9>
jmp    1173 <digest_alg_size+0x63>
mov    -0xc(%rbp),%eax
sub    $0xa,%eax
je     11c5 <digest_alg_size+0xb5>
jmp    1184 <digest_alg_size+0x74>
mov    -0xc(%rbp),%eax
sub    $0x64,%eax
je     11d1 <digest_alg_size+0xc1>
jmp    11dd <digest_alg_size+0xcd>
movl   $0x10,-0x4(%rbp)
jmp    11f0 <digest_alg_size+0xe0>
movl   $0x14,-0x4(%rbp)
jmp    11f0 <digest_alg_size+0xe0>
movl   $0x14,-0x4(%rbp)
jmp    11f0 <digest_alg_size+0xe0>
movl   $0x20,-0x4(%rbp)
jmp    11f0 <digest_alg_size+0xe0>
movl   $0x40,-0x4(%rbp)
jmp    11f0 <digest_alg_size+0xe0>
movl   $0x18,-0x4(%rbp)
jmp    11f0 <digest_alg_size+0xe0>
lea    0xe1c(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<digest_alg_size>:
push   %rax
lea    -0x1(%rdi),%ecx
cmp    $0x9,%ecx
ja     1135 <digest_alg_size+0x25>
mov    $0x10,%eax
lea    0xedb(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    $0x14,%eax
pop    %rcx
ret
cmp    $0x64,%edi
jne    1141 <digest_alg_size+0x31>
mov    $0x18,%eax
pop    %rcx
ret
lea    0xee0(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    $0x20,%eax
pop    %rcx
ret
mov    $0x40,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"hash_any: bad algorithm\0A\00"
define i32 @digest_alg_size(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %11 [
i32 1, label %5
i32 2, label %6
i32 3, label %7
i32 8, label %8
i32 10, label %9
i32 6, label %10
i32 100, label %10
]
5: ; preds = %1
store i32 16, i32* %2
br label %13
6: ; preds = %1
store i32 20, i32* %2
br label %13
7: ; preds = %1
store i32 20, i32* %2
br label %13
8: ; preds = %1
store i32 32, i32* %2
br label %13
9: ; preds = %1
store i32 64, i32* %2
br label %13
10: ; preds = %1, %1
store i32 24, i32* %2
br label %13
11: ; preds = %1
%12 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %13
13: ; preds = %11, %10, %9, %8, %7, %6, %5
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
@str = [24 x i8] c"hash_any: bad algorithm\00"
define i32 @digest_alg_size(i32 %0) {
switch i32 %0, label %7 [
i32 1, label %9
i32 2, label %2
i32 3, label %3
i32 8, label %4
i32 10, label %5
i32 6, label %6
i32 100, label %6
]
2: ; preds = %1
br label %9
3: ; preds = %1
br label %9
4: ; preds = %1
br label %9
5: ; preds = %1
br label %9
6: ; preds = %1, %1
br label %9
7: ; preds = %1
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
br label %9
9: ; preds = %1, %7, %6, %5, %4, %3, %2
%10 = phi i32 [ 0, %7 ], [ 24, %6 ], [ 64, %5 ], [ 32, %4 ], [ 20, %3 ], [ 20, %2 ], [ 16, %1 ]
ret i32 %10
}