#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, char *);
int main() {
  FILE *in = fopen("task.in", "r");
  FILE *out = fopen("task.out", "w");
  int limitSym = 100;
  char str[limitSym];
  int length = 0;
  fscanf(in, "%s", str);
  for (; str[length] != '\0'; length++)
    ;
  for (int i = 0, j = length - 1; i < j; i++, j--) {
    int temporary = str[j];
    str[j] = str[i];
    str[i] = temporary;
  }
  fprintf(out, "%s\n", str);
  fclose(in);
  fclose(out);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    0xeab(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    0xe9d(%rip),%rdi
lea    0xe9f(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
movl   $0x64,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdx
sub    %rcx,%rdx
mov    %rdx,-0x48(%rbp)
mov    %rdx,%rsp
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe59(%rip),%rsi
call   1040 <fscanf@plt>
mov    -0x48(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     11e9 <main+0xa9>
jmp    11db <main+0x9b>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11c1 <main+0x81>
movl   $0x0,-0x38(%rbp)
mov    -0x34(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    1245 <main+0x105>
mov    -0x48(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
mov    %ecx,-0x40(%rbp)
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
movslq -0x3c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x40(%rbp),%ecx
mov    %cl,%dl
movslq -0x38(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
mov    -0x3c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x3c(%rbp)
jmp    11f9 <main+0xb9>
mov    -0x48(%rbp),%rdx
mov    -0x18(%rbp),%rdi
lea    0xdc4(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x70,%rsp
lea    0xeb0(%rip),%rdi
lea    0xeb1(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%r14
lea    0xea4(%rip),%rdi
lea    0xea6(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%r15
lea    0xe99(%rip),%rsi
mov    %rsp,%rdx
mov    %r14,%rdi
call   1040 <fscanf@plt>
mov    $0xffffffffffffffff,%rdx
movabs $0xfffffffe00000000,%rax
ff ff ff
movabs $0x100000000,%rcx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    %rcx,%rax
cmpb   $0x0,0x1(%rsp,%rdx,1)
lea    0x1(%rdx),%rdx
jne    11b0 <main+0x70>
test   $0xfffffffe,%edx
je     11f0 <main+0xb0>
sar    $0x20,%rax
add    $0xffffffffffffffff,%rax
xor    %ecx,%ecx
movzbl 0x1(%rsp,%rax,1),%edx
movzbl (%rsp,%rcx,1),%ebx
mov    %bl,0x1(%rsp,%rax,1)
mov    %dl,(%rsp,%rcx,1)
add    $0x1,%rcx
lea    -0x1(%rax),%rdx
cmp    %rax,%rcx
mov    %rdx,%rax
jl     11d0 <main+0x90>
lea    0xe21(%rip),%rsi
mov    %rsp,%rdx
mov    %r15,%rdi
call   1050 <fprintf@plt>
mov    %r14,%rdi
call   1030 <fclose@plt>
mov    %r15,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [8 x i8] c"task.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [9 x i8] c"task.out\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %1
%11 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %11, i32** %2
%12 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %12, i32** %3
store i32 100, i32* %4
%13 = load i32, i32* %4
%14 = zext i32 %13 to i64
%15 = call i8* @llvm.stacksave()
store i8* %15, i8** %5
%16 = alloca i8, i64 %14
store i64 %14, i64* %6
store i32 0, i32* %7
%17 = load i32*, i32** %2
%18 = call i32 @fscanf(i32* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %16)
br label %19
19: ; preds = %27, %0
%20 = load i32, i32* %7
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %16, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %30
26: ; preds = %19
br label %27
27: ; preds = %26
%28 = load i32, i32* %7
%29 = add nsw i32 %28, 1
store i32 %29, i32* %7
br label %19
30: ; preds = %19
store i32 0, i32* %8
%31 = load i32, i32* %7
%32 = sub nsw i32 %31, 1
store i32 %32, i32* %9
br label %33
33: ; preds = %55, %30
%34 = load i32, i32* %8
%35 = load i32, i32* %9
%36 = icmp slt i32 %34, %35
br i1 %36, label %37, label %60
37: ; preds = %33
%38 = load i32, i32* %9
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8, i8* %16, i64 %39
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
store i32 %42, i32* %10
%43 = load i32, i32* %8
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8, i8* %16, i64 %44
%46 = load i8, i8* %45
%47 = load i32, i32* %9
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8, i8* %16, i64 %48
store i8 %46, i8* %49
%50 = load i32, i32* %10
%51 = trunc i32 %50 to i8
%52 = load i32, i32* %8
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8, i8* %16, i64 %53
store i8 %51, i8* %54
br label %55
55: ; preds = %37
%56 = load i32, i32* %8
%57 = add nsw i32 %56, 1
store i32 %57, i32* %8
%58 = load i32, i32* %9
%59 = add nsw i32 %58, -1
store i32 %59, i32* %9
br label %33
60: ; preds = %33
%61 = load i32*, i32** %3
%62 = call i32 @fprintf(i32* %61, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %16)
%63 = load i32*, i32** %2
%64 = call i32 @fclose(i32* %63)
%65 = load i32*, i32** %3
%66 = call i32 @fclose(i32* %65)
store i32 0, i32* %1
%67 = load i8*, i8** %5
%68 = load i32, i32* %1
ret i32 %68
}

LLVM IR (-O2):
@.str = [8 x i8] c"task.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [9 x i8] c"task.out\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%3 = alloca [100 x i8]
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%5 = call i32 @fscanf(i32* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %4)
br label %6
6: ; preds = %6, %0
%7 = phi i64 [ %11, %6 ], [ 0, %0 ]
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
%11 = add nuw i64 %7, 1
br i1 %10, label %12, label %6
12: ; preds = %6
%13 = and i64 %7, 4294967294
%14 = icmp eq i64 %13, 0
br i1 %14, label %19, label %15
15: ; preds = %12
%16 = shl i64 %7, 32
%17 = add i64 %16, -4294967296
%18 = ashr exact i64 %17, 32
br label %23
19: ; preds = %23, %12
%20 = call i32 @fprintf(i32* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %4)
%21 = call i32 @fclose(i32* %1)
%22 = call i32 @fclose(i32* %2)
ret i32 0
23: ; preds = %15, %23
%24 = phi i64 [ 0, %15 ], [ %30, %23 ]
%25 = phi i64 [ %18, %15 ], [ %31, %23 ]
%26 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %24
%29 = load i8, i8* %28
store i8 %29, i8* %26
store i8 %27, i8* %28
%30 = add nuw nsw i64 %24, 1
%31 = add nsw i64 %25, -1
%32 = icmp slt i64 %30, %31
br i1 %32, label %23, label %19
}