#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;
  scalar_t__ d_type;
};
typedef size_t ssize_t;
typedef int /*<<< orphan*/ dev_t;
typedef int /*<<< orphan*/ FILE;
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
scalar_t__ DT_DIR;
scalar_t__ DT_UNKNOWN;
int /*<<< orphan*/ closedir(int /*<<< orphan*/ *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
size_t fread(char *, int, int, int /*<<< orphan*/ *);
unsigned long major(int /*<<< orphan*/);
unsigned long minor(int /*<<< orphan*/);
int /*<<< orphan*/ *opendir(char *);
struct dirent *readdir(int /*<<< orphan*/ *);
char *strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
unsigned long strtoul(char *, char **, int);
int scansysdir(char *namebuf, char *sysdir, dev_t dev) {
  char *dirtailptr = strchr(sysdir, '\0');
  DIR *dir;
  int done = 0;
  struct dirent *de;
  char *systail;
  FILE *sysdev;
  unsigned long ma, mi;
  char *ep;
  ssize_t rd;
  if (!(dir = opendir(sysdir)))
    return 0;
  *dirtailptr++ = '/';
  while (!done && (de = readdir(dir))) {
    if (de->d_name[0] == '.')
      continue;
    if (de->d_type != DT_UNKNOWN && de->d_type != DT_DIR)
      continue;
    if (strlen(de->d_name) >= (512 - 64) - (dirtailptr - sysdir))
      continue;
    strcpy(dirtailptr, de->d_name);
    systail = strchr(sysdir, '\0');
    strcpy(systail, "/dev");
    if (!(sysdev = fopen(sysdir, "r")))
      continue;
    rd = fread(namebuf, 1, 512, sysdev);
    namebuf[rd] = '\0';
    fclose(sysdev);
    ma = strtoul(namebuf, &ep, 10);
    if (ma != major(dev) || *ep != ':')
      continue;
    mi = strtoul(ep + 1, &ep, 10);
    if (*ep != '\n')
      continue;
    if (mi == minor(dev)) {
      strcpy(namebuf, de->d_name);
      done = 1;
    } else {
      *systail = '\0';
      done = scansysdir(namebuf, sysdir, dev);
    }
  }
  closedir(dir);
  return done;
}


x86 assembly (clang, -O0):
<scansysdir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
call   1090 <strchr@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <opendir@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
jne    121f <scansysdir+0x4f>
movl   $0x0,-0x4(%rbp)
jmp    144f <scansysdir+0x27f>
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
movb   $0x2f,(%rax)
xor    %eax,%eax
cmpl   $0x0,-0x34(%rbp)
mov    %al,-0x71(%rbp)
jne    1257 <scansysdir+0x87>
mov    -0x30(%rbp),%rdi
call   10c0 <readdir@plt>
mov    %rax,-0x40(%rbp)
cmp    $0x0,%rax
setne  %al
mov    %al,-0x71(%rbp)
mov    -0x71(%rbp),%al
test   $0x1,%al
jne    1267 <scansysdir+0x97>
jmp    1440 <scansysdir+0x270>
mov    -0x40(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    127f <scansysdir+0xaf>
jmp    1231 <scansysdir+0x61>
mov    -0x40(%rbp),%rax
mov    0x8(%rax),%rax
mov    0x2d5a(%rip),%rcx
cmp    (%rcx),%rax
je     12b4 <scansysdir+0xe4>
mov    -0x40(%rbp),%rax
mov    0x8(%rax),%rax
mov    0x2d32(%rip),%rcx
cmp    (%rcx),%rax
je     12b4 <scansysdir+0xe4>
jmp    1231 <scansysdir+0x61>
mov    -0x40(%rbp),%rax
mov    (%rax),%rdi
call   1080 <strlen@plt>
cltq
mov    -0x28(%rbp),%rdx
mov    -0x18(%rbp),%rcx
sub    %rcx,%rdx
mov    $0x1c0,%ecx
sub    %rdx,%rcx
cmp    %rcx,%rax
jl     12e3 <scansysdir+0x113>
jmp    1231 <scansysdir+0x61>
mov    -0x28(%rbp),%rdi
mov    -0x40(%rbp),%rax
mov    (%rax),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
call   1090 <strchr@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
lea    0xcf3(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rdi
lea    0xce8(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x50(%rbp)
cmp    $0x0,%rax
jne    1335 <scansysdir+0x165>
jmp    1231 <scansysdir+0x61>
mov    -0x10(%rbp),%rdi
mov    -0x50(%rbp),%rcx
mov    $0x1,%esi
mov    $0x200,%edx
call   1040 <fread@plt>
mov    %rax,-0x70(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x70(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x50(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x10(%rbp),%rdi
lea    -0x68(%rbp),%rsi
mov    $0xa,%edx
call   10f0 <strtoul@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x1c(%rbp),%edi
call   10a0 <major@plt>
mov    %rax,%rcx
mov    -0x80(%rbp),%rax
cmp    %rcx,%rax
jne    13ab <scansysdir+0x1db>
mov    -0x68(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3a,%eax
je     13b0 <scansysdir+0x1e0>
jmp    1231 <scansysdir+0x61>
mov    -0x68(%rbp),%rdi
add    $0x1,%rdi
lea    -0x68(%rbp),%rsi
mov    $0xa,%edx
call   10f0 <strtoul@plt>
mov    %rax,-0x60(%rbp)
mov    -0x68(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
je     13df <scansysdir+0x20f>
jmp    1231 <scansysdir+0x61>
mov    -0x60(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x1c(%rbp),%edi
call   1070 <minor@plt>
mov    %rax,%rcx
mov    -0x88(%rbp),%rax
cmp    %rcx,%rax
jne    1421 <scansysdir+0x251>
mov    -0x10(%rbp),%rdi
mov    -0x40(%rbp),%rax
mov    (%rax),%rsi
call   1030 <strcpy@plt>
movl   $0x1,-0x34(%rbp)
jmp    143b <scansysdir+0x26b>
mov    -0x48(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   10d0 <scansysdir@plt>
mov    %eax,-0x34(%rbp)
jmp    1231 <scansysdir+0x61>
mov    -0x30(%rbp),%rdi
call   10b0 <closedir@plt>
mov    -0x34(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scansysdir>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %edx,%r15d
mov    %rsi,%r12
mov    %rdi,%rbp
mov    %rsi,%rdi
call   1080 <strlen@plt>
mov    %rax,%rbx
mov    %r12,%rdi
call   1060 <opendir@plt>
test   %rax,%rax
je     1394 <scansysdir+0x1d4>
mov    %rax,%r14
mov    %rbp,0x20(%rsp)
mov    %r15d,0x14(%rsp)
add    %r12,%rbx
movb   $0x2f,(%rbx)
add    $0x1,%rbx
mov    %r12,%rbp
sub    %rbx,%rbp
add    $0x1c0,%rbp
mov    %r12,0x18(%rsp)
mov    %rbx,0x8(%rsp)
mov    %rbp,(%rsp)
jmp    1249 <scansysdir+0x89>
mov    0x18(%rsp),%r12
mov    0x8(%rsp),%rbx
mov    (%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
nop
test   %r13d,%r13d
jne    139c <scansysdir+0x1dc>
mov    %r14,%rdi
call   10b0 <readdir@plt>
test   %rax,%rax
je     1399 <scansysdir+0x1d9>
mov    %rax,%r15
mov    (%rax),%rdi
xor    %r13d,%r13d
cmpb   $0x2e,(%rdi)
je     1240 <scansysdir+0x80>
mov    0x8(%r15),%rax
mov    0x2d75(%rip),%rcx
cmp    (%rcx),%rax
je     1284 <scansysdir+0xc4>
mov    0x2d59(%rip),%rcx
cmp    (%rcx),%rax
jne    1240 <scansysdir+0x80>
call   1080 <strlen@plt>
cltq
cmp    %rax,%rbp
jle    1240 <scansysdir+0x80>
mov    (%r15),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %r12,%rdi
call   1080 <strlen@plt>
mov    %rax,%rbx
add    %r12,%rbx
mov    %rbx,%rdi
lea    0xd4d(%rip),%rsi
call   1030 <strcpy@plt>
mov    %r12,%rdi
lea    0xd43(%rip),%rsi
call   10d0 <fopen@plt>
test   %rax,%rax
je     1227 <scansysdir+0x67>
mov    %rax,%r12
mov    %rbx,0x30(%rsp)
mov    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x200,%edx
mov    %rax,%rcx
call   1040 <fread@plt>
movb   $0x0,(%rbx,%rax,1)
mov    %r12,%rdi
call   1050 <fclose@plt>
mov    %rbx,%rdi
lea    0x28(%rsp),%rsi
mov    $0xa,%edx
call   10e0 <strtoul@plt>
mov    %rax,%rbp
mov    0x14(%rsp),%edi
call   1090 <major@plt>
cmp    %rax,%rbp
jne    1227 <scansysdir+0x67>
mov    0x28(%rsp),%rdi
cmpb   $0x3a,(%rdi)
jne    1227 <scansysdir+0x67>
add    $0x1,%rdi
lea    0x28(%rsp),%rsi
mov    $0xa,%edx
call   10e0 <strtoul@plt>
mov    0x28(%rsp),%rcx
cmpb   $0xa,(%rcx)
mov    0x18(%rsp),%r12
mov    0x8(%rsp),%rbx
mov    (%rsp),%rbp
jne    1240 <scansysdir+0x80>
mov    0x14(%rsp),%ebx
mov    %ebx,%edi
mov    %rax,%rbp
call   1070 <minor@plt>
cmp    %rax,%rbp
je     13b6 <scansysdir+0x1f6>
mov    0x30(%rsp),%rax
movb   $0x0,(%rax)
mov    0x20(%rsp),%rdi
mov    %r12,%rsi
mov    %ebx,%edx
call   10c0 <scansysdir@plt>
mov    %eax,%r13d
jmp    122c <scansysdir+0x6c>
xor    %r13d,%r13d
jmp    13a4 <scansysdir+0x1e4>
xor    %r13d,%r13d
mov    %r14,%rdi
call   10a0 <closedir@plt>
mov    %r13d,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    (%r15),%rsi
mov    0x20(%rsp),%rdi
call   1030 <strcpy@plt>
mov    $0x1,%r13d
jmp    139c <scansysdir+0x1dc>

LLVM IR (-O0):
%struct.dirent = type { i8*, i64 }
@DT_UNKNOWN = global i64 0
@DT_DIR = global i64 0
@.str = [5 x i8] c"/dev\00"
@.str.1 = [2 x i8] c"r\00"
define i32 @scansysdir(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32*
%10 = alloca i32
%11 = alloca %struct.dirent*
%12 = alloca i8*
%13 = alloca i32*
%14 = alloca i64
%15 = alloca i64
%16 = alloca i8*
%17 = alloca i64
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%18 = load i8*, i8** %6
%19 = call i8* @strchr(i8* %18, i8 signext 0)
store i8* %19, i8** %8
store i32 0, i32* %10
%20 = load i8*, i8** %6
%21 = call i32* @opendir(i8* %20)
store i32* %21, i32** %9
%22 = icmp ne i32* %21, null
br i1 %22, label %24, label %23
23: ; preds = %3
store i32 0, i32* %4
br label %138
24: ; preds = %3
%25 = load i8*, i8** %8
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %8
store i8 47, i8* %25
br label %27
27: ; preds = %133, %115, %106, %85, %71, %57, %44, %24
%28 = load i32, i32* %10
%29 = icmp ne i32 %28, 0
br i1 %29, label %34, label %30
30: ; preds = %27
%31 = load i32*, i32** %9
%32 = call %struct.dirent* @readdir(i32* %31)
store %struct.dirent* %32, %struct.dirent** %11
%33 = icmp ne %struct.dirent* %32, null
br label %34
34: ; preds = %30, %27
%35 = phi i1 [ false, %27 ], [ %33, %30 ]
br i1 %35, label %36, label %134
36: ; preds = %34
%37 = load %struct.dirent*, %struct.dirent** %11
%38 = getelementptr inbounds %struct.dirent, %struct.dirent* %37, i32 0, i32 0
%39 = load i8*, i8** %38
%40 = getelementptr inbounds i8, i8* %39, i64 0
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
%43 = icmp eq i32 %42, 46
br i1 %43, label %44, label %45
44: ; preds = %36
br label %27
45: ; preds = %36
%46 = load %struct.dirent*, %struct.dirent** %11
%47 = getelementptr inbounds %struct.dirent, %struct.dirent* %46, i32 0, i32 1
%48 = load i64, i64* %47
%49 = load i64, i64* @DT_UNKNOWN
%50 = icmp ne i64 %48, %49
br i1 %50, label %51, label %58
51: ; preds = %45
%52 = load %struct.dirent*, %struct.dirent** %11
%53 = getelementptr inbounds %struct.dirent, %struct.dirent* %52, i32 0, i32 1
%54 = load i64, i64* %53
%55 = load i64, i64* @DT_DIR
%56 = icmp ne i64 %54, %55
br i1 %56, label %57, label %58
57: ; preds = %51
br label %27
58: ; preds = %51, %45
%59 = load %struct.dirent*, %struct.dirent** %11
%60 = getelementptr inbounds %struct.dirent, %struct.dirent* %59, i32 0, i32 0
%61 = load i8*, i8** %60
%62 = call i32 @strlen(i8* %61)
%63 = sext i32 %62 to i64
%64 = load i8*, i8** %8
%65 = load i8*, i8** %6
%66 = ptrtoint i8* %64 to i64
%67 = ptrtoint i8* %65 to i64
%68 = sub i64 %66, %67
%69 = sub nsw i64 448, %68
%70 = icmp sge i64 %63, %69
br i1 %70, label %71, label %72
71: ; preds = %58
br label %27
72: ; preds = %58
%73 = load i8*, i8** %8
%74 = load %struct.dirent*, %struct.dirent** %11
%75 = getelementptr inbounds %struct.dirent, %struct.dirent* %74, i32 0, i32 0
%76 = load i8*, i8** %75
%77 = call i32 @strcpy(i8* %73, i8* %76)
%78 = load i8*, i8** %6
%79 = call i8* @strchr(i8* %78, i8 signext 0)
store i8* %79, i8** %12
%80 = load i8*, i8** %12
%81 = call i32 @strcpy(i8* %80, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%82 = load i8*, i8** %6
%83 = call i32* @fopen(i8* %82, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %83, i32** %13
%84 = icmp ne i32* %83, null
br i1 %84, label %86, label %85
85: ; preds = %72
br label %27
86: ; preds = %72
%87 = load i8*, i8** %5
%88 = load i32*, i32** %13
%89 = call i64 @fread(i8* %87, i32 1, i32 512, i32* %88)
store i64 %89, i64* %17
%90 = load i8*, i8** %5
%91 = load i64, i64* %17
%92 = getelementptr inbounds i8, i8* %90, i64 %91
store i8 0, i8* %92
%93 = load i32*, i32** %13
%94 = call i32 @fclose(i32* %93)
%95 = load i8*, i8** %5
%96 = call i64 @strtoul(i8* %95, i8** %16, i32 10)
store i64 %96, i64* %14
%97 = load i64, i64* %14
%98 = load i32, i32* %7
%99 = call i64 @major(i32 %98)
%100 = icmp ne i64 %97, %99
br i1 %100, label %106, label %101
101: ; preds = %86
%102 = load i8*, i8** %16
%103 = load i8, i8* %102
%104 = sext i8 %103 to i32
%105 = icmp ne i32 %104, 58
br i1 %105, label %106, label %107
106: ; preds = %101, %86
br label %27
107: ; preds = %101
%108 = load i8*, i8** %16
%109 = getelementptr inbounds i8, i8* %108, i64 1
%110 = call i64 @strtoul(i8* %109, i8** %16, i32 10)
store i64 %110, i64* %15
%111 = load i8*, i8** %16
%112 = load i8, i8* %111
%113 = sext i8 %112 to i32
%114 = icmp ne i32 %113, 10
br i1 %114, label %115, label %116
115: ; preds = %107
br label %27
116: ; preds = %107
%117 = load i64, i64* %15
%118 = load i32, i32* %7
%119 = call i64 @minor(i32 %118)
%120 = icmp eq i64 %117, %119
br i1 %120, label %121, label %127
121: ; preds = %116
%122 = load i8*, i8** %5
%123 = load %struct.dirent*, %struct.dirent** %11
%124 = getelementptr inbounds %struct.dirent, %struct.dirent* %123, i32 0, i32 0
%125 = load i8*, i8** %124
%126 = call i32 @strcpy(i8* %122, i8* %125)
store i32 1, i32* %10
br label %133
127: ; preds = %116
%128 = load i8*, i8** %12
store i8 0, i8* %128
%129 = load i8*, i8** %5
%130 = load i8*, i8** %6
%131 = load i32, i32* %7
%132 = call i32 @scansysdir(i8* %129, i8* %130, i32 %131)
store i32 %132, i32* %10
br label %133
133: ; preds = %127, %121
br label %27
134: ; preds = %34
%135 = load i32*, i32** %9
%136 = call i32 @closedir(i32* %135)
%137 = load i32, i32* %10
store i32 %137, i32* %4
br label %138
138: ; preds = %134, %23
%139 = load i32, i32* %4
ret i32 %139
}

LLVM IR (-O2):
%struct.dirent = type { i8*, i64 }
@DT_UNKNOWN = global i64 0
@DT_DIR = global i64 0
@.str = [5 x i8] c"/dev\00"
@.str.1 = [2 x i8] c"r\00"
define i32 @scansysdir(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = tail call i64 bitcast (i32 (i8*)* @strlen to i64 (i8*)*)(i8* %1)
%6 = getelementptr i8, i8* %1, i64 %5
%7 = bitcast i8** %4 to i8*
%8 = tail call i32* @opendir(i8* %1)
%9 = icmp eq i32* %8, null
br i1 %9, label %75, label %10
10: ; preds = %3
%11 = getelementptr inbounds i8, i8* %6, i64 1
store i8 47, i8* %6
%12 = ptrtoint i8* %11 to i64
%13 = ptrtoint i8* %1 to i64
%14 = add i64 %13, 448
%15 = sub i64 %14, %12
br label %16
16: ; preds = %10, %55
%17 = tail call %struct.dirent* @readdir(i32* %8)
%18 = icmp eq %struct.dirent* %17, null
br i1 %18, label %72, label %19
19: ; preds = %16
%20 = getelementptr inbounds %struct.dirent, %struct.dirent* %17, i64 0, i32 0
%21 = load i8*, i8** %20
%22 = load i8, i8* %21
%23 = icmp eq i8 %22, 46
br i1 %23, label %55, label %24
24: ; preds = %19
%25 = getelementptr inbounds %struct.dirent, %struct.dirent* %17, i64 0, i32 1
%26 = load i64, i64* %25
%27 = load i64, i64* @DT_UNKNOWN
%28 = icmp eq i64 %26, %27
%29 = load i64, i64* @DT_DIR
%30 = icmp eq i64 %26, %29
%31 = select i1 %28, i1 true, i1 %30
br i1 %31, label %32, label %55
32: ; preds = %24
%33 = tail call i32 @strlen(i8* %21)
%34 = sext i32 %33 to i64
%35 = icmp sgt i64 %15, %34
br i1 %35, label %36, label %55
36: ; preds = %32
%37 = load i8*, i8** %20
%38 = tail call i32 @strcpy(i8* %11, i8* %37)
%39 = tail call i64 bitcast (i32 (i8*)* @strlen to i64 (i8*)*)(i8* %1)
%40 = getelementptr i8, i8* %1, i64 %39
%41 = tail call i32 @strcpy(i8* %40, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%42 = tail call i32* @fopen(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%43 = icmp eq i32* %42, null
br i1 %43, label %55, label %44
44: ; preds = %36
%45 = tail call i64 @fread(i8* %0, i32 1, i32 512, i32* %42)
%46 = getelementptr inbounds i8, i8* %0, i64 %45
store i8 0, i8* %46
%47 = tail call i32 @fclose(i32* %42)
%48 = call i64 @strtoul(i8* %0, i8** %4, i32 10)
%49 = tail call i64 @major(i32 %2)
%50 = icmp eq i64 %48, %49
br i1 %50, label %51, label %55
51: ; preds = %44
%52 = load i8*, i8** %4
%53 = load i8, i8* %52
%54 = icmp eq i8 %53, 58
br i1 %54, label %58, label %55
55: ; preds = %70, %44, %51, %19, %32, %36, %58, %24
%56 = phi i32 [ 0, %19 ], [ 0, %32 ], [ 0, %58 ], [ 0, %36 ], [ 0, %24 ], [ 0, %51 ], [ 0, %44 ], [ %71, %70 ]
%57 = icmp eq i32 %56, 0
br i1 %57, label %16, label %72
58: ; preds = %51
%59 = getelementptr inbounds i8, i8* %52, i64 1
%60 = call i64 @strtoul(i8* %59, i8** %4, i32 10)
%61 = load i8*, i8** %4
%62 = load i8, i8* %61
%63 = icmp eq i8 %62, 10
br i1 %63, label %64, label %55
64: ; preds = %58
%65 = tail call i64 @minor(i32 %2)
%66 = icmp eq i64 %60, %65
br i1 %66, label %67, label %70
67: ; preds = %64
%68 = load i8*, i8** %20
%69 = tail call i32 @strcpy(i8* %0, i8* %68)
br label %72
70: ; preds = %64
store i8 0, i8* %40
%71 = tail call i32 @scansysdir(i8* %0, i8* %1, i32 %2)
br label %55
72: ; preds = %55, %16, %67
%73 = phi i32 [ 1, %67 ], [ 0, %16 ], [ %56, %55 ]
%74 = tail call i32 @closedir(i32* %8)
br label %75
75: ; preds = %3, %72
%76 = phi i32 [ %73, %72 ], [ 0, %3 ]
ret i32 %76
}