#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 *, char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int number;
  int flag = 1;
  int numA;
  int numB;
  int numC;
  int numD;
  printf("%s", "Enter a 5 digit number: ");
  scanf("%d", &number);
  while (flag != -1) {
    if (number > 10000) {
      if (number < 99999) {
        numA = number / 10000;
        number = number % 10000;
        numB = number / 1000;
        number = number % 1000;
        number = number % 100;
        numC = number / 10;
        numD = number % 10;
        if (numA == numD) {
          if (numB == numC) {
            puts("The given number is a palindrome!!!");
          } else
            puts("Not a palindrome!!!");
        } else
          puts("Not a palindrome!!!");
        flag = -1;
      } else {
        puts("You did not provide a 5 digit number!!!");
        printf("%s", "Enter a 5 digit number: ");
        scanf("%d", &number);
      }
    } else {
      puts("You did not provide a 5 digit number!!!");
      printf("%s", "Enter a 5 digit number: ");
      scanf("%d", &number);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
lea    0xeb3(%rip),%rdi
lea    0xeaf(%rip),%rsi
call   1040 <printf@plt>
lea    0xebc(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0xffffffff,-0xc(%rbp)
je     12a9 <main+0x179>
cmpl   $0x2710,-0x8(%rbp)
jle    1275 <main+0x145>
cmpl   $0x1869f,-0x8(%rbp)
jge    1241 <main+0x111>
mov    -0x8(%rbp),%eax
mov    $0x2710,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2710,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jne    1229 <main+0xf9>
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jne    1218 <main+0xe8>
lea    0xe11(%rip),%rdi
call   1030 <puts@plt>
jmp    1224 <main+0xf4>
lea    0xe24(%rip),%rdi
call   1030 <puts@plt>
jmp    1235 <main+0x105>
lea    0xe13(%rip),%rdi
call   1030 <puts@plt>
movl   $0xffffffff,-0xc(%rbp)
jmp    1270 <main+0x140>
lea    0xe0f(%rip),%rdi
call   1030 <puts@plt>
lea    0xdac(%rip),%rdi
lea    0xda8(%rip),%rsi
call   1040 <printf@plt>
lea    0xdb5(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
jmp    12a4 <main+0x174>
lea    0xddb(%rip),%rdi
call   1030 <puts@plt>
lea    0xd78(%rip),%rdi
lea    0xd74(%rip),%rsi
call   1040 <printf@plt>
lea    0xd81(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
jmp    1169 <main+0x39>
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    0xebc(%rip),%rdi
lea    0xeb8(%rip),%rsi
call   1040 <printf@plt>
lea    0xec5(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%ecx
lea    -0x2711(%rcx),%eax
cmp    $0x15f8e,%eax
jb     11cf <main+0x9f>
lea    0xede(%rip),%r14
lea    0xe80(%rip),%r15
lea    0xe7c(%rip),%r12
lea    0xe8e(%rip),%r13
lea    0xc(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <printf@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%ecx
lea    -0x2711(%rcx),%eax
cmp    $0x15f8e,%eax
jae    11a0 <main+0x70>
mov    %ecx,%edx
mov    $0xd1b71759,%eax
imul   %rdx,%rax
shr    $0x2d,%rax
imul   $0x2710,%eax,%edx
sub    %edx,%ecx
movzwl %cx,%edx
shr    $0x3,%edx
imul   $0x20c5,%edx,%edx
shr    $0x14,%edx
imul   $0x3e8,%edx,%esi
sub    %esi,%ecx
movzwl %cx,%ecx
mov    %ecx,%esi
shr    $0x2,%esi
imul   $0x147b,%esi,%esi
shr    $0x11,%esi
imul   $0x64,%esi,%esi
sub    %esi,%ecx
movzwl %cx,%esi
mov    %esi,0xc(%rsp)
imul   $0xcd,%ecx,%esi
movzwl %si,%esi
shr    $0xb,%esi
lea    (%rsi,%rsi,1),%edi
lea    (%rdi,%rdi,4),%edi
sub    %dil,%cl
cmp    %si,%dx
lea    0xde6(%rip),%rdi
lea    0xe03(%rip),%rdx
cmovne %rdx,%rdi
movzbl %cl,%ecx
cmp    %ecx,%eax
cmovne %rdx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [25 x i8] c"Enter a 5 digit number: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [36 x i8] c"The given number is a palindrome!!!\00"
@.str.4 = [20 x i8] c"Not a palindrome!!!\00"
@.str.5 = [40 x i8] c"You did not provide a 5 digit number!!!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %3
%8 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 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* %2)
br label %10
10: ; preds = %58, %0
%11 = load i32, i32* %3
%12 = icmp ne i32 %11, -1
br i1 %12, label %13, label %59
13: ; preds = %10
%14 = load i32, i32* %2
%15 = icmp sgt i32 %14, 10000
br i1 %15, label %16, label %54
16: ; preds = %13
%17 = load i32, i32* %2
%18 = icmp slt i32 %17, 99999
br i1 %18, label %19, label %49
19: ; preds = %16
%20 = load i32, i32* %2
%21 = sdiv i32 %20, 10000
store i32 %21, i32* %4
%22 = load i32, i32* %2
%23 = srem i32 %22, 10000
store i32 %23, i32* %2
%24 = load i32, i32* %2
%25 = sdiv i32 %24, 1000
store i32 %25, i32* %5
%26 = load i32, i32* %2
%27 = srem i32 %26, 1000
store i32 %27, i32* %2
%28 = load i32, i32* %2
%29 = srem i32 %28, 100
store i32 %29, i32* %2
%30 = load i32, i32* %2
%31 = sdiv i32 %30, 10
store i32 %31, i32* %6
%32 = load i32, i32* %2
%33 = srem i32 %32, 10
store i32 %33, i32* %7
%34 = load i32, i32* %4
%35 = load i32, i32* %7
%36 = icmp eq i32 %34, %35
br i1 %36, label %37, label %46
37: ; preds = %19
%38 = load i32, i32* %5
%39 = load i32, i32* %6
%40 = icmp eq i32 %38, %39
br i1 %40, label %41, label %43
41: ; preds = %37
%42 = call i32 @puts(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0))
br label %45
43: ; preds = %37
%44 = call i32 @puts(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
br label %45
45: ; preds = %43, %41
br label %48
46: ; preds = %19
%47 = call i32 @puts(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
br label %48
48: ; preds = %46, %45
store i32 -1, i32* %3
br label %53
49: ; preds = %16
%50 = call i32 @puts(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0))
%51 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%52 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
br label %53
53: ; preds = %49, %48
br label %58
54: ; preds = %13
%55 = call i32 @puts(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0))
%56 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%57 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
br label %58
58: ; preds = %54, %53
br label %10
59: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [25 x i8] c"Enter a 5 digit number: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [36 x i8] c"The given number is a palindrome!!!\00"
@.str.4 = [20 x i8] c"Not a palindrome!!!\00"
@.str.5 = [40 x i8] c"You did not provide a 5 digit number!!!\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = add i32 %5, -10001
%7 = icmp ult i32 %6, 89998
br i1 %7, label %8, label %27
8: ; preds = %27, %0
%9 = phi i32 [ %5, %0 ], [ %31, %27 ]
%10 = udiv i32 %9, 10000
%11 = urem i32 %9, 10000
%12 = trunc i32 %11 to i16
%13 = urem i16 %12, 1000
%14 = udiv i16 %12, 1000
%15 = urem i16 %13, 100
%16 = zext i16 %15 to i32
store i32 %16, i32* %1
%17 = trunc i16 %15 to i8
%18 = urem i8 %17, 10
%19 = udiv i8 %17, 10
%20 = zext i8 %18 to i32
%21 = icmp eq i32 %10, %20
%22 = zext i8 %19 to i16
%23 = icmp eq i16 %14, %22
%24 = select i1 %23, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0)
%25 = select i1 %21, i8* %24, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0)
%26 = call i32 @puts(i8* dereferenceable(1) %25)
ret i32 0
27: ; preds = %0, %27
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0))
%29 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%30 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%31 = load i32, i32* %1
%32 = add i32 %31, -10001
%33 = icmp ult i32 %32, 89998
br i1 %33, label %8, label %27
}