#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 /*<<< orphan*/ puts(char *);
int strlen(char *);
int main() {
  int i, l;
  i = 0;
  char word[100];
  char a;
  printf("Vuvedi duma: ");
  gets(word);
  l = strlen(word) - 1;
  while (i < l) {
    a = word[l];
    word[l] = word[i];
    word[i] = a;
    i++;
    l--;
  }
  puts(word);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xea0(%rip),%rdi
call   1050 <printf@plt>
lea    -0x70(%rbp),%rdi
call   1060 <gets@plt>
lea    -0x70(%rbp),%rdi
call   1040 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11c6 <main+0x86>
movslq -0xc(%rbp),%rax
mov    -0x70(%rbp,%rax,1),%al
mov    %al,-0x71(%rbp)
movslq -0x8(%rbp),%rax
mov    -0x70(%rbp,%rax,1),%cl
movslq -0xc(%rbp),%rax
mov    %cl,-0x70(%rbp,%rax,1)
mov    -0x71(%rbp),%cl
movslq -0x8(%rbp),%rax
mov    %cl,-0x70(%rbp,%rax,1)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    117d <main+0x3d>
lea    -0x70(%rbp),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
lea    0xeb4(%rip),%rdi
call   1050 <printf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1060 <gets@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    $0x2,%eax
jl     11a0 <main+0x60>
mov    %eax,%eax
add    $0xfffffffffffffffe,%rax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
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     1180 <main+0x40>
mov    %rsp,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [14 x i8] c"Vuvedi duma: \00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @gets(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 [100 x i8], [100 x i8]* %1, i64 0, i64 %12
%14 = load i8, i8* %13
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %11
%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 @puts(i8* %2)
ret i32 0
}