#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 *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strrev(char *);
void palindrome(char *string) {
  int i;
  char temp[100];
  strcpy(temp, string);
  strrev(temp);
  if (strcmp(string, temp) == 0)
    printf("The given string %s is palindrome\n", string);
  else
    printf("The given string %s is not palindrome\n", string);
}


x86 assembly (clang, -O0):
<palindrome>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x70(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x70(%rbp),%rdi
call   1060 <strrev@plt>
mov    -0x8(%rbp),%rdi
lea    -0x70(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    118e <palindrome+0x4e>
mov    -0x8(%rbp),%rsi
lea    0xe7c(%rip),%rdi
call   1040 <printf@plt>
jmp    119e <palindrome+0x5e>
mov    -0x8(%rbp),%rsi
lea    0xe8a(%rip),%rdi
call   1040 <printf@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<palindrome>:
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    %rdi,%rbx
mov    %rsp,%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %r14,%rdi
call   1060 <strrev@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
lea    0xe8b(%rip),%rax
lea    0xea7(%rip),%rdi
cmove  %rax,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [35 x i8] c"The given string %s is palindrome\0A\00"
@.str.1 = [39 x i8] c"The given string %s is not palindrome\0A\00"
define void @palindrome(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca [100 x i8]
store i8* %0, i8** %2
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%6 = load i8*, i8** %2
%7 = call i32 @strcpy(i8* %5, i8* %6)
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%9 = call i32 @strrev(i8* %8)
%10 = load i8*, i8** %2
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%12 = call i64 @strcmp(i8* %10, i8* %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %1
%15 = load i8*, i8** %2
%16 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %15)
br label %20
17: ; preds = %1
%18 = load i8*, i8** %2
%19 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i8* %18)
br label %20
20: ; preds = %17, %14
ret void
}

LLVM IR (-O2):
@.str = [35 x i8] c"The given string %s is palindrome\0A\00"
@.str.1 = [39 x i8] c"The given string %s is not palindrome\0A\00"
define void @palindrome(i8* %0) {
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%4 = call i32 @strcpy(i8* %3, i8* %0)
%5 = call i32 @strrev(i8* %3)
%6 = call i64 @strcmp(i8* %0, i8* %3)
%7 = icmp eq i64 %6, 0
%8 = select i1 %7, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0)
%9 = call i32 @printf(i8* %8, i8* %0)
ret void
}