#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 stat {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ O_WRONLY;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int fscanf(int /*<<< orphan*/ *, char *, int *);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int rmdir(char *);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, ...);
int /*<<< orphan*/ sprintf(char *, char *, int);
int stat(char *, struct stat *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ strncat(char *, char *, int);
int /*<<< orphan*/ write(int, char *, int /*<<< orphan*/);
void destroy_cpuset(const char *name, int print) {
  struct stat st;
  char path[1024];
  char buf[100];
  FILE *fp;
  int pid;
  int ret;
  int fd;
  int retry = 0;
  printf("Removing %s\n", name);
  snprintf(path, 1024 - 1, "%s/%s",
           "/sys/fs/cgroup"
           "/cpuset",
           name);
  path[1024 - 1] = 0;
  ret = stat(path, &st);
  if (ret < 0)
    return;
again:
  strncat(path, "/tasks", 1024 - 1);
  if ((fp = fopen(path, "r")) == NULL) {
    fprintf(stderr, "Failed opening %s\n", path);
    perror("fopen");
    return;
  }
  snprintf(path, 1024 - 1, "%s/tasks",
           "/sys/fs/cgroup"
           "/cpuset");
  path[1024 - 1] = 0;
  fd = open(path, O_WRONLY);
  if (fd < 0) {
    fclose(fp);
    fprintf(stderr, "Failed opening %s\n", path);
    perror("open");
    return;
  }
  while (fscanf(fp, "%d", &pid) == 1) {
    sprintf(buf, "%d", pid);
    if (print)
      printf("Moving %d out of %s\n", pid, name);
    write(fd, buf, strlen(buf));
  }
  fclose(fp);
  close(fd);
  snprintf(path, 1024 - 1, "%s/%s",
           "/sys/fs/cgroup"
           "/cpuset",
           name);
  path[1024 - 1] = 0;
  sleep(1);
  ret = rmdir(path);
  if (ret < 0) {
    if (retry++ < 5)
      goto again;
    fprintf(stderr, "Failed to remove %s\n", path);
    perror("rmdir");
    if (retry++ < 5) {
      fprintf(stderr, "Trying again\n");
      goto again;
    }
  }
}


x86 assembly (clang, -O0):
<destroy_cpuset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4b0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x498(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xdd9(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x410(%rbp),%rdi
mov    -0x8(%rbp),%r8
mov    $0x3ff,%esi
lea    0xdc8(%rip),%rdx
lea    0xdc7(%rip),%rcx
mov    $0x0,%al
call   1080 <snprintf@plt>
movb   $0x0,-0x11(%rbp)
lea    -0x410(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   10d0 <stat@plt>
mov    %eax,-0x490(%rbp)
cmpl   $0x0,-0x490(%rbp)
jge    127f <destroy_cpuset+0x7f>
jmp    1506 <destroy_cpuset+0x306>
jmp    1284 <destroy_cpuset+0x84>
lea    -0x410(%rbp),%rdi
lea    0xdb2(%rip),%rsi
mov    $0x3ff,%edx
call   10a0 <strncat@plt>
lea    -0x410(%rbp),%rdi
lea    0xdd2(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x488(%rbp)
cmp    $0x0,%rax
jne    12ef <destroy_cpuset+0xef>
mov    0x2d19(%rip),%rax
mov    (%rax),%edi
lea    -0x410(%rbp),%rdx
lea    0xd52(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
lea    0xd57(%rip),%rdi
call   1100 <perror@plt>
jmp    1506 <destroy_cpuset+0x306>
lea    -0x410(%rbp),%rdi
mov    $0x3ff,%esi
lea    0xd40(%rip),%rdx
lea    0xd0a(%rip),%rcx
mov    $0x0,%al
call   1080 <snprintf@plt>
movb   $0x0,-0x11(%rbp)
lea    -0x410(%rbp),%rdi
mov    0x2cae(%rip),%rax
mov    (%rax),%esi
call   10e0 <open@plt>
mov    %eax,-0x494(%rbp)
cmpl   $0x0,-0x494(%rbp)
jge    1377 <destroy_cpuset+0x177>
mov    -0x488(%rbp),%rdi
call   1040 <fclose@plt>
mov    0x2c91(%rip),%rax
mov    (%rax),%edi
lea    -0x410(%rbp),%rdx
lea    0xcca(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
lea    0xcd0(%rip),%rdi
call   1100 <perror@plt>
jmp    1506 <destroy_cpuset+0x306>
jmp    137c <destroy_cpuset+0x17c>
mov    -0x488(%rbp),%rdi
lea    0xcc1(%rip),%rsi
lea    -0x48c(%rbp),%rdx
call   1090 <fscanf@plt>
cmp    $0x1,%eax
jne    1419 <destroy_cpuset+0x219>
lea    -0x480(%rbp),%rdi
mov    -0x48c(%rbp),%edx
lea    0xc98(%rip),%rsi
call   1110 <sprintf@plt>
cmpl   $0x0,-0xc(%rbp)
je     13da <destroy_cpuset+0x1da>
mov    -0x48c(%rbp),%esi
mov    -0x8(%rbp),%rdx
lea    0xc7b(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x494(%rbp),%eax
mov    %eax,-0x4a4(%rbp)
lea    -0x480(%rbp),%rax
mov    %rax,-0x4a0(%rbp)
lea    -0x480(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x4a4(%rbp),%edi
mov    -0x4a0(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
jmp    137c <destroy_cpuset+0x17c>
mov    -0x488(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x494(%rbp),%edi
call   10b0 <close@plt>
lea    -0x410(%rbp),%rdi
mov    -0x8(%rbp),%r8
mov    $0x3ff,%esi
lea    0xbc6(%rip),%rdx
lea    0xbc5(%rip),%rcx
mov    $0x0,%al
call   1080 <snprintf@plt>
movb   $0x0,-0x11(%rbp)
mov    $0x1,%edi
call   1120 <sleep@plt>
lea    -0x410(%rbp),%rdi
call   1050 <rmdir@plt>
mov    %eax,-0x490(%rbp)
cmpl   $0x0,-0x490(%rbp)
jge    1506 <destroy_cpuset+0x306>
mov    -0x498(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x498(%rbp)
cmp    $0x5,%eax
jge    14a1 <destroy_cpuset+0x2a1>
jmp    1284 <destroy_cpuset+0x84>
mov    0x2b38(%rip),%rax
mov    (%rax),%edi
lea    -0x410(%rbp),%rdx
lea    0xbab(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
lea    0xbb2(%rip),%rdi
call   1100 <perror@plt>
mov    -0x498(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x498(%rbp)
cmp    $0x5,%eax
jge    1501 <destroy_cpuset+0x301>
mov    0x2af4(%rip),%rax
mov    (%rax),%edi
lea    0xb89(%rip),%rsi
mov    $0x0,%al
call   10c0 <fprintf@plt>
jmp    1284 <destroy_cpuset+0x84>
jmp    1506 <destroy_cpuset+0x306>
add    $0x4b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<destroy_cpuset>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x498,%rsp
mov    %esi,%r14d
mov    %rdi,%rbx
lea    0xde2(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xdde(%rip),%rdx
lea    0xddd(%rip),%rcx
lea    0x90(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x3ff,%esi
mov    %rbx,0x10(%rsp)
mov    %rbx,%r8
xor    %eax,%eax
call   1080 <snprintf@plt>
movb   $0x0,0x48f(%rsp)
lea    0x18(%rsp),%rsi
mov    %rbp,%rdi
call   10d0 <stat@plt>
test   %eax,%eax
js     143f <destroy_cpuset+0x23f>
lea    0x90(%rsp),%rbx
lea    0xd92(%rip),%r15
lea    0xdc3(%rip),%r12
lea    0x20(%rsp),%r13
xor    %eax,%eax
nop
mov    %eax,0xc(%rsp)
mov    %rbx,%rdi
lea    0xda6(%rip),%rsi
mov    $0x3ff,%edx
call   10a0 <strncat@plt>
mov    %rbx,%rdi
lea    0xdca(%rip),%rsi
call   10f0 <fopen@plt>
test   %rax,%rax
je     13e9 <destroy_cpuset+0x1e9>
mov    %rax,%rbp
mov    %rbx,%rdi
mov    $0x3ff,%esi
lea    0xd70(%rip),%rdx
mov    %r15,%rcx
xor    %eax,%eax
call   1080 <snprintf@plt>
movb   $0x0,0x48f(%rsp)
mov    0x2ce5(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   10e0 <open@plt>
test   %eax,%eax
js     13f9 <destroy_cpuset+0x1f9>
mov    %eax,%r15d
mov    %rbp,%rdi
mov    %r12,%rsi
lea    0x8(%rsp),%rdx
call   1090 <fscanf@plt>
cmp    $0x1,%eax
mov    0x10(%rsp),%rbx
je     13be <destroy_cpuset+0x1be>
mov    %rbp,%rdi
call   1040 <fclose@plt>
mov    %r15d,%edi
call   10b0 <close@plt>
mov    %rbx,%r8
lea    0x90(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x3ff,%esi
lea    0xcc5(%rip),%rdx
lea    0xcc4(%rip),%r15
mov    %r15,%rcx
xor    %eax,%eax
call   1080 <snprintf@plt>
movb   $0x0,0x48f(%rsp)
mov    $0x1,%edi
call   1120 <sleep@plt>
mov    %rbx,%rdi
call   1050 <rmdir@plt>
test   %eax,%eax
jns    143f <destroy_cpuset+0x23f>
mov    0xc(%rsp),%eax
add    $0x1,%eax
cmp    $0x6,%eax
jne    1290 <destroy_cpuset+0x90>
jmp    1411 <destroy_cpuset+0x211>
mov    %r13,%rdi
call   1060 <strlen@plt>
mov    %r15d,%edi
mov    %r13,%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
lea    0x8(%rsp),%rdx
call   1090 <fscanf@plt>
cmp    $0x1,%eax
jne    131e <destroy_cpuset+0x11e>
mov    0x8(%rsp),%edx
mov    %r13,%rdi
mov    %r12,%rsi
call   1110 <sprintf@plt>
test   %r14d,%r14d
je     1390 <destroy_cpuset+0x190>
mov    0x8(%rsp),%esi
lea    0xc71(%rip),%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1070 <printf@plt>
jmp    1390 <destroy_cpuset+0x190>
lea    0xc4c(%rip),%rbx
lea    0xc32(%rip),%rsi
jmp    141f <destroy_cpuset+0x21f>
mov    %rbp,%rdi
call   1040 <fclose@plt>
lea    0xc35(%rip),%rbx
lea    0xc1a(%rip),%rsi
jmp    141f <destroy_cpuset+0x21f>
lea    0xc4b(%rip),%rsi
lea    0xc59(%rip),%rbx
mov    0x2bba(%rip),%rax
mov    (%rax),%edi
lea    0x90(%rsp),%rdx
xor    %eax,%eax
call   10c0 <fprintf@plt>
mov    %rbx,%rdi
call   1100 <perror@plt>
add    $0x498,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [13 x i8] c"Removing %s\0A\00"
@.str.1 = [6 x i8] c"%s/%s\00"
@.str.2 = [22 x i8] c"/sys/fs/cgroup/cpuset\00"
@.str.3 = [7 x i8] c"/tasks\00"
@.str.4 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.5 = [19 x i8] c"Failed opening %s\0A\00"
@.str.6 = [6 x i8] c"fopen\00"
@.str.7 = [9 x i8] c"%s/tasks\00"
@O_WRONLY = global i32 0
@.str.8 = [5 x i8] c"open\00"
@.str.9 = [3 x i8] c"%d\00"
@.str.10 = [21 x i8] c"Moving %d out of %s\0A\00"
@.str.11 = [21 x i8] c"Failed to remove %s\0A\00"
@.str.12 = [6 x i8] c"rmdir\00"
@.str.13 = [14 x i8] c"Trying again\0A\00"
define void @destroy_cpuset(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca %struct.stat
%6 = alloca [1024 x i8]
%7 = alloca [100 x i8]
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 0, i32* %12
%13 = load i8*, i8** %3
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%16 = load i8*, i8** %3
%17 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %15, i32 1023, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %16)
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 1023
store i8 0, i8* %18
%19 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%20 = call i32 @stat(i8* %19, %struct.stat* %5)
store i32 %20, i32* %10
%21 = load i32, i32* %10
%22 = icmp slt i32 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %2
br label %104
24: ; preds = %2
br label %25
25: ; preds = %100, %91, %24
%26 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%27 = call i32 @strncat(i8* %26, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 1023)
%28 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%29 = call i32* @fopen(i8* %28, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %29, i32** %8
%30 = icmp eq i32* %29, null
br i1 %30, label %31, label %36
31: ; preds = %25
%32 = load i32, i32* @stderr
%33 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%34 = call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* %33)
%35 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
br label %104
36: ; preds = %25
%37 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%38 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %37, i32 1023, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%39 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 1023
store i8 0, i8* %39
%40 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%41 = load i32, i32* @O_WRONLY
%42 = call i32 @open(i8* %40, i32 %41)
store i32 %42, i32* %11
%43 = load i32, i32* %11
%44 = icmp slt i32 %43, 0
br i1 %44, label %45, label %52
45: ; preds = %36
%46 = load i32*, i32** %8
%47 = call i32 @fclose(i32* %46)
%48 = load i32, i32* @stderr
%49 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%50 = call i32 (i32, i8*, ...) @fprintf(i32 %48, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* %49)
%51 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
br label %104
52: ; preds = %36
br label %53
53: ; preds = %67, %52
%54 = load i32*, i32** %8
%55 = call i32 @fscanf(i32* %54, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32* %9)
%56 = icmp eq i32 %55, 1
br i1 %56, label %57, label %73
57: ; preds = %53
%58 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%59 = load i32, i32* %9
%60 = call i32 @sprintf(i8* %58, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32 %59)
%61 = load i32, i32* %4
%62 = icmp ne i32 %61, 0
br i1 %62, label %63, label %67
63: ; preds = %57
%64 = load i32, i32* %9
%65 = load i8*, i8** %3
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0), i32 %64, i8* %65)
br label %67
67: ; preds = %63, %57
%68 = load i32, i32* %11
%69 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%70 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%71 = call i32 @strlen(i8* %70)
%72 = call i32 @write(i32 %68, i8* %69, i32 %71)
br label %53
73: ; preds = %53
%74 = load i32*, i32** %8
%75 = call i32 @fclose(i32* %74)
%76 = load i32, i32* %11
%77 = call i32 @close(i32 %76)
%78 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%79 = load i8*, i8** %3
%80 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %78, i32 1023, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %79)
%81 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 1023
store i8 0, i8* %81
%82 = call i32 @sleep(i32 1)
%83 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%84 = call i32 @rmdir(i8* %83)
store i32 %84, i32* %10
%85 = load i32, i32* %10
%86 = icmp slt i32 %85, 0
br i1 %86, label %87, label %104
87: ; preds = %73
%88 = load i32, i32* %12
%89 = add nsw i32 %88, 1
store i32 %89, i32* %12
%90 = icmp slt i32 %88, 5
br i1 %90, label %91, label %92
91: ; preds = %87
br label %25
92: ; preds = %87
%93 = load i32, i32* @stderr
%94 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%95 = call i32 (i32, i8*, ...) @fprintf(i32 %93, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i64 0, i64 0), i8* %94)
%96 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0))
%97 = load i32, i32* %12
%98 = add nsw i32 %97, 1
store i32 %98, i32* %12
%99 = icmp slt i32 %97, 5
br i1 %99, label %100, label %103
100: ; preds = %92
%101 = load i32, i32* @stderr
%102 = call i32 (i32, i8*, ...) @fprintf(i32 %101, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.13, i64 0, i64 0))
br label %25
103: ; preds = %92
br label %104
104: ; preds = %23, %31, %45, %103, %73
ret void
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [13 x i8] c"Removing %s\0A\00"
@.str.1 = [6 x i8] c"%s/%s\00"
@.str.2 = [22 x i8] c"/sys/fs/cgroup/cpuset\00"
@.str.3 = [7 x i8] c"/tasks\00"
@.str.4 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.5 = [19 x i8] c"Failed opening %s\0A\00"
@.str.6 = [6 x i8] c"fopen\00"
@.str.7 = [9 x i8] c"%s/tasks\00"
@O_WRONLY = global i32 0
@.str.8 = [5 x i8] c"open\00"
@.str.9 = [3 x i8] c"%d\00"
@.str.10 = [21 x i8] c"Moving %d out of %s\0A\00"
@.str.11 = [21 x i8] c"Failed to remove %s\0A\00"
@.str.12 = [6 x i8] c"rmdir\00"
define void @destroy_cpuset(i8* %0, i32 %1) {
%3 = alloca %struct.stat
%4 = alloca [1024 x i8]
%5 = alloca [100 x i8]
%6 = alloca i32
%7 = bitcast %struct.stat* %3 to i8*
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%10 = bitcast i32* %6 to i8*
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %0)
%12 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %8, i32 1023, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 1023
store i8 0, i8* %13
%14 = call i32 @stat(i8* %8, %struct.stat* %3)
%15 = icmp slt i32 %14, 0
br i1 %15, label %60, label %16
16: ; preds = %2
%17 = icmp eq i32 %1, 0
br label %18
18: ; preds = %16, %51
%19 = phi i32 [ %52, %51 ], [ 0, %16 ]
%20 = call i32 @strncat(i8* %8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 1023)
%21 = call i32* @fopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%22 = icmp eq i32* %21, null
br i1 %22, label %54, label %23
23: ; preds = %18
%24 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %8, i32 1023, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
store i8 0, i8* %13
%25 = load i32, i32* @O_WRONLY
%26 = call i32 @open(i8* %8, i32 %25)
%27 = icmp slt i32 %26, 0
br i1 %27, label %31, label %28
28: ; preds = %23
%29 = call i32 @fscanf(i32* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32* %6)
%30 = icmp eq i32 %29, 1
br i1 %30, label %33, label %44
31: ; preds = %23
%32 = call i32 @fclose(i32* %21)
br label %54
33: ; preds = %28, %39
%34 = load i32, i32* %6
%35 = call i32 @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32 %34)
br i1 %17, label %39, label %36
36: ; preds = %33
%37 = load i32, i32* %6
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0), i32 %37, i8* %0)
br label %39
39: ; preds = %36, %33
%40 = call i32 @strlen(i8* %9)
%41 = call i32 @write(i32 %26, i8* %9, i32 %40)
%42 = call i32 @fscanf(i32* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32* %6)
%43 = icmp eq i32 %42, 1
br i1 %43, label %33, label %44
44: ; preds = %39, %28
%45 = call i32 @fclose(i32* %21)
%46 = call i32 @close(i32 %26)
%47 = call i32 (i8*, i32, i8*, i8*, ...) @snprintf(i8* %8, i32 1023, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %0)
store i8 0, i8* %13
%48 = call i32 @sleep(i32 1)
%49 = call i32 @rmdir(i8* %8)
%50 = icmp slt i32 %49, 0
br i1 %50, label %51, label %60
51: ; preds = %44
%52 = add nuw nsw i32 %19, 1
%53 = icmp eq i32 %52, 6
br i1 %53, label %54, label %18
54: ; preds = %51, %18, %31
%55 = phi i8* [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), %31 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), %18 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i64 0, i64 0), %51 ]
%56 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), %31 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), %18 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), %51 ]
%57 = load i32, i32* @stderr
%58 = call i32 (i32, i8*, ...) @fprintf(i32 %57, i8* %55, i8* %8)
%59 = call i32 @perror(i8* %56)
br label %60
60: ; preds = %44, %54, %2
ret void
}