#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 */
scalar_t__ sqlite3StrICmp(char const *, char *);
int getTempStore(const char *z) {
  if (z[0] >= '0' && z[0] <= '2') {
    return z[0] - '0';
  } else if (sqlite3StrICmp(z, "file") == 0) {
    return 1;
  } else if (sqlite3StrICmp(z, "memory") == 0) {
    return 2;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<getTempStore>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jl     114e <getTempStore+0x3e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x32,%eax
jg     114e <getTempStore+0x3e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    11a1 <getTempStore+0x91>
mov    -0x10(%rbp),%rdi
lea    0xea7(%rip),%rsi
call   1030 <sqlite3StrICmp@plt>
cmp    $0x0,%rax
jne    1174 <getTempStore+0x64>
movl   $0x1,-0x4(%rbp)
jmp    11a1 <getTempStore+0x91>
mov    -0x10(%rbp),%rdi
lea    0xe86(%rip),%rsi
call   1030 <sqlite3StrICmp@plt>
cmp    $0x0,%rax
jne    119a <getTempStore+0x8a>
movl   $0x2,-0x4(%rbp)
jmp    11a1 <getTempStore+0x91>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getTempStore>:
push   %rbx
movzbl (%rdi),%eax
lea    -0x30(%rax),%ecx
cmp    $0x2,%cl
ja     1121 <getTempStore+0x11>
add    $0xffffffd0,%eax
pop    %rbx
ret
mov    %rdi,%rbx
lea    0xed5(%rip),%rsi
call   1030 <sqlite3StrICmp@plt>
test   %rax,%rax
je     1153 <getTempStore+0x43>
lea    0xec9(%rip),%rsi
mov    %rbx,%rdi
call   1030 <sqlite3StrICmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
add    %eax,%eax
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"file\00"
@.str.1 = [7 x i8] c"memory\00"
define i32 @getTempStore(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp sge i32 %7, 48
br i1 %8, label %9, label %21
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i64 0
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp sle i32 %13, 50
br i1 %14, label %15, label %21
15: ; preds = %9
%16 = load i8*, i8** %3
%17 = getelementptr inbounds i8, i8* %16, i64 0
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = sub nsw i32 %19, 48
store i32 %20, i32* %2
br label %32
21: ; preds = %9, %1
%22 = load i8*, i8** %3
%23 = call i64 @sqlite3StrICmp(i8* %22, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %21
store i32 1, i32* %2
br label %32
26: ; preds = %21
%27 = load i8*, i8** %3
%28 = call i64 @sqlite3StrICmp(i8* %27, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %26
store i32 2, i32* %2
br label %32
31: ; preds = %26
store i32 0, i32* %2
br label %32
32: ; preds = %31, %30, %25, %15
%33 = load i32, i32* %2
ret i32 %33
}

LLVM IR (-O2):
@.str = [5 x i8] c"file\00"
@.str.1 = [7 x i8] c"memory\00"
define i32 @getTempStore(i8* %0) {
%2 = load i8, i8* %0
%3 = add i8 %2, -48
%4 = icmp ult i8 %3, 3
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = zext i8 %2 to i32
%7 = add nsw i32 %6, -48
br label %15
8: ; preds = %1
%9 = tail call i64 @sqlite3StrICmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %8
%12 = tail call i64 @sqlite3StrICmp(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
%14 = select i1 %13, i32 2, i32 0
br label %15
15: ; preds = %11, %8, %5
%16 = phi i32 [ %7, %5 ], [ 1, %8 ], [ %14, %11 ]
ret i32 %16
}