#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 */
scalar_t__ EOF;
int /*<<< orphan*/ longest_palindrome(char *);
char *malloc(int);
int /*<<< orphan*/ pre_process(char *, char *);
int /*<<< orphan*/ printf(char *, char *);
scalar_t__ scanf(char *, char *);
int strlen(char *);
int main(void) {
  char in[(128)] = {0};
  char *tmp;
  while (scanf("%s", in) != EOF) {
    tmp = malloc(strlen(in) * 2 + 4);
    pre_process(in, tmp);
    printf("%s\n", tmp);
    longest_palindrome(tmp);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1050 <memset@plt>
lea    -0x90(%rbp),%rsi
lea    0xe5d(%rip),%rdi
call   1090 <scanf@plt>
mov    0x2e39(%rip),%rcx
cmp    (%rcx),%rax
je     120f <main+0x9f>
lea    -0x90(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%edi
shl    $0x1,%edi
add    $0x4,%edi
call   1080 <malloc@plt>
mov    %rax,-0x98(%rbp)
lea    -0x90(%rbp),%rdi
mov    -0x98(%rbp),%rsi
call   1070 <pre_process@plt>
mov    -0x98(%rbp),%rsi
lea    0xe0a(%rip),%rdi
call   1040 <printf@plt>
mov    -0x98(%rbp),%rdi
call   1060 <longest_palindrome@plt>
jmp    1195 <main+0x25>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x80,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
lea    0xe5f(%rip),%rdi
mov    %rsp,%rsi
call   1080 <scanf@plt>
mov    0x2e38(%rip),%r13
cmp    0x0(%r13),%rax
je     1215 <main+0xb5>
mov    %rsp,%r12
lea    0xe43(%rip),%r14
lea    0xe39(%rip),%r15
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
call   1030 <strlen@plt>
lea    (%rax,%rax,1),%edi
add    $0x4,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
mov    %r12,%rdi
mov    %rax,%rsi
call   1060 <pre_process@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <longest_palindrome@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1080 <scanf@plt>
cmp    0x0(%r13),%rax
jne    11d0 <main+0x70>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@EOF = global i64 0
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [128 x i8]
%3 = alloca i8*
store i32 0, i32* %1
%4 = bitcast [128 x i8]* %2 to i8*
br label %5
5: ; preds = %10, %0
%6 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%7 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i64, i64* @EOF
%9 = icmp ne i64 %7, %8
br i1 %9, label %10, label %23
10: ; preds = %5
%11 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%12 = call i32 @strlen(i8* %11)
%13 = mul nsw i32 %12, 2
%14 = add nsw i32 %13, 4
%15 = call i8* @malloc(i32 %14)
store i8* %15, i8** %3
%16 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%17 = load i8*, i8** %3
%18 = call i32 @pre_process(i8* %16, i8* %17)
%19 = load i8*, i8** %3
%20 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %19)
%21 = load i8*, i8** %3
%22 = call i32 @longest_palindrome(i8* %21)
br label %5
23: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@EOF = global i64 0
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [128 x i8]
%2 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%3 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = load i64, i64* @EOF
%5 = icmp eq i64 %3, %4
br i1 %5, label %17, label %6
6: ; preds = %0, %6
%7 = call i32 @strlen(i8* %2)
%8 = shl nsw i32 %7, 1
%9 = add nsw i32 %8, 4
%10 = call i8* @malloc(i32 %9)
%11 = call i32 @pre_process(i8* %2, i8* %10)
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%13 = call i32 @longest_palindrome(i8* %10)
%14 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%15 = load i64, i64* @EOF
%16 = icmp eq i64 %14, %15
br i1 %16, label %17, label %6
17: ; preds = %6, %0
ret i32 0
}