#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 *, int *);
int main() {
  int birler, onlar, binler, on_binler, sayi;
  printf("Programdan cikmak icin -1 giriniz\n");
  printf("Bes basamakli bir sayi giriniz:");
  scanf("%d", &sayi);
  while (sayi != -1) {
    on_binler = sayi / 10000;
    binler = sayi / 1000;
    binler = binler % 10;
    onlar = sayi / 10;
    onlar = onlar % 10;
    birler = sayi % 10;
    if (on_binler == birler && binler == onlar) {
      printf("Bu sayi palindrome sayidir.\n");
    } else {
      printf("Bu sayi palindrome sayi degildir.\n");
    }
    printf("Bes basamakli bir sayi giriniz:");
    scanf("%d", &sayi);
  }
  printf("Programdan ciktiniz.");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xee1(%rip),%rdi
call   1030 <printf@plt>
lea    0xef5(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0xffffffff,-0x18(%rbp)
je     120b <main+0xeb>
mov    -0x18(%rbp),%eax
mov    $0x2710,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0x18(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x18(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    11de <main+0xbe>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    11de <main+0xbe>
lea    0xe72(%rip),%rdi
call   1030 <printf@plt>
jmp    11ea <main+0xca>
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
lea    0xe32(%rip),%rdi
call   1030 <printf@plt>
lea    0xe46(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
jmp    1157 <main+0x37>
lea    0xe74(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xef4(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb0(%rip),%rdi
call   1040 <printf@plt>
lea    0xec4(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0xffffffff,%eax
je     1261 <main+0x131>
lea    0xf02(%rip),%r12
lea    0xe7f(%rip),%r14
lea    0xe98(%rip),%r15
lea    0xc(%rsp),%rbx
lea    0xec6(%rip),%r13
jmp    11c8 <main+0x98>
cs nopw 0x0(%rax,%rax,1)
mov    %r13,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0xffffffff,%eax
je     1261 <main+0x131>
movslq %eax,%rcx
imul   $0x68db8bad,%rcx,%rdx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x2c,%rdx
add    %eax,%edx
imul   $0x66666667,%rcx,%rax
mov    %rax,%rsi
shr    $0x3f,%rsi
sar    $0x22,%rax
add    %esi,%eax
lea    (%rax,%rax,1),%esi
lea    (%rsi,%rsi,4),%esi
mov    %ecx,%edi
sub    %esi,%edi
cmp    %edi,%edx
jne    11a0 <main+0x70>
movslq %eax,%rdx
imul   $0x66666667,%rdx,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x22,%rdx
add    %esi,%edx
add    %edx,%edx
lea    (%rdx,%rdx,4),%edx
sub    %edx,%eax
imul   $0x10624dd3,%rcx,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rcx
add    %edx,%ecx
movslq %ecx,%rcx
imul   $0x66666667,%rcx,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x22,%rdx
add    %esi,%edx
add    %edx,%edx
lea    (%rdx,%rdx,4),%edx
sub    %edx,%ecx
mov    %r12,%rdi
cmp    %eax,%ecx
jne    11a0 <main+0x70>
jmp    11a3 <main+0x73>
lea    0xdbb(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [35 x i8] c"Programdan cikmak icin -1 giriniz\0A\00"
@.str.1 = [32 x i8] c"Bes basamakli bir sayi giriniz:\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [29 x i8] c"Bu sayi palindrome sayidir.\0A\00"
@.str.4 = [35 x i8] c"Bu sayi palindrome sayi degildir.\0A\00"
@.str.5 = [21 x i8] c"Programdan ciktiniz.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %6)
br label %10
10: ; preds = %37, %0
%11 = load i32, i32* %6
%12 = icmp ne i32 %11, -1
br i1 %12, label %13, label %40
13: ; preds = %10
%14 = load i32, i32* %6
%15 = sdiv i32 %14, 10000
store i32 %15, i32* %5
%16 = load i32, i32* %6
%17 = sdiv i32 %16, 1000
store i32 %17, i32* %4
%18 = load i32, i32* %4
%19 = srem i32 %18, 10
store i32 %19, i32* %4
%20 = load i32, i32* %6
%21 = sdiv i32 %20, 10
store i32 %21, i32* %3
%22 = load i32, i32* %3
%23 = srem i32 %22, 10
store i32 %23, i32* %3
%24 = load i32, i32* %6
%25 = srem i32 %24, 10
store i32 %25, i32* %2
%26 = load i32, i32* %5
%27 = load i32, i32* %2
%28 = icmp eq i32 %26, %27
br i1 %28, label %29, label %35
29: ; preds = %13
%30 = load i32, i32* %4
%31 = load i32, i32* %3
%32 = icmp eq i32 %30, %31
br i1 %32, label %33, label %35
33: ; preds = %29
%34 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
br label %37
35: ; preds = %29, %13
%36 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0))
br label %37
37: ; preds = %35, %33
%38 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%39 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %6)
br label %10
40: ; preds = %10
%41 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [32 x i8] c"Bes basamakli bir sayi giriniz:\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.5 = [21 x i8] c"Programdan ciktiniz.\00"
@str = [34 x i8] c"Programdan cikmak icin -1 giriniz\00"
@str.6 = [34 x i8] c"Bu sayi palindrome sayi degildir.\00"
@str.7 = [28 x i8] c"Bu sayi palindrome sayidir.\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp eq i32 %6, -1
br i1 %7, label %27, label %8
8: ; preds = %0, %20
%9 = phi i32 [ %25, %20 ], [ %6, %0 ]
%10 = sdiv i32 %9, 10000
%11 = srem i32 %9, 10
%12 = sdiv i32 %9, 10
%13 = icmp eq i32 %10, %11
br i1 %13, label %14, label %19
14: ; preds = %8
%15 = srem i32 %12, 10
%16 = sdiv i32 %9, 1000
%17 = srem i32 %16, 10
%18 = icmp eq i32 %17, %15
br i1 %18, label %20, label %19
19: ; preds = %14, %8
br label %20
20: ; preds = %14, %19
%21 = phi i8* [ getelementptr inbounds ([34 x i8], [34 x i8]* @str.6, i64 0, i64 0), %19 ], [ getelementptr inbounds ([28 x i8], [28 x i8]* @str.7, i64 0, i64 0), %14 ]
%22 = call i32 @puts(i8* dereferenceable(1) %21)
%23 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%25 = load i32, i32* %1
%26 = icmp eq i32 %25, -1
br i1 %26, label %27, label %8
27: ; preds = %20, %0
%28 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}