#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 {
  int /*<<< orphan*/ *d_name;
};
typedef int /*<<< orphan*/ cmdline;
typedef int /*<<< orphan*/ FILE;
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int /*<<< orphan*/ _SC_PAGESIZE;
int atoi(int /*<<< orphan*/ *);
int /*<<< orphan*/ closedir(int /*<<< orphan*/ *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, char *, unsigned long *,
                          unsigned long *, unsigned long *, unsigned long *,
                          long *, unsigned long long *, unsigned long *);
int const getpid();
int /*<<< orphan*/ isdigit(int /*<<< orphan*/);
int /*<<< orphan*/ *opendir(char *);
int /*<<< orphan*/ printf(char *, ...);
struct dirent *readdir(int /*<<< orphan*/ *);
int /*<<< orphan*/ sprintf(char *, char *, int const);
scalar_t__ strlen(char *);
int sysconf(int /*<<< orphan*/);
void dump_proc_stats(void) {
  struct dirent *de;
  DIR *d = opendir("/proc");
  if (!d)
    return;
  const long kb_per_page = sysconf(_SC_PAGESIZE) / 1024;
  bool terminate_prev_line = false;
  printf("  \"processes\":\n  {\n");
  while ((de = readdir(d))) {
    if (!isdigit(de->d_name[0]))
      continue;
    const int pid = atoi(de->d_name);
    if (pid == getpid())
      continue;
    char cmdline[64];
    char fpath[32];
    FILE *f;
    sprintf(fpath, "/proc/%d/cmdline", pid);
    f = fopen(fpath, "r");
    if (!f)
      continue;
    cmdline[0] = '\0';
    fgets(cmdline, sizeof(cmdline), f);
    fclose(f);
    char proc_name[256];
    long num_threads = 0;
    long unsigned min_faults = 0;
    long unsigned maj_faults = 0;
    long unsigned utime = 0;
    long unsigned ktime = 0;
    long unsigned vm_rss = 0;
    long long unsigned start_time = 0;
    sprintf(fpath, "/proc/%d/stat", pid);
    f = fopen(fpath, "r");
    if (!f)
      continue;
    fscanf(f,
           "%*d %s %*c %*d %*d %*d %*d %*d %*u %lu %*u %lu %*u %lu %lu "
           "%*d %*d %*d %*d %ld %*d %llu %*u %ld",
           proc_name, &min_faults, &maj_faults, &utime, &ktime, &num_threads,
           &start_time, &vm_rss);
    fclose(f);
    char const *const cmd = (strlen(cmdline) > 0) ? cmdline : proc_name;
    if (terminate_prev_line)
      printf(",\n");
    terminate_prev_line = true;
    printf("   \"%d\": {"
           "\"name\": \"%s\", "
           "\"n_threads\": %ld, "
           "\"start_time\": %llu, "
           "\"user_time\": %lu, "
           "\"sys_time\": %lu, "
           "\"min_faults\": %lu, "
           "\"maj_faults\": %lu, "
           "\"vm_rss\": %lu"
           "}",
           pid, cmd, num_threads, start_time, utime, ktime, min_faults,
           maj_faults, vm_rss * kb_per_page);
  }
  closedir(d);
  printf("\n  }");
}


x86 assembly (clang, -O0):
<dump_proc_stats>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x208,%rsp
lea    0xe0d(%rip),%rdi
call   1060 <opendir@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    120c <dump_proc_stats+0x2c>
jmp    14e1 <dump_proc_stats+0x301>
mov    0x2dd5(%rip),%rax
mov    (%rax),%edi
call   10e0 <sysconf@plt>
mov    $0x400,%ecx
cltd
idiv   %ecx
cltq
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
lea    0xdd0(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x18(%rbp),%rdi
call   10c0 <readdir@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     14ca <dump_proc_stats+0x2ea>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    1270 <dump_proc_stats+0x90>
jmp    123d <dump_proc_stats+0x5d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10f0 <atoi@plt>
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x1e4(%rbp)
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %eax,%ecx
mov    -0x1e4(%rbp),%eax
cmp    %ecx,%eax
jne    12a4 <dump_proc_stats+0xc4>
jmp    123d <dump_proc_stats+0x5d>
lea    -0x90(%rbp),%rdi
mov    -0x28(%rbp),%edx
lea    0xd65(%rip),%rsi
call   1100 <sprintf@plt>
lea    -0x90(%rbp),%rdi
lea    0xd63(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x98(%rbp)
cmpq   $0x0,-0x98(%rbp)
jne    12e7 <dump_proc_stats+0x107>
jmp    123d <dump_proc_stats+0x5d>
movb   $0x0,-0x70(%rbp)
lea    -0x70(%rbp),%rdi
mov    -0x98(%rbp),%rdx
mov    $0x40,%esi
call   10b0 <fgets@plt>
mov    -0x98(%rbp),%rdi
call   1050 <fclose@plt>
movq   $0x0,-0x1a8(%rbp)
movq   $0x0,-0x1b0(%rbp)
movq   $0x0,-0x1b8(%rbp)
movq   $0x0,-0x1c0(%rbp)
movq   $0x0,-0x1c8(%rbp)
movq   $0x0,-0x1d0(%rbp)
movq   $0x0,-0x1d8(%rbp)
lea    -0x90(%rbp),%rdi
mov    -0x28(%rbp),%edx
lea    0xcc3(%rip),%rsi
call   1100 <sprintf@plt>
lea    -0x90(%rbp),%rdi
lea    0xcae(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x98(%rbp)
cmpq   $0x0,-0x98(%rbp)
jne    139c <dump_proc_stats+0x1bc>
jmp    123d <dump_proc_stats+0x5d>
mov    -0x98(%rbp),%rdi
lea    -0x1a0(%rbp),%rdx
lea    0xc8a(%rip),%rsi
lea    -0x1b0(%rbp),%rcx
lea    -0x1b8(%rbp),%r8
lea    -0x1c0(%rbp),%r9
lea    -0x1c8(%rbp),%rbx
lea    -0x1a8(%rbp),%r11
lea    -0x1d8(%rbp),%r10
lea    -0x1d0(%rbp),%rax
mov    %rbx,(%rsp)
mov    %r11,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %rax,0x18(%rsp)
call   1090 <fscanf@plt>
mov    -0x98(%rbp),%rdi
call   1050 <fclose@plt>
lea    -0x70(%rbp),%rdi
call   1070 <strlen@plt>
cmp    $0x0,%rax
jle    1429 <dump_proc_stats+0x249>
lea    -0x70(%rbp),%rax
mov    %rax,-0x1f0(%rbp)
jmp    1437 <dump_proc_stats+0x257>
lea    -0x1a0(%rbp),%rax
mov    %rax,-0x1f0(%rbp)
mov    -0x1f0(%rbp),%rax
mov    %rax,-0x1e0(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     145d <dump_proc_stats+0x27d>
lea    0xc45(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movl   $0x1,-0x24(%rbp)
mov    -0x28(%rbp),%esi
mov    -0x1e0(%rbp),%rdx
mov    -0x1a8(%rbp),%rcx
mov    -0x1d8(%rbp),%r8
mov    -0x1c0(%rbp),%r9
mov    -0x1c8(%rbp),%rbx
mov    -0x1b0(%rbp),%r11
mov    -0x1b8(%rbp),%r10
mov    -0x1d0(%rbp),%rax
imul   -0x20(%rbp),%rax
lea    0xbf3(%rip),%rdi
mov    %rbx,(%rsp)
mov    %r11,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %rax,0x18(%rsp)
mov    $0x0,%al
call   1080 <printf@plt>
jmp    123d <dump_proc_stats+0x5d>
mov    -0x18(%rbp),%rdi
call   10a0 <closedir@plt>
lea    0xc5a(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
add    $0x208,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_proc_stats>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1a8,%rsp
lea    0xe08(%rip),%rdi
call   1060 <opendir@plt>
test   %rax,%rax
je     1435 <dump_proc_stats+0x255>
mov    %rax,%rbx
mov    0x2dd8(%rip),%rax
mov    (%rax),%edi
call   10e0 <sysconf@plt>
lea    0x3ff(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
sar    $0xa,%ecx
movslq %ecx,%r14
lea    0xef3(%rip),%rdi
call   1030 <puts@plt>
lea    0xddc(%rip),%rax
lea    0x60(%rsp),%rcx
xor    %r13d,%r13d
mov    %rcx,%r15
mov    %rax,%r12
nopl   0x0(%rax)
mov    %rbx,%rdi
call   10c0 <readdir@plt>
test   %rax,%rax
je     141f <dump_proc_stats+0x23f>
mov    (%rax),%rdi
mov    (%rdi),%eax
add    $0xffffffd0,%eax
cmp    $0x9,%eax
ja     1250 <dump_proc_stats+0x70>
call   10f0 <atoi@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1040 <getpid@plt>
cmp    %eax,%ebp
mov    %r12,%rax
mov    %r15,%rcx
je     1243 <dump_proc_stats+0x63>
lea    0x40(%rsp),%rdi
lea    0xd74(%rip),%rsi
mov    %ebp,%edx
call   1100 <sprintf@plt>
lea    0x40(%rsp),%rdi
lea    0xd72(%rip),%rsi
call   10d0 <fopen@plt>
test   %rax,%rax
je     1410 <dump_proc_stats+0x230>
movb   $0x0,0x60(%rsp)
mov    %r15,%rdi
mov    $0x40,%esi
mov    %rax,%rdx
mov    %rax,(%rsp)
call   10b0 <fgets@plt>
mov    (%rsp),%rdi
call   1050 <fclose@plt>
movq   $0x0,0x38(%rsp)
movq   $0x0,0x30(%rsp)
movq   $0x0,0x28(%rsp)
movq   $0x0,0x20(%rsp)
movq   $0x0,0x18(%rsp)
movq   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
lea    0x40(%rsp),%rdi
lea    0xcf9(%rip),%rsi
mov    %ebp,%edx
call   1100 <sprintf@plt>
lea    0x40(%rsp),%rdi
lea    0xce4(%rip),%rsi
call   10d0 <fopen@plt>
test   %rax,%rax
je     1405 <dump_proc_stats+0x225>
mov    %rax,%rdi
mov    %rax,(%rsp)
lea    0xcd8(%rip),%rsi
lea    0xa0(%rsp),%rdx
lea    0x30(%rsp),%rcx
lea    0x28(%rsp),%r8
lea    0x20(%rsp),%r9
lea    0x10(%rsp),%rax
push   %rax
lea    0x10(%rsp),%rax
push   %rax
lea    0x48(%rsp),%rax
push   %rax
lea    0x30(%rsp),%rax
push   %rax
call   1090 <fscanf@plt>
add    $0x20,%rsp
mov    (%rsp),%rdi
call   1050 <fclose@plt>
lea    0x60(%rsp),%rdi
call   1070 <strlen@plt>
test   %rax,%rax
lea    0xa0(%rsp),%rdx
lea    0x60(%rsp),%rax
cmovg  %rax,%rdx
test   %r13d,%r13d
je     13c5 <dump_proc_stats+0x1e5>
lea    0xd7b(%rip),%rdi
mov    %rdx,%r13
call   1030 <puts@plt>
mov    %r13,%rdx
mov    0x38(%rsp),%rcx
mov    0x8(%rsp),%r8
mov    0x20(%rsp),%r9
mov    0x10(%rsp),%r10
imul   %r14,%r10
lea    0xca3(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
push   %r10
push   0x30(%rsp)
push   0x40(%rsp)
push   0x30(%rsp)
call   1080 <printf@plt>
add    $0x20,%rsp
mov    $0x1,%r13d
mov    %r12,%rax
mov    %r15,%rcx
jmp    1243 <dump_proc_stats+0x63>
lea    0xc00(%rip),%rax
mov    %r15,%rcx
jmp    1243 <dump_proc_stats+0x63>
mov    %rbx,%rdi
call   10a0 <closedir@plt>
lea    0xcef(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
add    $0x1a8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.dirent = type { i32* }
@.str = [6 x i8] c"/proc\00"
@_SC_PAGESIZE = global i32 0
@.str.1 = [20 x i8] c" \22processes\22:\0A {\0A\00"
@.str.2 = [17 x i8] c"/proc/%d/cmdline\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [14 x i8] c"/proc/%d/stat\00"
@.str.5 = [96 x i8] c"%*d %s %*c %*d %*d %*d %*d %*d %*u %lu %*u %lu %*u %lu %lu %*d %*d %*d %*d %ld %*d %llu %*u %ld\00"
@.str.6 = [3 x i8] c",\0A\00"
@.str.7 = [150 x i8] c" \22%d\22: {\22name\22: \22%s\22, \22n_threads\22: %ld, \22start_time\22: %llu, \22user_time\22: %lu, \22sys_time\22: %lu, \22min_faults\22: %lu, \22maj_faults\22: %lu, \22vm_rss\22: %lu}\00"
@.str.8 = [5 x i8] c"\0A }\00"
define void @dump_proc_stats() {
%1 = alloca %struct.dirent*
%2 = alloca i32*
%3 = alloca i64
%4 = alloca i32
%5 = alloca i32
%6 = alloca [64 x i8]
%7 = alloca [32 x i8]
%8 = alloca i32*
%9 = alloca [256 x i8]
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
%15 = alloca i64
%16 = alloca i64
%17 = alloca i8*
%18 = call i32* @opendir(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32* %18, i32** %2
%19 = load i32*, i32** %2
%20 = icmp ne i32* %19, null
br i1 %20, label %22, label %21
21: ; preds = %0
br label %110
22: ; preds = %0
%23 = load i32, i32* @_SC_PAGESIZE
%24 = call i32 @sysconf(i32 %23)
%25 = sdiv i32 %24, 1024
%26 = sext i32 %25 to i64
store i64 %26, i64* %3
store i32 0, i32* %4
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
br label %28
28: ; preds = %93, %73, %58, %49, %40, %22
%29 = load i32*, i32** %2
%30 = call %struct.dirent* @readdir(i32* %29)
store %struct.dirent* %30, %struct.dirent** %1
%31 = icmp ne %struct.dirent* %30, null
br i1 %31, label %32, label %106
32: ; preds = %28
%33 = load %struct.dirent*, %struct.dirent** %1
%34 = getelementptr inbounds %struct.dirent, %struct.dirent* %33, i32 0, i32 0
%35 = load i32*, i32** %34
%36 = getelementptr inbounds i32, i32* %35, i64 0
%37 = load i32, i32* %36
%38 = call i32 @isdigit(i32 %37)
%39 = icmp ne i32 %38, 0
br i1 %39, label %41, label %40
40: ; preds = %32
br label %28
41: ; preds = %32
%42 = load %struct.dirent*, %struct.dirent** %1
%43 = getelementptr inbounds %struct.dirent, %struct.dirent* %42, i32 0, i32 0
%44 = load i32*, i32** %43
%45 = call i32 @atoi(i32* %44)
store i32 %45, i32* %5
%46 = load i32, i32* %5
%47 = call i32 (...) @getpid()
%48 = icmp eq i32 %46, %47
br i1 %48, label %49, label %50
49: ; preds = %41
br label %28
50: ; preds = %41
%51 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%52 = load i32, i32* %5
%53 = call i32 @sprintf(i8* %51, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %52)
%54 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%55 = call i32* @fopen(i8* %54, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %55, i32** %8
%56 = load i32*, i32** %8
%57 = icmp ne i32* %56, null
br i1 %57, label %59, label %58
58: ; preds = %50
br label %28
59: ; preds = %50
%60 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
store i8 0, i8* %60
%61 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%62 = load i32*, i32** %8
%63 = call i32 @fgets(i8* %61, i32 64, i32* %62)
%64 = load i32*, i32** %8
%65 = call i32 @fclose(i32* %64)
store i64 0, i64* %10
store i64 0, i64* %11
store i64 0, i64* %12
store i64 0, i64* %13
store i64 0, i64* %14
store i64 0, i64* %15
store i64 0, i64* %16
%66 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%67 = load i32, i32* %5
%68 = call i32 @sprintf(i8* %66, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 %67)
%69 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%70 = call i32* @fopen(i8* %69, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %70, i32** %8
%71 = load i32*, i32** %8
%72 = icmp ne i32* %71, null
br i1 %72, label %74, label %73
73: ; preds = %59
br label %28
74: ; preds = %59
%75 = load i32*, i32** %8
%76 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%77 = call i32 @fscanf(i32* %75, i8* getelementptr inbounds ([96 x i8], [96 x i8]* @.str.5, i64 0, i64 0), i8* %76, i64* %11, i64* %12, i64* %13, i64* %14, i64* %10, i64* %16, i64* %15)
%78 = load i32*, i32** %8
%79 = call i32 @fclose(i32* %78)
%80 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%81 = call i64 @strlen(i8* %80)
%82 = icmp sgt i64 %81, 0
br i1 %82, label %83, label %85
83: ; preds = %74
%84 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
br label %87
85: ; preds = %74
%86 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
br label %87
87: ; preds = %85, %83
%88 = phi i8* [ %84, %83 ], [ %86, %85 ]
store i8* %88, i8** %17
%89 = load i32, i32* %4
%90 = icmp ne i32 %89, 0
br i1 %90, label %91, label %93
91: ; preds = %87
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %93
93: ; preds = %91, %87
store i32 1, i32* %4
%94 = load i32, i32* %5
%95 = load i8*, i8** %17
%96 = load i64, i64* %10
%97 = load i64, i64* %16
%98 = load i64, i64* %13
%99 = load i64, i64* %14
%100 = load i64, i64* %11
%101 = load i64, i64* %12
%102 = load i64, i64* %15
%103 = load i64, i64* %3
%104 = mul i64 %102, %103
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([150 x i8], [150 x i8]* @.str.7, i64 0, i64 0), i32 %94, i8* %95, i64 %96, i64 %97, i64 %98, i64 %99, i64 %100, i64 %101, i64 %104)
br label %28
106: ; preds = %28
%107 = load i32*, i32** %2
%108 = call i32 @closedir(i32* %107)
%109 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
br label %110
110: ; preds = %106, %21
ret void
}

LLVM IR (-O2):
%struct.dirent = type { i32* }
@.str = [6 x i8] c"/proc\00"
@_SC_PAGESIZE = global i32 0
@.str.2 = [17 x i8] c"/proc/%d/cmdline\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [14 x i8] c"/proc/%d/stat\00"
@.str.5 = [96 x i8] c"%*d %s %*c %*d %*d %*d %*d %*d %*u %lu %*u %lu %*u %lu %lu %*d %*d %*d %*d %ld %*d %llu %*u %ld\00"
@.str.7 = [150 x i8] c" \22%d\22: {\22name\22: \22%s\22, \22n_threads\22: %ld, \22start_time\22: %llu, \22user_time\22: %lu, \22sys_time\22: %lu, \22min_faults\22: %lu, \22maj_faults\22: %lu, \22vm_rss\22: %lu}\00"
@.str.8 = [5 x i8] c"\0A }\00"
@str = [19 x i8] c" \22processes\22:\0A {\00"
@str.9 = [2 x i8] c",\00"
define void @dump_proc_stats() {
%1 = alloca [64 x i8]
%2 = alloca [32 x i8]
%3 = alloca [256 x i8]
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = tail call i32* @opendir(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i32* %11, null
br i1 %12, label %81, label %13
13: ; preds = %0
%14 = load i32, i32* @_SC_PAGESIZE
%15 = tail call i32 @sysconf(i32 %14)
%16 = sdiv i32 %15, 1024
%17 = sext i32 %16 to i64
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%19 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 0
%20 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%21 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%22 = bitcast i64* %4 to i8*
%23 = bitcast i64* %5 to i8*
%24 = bitcast i64* %6 to i8*
%25 = bitcast i64* %7 to i8*
%26 = bitcast i64* %8 to i8*
%27 = bitcast i64* %9 to i8*
%28 = bitcast i64* %10 to i8*
br label %29
29: ; preds = %76, %13
%30 = phi i32 [ %77, %76 ], [ 0, %13 ]
br label %31
31: ; preds = %29, %41
br label %32
32: ; preds = %31, %35
%33 = call %struct.dirent* @readdir(i32* %11)
%34 = icmp eq %struct.dirent* %33, null
br i1 %34, label %78, label %35
35: ; preds = %32
%36 = getelementptr inbounds %struct.dirent, %struct.dirent* %33, i64 0, i32 0
%37 = load i32*, i32** %36
%38 = load i32, i32* %37
%39 = add i32 %38, -48
%40 = icmp ult i32 %39, 10
br i1 %40, label %41, label %32
41: ; preds = %35
%42 = call i32 @atoi(i32* %37)
%43 = call i32 (...) @getpid()
%44 = icmp eq i32 %42, %43
br i1 %44, label %31, label %45
45: ; preds = %41
%46 = call i32 @sprintf(i8* %20, i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %42)
%47 = call i32* @fopen(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%48 = icmp eq i32* %47, null
br i1 %48, label %76, label %49
49: ; preds = %45
store i8 0, i8* %19
%50 = call i32 @fgets(i8* %19, i32 64, i32* %47)
%51 = call i32 @fclose(i32* %47)
store i64 0, i64* %4
store i64 0, i64* %5
store i64 0, i64* %6
store i64 0, i64* %7
store i64 0, i64* %8
store i64 0, i64* %9
store i64 0, i64* %10
%52 = call i32 @sprintf(i8* %20, i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 %42)
%53 = call i32* @fopen(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%54 = icmp eq i32* %53, null
br i1 %54, label %74, label %55
55: ; preds = %49
%56 = call i32 @fscanf(i32* %53, i8* getelementptr inbounds ([96 x i8], [96 x i8]* @.str.5, i64 0, i64 0), i8* %21, i64* %5, i64* %6, i64* %7, i64* %8, i64* %4, i64* %10, i64* %9)
%57 = call i32 @fclose(i32* %53)
%58 = call i64 @strlen(i8* %19)
%59 = icmp sgt i64 %58, 0
%60 = select i1 %59, i8* %19, i8* %21
%61 = icmp eq i32 %30, 0
br i1 %61, label %64, label %62
62: ; preds = %55
%63 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.9, i64 0, i64 0))
br label %64
64: ; preds = %62, %55
%65 = load i64, i64* %4
%66 = load i64, i64* %10
%67 = load i64, i64* %7
%68 = load i64, i64* %8
%69 = load i64, i64* %5
%70 = load i64, i64* %6
%71 = load i64, i64* %9
%72 = mul i64 %71, %17
%73 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([150 x i8], [150 x i8]* @.str.7, i64 0, i64 0), i32 %42, i8* %60, i64 %65, i64 %66, i64 %67, i64 %68, i64 %69, i64 %70, i64 %72)
br label %74
74: ; preds = %49, %64
%75 = phi i32 [ 1, %64 ], [ %30, %49 ]
br label %76
76: ; preds = %45, %74
%77 = phi i32 [ %75, %74 ], [ %30, %45 ]
br label %29
78: ; preds = %32
%79 = call i32 @closedir(i32* %11)
%80 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
br label %81
81: ; preds = %0, %78
ret void
}