#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 ssize_t;

/* Variables and functions */
int /*<<< orphan*/ free(char *);
int getline(char **, size_t *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdin;
void question_one() {
  char *line = NULL;
  size_t len = 0;
  ssize_t read;
  bool is_palindrome = true;
  printf("Enter your string: ");
  read = getline(&line, &len, stdin);
  if (read != -1) {
    size_t start = 0;
    size_t end = read - 2;
    while (start < read - 2) {
      if (line[start] != line[end]) {
        is_palindrome = false;
        break;
      }
      start++;
      end--;
    }
    if (is_palindrome) {
      printf("yes it is a palindrome.\n");
    } else {
      printf("no it is not a palindrome.\n");
    }
  }
  free(line);
}


x86 assembly (clang, -O0):
<question_one>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movq   $0x0,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movl   $0x1,-0x18(%rbp)
lea    0xeaa(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e86(%rip),%rax
mov    (%rax),%edx
lea    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <getline@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
je     121d <question_one+0xed>
movq   $0x0,-0x20(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
cltq
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
cmp    %rcx,%rax
jae    11f1 <question_one+0xc1>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x8(%rbp),%rcx
mov    -0x28(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     11d4 <question_one+0xa4>
movl   $0x0,-0x18(%rbp)
jmp    11f1 <question_one+0xc1>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x28(%rbp)
jmp    1192 <question_one+0x62>
cmpl   $0x0,-0x18(%rbp)
je     120c <question_one+0xdc>
lea    0xe12(%rip),%rdi
call   1040 <printf@plt>
jmp    1218 <question_one+0xe8>
lea    0xe1a(%rip),%rdi
call   1040 <printf@plt>
jmp    121d <question_one+0xed>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<question_one>:
sub    $0x18,%rsp
movq   $0x0,0x8(%rsp)
movq   $0x0,0x10(%rsp)
lea    0xea3(%rip),%rdi
call   1050 <printf@plt>
mov    0x2e7f(%rip),%rax
mov    (%rax),%edx
lea    0x8(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1060 <getline@plt>
cmp    $0xffffffff,%eax
je     11cf <question_one+0x8f>
lea    0xea9(%rip),%rdi
add    $0xfffffffe,%eax
je     11ca <question_one+0x8a>
cltq
cmp    $0x2,%rax
mov    $0x1,%r9d
cmovae %rax,%r9
mov    0x8(%rsp),%rdx
add    %rdx,%rax
xor    %esi,%esi
lea    0xe68(%rip),%r8
nopl   0x0(%rax)
movzbl (%rdx,%rsi,1),%ecx
cmp    (%rax),%cl
jne    11c7 <question_one+0x87>
add    $0x1,%rsi
add    $0xffffffffffffffff,%rax
cmp    %rsi,%r9
jne    11b0 <question_one+0x70>
jmp    11ca <question_one+0x8a>
mov    %r8,%rdi
call   1040 <puts@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Enter your string: \00"
@stdin = global i32 0
@.str.1 = [25 x i8] c"yes it is a palindrome.\0A\00"
@.str.2 = [28 x i8] c"no it is not a palindrome.\0A\00"
define void @question_one() {
%1 = alloca i8*
%2 = alloca i64
%3 = alloca i32
%4 = alloca i32
%5 = alloca i64
%6 = alloca i64
store i8* null, i8** %1
store i64 0, i64* %2
store i32 1, i32* %4
%7 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @stdin
%9 = call i32 @getline(i8** %1, i64* %2, i32 %8)
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = icmp ne i32 %10, -1
br i1 %11, label %12, label %48
12: ; preds = %0
store i64 0, i64* %5
%13 = load i32, i32* %3
%14 = sub nsw i32 %13, 2
%15 = sext i32 %14 to i64
store i64 %15, i64* %6
br label %16
16: ; preds = %35, %12
%17 = load i64, i64* %5
%18 = load i32, i32* %3
%19 = sub nsw i32 %18, 2
%20 = sext i32 %19 to i64
%21 = icmp ult i64 %17, %20
br i1 %21, label %22, label %40
22: ; preds = %16
%23 = load i8*, i8** %1
%24 = load i64, i64* %5
%25 = getelementptr inbounds i8, i8* %23, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = load i8*, i8** %1
%29 = load i64, i64* %6
%30 = getelementptr inbounds i8, i8* %28, i64 %29
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp ne i32 %27, %32
br i1 %33, label %34, label %35
34: ; preds = %22
store i32 0, i32* %4
br label %40
35: ; preds = %22
%36 = load i64, i64* %5
%37 = add i64 %36, 1
store i64 %37, i64* %5
%38 = load i64, i64* %6
%39 = add i64 %38, -1
store i64 %39, i64* %6
br label %16
40: ; preds = %34, %16
%41 = load i32, i32* %4
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %40
%44 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
br label %47
45: ; preds = %40
%46 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
br label %47
47: ; preds = %45, %43
br label %48
48: ; preds = %47, %0
%49 = load i8*, i8** %1
%50 = call i32 @free(i8* %49)
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"Enter your string: \00"
@stdin = global i32 0
@str = [27 x i8] c"no it is not a palindrome.\00"
@str.3 = [24 x i8] c"yes it is a palindrome.\00"
define void @question_one() {
%1 = alloca i8*
%2 = alloca i64
%3 = bitcast i8** %1 to i8*
store i8* null, i8** %1
%4 = bitcast i64* %2 to i8*
store i64 0, i64* %2
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @stdin
%7 = call i32 @getline(i8** %1, i64* %2, i32 %6)
%8 = icmp eq i32 %7, -1
br i1 %8, label %31, label %9
9: ; preds = %0
%10 = add nsw i32 %7, -2
%11 = sext i32 %10 to i64
%12 = icmp eq i32 %10, 0
br i1 %12, label %28, label %13
13: ; preds = %9
%14 = load i8*, i8** %1
%15 = call i64 @llvm.umax.i64(i64 %11, i64 1)
br label %16
16: ; preds = %13, %24
%17 = phi i64 [ %11, %13 ], [ %26, %24 ]
%18 = phi i64 [ 0, %13 ], [ %25, %24 ]
%19 = getelementptr inbounds i8, i8* %14, i64 %18
%20 = load i8, i8* %19
%21 = getelementptr inbounds i8, i8* %14, i64 %17
%22 = load i8, i8* %21
%23 = icmp eq i8 %20, %22
br i1 %23, label %24, label %28
24: ; preds = %16
%25 = add nuw i64 %18, 1
%26 = add i64 %17, -1
%27 = icmp eq i64 %25, %15
br i1 %27, label %28, label %16
28: ; preds = %16, %24, %9
%29 = phi i8* [ getelementptr inbounds ([24 x i8], [24 x i8]* @str.3, i64 0, i64 0), %9 ], [ getelementptr inbounds ([24 x i8], [24 x i8]* @str.3, i64 0, i64 0), %24 ], [ getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0), %16 ]
%30 = call i32 @puts(i8* dereferenceable(1) %29)
br label %31
31: ; preds = %28, %0
%32 = load i8*, i8** %1
%33 = call i32 @free(i8* %32)
ret void
}