#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 */
typedef int /*<<< orphan*/ buff;

/* Variables and functions */
int /*<<< orphan*/ AF_UNIX;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fork();
int /*<<< orphan*/ memset(char *, char, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int read(int, char *, int);
int snprintf(char *, int, char *, int);
scalar_t__ socketpair(int /*<<< orphan*/, int /*<<< orphan*/,
                      int /*<<< orphan*/, int *);
int strlen(char *);
scalar_t__ wait();
int /*<<< orphan*/ write(int, char *, int);
int main() {
  int pair[2];
  char buff[32];
  int len;
  memset(buff, ' ', sizeof(buff));
  if (socketpair(AF_UNIX, SOCK_STREAM, 0, pair) < 0) {
    perror("socketpair");
    return 1;
  }
  if (!fork()) {
    printf("Collector started\n");
    close(pair[0]);
    while ((len = read(pair[1], buff, sizeof(buff))) > 0) {
      buff[len] = 0;
      printf("collected: %s\n", buff);
    }
    exit(0);
  }
  for (int i = 0; i < 5; i++) {
    if (!fork()) {
      int len = snprintf(buff, sizeof(buff), "%d Hello", i);
      write(pair[1], buff, 32);
      exit(0);
    }
  }
  close(pair[1]);
  int remaining = 5;
  while (remaining && (len = read(pair[0], buff, sizeof(buff))) > 0) {
    for (int i = 0; i < strlen(buff); i++) {
      if (buff[i] > 'a' && buff[i] < 'z') {
        buff[i] += 'Z' - 'z';
      }
    }
    write(pair[0], buff, len);
    remaining--;
  }
  close(pair[0]);
  close(pair[1]);
  printf("finished\n");
  while (wait() > 0)
    ;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x20,%edx
mov    %edx,%esi
call   1070 <memset@plt>
mov    0x2e02(%rip),%rax
mov    (%rax),%edi
mov    0x2de9(%rip),%rax
mov    (%rax),%esi
lea    -0xc(%rbp),%rcx
xor    %edx,%edx
call   10a0 <socketpair@plt>
cmp    $0x0,%rax
jge    121e <main+0x5e>
lea    0xdf3(%rip),%rdi
call   10b0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    13fc <main+0x23c>
mov    $0x0,%al
call   10e0 <fork@plt>
cmp    $0x0,%eax
jne    1288 <main+0xc8>
lea    0xdd6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc(%rbp),%edi
call   1080 <close@plt>
mov    -0x8(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0x20,%edx
call   1090 <read@plt>
mov    %eax,-0x34(%rbp)
cmp    $0x0,%eax
jle    1281 <main+0xc1>
movslq -0x34(%rbp),%rax
movb   $0x0,-0x30(%rbp,%rax,1)
lea    -0x30(%rbp),%rsi
lea    0xda9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1244 <main+0x84>
xor    %edi,%edi
call   10c0 <exit@plt>
movl   $0x0,-0x38(%rbp)
cmpl   $0x5,-0x38(%rbp)
jge    12ef <main+0x12f>
mov    $0x0,%al
call   10e0 <fork@plt>
cmp    $0x0,%eax
jne    12dc <main+0x11c>
lea    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%ecx
mov    $0x20,%esi
lea    0xd71(%rip),%rdx
call   1060 <snprintf@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0x20,%edx
call   1030 <write@plt>
xor    %edi,%edi
call   10c0 <exit@plt>
jmp    12e1 <main+0x121>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    128f <main+0xcf>
mov    -0x8(%rbp),%edi
call   1080 <close@plt>
movl   $0x5,-0x40(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x40(%rbp)
mov    %al,-0x45(%rbp)
je     132a <main+0x16a>
mov    -0xc(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0x20,%edx
call   1090 <read@plt>
mov    %eax,-0x34(%rbp)
cmp    $0x0,%eax
setg   %al
mov    %al,-0x45(%rbp)
mov    -0x45(%rbp),%al
test   $0x1,%al
jne    133a <main+0x17a>
jmp    13c1 <main+0x201>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    %eax,-0x4c(%rbp)
lea    -0x30(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x4c(%rbp),%eax
cmp    %ecx,%eax
jge    13a4 <main+0x1e4>
movslq -0x44(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x61,%eax
jle    1391 <main+0x1d1>
movslq -0x44(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x7a,%eax
jge    1391 <main+0x1d1>
movslq -0x44(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%ecx
add    $0xffffffe0,%ecx
mov    %cl,-0x30(%rbp,%rax,1)
jmp    1396 <main+0x1d6>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1341 <main+0x181>
mov    -0xc(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    -0x34(%rbp),%edx
call   1030 <write@plt>
mov    -0x40(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x40(%rbp)
jmp    12fe <main+0x13e>
mov    -0xc(%rbp),%edi
call   1080 <close@plt>
mov    -0x8(%rbp),%edi
call   1080 <close@plt>
lea    0xc5e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   10d0 <wait@plt>
cmp    $0x0,%rax
jle    13f5 <main+0x235>
jmp    13df <main+0x21f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x38,%rsp
lea    0x10(%rsp),%rdi
mov    $0x20,%esi
mov    $0x20,%edx
call   1080 <memset@plt>
mov    0x2df3(%rip),%rax
mov    (%rax),%edi
mov    0x2dda(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rcx
xor    %edx,%edx
call   10b0 <socketpair@plt>
test   %rax,%rax
js     1339 <main+0x169>
xor    %ebx,%ebx
xor    %eax,%eax
call   10f0 <fork@plt>
test   %eax,%eax
je     134c <main+0x17c>
xor    %eax,%eax
call   10f0 <fork@plt>
test   %eax,%eax
je     13da <main+0x20a>
xor    %eax,%eax
call   10f0 <fork@plt>
test   %eax,%eax
je     13c0 <main+0x1f0>
xor    %eax,%eax
call   10f0 <fork@plt>
test   %eax,%eax
je     13c7 <main+0x1f7>
xor    %eax,%eax
call   10f0 <fork@plt>
test   %eax,%eax
je     13ce <main+0x1fe>
xor    %eax,%eax
call   10f0 <fork@plt>
test   %eax,%eax
je     13d5 <main+0x205>
mov    0xc(%rsp),%edi
call   1090 <close@plt>
mov    $0x5,%r14d
lea    0x10(%rsp),%rbx
jmp    12a5 <main+0xd5>
nopw   0x0(%rax,%rax,1)
mov    0x8(%rsp),%edi
mov    %rbx,%rsi
mov    %r15d,%edx
call   1040 <write@plt>
add    $0xffffffff,%r14d
je     12f8 <main+0x128>
mov    0x8(%rsp),%edi
mov    %rbx,%rsi
mov    $0x20,%edx
call   10a0 <read@plt>
test   %eax,%eax
jle    12f8 <main+0x128>
mov    %eax,%r15d
mov    %rbx,%rdi
call   1050 <strlen@plt>
test   %eax,%eax
jle    1290 <main+0xc0>
xor    %ebp,%ebp
jmp    12e3 <main+0x113>
nopl   (%rax)
add    $0x1,%rbp
mov    %rbx,%rdi
call   1050 <strlen@plt>
cltq
cmp    %rax,%rbp
jge    1290 <main+0xc0>
movzbl 0x10(%rsp,%rbp,1),%eax
lea    -0x62(%rax),%ecx
cmp    $0x17,%cl
ja     12d0 <main+0x100>
add    $0xe0,%al
mov    %al,0x10(%rsp,%rbp,1)
jmp    12d0 <main+0x100>
mov    0x8(%rsp),%edi
call   1090 <close@plt>
mov    0xc(%rsp),%edi
call   1090 <close@plt>
lea    0xd24(%rip),%rdi
call   1030 <puts@plt>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   10e0 <wait@plt>
test   %rax,%rax
jg     1320 <main+0x150>
mov    %ebx,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xcc0(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%ebx
jmp    132c <main+0x15c>
lea    0xcd0(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%rsp),%edi
call   1090 <close@plt>
mov    0xc(%rsp),%edi
lea    0x10(%rsp),%rsi
mov    $0x20,%edx
call   10a0 <read@plt>
test   %eax,%eax
jle    13b9 <main+0x1e9>
lea    0xc8c(%rip),%rbx
lea    0x10(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %eax,%eax
movb   $0x0,0x10(%rsp,%rax,1)
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0xc(%rsp),%edi
mov    %rbp,%rsi
mov    $0x20,%edx
call   10a0 <read@plt>
test   %eax,%eax
jg     1390 <main+0x1c0>
xor    %edi,%edi
call   10d0 <exit@plt>
mov    $0x1,%ebx
jmp    13da <main+0x20a>
mov    $0x2,%ebx
jmp    13da <main+0x20a>
mov    $0x3,%ebx
jmp    13da <main+0x20a>
mov    $0x4,%ebx
lea    0xc39(%rip),%rdx
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x20,%esi
mov    %ebx,%ecx
call   1070 <snprintf@plt>
mov    0xc(%rsp),%edi
mov    %rbp,%rsi
mov    $0x20,%edx
call   1040 <write@plt>
xor    %edi,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
@AF_UNIX = global i32 0
@SOCK_STREAM = global i32 0
@.str = [11 x i8] c"socketpair\00"
@.str.1 = [19 x i8] c"Collector started\0A\00"
@.str.2 = [15 x i8] c"collected: %s\0A\00"
@.str.3 = [9 x i8] c"%d Hello\00"
@.str.4 = [10 x i8] c"finished\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x i32]
%3 = alloca [32 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%10 = call i32 @memset(i8* %9, i8 signext 32, i32 32)
%11 = load i32, i32* @AF_UNIX
%12 = load i32, i32* @SOCK_STREAM
%13 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%14 = call i64 @socketpair(i32 %11, i32 %12, i32 0, i32* %13)
%15 = icmp slt i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %0
%17 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %1
br label %128
18: ; preds = %0
%19 = call i32 (...) @fork()
%20 = icmp ne i32 %19, 0
br i1 %20, label %40, label %21
21: ; preds = %18
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%23 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%24 = load i32, i32* %23
%25 = call i32 @close(i32 %24)
br label %26
26: ; preds = %32, %21
%27 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%28 = load i32, i32* %27
%29 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%30 = call i32 @read(i32 %28, i8* %29, i32 32)
store i32 %30, i32* %4
%31 = icmp sgt i32 %30, 0
br i1 %31, label %32, label %38
32: ; preds = %26
%33 = load i32, i32* %4
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 %34
store i8 0, i8* %35
%36 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %36)
br label %26
38: ; preds = %26
%39 = call i32 @exit(i32 0)
unreachable
40: ; preds = %18
store i32 0, i32* %5
br label %41
41: ; preds = %57, %40
%42 = load i32, i32* %5
%43 = icmp slt i32 %42, 5
br i1 %43, label %44, label %60
44: ; preds = %41
%45 = call i32 (...) @fork()
%46 = icmp ne i32 %45, 0
br i1 %46, label %56, label %47
47: ; preds = %44
%48 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%49 = load i32, i32* %5
%50 = call i32 @snprintf(i8* %48, i32 32, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %49)
store i32 %50, i32* %6
%51 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%52 = load i32, i32* %51
%53 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%54 = call i32 @write(i32 %52, i8* %53, i32 32)
%55 = call i32 @exit(i32 0)
unreachable
56: ; preds = %44
br label %57
57: ; preds = %56
%58 = load i32, i32* %5
%59 = add nsw i32 %58, 1
store i32 %59, i32* %5
br label %41
60: ; preds = %41
%61 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%62 = load i32, i32* %61
%63 = call i32 @close(i32 %62)
store i32 5, i32* %7
br label %64
64: ; preds = %107, %60
%65 = load i32, i32* %7
%66 = icmp ne i32 %65, 0
br i1 %66, label %67, label %73
67: ; preds = %64
%68 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%69 = load i32, i32* %68
%70 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%71 = call i32 @read(i32 %69, i8* %70, i32 32)
store i32 %71, i32* %4
%72 = icmp sgt i32 %71, 0
br label %73
73: ; preds = %67, %64
%74 = phi i1 [ false, %64 ], [ %72, %67 ]
br i1 %74, label %75, label %115
75: ; preds = %73
store i32 0, i32* %8
br label %76
76: ; preds = %104, %75
%77 = load i32, i32* %8
%78 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%79 = call i32 @strlen(i8* %78)
%80 = icmp slt i32 %77, %79
br i1 %80, label %81, label %107
81: ; preds = %76
%82 = load i32, i32* %8
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 %83
%85 = load i8, i8* %84
%86 = sext i8 %85 to i32
%87 = icmp sgt i32 %86, 97
br i1 %87, label %88, label %103
88: ; preds = %81
%89 = load i32, i32* %8
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 %90
%92 = load i8, i8* %91
%93 = sext i8 %92 to i32
%94 = icmp slt i32 %93, 122
br i1 %94, label %95, label %103
95: ; preds = %88
%96 = load i32, i32* %8
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 %97
%99 = load i8, i8* %98
%100 = sext i8 %99 to i32
%101 = add nsw i32 %100, -32
%102 = trunc i32 %101 to i8
store i8 %102, i8* %98
br label %103
103: ; preds = %95, %88, %81
br label %104
104: ; preds = %103
%105 = load i32, i32* %8
%106 = add nsw i32 %105, 1
store i32 %106, i32* %8
br label %76
107: ; preds = %76
%108 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%109 = load i32, i32* %108
%110 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%111 = load i32, i32* %4
%112 = call i32 @write(i32 %109, i8* %110, i32 %111)
%113 = load i32, i32* %7
%114 = add nsw i32 %113, -1
store i32 %114, i32* %7
br label %64
115: ; preds = %73
%116 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%117 = load i32, i32* %116
%118 = call i32 @close(i32 %117)
%119 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%120 = load i32, i32* %119
%121 = call i32 @close(i32 %120)
%122 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
br label %123
123: ; preds = %126, %115
%124 = call i64 (...) @wait()
%125 = icmp sgt i64 %124, 0
br i1 %125, label %126, label %127
126: ; preds = %123
br label %123
127: ; preds = %123
store i32 0, i32* %1
br label %128
128: ; preds = %127, %16
%129 = load i32, i32* %1
ret i32 %129
}

LLVM IR (-O2):
@AF_UNIX = global i32 0
@SOCK_STREAM = global i32 0
@.str = [11 x i8] c"socketpair\00"
@.str.2 = [15 x i8] c"collected: %s\0A\00"
@.str.3 = [9 x i8] c"%d Hello\00"
@str = [18 x i8] c"Collector started\00"
@str.5 = [9 x i8] c"finished\00"
define i32 @main() {
%1 = alloca [2 x i32]
%2 = alloca [32 x i8]
%3 = bitcast [2 x i32]* %1 to i8*
%4 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%5 = call i32 @memset(i8* %4, i8 signext 32, i32 32)
%6 = load i32, i32* @AF_UNIX
%7 = load i32, i32* @SOCK_STREAM
%8 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
%9 = call i64 @socketpair(i32 %6, i32 %7, i32 0, i32* %8)
%10 = icmp slt i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %95
13: ; preds = %0
%14 = call i32 (...) @fork()
%15 = icmp eq i32 %14, 0
br i1 %15, label %19, label %16
16: ; preds = %13
%17 = call i32 (...) @fork()
%18 = icmp eq i32 %17, 0
br i1 %18, label %37, label %44
19: ; preds = %13
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%21 = load i32, i32* %8
%22 = call i32 @close(i32 %21)
%23 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 1
%24 = load i32, i32* %23
%25 = call i32 @read(i32 %24, i8* %4, i32 32)
%26 = icmp sgt i32 %25, 0
br i1 %26, label %27, label %35
27: ; preds = %19, %27
%28 = phi i32 [ %33, %27 ], [ %25, %19 ]
%29 = zext i32 %28 to i64
%30 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 %29
store i8 0, i8* %30
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%32 = load i32, i32* %23
%33 = call i32 @read(i32 %32, i8* %4, i32 32)
%34 = icmp sgt i32 %33, 0
br i1 %34, label %27, label %35
35: ; preds = %27, %19
%36 = call i32 @exit(i32 0)
unreachable
37: ; preds = %53, %50, %47, %44, %16
%38 = phi i32 [ 0, %16 ], [ 1, %44 ], [ 2, %47 ], [ 3, %50 ], [ 4, %53 ]
%39 = call i32 @snprintf(i8* %4, i32 32, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %38)
%40 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 1
%41 = load i32, i32* %40
%42 = call i32 @write(i32 %41, i8* %4, i32 32)
%43 = call i32 @exit(i32 0)
unreachable
44: ; preds = %16
%45 = call i32 (...) @fork()
%46 = icmp eq i32 %45, 0
br i1 %46, label %37, label %47
47: ; preds = %44
%48 = call i32 (...) @fork()
%49 = icmp eq i32 %48, 0
br i1 %49, label %37, label %50
50: ; preds = %47
%51 = call i32 (...) @fork()
%52 = icmp eq i32 %51, 0
br i1 %52, label %37, label %53
53: ; preds = %50
%54 = call i32 (...) @fork()
%55 = icmp eq i32 %54, 0
br i1 %55, label %37, label %56
56: ; preds = %53
%57 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 1
%58 = load i32, i32* %57
%59 = call i32 @close(i32 %58)
br label %60
60: ; preds = %56, %68
%61 = phi i32 [ 5, %56 ], [ %71, %68 ]
%62 = load i32, i32* %8
%63 = call i32 @read(i32 %62, i8* %4, i32 32)
%64 = icmp sgt i32 %63, 0
br i1 %64, label %65, label %86
65: ; preds = %60
%66 = call i32 @strlen(i8* %4)
%67 = icmp sgt i32 %66, 0
br i1 %67, label %73, label %68
68: ; preds = %81, %65
%69 = load i32, i32* %8
%70 = call i32 @write(i32 %69, i8* %4, i32 %63)
%71 = add nsw i32 %61, -1
%72 = icmp eq i32 %71, 0
br i1 %72, label %86, label %60
73: ; preds = %65, %81
%74 = phi i64 [ %82, %81 ], [ 0, %65 ]
%75 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 %74
%76 = load i8, i8* %75
%77 = add i8 %76, -98
%78 = icmp ult i8 %77, 24
br i1 %78, label %79, label %81
79: ; preds = %73
%80 = add nsw i8 %76, -32
store i8 %80, i8* %75
br label %81
81: ; preds = %73, %79
%82 = add nuw nsw i64 %74, 1
%83 = call i32 @strlen(i8* %4)
%84 = sext i32 %83 to i64
%85 = icmp slt i64 %82, %84
br i1 %85, label %73, label %68
86: ; preds = %68, %60
%87 = load i32, i32* %8
%88 = call i32 @close(i32 %87)
%89 = load i32, i32* %57
%90 = call i32 @close(i32 %89)
%91 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.5, i64 0, i64 0))
br label %92
92: ; preds = %92, %86
%93 = call i64 (...) @wait()
%94 = icmp sgt i64 %93, 0
br i1 %94, label %92, label %95
95: ; preds = %92, %11
%96 = phi i32 [ 1, %11 ], [ 0, %92 ]
ret i32 %96
}