#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 *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int main(void) {
  char line[255];
  int i = 0;
  scanf("%c", &line[i]);
  while (line[i] != '\n')
    scanf("%c", &line[++i]);
  for (i--; i >= 0; i--)
    printf("%c", line[i]);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x114(%rbp)
movslq -0x114(%rbp),%rax
lea    -0x110(%rbp),%rsi
add    %rax,%rsi
lea    0xeac(%rip),%rdi
call   1040 <scanf@plt>
movslq -0x114(%rbp),%rax
movsbl -0x110(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
je     119d <main+0x7d>
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
cltq
lea    -0x110(%rbp),%rsi
add    %rax,%rsi
lea    0xe6d(%rip),%rdi
call   1040 <scanf@plt>
jmp    1159 <main+0x39>
mov    -0x114(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x114(%rbp)
cmpl   $0x0,-0x114(%rbp)
jl     11ea <main+0xca>
movslq -0x114(%rbp),%rax
movsbl -0x110(%rbp,%rax,1),%esi
ff
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x114(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x114(%rbp)
jmp    11ac <main+0x8c>
lea    0xe12(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x108,%rsp
lea    0xecb(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
cmpb   $0xa,(%rsp)
je     11a6 <main+0x86>
lea    0x1(%rsp),%r15
xor    %r12d,%r12d
lea    0xeae(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r12,%rbx
add    $0x1,%r12
lea    (%r15,%rbx,1),%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
cmpb   $0xa,0x1(%rsp,%rbx,1)
jne    1160 <main+0x40>
test   %r12d,%r12d
jle    11a6 <main+0x86>
mov    %r12d,%ebx
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
lea    -0x2(%rbx),%eax
movsbl (%rsp,%rax,1),%edi
call   1030 <putchar@plt>
add    $0xffffffffffffffff,%rbx
cmp    $0x1,%rbx
ja     1190 <main+0x70>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [255 x i8]
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
%4 = load i32, i32* %3
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 %5
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %8
8: ; preds = %15, %0
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 %10
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %13, 10
br i1 %14, label %15, label %21
15: ; preds = %8
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 %18
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %19)
br label %8
21: ; preds = %8
%22 = load i32, i32* %3
%23 = add nsw i32 %22, -1
store i32 %23, i32* %3
br label %24
24: ; preds = %34, %21
%25 = load i32, i32* %3
%26 = icmp sge i32 %25, 0
br i1 %26, label %27, label %37
27: ; preds = %24
%28 = load i32, i32* %3
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 %29
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %32)
br label %34
34: ; preds = %27
%35 = load i32, i32* %3
%36 = add nsw i32 %35, -1
store i32 %36, i32* %3
br label %24
37: ; preds = %24
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca [255 x i8]
%2 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = load i8, i8* %2
%5 = icmp eq i8 %4, 10
br i1 %5, label %27, label %11
6: ; preds = %11
%7 = trunc i64 %13 to i32
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %27
9: ; preds = %6
%10 = and i64 %13, 4294967295
br label %18
11: ; preds = %0, %11
%12 = phi i64 [ %13, %11 ], [ 0, %0 ]
%13 = add nuw nsw i64 %12, 1
%14 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 %13
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = load i8, i8* %14
%17 = icmp eq i8 %16, 10
br i1 %17, label %6, label %11
18: ; preds = %9, %18
%19 = phi i64 [ %10, %9 ], [ %20, %18 ]
%20 = add nsw i64 %19, -1
%21 = and i64 %20, 4294967295
%22 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = call i32 @putchar(i32 %24)
%26 = icmp ugt i64 %19, 1
br i1 %26, label %18, label %27
27: ; preds = %18, %0, %6
%28 = call i32 @putchar(i32 10)
ret i32 0
}