#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*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
int strlen(char *);
void main() {
  char a[10000], b;
  printf("\nVavedi tekst:");
  fgets(a, sizeof a, stdin);
  int i, l;
  l = strlen(a) - 1;
  for (i = 0; i < l; i++, l--) {
    b = a[i];
    a[i] = a[l];
    a[l] = b;
  }
  printf("%s\n", a);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2720,%rsp
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x2710(%rbp),%rdi
mov    0x2e91(%rip),%rax
mov    (%rax),%edx
mov    $0x2710,%esi
call   1050 <fgets@plt>
lea    -0x2710(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0x271c(%rbp)
movl   $0x0,-0x2718(%rbp)
mov    -0x2718(%rbp),%eax
cmp    -0x271c(%rbp),%eax
jge    11fb <main+0xcb>
movslq -0x2718(%rbp),%rax
mov    -0x2710(%rbp,%rax,1),%al
mov    %al,-0x2711(%rbp)
movslq -0x271c(%rbp),%rax
mov    -0x2710(%rbp,%rax,1),%cl
movslq -0x2718(%rbp),%rax
mov    %cl,-0x2710(%rbp,%rax,1)
mov    -0x2711(%rbp),%cl
movslq -0x271c(%rbp),%rax
mov    %cl,-0x2710(%rbp,%rax,1)
mov    -0x2718(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2718(%rbp)
mov    -0x271c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x271c(%rbp)
jmp    1182 <main+0x52>
lea    -0x2710(%rbp),%rsi
lea    0xe06(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x2720,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x2710,%rsp
lea    0xeb1(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2e8b(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x2710,%esi
call   1060 <fgets@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    $0x2,%eax
jl     11b0 <main+0x70>
mov    %eax,%eax
add    $0xfffffffffffffffe,%rax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl (%rsp,%rcx,1),%edx
movzbl 0x1(%rsp,%rax,1),%ebx
mov    %bl,(%rsp,%rcx,1)
mov    %dl,0x1(%rsp,%rax,1)
add    $0x1,%rcx
lea    -0x1(%rax),%rdx
cmp    %rax,%rcx
mov    %rdx,%rax
jl     1190 <main+0x50>
mov    %rsp,%rdi
call   1030 <puts@plt>
add    $0x2710,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"\0AVavedi tekst:\00"
@stdin = global i32 0
@.str.1 = [4 x i8] c"%s\0A\00"
define void @main() {
%1 = alloca [10000 x i8]
%2 = alloca i8
%3 = alloca i32
%4 = alloca i32
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [10000 x i8], [10000 x i8]* %1, i64 0, i64 0
%7 = load i32, i32* @stdin
%8 = call i32 @fgets(i8* %6, i32 10000, i32 %7)
%9 = getelementptr inbounds [10000 x i8], [10000 x i8]* %1, i64 0, i64 0
%10 = call i32 @strlen(i8* %9)
%11 = sub nsw i32 %10, 1
store i32 %11, i32* %4
store i32 0, i32* %3
br label %12
12: ; preds = %32, %0
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %37
16: ; preds = %12
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [10000 x i8], [10000 x i8]* %1, i64 0, i64 %18
%20 = load i8, i8* %19
store i8 %20, i8* %2
%21 = load i32, i32* %4
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [10000 x i8], [10000 x i8]* %1, i64 0, i64 %22
%24 = load i8, i8* %23
%25 = load i32, i32* %3
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [10000 x i8], [10000 x i8]* %1, i64 0, i64 %26
store i8 %24, i8* %27
%28 = load i8, i8* %2
%29 = load i32, i32* %4
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [10000 x i8], [10000 x i8]* %1, i64 0, i64 %30
store i8 %28, i8* %31
br label %32
32: ; preds = %16
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
store i32 %34, i32* %3
%35 = load i32, i32* %4
%36 = add nsw i32 %35, -1
store i32 %36, i32* %4
br label %12
37: ; preds = %12
%38 = getelementptr inbounds [10000 x i8], [10000 x i8]* %1, i64 0, i64 0
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %38)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"\0AVavedi tekst:\00"
@stdin = global i32 0
define void @main() {
%1 = alloca [10000 x i8]
%2 = getelementptr inbounds [10000 x i8], [10000 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @stdin
%5 = call i32 @fgets(i8* %2, i32 10000, i32 %4)
%6 = call i32 @strlen(i8* %2)
%7 = icmp sgt i32 %6, 1
br i1 %7, label %8, label %21
8: ; preds = %0
%9 = zext i32 %6 to i64
%10 = add nsw i64 %9, -1
br label %11
11: ; preds = %8, %11
%12 = phi i64 [ 0, %8 ], [ %18, %11 ]
%13 = phi i64 [ %10, %8 ], [ %19, %11 ]
%14 = getelementptr inbounds [10000 x i8], [10000 x i8]* %1, i64 0, i64 %12
%15 = load i8, i8* %14
%16 = getelementptr inbounds [10000 x i8], [10000 x i8]* %1, i64 0, i64 %13
%17 = load i8, i8* %16
store i8 %17, i8* %14
store i8 %15, i8* %16
%18 = add nuw nsw i64 %12, 1
%19 = add nsw i64 %13, -1
%20 = icmp slt i64 %18, %19
br i1 %20, label %11, label %21
21: ; preds = %11, %0
%22 = call i32 @puts(i8* %2)
ret void
}