#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 EXIT_SUCCESS;
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
size_t remove_new_line(char *);
int /*<<< orphan*/ reverce_str(char *, char *, size_t);
int /*<<< orphan*/ stdin;
int main() {
  char bufer[20];
  fgets(bufer, 20, stdin);
  size_t lengh = remove_new_line(bufer);
  char reverst[lengh - 1];
  reverce_str(reverst, bufer, lengh);
  printf("%s", reverst);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e92(%rip),%rax
mov    (%rax),%edx
lea    -0x20(%rbp),%rdi
mov    %rdi,-0x48(%rbp)
mov    $0x14,%esi
call   1040 <fgets@plt>
mov    -0x48(%rbp),%rdi
call   1050 <remove_new_line@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rcx
mov    %rcx,%rax
add    $0xffffffffffffffff,%rax
mov    %rsp,%rdx
mov    %rdx,-0x30(%rbp)
add    $0xe,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x40(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x38(%rbp)
lea    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1060 <reverce_str@plt>
mov    -0x40(%rbp),%rsi
lea    0xe46(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e12(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    0x2e94(%rip),%rax
mov    (%rax),%edx
lea    -0x30(%rbp),%r14
mov    %r14,%rdi
mov    $0x14,%esi
call   1040 <fgets@plt>
mov    %r14,%rdi
call   1050 <remove_new_line@plt>
mov    %rsp,%r15
mov    %rsp,%rbx
lea    0xe(%rax),%rcx
and    $0xfffffffffffffff0,%rcx
sub    %rcx,%rbx
mov    %rbx,%rsp
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %rax,%rdx
call   1060 <reverce_str@plt>
lea    0xe68(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    0x2e31(%rip),%rax
mov    (%rax),%eax
mov    %r15,%rsp
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [3 x i8] c"%s\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i8]
%3 = alloca i64
%4 = alloca i8*
%5 = alloca i64
store i32 0, i32* %1
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%7 = load i32, i32* @stdin
%8 = call i32 @fgets(i8* %6, i32 20, i32 %7)
%9 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%10 = call i64 @remove_new_line(i8* %9)
store i64 %10, i64* %3
%11 = load i64, i64* %3
%12 = sub i64 %11, 1
%13 = call i8* @llvm.stacksave()
store i8* %13, i8** %4
%14 = alloca i8, i64 %12
store i64 %12, i64* %5
%15 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%16 = load i64, i64* %3
%17 = call i32 @reverce_str(i8* %14, i8* %15, i64 %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %14)
%19 = load i32, i32* @EXIT_SUCCESS
store i32 %19, i32* %1
%20 = load i8*, i8** %4
%21 = load i32, i32* %1
ret i32 %21
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [3 x i8] c"%s\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = call i32 @fgets(i8* %2, i32 20, i32 %3)
%5 = call i64 @remove_new_line(i8* %2)
%6 = add i64 %5, -1
%7 = call i8* @llvm.stacksave()
%8 = alloca i8, i64 %6
%9 = call i32 @reverce_str(i8* %8, i8* %2, i64 %5)
%10 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %8)
%11 = load i32, i32* @EXIT_SUCCESS
ret i32 %11
}