#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 */
char EOF;
int EXIT_SUCCESS;
char getchar();
int /*<<< orphan*/ puts(char *);
int main() {
  int n, i = 0, j, k;
  char str[255], ch, temp;
  while ((ch = getchar()) != EOF) {
    str[i++] = ch;
  }
  str[i] = '\0';
  for (j = 0, k = i - 1; j < k; j++, k--) {
    temp = str[j];
    str[j] = str[k];
    str[k] = temp;
  }
  puts(str);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x121(%rbp)
movsbl %al,%eax
mov    0x2e98(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     117a <main+0x5a>
mov    -0x121(%rbp),%cl
mov    -0xc(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
cltq
mov    %cl,-0x120(%rbp,%rax,1)
jmp    1139 <main+0x19>
movslq -0xc(%rbp),%rax
movb   $0x0,-0x120(%rbp,%rax,1)
movl   $0x0,-0x10(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11f1 <main+0xd1>
movslq -0x10(%rbp),%rax
mov    -0x120(%rbp,%rax,1),%al
mov    %al,-0x122(%rbp)
movslq -0x14(%rbp),%rax
mov    -0x120(%rbp,%rax,1),%cl
movslq -0x10(%rbp),%rax
mov    %cl,-0x120(%rbp,%rax,1)
mov    -0x122(%rbp),%cl
movslq -0x14(%rbp),%rax
mov    %cl,-0x120(%rbp,%rax,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1196 <main+0x76>
lea    -0x120(%rbp),%rdi
call   1030 <puts@plt>
mov    0x2dd4(%rip),%rax
mov    (%rax),%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x108,%rsp
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb0(%rip),%r14
cmp    (%r14),%al
jne    1143 <main+0x23>
movb   $0x0,(%rsp)
jmp    11a0 <main+0x80>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %al,(%rsp,%rbx,1)
add    $0x1,%rbx
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r14),%al
jne    1150 <main+0x30>
mov    %ebx,%eax
movb   $0x0,(%rsp,%rax,1)
cmp    $0x2,%ebx
jl     11a0 <main+0x80>
mov    %ebx,%eax
add    $0xfffffffffffffffe,%rax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
movzbl (%rsp,%rcx,1),%edx
movzbl 0x1(%rsp,%rax,1),%ebx
mov    %bl,(%rsp,%rcx,1)
mov    %dl,0x1(%rsp,%rax,1)
add    $0x1,%rcx
lea    -0x1(%rax),%rdx
cmp    %rax,%rcx
mov    %rdx,%rax
jl     1180 <main+0x60>
mov    %rsp,%rdi
call   1030 <puts@plt>
mov    0x2e29(%rip),%rax
mov    (%rax),%eax
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@EOF = global i8 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [255 x i8]
%7 = alloca i8
%8 = alloca i8
store i32 0, i32* %1
store i32 0, i32* %3
br label %9
9: ; preds = %15, %0
%10 = call signext i8 (...) @getchar()
store i8 %10, i8* %7
%11 = sext i8 %10 to i32
%12 = load i8, i8* @EOF
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %11, %13
br i1 %14, label %15, label %21
15: ; preds = %9
%16 = load i8, i8* %7
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
store i32 %18, i32* %3
%19 = sext i32 %17 to i64
%20 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 %19
store i8 %16, i8* %20
br label %9
21: ; preds = %9
%22 = load i32, i32* %3
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 %23
store i8 0, i8* %24
store i32 0, i32* %4
%25 = load i32, i32* %3
%26 = sub nsw i32 %25, 1
store i32 %26, i32* %5
br label %27
27: ; preds = %47, %21
%28 = load i32, i32* %4
%29 = load i32, i32* %5
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %52
31: ; preds = %27
%32 = load i32, i32* %4
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 %33
%35 = load i8, i8* %34
store i8 %35, i8* %8
%36 = load i32, i32* %5
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 %37
%39 = load i8, i8* %38
%40 = load i32, i32* %4
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 %41
store i8 %39, i8* %42
%43 = load i8, i8* %8
%44 = load i32, i32* %5
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 %45
store i8 %43, i8* %46
br label %47
47: ; preds = %31
%48 = load i32, i32* %4
%49 = add nsw i32 %48, 1
store i32 %49, i32* %4
%50 = load i32, i32* %5
%51 = add nsw i32 %50, -1
store i32 %51, i32* %5
br label %27
52: ; preds = %27
%53 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 0
%54 = call i32 @puts(i8* %53)
%55 = load i32, i32* @EXIT_SUCCESS
ret i32 %55
}

LLVM IR (-O2):
@EOF = global i8 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca [255 x i8]
%2 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
%3 = tail call signext i8 (...) @getchar()
%4 = load i8, i8* @EOF
%5 = icmp eq i8 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
store i8 0, i8* %7
br label %34
8: ; preds = %0, %8
%9 = phi i64 [ %11, %8 ], [ 0, %0 ]
%10 = phi i8 [ %13, %8 ], [ %3, %0 ]
%11 = add nuw i64 %9, 1
%12 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 %9
store i8 %10, i8* %12
%13 = tail call signext i8 (...) @getchar()
%14 = load i8, i8* @EOF
%15 = icmp eq i8 %13, %14
br i1 %15, label %16, label %8
16: ; preds = %8
%17 = trunc i64 %11 to i32
%18 = and i64 %11, 4294967295
%19 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 %18
store i8 0, i8* %19
%20 = icmp sgt i32 %17, 1
br i1 %20, label %21, label %34
21: ; preds = %16
%22 = and i64 %11, 4294967295
%23 = add nsw i64 %22, -1
br label %24
24: ; preds = %21, %24
%25 = phi i64 [ 0, %21 ], [ %31, %24 ]
%26 = phi i64 [ %23, %21 ], [ %32, %24 ]
%27 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 %25
%28 = load i8, i8* %27
%29 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 %26
%30 = load i8, i8* %29
store i8 %30, i8* %27
store i8 %28, i8* %29
%31 = add nuw nsw i64 %25, 1
%32 = add nsw i64 %26, -1
%33 = icmp slt i64 %31, %32
br i1 %33, label %24, label %34
34: ; preds = %24, %6, %16
%35 = call i32 @puts(i8* %2)
%36 = load i32, i32* @EXIT_SUCCESS
ret i32 %36
}