#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 strlen(char *);
int OperatorType(char *S) {
  if (strlen(S) == 1) {
    if (S[0] == '&')
      return 0x1;
    if (S[0] == '|')
      return 0x8;
    if (S[0] == ';')
      return 0x10;
  }
  if (strlen(S) == 2) {
    if (S[0] == '&' && S[1] == '&')
      return 0x2;
    if (S[0] == '|' && S[1] == '|')
      return 0x4;
  }
  return 0x0;
}


x86 assembly (clang, -O0):
<OperatorType>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x1,%eax
jne    1187 <OperatorType+0x77>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x26,%eax
jne    114a <OperatorType+0x3a>
movl   $0x1,-0x4(%rbp)
jmp    11ff <OperatorType+0xef>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7c,%eax
jne    1166 <OperatorType+0x56>
movl   $0x8,-0x4(%rbp)
jmp    11ff <OperatorType+0xef>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3b,%eax
jne    1182 <OperatorType+0x72>
movl   $0x10,-0x4(%rbp)
jmp    11ff <OperatorType+0xef>
jmp    1187 <OperatorType+0x77>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x2,%eax
jne    11f8 <OperatorType+0xe8>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x26,%eax
jne    11c6 <OperatorType+0xb6>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x26,%eax
jne    11c6 <OperatorType+0xb6>
movl   $0x2,-0x4(%rbp)
jmp    11ff <OperatorType+0xef>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7c,%eax
jne    11f3 <OperatorType+0xe3>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x7c,%eax
jne    11f3 <OperatorType+0xe3>
movl   $0x4,-0x4(%rbp)
jmp    11ff <OperatorType+0xef>
jmp    11f8 <OperatorType+0xe8>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OperatorType>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
cmp    $0x1,%eax
jne    1133 <OperatorType+0x23>
mov    (%rbx),%al
cmp    $0x26,%al
je     1157 <OperatorType+0x47>
cmp    $0x3b,%al
je     115e <OperatorType+0x4e>
cmp    $0x7c,%al
jne    1133 <OperatorType+0x23>
mov    $0x8,%eax
pop    %rbx
ret
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmp    $0x2,%eax
jne    1170 <OperatorType+0x60>
mov    (%rbx),%al
cmp    $0x7c,%al
je     1165 <OperatorType+0x55>
cmp    $0x26,%al
jne    1170 <OperatorType+0x60>
mov    $0x2,%eax
cmpb   $0x26,0x1(%rbx)
jne    1170 <OperatorType+0x60>
jmp    1172 <OperatorType+0x62>
mov    $0x1,%eax
pop    %rbx
ret
mov    $0x10,%eax
pop    %rbx
ret
mov    $0x4,%eax
cmpb   $0x7c,0x1(%rbx)
je     1172 <OperatorType+0x62>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @OperatorType(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i32 @strlen(i8* %4)
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %29
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = getelementptr inbounds i8, i8* %8, i64 0
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 38
br i1 %12, label %13, label %14
13: ; preds = %7
store i32 1, i32* %2
br label %61
14: ; preds = %7
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i64 0
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 124
br i1 %19, label %20, label %21
20: ; preds = %14
store i32 8, i32* %2
br label %61
21: ; preds = %14
%22 = load i8*, i8** %3
%23 = getelementptr inbounds i8, i8* %22, i64 0
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 59
br i1 %26, label %27, label %28
27: ; preds = %21
store i32 16, i32* %2
br label %61
28: ; preds = %21
br label %29
29: ; preds = %28, %1
%30 = load i8*, i8** %3
%31 = call i32 @strlen(i8* %30)
%32 = icmp eq i32 %31, 2
br i1 %32, label %33, label %60
33: ; preds = %29
%34 = load i8*, i8** %3
%35 = getelementptr inbounds i8, i8* %34, i64 0
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = icmp eq i32 %37, 38
br i1 %38, label %39, label %46
39: ; preds = %33
%40 = load i8*, i8** %3
%41 = getelementptr inbounds i8, i8* %40, i64 1
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 38
br i1 %44, label %45, label %46
45: ; preds = %39
store i32 2, i32* %2
br label %61
46: ; preds = %39, %33
%47 = load i8*, i8** %3
%48 = getelementptr inbounds i8, i8* %47, i64 0
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = icmp eq i32 %50, 124
br i1 %51, label %52, label %59
52: ; preds = %46
%53 = load i8*, i8** %3
%54 = getelementptr inbounds i8, i8* %53, i64 1
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = icmp eq i32 %56, 124
br i1 %57, label %58, label %59
58: ; preds = %52
store i32 4, i32* %2
br label %61
59: ; preds = %52, %46
br label %60
60: ; preds = %59, %29
store i32 0, i32* %2
br label %61
61: ; preds = %60, %58, %45, %27, %20, %13
%62 = load i32, i32* %2
ret i32 %62
}

LLVM IR (-O2):
define i32 @OperatorType(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp eq i32 %2, 1
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i8, i8* %0
switch i8 %5, label %8 [
i8 38, label %22
i8 124, label %6
i8 59, label %7
]
6: ; preds = %4
br label %22
7: ; preds = %4
br label %22
8: ; preds = %4, %1
%9 = tail call i32 @strlen(i8* %0)
%10 = icmp eq i32 %9, 2
br i1 %10, label %11, label %21
11: ; preds = %8
%12 = load i8, i8* %0
switch i8 %12, label %21 [
i8 38, label %13
i8 124, label %17
]
13: ; preds = %11
%14 = getelementptr inbounds i8, i8* %0, i64 1
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 38
br i1 %16, label %22, label %21
17: ; preds = %11
%18 = getelementptr inbounds i8, i8* %0, i64 1
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 124
br i1 %20, label %22, label %21
21: ; preds = %11, %13, %17, %8
br label %22
22: ; preds = %17, %13, %4, %21, %7, %6
%23 = phi i32 [ 8, %6 ], [ 16, %7 ], [ 0, %21 ], [ 1, %4 ], [ 2, %13 ], [ 4, %17 ]
ret i32 %23
}