#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*/ StringLower(char *);
int /*<<< orphan*/ strcmp(char *, char *);
int iHybridNumber(char *sName) {
  StringLower(sName);
  if (!strcmp(sName, "undefined"))
    return (-1);
  if (!strcmp(sName, "unknown"))
    return (0);
  if (!strcmp(sName, "sp1"))
    return (1);
  if (!strcmp(sName, "sp2"))
    return (2);
  if (!strcmp(sName, "sp3"))
    return (3);
  return (-1);
}


x86 assembly (clang, -O0):
<iHybridNumber>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <StringLower@plt>
mov    -0x10(%rbp),%rdi
lea    0xec0(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    115a <iHybridNumber+0x3a>
movl   $0xffffffff,-0x4(%rbp)
jmp    11f5 <iHybridNumber+0xd5>
mov    -0x10(%rbp),%rdi
lea    0xea5(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    117f <iHybridNumber+0x5f>
movl   $0x0,-0x4(%rbp)
jmp    11f5 <iHybridNumber+0xd5>
mov    -0x10(%rbp),%rdi
lea    0xe88(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11a4 <iHybridNumber+0x84>
movl   $0x1,-0x4(%rbp)
jmp    11f5 <iHybridNumber+0xd5>
mov    -0x10(%rbp),%rdi
lea    0xe67(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11c9 <iHybridNumber+0xa9>
movl   $0x2,-0x4(%rbp)
jmp    11f5 <iHybridNumber+0xd5>
mov    -0x10(%rbp),%rdi
lea    0xe46(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11ee <iHybridNumber+0xce>
movl   $0x3,-0x4(%rbp)
jmp    11f5 <iHybridNumber+0xd5>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iHybridNumber>:
push   %rbx
mov    %rdi,%rbx
call   1040 <StringLower@plt>
lea    0xed0(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     118d <iHybridNumber+0x6d>
lea    0xec7(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1194 <iHybridNumber+0x74>
lea    0xebc(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1198 <iHybridNumber+0x78>
lea    0xead(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     119f <iHybridNumber+0x7f>
lea    0xe9e(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
neg    %eax
sbb    %eax,%eax
or     $0x3,%eax
pop    %rbx
ret
mov    $0xffffffff,%eax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret
mov    $0x2,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"undefined\00"
@.str.1 = [8 x i8] c"unknown\00"
@.str.2 = [4 x i8] c"sp1\00"
@.str.3 = [4 x i8] c"sp2\00"
@.str.4 = [4 x i8] c"sp3\00"
define i32 @iHybridNumber(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i32 @StringLower(i8* %4)
%6 = load i8*, i8** %3
%7 = call i32 @strcmp(i8* %6, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%8 = icmp ne i32 %7, 0
br i1 %8, label %10, label %9
9: ; preds = %1
store i32 -1, i32* %2
br label %31
10: ; preds = %1
%11 = load i8*, i8** %3
%12 = call i32 @strcmp(i8* %11, i8* getelementptr inbounds ([8 x i8], [8 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 0, i32* %2
br label %31
15: ; preds = %10
%16 = load i8*, i8** %3
%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 1, i32* %2
br label %31
20: ; preds = %15
%21 = load i8*, i8** %3
%22 = call i32 @strcmp(i8* %21, i8* getelementptr inbounds ([4 x i8], [4 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 2, i32* %2
br label %31
25: ; preds = %20
%26 = load i8*, i8** %3
%27 = call i32 @strcmp(i8* %26, i8* getelementptr inbounds ([4 x i8], [4 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 3, i32* %2
br label %31
30: ; preds = %25
store i32 -1, i32* %2
br label %31
31: ; preds = %30, %29, %24, %19, %14, %9
%32 = load i32, i32* %2
ret i32 %32
}

LLVM IR (-O2):
@.str = [10 x i8] c"undefined\00"
@.str.1 = [8 x i8] c"unknown\00"
@.str.2 = [4 x i8] c"sp1\00"
@.str.3 = [4 x i8] c"sp2\00"
@.str.4 = [4 x i8] c"sp3\00"
define i32 @iHybridNumber(i8* %0) {
%2 = tail call i32 @StringLower(i8* %0)
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(10) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, 0
br i1 %4, label %18, label %5
5: ; preds = %1
%6 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i32 %6, 0
br i1 %7, label %18, label %8
8: ; preds = %5
%9 = tail call i32 @strcmp(i8* dereferenceable(1) %0, 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 %18, label %11
11: ; preds = %8
%12 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%13 = icmp eq i32 %12, 0
br i1 %13, label %18, label %14
14: ; preds = %11
%15 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%16 = icmp eq i32 %15, 0
%17 = select i1 %16, i32 3, i32 -1
br label %18
18: ; preds = %14, %11, %8, %5, %1
%19 = phi i32 [ -1, %1 ], [ 0, %5 ], [ 1, %8 ], [ 2, %11 ], [ %17, %14 ]
ret i32 %19
}