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

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *strtok(char *, char *);
int main() {
  printf("Enter a sentence : ");
  char s[100];
  scanf("%[^\n]s", s);
  char str[100];
  strcpy(str, s);
  char *word;
  word = strtok(s, " ,.?!");
  char arr[20][20];
  int i = 0;
  while (word != NULL) {
    strcpy(arr[i], word);
    i++;
    word = strtok(NULL, " ,.?!");
  }
  int count = i - 1;
  int flag = 0;
  for (i = 0; i <= count / 2; i++) {
    if (strcmp(arr[count - i], arr[i]) != 0)
      break;
    else
      flag = 1;
  }
  if (flag == 1)
    printf("\"%s\" is a Palindrome paragraph.\n", str);
  else
    printf("\"%s\" is NOT a Palindrome paragraph.\n", str);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x290,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x70(%rbp),%rsi
lea    0xe99(%rip),%rdi
call   1060 <scanf@plt>
lea    -0xe0(%rbp),%rdi
lea    -0x70(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x70(%rbp),%rdi
lea    0xe80(%rip),%rsi
call   1070 <strtok@plt>
mov    %rax,-0xe8(%rbp)
movl   $0x0,-0x284(%rbp)
cmpq   $0x0,-0xe8(%rbp)
je     120b <main+0xbb>
movslq -0x284(%rbp),%rax
lea    -0x280(%rbp),%rdi
imul   $0x14,%rax,%rax
add    %rax,%rdi
mov    -0xe8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x284(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x284(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xe21(%rip),%rsi
call   1070 <strtok@plt>
mov    %rax,-0xe8(%rbp)
jmp    11b1 <main+0x61>
mov    -0x284(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x288(%rbp)
movl   $0x0,-0x28c(%rbp)
movl   $0x0,-0x284(%rbp)
mov    -0x284(%rbp),%eax
mov    %eax,-0x290(%rbp)
mov    -0x288(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x290(%rbp),%eax
cmp    %ecx,%eax
jg     12c0 <main+0x170>
mov    -0x288(%rbp),%eax
sub    -0x284(%rbp),%eax
cltq
lea    -0x280(%rbp),%rdi
imul   $0x14,%rax,%rax
add    %rax,%rdi
movslq -0x284(%rbp),%rax
lea    -0x280(%rbp),%rsi
imul   $0x14,%rax,%rax
add    %rax,%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     129d <main+0x14d>
jmp    12c0 <main+0x170>
movl   $0x1,-0x28c(%rbp)
jmp    12ac <main+0x15c>
mov    -0x284(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x284(%rbp)
jmp    122e <main+0xde>
cmpl   $0x1,-0x28c(%rbp)
jne    12e7 <main+0x197>
lea    -0xe0(%rbp),%rsi
lea    0xd46(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12fc <main+0x1ac>
lea    -0xe0(%rbp),%rsi
lea    0xd4d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x290,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x268,%rsp
lea    0xe9c(%rip),%rdi
xor    %r15d,%r15d
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe9f(%rip),%rdi
lea    0x200(%rsp),%rbx
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
lea    0xe84(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strtok@plt>
test   %rax,%rax
je     11e3 <main+0x93>
lea    0x70(%rsp),%rbx
mov    $0xffffffff,%ebp
lea    0xe66(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
xor    %edi,%edi
mov    %r14,%rsi
call   1070 <strtok@plt>
add    $0x14,%rbx
add    $0x1,%ebp
test   %rax,%rax
jne    11c0 <main+0x70>
jmp    11e8 <main+0x98>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
shr    $0x1f,%eax
add    %ebp,%eax
sar    %eax
movslq %ebp,%rcx
test   %eax,%eax
cmovg  %eax,%r15d
lea    (%rcx,%rcx,4),%rbx
lea    (%rsp,%rbx,4),%rdi
add    $0x70,%rdi
lea    0x70(%rsp),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     121e <main+0xce>
lea    0xe26(%rip),%r14
jmp    125e <main+0x10e>
add    $0x1,%r15d
lea    0x84(%rsp),%rsi
lea    (%rsp,%rbx,4),%rdi
add    $0x5c,%rdi
lea    0xde8(%rip),%r14
nopl   0x0(%rax)
add    $0xffffffffffffffff,%r15
je     125e <main+0x10e>
lea    0x14(%rsi),%rbp
lea    -0x14(%rdi),%rbx
call   1050 <strcmp@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
test   %rax,%rax
je     1240 <main+0xf0>
mov    %rsp,%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x268,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Enter a sentence : \00"
@.str.1 = [7 x i8] c"%[^\0A]s\00"
@.str.2 = [6 x i8] c" ,.?!\00"
@.str.3 = [33 x i8] c"\22%s\22 is a Palindrome paragraph.\0A\00"
@.str.4 = [37 x i8] c"\22%s\22 is NOT a Palindrome paragraph.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca [100 x i8]
%4 = alloca i8*
%5 = alloca [20 x [20 x i8]]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%11 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%14 = call i32 @strcpy(i8* %12, i8* %13)
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%16 = call i8* @strtok(i8* %15, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
store i8* %16, i8** %4
store i32 0, i32* %6
br label %17
17: ; preds = %20, %0
%18 = load i8*, i8** %4
%19 = icmp ne i8* %18, null
br i1 %19, label %20, label %30
20: ; preds = %17
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [20 x [20 x i8]], [20 x [20 x i8]]* %5, i64 0, i64 %22
%24 = getelementptr inbounds [20 x i8], [20 x i8]* %23, i64 0, i64 0
%25 = load i8*, i8** %4
%26 = call i32 @strcpy(i8* %24, i8* %25)
%27 = load i32, i32* %6
%28 = add nsw i32 %27, 1
store i32 %28, i32* %6
%29 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
store i8* %29, i8** %4
br label %17
30: ; preds = %17
%31 = load i32, i32* %6
%32 = sub nsw i32 %31, 1
store i32 %32, i32* %7
store i32 0, i32* %8
store i32 0, i32* %6
br label %33
33: ; preds = %54, %30
%34 = load i32, i32* %6
%35 = load i32, i32* %7
%36 = sdiv i32 %35, 2
%37 = icmp sle i32 %34, %36
br i1 %37, label %38, label %57
38: ; preds = %33
%39 = load i32, i32* %7
%40 = load i32, i32* %6
%41 = sub nsw i32 %39, %40
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [20 x [20 x i8]], [20 x [20 x i8]]* %5, i64 0, i64 %42
%44 = getelementptr inbounds [20 x i8], [20 x i8]* %43, i64 0, i64 0
%45 = load i32, i32* %6
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [20 x [20 x i8]], [20 x [20 x i8]]* %5, i64 0, i64 %46
%48 = getelementptr inbounds [20 x i8], [20 x i8]* %47, i64 0, i64 0
%49 = call i64 @strcmp(i8* %44, i8* %48)
%50 = icmp ne i64 %49, 0
br i1 %50, label %51, label %52
51: ; preds = %38
br label %57
52: ; preds = %38
store i32 1, i32* %8
br label %53
53: ; preds = %52
br label %54
54: ; preds = %53
%55 = load i32, i32* %6
%56 = add nsw i32 %55, 1
store i32 %56, i32* %6
br label %33
57: ; preds = %51, %33
%58 = load i32, i32* %8
%59 = icmp eq i32 %58, 1
br i1 %59, label %60, label %63
60: ; preds = %57
%61 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i8* %61)
br label %66
63: ; preds = %57
%64 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i8* %64)
br label %66
66: ; preds = %63, %60
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"Enter a sentence : \00"
@.str.1 = [7 x i8] c"%[^\0A]s\00"
@.str.2 = [6 x i8] c" ,.?!\00"
@.str.3 = [33 x i8] c"\22%s\22 is a Palindrome paragraph.\0A\00"
@.str.4 = [37 x i8] c"\22%s\22 is NOT a Palindrome paragraph.\0A\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca [100 x i8]
%3 = alloca [20 x [20 x i8]]
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%6 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%8 = call i32 @strcpy(i8* %7, i8* %5)
%9 = call i8* @strtok(i8* %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%10 = getelementptr inbounds [20 x [20 x i8]], [20 x [20 x i8]]* %3, i64 0, i64 0, i64 0
%11 = icmp eq i8* %9, null
br i1 %11, label %23, label %12
12: ; preds = %0, %12
%13 = phi i64 [ %17, %12 ], [ 0, %0 ]
%14 = phi i8* [ %18, %12 ], [ %9, %0 ]
%15 = getelementptr inbounds [20 x [20 x i8]], [20 x [20 x i8]]* %3, i64 0, i64 %13, i64 0
%16 = call i32 @strcpy(i8* %15, i8* %14)
%17 = add nuw i64 %13, 1
%18 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%19 = icmp eq i8* %18, null
br i1 %19, label %20, label %12
20: ; preds = %12
%21 = trunc i64 %17 to i32
%22 = add i32 %21, -1
br label %23
23: ; preds = %0, %20
%24 = phi i32 [ -1, %0 ], [ %22, %20 ]
%25 = sdiv i32 %24, 2
%26 = sext i32 %24 to i64
%27 = call i32 @llvm.smax.i32(i32 %25, i32 0)
%28 = add nuw nsw i32 %27, 1
%29 = zext i32 %28 to i64
%30 = getelementptr inbounds [20 x [20 x i8]], [20 x [20 x i8]]* %3, i64 0, i64 %26, i64 0
%31 = getelementptr inbounds [20 x [20 x i8]], [20 x [20 x i8]]* %3, i64 0, i64 0, i64 0
%32 = call i64 @strcmp(i8* %30, i8* %31)
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %44
34: ; preds = %23, %38
%35 = phi i64 [ %36, %38 ], [ 0, %23 ]
%36 = add nuw nsw i64 %35, 1
%37 = icmp eq i64 %36, %29
br i1 %37, label %44, label %38
38: ; preds = %34
%39 = sub nsw i64 %26, %36
%40 = getelementptr inbounds [20 x [20 x i8]], [20 x [20 x i8]]* %3, i64 0, i64 %39, i64 0
%41 = getelementptr inbounds [20 x [20 x i8]], [20 x [20 x i8]]* %3, i64 0, i64 %36, i64 0
%42 = call i64 @strcmp(i8* %40, i8* %41)
%43 = icmp eq i64 %42, 0
br i1 %43, label %34, label %44
44: ; preds = %34, %38, %23
%45 = phi i8* [ getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), %23 ], [ getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), %38 ], [ getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), %34 ]
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %45, i8* %7)
ret i32 0
}