#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*/ gets(char *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *);
int strlen(char *);
int main() {
  char letter, word[1000];
  int l, i = 0, n;
  printf("Vuvedi tekst:", n);
  scanf("%d", &n);
  gets(word);
  l = strlen(word) - 1;
  while (l > i) {
    letter = word[l];
    word[l] = word[i];
    word[i] = letter;
    (i++, l--);
  }
  puts(word);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x3f8(%rbp)
mov    -0x3fc(%rbp),%esi
lea    0xe87(%rip),%rdi
call   1050 <printf@plt>
lea    0xe89(%rip),%rdi
lea    -0x3fc(%rbp),%rsi
call   1070 <scanf@plt>
lea    -0x3f0(%rbp),%rdi
call   1060 <gets@plt>
lea    -0x3f0(%rbp),%rdi
call   1040 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0x3f4(%rbp)
mov    -0x3f4(%rbp),%eax
cmp    -0x3f8(%rbp),%eax
jle    1225 <main+0xd5>
movslq -0x3f4(%rbp),%rax
mov    -0x3f0(%rbp,%rax,1),%al
mov    %al,-0x5(%rbp)
movslq -0x3f8(%rbp),%rax
mov    -0x3f0(%rbp,%rax,1),%cl
movslq -0x3f4(%rbp),%rax
mov    %cl,-0x3f0(%rbp,%rax,1)
mov    -0x5(%rbp),%cl
movslq -0x3f8(%rbp),%rax
mov    %cl,-0x3f0(%rbp,%rax,1)
mov    -0x3f8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3f8(%rbp)
mov    -0x3f4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x3f4(%rbp)
jmp    11b2 <main+0x62>
lea    -0x3f0(%rbp),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x400,%rsp
lea    0xea1(%rip),%rdi
call   1050 <printf@plt>
lea    0xea3(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <gets@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    $0x2,%eax
jl     11c2 <main+0x72>
mov    %eax,%eax
add    $0xfffffffffffffffe,%rax
xor    %ecx,%ecx
nopw   0x0(%rax,%rax,1)
movzbl 0x11(%rsp,%rax,1),%edx
movzbl 0x10(%rsp,%rcx,1),%ebx
mov    %bl,0x11(%rsp,%rax,1)
mov    %dl,0x10(%rsp,%rcx,1)
add    $0x1,%rcx
lea    -0x1(%rax),%rdx
cmp    %rcx,%rax
mov    %rdx,%rax
jg     11a0 <main+0x50>
lea    0x10(%rsp),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbx
ret

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

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