#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 */
struct udev {
  int dummy;
};

/* Variables and functions */
int strlen(char *);
int /*<<< orphan*/ *strstr(char const *, char const *);
bool devices_delay_end(struct udev *udev, const char *syspath) {
  static const char *delay_device_list[] = {"/block/md", "/block/dm-", NULL};
  int i;
  for (i = 0; delay_device_list[i] != NULL; i++) {
    if (strstr(syspath + strlen("/sys"), delay_device_list[i]) != NULL)
      return true;
  }
  return false;
}


x86 assembly (clang, -O0):
<devices_delay_end>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movslq -0x1c(%rbp),%rcx
lea    0x2efe(%rip),%rax
cmpq   $0x0,(%rax,%rcx,8)
je     11a7 <devices_delay_end+0x87>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    0xeb9(%rip),%rdi
call   1030 <strlen@plt>
mov    -0x28(%rbp),%rdi
cltq
add    %rax,%rdi
movslq -0x1c(%rbp),%rcx
lea    0x2ecb(%rip),%rax
mov    (%rax,%rcx,8),%rsi
call   1040 <strstr@plt>
cmp    $0x0,%rax
je     1194 <devices_delay_end+0x74>
movl   $0x1,-0x4(%rbp)
jmp    11ae <devices_delay_end+0x8e>
jmp    1199 <devices_delay_end+0x79>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1137 <devices_delay_end+0x17>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<devices_delay_end>:
push   %rbx
mov    %rsi,%rbx
lea    0xeea(%rip),%rdi
call   1030 <strlen@plt>
movslq %eax,%rdi
add    %rbx,%rdi
lea    0xec3(%rip),%rsi
call   1040 <strstr@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     1151 <devices_delay_end+0x31>
pop    %rbx
ret
lea    0xebd(%rip),%rdi
call   1030 <strlen@plt>
cltq
add    %rax,%rbx
lea    0xea1(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strstr@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rbx
ret

LLVM IR (-O0):
%struct.udev = type { i32 }
@devices_delay_end.delay_device_list = internal global [3 x i8*] [i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i32 0, i32 0), i8* null]
@.str = [10 x i8] c"/block/md\00"
@.str.1 = [11 x i8] c"/block/dm-\00"
@.str.2 = [5 x i8] c"/sys\00"
define i32 @devices_delay_end(%struct.udev* %0, i8* %1) {
%3 = alloca i32
%4 = alloca %struct.udev*
%5 = alloca i8*
%6 = alloca i32
store %struct.udev* %0, %struct.udev** %4
store i8* %1, i8** %5
store i32 0, i32* %6
br label %7
7: ; preds = %26, %2
%8 = load i32, i32* %6
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [3 x i8*], [3 x i8*]* @devices_delay_end.delay_device_list, i64 0, i64 %9
%11 = load i8*, i8** %10
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %29
13: ; preds = %7
%14 = load i8*, i8** %5
%15 = call i32 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
%18 = load i32, i32* %6
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [3 x i8*], [3 x i8*]* @devices_delay_end.delay_device_list, i64 0, i64 %19
%21 = load i8*, i8** %20
%22 = call i32* @strstr(i8* %17, i8* %21)
%23 = icmp ne i32* %22, null
br i1 %23, label %24, label %25
24: ; preds = %13
store i32 1, i32* %3
br label %30
25: ; preds = %13
br label %26
26: ; preds = %25
%27 = load i32, i32* %6
%28 = add nsw i32 %27, 1
store i32 %28, i32* %6
br label %7
29: ; preds = %7
store i32 0, i32* %3
br label %30
30: ; preds = %29, %24
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
%struct.udev = type { i32 }
@.str = [10 x i8] c"/block/md\00"
@.str.1 = [11 x i8] c"/block/dm-\00"
@.str.2 = [5 x i8] c"/sys\00"
define i32 @devices_delay_end(%struct.udev* nocapture readnone %0, i8* %1) {
%3 = tail call i32 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %1, i64 %4
%6 = tail call i32* @strstr(i8* dereferenceable(1) %5, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %15
8: ; preds = %2
%9 = tail call i32 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %1, i64 %10
%12 = tail call i32* @strstr(i8* dereferenceable(1) %11, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp ne i32* %12, null
%14 = zext i1 %13 to i32
br label %15
15: ; preds = %8, %2
%16 = phi i32 [ 1, %2 ], [ %14, %8 ]
ret i32 %16
}