#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 *, char *);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char str[50];
  char rev[50];
  int i = -1, j = 0;
  scanf("%s", str);
  while (str[++i] != '\0')
    ;
  while (i >= 0)
    rev[j++] = str[--i];
  rev[j] = '\0';
  printf("%s", rev);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffff,-0x84(%rbp)
ff ff ff
movl   $0x0,-0x88(%rbp)
lea    -0x40(%rbp),%rsi
lea    0xeaf(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
cltq
movsbl -0x40(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     117a <main+0x5a>
jmp    1156 <main+0x36>
jmp    117f <main+0x5f>
cmpl   $0x0,-0x84(%rbp)
jl     11bd <main+0x9d>
mov    -0x84(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x84(%rbp)
cltq
mov    -0x40(%rbp,%rax,1),%cl
mov    -0x88(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x88(%rbp)
cltq
mov    %cl,-0x80(%rbp,%rax,1)
jmp    117f <main+0x5f>
movslq -0x88(%rbp),%rax
movb   $0x0,-0x80(%rbp,%rax,1)
lea    -0x80(%rbp),%rsi
lea    0xe2c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x80,%rsp
lea    0xecd(%rip),%rdi
lea    0x40(%rsp),%r14
mov    %r14,%rsi
call   1040 <scanf@plt>
mov    $0xffffffff,%ecx
movabs $0xffffffff00000000,%rdx
ff ff ff
xor    %eax,%eax
movabs $0x100000000,%rsi
nopl   0x0(%rax,%rax,1)
add    %rsi,%rdx
add    $0x1,%ecx
cmpb   $0x0,0x40(%rsp,%rax,1)
lea    0x1(%rax),%rax
jne    1160 <main+0x40>
lea    -0x2(%rax),%esi
xor    %edi,%edi
cmp    $0xffffffff,%esi
jl     1326 <main+0x206>
sar    $0x20,%rdx
test   %ecx,%ecx
mov    $0x0,%r11d
cmovs  %ecx,%r11d
neg    %r11d
add    %rax,%r11
cmp    $0x8,%r11d
jb     12f7 <main+0x1d7>
lea    -0x1(%rax),%r9
mov    %r11d,%r8d
xor    %r10d,%r10d
cmp    $0x20,%r11d
jae    11b6 <main+0x96>
xor    %edi,%edi
jmp    127c <main+0x15c>
mov    %r8d,%edi
and    $0xffffffe0,%edi
movslq %r9d,%rsi
lea    (%rsp,%rsi,1),%rbx
add    $0x30,%rbx
test   %ecx,%ecx
mov    $0x0,%esi
cmovs  %ecx,%esi
mov    %eax,%r15d
sub    %esi,%r15d
and    $0xffffffe0,%r15d
pxor   %xmm0,%xmm0
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movdqu -0x10(%rbx),%xmm1
movdqu (%rbx),%xmm2
movdqa %xmm2,%xmm3
punpcklbw %xmm0,%xmm3
pshufd $0x4e,%xmm3,%xmm3
pshuflw $0x1b,%xmm3,%xmm3
pshufhw $0x1b,%xmm3,%xmm3
punpckhbw %xmm0,%xmm2
pshufd $0x4e,%xmm2,%xmm2
pshuflw $0x1b,%xmm2,%xmm2
pshufhw $0x1b,%xmm2,%xmm2
packuswb %xmm3,%xmm2
movdqa %xmm1,%xmm3
punpcklbw %xmm0,%xmm3
pshufd $0x4e,%xmm3,%xmm3
pshuflw $0x1b,%xmm3,%xmm3
pshufhw $0x1b,%xmm3,%xmm3
punpckhbw %xmm0,%xmm1
pshufd $0x4e,%xmm1,%xmm1
pshuflw $0x1b,%xmm1,%xmm1
pshufhw $0x1b,%xmm1,%xmm1
packuswb %xmm3,%xmm1
movdqa %xmm2,(%rsp,%rsi,1)
movdqa %xmm1,0x10(%rsp,%rsi,1)
add    $0x20,%rsi
add    $0xffffffffffffffe0,%rbx
cmp    %rsi,%r15
jne    11f0 <main+0xd0>
cmp    %r8,%rdi
je     1323 <main+0x203>
test   $0x18,%r8b
je     12f4 <main+0x1d4>
mov    %rdi,%rsi
mov    %r8d,%edi
and    $0xfffffff8,%edi
sub    %rdi,%rdx
mov    %rsi,%rbx
neg    %rbx
lea    (%rsp,%rbx,1),%r15
add    $0x40,%r15
movslq %r9d,%rbx
test   %ecx,%ecx
cmovs  %ecx,%r10d
add    %r15,%rbx
add    $0xfffffffffffffff8,%rbx
mov    %eax,%r9d
sub    %r10d,%r9d
and    $0xfffffff8,%r9d
pxor   %xmm0,%xmm0
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movq   (%rbx),%xmm1
punpcklbw %xmm0,%xmm1
pshufd $0x4e,%xmm1,%xmm1
pshuflw $0x1b,%xmm1,%xmm1
pshufhw $0x1b,%xmm1,%xmm1
packuswb %xmm1,%xmm1
movq   %xmm1,(%rsp,%rsi,1)
add    $0x8,%rsi
add    $0xfffffffffffffff8,%rbx
cmp    %rsi,%r9
jne    12c0 <main+0x1a0>
cmp    %r8,%rdi
jne    12f7 <main+0x1d7>
jmp    1323 <main+0x203>
sub    %rdi,%rdx
add    %r14,%rdx
add    $0xffffffffffffffff,%rdx
xor    %esi,%esi
test   %ecx,%ecx
cmovs  %ecx,%esi
sub    %esi,%eax
nopw   0x0(%rax,%rax,1)
movzbl (%rdx),%ecx
mov    %cl,(%rsp,%rdi,1)
add    $0x1,%rdi
add    $0xffffffffffffffff,%rdx
cmp    %rdi,%rax
jne    1310 <main+0x1f0>
mov    %r11d,%edi
movb   $0x0,(%rsp,%rdi,1)
lea    0xccf(%rip),%rdi
mov    %rsp,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [50 x i8]
%2 = alloca [50 x i8]
%3 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
br label %6
6: ; preds = %6, %0
%7 = phi i64 [ %8, %6 ], [ -1, %0 ]
%8 = add nsw i64 %7, 1
%9 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %6
12: ; preds = %6
%13 = trunc i64 %7 to i32
%14 = trunc i64 %8 to i32
%15 = icmp sgt i32 %13, -2
br i1 %15, label %16, label %86
16: ; preds = %12
%17 = shl i64 %8, 32
%18 = ashr exact i64 %17, 32
%19 = add i32 %14, 1
%20 = call i32 @llvm.smin.i32(i32 %14, i32 0)
%21 = sub i32 %19, %20
%22 = zext i32 %21 to i64
%23 = icmp ult i32 %21, 8
br i1 %23, label %72, label %24
24: ; preds = %16
%25 = icmp ult i32 %21, 32
br i1 %25, label %53, label %26
26: ; preds = %24
%27 = and i64 %22, 4294967264
br label %28
28: ; preds = %28, %26
%29 = phi i64 [ 0, %26 ], [ %45, %28 ]
%30 = xor i64 %29, -1
%31 = add i64 %18, %30
%32 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 %31
%33 = getelementptr inbounds i8, i8* %32, i64 -15
%34 = bitcast i8* %33 to <16 x i8>*
%35 = load <16 x i8>, <16 x i8>* %34
%36 = shufflevector <16 x i8> %35, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
%37 = getelementptr inbounds i8, i8* %32, i64 -31
%38 = bitcast i8* %37 to <16 x i8>*
%39 = load <16 x i8>, <16 x i8>* %38
%40 = shufflevector <16 x i8> %39, <16 x i8> poison, <16 x i32> <i32 15, i32 14, i32 13, i32 12, i32 11, i32 10, i32 9, i32 8, i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
%41 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 %29
%42 = bitcast i8* %41 to <16 x i8>*
store <16 x i8> %36, <16 x i8>* %42
%43 = getelementptr inbounds i8, i8* %41, i64 16
%44 = bitcast i8* %43 to <16 x i8>*
store <16 x i8> %40, <16 x i8>* %44
%45 = add nuw i64 %29, 32
%46 = icmp eq i64 %45, %27
br i1 %46, label %47, label %28
47: ; preds = %28
%48 = icmp eq i64 %27, %22
br i1 %48, label %84, label %49
49: ; preds = %47
%50 = sub nsw i64 %18, %27
%51 = and i64 %22, 24
%52 = icmp eq i64 %51, 0
br i1 %52, label %72, label %53
53: ; preds = %24, %49
%54 = phi i64 [ %27, %49 ], [ 0, %24 ]
%55 = and i64 %22, 4294967288
%56 = sub nsw i64 %18, %55
br label %57
57: ; preds = %57, %53
%58 = phi i64 [ %54, %53 ], [ %68, %57 ]
%59 = xor i64 %58, -1
%60 = add i64 %18, %59
%61 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 %60
%62 = getelementptr inbounds i8, i8* %61, i64 -7
%63 = bitcast i8* %62 to <8 x i8>*
%64 = load <8 x i8>, <8 x i8>* %63
%65 = shufflevector <8 x i8> %64, <8 x i8> poison, <8 x i32> <i32 7, i32 6, i32 5, i32 4, i32 3, i32 2, i32 1, i32 0>
%66 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 %58
%67 = bitcast i8* %66 to <8 x i8>*
store <8 x i8> %65, <8 x i8>* %67
%68 = add nuw i64 %58, 8
%69 = icmp eq i64 %68, %55
br i1 %69, label %70, label %57
70: ; preds = %57
%71 = icmp eq i64 %55, %22
br i1 %71, label %84, label %72
72: ; preds = %16, %49, %70
%73 = phi i64 [ %18, %16 ], [ %50, %49 ], [ %56, %70 ]
%74 = phi i64 [ 0, %16 ], [ %27, %49 ], [ %55, %70 ]
br label %75
75: ; preds = %72, %75
%76 = phi i64 [ %78, %75 ], [ %73, %72 ]
%77 = phi i64 [ %81, %75 ], [ %74, %72 ]
%78 = add nsw i64 %76, -1
%79 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 %78
%80 = load i8, i8* %79
%81 = add nuw nsw i64 %77, 1
%82 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 %77
store i8 %80, i8* %82
%83 = icmp eq i64 %81, %22
br i1 %83, label %84, label %75
84: ; preds = %75, %70, %47
%85 = zext i32 %21 to i64
br label %86
86: ; preds = %12, %84
%87 = phi i64 [ %85, %84 ], [ 0, %12 ]
%88 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 %87
store i8 0, i8* %88
%89 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 0
}