#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*/ strcmp(char const *, char *);
int lookup_set_token(const char *t) {
  int ret = -9999;
  if (!t)
    goto ret;
  if (!strcmp(t, "set1"))
    ret = 1;
  else if (!strcmp(t, "set2"))
    ret = 2;
  else if (!strcmp(t, "set3"))
    ret = 3;
  else if (!strcmp(t, "set2ext"))
    ret = 4;
  else if (!strcmp(t, "any"))
    ret = 5;
ret:
  return ret;
}


x86 assembly (clang, -O0):
<lookup_set_token>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0xffffd8f1,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1133 <lookup_set_token+0x23>
jmp    1200 <lookup_set_token+0xf0>
mov    -0x8(%rbp),%rdi
lea    0xec2(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1158 <lookup_set_token+0x48>
movl   $0x1,-0xc(%rbp)
jmp    11fb <lookup_set_token+0xeb>
mov    -0x8(%rbp),%rdi
lea    0xea2(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    117d <lookup_set_token+0x6d>
movl   $0x2,-0xc(%rbp)
jmp    11f6 <lookup_set_token+0xe6>
mov    -0x8(%rbp),%rdi
lea    0xe82(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11a2 <lookup_set_token+0x92>
movl   $0x3,-0xc(%rbp)
jmp    11f1 <lookup_set_token+0xe1>
mov    -0x8(%rbp),%rdi
lea    0xe62(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11c7 <lookup_set_token+0xb7>
movl   $0x4,-0xc(%rbp)
jmp    11ec <lookup_set_token+0xdc>
mov    -0x8(%rbp),%rdi
lea    0xe45(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11e7 <lookup_set_token+0xd7>
movl   $0x5,-0xc(%rbp)
jmp    11ec <lookup_set_token+0xdc>
jmp    11f1 <lookup_set_token+0xe1>
jmp    11f6 <lookup_set_token+0xe6>
jmp    11fb <lookup_set_token+0xeb>
jmp    1200 <lookup_set_token+0xf0>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lookup_set_token>:
push   %rbx
test   %rdi,%rdi
je     1182 <lookup_set_token+0x72>
mov    %rdi,%rbx
lea    0xee0(%rip),%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1189 <lookup_set_token+0x79>
lea    0xed5(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1190 <lookup_set_token+0x80>
lea    0xec7(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1197 <lookup_set_token+0x87>
lea    0xeb9(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     119e <lookup_set_token+0x8e>
lea    0xeae(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
mov    $0x5,%ecx
mov    $0xffffd8f1,%eax
cmove  %ecx,%eax
pop    %rbx
ret
mov    $0xffffd8f1,%eax
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret
mov    $0x2,%eax
pop    %rbx
ret
mov    $0x3,%eax
pop    %rbx
ret
mov    $0x4,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"set1\00"
@.str.1 = [5 x i8] c"set2\00"
@.str.2 = [5 x i8] c"set3\00"
@.str.3 = [8 x i8] c"set2ext\00"
@.str.4 = [4 x i8] c"any\00"
define i32 @lookup_set_token(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 -9999, i32* %3
%4 = load i8*, i8** %2
%5 = icmp ne i8* %4, null
br i1 %5, label %7, label %6
6: ; preds = %1
br label %37
7: ; preds = %1
%8 = load i8*, i8** %2
%9 = call i32 @strcmp(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%10 = icmp ne i32 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %7
store i32 1, i32* %3
br label %36
12: ; preds = %7
%13 = load i8*, i8** %2
%14 = call i32 @strcmp(i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp ne i32 %14, 0
br i1 %15, label %17, label %16
16: ; preds = %12
store i32 2, i32* %3
br label %35
17: ; preds = %12
%18 = load i8*, i8** %2
%19 = call i32 @strcmp(i8* %18, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%20 = icmp ne i32 %19, 0
br i1 %20, label %22, label %21
21: ; preds = %17
store i32 3, i32* %3
br label %34
22: ; preds = %17
%23 = load i8*, i8** %2
%24 = call i32 @strcmp(i8* %23, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%25 = icmp ne i32 %24, 0
br i1 %25, label %27, label %26
26: ; preds = %22
store i32 4, i32* %3
br label %33
27: ; preds = %22
%28 = load i8*, i8** %2
%29 = call i32 @strcmp(i8* %28, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%30 = icmp ne i32 %29, 0
br i1 %30, label %32, label %31
31: ; preds = %27
store i32 5, i32* %3
br label %32
32: ; preds = %31, %27
br label %33
33: ; preds = %32, %26
br label %34
34: ; preds = %33, %21
br label %35
35: ; preds = %34, %16
br label %36
36: ; preds = %35, %11
br label %37
37: ; preds = %36, %6
%38 = load i32, i32* %3
ret i32 %38
}

LLVM IR (-O2):
@.str = [5 x i8] c"set1\00"
@.str.1 = [5 x i8] c"set2\00"
@.str.2 = [5 x i8] c"set3\00"
@.str.3 = [8 x i8] c"set2ext\00"
@.str.4 = [4 x i8] c"any\00"
define i32 @lookup_set_token(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %19, label %3
3: ; preds = %1
%4 = tail call i32 @strcmp(i8* %0, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32 %4, 0
br i1 %5, label %19, label %6
6: ; preds = %3
%7 = tail call i32 @strcmp(i8* %0, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
br i1 %8, label %19, label %9
9: ; preds = %6
%10 = tail call i32 @strcmp(i8* %0, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%11 = icmp eq i32 %10, 0
br i1 %11, label %19, label %12
12: ; preds = %9
%13 = tail call i32 @strcmp(i8* %0, i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%14 = icmp eq i32 %13, 0
br i1 %14, label %19, label %15
15: ; preds = %12
%16 = tail call i32 @strcmp(i8* %0, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%17 = icmp eq i32 %16, 0
%18 = select i1 %17, i32 5, i32 -9999
br label %19
19: ; preds = %15, %12, %9, %6, %3, %1
%20 = phi i32 [ -9999, %1 ], [ 1, %3 ], [ 2, %6 ], [ 3, %9 ], [ 4, %12 ], [ %18, %15 ]
ret i32 %20
}