#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 main() {
  char text[100];
  int begin, middle, end, length = 0;
  printf("Vuvedi teskt:\n");
  scanf("%s", text);
  while (text[length] != '\0')
    length++;
  end = length - 1;
  middle = length / 2;
  for (begin = 0; begin < middle; begin++) {
    if (text[begin] != text[end]) {
      printf("0\n");
      break;
    }
    end--;
  }
  if (begin == middle)
    printf("1\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x80(%rbp)
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
lea    -0x70(%rbp),%rsi
lea    0xebf(%rip),%rdi
call   1040 <scanf@plt>
movslq -0x80(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     1175 <main+0x55>
mov    -0x80(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x80(%rbp)
jmp    1155 <main+0x35>
mov    -0x80(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x7c(%rbp)
mov    -0x80(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x78(%rbp)
movl   $0x0,-0x74(%rbp)
mov    -0x74(%rbp),%eax
cmp    -0x78(%rbp),%eax
jge    11e1 <main+0xc1>
movslq -0x74(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
movslq -0x7c(%rbp),%rcx
movsbl -0x70(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
je     11ca <main+0xaa>
lea    0xe52(%rip),%rdi
call   1030 <printf@plt>
jmp    11e1 <main+0xc1>
mov    -0x7c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x7c(%rbp)
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1193 <main+0x73>
mov    -0x74(%rbp),%eax
cmp    -0x78(%rbp),%eax
jne    11f9 <main+0xd9>
lea    0xe21(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x68,%rsp
lea    0xed6(%rip),%rdi
call   1030 <puts@plt>
lea    0xec7(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    $0xffffffff,%ecx
nopl   0x0(%rax)
add    $0x1,%ecx
cmpb   $0x0,(%rbx)
lea    0x1(%rbx),%rbx
jne    1150 <main+0x30>
mov    %ecx,%ebp
shr    %ebp
xor    %edi,%edi
cmp    $0x2,%ecx
jb     11a5 <main+0x85>
cmp    $0x2,%ebp
mov    $0x1,%edi
cmovae %ebp,%edi
mov    $0x1,%edx
cmovae %ebp,%edx
neg    %rdx
movslq %ecx,%rcx
add    %rsp,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rsp,%rsi
xor    %ebx,%ebx
nopl   0x0(%rax)
movzbl (%rsi),%eax
cmp    (%rcx,%rbx,1),%al
jne    11be <main+0x9e>
add    $0xffffffffffffffff,%rbx
add    $0x1,%rsi
cmp    %rbx,%rdx
jne    1190 <main+0x70>
cmp    %ebp,%edi
jne    11b5 <main+0x95>
lea    0xe61(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %rbp
ret
neg    %ebx
lea    0xe4c(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%edi
cmp    %ebp,%edi
je     11a9 <main+0x89>
jmp    11b5 <main+0x95>

LLVM IR (-O0):
@.str = [15 x i8] c"Vuvedi teskt:\0A\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [3 x i8] c"0\0A\00"
@.str.3 = [3 x i8] c"1\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %6
%7 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %8)
br label %10
10: ; preds = %17, %0
%11 = load i32, i32* %6
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %12
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %10
%18 = load i32, i32* %6
%19 = add nsw i32 %18, 1
store i32 %19, i32* %6
br label %10
20: ; preds = %10
%21 = load i32, i32* %6
%22 = sub nsw i32 %21, 1
store i32 %22, i32* %5
%23 = load i32, i32* %6
%24 = sdiv i32 %23, 2
store i32 %24, i32* %4
store i32 0, i32* %3
br label %25
25: ; preds = %46, %20
%26 = load i32, i32* %3
%27 = load i32, i32* %4
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %49
29: ; preds = %25
%30 = load i32, i32* %3
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %31
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = load i32, i32* %5
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %36
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = icmp ne i32 %34, %39
br i1 %40, label %41, label %43
41: ; preds = %29
%42 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %49
43: ; preds = %29
%44 = load i32, i32* %5
%45 = add nsw i32 %44, -1
store i32 %45, i32* %5
br label %46
46: ; preds = %43
%47 = load i32, i32* %3
%48 = add nsw i32 %47, 1
store i32 %48, i32* %3
br label %25
49: ; preds = %41, %25
%50 = load i32, i32* %3
%51 = load i32, i32* %4
%52 = icmp eq i32 %50, %51
br i1 %52, label %53, label %55
53: ; preds = %49
%54 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %55
55: ; preds = %53, %49
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%s\00"
@str = [14 x i8] c"Vuvedi teskt:\00"
@str.4 = [2 x i8] c"1\00"
@str.5 = [2 x i8] c"0\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 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 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)
br label %5
5: ; preds = %5, %0
%6 = phi i64 [ %10, %5 ], [ 0, %0 ]
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %6
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 0
%10 = add nuw i64 %6, 1
br i1 %9, label %11, label %5
11: ; preds = %5
%12 = trunc i64 %6 to i32
%13 = lshr i32 %12, 1
%14 = icmp ult i32 %12, 2
br i1 %14, label %35, label %15
15: ; preds = %11
%16 = shl i64 %6, 32
%17 = ashr exact i64 %16, 32
%18 = call i32 @llvm.umax.i32(i32 %13, i32 1)
%19 = zext i32 %18 to i64
br label %20
20: ; preds = %15, %32
%21 = phi i64 [ 0, %15 ], [ %33, %32 ]
%22 = phi i64 [ %17, %15 ], [ %23, %32 ]
%23 = add nsw i64 %22, -1
%24 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %21
%25 = load i8, i8* %24
%26 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %23
%27 = load i8, i8* %26
%28 = icmp eq i8 %25, %27
br i1 %28, label %32, label %29
29: ; preds = %20
%30 = trunc i64 %21 to i32
%31 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.5, i64 0, i64 0))
br label %35
32: ; preds = %20
%33 = add nuw nsw i64 %21, 1
%34 = icmp eq i64 %33, %19
br i1 %34, label %35, label %20
35: ; preds = %32, %11, %29
%36 = phi i32 [ %30, %29 ], [ 0, %11 ], [ %18, %32 ]
%37 = icmp eq i32 %36, %13
br i1 %37, label %38, label %40
38: ; preds = %35
%39 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.4, i64 0, i64 0))
br label %40
40: ; preds = %38, %35
ret i32 0
}