#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*/ buffr2;

/* Variables and functions */
int EXIT_FAILURE;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int);
int fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int getpid();
int /*<<< orphan*/ perror(char *);
int pipe(int *);
int /*<<< orphan*/ prime(int);
int /*<<< orphan*/ printf(char *, ...);
int read(int, int *, int);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ waitpid(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ write(int, int *, int);
int main() {
  int pid, a, n, p[2], p2[2], i, buffr1[100], buffr2[100], n2 = 0;
  a = pipe(p);
  if (a == -1) {
    fprintf(stderr, "Pipe Failed.\n");
    return EXIT_FAILURE;
  }
  a = pipe(p2);
  if (a == -1) {
    fprintf(stderr, "Pipe Failed.\n");
    return EXIT_FAILURE;
  }
  pid = fork();
  switch (pid) {
  case -1:
    perror("main: fork");
    exit(1);
  case 0:
    n = read(p[0], buffr2, sizeof(buffr2));
    printf("In child process (ID: %d)\n", getpid());
    n = n / sizeof(int);
    for (i = 0; i < n; i++) {
      if (prime(buffr2[i])) {
        buffr1[n2] = buffr2[i];
        n2++;
      }
    }
    write(p2[1], buffr1, n2 * sizeof(int));
    exit(1);
    break;
  default:
    printf("In parent process (ID: %d)\n", getpid());
    printf("Number of elements:- ");
    scanf("%d", &n);
    printf("Enter the elements\n");
    for (i = 0; i < n; i++) {
      scanf("%d", &buffr1[i]);
    }
    write(p[1], buffr1, n * sizeof(int));
    waitpid(pid, NULL, 0);
    printf("In parent process (ID: %d)\n", getpid());
    n2 = read(p2[0], buffr2, sizeof(buffr2));
    n2 = n2 / sizeof(int);
    for (i = 0; i < n2; i++)
      printf("%d is prime\n", buffr2[i]);
    break;
  }
  close(p[0]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x360,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x354(%rbp)
lea    -0x18(%rbp),%rdi
call   1070 <pipe@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    1228 <main+0x58>
mov    0x2dd7(%rip),%rax
mov    (%rax),%edi
lea    0xdee(%rip),%rsi
call   1090 <fprintf@plt>
mov    0x2dba(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    14a9 <main+0x2d9>
lea    -0x20(%rbp),%rdi
call   1070 <pipe@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    1264 <main+0x94>
mov    0x2d9b(%rip),%rax
mov    (%rax),%edi
lea    0xdb2(%rip),%rsi
call   1090 <fprintf@plt>
mov    0x2d7e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    14a9 <main+0x2d9>
xor    %eax,%eax
call   10f0 <fork@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x358(%rbp)
sub    $0xffffffff,%eax
je     1298 <main+0xc8>
jmp    1285 <main+0xb5>
mov    -0x358(%rbp),%eax
test   %eax,%eax
je     12ae <main+0xde>
jmp    1374 <main+0x1a4>
lea    0xd6f(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x18(%rbp),%edi
lea    -0x350(%rbp),%rsi
mov    $0x190,%edx
call   1080 <read@plt>
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %eax,%esi
lea    0xd44(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movslq -0x10(%rbp),%rax
shr    $0x2,%rax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    134e <main+0x17e>
movslq -0x24(%rbp),%rax
mov    -0x350(%rbp,%rax,4),%edi
call   10c0 <prime@plt>
cmp    $0x0,%eax
je     133b <main+0x16b>
movslq -0x24(%rbp),%rax
mov    -0x350(%rbp,%rax,4),%ecx
movslq -0x354(%rbp),%rax
mov    %ecx,-0x1c0(%rbp,%rax,4)
mov    -0x354(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x354(%rbp)
jmp    1340 <main+0x170>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    12ee <main+0x11e>
mov    -0x1c(%rbp),%edi
lea    -0x1c0(%rbp),%rsi
movslq -0x354(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edx
call   1030 <write@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %eax,%esi
lea    0xcb0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xcbe(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xcc6(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   10a0 <scanf@plt>
lea    0xcb9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    13f6 <main+0x226>
movslq -0x24(%rbp),%rax
lea    -0x1c0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xc83(%rip),%rdi
call   10a0 <scanf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    13be <main+0x1ee>
mov    -0x14(%rbp),%edi
lea    -0x1c0(%rbp),%rsi
movslq -0x10(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edx
call   1030 <write@plt>
mov    -0x8(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   10b0 <waitpid@plt>
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %eax,%esi
lea    0xc07(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%edi
lea    -0x350(%rbp),%rsi
mov    $0x190,%edx
call   1080 <read@plt>
mov    %eax,-0x354(%rbp)
movslq -0x354(%rbp),%rax
shr    $0x2,%rax
mov    %eax,-0x354(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x354(%rbp),%eax
jge    149c <main+0x2cc>
movslq -0x24(%rbp),%rax
mov    -0x350(%rbp,%rax,4),%esi
lea    0xbf6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1466 <main+0x296>
jmp    14a1 <main+0x2d1>
mov    -0x18(%rbp),%edi
call   1060 <close@plt>
mov    -0x4(%rbp),%eax
add    $0x360,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x348,%rsp
lea    0x10(%rsp),%rdi
call   1080 <pipe@plt>
cmp    $0xffffffff,%eax
je     1332 <main+0x152>
lea    0x18(%rsp),%rdi
call   1080 <pipe@plt>
cmp    $0xffffffff,%eax
je     1332 <main+0x152>
xor    %r14d,%r14d
xor    %eax,%eax
call   1100 <fork@plt>
test   %eax,%eax
je     1362 <main+0x182>
mov    %eax,%r15d
cmp    $0xffffffff,%eax
je     13cf <main+0x1ef>
xor    %eax,%eax
call   1050 <getpid@plt>
lea    0xdf5(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe01(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe09(%rip),%rdi
lea    0xc(%rsp),%rsi
call   10b0 <scanf@plt>
lea    0xe08(%rip),%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%edx
test   %edx,%edx
jle    12ad <main+0xcd>
lea    0x1b0(%rsp),%rbx
xor    %ebp,%ebp
lea    0xdda(%rip),%r14
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
call   10b0 <scanf@plt>
add    $0x1,%rbp
movslq 0xc(%rsp),%rdx
add    $0x4,%rbx
cmp    %rdx,%rbp
jl     1290 <main+0xb0>
mov    0x14(%rsp),%edi
shl    $0x2,%edx
lea    0x1b0(%rsp),%rsi
call   1040 <write@plt>
xor    %r14d,%r14d
mov    %r15d,%edi
xor    %esi,%esi
xor    %edx,%edx
call   10c0 <waitpid@plt>
xor    %eax,%eax
call   1050 <getpid@plt>
lea    0xd56(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x18(%rsp),%edi
lea    0x20(%rsp),%rsi
mov    $0x190,%edx
call   1090 <read@plt>
cmp    $0x4,%eax
jl     1327 <main+0x147>
mov    %eax,%ebp
shr    $0x2,%ebp
lea    0xd5e(%rip),%r15
xor    %ebx,%ebx
nopl   (%rax)
mov    0x20(%rsp,%rbx,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1310 <main+0x130>
mov    0x10(%rsp),%edi
call   1070 <close@plt>
jmp    1351 <main+0x171>
mov    0x2ca7(%rip),%rax
mov    (%rax),%edi
lea    0xcbe(%rip),%rsi
call   10a0 <fprintf@plt>
mov    0x2c8a(%rip),%rax
mov    (%rax),%r14d
mov    %r14d,%eax
add    $0x348,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x10(%rsp),%edi
lea    0x20(%rsp),%rsi
mov    $0x190,%edx
call   1090 <read@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <getpid@plt>
lea    0xc94(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %ebx,%eax
sar    $0x2,%eax
mov    %eax,0xc(%rsp)
cmp    $0x4,%ebx
jl     13e5 <main+0x205>
movslq %eax,%r15
xor    %ebp,%ebp
xor    %r14d,%r14d
jmp    13af <main+0x1cf>
add    $0x1,%rbp
cmp    %r15,%rbp
jge    13e5 <main+0x205>
mov    0x20(%rsp,%rbp,4),%ebx
mov    %ebx,%edi
call   10d0 <prime@plt>
test   %eax,%eax
je     13a6 <main+0x1c6>
movslq %r14d,%r14
mov    %ebx,0x1b0(%rsp,%r14,4)
add    $0x1,%r14d
jmp    13a6 <main+0x1c6>
lea    0xc38(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    0x1c(%rsp),%edi
shl    $0x2,%r14d
lea    0x1b0(%rsp),%rsi
mov    %r14d,%edx
call   1040 <write@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [14 x i8] c"Pipe Failed.\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [11 x i8] c"main: fork\00"
@.str.2 = [27 x i8] c"In child process (ID: %d)\0A\00"
@.str.3 = [28 x i8] c"In parent process (ID: %d)\0A\00"
@.str.4 = [22 x i8] c"Number of elements:- \00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [20 x i8] c"Enter the elements\0A\00"
@.str.7 = [13 x i8] c"%d is prime\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [2 x i32]
%6 = alloca [2 x i32]
%7 = alloca i32
%8 = alloca [100 x i32]
%9 = alloca [100 x i32]
%10 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %10
%11 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
%12 = call i32 @pipe(i32* %11)
store i32 %12, i32* %3
%13 = load i32, i32* %3
%14 = icmp eq i32 %13, -1
br i1 %14, label %15, label %19
15: ; preds = %0
%16 = load i32, i32* @stderr
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%18 = load i32, i32* @EXIT_FAILURE
store i32 %18, i32* %1
br label %137
19: ; preds = %0
%20 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%21 = call i32 @pipe(i32* %20)
store i32 %21, i32* %3
%22 = load i32, i32* %3
%23 = icmp eq i32 %22, -1
br i1 %23, label %24, label %28
24: ; preds = %19
%25 = load i32, i32* @stderr
%26 = call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%27 = load i32, i32* @EXIT_FAILURE
store i32 %27, i32* %1
br label %137
28: ; preds = %19
%29 = call i32 (...) @fork()
store i32 %29, i32* %2
%30 = load i32, i32* %2
switch i32 %30, label %80 [
i32 -1, label %31
i32 0, label %34
]
31: ; preds = %28
%32 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%33 = call i32 @exit(i32 1)
unreachable
34: ; preds = %28
%35 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
%36 = load i32, i32* %35
%37 = getelementptr inbounds [100 x i32], [100 x i32]* %9, i64 0, i64 0
%38 = call i32 @read(i32 %36, i32* %37, i32 400)
store i32 %38, i32* %4
%39 = call i32 (...) @getpid()
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %39)
%41 = load i32, i32* %4
%42 = sext i32 %41 to i64
%43 = udiv i64 %42, 4
%44 = trunc i64 %43 to i32
store i32 %44, i32* %4
store i32 0, i32* %7
br label %45
45: ; preds = %67, %34
%46 = load i32, i32* %7
%47 = load i32, i32* %4
%48 = icmp slt i32 %46, %47
br i1 %48, label %49, label %70
49: ; preds = %45
%50 = load i32, i32* %7
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [100 x i32], [100 x i32]* %9, i64 0, i64 %51
%53 = load i32, i32* %52
%54 = call i32 @prime(i32 %53)
%55 = icmp ne i32 %54, 0
br i1 %55, label %56, label %66
56: ; preds = %49
%57 = load i32, i32* %7
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [100 x i32], [100 x i32]* %9, i64 0, i64 %58
%60 = load i32, i32* %59
%61 = load i32, i32* %10
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [100 x i32], [100 x i32]* %8, i64 0, i64 %62
store i32 %60, i32* %63
%64 = load i32, i32* %10
%65 = add nsw i32 %64, 1
store i32 %65, i32* %10
br label %66
66: ; preds = %56, %49
br label %67
67: ; preds = %66
%68 = load i32, i32* %7
%69 = add nsw i32 %68, 1
store i32 %69, i32* %7
br label %45
70: ; preds = %45
%71 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
%72 = load i32, i32* %71
%73 = getelementptr inbounds [100 x i32], [100 x i32]* %8, i64 0, i64 0
%74 = load i32, i32* %10
%75 = sext i32 %74 to i64
%76 = mul i64 %75, 4
%77 = trunc i64 %76 to i32
%78 = call i32 @write(i32 %72, i32* %73, i32 %77)
%79 = call i32 @exit(i32 1)
unreachable
80: ; preds = %28
%81 = call i32 (...) @getpid()
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 %81)
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
%84 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %4)
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %7
br label %86
86: ; preds = %95, %80
%87 = load i32, i32* %7
%88 = load i32, i32* %4
%89 = icmp slt i32 %87, %88
br i1 %89, label %90, label %98
90: ; preds = %86
%91 = load i32, i32* %7
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds [100 x i32], [100 x i32]* %8, i64 0, i64 %92
%94 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %93)
br label %95
95: ; preds = %90
%96 = load i32, i32* %7
%97 = add nsw i32 %96, 1
store i32 %97, i32* %7
br label %86
98: ; preds = %86
%99 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 1
%100 = load i32, i32* %99
%101 = getelementptr inbounds [100 x i32], [100 x i32]* %8, i64 0, i64 0
%102 = load i32, i32* %4
%103 = sext i32 %102 to i64
%104 = mul i64 %103, 4
%105 = trunc i64 %104 to i32
%106 = call i32 @write(i32 %100, i32* %101, i32 %105)
%107 = load i32, i32* %2
%108 = call i32 @waitpid(i32 %107, i32* null, i32 0)
%109 = call i32 (...) @getpid()
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 %109)
%111 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%112 = load i32, i32* %111
%113 = getelementptr inbounds [100 x i32], [100 x i32]* %9, i64 0, i64 0
%114 = call i32 @read(i32 %112, i32* %113, i32 400)
store i32 %114, i32* %10
%115 = load i32, i32* %10
%116 = sext i32 %115 to i64
%117 = udiv i64 %116, 4
%118 = trunc i64 %117 to i32
store i32 %118, i32* %10
store i32 0, i32* %7
br label %119
119: ; preds = %129, %98
%120 = load i32, i32* %7
%121 = load i32, i32* %10
%122 = icmp slt i32 %120, %121
br i1 %122, label %123, label %132
123: ; preds = %119
%124 = load i32, i32* %7
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds [100 x i32], [100 x i32]* %9, i64 0, i64 %125
%127 = load i32, i32* %126
%128 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i32 %127)
br label %129
129: ; preds = %123
%130 = load i32, i32* %7
%131 = add nsw i32 %130, 1
store i32 %131, i32* %7
br label %119
132: ; preds = %119
br label %133
133: ; preds = %132
%134 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
%135 = load i32, i32* %134
%136 = call i32 @close(i32 %135)
br label %137
137: ; preds = %133, %24, %15
%138 = load i32, i32* %1
ret i32 %138
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [14 x i8] c"Pipe Failed.\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [11 x i8] c"main: fork\00"
@.str.2 = [27 x i8] c"In child process (ID: %d)\0A\00"
@.str.3 = [28 x i8] c"In parent process (ID: %d)\0A\00"
@.str.4 = [22 x i8] c"Number of elements:- \00"
@.str.5 = [3 x i8] c"%d\00"
@.str.7 = [13 x i8] c"%d is prime\0A\00"
@str = [19 x i8] c"Enter the elements\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x i32]
%3 = alloca [2 x i32]
%4 = alloca [100 x i32]
%5 = alloca [100 x i32]
%6 = bitcast i32* %1 to i8*
%7 = bitcast [2 x i32]* %2 to i8*
%8 = bitcast [2 x i32]* %3 to i8*
%9 = bitcast [100 x i32]* %4 to i8*
%10 = bitcast [100 x i32]* %5 to i8*
%11 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%12 = call i32 @pipe(i32* %11)
%13 = icmp eq i32 %12, -1
br i1 %13, label %14, label %18
14: ; preds = %0
%15 = load i32, i32* @stderr
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%17 = load i32, i32* @EXIT_FAILURE
br label %107
18: ; preds = %0
%19 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%20 = call i32 @pipe(i32* %19)
%21 = icmp eq i32 %20, -1
br i1 %21, label %22, label %26
22: ; preds = %18
%23 = load i32, i32* @stderr
%24 = call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%25 = load i32, i32* @EXIT_FAILURE
br label %107
26: ; preds = %18
%27 = call i32 (...) @fork()
switch i32 %27, label %64 [
i32 -1, label %28
i32 0, label %31
]
28: ; preds = %26
%29 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%30 = call i32 @exit(i32 1)
unreachable
31: ; preds = %26
%32 = load i32, i32* %11
%33 = getelementptr inbounds [100 x i32], [100 x i32]* %5, i64 0, i64 0
%34 = call i32 @read(i32 %32, i32* %33, i32 400)
%35 = call i32 (...) @getpid()
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %35)
%37 = ashr i32 %34, 2
store i32 %37, i32* %1
%38 = icmp sgt i32 %34, 3
br i1 %38, label %39, label %56
39: ; preds = %31
%40 = sext i32 %37 to i64
br label %41
41: ; preds = %39, %52
%42 = phi i64 [ 0, %39 ], [ %54, %52 ]
%43 = phi i32 [ 0, %39 ], [ %53, %52 ]
%44 = getelementptr inbounds [100 x i32], [100 x i32]* %5, i64 0, i64 %42
%45 = load i32, i32* %44
%46 = call i32 @prime(i32 %45)
%47 = icmp eq i32 %46, 0
br i1 %47, label %52, label %48
48: ; preds = %41
%49 = sext i32 %43 to i64
%50 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 %49
store i32 %45, i32* %50
%51 = add nsw i32 %43, 1
br label %52
52: ; preds = %41, %48
%53 = phi i32 [ %51, %48 ], [ %43, %41 ]
%54 = add nuw nsw i64 %42, 1
%55 = icmp slt i64 %54, %40
br i1 %55, label %41, label %56
56: ; preds = %52, %31
%57 = phi i32 [ 0, %31 ], [ %53, %52 ]
%58 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%59 = load i32, i32* %58
%60 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 0
%61 = shl i32 %57, 2
%62 = call i32 @write(i32 %59, i32* %60, i32 %61)
%63 = call i32 @exit(i32 1)
unreachable
64: ; preds = %26
%65 = call i32 (...) @getpid()
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 %65)
%67 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
%68 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %1)
%69 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%70 = load i32, i32* %1
%71 = icmp sgt i32 %70, 0
br i1 %71, label %72, label %80
72: ; preds = %64, %72
%73 = phi i64 [ %76, %72 ], [ 0, %64 ]
%74 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 %73
%75 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %74)
%76 = add nuw nsw i64 %73, 1
%77 = load i32, i32* %1
%78 = sext i32 %77 to i64
%79 = icmp slt i64 %76, %78
br i1 %79, label %72, label %80
80: ; preds = %72, %64
%81 = phi i32 [ %70, %64 ], [ %77, %72 ]
%82 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%83 = load i32, i32* %82
%84 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 0
%85 = shl i32 %81, 2
%86 = call i32 @write(i32 %83, i32* %84, i32 %85)
%87 = call i32 @waitpid(i32 %27, i32* null, i32 0)
%88 = call i32 (...) @getpid()
%89 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 %88)
%90 = load i32, i32* %19
%91 = getelementptr inbounds [100 x i32], [100 x i32]* %5, i64 0, i64 0
%92 = call i32 @read(i32 %90, i32* %91, i32 400)
%93 = icmp sgt i32 %92, 3
br i1 %93, label %94, label %104
94: ; preds = %80
%95 = lshr i32 %92, 2
%96 = zext i32 %95 to i64
br label %97
97: ; preds = %94, %97
%98 = phi i64 [ 0, %94 ], [ %102, %97 ]
%99 = getelementptr inbounds [100 x i32], [100 x i32]* %5, i64 0, i64 %98
%100 = load i32, i32* %99
%101 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i32 %100)
%102 = add nuw nsw i64 %98, 1
%103 = icmp eq i64 %102, %96
br i1 %103, label %104, label %97
104: ; preds = %97, %80
%105 = load i32, i32* %11
%106 = call i32 @close(i32 %105)
br label %107
107: ; preds = %104, %22, %14
%108 = phi i32 [ %17, %14 ], [ %25, %22 ], [ 0, %104 ]
ret i32 %108
}