#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*/ memcmp(char *, char const *, int);
int is_top_level_match(char *line, const char *device, bool class) {
  if (line[0] == '\t')
    return false;
  if (line[0] == '#')
    return false;
  if (!class)
    return !memcmp(line, &device[2], 4);
  if (line[0] != 'C')
    return false;
  return !memcmp(&line[2], &device[2], 2);
}


x86 assembly (clang, -O0):
<is_top_level_match>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
jne    113f <is_top_level_match+0x2f>
movl   $0x0,-0x4(%rbp)
jmp    11d6 <is_top_level_match+0xc6>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x23,%eax
jne    115b <is_top_level_match+0x4b>
movl   $0x0,-0x4(%rbp)
jmp    11d6 <is_top_level_match+0xc6>
cmpl   $0x0,-0x1c(%rbp)
jne    1190 <is_top_level_match+0x80>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    $0x2,%rsi
mov    $0x4,%edx
call   1030 <memcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    11d6 <is_top_level_match+0xc6>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x43,%eax
je     11ac <is_top_level_match+0x9c>
movl   $0x0,-0x4(%rbp)
jmp    11d6 <is_top_level_match+0xc6>
mov    -0x10(%rbp),%rdi
add    $0x2,%rdi
mov    -0x18(%rbp),%rsi
add    $0x2,%rsi
mov    $0x2,%edx
call   1030 <memcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_top_level_match>:
push   %rax
mov    (%rdi),%cl
xor    %eax,%eax
cmp    $0x9,%cl
je     114e <is_top_level_match+0x3e>
cmp    $0x23,%cl
je     114e <is_top_level_match+0x3e>
test   %edx,%edx
je     1137 <is_top_level_match+0x27>
cmp    $0x43,%cl
jne    114c <is_top_level_match+0x3c>
add    $0x2,%rdi
add    $0x2,%rsi
mov    $0x2,%edx
jmp    1140 <is_top_level_match+0x30>
add    $0x2,%rsi
mov    $0x4,%edx
call   1030 <memcmp@plt>
test   %eax,%eax
sete   %al
jmp    114e <is_top_level_match+0x3e>
xor    %eax,%eax
movzbl %al,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @is_top_level_match(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%8 = load i8*, i8** %5
%9 = getelementptr inbounds i8, i8* %8, i64 0
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 9
br i1 %12, label %13, label %14
13: ; preds = %3
store i32 0, i32* %4
br label %48
14: ; preds = %3
%15 = load i8*, i8** %5
%16 = getelementptr inbounds i8, i8* %15, i64 0
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 35
br i1 %19, label %20, label %21
20: ; preds = %14
store i32 0, i32* %4
br label %48
21: ; preds = %14
%22 = load i32, i32* %7
%23 = icmp ne i32 %22, 0
br i1 %23, label %32, label %24
24: ; preds = %21
%25 = load i8*, i8** %5
%26 = load i8*, i8** %6
%27 = getelementptr inbounds i8, i8* %26, i64 2
%28 = call i32 @memcmp(i8* %25, i8* %27, i32 4)
%29 = icmp ne i32 %28, 0
%30 = xor i1 %29, true
%31 = zext i1 %30 to i32
store i32 %31, i32* %4
br label %48
32: ; preds = %21
%33 = load i8*, i8** %5
%34 = getelementptr inbounds i8, i8* %33, i64 0
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp ne i32 %36, 67
br i1 %37, label %38, label %39
38: ; preds = %32
store i32 0, i32* %4
br label %48
39: ; preds = %32
%40 = load i8*, i8** %5
%41 = getelementptr inbounds i8, i8* %40, i64 2
%42 = load i8*, i8** %6
%43 = getelementptr inbounds i8, i8* %42, i64 2
%44 = call i32 @memcmp(i8* %41, i8* %43, i32 2)
%45 = icmp ne i32 %44, 0
%46 = xor i1 %45, true
%47 = zext i1 %46 to i32
store i32 %47, i32* %4
br label %48
48: ; preds = %39, %38, %24, %20, %13
%49 = load i32, i32* %4
ret i32 %49
}

LLVM IR (-O2):
define i32 @is_top_level_match(i8* %0, i8* %1, i32 %2) {
%4 = load i8, i8* %0
switch i8 %4, label %5 [
i8 9, label %18
i8 35, label %18
]
5: ; preds = %3
%6 = icmp eq i32 %2, 0
br i1 %6, label %7, label %11
7: ; preds = %5
%8 = getelementptr inbounds i8, i8* %1, i64 2
%9 = tail call i32 @memcmp(i8* %0, i8* %8, i32 4)
%10 = icmp eq i32 %9, 0
br label %18
11: ; preds = %5
%12 = icmp eq i8 %4, 67
br i1 %12, label %13, label %18
13: ; preds = %11
%14 = getelementptr inbounds i8, i8* %0, i64 2
%15 = getelementptr inbounds i8, i8* %1, i64 2
%16 = tail call i32 @memcmp(i8* %14, i8* %15, i32 2)
%17 = icmp eq i32 %16, 0
br label %18
18: ; preds = %11, %3, %3, %13, %7
%19 = phi i1 [ %17, %13 ], [ %10, %7 ], [ false, %3 ], [ false, %3 ], [ false, %11 ]
%20 = zext i1 %19 to i32
ret i32 %20
}