#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*/ strlen(char const *);
int /*<<< orphan*/ strncmp(char const *, char const *, int /*<<< orphan*/);
int is_ignored_device(const char *devname) {
  static const char *ignored_devices[] = {"/dev/ram", "/dev/loop", NULL};
  const char **dev;
  for (dev = ignored_devices; *dev; dev++)
    if (!strncmp(devname, *dev, strlen(*dev)))
      return 1;
  return 0;
}


x86 assembly (clang, -O0):
<is_ignored_device>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
lea    0x2f0d(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
je     119e <is_ignored_device+0x7e>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
call   1040 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1188 <is_ignored_device+0x68>
movl   $0x1,-0x4(%rbp)
jmp    11a5 <is_ignored_device+0x85>
jmp    118d <is_ignored_device+0x6d>
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x18(%rbp)
jmp    1137 <is_ignored_device+0x17>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_ignored_device>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xed2(%rip),%r14
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     116e <is_ignored_device+0x4e>
lea    0xebb(%rip),%r14
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
sete   %al
jmp    1173 <is_ignored_device+0x53>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@is_ignored_device.ignored_devices = internal global [3 x i8*] [i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i32 0, i32 0), i8* null]
@.str = [9 x i8] c"/dev/ram\00"
@.str.1 = [10 x i8] c"/dev/loop\00"
define i32 @is_ignored_device(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8**
store i8* %0, i8** %3
store i8** getelementptr inbounds ([3 x i8*], [3 x i8*]* @is_ignored_device.ignored_devices, i64 0, i64 0), i8*** %4
br label %5
5: ; preds = %20, %1
%6 = load i8**, i8*** %4
%7 = load i8*, i8** %6
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %23
9: ; preds = %5
%10 = load i8*, i8** %3
%11 = load i8**, i8*** %4
%12 = load i8*, i8** %11
%13 = load i8**, i8*** %4
%14 = load i8*, i8** %13
%15 = call i32 @strlen(i8* %14)
%16 = call i32 @strncmp(i8* %10, i8* %12, i32 %15)
%17 = icmp ne i32 %16, 0
br i1 %17, label %19, label %18
18: ; preds = %9
store i32 1, i32* %2
br label %24
19: ; preds = %9
br label %20
20: ; preds = %19
%21 = load i8**, i8*** %4
%22 = getelementptr inbounds i8*, i8** %21, i32 1
store i8** %22, i8*** %4
br label %5
23: ; preds = %5
store i32 0, i32* %2
br label %24
24: ; preds = %23, %18
%25 = load i32, i32* %2
ret i32 %25
}

LLVM IR (-O2):
@.str = [9 x i8] c"/dev/ram\00"
@.str.1 = [10 x i8] c"/dev/loop\00"
define i32 @is_ignored_device(i8* %0) {
%2 = tail call i32 @strlen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = icmp eq i32 %3, 0
br i1 %4, label %10, label %5
5: ; preds = %1
%6 = tail call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = icmp eq i32 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %5, %1
%11 = phi i32 [ 1, %1 ], [ %9, %5 ]
ret i32 %11
}