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

/* Variables and functions */
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*/ printf(char *, ...);
int /*<<< orphan*/ read(int, char **, int);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int /*<<< orphan*/ waitpid(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ write(int, char **, int);
int main() {
  int pid, a, n, p[2], p2[2], i, len, j, k, flag, n2 = 0;
  char str1[100][100], str2[100][100];
  printf("Number of elements:- ");
  scanf("%d", &n);
  a = pipe(p);
  if (a == -1) {
    fprintf(stderr, "Pipe Failed.\n");
    exit(1);
  }
  a = pipe(p2);
  if (a == -1) {
    fprintf(stderr, "Pipe Failed.\n");
    exit(1);
  }
  pid = fork();
  switch (pid) {
  case -1:
    perror("main: fork");
    exit(1);
  case 0:
    read(p[0], str2, sizeof(str2));
    printf("In child process (ID: %d)\n", getpid());
    for (i = 0; i < n; i++) {
      len = strlen(str2[i]);
      flag = 0;
      for (j = 0, k = len - 1; j < len; j++, k--) {
        if (str2[i][j] != str2[i][k]) {
          flag = 1;
          break;
        }
      }
      if (flag == 0) {
        n2++;
        strcpy(str1[n2], str2[i]);
      }
    }
    str1[0][0] = n2;
    write(p2[1], str1, sizeof(str1));
    exit(1);
    break;
  default:
    printf("In parent process (ID: %d)\n", getpid());
    printf("Enter elements\n");
    for (i = 0; i < n; i++) {
      scanf("%s", str1[i]);
    }
    write(p[1], str1, sizeof(str1));
    waitpid(pid, NULL, 0);
    read(p2[0], str2, sizeof(str2));
    printf("In parent process (ID: %d)\n", pid);
    n = (int)str2[0][0];
    printf("Total no of palindromes: %d\n", n);
    for (i = 1; i <= n; i++)
      printf("Palindrome %d:- %s\n", i, str2[i]);
    break;
  }
  close(p[0]);
  close(p2[0]);
  close(p[1]);
  close(p2[1]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4e70,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x38(%rbp)
lea    0xe00(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xe08(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   10c0 <scanf@plt>
lea    -0x18(%rbp),%rdi
call   1090 <pipe@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    124e <main+0x6e>
mov    0x2daa(%rip),%rax
mov    (%rax),%edi
lea    0xdda(%rip),%rsi
call   10b0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
lea    -0x20(%rbp),%rdi
call   1090 <pipe@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    1283 <main+0xa3>
mov    0x2d75(%rip),%rax
mov    (%rax),%edi
lea    0xda5(%rip),%rsi
call   10b0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
xor    %eax,%eax
call   1100 <fork@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4e64(%rbp)
sub    $0xffffffff,%eax
je     12b7 <main+0xd7>
jmp    12a4 <main+0xc4>
mov    -0x4e64(%rbp),%eax
test   %eax,%eax
je     12cd <main+0xed>
jmp    1422 <main+0x242>
lea    0xd69(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x18(%rbp),%edi
lea    -0x4e60(%rbp),%rsi
mov    $0x2710,%edx
call   10a0 <read@plt>
mov    $0x0,%al
call   1050 <getpid@plt>
mov    %eax,%esi
lea    0xd41(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    13fb <main+0x21b>
movslq -0x24(%rbp),%rax
lea    -0x4e60(%rbp),%rdi
imul   $0x64,%rax,%rax
add    %rax,%rdi
call   1060 <strlen@plt>
mov    %eax,-0x28(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x28(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    13ac <main+0x1cc>
movslq -0x24(%rbp),%rcx
lea    -0x4e60(%rbp),%rax
imul   $0x64,%rcx,%rcx
add    %rcx,%rax
movslq -0x2c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movslq -0x24(%rbp),%rdx
lea    -0x4e60(%rbp),%rcx
imul   $0x64,%rdx,%rdx
add    %rdx,%rcx
movslq -0x30(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     1390 <main+0x1b0>
movl   $0x1,-0x34(%rbp)
jmp    13ac <main+0x1cc>
jmp    1395 <main+0x1b5>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x30(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x30(%rbp)
jmp    133c <main+0x15c>
cmpl   $0x0,-0x34(%rbp)
jne    13e8 <main+0x208>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
movslq -0x38(%rbp),%rax
lea    -0x2750(%rbp),%rdi
imul   $0x64,%rax,%rax
add    %rax,%rdi
movslq -0x24(%rbp),%rax
lea    -0x4e60(%rbp),%rsi
imul   $0x64,%rax,%rax
add    %rax,%rsi
call   1030 <strcpy@plt>
jmp    13ed <main+0x20d>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    12ff <main+0x11f>
mov    -0x38(%rbp),%eax
mov    %al,-0x2750(%rbp)
mov    -0x1c(%rbp),%edi
lea    -0x2750(%rbp),%rsi
mov    $0x2710,%edx
call   1040 <write@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    $0x0,%al
call   1050 <getpid@plt>
mov    %eax,%esi
lea    0xc1b(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xc29(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1488 <main+0x2a8>
movslq -0x24(%rbp),%rax
lea    -0x2750(%rbp),%rsi
imul   $0x64,%rax,%rax
add    %rax,%rsi
lea    0xc06(%rip),%rdi
mov    $0x0,%al
call   10c0 <scanf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    144e <main+0x26e>
mov    -0x14(%rbp),%edi
lea    -0x2750(%rbp),%rsi
mov    $0x2710,%edx
call   1040 <write@plt>
mov    -0x8(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   10d0 <waitpid@plt>
mov    -0x20(%rbp),%edi
lea    -0x4e60(%rbp),%rsi
mov    $0x2710,%edx
call   10a0 <read@plt>
mov    -0x8(%rbp),%esi
lea    0xb85(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movsbl -0x4e60(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xb99(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     152e <main+0x34e>
mov    -0x24(%rbp),%esi
movslq -0x24(%rbp),%rax
lea    -0x4e60(%rbp),%rdx
imul   $0x64,%rax,%rax
add    %rax,%rdx
lea    0xb80(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    14f1 <main+0x311>
jmp    1533 <main+0x353>
mov    -0x18(%rbp),%edi
call   1080 <close@plt>
mov    -0x20(%rbp),%edi
call   1080 <close@plt>
mov    -0x14(%rbp),%edi
call   1080 <close@plt>
mov    -0x1c(%rbp),%edi
call   1080 <close@plt>
mov    -0x4(%rbp),%eax
add    $0x4e70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x4e40,%rsp
lea    0xdfa(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xe02(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   10d0 <scanf@plt>
lea    0x18(%rsp),%rdi
call   10a0 <pipe@plt>
cmp    $0xffffffff,%eax
je     1397 <main+0x1a7>
lea    0x10(%rsp),%rdi
call   10a0 <pipe@plt>
cmp    $0xffffffff,%eax
je     1397 <main+0x1a7>
xor    %r15d,%r15d
xor    %eax,%eax
call   1110 <fork@plt>
test   %eax,%eax
je     13b6 <main+0x1c6>
mov    %eax,%r14d
cmp    $0xffffffff,%eax
je     1478 <main+0x288>
xor    %eax,%eax
call   1060 <getpid@plt>
lea    0xddb(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xe1b(%rip),%rdi
call   1040 <puts@plt>
cmpl   $0x0,0xc(%rsp)
jle    12bf <main+0xcf>
lea    0x2730(%rsp),%rbx
lea    0xdcc(%rip),%r15
xor    %ebp,%ebp
nop
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   10d0 <scanf@plt>
add    $0x1,%rbp
movslq 0xc(%rsp),%rax
add    $0x64,%rbx
cmp    %rax,%rbp
jl     12a0 <main+0xb0>
mov    0x1c(%rsp),%edi
lea    0x2730(%rsp),%rsi
mov    $0x2710,%edx
call   1050 <write@plt>
mov    %r14d,%edi
xor    %esi,%esi
xor    %edx,%edx
call   10e0 <waitpid@plt>
mov    0x10(%rsp),%edi
lea    0x20(%rsp),%rsi
mov    $0x2710,%edx
call   10b0 <read@plt>
lea    0xd52(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1080 <printf@plt>
movsbl 0x20(%rsp),%esi
mov    %esi,0xc(%rsp)
lea    0xd57(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
cmpl   $0x0,0xc(%rsp)
jle    1361 <main+0x171>
lea    0x84(%rsp),%rbx
lea    0xd57(%rip),%r14
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%rbp
mov    %r14,%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1080 <printf@plt>
movslq 0xc(%rsp),%rax
add    $0x64,%rbx
cmp    %rax,%rbp
jl     1340 <main+0x150>
mov    0x18(%rsp),%edi
call   1090 <close@plt>
mov    0x10(%rsp),%edi
call   1090 <close@plt>
mov    0x1c(%rsp),%edi
call   1090 <close@plt>
mov    0x14(%rsp),%edi
call   1090 <close@plt>
xor    %eax,%eax
add    $0x4e40,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c42(%rip),%rax
mov    (%rax),%edi
lea    0xc72(%rip),%rsi
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    0x18(%rsp),%edi
lea    0x20(%rsp),%r12
mov    %r12,%rsi
mov    $0x2710,%edx
call   10b0 <read@plt>
xor    %eax,%eax
call   1060 <getpid@plt>
lea    0xc58(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1080 <printf@plt>
cmpl   $0x0,0xc(%rsp)
jle    148e <main+0x29e>
lea    0x1f(%rsp),%rbp
xor    %ebx,%ebx
xor    %r15d,%r15d
jmp    1434 <main+0x244>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r15d
movslq %r15d,%rax
imul   $0x64,%rax,%rax
lea    (%rsp,%rax,1),%rdi
add    $0x2730,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rax
add    $0x64,%r12
add    $0x64,%rbp
cmp    %rax,%rbx
jge    148e <main+0x29e>
imul   $0x64,%rbx,%rax
lea    (%rsp,%rax,1),%r14
add    $0x20,%r14
mov    %r14,%rdi
call   1070 <strlen@plt>
test   %eax,%eax
jle    1400 <main+0x210>
mov    %eax,%eax
mov    %r12,%rcx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl (%rcx),%edx
cmp    0x0(%rbp,%rax,1),%dl
jne    141e <main+0x22e>
add    $0xffffffffffffffff,%rax
add    $0x1,%rcx
test   %rax,%rax
jne    1460 <main+0x270>
jmp    1400 <main+0x210>
lea    0xba8(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    %r15b,0x2730(%rsp)
mov    0x14(%rsp),%edi
lea    0x2730(%rsp),%rsi
mov    $0x2710,%edx
call   1050 <write@plt>
mov    $0x1,%edi
call   1100 <exit@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"Number of elements:- \00"
@.str.1 = [3 x i8] c"%d\00"
@stderr = global i32 0
@.str.2 = [14 x i8] c"Pipe Failed.\0A\00"
@.str.3 = [11 x i8] c"main: fork\00"
@.str.4 = [27 x i8] c"In child process (ID: %d)\0A\00"
@.str.5 = [28 x i8] c"In parent process (ID: %d)\0A\00"
@.str.6 = [16 x i8] c"Enter elements\0A\00"
@.str.7 = [3 x i8] c"%s\00"
@.str.8 = [29 x i8] c"Total no of palindromes: %d\0A\00"
@.str.9 = [20 x i8] c"Palindrome %d:- %s\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 i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca [100 x [100 x i8]]
%14 = alloca [100 x [100 x i8]]
store i32 0, i32* %1
store i32 0, i32* %12
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%17 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
%18 = call i32 @pipe(i32* %17)
store i32 %18, i32* %3
%19 = load i32, i32* %3
%20 = icmp eq i32 %19, -1
br i1 %20, label %21, label %25
21: ; preds = %0
%22 = load i32, i32* @stderr
%23 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%24 = call i32 @exit(i32 1)
unreachable
25: ; preds = %0
%26 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%27 = call i32 @pipe(i32* %26)
store i32 %27, i32* %3
%28 = load i32, i32* %3
%29 = icmp eq i32 %28, -1
br i1 %29, label %30, label %34
30: ; preds = %25
%31 = load i32, i32* @stderr
%32 = call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%33 = call i32 @exit(i32 1)
unreachable
34: ; preds = %25
%35 = call i32 (...) @fork()
store i32 %35, i32* %2
%36 = load i32, i32* %2
switch i32 %36, label %119 [
i32 -1, label %37
i32 0, label %40
]
37: ; preds = %34
%38 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%39 = call i32 @exit(i32 1)
unreachable
40: ; preds = %34
%41 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
%42 = load i32, i32* %41
%43 = getelementptr inbounds [100 x [100 x i8]], [100 x [100 x i8]]* %14, i64 0, i64 0
%44 = bitcast [100 x i8]* %43 to i8**
%45 = call i32 @read(i32 %42, i8** %44, i32 10000)
%46 = call i32 (...) @getpid()
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i32 %46)
store i32 0, i32* %7
br label %48
48: ; preds = %105, %40
%49 = load i32, i32* %7
%50 = load i32, i32* %4
%51 = icmp slt i32 %49, %50
br i1 %51, label %52, label %108
52: ; preds = %48
%53 = load i32, i32* %7
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [100 x [100 x i8]], [100 x [100 x i8]]* %14, i64 0, i64 %54
%56 = getelementptr inbounds [100 x i8], [100 x i8]* %55, i64 0, i64 0
%57 = call i32 @strlen(i8* %56)
store i32 %57, i32* %8
store i32 0, i32* %11
store i32 0, i32* %9
%58 = load i32, i32* %8
%59 = sub nsw i32 %58, 1
store i32 %59, i32* %10
br label %60
60: ; preds = %84, %52
%61 = load i32, i32* %9
%62 = load i32, i32* %8
%63 = icmp slt i32 %61, %62
br i1 %63, label %64, label %89
64: ; preds = %60
%65 = load i32, i32* %7
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [100 x [100 x i8]], [100 x [100 x i8]]* %14, i64 0, i64 %66
%68 = load i32, i32* %9
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [100 x i8], [100 x i8]* %67, i64 0, i64 %69
%71 = load i8, i8* %70
%72 = sext i8 %71 to i32
%73 = load i32, i32* %7
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds [100 x [100 x i8]], [100 x [100 x i8]]* %14, i64 0, i64 %74
%76 = load i32, i32* %10
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds [100 x i8], [100 x i8]* %75, i64 0, i64 %77
%79 = load i8, i8* %78
%80 = sext i8 %79 to i32
%81 = icmp ne i32 %72, %80
br i1 %81, label %82, label %83
82: ; preds = %64
store i32 1, i32* %11
br label %89
83: ; preds = %64
br label %84
84: ; preds = %83
%85 = load i32, i32* %9
%86 = add nsw i32 %85, 1
store i32 %86, i32* %9
%87 = load i32, i32* %10
%88 = add nsw i32 %87, -1
store i32 %88, i32* %10
br label %60
89: ; preds = %82, %60
%90 = load i32, i32* %11
%91 = icmp eq i32 %90, 0
br i1 %91, label %92, label %104
92: ; preds = %89
%93 = load i32, i32* %12
%94 = add nsw i32 %93, 1
store i32 %94, i32* %12
%95 = load i32, i32* %12
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds [100 x [100 x i8]], [100 x [100 x i8]]* %13, i64 0, i64 %96
%98 = getelementptr inbounds [100 x i8], [100 x i8]* %97, i64 0, i64 0
%99 = load i32, i32* %7
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds [100 x [100 x i8]], [100 x [100 x i8]]* %14, i64 0, i64 %100
%102 = getelementptr inbounds [100 x i8], [100 x i8]* %101, i64 0, i64 0
%103 = call i32 @strcpy(i8* %98, i8* %102)
br label %104
104: ; preds = %92, %89
br label %105
105: ; preds = %104
%106 = load i32, i32* %7
%107 = add nsw i32 %106, 1
store i32 %107, i32* %7
br label %48
108: ; preds = %48
%109 = load i32, i32* %12
%110 = trunc i32 %109 to i8
%111 = getelementptr inbounds [100 x [100 x i8]], [100 x [100 x i8]]* %13, i64 0, i64 0
%112 = getelementptr inbounds [100 x i8], [100 x i8]* %111, i64 0, i64 0
store i8 %110, i8* %112
%113 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
%114 = load i32, i32* %113
%115 = getelementptr inbounds [100 x [100 x i8]], [100 x [100 x i8]]* %13, i64 0, i64 0
%116 = bitcast [100 x i8]* %115 to i8**
%117 = call i32 @write(i32 %114, i8** %116, i32 10000)
%118 = call i32 @exit(i32 1)
unreachable
119: ; preds = %34
%120 = call i32 (...) @getpid()
%121 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i32 %120)
%122 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %7
br label %123
123: ; preds = %133, %119
%124 = load i32, i32* %7
%125 = load i32, i32* %4
%126 = icmp slt i32 %124, %125
br i1 %126, label %127, label %136
127: ; preds = %123
%128 = load i32, i32* %7
%129 = sext i32 %128 to i64
%130 = getelementptr inbounds [100 x [100 x i8]], [100 x [100 x i8]]* %13, i64 0, i64 %129
%131 = getelementptr inbounds [100 x i8], [100 x i8]* %130, i64 0, i64 0
%132 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %131)
br label %133
133: ; preds = %127
%134 = load i32, i32* %7
%135 = add nsw i32 %134, 1
store i32 %135, i32* %7
br label %123
136: ; preds = %123
%137 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 1
%138 = load i32, i32* %137
%139 = getelementptr inbounds [100 x [100 x i8]], [100 x [100 x i8]]* %13, i64 0, i64 0
%140 = bitcast [100 x i8]* %139 to i8**
%141 = call i32 @write(i32 %138, i8** %140, i32 10000)
%142 = load i32, i32* %2
%143 = call i32 @waitpid(i32 %142, i32* null, i32 0)
%144 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%145 = load i32, i32* %144
%146 = getelementptr inbounds [100 x [100 x i8]], [100 x [100 x i8]]* %14, i64 0, i64 0
%147 = bitcast [100 x i8]* %146 to i8**
%148 = call i32 @read(i32 %145, i8** %147, i32 10000)
%149 = load i32, i32* %2
%150 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i32 %149)
%151 = getelementptr inbounds [100 x [100 x i8]], [100 x [100 x i8]]* %14, i64 0, i64 0
%152 = getelementptr inbounds [100 x i8], [100 x i8]* %151, i64 0, i64 0
%153 = load i8, i8* %152
%154 = sext i8 %153 to i32
store i32 %154, i32* %4
%155 = load i32, i32* %4
%156 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.8, i64 0, i64 0), i32 %155)
store i32 1, i32* %7
br label %157
157: ; preds = %168, %136
%158 = load i32, i32* %7
%159 = load i32, i32* %4
%160 = icmp sle i32 %158, %159
br i1 %160, label %161, label %171
161: ; preds = %157
%162 = load i32, i32* %7
%163 = load i32, i32* %7
%164 = sext i32 %163 to i64
%165 = getelementptr inbounds [100 x [100 x i8]], [100 x [100 x i8]]* %14, i64 0, i64 %164
%166 = getelementptr inbounds [100 x i8], [100 x i8]* %165, i64 0, i64 0
%167 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0), i32 %162, i8* %166)
br label %168
168: ; preds = %161
%169 = load i32, i32* %7
%170 = add nsw i32 %169, 1
store i32 %170, i32* %7
br label %157
171: ; preds = %157
br label %172
172: ; preds = %171
%173 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
%174 = load i32, i32* %173
%175 = call i32 @close(i32 %174)
%176 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%177 = load i32, i32* %176
%178 = call i32 @close(i32 %177)
%179 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 1
%180 = load i32, i32* %179
%181 = call i32 @close(i32 %180)
%182 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
%183 = load i32, i32* %182
%184 = call i32 @close(i32 %183)
%185 = load i32, i32* %1
ret i32 %185
}

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