#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*/ gets(char *);
int /*<<< orphan*/ printf(char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strrev(char *);
void spal() {
  char a[100], b[100];
  printf("Enter the string to check if it is a palindrome\n");
  gets(a);
  strcpy(b, a);
  strrev(b);
  if (strcmp(a, b) == 0)
    printf("Entered string is a palindrome.\n");
  else
    printf("Entered string is not a palindrome.\n");
}


x86 assembly (clang, -O0):
<spal>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
lea    0xe9e(%rip),%rdi
call   1040 <printf@plt>
lea    -0x70(%rbp),%rdi
call   1060 <gets@plt>
lea    -0xe0(%rbp),%rdi
lea    -0x70(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0xe0(%rbp),%rdi
call   1070 <strrev@plt>
lea    -0x70(%rbp),%rdi
lea    -0xe0(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11b7 <spal+0x67>
lea    0xe84(%rip),%rdi
call   1040 <printf@plt>
jmp    11c3 <spal+0x73>
lea    0xe94(%rip),%rdi
call   1040 <printf@plt>
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spal>:
push   %r14
push   %rbx
sub    $0xd8,%rsp
lea    0xe9f(%rip),%rdi
call   1040 <puts@plt>
lea    0x70(%rsp),%r14
mov    %r14,%rdi
call   1060 <gets@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1070 <strrev@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
lea    0xeb6(%rip),%rax
lea    0xe8b(%rip),%rdi
cmove  %rax,%rdi
call   1040 <puts@plt>
add    $0xd8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [49 x i8] c"Enter the string to check if it is a palindrome\0A\00"
@.str.1 = [33 x i8] c"Entered string is a palindrome.\0A\00"
@.str.2 = [37 x i8] c"Entered string is not a palindrome.\0A\00"
define void @spal() {
%1 = alloca [100 x i8]
%2 = alloca [100 x i8]
%3 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%5 = call i32 @gets(i8* %4)
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%8 = call i32 @strcpy(i8* %6, i8* %7)
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%10 = call i32 @strrev(i8* %9)
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%13 = call i64 @strcmp(i8* %11, i8* %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %0
%16 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
br label %19
17: ; preds = %0
%18 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
br label %19
19: ; preds = %17, %15
ret void
}

LLVM IR (-O2):
@str = [48 x i8] c"Enter the string to check if it is a palindrome\00"
@str.3 = [36 x i8] c"Entered string is not a palindrome.\00"
@str.4 = [32 x i8] c"Entered string is a palindrome.\00"
define void @spal() {
%1 = alloca [100 x i8]
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
%6 = call i32 @gets(i8* %3)
%7 = call i32 @strcpy(i8* %4, i8* %3)
%8 = call i32 @strrev(i8* %4)
%9 = call i64 @strcmp(i8* %3, i8* %4)
%10 = icmp eq i64 %9, 0
%11 = select i1 %10, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @str.4, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @str.3, i64 0, i64 0)
%12 = call i32 @puts(i8* dereferenceable(1) %11)
ret void
}