#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__ strlen(char *);
scalar_t__ strncasecmp(char *, char *, scalar_t__);
int odirureMatch(char *first, char *second, char *input) {
  if ((strlen(input) > strlen(first)) && (strlen(input) > strlen(second)))
    return 0;
  else if ((strlen(input) > strlen(first)) &&
           (strlen(input) <= strlen(second))) {
    if (strncasecmp(input, second, strlen(input)) == 0)
      return 2;
    else
      return 0;
  } else if ((strlen(input) <= strlen(first)) &&
             (strlen(input) > strlen(second))) {
    if (strncasecmp(input, first, strlen(input)) == 0)
      return 1;
    else
      return 0;
  } else if ((strlen(input) <= strlen(first)) &&
             (strlen(input) <= strlen(second))) {
    if ((strncasecmp(input, first, strlen(input)) == 0) &&
        (strncasecmp(input, second, strlen(input)) == 0))
      return 3;
    if (strncasecmp(input, first, strlen(input)) == 0)
      return 1;
    else if (strncasecmp(input, second, strlen(input)) == 0)
      return 2;
    else
      return 0;
  } else
    return 0;
}


x86 assembly (clang, -O0):
<odirureMatch>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cmp    %rcx,%rax
jle    118f <odirureMatch+0x6f>
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
cmp    %rcx,%rax
jle    118f <odirureMatch+0x6f>
movl   $0x0,-0x4(%rbp)
jmp    143c <odirureMatch+0x31c>
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
cmp    %rcx,%rax
jle    1226 <odirureMatch+0x106>
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x40(%rbp),%rax
cmp    %rcx,%rax
jg     1226 <odirureMatch+0x106>
mov    -0x20(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x50(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    %rax,%rdx
call   1040 <strncasecmp@plt>
cmp    $0x0,%rax
jne    121a <odirureMatch+0xfa>
movl   $0x2,-0x4(%rbp)
jmp    143c <odirureMatch+0x31c>
movl   $0x0,-0x4(%rbp)
jmp    143c <odirureMatch+0x31c>
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x58(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x58(%rbp),%rax
cmp    %rcx,%rax
jg     12bd <odirureMatch+0x19d>
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x60(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x60(%rbp),%rax
cmp    %rcx,%rax
jle    12bd <odirureMatch+0x19d>
mov    -0x20(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x70(%rbp),%rdi
mov    -0x68(%rbp),%rsi
mov    %rax,%rdx
call   1040 <strncasecmp@plt>
cmp    $0x0,%rax
jne    12b1 <odirureMatch+0x191>
movl   $0x1,-0x4(%rbp)
jmp    143c <odirureMatch+0x31c>
movl   $0x0,-0x4(%rbp)
jmp    143c <odirureMatch+0x31c>
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x78(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x78(%rbp),%rax
cmp    %rcx,%rax
jg     1435 <odirureMatch+0x315>
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x80(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x80(%rbp),%rax
cmp    %rcx,%rax
jg     1435 <odirureMatch+0x315>
mov    -0x20(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x90(%rbp),%rdi
mov    -0x88(%rbp),%rsi
mov    %rax,%rdx
call   1040 <strncasecmp@plt>
cmp    $0x0,%rax
jne    1393 <odirureMatch+0x273>
mov    -0x20(%rbp),%rax
mov    %rax,-0xa0(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0xa0(%rbp),%rdi
mov    -0x98(%rbp),%rsi
mov    %rax,%rdx
call   1040 <strncasecmp@plt>
cmp    $0x0,%rax
jne    1393 <odirureMatch+0x273>
movl   $0x3,-0x4(%rbp)
jmp    143c <odirureMatch+0x31c>
mov    -0x20(%rbp),%rax
mov    %rax,-0xb0(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0xa8(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0xb0(%rbp),%rdi
mov    -0xa8(%rbp),%rsi
mov    %rax,%rdx
call   1040 <strncasecmp@plt>
cmp    $0x0,%rax
jne    13de <odirureMatch+0x2be>
movl   $0x1,-0x4(%rbp)
jmp    143c <odirureMatch+0x31c>
mov    -0x20(%rbp),%rax
mov    %rax,-0xc0(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0xb8(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0xc0(%rbp),%rdi
mov    -0xb8(%rbp),%rsi
mov    %rax,%rdx
call   1040 <strncasecmp@plt>
cmp    $0x0,%rax
jne    1429 <odirureMatch+0x309>
movl   $0x2,-0x4(%rbp)
jmp    143c <odirureMatch+0x31c>
movl   $0x0,-0x4(%rbp)
jmp    143c <odirureMatch+0x31c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<odirureMatch>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%r12
mov    %rdx,%rdi
call   1030 <strlen@plt>
mov    %rax,%rbx
mov    %r12,%rdi
call   1030 <strlen@plt>
mov    %rax,%rbp
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %rax,%r13
cmp    %rbp,%rbx
jle    1174 <odirureMatch+0x54>
xor    %eax,%eax
cmp    %r13,%rbx
jg     11c3 <odirureMatch+0xa3>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1040 <strncasecmp@plt>
mov    %rax,%rcx
jmp    11aa <odirureMatch+0x8a>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1040 <strncasecmp@plt>
mov    %rax,%r12
cmp    %r13,%rbx
jle    1194 <odirureMatch+0x74>
xor    %eax,%eax
test   %r12,%r12
sete   %al
jmp    11c3 <odirureMatch+0xa3>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1040 <strncasecmp@plt>
mov    %rax,%rcx
test   %r12,%r12
je     11b6 <odirureMatch+0x96>
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
add    %eax,%eax
jmp    11c3 <odirureMatch+0xa3>
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
add    %eax,%eax
add    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @odirureMatch(i8* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%8 = load i8*, i8** %7
%9 = call i64 @strlen(i8* %8)
%10 = load i8*, i8** %5
%11 = call i64 @strlen(i8* %10)
%12 = icmp sgt i64 %9, %11
br i1 %12, label %13, label %20
13: ; preds = %3
%14 = load i8*, i8** %7
%15 = call i64 @strlen(i8* %14)
%16 = load i8*, i8** %6
%17 = call i64 @strlen(i8* %16)
%18 = icmp sgt i64 %15, %17
br i1 %18, label %19, label %20
19: ; preds = %13
store i32 0, i32* %4
br label %107
20: ; preds = %13, %3
%21 = load i8*, i8** %7
%22 = call i64 @strlen(i8* %21)
%23 = load i8*, i8** %5
%24 = call i64 @strlen(i8* %23)
%25 = icmp sgt i64 %22, %24
br i1 %25, label %26, label %41
26: ; preds = %20
%27 = load i8*, i8** %7
%28 = call i64 @strlen(i8* %27)
%29 = load i8*, i8** %6
%30 = call i64 @strlen(i8* %29)
%31 = icmp sle i64 %28, %30
br i1 %31, label %32, label %41
32: ; preds = %26
%33 = load i8*, i8** %7
%34 = load i8*, i8** %6
%35 = load i8*, i8** %7
%36 = call i64 @strlen(i8* %35)
%37 = call i64 @strncasecmp(i8* %33, i8* %34, i64 %36)
%38 = icmp eq i64 %37, 0
br i1 %38, label %39, label %40
39: ; preds = %32
store i32 2, i32* %4
br label %107
40: ; preds = %32
store i32 0, i32* %4
br label %107
41: ; preds = %26, %20
%42 = load i8*, i8** %7
%43 = call i64 @strlen(i8* %42)
%44 = load i8*, i8** %5
%45 = call i64 @strlen(i8* %44)
%46 = icmp sle i64 %43, %45
br i1 %46, label %47, label %62
47: ; preds = %41
%48 = load i8*, i8** %7
%49 = call i64 @strlen(i8* %48)
%50 = load i8*, i8** %6
%51 = call i64 @strlen(i8* %50)
%52 = icmp sgt i64 %49, %51
br i1 %52, label %53, label %62
53: ; preds = %47
%54 = load i8*, i8** %7
%55 = load i8*, i8** %5
%56 = load i8*, i8** %7
%57 = call i64 @strlen(i8* %56)
%58 = call i64 @strncasecmp(i8* %54, i8* %55, i64 %57)
%59 = icmp eq i64 %58, 0
br i1 %59, label %60, label %61
60: ; preds = %53
store i32 1, i32* %4
br label %107
61: ; preds = %53
store i32 0, i32* %4
br label %107
62: ; preds = %47, %41
%63 = load i8*, i8** %7
%64 = call i64 @strlen(i8* %63)
%65 = load i8*, i8** %5
%66 = call i64 @strlen(i8* %65)
%67 = icmp sle i64 %64, %66
br i1 %67, label %68, label %106
68: ; preds = %62
%69 = load i8*, i8** %7
%70 = call i64 @strlen(i8* %69)
%71 = load i8*, i8** %6
%72 = call i64 @strlen(i8* %71)
%73 = icmp sle i64 %70, %72
br i1 %73, label %74, label %106
74: ; preds = %68
%75 = load i8*, i8** %7
%76 = load i8*, i8** %5
%77 = load i8*, i8** %7
%78 = call i64 @strlen(i8* %77)
%79 = call i64 @strncasecmp(i8* %75, i8* %76, i64 %78)
%80 = icmp eq i64 %79, 0
br i1 %80, label %81, label %89
81: ; preds = %74
%82 = load i8*, i8** %7
%83 = load i8*, i8** %6
%84 = load i8*, i8** %7
%85 = call i64 @strlen(i8* %84)
%86 = call i64 @strncasecmp(i8* %82, i8* %83, i64 %85)
%87 = icmp eq i64 %86, 0
br i1 %87, label %88, label %89
88: ; preds = %81
store i32 3, i32* %4
br label %107
89: ; preds = %81, %74
%90 = load i8*, i8** %7
%91 = load i8*, i8** %5
%92 = load i8*, i8** %7
%93 = call i64 @strlen(i8* %92)
%94 = call i64 @strncasecmp(i8* %90, i8* %91, i64 %93)
%95 = icmp eq i64 %94, 0
br i1 %95, label %96, label %97
96: ; preds = %89
store i32 1, i32* %4
br label %107
97: ; preds = %89
%98 = load i8*, i8** %7
%99 = load i8*, i8** %6
%100 = load i8*, i8** %7
%101 = call i64 @strlen(i8* %100)
%102 = call i64 @strncasecmp(i8* %98, i8* %99, i64 %101)
%103 = icmp eq i64 %102, 0
br i1 %103, label %104, label %105
104: ; preds = %97
store i32 2, i32* %4
br label %107
105: ; preds = %97
store i32 0, i32* %4
br label %107
106: ; preds = %68, %62
store i32 0, i32* %4
br label %107
107: ; preds = %106, %105, %104, %96, %88, %61, %60, %40, %39, %19
%108 = load i32, i32* %4
ret i32 %108
}

LLVM IR (-O2):
define i32 @odirureMatch(i8* nocapture %0, i8* nocapture %1, i8* nocapture %2) {
%4 = tail call i64 @strlen(i8* dereferenceable(1) %2)
%5 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%6 = icmp sgt i64 %4, %5
%7 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%8 = icmp sgt i64 %4, %7
br i1 %6, label %9, label %14
9: ; preds = %3
br i1 %8, label %26, label %10
10: ; preds = %9
%11 = tail call i64 @strncasecmp(i8* %2, i8* %1, i64 %4)
%12 = icmp eq i64 %11, 0
%13 = select i1 %12, i32 2, i32 0
br label %26
14: ; preds = %3
%15 = tail call i64 @strncasecmp(i8* %2, i8* %0, i64 %4)
%16 = icmp eq i64 %15, 0
br i1 %8, label %17, label %19
17: ; preds = %14
%18 = zext i1 %16 to i32
br label %26
19: ; preds = %14
%20 = tail call i64 @strncasecmp(i8* %2, i8* %1, i64 %4)
%21 = icmp eq i64 %20, 0
br i1 %16, label %22, label %24
22: ; preds = %19
%23 = select i1 %21, i32 3, i32 1
br label %26
24: ; preds = %19
%25 = select i1 %21, i32 2, i32 0
br label %26
26: ; preds = %22, %24, %17, %10, %9
%27 = phi i32 [ 0, %9 ], [ %13, %10 ], [ %18, %17 ], [ %25, %24 ], [ %23, %22 ]
ret i32 %27
}