#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);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char *, char *);
int toIntType(char *key, char *type) {
  if (!strcmp(type, "string")) {
    return 0;
  } else if (!strcmp(type, "list")) {
    return 1;
  } else if (!strcmp(type, "set")) {
    return 2;
  } else if (!strcmp(type, "hash")) {
    return 3;
  } else if (!strcmp(type, "zset")) {
    return 4;
  } else if (!strcmp(type, "none")) {
    return 5;
  } else {
    fprintf(stderr, "Unknown type '%s' for key '%s'\n", type, key);
    exit(1);
  }
}


x86 assembly (clang, -O0):
<toIntType>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xeb5(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1165 <toIntType+0x35>
movl   $0x0,-0x4(%rbp)
jmp    1245 <toIntType+0x115>
mov    -0x18(%rbp),%rdi
lea    0xe97(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    118a <toIntType+0x5a>
movl   $0x1,-0x4(%rbp)
jmp    1245 <toIntType+0x115>
mov    -0x18(%rbp),%rdi
lea    0xe7d(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11af <toIntType+0x7f>
movl   $0x2,-0x4(%rbp)
jmp    1245 <toIntType+0x115>
mov    -0x18(%rbp),%rdi
lea    0xe52(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11d4 <toIntType+0xa4>
movl   $0x3,-0x4(%rbp)
jmp    1245 <toIntType+0x115>
mov    -0x18(%rbp),%rdi
lea    0xe32(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11f9 <toIntType+0xc9>
movl   $0x4,-0x4(%rbp)
jmp    1245 <toIntType+0x115>
mov    -0x18(%rbp),%rdi
lea    0xe12(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    121e <toIntType+0xee>
movl   $0x5,-0x4(%rbp)
jmp    1245 <toIntType+0x115>
mov    0x2dbb(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xde5(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<toIntType>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xebf(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11dc <toIntType+0xac>
lea    0xeaf(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11e0 <toIntType+0xb0>
lea    0xea7(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11e7 <toIntType+0xb7>
lea    0xe8e(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11ee <toIntType+0xbe>
lea    0xe80(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     11f5 <toIntType+0xc5>
lea    0xe72(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
mov    %eax,%ecx
mov    $0x5,%eax
test   %ecx,%ecx
je     11fa <toIntType+0xca>
mov    0x2e22(%rip),%rax
mov    (%rax),%edi
lea    0xe54(%rip),%rsi
mov    %rbx,%rdx
mov    %r14,%rcx
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
xor    %eax,%eax
jmp    11fa <toIntType+0xca>
mov    $0x1,%eax
jmp    11fa <toIntType+0xca>
mov    $0x2,%eax
jmp    11fa <toIntType+0xca>
mov    $0x3,%eax
jmp    11fa <toIntType+0xca>
mov    $0x4,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [7 x i8] c"string\00"
@.str.1 = [5 x i8] c"list\00"
@.str.2 = [4 x i8] c"set\00"
@.str.3 = [5 x i8] c"hash\00"
@.str.4 = [5 x i8] c"zset\00"
@.str.5 = [5 x i8] c"none\00"
@stderr = global i32 0
@.str.6 = [32 x i8] c"Unknown type '%s' for key '%s'\0A\00"
define i32 @toIntType(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %5
%7 = call i32 @strcmp(i8* %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%8 = icmp ne i32 %7, 0
br i1 %8, label %10, label %9
9: ; preds = %2
store i32 0, i32* %3
br label %41
10: ; preds = %2
%11 = load i8*, i8** %5
%12 = call i32 @strcmp(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp ne i32 %12, 0
br i1 %13, label %15, label %14
14: ; preds = %10
store i32 1, i32* %3
br label %41
15: ; preds = %10
%16 = load i8*, i8** %5
%17 = call i32 @strcmp(i8* %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%18 = icmp ne i32 %17, 0
br i1 %18, label %20, label %19
19: ; preds = %15
store i32 2, i32* %3
br label %41
20: ; preds = %15
%21 = load i8*, i8** %5
%22 = call i32 @strcmp(i8* %21, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%23 = icmp ne i32 %22, 0
br i1 %23, label %25, label %24
24: ; preds = %20
store i32 3, i32* %3
br label %41
25: ; preds = %20
%26 = load i8*, i8** %5
%27 = call i32 @strcmp(i8* %26, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%28 = icmp ne i32 %27, 0
br i1 %28, label %30, label %29
29: ; preds = %25
store i32 4, i32* %3
br label %41
30: ; preds = %25
%31 = load i8*, i8** %5
%32 = call i32 @strcmp(i8* %31, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%33 = icmp ne i32 %32, 0
br i1 %33, label %35, label %34
34: ; preds = %30
store i32 5, i32* %3
br label %41
35: ; preds = %30
%36 = load i32, i32* @stderr
%37 = load i8*, i8** %5
%38 = load i8*, i8** %4
%39 = call i32 @fprintf(i32 %36, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), i8* %37, i8* %38)
%40 = call i32 @exit(i32 1)
unreachable
41: ; preds = %34, %29, %24, %19, %14, %9
%42 = load i32, i32* %3
ret i32 %42
}

LLVM IR (-O2):
@.str = [7 x i8] c"string\00"
@.str.1 = [5 x i8] c"list\00"
@.str.2 = [4 x i8] c"set\00"
@.str.3 = [5 x i8] c"hash\00"
@.str.4 = [5 x i8] c"zset\00"
@.str.5 = [5 x i8] c"none\00"
@stderr = global i32 0
@.str.6 = [32 x i8] c"Unknown type '%s' for key '%s'\0A\00"
define i32 @toIntType(i8* %0, i8* %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, 0
br i1 %4, label %24, label %5
5: ; preds = %2
%6 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i32 %6, 0
br i1 %7, label %24, label %8
8: ; preds = %5
%9 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%10 = icmp eq i32 %9, 0
br i1 %10, label %24, label %11
11: ; preds = %8
%12 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%13 = icmp eq i32 %12, 0
br i1 %13, label %24, label %14
14: ; preds = %11
%15 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%16 = icmp eq i32 %15, 0
br i1 %16, label %24, label %17
17: ; preds = %14
%18 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%19 = icmp eq i32 %18, 0
br i1 %19, label %24, label %20
20: ; preds = %17
%21 = load i32, i32* @stderr
%22 = tail call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), i8* %1, i8* %0)
%23 = tail call i32 @exit(i32 1)
unreachable
24: ; preds = %17, %14, %11, %8, %5, %2
%25 = phi i32 [ 0, %2 ], [ 1, %5 ], [ 2, %8 ], [ 3, %11 ], [ 4, %14 ], [ 5, %17 ]
ret i32 %25
}