#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() {
  char a[200], *p;
  int i, j;
  scanf("%s", a);
  for (i = 0; a[i] != '\0'; i++)
    ;
  for (p = a + i - 1; p >= a; p--)
    printf("%c", *p);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xd0(%rbp),%rsi
lea    0xec0(%rip),%rdi
call   1040 <scanf@plt>
movl   $0x0,-0xdc(%rbp)
movslq -0xdc(%rbp),%rax
movsbl -0xd0(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
je     1180 <main+0x60>
jmp    116c <main+0x4c>
mov    -0xdc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xdc(%rbp)
jmp    114f <main+0x2f>
lea    -0xd0(%rbp),%rax
movslq -0xdc(%rbp),%rcx
add    %rcx,%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0xd8(%rbp)
mov    -0xd8(%rbp),%rax
lea    -0xd0(%rbp),%rcx
cmp    %rcx,%rax
jb     11e2 <main+0xc2>
mov    -0xd8(%rbp),%rax
movsbl (%rax),%esi
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xd8(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0xd8(%rbp)
jmp    119c <main+0x7c>
lea    0xe1d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0xc8,%rsp
lea    0xecf(%rip),%rdi
mov    %rsp,%r14
mov    %r14,%rsi
call   1040 <scanf@plt>
mov    $0xffffffffffffffff,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmpb   $0x0,0x1(%rsp,%rax,1)
lea    0x1(%rax),%rax
jne    1150 <main+0x30>
mov    %eax,%eax
lea    (%rsp,%rax,1),%rbx
add    $0xffffffffffffffff,%rbx
cmp    %r14,%rbx
jb     1181 <main+0x61>
nopw   0x0(%rax,%rax,1)
movsbl (%rbx),%edi
call   1030 <putchar@plt>
add    $0xffffffffffffffff,%rbx
cmp    %r14,%rbx
jae    1170 <main+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0xc8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [200 x i8]
%2 = getelementptr inbounds [200 x i8], [200 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)
br label %4
4: ; preds = %4, %0
%5 = phi i64 [ %9, %4 ], [ 0, %0 ]
%6 = getelementptr inbounds [200 x i8], [200 x i8]* %1, i64 0, i64 %5
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
%9 = add nuw i64 %5, 1
br i1 %8, label %10, label %4
10: ; preds = %4
%11 = and i64 %5, 4294967295
%12 = getelementptr inbounds [200 x i8], [200 x i8]* %1, i64 0, i64 %11
%13 = getelementptr inbounds i8, i8* %12, i64 -1
%14 = icmp ult i8* %13, %2
br i1 %14, label %22, label %15
15: ; preds = %10, %15
%16 = phi i8* [ %20, %15 ], [ %13, %10 ]
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = call i32 @putchar(i32 %18)
%20 = getelementptr inbounds i8, i8* %16, i64 -1
%21 = icmp ult i8* %20, %2
br i1 %21, label %22, label %15
22: ; preds = %15, %10
%23 = call i32 @putchar(i32 10)
ret i32 0
}