#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 timespec {
  int tv_nsec;
  scalar_t__ tv_sec;
};
typedef int pid_t;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int PATH_MAX;
int /*<<< orphan*/ PR_SET_NAME;
scalar_t__ chdir(char *);
int /*<<< orphan*/ err(int, char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int fork();
int /*<<< orphan*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ nanosleep(struct timespec *, int /*<<< orphan*/ *);
int /*<<< orphan*/ prctl(int /*<<< orphan*/, unsigned long, int /*<<< orphan*/,
                         int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ setsid();
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ sprintf(char *, char *, unsigned long);
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int /*<<< orphan*/ unlink(char *);
int main(int argc, char *argv[]) {
  char executable[PATH_MAX];
  char temp[16];
  pid_t cpid;
  int len, nlen;
  int count = 4;
  int i, k;
  char *p;
  struct timespec wtime, ptime;
  wtime.tv_sec = 0;
  wtime.tv_nsec = 1000000;
  ptime.tv_sec = 0;
  ptime.tv_nsec = 50000000;
  while ((cpid = fork()) == -1)
    sleep(1);
  if (cpid > 0)
    exit(EXIT_SUCCESS);
  len = strlen(argv[0]);
  strncpy(executable, argv[0], len);
  unlink(executable);
  if (chdir("/") < 0)
    err(1, "chdir");
  while (count--) {
    while ((cpid = fork()) == -1)
      nanosleep(&wtime, NULL);
    if (cpid > 0) {
      if (count == 0)
        exit(EXIT_SUCCESS);
      else
        continue;
    }
    setsid();
    if ((p = malloc(sizeof(char))) == NULL)
      exit(EXIT_FAILURE);
    sprintf(temp, "%lx", (long unsigned int)p);
    nlen = strlen(temp) - 4;
    free(p);
    char next[256];
    for (i = 0, k = count; i < len; i++, k++) {
      if (k >= nlen)
        k = 0;
      next[i] = temp[k];
    }
    next[i] = '\0';
    strncpy(argv[0], next, len);
    prctl(PR_SET_NAME, (unsigned long)next, 0, 0, 0);
    if (count == 0)
      count = 4;
    nanosleep(&ptime, NULL);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x180,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2df0(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x178(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
movl   $0x4,-0x40(%rbp)
movq   $0x0,-0x58(%rbp)
movl   $0xf4240,-0x60(%rbp)
movq   $0x0,-0x68(%rbp)
movl   $0x2faf080,-0x70(%rbp)
mov    $0x0,%al
call   1100 <fork@plt>
mov    %eax,-0x34(%rbp)
cmp    $0xffffffff,%eax
jne    126f <main+0x8f>
mov    $0x1,%edi
call   10f0 <sleep@plt>
jmp    124d <main+0x6d>
cmpl   $0x0,-0x34(%rbp)
jle    1287 <main+0xa7>
mov    0x2d48(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <strlen@plt>
mov    -0x178(%rbp),%rdi
mov    %eax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    -0x38(%rbp),%edx
call   1050 <strncpy@plt>
mov    -0x178(%rbp),%rdi
call   1040 <unlink@plt>
lea    0xd41(%rip),%rdi
call   1070 <chdir@plt>
cmp    $0x0,%rax
jge    12df <main+0xff>
mov    $0x1,%edi
lea    0xd28(%rip),%rsi
call   10b0 <err@plt>
jmp    12e4 <main+0x104>
mov    -0x40(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x40(%rbp)
cmp    $0x0,%eax
je     145b <main+0x27b>
jmp    12fd <main+0x11d>
mov    $0x0,%al
call   1100 <fork@plt>
mov    %eax,-0x34(%rbp)
cmp    $0xffffffff,%eax
jne    1322 <main+0x142>
lea    -0x60(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1080 <nanosleep@plt>
jmp    12fd <main+0x11d>
cmpl   $0x0,-0x34(%rbp)
jle    1349 <main+0x169>
cmpl   $0x0,-0x40(%rbp)
jne    1344 <main+0x164>
mov    0x2c8b(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
jmp    12e4 <main+0x104>
mov    $0x0,%al
call   1090 <setsid@plt>
mov    $0x1,%edi
call   10c0 <malloc@plt>
mov    %rax,-0x50(%rbp)
cmp    $0x0,%rax
jne    1376 <main+0x196>
mov    0x2c61(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
lea    -0x30(%rbp),%rdi
mov    -0x50(%rbp),%rdx
lea    0xc83(%rip),%rsi
call   10d0 <sprintf@plt>
lea    -0x30(%rbp),%rdi
call   1060 <strlen@plt>
sub    $0x4,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x44(%rbp)
mov    -0x40(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x38(%rbp),%eax
jge    13f8 <main+0x218>
mov    -0x48(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jl     13ce <main+0x1ee>
movl   $0x0,-0x48(%rbp)
movslq -0x48(%rbp),%rax
mov    -0x30(%rbp,%rax,1),%cl
movslq -0x44(%rbp),%rax
mov    %cl,-0x170(%rbp,%rax,1)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    13af <main+0x1cf>
movslq -0x44(%rbp),%rax
movb   $0x0,-0x170(%rbp,%rax,1)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    -0x170(%rbp),%rsi
mov    -0x38(%rbp),%edx
call   1050 <strncpy@plt>
mov    0x2bb7(%rip),%rax
mov    (%rax),%edi
lea    -0x170(%rbp),%rsi
xor    %r8d,%r8d
mov    %r8d,%edx
mov    %r8d,%ecx
call   10a0 <prctl@plt>
cmpl   $0x0,-0x40(%rbp)
jne    1449 <main+0x269>
movl   $0x4,-0x40(%rbp)
lea    -0x70(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1080 <nanosleep@plt>
jmp    12e4 <main+0x104>
movl   $0x0,-0x4(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x148,%rsp
mov    %rsi,-0x30(%rbp)
mov    0x2df1(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
movq   $0x0,-0x68(%rbp)
movl   $0xf4240,-0x70(%rbp)
movq   $0x0,-0x58(%rbp)
movl   $0x2faf080,-0x60(%rbp)
xor    %eax,%eax
call   1100 <fork@plt>
cmp    $0xffffffff,%eax
jne    1248 <main+0x68>
mov    $0x1,%edi
call   10f0 <sleep@plt>
jmp    1230 <main+0x50>
test   %eax,%eax
jle    125a <main+0x7a>
mov    0x2d75(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
mov    -0x30(%rbp),%r14
mov    (%r14),%rdi
call   1060 <strlen@plt>
mov    %eax,%r15d
mov    (%r14),%rsi
mov    %rbx,%rdi
mov    %eax,%edx
call   1050 <strncpy@plt>
mov    %rbx,%rdi
call   1040 <unlink@plt>
lea    0xd7b(%rip),%rdi
call   1070 <chdir@plt>
test   %rax,%rax
jns    12a0 <main+0xc0>
lea    0xd6c(%rip),%rsi
mov    $0x1,%edi
call   10b0 <err@plt>
mov    %r15d,%eax
mov    %rax,-0x50(%rbp)
and    $0xfffffffe,%eax
mov    %rax,-0x48(%rbp)
lea    -0x70(%rbp),%rbx
mov    $0x4,%r12d
jmp    12ca <main+0xea>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
xor    %esi,%esi
call   1080 <nanosleep@plt>
xor    %eax,%eax
call   1100 <fork@plt>
cmp    $0xffffffff,%eax
je     12c0 <main+0xe0>
add    $0xffffffff,%r12d
test   %eax,%eax
jle    12e8 <main+0x108>
test   %r12d,%r12d
jne    12ca <main+0xea>
jmp    124c <main+0x6c>
xor    %eax,%eax
call   1090 <setsid@plt>
mov    $0x1,%edi
call   10c0 <malloc@plt>
test   %rax,%rax
je     13ff <main+0x21f>
mov    %rax,%r13
lea    -0x40(%rbp),%r14
mov    %r14,%rdi
lea    0xcf5(%rip),%rsi
mov    %rax,%rdx
call   10d0 <sprintf@plt>
mov    %r14,%rdi
call   1060 <strlen@plt>
mov    %eax,%r14d
mov    %r13,%rdi
call   1030 <free@plt>
test   %r15d,%r15d
jle    13ad <main+0x1cd>
add    $0xfffffffc,%r14d
xor    %eax,%eax
mov    %r12d,%ecx
cmp    $0x1,%r15d
je     1389 <main+0x1a9>
mov    -0x48(%rbp),%rsi
xor    %edi,%edi
nopl   0x0(%rax)
cmp    %r14d,%ecx
cmovge %edi,%ecx
movslq %ecx,%rcx
movzbl -0x40(%rbp,%rcx,1),%edx
mov    %dl,-0x170(%rbp,%rax,1)
add    $0x1,%ecx
cmp    %r14d,%ecx
cmovge %edi,%ecx
movslq %ecx,%rcx
movzbl -0x40(%rbp,%rcx,1),%edx
mov    %dl,-0x16f(%rbp,%rax,1)
add    $0x2,%rax
add    $0x1,%ecx
cmp    %rax,%rsi
jne    1350 <main+0x170>
xor    %esi,%esi
mov    %r15d,%edx
testb  $0x1,-0x50(%rbp)
je     13af <main+0x1cf>
cmp    %r14d,%ecx
cmovge %esi,%ecx
movslq %ecx,%rcx
mov    -0x40(%rbp,%rcx,1),%cl
mov    %cl,-0x170(%rbp,%rax,1)
mov    %r15d,%edx
jmp    13af <main+0x1cf>
xor    %edx,%edx
mov    %edx,%eax
movb   $0x0,-0x170(%rbp,%rax,1)
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
lea    -0x170(%rbp),%r14
mov    %r14,%rsi
mov    %r15d,%edx
call   1050 <strncpy@plt>
mov    0x2bff(%rip),%rax
mov    (%rax),%edi
mov    %r14,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   10a0 <prctl@plt>
test   %r12d,%r12d
mov    $0x4,%eax
cmove  %eax,%r12d
lea    -0x60(%rbp),%rdi
jmp    12c3 <main+0xe3>
mov    0x2bca(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
%struct.timespec = type { i32, i64 }
@PATH_MAX = global i32 0
@EXIT_SUCCESS = global i32 0
@.str = [2 x i8] c"/\00"
@.str.1 = [6 x i8] c"chdir\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [4 x i8] c"%lx\00"
@PR_SET_NAME = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i64
%8 = alloca [16 x i8]
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i8*
%16 = alloca %struct.timespec
%17 = alloca %struct.timespec
%18 = alloca [256 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%19 = load i32, i32* @PATH_MAX
%20 = zext i32 %19 to i64
%21 = call i8* @llvm.stacksave()
store i8* %21, i8** %6
%22 = alloca i8, i64 %20
store i64 %20, i64* %7
store i32 4, i32* %12
%23 = getelementptr inbounds %struct.timespec, %struct.timespec* %16, i32 0, i32 1
store i64 0, i64* %23
%24 = getelementptr inbounds %struct.timespec, %struct.timespec* %16, i32 0, i32 0
store i32 1000000, i32* %24
%25 = getelementptr inbounds %struct.timespec, %struct.timespec* %17, i32 0, i32 1
store i64 0, i64* %25
%26 = getelementptr inbounds %struct.timespec, %struct.timespec* %17, i32 0, i32 0
store i32 50000000, i32* %26
br label %27
27: ; preds = %30, %2
%28 = call i32 (...) @fork()
store i32 %28, i32* %9
%29 = icmp eq i32 %28, -1
br i1 %29, label %30, label %32
30: ; preds = %27
%31 = call i32 @sleep(i32 1)
br label %27
32: ; preds = %27
%33 = load i32, i32* %9
%34 = icmp sgt i32 %33, 0
br i1 %34, label %35, label %38
35: ; preds = %32
%36 = load i32, i32* @EXIT_SUCCESS
%37 = call i32 @exit(i32 %36)
unreachable
38: ; preds = %32
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 0
%41 = load i8*, i8** %40
%42 = call i32 @strlen(i8* %41)
store i32 %42, i32* %10
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 0
%45 = load i8*, i8** %44
%46 = load i32, i32* %10
%47 = call i32 @strncpy(i8* %22, i8* %45, i32 %46)
%48 = call i32 @unlink(i8* %22)
%49 = call i64 @chdir(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%50 = icmp slt i64 %49, 0
br i1 %50, label %51, label %53
51: ; preds = %38
%52 = call i32 @err(i32 1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %53
53: ; preds = %51, %38
br label %54
54: ; preds = %131, %73, %53
%55 = load i32, i32* %12
%56 = add nsw i32 %55, -1
store i32 %56, i32* %12
%57 = icmp ne i32 %55, 0
br i1 %57, label %58, label %133
58: ; preds = %54
br label %59
59: ; preds = %62, %58
%60 = call i32 (...) @fork()
store i32 %60, i32* %9
%61 = icmp eq i32 %60, -1
br i1 %61, label %62, label %64
62: ; preds = %59
%63 = call i32 @nanosleep(%struct.timespec* %16, i32* null)
br label %59
64: ; preds = %59
%65 = load i32, i32* %9
%66 = icmp sgt i32 %65, 0
br i1 %66, label %67, label %74
67: ; preds = %64
%68 = load i32, i32* %12
%69 = icmp eq i32 %68, 0
br i1 %69, label %70, label %73
70: ; preds = %67
%71 = load i32, i32* @EXIT_SUCCESS
%72 = call i32 @exit(i32 %71)
unreachable
73: ; preds = %67
br label %54
74: ; preds = %64
%75 = call i32 (...) @setsid()
%76 = call i8* @malloc(i32 1)
store i8* %76, i8** %15
%77 = icmp eq i8* %76, null
br i1 %77, label %78, label %81
78: ; preds = %74
%79 = load i32, i32* @EXIT_FAILURE
%80 = call i32 @exit(i32 %79)
unreachable
81: ; preds = %74
%82 = getelementptr inbounds [16 x i8], [16 x i8]* %8, i64 0, i64 0
%83 = load i8*, i8** %15
%84 = ptrtoint i8* %83 to i64
%85 = call i32 @sprintf(i8* %82, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i64 %84)
%86 = getelementptr inbounds [16 x i8], [16 x i8]* %8, i64 0, i64 0
%87 = call i32 @strlen(i8* %86)
%88 = sub nsw i32 %87, 4
store i32 %88, i32* %11
%89 = load i8*, i8** %15
%90 = call i32 @free(i8* %89)
store i32 0, i32* %13
%91 = load i32, i32* %12
store i32 %91, i32* %14
br label %92
92: ; preds = %109, %81
%93 = load i32, i32* %13
%94 = load i32, i32* %10
%95 = icmp slt i32 %93, %94
br i1 %95, label %96, label %114
96: ; preds = %92
%97 = load i32, i32* %14
%98 = load i32, i32* %11
%99 = icmp sge i32 %97, %98
br i1 %99, label %100, label %101
100: ; preds = %96
store i32 0, i32* %14
br label %101
101: ; preds = %100, %96
%102 = load i32, i32* %14
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds [16 x i8], [16 x i8]* %8, i64 0, i64 %103
%105 = load i8, i8* %104
%106 = load i32, i32* %13
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 %107
store i8 %105, i8* %108
br label %109
109: ; preds = %101
%110 = load i32, i32* %13
%111 = add nsw i32 %110, 1
store i32 %111, i32* %13
%112 = load i32, i32* %14
%113 = add nsw i32 %112, 1
store i32 %113, i32* %14
br label %92
114: ; preds = %92
%115 = load i32, i32* %13
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 %116
store i8 0, i8* %117
%118 = load i8**, i8*** %5
%119 = getelementptr inbounds i8*, i8** %118, i64 0
%120 = load i8*, i8** %119
%121 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 0
%122 = load i32, i32* %10
%123 = call i32 @strncpy(i8* %120, i8* %121, i32 %122)
%124 = load i32, i32* @PR_SET_NAME
%125 = getelementptr inbounds [256 x i8], [256 x i8]* %18, i64 0, i64 0
%126 = ptrtoint i8* %125 to i64
%127 = call i32 @prctl(i32 %124, i64 %126, i32 0, i32 0, i32 0)
%128 = load i32, i32* %12
%129 = icmp eq i32 %128, 0
br i1 %129, label %130, label %131
130: ; preds = %114
store i32 4, i32* %12
br label %131
131: ; preds = %130, %114
%132 = call i32 @nanosleep(%struct.timespec* %17, i32* null)
br label %54
133: ; preds = %54
store i32 0, i32* %3
%134 = load i8*, i8** %6
%135 = load i32, i32* %3
ret i32 %135
}

LLVM IR (-O2):
%struct.timespec = type { i32, i64 }
@PATH_MAX = global i32 0
@EXIT_SUCCESS = global i32 0
@.str = [2 x i8] c"/\00"
@.str.1 = [6 x i8] c"chdir\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [4 x i8] c"%lx\00"
@PR_SET_NAME = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [16 x i8]
%4 = alloca %struct.timespec
%5 = alloca %struct.timespec
%6 = alloca [256 x i8]
%7 = load i32, i32* @PATH_MAX
%8 = zext i32 %7 to i64
%9 = alloca i8, i64 %8
%10 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%11 = bitcast %struct.timespec* %4 to i8*
%12 = bitcast %struct.timespec* %5 to i8*
%13 = getelementptr inbounds %struct.timespec, %struct.timespec* %4, i64 0, i32 1
store i64 0, i64* %13
%14 = getelementptr inbounds %struct.timespec, %struct.timespec* %4, i64 0, i32 0
store i32 1000000, i32* %14
%15 = getelementptr inbounds %struct.timespec, %struct.timespec* %5, i64 0, i32 1
store i64 0, i64* %15
%16 = getelementptr inbounds %struct.timespec, %struct.timespec* %5, i64 0, i32 0
store i32 50000000, i32* %16
%17 = tail call i32 (...) @fork()
%18 = icmp eq i32 %17, -1
br i1 %18, label %19, label %23
19: ; preds = %2, %19
%20 = tail call i32 @sleep(i32 1)
%21 = tail call i32 (...) @fork()
%22 = icmp eq i32 %21, -1
br i1 %22, label %19, label %23
23: ; preds = %19, %2
%24 = phi i32 [ %17, %2 ], [ %21, %19 ]
%25 = icmp sgt i32 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %23
%27 = load i32, i32* @EXIT_SUCCESS
%28 = tail call i32 @exit(i32 %27)
unreachable
29: ; preds = %23
%30 = load i8*, i8** %1
%31 = tail call i32 @strlen(i8* %30)
%32 = load i8*, i8** %1
%33 = call i32 @strncpy(i8* %9, i8* %32, i32 %31)
%34 = call i32 @unlink(i8* %9)
%35 = call i64 @chdir(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%36 = icmp slt i64 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %29
%38 = call i32 @err(i32 1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %39
39: ; preds = %37, %29
%40 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%41 = icmp sgt i32 %31, 0
%42 = ptrtoint [256 x i8]* %6 to i64
%43 = zext i32 %31 to i64
%44 = and i64 %43, 1
%45 = icmp eq i32 %31, 1
%46 = and i64 %43, 4294967294
%47 = icmp eq i64 %44, 0
br label %48
48: ; preds = %122, %39
%49 = phi i32 [ 4, %39 ], [ %123, %122 ]
%50 = add nsw i32 %49, -1
%51 = call i32 (...) @fork()
%52 = icmp eq i32 %51, -1
br i1 %52, label %53, label %57
53: ; preds = %48, %53
%54 = call i32 @nanosleep(%struct.timespec* %4, i32* null)
%55 = call i32 (...) @fork()
%56 = icmp eq i32 %55, -1
br i1 %56, label %53, label %57
57: ; preds = %53, %48
%58 = phi i32 [ %51, %48 ], [ %55, %53 ]
%59 = icmp sgt i32 %58, 0
br i1 %59, label %60, label %65
60: ; preds = %57
%61 = icmp eq i32 %50, 0
br i1 %61, label %62, label %122
62: ; preds = %60
%63 = load i32, i32* @EXIT_SUCCESS
%64 = call i32 @exit(i32 %63)
unreachable
65: ; preds = %57
%66 = call i32 (...) @setsid()
%67 = call dereferenceable_or_null(1) i8* @malloc(i32 1)
%68 = icmp eq i8* %67, null
br i1 %68, label %69, label %72
69: ; preds = %65
%70 = load i32, i32* @EXIT_FAILURE
%71 = call i32 @exit(i32 %70)
unreachable
72: ; preds = %65
%73 = ptrtoint i8* %67 to i64
%74 = call i32 @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i64 %73)
%75 = call i32 @strlen(i8* %10)
%76 = add nsw i32 %75, -4
%77 = call i32 @free(i8* %67)
br i1 %41, label %78, label %111
78: ; preds = %72
br i1 %45, label %101, label %79
79: ; preds = %78, %79
%80 = phi i64 [ %97, %79 ], [ 0, %78 ]
%81 = phi i32 [ %98, %79 ], [ %50, %78 ]
%82 = phi i64 [ %99, %79 ], [ 0, %78 ]
%83 = icmp slt i32 %81, %76
%84 = select i1 %83, i32 %81, i32 0
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 %85
%87 = load i8, i8* %86
%88 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %80
store i8 %87, i8* %88
%89 = or i64 %80, 1
%90 = add nsw i32 %84, 1
%91 = icmp slt i32 %90, %76
%92 = select i1 %91, i32 %90, i32 0
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 %93
%95 = load i8, i8* %94
%96 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %89
store i8 %95, i8* %96
%97 = add nuw nsw i64 %80, 2
%98 = add nsw i32 %92, 1
%99 = add i64 %82, 2
%100 = icmp eq i64 %99, %46
br i1 %100, label %101, label %79
101: ; preds = %79, %78
%102 = phi i64 [ 0, %78 ], [ %97, %79 ]
%103 = phi i32 [ %50, %78 ], [ %98, %79 ]
br i1 %47, label %111, label %104
104: ; preds = %101
%105 = icmp slt i32 %103, %76
%106 = select i1 %105, i32 %103, i32 0
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 %107
%109 = load i8, i8* %108
%110 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %102
store i8 %109, i8* %110
br label %111
111: ; preds = %104, %101, %72
%112 = phi i32 [ 0, %72 ], [ %31, %101 ], [ %31, %104 ]
%113 = zext i32 %112 to i64
%114 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %113
store i8 0, i8* %114
%115 = load i8*, i8** %1
%116 = call i32 @strncpy(i8* %115, i8* %40, i32 %31)
%117 = load i32, i32* @PR_SET_NAME
%118 = call i32 @prctl(i32 %117, i64 %42, i32 0, i32 0, i32 0)
%119 = icmp eq i32 %50, 0
%120 = select i1 %119, i32 4, i32 %50
%121 = call i32 @nanosleep(%struct.timespec* %5, i32* null)
br label %122
122: ; preds = %111, %60
%123 = phi i32 [ %50, %60 ], [ %120, %111 ]
br label %48
}