#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 */
char *gettext(char *);
int /*<<< orphan*/ printf(char *);
void echo_hash_algo_type(int algo) {
  switch (algo) {
  case 1:
    printf("MD5\n");
    break;
  case 2:
    printf("SHA-1\n");
    break;
  case 3:
    printf("RIPE-MD/160\n");
    break;
  case 4:
    printf(gettext("Reserved for double-width SHA (experimental)\n"));
    break;
  case 5:
    printf("MD2\n");
    break;
  case 6:
    printf(gettext("Reserved for Tiger/192\n"));
    break;
  case 7:
    printf(gettext("Reserved for HAVAL (5 pass, 160-bit)\n"));
    break;
  case 100:
  case 101:
  case 102:
  case 103:
  case 104:
  case 105:
  case 106:
  case 107:
  case 108:
  case 109:
  case 110:
    printf(gettext("Private/Experimental algorithm.\n"));
    break;
  default:
    printf(gettext("pk_algo parse error\n"));
    break;
  }
}


x86 assembly (clang, -O0):
<echo_hash_algo_type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x6d,%eax
ja     11fc <echo_hash_algo_type+0xdc>
mov    -0x10(%rbp),%rax
lea    0xeb5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0x105d(%rip),%rdi
call   1040 <printf@plt>
jmp    1210 <echo_hash_algo_type+0xf0>
lea    0x1051(%rip),%rdi
call   1040 <printf@plt>
jmp    1210 <echo_hash_algo_type+0xf0>
lea    0x1047(%rip),%rdi
call   1040 <printf@plt>
jmp    1210 <echo_hash_algo_type+0xf0>
lea    0x1043(%rip),%rdi
call   1030 <gettext@plt>
mov    %rax,%rdi
call   1040 <printf@plt>
jmp    1210 <echo_hash_algo_type+0xf0>
lea    0x1058(%rip),%rdi
call   1040 <printf@plt>
jmp    1210 <echo_hash_algo_type+0xf0>
lea    0x104c(%rip),%rdi
call   1030 <gettext@plt>
mov    %rax,%rdi
call   1040 <printf@plt>
jmp    1210 <echo_hash_algo_type+0xf0>
lea    0x104b(%rip),%rdi
call   1030 <gettext@plt>
mov    %rax,%rdi
call   1040 <printf@plt>
jmp    1210 <echo_hash_algo_type+0xf0>
lea    0x1058(%rip),%rdi
call   1030 <gettext@plt>
mov    %rax,%rdi
call   1040 <printf@plt>
jmp    1210 <echo_hash_algo_type+0xf0>
lea    0x1060(%rip),%rdi
call   1030 <gettext@plt>
mov    %rax,%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<echo_hash_algo_type>:
push   %rax
add    $0xffffffff,%edi
cmp    $0x6d,%edi
ja     11ad <echo_hash_algo_type+0x7d>
lea    0xec0(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
lea    0x10d4(%rip),%rdi
call   1040 <gettext@plt>
mov    %rax,%rdi
pop    %rax
jmp    1050 <printf@plt>
lea    0x110b(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>
lea    0x10f8(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>
lea    0x10df(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>
lea    0x102c(%rip),%rdi
jmp    1150 <echo_hash_algo_type+0x20>
lea    0x10c5(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>
lea    0x1044(%rip),%rdi
jmp    1150 <echo_hash_algo_type+0x20>
lea    0x1053(%rip),%rdi
jmp    1150 <echo_hash_algo_type+0x20>
lea    0x1091(%rip),%rdi
jmp    1150 <echo_hash_algo_type+0x20>

LLVM IR (-O0):
@.str = [5 x i8] c"MD5\0A\00"
@.str.1 = [7 x i8] c"SHA-1\0A\00"
@.str.2 = [13 x i8] c"RIPE-MD/160\0A\00"
@.str.3 = [46 x i8] c"Reserved for double-width SHA (experimental)\0A\00"
@.str.4 = [5 x i8] c"MD2\0A\00"
@.str.5 = [24 x i8] c"Reserved for Tiger/192\0A\00"
@.str.6 = [38 x i8] c"Reserved for HAVAL (5 pass, 160-bit)\0A\00"
@.str.7 = [33 x i8] c"Private/Experimental algorithm.\0A\00"
@.str.8 = [21 x i8] c"pk_algo parse error\0A\00"
define void @echo_hash_algo_type(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %24 [
i32 1, label %4
i32 2, label %6
i32 3, label %8
i32 4, label %10
i32 5, label %13
i32 6, label %15
i32 7, label %18
i32 100, label %21
i32 101, label %21
i32 102, label %21
i32 103, label %21
i32 104, label %21
i32 105, label %21
i32 106, label %21
i32 107, label %21
i32 108, label %21
i32 109, label %21
i32 110, label %21
]
4: ; preds = %1
%5 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %27
6: ; preds = %1
%7 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %27
8: ; preds = %1
%9 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
br label %27
10: ; preds = %1
%11 = call i8* @gettext(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @printf(i8* %11)
br label %27
13: ; preds = %1
%14 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %27
15: ; preds = %1
%16 = call i8* @gettext(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
%17 = call i32 @printf(i8* %16)
br label %27
18: ; preds = %1
%19 = call i8* @gettext(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0))
%20 = call i32 @printf(i8* %19)
br label %27
21: ; preds = %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1
%22 = call i8* @gettext(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0))
%23 = call i32 @printf(i8* %22)
br label %27
24: ; preds = %1
%25 = call i8* @gettext(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0))
%26 = call i32 @printf(i8* %25)
br label %27
27: ; preds = %24, %21, %18, %15, %13, %10, %8, %6, %4
ret void
}

LLVM IR (-O2):
@.str.3 = [46 x i8] c"Reserved for double-width SHA (experimental)\0A\00"
@.str.5 = [24 x i8] c"Reserved for Tiger/192\0A\00"
@.str.6 = [38 x i8] c"Reserved for HAVAL (5 pass, 160-bit)\0A\00"
@.str.7 = [33 x i8] c"Private/Experimental algorithm.\0A\00"
@.str.8 = [21 x i8] c"pk_algo parse error\0A\00"
@str = [4 x i8] c"MD2\00"
@str.9 = [12 x i8] c"RIPE-MD/160\00"
@str.10 = [6 x i8] c"SHA-1\00"
@str.11 = [4 x i8] c"MD5\00"
define void @echo_hash_algo_type(i32 %0) {
switch i32 %0, label %22 [
i32 1, label %2
i32 2, label %4
i32 3, label %6
i32 4, label %8
i32 5, label %11
i32 6, label %13
i32 7, label %16
i32 100, label %19
i32 101, label %19
i32 102, label %19
i32 103, label %19
i32 104, label %19
i32 105, label %19
i32 106, label %19
i32 107, label %19
i32 108, label %19
i32 109, label %19
i32 110, label %19
]
2: ; preds = %1
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.11, i64 0, i64 0))
br label %25
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.10, i64 0, i64 0))
br label %25
6: ; preds = %1
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.9, i64 0, i64 0))
br label %25
8: ; preds = %1
%9 = tail call i8* @gettext(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0))
%10 = tail call i32 @printf(i8* dereferenceable(1) %9)
br label %25
11: ; preds = %1
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
br label %25
13: ; preds = %1
%14 = tail call i8* @gettext(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
%15 = tail call i32 @printf(i8* dereferenceable(1) %14)
br label %25
16: ; preds = %1
%17 = tail call i8* @gettext(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0))
%18 = tail call i32 @printf(i8* dereferenceable(1) %17)
br label %25
19: ; preds = %1, %1, %1, %1, %1, %1, %1, %1, %1, %1, %1
%20 = tail call i8* @gettext(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0))
%21 = tail call i32 @printf(i8* dereferenceable(1) %20)
br label %25
22: ; preds = %1
%23 = tail call i8* @gettext(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0))
%24 = tail call i32 @printf(i8* dereferenceable(1) %23)
br label %25
25: ; preds = %22, %19, %16, %13, %11, %8, %6, %4, %2
ret void
}