#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 dirent {
  char *d_name;
};
typedef scalar_t__ dev_t;
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int PATH_MAX;
int /*<<< orphan*/ closedir(int /*<<< orphan*/ *);
int /*<<< orphan*/ error_reason(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ free(char *);
scalar_t__ makedev(int, int);
scalar_t__ misc_read_special_file(char *, char **, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ *opendir(char *);
struct dirent *readdir(int /*<<< orphan*/ *);
int /*<<< orphan*/ snprintf(char *, int, char *, char const *, int, ...);
int sscanf(char *, char *, int *, int *);
int /*<<< orphan*/ stderr;
scalar_t__ strncmp(char *, char *, int);
int disk_check_subchannel_set(int devno, dev_t device, char *dev_name) {
  struct dirent *direntp;
  DIR *fdd;
  static const char sys_bus_ccw_dev_filename[] = "/sys/bus/ccw/devices";
  char dev_file[PATH_MAX];
  char *buffer;
  int minor, major;
  snprintf(dev_file, PATH_MAX, "%s/0.0.%04x", sys_bus_ccw_dev_filename, devno);
  fdd = opendir(dev_file);
  if (!fdd)
    goto out_with_warning;
  while ((direntp = readdir(fdd)))
    if (strncmp(direntp->d_name, "block:", 6) == 0)
      break;
  if (direntp != NULL)
    snprintf(dev_file, PATH_MAX, "%s/0.0.%04x/%s/dev", sys_bus_ccw_dev_filename,
             devno, direntp->d_name);
  else {
    closedir(fdd);
    snprintf(dev_file, PATH_MAX, "%s/0.0.%04x/block", sys_bus_ccw_dev_filename,
             devno);
    fdd = opendir(dev_file);
    if (!fdd)
      goto out_with_warning;
    while ((direntp = readdir(fdd)))
      if (strncmp(direntp->d_name, "dasd", 4) == 0)
        break;
    if (direntp == NULL)
      goto out_with_warning;
    snprintf(dev_file, PATH_MAX, "%s/0.0.%04x/block/%s/dev",
             sys_bus_ccw_dev_filename, devno, direntp->d_name);
  }
  closedir(fdd);
  if (misc_read_special_file(dev_file, &buffer, NULL, 1))
    goto out_with_warning;
  if (sscanf(buffer, "%i:%i", &major, &minor) != 2) {
    free(buffer);
    goto out_with_warning;
  }
  free(buffer);
  if (makedev(major, minor) != device) {
    error_reason("Dump target '%s' must belong to "
                 "subchannel set 0.",
                 dev_name);
    return -1;
  }
  return 0;
out_with_warning:
  fprintf(stderr,
          "Warning: Could not determine whether dump target %s "
          "belongs to subchannel set 0.\n",
          dev_name);
  return 0;
}


x86 assembly (clang, -O0):
<disk_check_subchannel_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2e26(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x58(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x38(%rbp)
mov    0x2dfa(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%r8d
lea    0xe12(%rip),%rdx
lea    0xdf6(%rip),%rcx
mov    $0x0,%al
call   1080 <snprintf@plt>
mov    -0x58(%rbp),%rdi
call   1060 <opendir@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    122e <disk_check_subchannel_set+0x7e>
jmp    1435 <disk_check_subchannel_set+0x285>
jmp    1233 <disk_check_subchannel_set+0x83>
mov    -0x28(%rbp),%rdi
call   10b0 <readdir@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     1276 <disk_check_subchannel_set+0xc6>
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
lea    0xdc9(%rip),%rsi
mov    $0x6,%edx
call   1050 <strncmp@plt>
cmp    $0x0,%rax
jne    1271 <disk_check_subchannel_set+0xc1>
jmp    1276 <disk_check_subchannel_set+0xc6>
jmp    1233 <disk_check_subchannel_set+0x83>
cmpq   $0x0,-0x20(%rbp)
je     12b3 <disk_check_subchannel_set+0x103>
mov    -0x58(%rbp),%rdi
mov    0x2d64(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%r8d
mov    -0x20(%rbp),%rax
mov    (%rax),%r9
lea    0xd88(%rip),%rdx
lea    0xd59(%rip),%rcx
mov    $0x0,%al
call   1080 <snprintf@plt>
jmp    1384 <disk_check_subchannel_set+0x1d4>
mov    -0x28(%rbp),%rdi
call   1090 <closedir@plt>
mov    -0x58(%rbp),%rdi
mov    0x2d29(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%r8d
lea    0xd67(%rip),%rdx
lea    0xd25(%rip),%rcx
mov    $0x0,%al
call   1080 <snprintf@plt>
mov    -0x58(%rbp),%rdi
call   1060 <opendir@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    12ff <disk_check_subchannel_set+0x14f>
jmp    1435 <disk_check_subchannel_set+0x285>
jmp    1304 <disk_check_subchannel_set+0x154>
mov    -0x28(%rbp),%rdi
call   10b0 <readdir@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     1347 <disk_check_subchannel_set+0x197>
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
lea    0xd24(%rip),%rsi
mov    $0x4,%edx
call   1050 <strncmp@plt>
cmp    $0x0,%rax
jne    1342 <disk_check_subchannel_set+0x192>
jmp    1347 <disk_check_subchannel_set+0x197>
jmp    1304 <disk_check_subchannel_set+0x154>
cmpq   $0x0,-0x20(%rbp)
jne    1357 <disk_check_subchannel_set+0x1a7>
jmp    1435 <disk_check_subchannel_set+0x285>
mov    -0x58(%rbp),%rdi
mov    0x2c8e(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%r8d
mov    -0x20(%rbp),%rax
mov    (%rax),%r9
lea    0xcdc(%rip),%rdx
lea    0xc83(%rip),%rcx
mov    $0x0,%al
call   1080 <snprintf@plt>
mov    -0x28(%rbp),%rdi
call   1090 <closedir@plt>
mov    -0x58(%rbp),%rdi
lea    -0x40(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
mov    $0x1,%ecx
call   1070 <misc_read_special_file@plt>
cmp    $0x0,%rax
je     13b2 <disk_check_subchannel_set+0x202>
jmp    1435 <disk_check_subchannel_set+0x285>
mov    -0x40(%rbp),%rdi
lea    0xcae(%rip),%rsi
lea    -0x48(%rbp),%rdx
lea    -0x44(%rbp),%rcx
call   10c0 <sscanf@plt>
cmp    $0x2,%eax
je     13e1 <disk_check_subchannel_set+0x231>
mov    -0x40(%rbp),%rdi
call   1040 <free@plt>
jmp    1435 <disk_check_subchannel_set+0x285>
mov    -0x40(%rbp),%rdi
call   1040 <free@plt>
mov    -0x48(%rbp),%edi
mov    -0x44(%rbp),%esi
call   10d0 <makedev@plt>
cmp    -0x10(%rbp),%rax
je     1422 <disk_check_subchannel_set+0x272>
mov    -0x18(%rbp),%rsi
lea    0xc67(%rip),%rdi
call   1030 <error_reason@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x4c(%rbp)
jmp    145c <disk_check_subchannel_set+0x2ac>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x4c(%rbp)
jmp    145c <disk_check_subchannel_set+0x2ac>
mov    0x2b9c(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xc5a(%rip),%rsi
call   10a0 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x4c(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<disk_check_subchannel_set>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rdx,-0x38(%rbp)
mov    %rsi,-0x48(%rbp)
mov    %edi,%r13d
mov    0x2e1d(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rbx
mov    %rsi,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
lea    0xe25(%rip),%rdx
lea    0xe09(%rip),%rcx
mov    %rbx,%rdi
mov    %r13d,%r8d
xor    %eax,%eax
call   1080 <snprintf@plt>
mov    %rbx,%rdi
call   1060 <opendir@plt>
test   %rax,%rax
je     1363 <disk_check_subchannel_set+0x1b3>
mov    %rax,%r14
lea    0xe02(%rip),%r15
nop
mov    %r14,%rdi
call   10b0 <readdir@plt>
test   %rax,%rax
je     1251 <disk_check_subchannel_set+0xa1>
mov    %rax,%r12
mov    (%rax),%rdi
mov    %r15,%rsi
mov    $0x6,%edx
call   1050 <strncmp@plt>
test   %rax,%rax
jne    1220 <disk_check_subchannel_set+0x70>
lea    0xddc(%rip),%rdx
jmp    12d0 <disk_check_subchannel_set+0x120>
mov    %r14,%rdi
call   1090 <closedir@plt>
mov    0x2d90(%rip),%rax
mov    (%rax),%esi
lea    0xdd2(%rip),%rdx
lea    0xd90(%rip),%rcx
mov    %rbx,%rdi
mov    %r13d,%r8d
xor    %eax,%eax
call   1080 <snprintf@plt>
mov    %rbx,%rdi
call   1060 <opendir@plt>
test   %rax,%rax
je     1363 <disk_check_subchannel_set+0x1b3>
mov    %rax,%r14
lea    0xdb5(%rip),%r15
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   10b0 <readdir@plt>
test   %rax,%rax
je     1363 <disk_check_subchannel_set+0x1b3>
mov    %rax,%r12
mov    (%rax),%rdi
mov    %r15,%rsi
mov    $0x4,%edx
call   1050 <strncmp@plt>
test   %rax,%rax
jne    12a0 <disk_check_subchannel_set+0xf0>
lea    0xd82(%rip),%rdx
mov    0x2d19(%rip),%rax
mov    (%rax),%esi
mov    (%r12),%r9
lea    0xd1c(%rip),%rcx
mov    %rbx,%rdi
mov    %r13d,%r8d
xor    %eax,%eax
call   1080 <snprintf@plt>
mov    %r14,%rdi
call   1090 <closedir@plt>
lea    -0x40(%rbp),%rsi
mov    %rbx,%rdi
xor    %edx,%edx
mov    $0x1,%ecx
call   1070 <misc_read_special_file@plt>
test   %rax,%rax
jne    1363 <disk_check_subchannel_set+0x1b3>
mov    -0x40(%rbp),%rdi
lea    0xd4f(%rip),%rsi
lea    -0x2c(%rbp),%rdx
lea    -0x30(%rbp),%rcx
call   10c0 <sscanf@plt>
mov    %eax,%ebx
mov    -0x40(%rbp),%rdi
call   1040 <free@plt>
cmp    $0x2,%ebx
jne    1363 <disk_check_subchannel_set+0x1b3>
mov    -0x2c(%rbp),%edi
mov    -0x30(%rbp),%esi
call   10d0 <makedev@plt>
xor    %ecx,%ecx
cmp    -0x48(%rbp),%rax
je     137e <disk_check_subchannel_set+0x1ce>
lea    0xd1e(%rip),%rdi
mov    -0x38(%rbp),%rsi
call   1030 <error_reason@plt>
mov    $0xffffffff,%ecx
jmp    137e <disk_check_subchannel_set+0x1ce>
mov    0x2c6e(%rip),%rax
mov    (%rax),%edi
lea    0xd30(%rip),%rsi
mov    -0x38(%rbp),%rdx
call   10a0 <fprintf@plt>
xor    %ecx,%ecx
mov    %ecx,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.dirent = type { i8* }
@disk_check_subchannel_set.sys_bus_ccw_dev_filename = internal constant [21 x i8] c"/sys/bus/ccw/devices\00"
@PATH_MAX = global i32 0
@.str = [12 x i8] c"%s/0.0.%04x\00"
@.str.1 = [7 x i8] c"block:\00"
@.str.2 = [19 x i8] c"%s/0.0.%04x/%s/dev\00"
@.str.3 = [18 x i8] c"%s/0.0.%04x/block\00"
@.str.4 = [5 x i8] c"dasd\00"
@.str.5 = [25 x i8] c"%s/0.0.%04x/block/%s/dev\00"
@.str.6 = [6 x i8] c"%i:%i\00"
@.str.7 = [50 x i8] c"Dump target '%s' must belong to subchannel set 0.\00"
@stderr = global i32 0
@.str.8 = [82 x i8] c"Warning: Could not determine whether dump target %s belongs to subchannel set 0.\0A\00"
define i32 @disk_check_subchannel_set(i32 %0, i64 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i64
%7 = alloca i8*
%8 = alloca %struct.dirent*
%9 = alloca i32*
%10 = alloca i8*
%11 = alloca i64
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store i32 %0, i32* %5
store i64 %1, i64* %6
store i8* %2, i8** %7
%16 = load i32, i32* @PATH_MAX
%17 = zext i32 %16 to i64
%18 = call i8* @llvm.stacksave()
store i8* %18, i8** %10
%19 = alloca i8, i64 %17
store i64 %17, i64* %11
%20 = load i32, i32* @PATH_MAX
%21 = load i32, i32* %5
%22 = call i32 (i8*, i32, i8*, i8*, i32, ...) @snprintf(i8* %19, i32 %20, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @disk_check_subchannel_set.sys_bus_ccw_dev_filename, i64 0, i64 0), i32 %21)
%23 = call i32* @opendir(i8* %19)
store i32* %23, i32** %9
%24 = load i32*, i32** %9
%25 = icmp ne i32* %24, null
br i1 %25, label %27, label %26
26: ; preds = %3
br label %109
27: ; preds = %3
br label %28
28: ; preds = %39, %27
%29 = load i32*, i32** %9
%30 = call %struct.dirent* @readdir(i32* %29)
store %struct.dirent* %30, %struct.dirent** %8
%31 = icmp ne %struct.dirent* %30, null
br i1 %31, label %32, label %40
32: ; preds = %28
%33 = load %struct.dirent*, %struct.dirent** %8
%34 = getelementptr inbounds %struct.dirent, %struct.dirent* %33, i32 0, i32 0
%35 = load i8*, i8** %34
%36 = call i64 @strncmp(i8* %35, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 6)
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %39
38: ; preds = %32
br label %40
39: ; preds = %32
br label %28
40: ; preds = %38, %28
%41 = load %struct.dirent*, %struct.dirent** %8
%42 = icmp ne %struct.dirent* %41, null
br i1 %42, label %43, label %50
43: ; preds = %40
%44 = load i32, i32* @PATH_MAX
%45 = load i32, i32* %5
%46 = load %struct.dirent*, %struct.dirent** %8
%47 = getelementptr inbounds %struct.dirent, %struct.dirent* %46, i32 0, i32 0
%48 = load i8*, i8** %47
%49 = call i32 (i8*, i32, i8*, i8*, i32, ...) @snprintf(i8* %19, i32 %44, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @disk_check_subchannel_set.sys_bus_ccw_dev_filename, i64 0, i64 0), i32 %45, i8* %48)
br label %84
50: ; preds = %40
%51 = load i32*, i32** %9
%52 = call i32 @closedir(i32* %51)
%53 = load i32, i32* @PATH_MAX
%54 = load i32, i32* %5
%55 = call i32 (i8*, i32, i8*, i8*, i32, ...) @snprintf(i8* %19, i32 %53, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @disk_check_subchannel_set.sys_bus_ccw_dev_filename, i64 0, i64 0), i32 %54)
%56 = call i32* @opendir(i8* %19)
store i32* %56, i32** %9
%57 = load i32*, i32** %9
%58 = icmp ne i32* %57, null
br i1 %58, label %60, label %59
59: ; preds = %50
br label %109
60: ; preds = %50
br label %61
61: ; preds = %72, %60
%62 = load i32*, i32** %9
%63 = call %struct.dirent* @readdir(i32* %62)
store %struct.dirent* %63, %struct.dirent** %8
%64 = icmp ne %struct.dirent* %63, null
br i1 %64, label %65, label %73
65: ; preds = %61
%66 = load %struct.dirent*, %struct.dirent** %8
%67 = getelementptr inbounds %struct.dirent, %struct.dirent* %66, i32 0, i32 0
%68 = load i8*, i8** %67
%69 = call i64 @strncmp(i8* %68, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 4)
%70 = icmp eq i64 %69, 0
br i1 %70, label %71, label %72
71: ; preds = %65
br label %73
72: ; preds = %65
br label %61
73: ; preds = %71, %61
%74 = load %struct.dirent*, %struct.dirent** %8
%75 = icmp eq %struct.dirent* %74, null
br i1 %75, label %76, label %77
76: ; preds = %73
br label %109
77: ; preds = %73
%78 = load i32, i32* @PATH_MAX
%79 = load i32, i32* %5
%80 = load %struct.dirent*, %struct.dirent** %8
%81 = getelementptr inbounds %struct.dirent, %struct.dirent* %80, i32 0, i32 0
%82 = load i8*, i8** %81
%83 = call i32 (i8*, i32, i8*, i8*, i32, ...) @snprintf(i8* %19, i32 %78, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @disk_check_subchannel_set.sys_bus_ccw_dev_filename, i64 0, i64 0), i32 %79, i8* %82)
br label %84
84: ; preds = %77, %43
%85 = load i32*, i32** %9
%86 = call i32 @closedir(i32* %85)
%87 = call i64 @misc_read_special_file(i8* %19, i8** %12, i32* null, i32 1)
%88 = icmp ne i64 %87, 0
br i1 %88, label %89, label %90
89: ; preds = %84
br label %109
90: ; preds = %84
%91 = load i8*, i8** %12
%92 = call i32 @sscanf(i8* %91, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32* %14, i32* %13)
%93 = icmp ne i32 %92, 2
br i1 %93, label %94, label %97
94: ; preds = %90
%95 = load i8*, i8** %12
%96 = call i32 @free(i8* %95)
br label %109
97: ; preds = %90
%98 = load i8*, i8** %12
%99 = call i32 @free(i8* %98)
%100 = load i32, i32* %14
%101 = load i32, i32* %13
%102 = call i64 @makedev(i32 %100, i32 %101)
%103 = load i64, i64* %6
%104 = icmp ne i64 %102, %103
br i1 %104, label %105, label %108
105: ; preds = %97
%106 = load i8*, i8** %7
%107 = call i32 @error_reason(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.7, i64 0, i64 0), i8* %106)
store i32 -1, i32* %4
store i32 1, i32* %15
br label %113
108: ; preds = %97
store i32 0, i32* %4
store i32 1, i32* %15
br label %113
109: ; preds = %94, %89, %76, %59, %26
%110 = load i32, i32* @stderr
%111 = load i8*, i8** %7
%112 = call i32 @fprintf(i32 %110, i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str.8, i64 0, i64 0), i8* %111)
store i32 0, i32* %4
store i32 1, i32* %15
br label %113
113: ; preds = %109, %108, %105
%114 = load i8*, i8** %10
%115 = load i32, i32* %4
ret i32 %115
}

LLVM IR (-O2):
%struct.dirent = type { i8* }
@disk_check_subchannel_set.sys_bus_ccw_dev_filename = internal constant [21 x i8] c"/sys/bus/ccw/devices\00"
@PATH_MAX = global i32 0
@.str = [12 x i8] c"%s/0.0.%04x\00"
@.str.1 = [7 x i8] c"block:\00"
@.str.2 = [19 x i8] c"%s/0.0.%04x/%s/dev\00"
@.str.3 = [18 x i8] c"%s/0.0.%04x/block\00"
@.str.4 = [5 x i8] c"dasd\00"
@.str.5 = [25 x i8] c"%s/0.0.%04x/block/%s/dev\00"
@.str.6 = [6 x i8] c"%i:%i\00"
@.str.7 = [50 x i8] c"Dump target '%s' must belong to subchannel set 0.\00"
@stderr = global i32 0
@.str.8 = [82 x i8] c"Warning: Could not determine whether dump target %s belongs to subchannel set 0.\0A\00"
define i32 @disk_check_subchannel_set(i32 %0, i64 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = load i32, i32* @PATH_MAX
%8 = zext i32 %7 to i64
%9 = alloca i8, i64 %8
%10 = bitcast i8** %4 to i8*
%11 = bitcast i32* %5 to i8*
%12 = bitcast i32* %6 to i8*
%13 = call i32 (i8*, i32, i8*, i8*, i32, ...) @snprintf(i8* %9, i32 %7, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @disk_check_subchannel_set.sys_bus_ccw_dev_filename, i64 0, i64 0), i32 %0)
%14 = call i32* @opendir(i8* %9)
%15 = icmp eq i32* %14, null
br i1 %15, label %62, label %16
16: ; preds = %3, %19
%17 = call %struct.dirent* @readdir(i32* %14)
%18 = icmp eq %struct.dirent* %17, null
br i1 %18, label %24, label %19
19: ; preds = %16
%20 = getelementptr inbounds %struct.dirent, %struct.dirent* %17, i64 0, i32 0
%21 = load i8*, i8** %20
%22 = call i64 @strncmp(i8* %21, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 6)
%23 = icmp eq i64 %22, 0
br i1 %23, label %38, label %16
24: ; preds = %16
%25 = call i32 @closedir(i32* %14)
%26 = load i32, i32* @PATH_MAX
%27 = call i32 (i8*, i32, i8*, i8*, i32, ...) @snprintf(i8* %9, i32 %26, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @disk_check_subchannel_set.sys_bus_ccw_dev_filename, i64 0, i64 0), i32 %0)
%28 = call i32* @opendir(i8* %9)
%29 = icmp eq i32* %28, null
br i1 %29, label %62, label %30
30: ; preds = %24, %33
%31 = call %struct.dirent* @readdir(i32* %28)
%32 = icmp eq %struct.dirent* %31, null
br i1 %32, label %62, label %33
33: ; preds = %30
%34 = getelementptr inbounds %struct.dirent, %struct.dirent* %31, i64 0, i32 0
%35 = load i8*, i8** %34
%36 = call i64 @strncmp(i8* %35, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 4)
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %30
38: ; preds = %19, %33
%39 = phi %struct.dirent* [ %31, %33 ], [ %17, %19 ]
%40 = phi i8* [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), %33 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), %19 ]
%41 = phi i32* [ %28, %33 ], [ %14, %19 ]
%42 = getelementptr inbounds %struct.dirent, %struct.dirent* %39, i64 0, i32 0
%43 = load i32, i32* @PATH_MAX
%44 = load i8*, i8** %42
%45 = call i32 (i8*, i32, i8*, i8*, i32, ...) @snprintf(i8* %9, i32 %43, i8* %40, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @disk_check_subchannel_set.sys_bus_ccw_dev_filename, i64 0, i64 0), i32 %0, i8* %44)
%46 = call i32 @closedir(i32* %41)
%47 = call i64 @misc_read_special_file(i8* %9, i8** %4, i32* null, i32 1)
%48 = icmp eq i64 %47, 0
br i1 %48, label %49, label %62
49: ; preds = %38
%50 = load i8*, i8** %4
%51 = call i32 @sscanf(i8* %50, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i32* %6, i32* %5)
%52 = icmp eq i32 %51, 2
%53 = load i8*, i8** %4
%54 = call i32 @free(i8* %53)
br i1 %52, label %55, label %62
55: ; preds = %49
%56 = load i32, i32* %6
%57 = load i32, i32* %5
%58 = call i64 @makedev(i32 %56, i32 %57)
%59 = icmp eq i64 %58, %1
br i1 %59, label %65, label %60
60: ; preds = %55
%61 = call i32 @error_reason(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.7, i64 0, i64 0), i8* %2)
br label %65
62: ; preds = %30, %49, %38, %24, %3
%63 = load i32, i32* @stderr
%64 = call i32 @fprintf(i32 %63, i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str.8, i64 0, i64 0), i8* %2)
br label %65
65: ; preds = %55, %62, %60
%66 = phi i32 [ 0, %62 ], [ -1, %60 ], [ 0, %55 ]
ret i32 %66
}