#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 strlen(char *);
int main() {
  char c[10000];
  int i = 0;
  int j;
  int a;
  printf("Enter text:");
  scanf("%s", c);
  j = strlen(c) - 1;
  while (i < j) {
    a = c[i];
    c[i] = c[j];
    c[j] = a;
    i++;
    j--;
  }
  printf("%s", c);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2730,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x2724(%rbp)
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x2720(%rbp),%rsi
lea    0xea4(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x2720(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0x2728(%rbp)
mov    -0x2724(%rbp),%eax
cmp    -0x2728(%rbp),%eax
jge    11fe <main+0xce>
movslq -0x2724(%rbp),%rax
movsbl -0x2720(%rbp,%rax,1),%eax
ff
mov    %eax,-0x272c(%rbp)
movslq -0x2728(%rbp),%rax
mov    -0x2720(%rbp,%rax,1),%cl
movslq -0x2724(%rbp),%rax
mov    %cl,-0x2720(%rbp,%rax,1)
mov    -0x272c(%rbp),%eax
mov    %al,%cl
movslq -0x2728(%rbp),%rax
mov    %cl,-0x2720(%rbp,%rax,1)
mov    -0x2724(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2724(%rbp)
mov    -0x2728(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x2728(%rbp)
jmp    1182 <main+0x52>
lea    -0x2720(%rbp),%rsi
lea    0xe00(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x2730,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x2710,%rsp
lea    0xec1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xebf(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmp    $0x2,%eax
jl     1190 <main+0x60>
mov    %eax,%eax
add    $0xfffffffffffffffe,%rax
xor    %ecx,%ecx
nopl   (%rax)
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     1170 <main+0x40>
lea    0xe75(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x2710,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [12 x i8] c"Enter text:\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @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 ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = call i32 @strlen(i8* %2)
%6 = icmp sgt i32 %5, 1
br i1 %6, label %7, label %20
7: ; preds = %0
%8 = zext i32 %5 to i64
%9 = add nsw i64 %8, -1
br label %10
10: ; preds = %7, %10
%11 = phi i64 [ 0, %7 ], [ %17, %10 ]
%12 = phi i64 [ %9, %7 ], [ %18, %10 ]
%13 = getelementptr inbounds [10000 x i8], [10000 x i8]* %1, i64 0, i64 %11
%14 = load i8, i8* %13
%15 = getelementptr inbounds [10000 x i8], [10000 x i8]* %1, i64 0, i64 %12
%16 = load i8, i8* %15
store i8 %16, i8* %13
store i8 %14, i8* %15
%17 = add nuw nsw i64 %11, 1
%18 = add nsw i64 %12, -1
%19 = icmp slt i64 %17, %18
br i1 %19, label %10, label %20
20: ; preds = %10, %0
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
ret i32 0
}