#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*/ printf(char *);
scalar_t__ strncmp(char *, char *, int);
int operation_finder(char *operation) {
  if (strncmp("=", operation, 1) == 0) {
    return 0;
  } else if (strncmp("<=", operation, 2) == 0) {
    return 1;
  } else if (strncmp(">=", operation, 2) == 0) {
    return 2;
  } else if (strncmp(">", operation, 1) == 0) {
    return 3;
  } else if (strncmp("<", operation, 1) == 0) {
    return 4;
  } else if (strncmp("!=", operation, 2) == 0) {
    return 5;
  }
  printf("You did not enter a valid operation\n");
  exit(1);
}


x86 assembly (clang, -O0):
<operation_finder>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xec4(%rip),%rdi
mov    $0x1,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1167 <operation_finder+0x37>
movl   $0x0,-0x4(%rbp)
jmp    126d <operation_finder+0x13d>
mov    -0x10(%rbp),%rsi
lea    0xe8e(%rip),%rdi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1192 <operation_finder+0x62>
movl   $0x1,-0x4(%rbp)
jmp    126d <operation_finder+0x13d>
mov    -0x10(%rbp),%rsi
lea    0xe66(%rip),%rdi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11bd <operation_finder+0x8d>
movl   $0x2,-0x4(%rbp)
jmp    126d <operation_finder+0x13d>
mov    -0x10(%rbp),%rsi
lea    0xe3e(%rip),%rdi
mov    $0x1,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11e8 <operation_finder+0xb8>
movl   $0x3,-0x4(%rbp)
jmp    126d <operation_finder+0x13d>
mov    -0x10(%rbp),%rsi
lea    0xe15(%rip),%rdi
mov    $0x1,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1213 <operation_finder+0xe3>
movl   $0x4,-0x4(%rbp)
jmp    126d <operation_finder+0x13d>
mov    -0x10(%rbp),%rsi
lea    0xdec(%rip),%rdi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    123e <operation_finder+0x10e>
movl   $0x5,-0x4(%rbp)
jmp    126d <operation_finder+0x13d>
jmp    1243 <operation_finder+0x113>
jmp    1248 <operation_finder+0x118>
jmp    124d <operation_finder+0x11d>
jmp    1252 <operation_finder+0x122>
jmp    1257 <operation_finder+0x127>
lea    0xdaf(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<operation_finder>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xece(%rip),%rdi
mov    $0x1,%ebp
mov    %rbx,%rsi
mov    $0x1,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11f9 <operation_finder+0xc9>
lea    0xea1(%rip),%rdi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11fb <operation_finder+0xcb>
lea    0xe87(%rip),%rdi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
mov    $0x2,%ebp
test   %rax,%rax
je     11fb <operation_finder+0xcb>
lea    0xe6c(%rip),%rdi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1204 <operation_finder+0xd4>
lea    0xe55(%rip),%rdi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     120b <operation_finder+0xdb>
lea    0xe3e(%rip),%rdi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
mov    $0x5,%ebp
test   %rax,%rax
je     11fb <operation_finder+0xcb>
lea    0xe23(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    $0x3,%ebp
jmp    11fb <operation_finder+0xcb>
mov    $0x4,%ebp
jmp    11fb <operation_finder+0xcb>

LLVM IR (-O0):
@.str = [2 x i8] c"=\00"
@.str.1 = [3 x i8] c"<=\00"
@.str.2 = [3 x i8] c">=\00"
@.str.3 = [2 x i8] c">\00"
@.str.4 = [2 x i8] c"<\00"
@.str.5 = [3 x i8] c"!=\00"
@.str.6 = [37 x i8] c"You did not enter a valid operation\0A\00"
define i32 @operation_finder(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i64 @strncmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* %4, i32 1)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 0, i32* %2
br label %41
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i64 @strncmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %9, i32 2)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %8
store i32 1, i32* %2
br label %41
13: ; preds = %8
%14 = load i8*, i8** %3
%15 = call i64 @strncmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %14, i32 2)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %13
store i32 2, i32* %2
br label %41
18: ; preds = %13
%19 = load i8*, i8** %3
%20 = call i64 @strncmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* %19, i32 1)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %18
store i32 3, i32* %2
br label %41
23: ; preds = %18
%24 = load i8*, i8** %3
%25 = call i64 @strncmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* %24, i32 1)
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %23
store i32 4, i32* %2
br label %41
28: ; preds = %23
%29 = load i8*, i8** %3
%30 = call i64 @strncmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %29, i32 2)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %33
32: ; preds = %28
store i32 5, i32* %2
br label %41
33: ; preds = %28
br label %34
34: ; preds = %33
br label %35
35: ; preds = %34
br label %36
36: ; preds = %35
br label %37
37: ; preds = %36
br label %38
38: ; preds = %37
%39 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0))
%40 = call i32 @exit(i32 1)
unreachable
41: ; preds = %32, %27, %22, %17, %12, %7
%42 = load i32, i32* %2
ret i32 %42
}

LLVM IR (-O2):
@.str = [2 x i8] c"=\00"
@.str.1 = [3 x i8] c"<=\00"
@.str.2 = [3 x i8] c">=\00"
@.str.3 = [2 x i8] c">\00"
@.str.4 = [2 x i8] c"<\00"
@.str.5 = [3 x i8] c"!=\00"
@str = [36 x i8] c"You did not enter a valid operation\00"
define i32 @operation_finder(i8* %0) {
%2 = tail call i64 @strncmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* %0, i32 1)
%3 = icmp eq i64 %2, 0
br i1 %3, label %22, label %4
4: ; preds = %1
%5 = tail call i64 @strncmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %0, i32 2)
%6 = icmp eq i64 %5, 0
br i1 %6, label %22, label %7
7: ; preds = %4
%8 = tail call i64 @strncmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %0, i32 2)
%9 = icmp eq i64 %8, 0
br i1 %9, label %22, label %10
10: ; preds = %7
%11 = tail call i64 @strncmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* %0, i32 1)
%12 = icmp eq i64 %11, 0
br i1 %12, label %22, label %13
13: ; preds = %10
%14 = tail call i64 @strncmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* %0, i32 1)
%15 = icmp eq i64 %14, 0
br i1 %15, label %22, label %16
16: ; preds = %13
%17 = tail call i64 @strncmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %0, i32 2)
%18 = icmp eq i64 %17, 0
br i1 %18, label %22, label %19
19: ; preds = %16
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
%21 = tail call i32 @exit(i32 1)
unreachable
22: ; preds = %16, %13, %10, %7, %4, %1
%23 = phi i32 [ 0, %1 ], [ 1, %4 ], [ 2, %7 ], [ 3, %10 ], [ 4, %13 ], [ 5, %16 ]
ret i32 %23
}