#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*/ printf(char *, ...);
scalar_t__ scanf(char *, char **);
int main() {
  int i;
  char line[4];
  while (scanf("%s", &line) != EOF) {
    for (i = 3; i >= 0; i--)
      printf("%c", line[i]);
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xc(%rbp),%rsi
lea    0xec6(%rip),%rdi
call   1040 <scanf@plt>
mov    0x2ea2(%rip),%rcx
cmp    (%rcx),%rax
je     1198 <main+0x78>
movl   $0x3,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1185 <main+0x65>
movslq -0x8(%rbp),%rax
movsbl -0xc(%rbp,%rax,1),%esi
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1156 <main+0x36>
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    112f <main+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xed0(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x2ea7(%rip),%r15
cmp    (%r15),%rax
je     11a2 <main+0x82>
lea    0xeb3(%rip),%r14
lea    0xc(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl 0xf(%rsp),%edi
call   1030 <putchar@plt>
movsbl 0xe(%rsp),%edi
call   1030 <putchar@plt>
movsbl 0xd(%rsp),%edi
call   1030 <putchar@plt>
movsbl 0xc(%rsp),%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
cmp    (%r15),%rax
jne    1160 <main+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

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