#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*/ MNTTYPE_SWAP;
char *index(char const *, char);
scalar_t__ strcmp(char const *, int /*<<< orphan*/);
int strlen(char const *);
scalar_t__ strncmp(char const *, char const *, int);
int matching_type(const char *type, const char *types) {
  int no;
  int len;
  const char *p;
  if ((strcmp((type), (MNTTYPE_SWAP)) == 0))
    return 0;
  if (types == NULL)
    return 1;
  no = 0;
  if (!strncmp(types, "no", 2)) {
    no = 1;
    types += 2;
  }
  len = strlen(type);
  p = types;
  while (1) {
    if (!strncmp(p, "no", 2) && !strncmp(p + 2, type, len) &&
        (p[len + 2] == 0 || p[len + 2] == ','))
      return 0;
    if (strncmp(p, type, len) == 0 && (p[len] == 0 || p[len] == ','))
      return !no;
    p = index(p, ',');
    if (!p)
      break;
    p++;
  }
  return no;
}


x86 assembly (clang, -O0):
<matching_type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2e8d(%rip),%rax
mov    (%rax),%esi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1178 <matching_type+0x38>
movl   $0x0,-0x4(%rbp)
jmp    12ec <matching_type+0x1ac>
cmpq   $0x0,-0x18(%rbp)
jne    118f <matching_type+0x4f>
movl   $0x1,-0x4(%rbp)
jmp    12ec <matching_type+0x1ac>
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe5f(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11c8 <matching_type+0x88>
movl   $0x1,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xe19(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1259 <matching_type+0x119>
mov    -0x28(%rbp),%rdi
add    $0x2,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1259 <matching_type+0x119>
mov    -0x28(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     124d <matching_type+0x10d>
mov    -0x28(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2c,%eax
jne    1259 <matching_type+0x119>
movl   $0x0,-0x4(%rbp)
jmp    12ec <matching_type+0x1ac>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    12b3 <matching_type+0x173>
mov    -0x28(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     129d <matching_type+0x15d>
mov    -0x28(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2c,%eax
jne    12b3 <matching_type+0x173>
cmpl   $0x0,-0x1c(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    12ec <matching_type+0x1ac>
mov    -0x28(%rbp),%rdi
mov    $0x2c,%esi
call   1050 <index@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    12d5 <matching_type+0x195>
jmp    12e6 <matching_type+0x1a6>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    11dc <matching_type+0x9c>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<matching_type>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r15
mov    0x2e90(%rip),%rax
mov    (%rax),%esi
call   1060 <strcmp@plt>
test   %rax,%rax
je     1224 <matching_type+0xe4>
test   %rbx,%rbx
je     1228 <matching_type+0xe8>
lea    0xe88(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
xor    %r13d,%r13d
test   %rax,%rax
setne  0x7(%rsp)
sete   %r13b
lea    (%rbx,%r13,2),%rbx
mov    %r15,%rdi
call   1040 <strlen@plt>
mov    %eax,%r12d
movslq %eax,%rbp
jmp    11c6 <matching_type+0x86>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    $0x2c,%esi
call   1050 <index@plt>
lea    0x1(%rax),%rbx
test   %rax,%rax
je     122c <matching_type+0xec>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    1200 <matching_type+0xc0>
lea    0x2(%rbx),%rdi
mov    %r15,%rsi
mov    %r12d,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    1200 <matching_type+0xc0>
movzbl 0x2(%rbx,%rbp,1),%ecx
xor    %eax,%eax
test   %cl,%cl
je     122f <matching_type+0xef>
cmp    $0x2c,%cl
je     122f <matching_type+0xef>
nop
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %ebp,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    11b0 <matching_type+0x70>
movzbl (%rbx,%rbp,1),%eax
test   %al,%al
je     121e <matching_type+0xde>
cmp    $0x2c,%al
jne    11b0 <matching_type+0x70>
mov    0x7(%rsp),%al
jmp    122f <matching_type+0xef>
xor    %eax,%eax
jmp    122f <matching_type+0xef>
mov    $0x1,%al
jmp    122f <matching_type+0xef>
mov    %r13d,%eax
movzbl %al,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@MNTTYPE_SWAP = global i32 0
@.str = [3 x i8] c"no\00"
define i32 @matching_type(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%9 = load i8*, i8** %4
%10 = load i32, i32* @MNTTYPE_SWAP
%11 = call i64 @strcmp(i8* %9, i32 %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 0, i32* %3
br label %97
14: ; preds = %2
%15 = load i8*, i8** %5
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %18
17: ; preds = %14
store i32 1, i32* %3
br label %97
18: ; preds = %14
store i32 0, i32* %6
%19 = load i8*, i8** %5
%20 = call i64 @strncmp(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%21 = icmp ne i64 %20, 0
br i1 %21, label %25, label %22
22: ; preds = %18
store i32 1, i32* %6
%23 = load i8*, i8** %5
%24 = getelementptr inbounds i8, i8* %23, i64 2
store i8* %24, i8** %5
br label %25
25: ; preds = %22, %18
%26 = load i8*, i8** %4
%27 = call i32 @strlen(i8* %26)
store i32 %27, i32* %7
%28 = load i8*, i8** %5
store i8* %28, i8** %8
br label %29
29: ; preds = %25, %92
%30 = load i8*, i8** %8
%31 = call i64 @strncmp(i8* %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%32 = icmp ne i64 %31, 0
br i1 %32, label %59, label %33
33: ; preds = %29
%34 = load i8*, i8** %8
%35 = getelementptr inbounds i8, i8* %34, i64 2
%36 = load i8*, i8** %4
%37 = load i32, i32* %7
%38 = call i64 @strncmp(i8* %35, i8* %36, i32 %37)
%39 = icmp ne i64 %38, 0
br i1 %39, label %59, label %40
40: ; preds = %33
%41 = load i8*, i8** %8
%42 = load i32, i32* %7
%43 = add nsw i32 %42, 2
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8, i8* %41, i64 %44
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = icmp eq i32 %47, 0
br i1 %48, label %58, label %49
49: ; preds = %40
%50 = load i8*, i8** %8
%51 = load i32, i32* %7
%52 = add nsw i32 %51, 2
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8, i8* %50, i64 %53
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = icmp eq i32 %56, 44
br i1 %57, label %58, label %59
58: ; preds = %49, %40
store i32 0, i32* %3
br label %97
59: ; preds = %49, %33, %29
%60 = load i8*, i8** %8
%61 = load i8*, i8** %4
%62 = load i32, i32* %7
%63 = call i64 @strncmp(i8* %60, i8* %61, i32 %62)
%64 = icmp eq i64 %63, 0
br i1 %64, label %65, label %86
65: ; preds = %59
%66 = load i8*, i8** %8
%67 = load i32, i32* %7
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds i8, i8* %66, i64 %68
%70 = load i8, i8* %69
%71 = sext i8 %70 to i32
%72 = icmp eq i32 %71, 0
br i1 %72, label %81, label %73
73: ; preds = %65
%74 = load i8*, i8** %8
%75 = load i32, i32* %7
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds i8, i8* %74, i64 %76
%78 = load i8, i8* %77
%79 = sext i8 %78 to i32
%80 = icmp eq i32 %79, 44
br i1 %80, label %81, label %86
81: ; preds = %73, %65
%82 = load i32, i32* %6
%83 = icmp ne i32 %82, 0
%84 = xor i1 %83, true
%85 = zext i1 %84 to i32
store i32 %85, i32* %3
br label %97
86: ; preds = %73, %59
%87 = load i8*, i8** %8
%88 = call i8* @index(i8* %87, i8 signext 44)
store i8* %88, i8** %8
%89 = load i8*, i8** %8
%90 = icmp ne i8* %89, null
br i1 %90, label %92, label %91
91: ; preds = %86
br label %95
92: ; preds = %86
%93 = load i8*, i8** %8
%94 = getelementptr inbounds i8, i8* %93, i32 1
store i8* %94, i8** %8
br label %29
95: ; preds = %91
%96 = load i32, i32* %6
store i32 %96, i32* %3
br label %97
97: ; preds = %95, %81, %58, %17, %13
%98 = load i32, i32* %3
ret i32 %98
}

LLVM IR (-O2):
@MNTTYPE_SWAP = global i32 0
@.str = [3 x i8] c"no\00"
define i32 @matching_type(i8* %0, i8* %1) {
%3 = load i32, i32* @MNTTYPE_SWAP
%4 = tail call i64 @strcmp(i8* %0, i32 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %39, label %6
6: ; preds = %2
%7 = icmp eq i8* %1, null
br i1 %7, label %39, label %8
8: ; preds = %6
%9 = tail call i64 @strncmp(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%10 = icmp eq i64 %9, 0
%11 = select i1 %10, i64 2, i64 0
%12 = getelementptr i8, i8* %1, i64 %11
%13 = xor i1 %10, true
%14 = tail call i32 @strlen(i8* %0)
%15 = add nsw i32 %14, 2
%16 = sext i32 %15 to i64
%17 = sext i32 %14 to i64
br label %18
18: ; preds = %35, %8
%19 = phi i8* [ %12, %8 ], [ %38, %35 ]
%20 = tail call i64 @strncmp(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %29
22: ; preds = %18
%23 = getelementptr inbounds i8, i8* %19, i64 2
%24 = tail call i64 @strncmp(i8* %23, i8* %0, i32 %14)
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %22
%27 = getelementptr inbounds i8, i8* %19, i64 %16
%28 = load i8, i8* %27
switch i8 %28, label %29 [
i8 0, label %39
i8 44, label %39
]
29: ; preds = %26, %22, %18
%30 = tail call i64 @strncmp(i8* %19, i8* %0, i32 %14)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %29
%33 = getelementptr inbounds i8, i8* %19, i64 %17
%34 = load i8, i8* %33
switch i8 %34, label %35 [
i8 0, label %39
i8 44, label %39
]
35: ; preds = %32, %29
%36 = tail call i8* @index(i8* %19, i8 signext 44)
%37 = icmp eq i8* %36, null
%38 = getelementptr inbounds i8, i8* %36, i64 1
br i1 %37, label %39, label %18
39: ; preds = %32, %32, %35, %26, %26, %6, %2
%40 = phi i1 [ false, %2 ], [ true, %6 ], [ %13, %32 ], [ %13, %32 ], [ %10, %35 ], [ false, %26 ], [ false, %26 ]
%41 = zext i1 %40 to i32
ret i32 %41
}