#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*/ exit(int /*<<< orphan*/);
int pow(int, int);
int /*<<< orphan*/ printf(char *, char);
int get_hash_key(char *d, int n, int alphn, int f) {
  int i, j, m = 0, h = 0;
  for (i = 0; i < n; i++) {
    switch (d[i]) {
    case 'A':
      m = 0;
      break;
    case 'C':
      m = 1;
      break;
    case 'G':
      m = 2;
      break;
    case 'T':
      m = 3;
      break;
    case 'N':
      m = 4;
      break;
    case '-':
      m = 5;
      break;
    case 'B':
      m = 6;
      break;
    case 'D':
      m = 7;
      break;
    case 'H':
      m = 8;
      break;
    case 'K':
      m = 9;
      break;
    case 'M':
      m = 10;
      break;
    case 'R':
      m = 11;
      break;
    case 'S':
      m = 12;
      break;
    case 'V':
      m = 13;
      break;
    case 'W':
      m = 14;
      break;
    case 'Y':
      m = 15;
      break;
    case 'L':
      m = 16;
      break;
    case 'E':
      m = 17;
      break;
    case 'F':
      m = 18;
      break;
    case 'I':
      m = 19;
      break;
    case 'O':
      m = 20;
      break;
    case 'P':
      m = 21;
      break;
    case 'Q':
      m = 22;
      break;
    case 'U':
      m = 23;
      break;
    case 'X':
      m = 24;
      break;
    case 'Z':
      m = 25;
      break;
    case '*':
      m = 26;
      break;
    }
    if (m + 1 > alphn) {
      printf("no such symbol (%c)\n", d[i]);
      m = 0;
      exit(0);
    }
    if (f == 0)
      break;
    h += m * pow(alphn, i);
  }
  if (f == 1)
    return h;
  else
    return m;
}


x86 assembly (clang, -O0):
<get_hash_key>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1348 <get_hash_key+0x218>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
add    $0xffffffd6,%eax
mov    %eax,%ecx
mov    %rcx,-0x38(%rbp)
sub    $0x30,%eax
ja     12d7 <get_hash_key+0x1a7>
mov    -0x38(%rbp),%rax
lea    0xe71(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x0,-0x28(%rbp)
jmp    12d7 <get_hash_key+0x1a7>
movl   $0x1,-0x28(%rbp)
jmp    12d7 <get_hash_key+0x1a7>
movl   $0x2,-0x28(%rbp)
jmp    12d7 <get_hash_key+0x1a7>
movl   $0x3,-0x28(%rbp)
jmp    12d7 <get_hash_key+0x1a7>
movl   $0x4,-0x28(%rbp)
jmp    12d7 <get_hash_key+0x1a7>
movl   $0x5,-0x28(%rbp)
jmp    12d7 <get_hash_key+0x1a7>
movl   $0x6,-0x28(%rbp)
jmp    12d7 <get_hash_key+0x1a7>
movl   $0x7,-0x28(%rbp)
jmp    12d7 <get_hash_key+0x1a7>
movl   $0x8,-0x28(%rbp)
jmp    12d7 <get_hash_key+0x1a7>
movl   $0x9,-0x28(%rbp)
jmp    12d7 <get_hash_key+0x1a7>
movl   $0xa,-0x28(%rbp)
jmp    12d7 <get_hash_key+0x1a7>
movl   $0xb,-0x28(%rbp)
jmp    12d7 <get_hash_key+0x1a7>
movl   $0xc,-0x28(%rbp)
jmp    12d7 <get_hash_key+0x1a7>
movl   $0xd,-0x28(%rbp)
jmp    12d7 <get_hash_key+0x1a7>
movl   $0xe,-0x28(%rbp)
jmp    12d7 <get_hash_key+0x1a7>
movl   $0xf,-0x28(%rbp)
jmp    12d7 <get_hash_key+0x1a7>
movl   $0x10,-0x28(%rbp)
jmp    12d7 <get_hash_key+0x1a7>
movl   $0x11,-0x28(%rbp)
jmp    12d7 <get_hash_key+0x1a7>
movl   $0x12,-0x28(%rbp)
jmp    12d7 <get_hash_key+0x1a7>
movl   $0x13,-0x28(%rbp)
jmp    12d7 <get_hash_key+0x1a7>
movl   $0x14,-0x28(%rbp)
jmp    12d7 <get_hash_key+0x1a7>
movl   $0x15,-0x28(%rbp)
jmp    12d7 <get_hash_key+0x1a7>
movl   $0x16,-0x28(%rbp)
jmp    12d7 <get_hash_key+0x1a7>
movl   $0x17,-0x28(%rbp)
jmp    12d7 <get_hash_key+0x1a7>
movl   $0x18,-0x28(%rbp)
jmp    12d7 <get_hash_key+0x1a7>
movl   $0x19,-0x28(%rbp)
jmp    12d7 <get_hash_key+0x1a7>
movl   $0x1a,-0x28(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
cmp    -0x18(%rbp),%eax
jle    130c <get_hash_key+0x1dc>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
lea    0xdcf(%rip),%rdi
movsbl (%rax,%rcx,1),%esi
call   1030 <printf@plt>
movl   $0x0,-0x28(%rbp)
xor    %edi,%edi
call   1050 <exit@plt>
cmpl   $0x0,-0x1c(%rbp)
jne    131b <get_hash_key+0x1eb>
jmp    1348 <get_hash_key+0x218>
mov    -0x28(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x20(%rbp),%esi
call   1040 <pow@plt>
mov    %eax,%ecx
mov    -0x3c(%rbp),%eax
imul   %ecx,%eax
add    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    115a <get_hash_key+0x2a>
cmpl   $0x1,-0x1c(%rbp)
jne    135d <get_hash_key+0x22d>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1363 <get_hash_key+0x233>
mov    -0x28(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_hash_key>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,0x4(%rsp)
test   %esi,%esi
jle    11b6 <get_hash_key+0x86>
mov    %edx,%r12d
mov    %rdi,%r15
mov    %esi,%r14d
xor    %ebx,%ebx
xor    %ebp,%ebp
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl (%r15,%rbx,1),%esi
lea    -0x2a(%rsi),%eax
cmp    $0x30,%eax
ja     118f <get_hash_key+0x5f>
movabs $0x1fffeff800009,%rcx
bt     %rax,%rcx
jae    118f <get_hash_key+0x5f>
movslq %esi,%rax
lea    0xe91(%rip),%rcx
mov    -0xa8(%rcx,%rax,4),%r13d
ff
cmp    %r12d,%r13d
jge    11d9 <get_hash_key+0xa9>
cmpl   $0x0,0x4(%rsp)
je     11bd <get_hash_key+0x8d>
mov    %r12d,%edi
mov    %ebx,%esi
call   1040 <pow@plt>
imul   %r13d,%eax
add    %eax,%ebp
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1160 <get_hash_key+0x30>
jmp    11bf <get_hash_key+0x8f>
xor    %ebp,%ebp
xor    %r13d,%r13d
jmp    11bf <get_hash_key+0x8f>
xor    %ebp,%ebp
cmpl   $0x1,0x4(%rsp)
cmovne %r13d,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe20(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"no such symbol (%c)\0A\00"
define i32 @get_hash_key(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i8* %0, i8** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 0, i32* %12
store i32 0, i32* %13
store i32 0, i32* %10
br label %14
14: ; preds = %77, %4
%15 = load i32, i32* %10
%16 = load i32, i32* %7
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %80
18: ; preds = %14
%19 = load i8*, i8** %6
%20 = load i32, i32* %10
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
switch i32 %24, label %52 [
i32 65, label %25
i32 67, label %26
i32 71, label %27
i32 84, label %28
i32 78, label %29
i32 45, label %30
i32 66, label %31
i32 68, label %32
i32 72, label %33
i32 75, label %34
i32 77, label %35
i32 82, label %36
i32 83, label %37
i32 86, label %38
i32 87, label %39
i32 89, label %40
i32 76, label %41
i32 69, label %42
i32 70, label %43
i32 73, label %44
i32 79, label %45
i32 80, label %46
i32 81, label %47
i32 85, label %48
i32 88, label %49
i32 90, label %50
i32 42, label %51
]
25: ; preds = %18
store i32 0, i32* %12
br label %52
26: ; preds = %18
store i32 1, i32* %12
br label %52
27: ; preds = %18
store i32 2, i32* %12
br label %52
28: ; preds = %18
store i32 3, i32* %12
br label %52
29: ; preds = %18
store i32 4, i32* %12
br label %52
30: ; preds = %18
store i32 5, i32* %12
br label %52
31: ; preds = %18
store i32 6, i32* %12
br label %52
32: ; preds = %18
store i32 7, i32* %12
br label %52
33: ; preds = %18
store i32 8, i32* %12
br label %52
34: ; preds = %18
store i32 9, i32* %12
br label %52
35: ; preds = %18
store i32 10, i32* %12
br label %52
36: ; preds = %18
store i32 11, i32* %12
br label %52
37: ; preds = %18
store i32 12, i32* %12
br label %52
38: ; preds = %18
store i32 13, i32* %12
br label %52
39: ; preds = %18
store i32 14, i32* %12
br label %52
40: ; preds = %18
store i32 15, i32* %12
br label %52
41: ; preds = %18
store i32 16, i32* %12
br label %52
42: ; preds = %18
store i32 17, i32* %12
br label %52
43: ; preds = %18
store i32 18, i32* %12
br label %52
44: ; preds = %18
store i32 19, i32* %12
br label %52
45: ; preds = %18
store i32 20, i32* %12
br label %52
46: ; preds = %18
store i32 21, i32* %12
br label %52
47: ; preds = %18
store i32 22, i32* %12
br label %52
48: ; preds = %18
store i32 23, i32* %12
br label %52
49: ; preds = %18
store i32 24, i32* %12
br label %52
50: ; preds = %18
store i32 25, i32* %12
br label %52
51: ; preds = %18
store i32 26, i32* %12
br label %52
52: ; preds = %18, %51, %50, %49, %48, %47, %46, %45, %44, %43, %42, %41, %40, %39, %38, %37, %36, %35, %34, %33, %32, %31, %30, %29, %28, %27, %26, %25
%53 = load i32, i32* %12
%54 = add nsw i32 %53, 1
%55 = load i32, i32* %8
%56 = icmp sgt i32 %54, %55
br i1 %56, label %57, label %65
57: ; preds = %52
%58 = load i8*, i8** %6
%59 = load i32, i32* %10
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i8, i8* %58, i64 %60
%62 = load i8, i8* %61
%63 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8 signext %62)
store i32 0, i32* %12
%64 = call i32 @exit(i32 0)
unreachable
65: ; preds = %52
%66 = load i32, i32* %9
%67 = icmp eq i32 %66, 0
br i1 %67, label %68, label %69
68: ; preds = %65
br label %80
69: ; preds = %65
%70 = load i32, i32* %12
%71 = load i32, i32* %8
%72 = load i32, i32* %10
%73 = call i32 @pow(i32 %71, i32 %72)
%74 = mul nsw i32 %70, %73
%75 = load i32, i32* %13
%76 = add nsw i32 %75, %74
store i32 %76, i32* %13
br label %77
77: ; preds = %69
%78 = load i32, i32* %10
%79 = add nsw i32 %78, 1
store i32 %79, i32* %10
br label %14
80: ; preds = %68, %14
%81 = load i32, i32* %9
%82 = icmp eq i32 %81, 1
br i1 %82, label %83, label %85
83: ; preds = %80
%84 = load i32, i32* %13
store i32 %84, i32* %5
br label %87
85: ; preds = %80
%86 = load i32, i32* %12
store i32 %86, i32* %5
br label %87
87: ; preds = %85, %83
%88 = load i32, i32* %5
ret i32 %88
}

LLVM IR (-O2):
@.str = [21 x i8] c"no such symbol (%c)\0A\00"
@switch.table.get_hash_key = [49 x i32] [i32 26, i32 0, i32 0, i32 5, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 6, i32 1, i32 7, i32 17, i32 18, i32 2, i32 8, i32 19, i32 0, i32 9, i32 16, i32 10, i32 4, i32 20, i32 21, i32 22, i32 11, i32 12, i32 3, i32 23, i32 13, i32 14, i32 24, i32 15, i32 25]
define i32 @get_hash_key(i8* nocapture %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %41
6: ; preds = %4
%7 = icmp eq i32 %3, 0
%8 = zext i32 %1 to i64
br label %9
9: ; preds = %6, %34
%10 = phi i64 [ 0, %6 ], [ %39, %34 ]
%11 = phi i32 [ 0, %6 ], [ %38, %34 ]
%12 = phi i32 [ 0, %6 ], [ %28, %34 ]
%13 = getelementptr inbounds i8, i8* %0, i64 %10
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = add nsw i32 %15, -42
%17 = icmp ult i32 %16, 49
br i1 %17, label %18, label %27
18: ; preds = %9
%19 = zext i32 %16 to i64
%20 = lshr i64 562945650065417, %19
%21 = and i64 %20, 1
%22 = icmp eq i64 %21, 0
br i1 %22, label %27, label %23
23: ; preds = %18
%24 = sext i32 %16 to i64
%25 = getelementptr inbounds [49 x i32], [49 x i32]* @switch.table.get_hash_key, i64 0, i64 %24
%26 = load i32, i32* %25
br label %27
27: ; preds = %23, %18, %9
%28 = phi i32 [ %12, %9 ], [ %12, %18 ], [ %26, %23 ]
%29 = icmp slt i32 %28, %2
br i1 %29, label %33, label %30
30: ; preds = %27
%31 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8 signext %14)
%32 = tail call i32 @exit(i32 0)
unreachable
33: ; preds = %27
br i1 %7, label %41, label %34
34: ; preds = %33
%35 = trunc i64 %10 to i32
%36 = tail call i32 @pow(i32 %2, i32 %35)
%37 = mul nsw i32 %36, %28
%38 = add nsw i32 %37, %11
%39 = add nuw nsw i64 %10, 1
%40 = icmp eq i64 %39, %8
br i1 %40, label %41, label %9
41: ; preds = %34, %33, %4
%42 = phi i32 [ 0, %4 ], [ 0, %33 ], [ %38, %34 ]
%43 = phi i32 [ 0, %4 ], [ %28, %33 ], [ %28, %34 ]
%44 = icmp eq i32 %3, 1
%45 = select i1 %44, i32 %42, i32 %43
ret i32 %45
}