#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 */
size_t strlen(int /*<<< orphan*/);
int /*<<< orphan*/ *strstr(char const *, char const *);
int /*<<< orphan*/ udev_get_sys_path(struct udev *);
int /*<<< orphan*/ udev_log_null(struct udev *, char *, char const *);
bool devices_delay_end(struct udev *udev, const char *syspath) {
  static const char *delay_device_list[] = {"/block/md", "/block/dm-", NULL};
  size_t len;
  int i;
  len = strlen(udev_get_sys_path(udev));
  for (i = 0; delay_device_list[i] != NULL; i++) {
    if (strstr(&syspath[len], delay_device_list[i]) != NULL) {
      udev_log_null(udev, "delaying: %s\n", syspath);
      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)
mov    -0x10(%rbp),%rdi
call   1030 <udev_get_sys_path@plt>
mov    %eax,%edi
call   1050 <strlen@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movslq -0x24(%rbp),%rcx
lea    0x2eda(%rip),%rax
cmpq   $0x0,(%rax,%rcx,8)
je     11da <devices_delay_end+0x9a>
mov    -0x18(%rbp),%rdi
add    -0x20(%rbp),%rdi
movslq -0x24(%rbp),%rcx
lea    0x2ebc(%rip),%rax
mov    (%rax,%rcx,8),%rsi
call   1060 <strstr@plt>
cmp    $0x0,%rax
je     11c7 <devices_delay_end+0x87>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xe5f(%rip),%rsi
call   1040 <udev_log_null@plt>
movl   $0x1,-0x4(%rbp)
jmp    11e1 <devices_delay_end+0xa1>
jmp    11cc <devices_delay_end+0x8c>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    116b <devices_delay_end+0x2b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<devices_delay_end>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
call   1030 <udev_get_sys_path@plt>
mov    %eax,%edi
call   1050 <strlen@plt>
mov    %rax,%rbx
add    %r14,%rbx
lea    0xe9c(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strstr@plt>
test   %rax,%rax
jne    1185 <devices_delay_end+0x45>
lea    0xe92(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strstr@plt>
test   %rax,%rax
je     11a2 <devices_delay_end+0x62>
lea    0xe89(%rip),%rsi
mov    %r15,%rdi
mov    %r14,%rdx
call   1040 <udev_log_null@plt>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %r15
ret
xor    %eax,%eax
jmp    119c <devices_delay_end+0x5c>

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 = [14 x i8] c"delaying: %s\0A\00"
define i32 @devices_delay_end(%struct.udev* %0, i8* %1) {
%3 = alloca i32
%4 = alloca %struct.udev*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
store %struct.udev* %0, %struct.udev** %4
store i8* %1, i8** %5
%8 = load %struct.udev*, %struct.udev** %4
%9 = call i32 @udev_get_sys_path(%struct.udev* %8)
%10 = call i64 @strlen(i32 %9)
store i64 %10, i64* %6
store i32 0, i32* %7
br label %11
11: ; preds = %32, %2
%12 = load i32, i32* %7
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [3 x i8*], [3 x i8*]* @devices_delay_end.delay_device_list, i64 0, i64 %13
%15 = load i8*, i8** %14
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %35
17: ; preds = %11
%18 = load i8*, i8** %5
%19 = load i64, i64* %6
%20 = getelementptr inbounds i8, i8* %18, i64 %19
%21 = load i32, i32* %7
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [3 x i8*], [3 x i8*]* @devices_delay_end.delay_device_list, i64 0, i64 %22
%24 = load i8*, i8** %23
%25 = call i32* @strstr(i8* %20, i8* %24)
%26 = icmp ne i32* %25, null
br i1 %26, label %27, label %31
27: ; preds = %17
%28 = load %struct.udev*, %struct.udev** %4
%29 = load i8*, i8** %5
%30 = call i32 @udev_log_null(%struct.udev* %28, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %29)
store i32 1, i32* %3
br label %36
31: ; preds = %17
br label %32
32: ; preds = %31
%33 = load i32, i32* %7
%34 = add nsw i32 %33, 1
store i32 %34, i32* %7
br label %11
35: ; preds = %11
store i32 0, i32* %3
br label %36
36: ; preds = %35, %27
%37 = load i32, i32* %3
ret i32 %37
}

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 = [14 x i8] c"delaying: %s\0A\00"
define i32 @devices_delay_end(%struct.udev* %0, i8* %1) {
%3 = tail call i32 @udev_get_sys_path(%struct.udev* %0)
%4 = tail call i64 @strlen(i32 %3)
%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 %11
8: ; preds = %2
%9 = tail call i32* @strstr(i8* dereferenceable(1) %5, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i32* %9, null
br i1 %10, label %13, label %11
11: ; preds = %8, %2
%12 = tail call i32 @udev_log_null(%struct.udev* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* %1)
br label %13
13: ; preds = %8, %11
%14 = phi i32 [ 1, %11 ], [ 0, %8 ]
ret i32 %14
}