#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);
char *reverseACString(char *);
int /*<<< orphan*/ scanf(char *, char *);
int strlen(char *);
int main() {
  char *str;
  scanf("%s", str);
  char *x = reverseACString(str);
  for (int i = 0; i <= strlen(str); i++) {
    printf("%c", x[i]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xea6(%rip),%rdi
call   1060 <scanf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <reverseACString@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
cmp    %ecx,%eax
jg     11b5 <main+0x75>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
lea    0xe65(%rip),%rdi
movsbl (%rax,%rcx,1),%esi
call   1050 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1173 <main+0x33>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
lea    0xeb4(%rip),%rdi
call   1060 <scanf@plt>
call   1030 <reverseACString@plt>
mov    %rax,%r15
call   1040 <strlen@plt>
test   %eax,%eax
js     118e <main+0x4e>
mov    $0xffffffffffffffff,%rbx
lea    0xe93(%rip),%r14
movsbl 0x1(%r15,%rbx,1),%esi
mov    %r14,%rdi
call   1050 <printf@plt>
call   1040 <strlen@plt>
cltq
add    $0x1,%rbx
cmp    %rax,%rbx
jl     1170 <main+0x30>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"%c\00"
define i32 @main() {
%1 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* undef)
%2 = tail call i8* @reverseACString(i8* undef)
%3 = tail call i32 @strlen(i8* undef)
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %6, %0
ret i32 0
6: ; preds = %0, %6
%7 = phi i64 [ %11, %6 ], [ 0, %0 ]
%8 = getelementptr inbounds i8, i8* %2, i64 %7
%9 = load i8, i8* %8
%10 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 signext %9)
%11 = add nuw nsw i64 %7, 1
%12 = tail call i32 @strlen(i8* undef)
%13 = sext i32 %12 to i64
%14 = icmp slt i64 %7, %13
br i1 %14, label %6, label %5
}