#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 duma[100];
  int i, l = 0, k = 0;
  printf("vyvedi duma=");
  scanf("%s", duma);
  l = strlen(duma);
  for (i = 0; i < l; i++) {
    if (duma[i] == duma[l - 1]) {
      k = 1;
    } else {
      printf("0");
      break;
    }
    l--;
  }
  if (k == 1) {
    printf("%d\n", k);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x78(%rbp)
movl   $0x0,-0x7c(%rbp)
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x70(%rbp),%rsi
lea    0xea4(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x70(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x78(%rbp)
movl   $0x0,-0x74(%rbp)
mov    -0x74(%rbp),%eax
cmp    -0x78(%rbp),%eax
jge    11e2 <main+0xb2>
movslq -0x74(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
mov    -0x78(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl -0x70(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
jne    11b8 <main+0x88>
movl   $0x1,-0x7c(%rbp)
jmp    11cb <main+0x9b>
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11e2 <main+0xb2>
mov    -0x78(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x78(%rbp)
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1181 <main+0x51>
cmpl   $0x1,-0x7c(%rbp)
jne    11fd <main+0xcd>
mov    -0x7c(%rbp),%esi
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x68,%rsp
lea    0xeb3(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeb2(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    11d8 <main+0x98>
mov    %eax,%eax
mov    (%rsp),%bpl
mov    -0x1(%rsp,%rax,1),%bl
cmp    %bl,%bpl
jne    11ce <main+0x8e>
add    $0xffffffffffffffff,%rax
mov    $0x1,%ecx
nopw   0x0(%rax,%rax,1)
cmp    %rax,%rcx
jge    11b9 <main+0x79>
movzbl (%rsp,%rcx,1),%edx
lea    -0x1(%rax),%rsi
add    $0x1,%rcx
cmp    -0x1(%rsp,%rax,1),%dl
mov    %rsi,%rax
je     1190 <main+0x50>
mov    $0x30,%edi
call   1030 <putchar@plt>
cmp    %bl,%bpl
jne    11d8 <main+0x98>
lea    0xe50(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11d8 <main+0x98>
mov    $0x30,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [13 x i8] c"vyvedi duma=\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.3 = [4 x i8] c"%d\0A\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 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 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, 0
br i1 %6, label %7, label %33
7: ; preds = %0
%8 = zext i32 %5 to i64
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%10 = load i8, i8* %9
%11 = add nsw i64 %8, -1
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %11
%13 = load i8, i8* %12
%14 = icmp eq i8 %10, %13
br i1 %14, label %15, label %31
15: ; preds = %7, %19
%16 = phi i64 [ %26, %19 ], [ 1, %7 ]
%17 = phi i64 [ %22, %19 ], [ %11, %7 ]
%18 = icmp slt i64 %16, %17
br i1 %18, label %19, label %29
19: ; preds = %15
%20 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %16
%21 = load i8, i8* %20
%22 = add nsw i64 %17, -1
%23 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %22
%24 = load i8, i8* %23
%25 = icmp eq i8 %21, %24
%26 = add nuw nsw i64 %16, 1
br i1 %25, label %15, label %27
27: ; preds = %19
%28 = call i32 @putchar(i32 48)
br i1 %14, label %29, label %33
29: ; preds = %15, %27
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 1)
br label %33
31: ; preds = %7
%32 = call i32 @putchar(i32 48)
br label %33
33: ; preds = %31, %0, %29, %27
ret i32 0
}