#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(void) {
  int number = 0;
  printf("Enter A number consist of 5 digits:");
  scanf("%d", &number);
  int last_two_digit = number / 1000;
  int first_two_digits = number % 100;
  int sum_last_two_digit = (last_two_digit % 10) + (last_two_digit / 10);
  int sum_first_two_digits = (first_two_digits % 10) + (first_two_digits / 10);
  if (sum_last_two_digit == sum_first_two_digits) {
    printf("The Number (%d)  is palindrome number ", number);
  } else {
    printf("ooops!!! (%d)  is not palindrome number ", number);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x20(%rbp),%edx
add    %eax,%edx
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x1c(%rbp),%edx
add    %eax,%edx
mov    %edx,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jne    11d4 <main+0xb4>
mov    -0x8(%rbp),%esi
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e5 <main+0xc5>
mov    -0x8(%rbp),%esi
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xed0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee6(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movslq 0x4(%rsp),%rsi
imul   $0x10624dd3,%rsi,%rcx
mov    %rcx,%rax
shr    $0x3f,%rax
sar    $0x26,%rcx
add    %eax,%ecx
imul   $0x51eb851f,%rsi,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rax
add    %edx,%eax
imul   $0x64,%eax,%edx
mov    %esi,%eax
sub    %edx,%eax
movslq %ecx,%rdx
imul   $0x66666667,%rdx,%rcx
mov    %rcx,%rdi
shr    $0x3f,%rdi
sar    $0x22,%rcx
add    %edi,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%edx
imul   $0x68db8bad,%rsi,%rcx
mov    %rcx,%rdi
shr    $0x3f,%rdi
sar    $0x2c,%rcx
add    %edi,%ecx
add    %edx,%ecx
movsbl %al,%edx
imul   $0x67,%edx,%edx
movzwl %dx,%edx
movswl %dx,%edi
shr    $0xf,%edx
shr    $0xa,%edi
add    %dl,%dil
movzbl %dil,%edx
lea    (%rdx,%rdx,1),%edi
lea    (%rdi,%rdi,4),%edi
sub    %dil,%al
add    %al,%dl
movsbl %dl,%eax
cmp    %eax,%ecx
lea    0xe47(%rip),%rax
lea    0xe67(%rip),%rdi
cmove  %rax,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [36 x i8] c"Enter A number consist of 5 digits:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [39 x i8] c"The Number (%d) is palindrome number \00"
@.str.3 = [41 x i8] c"ooops!!! (%d) is not palindrome number \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
store i32 0, i32* %2
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
%10 = sdiv i32 %9, 1000
store i32 %10, i32* %3
%11 = load i32, i32* %2
%12 = srem i32 %11, 100
store i32 %12, i32* %4
%13 = load i32, i32* %3
%14 = srem i32 %13, 10
%15 = load i32, i32* %3
%16 = sdiv i32 %15, 10
%17 = add nsw i32 %14, %16
store i32 %17, i32* %5
%18 = load i32, i32* %4
%19 = srem i32 %18, 10
%20 = load i32, i32* %4
%21 = sdiv i32 %20, 10
%22 = add nsw i32 %19, %21
store i32 %22, i32* %6
%23 = load i32, i32* %5
%24 = load i32, i32* %6
%25 = icmp eq i32 %23, %24
br i1 %25, label %26, label %29
26: ; preds = %0
%27 = load i32, i32* %2
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i32 %27)
br label %32
29: ; preds = %0
%30 = load i32, i32* %2
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0), i32 %30)
br label %32
32: ; preds = %29, %26
ret i32 0
}

LLVM IR (-O2):
@.str = [36 x i8] c"Enter A number consist of 5 digits:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [39 x i8] c"The Number (%d) is palindrome number \00"
@.str.3 = [41 x i8] c"ooops!!! (%d) is not palindrome number \00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 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), i32* %1)
%5 = load i32, i32* %1
%6 = sdiv i32 %5, 1000
%7 = srem i32 %5, 100
%8 = srem i32 %6, 10
%9 = sdiv i32 %5, 10000
%10 = add nsw i32 %8, %9
%11 = trunc i32 %7 to i8
%12 = srem i8 %11, 10
%13 = sdiv i8 %11, 10
%14 = add nsw i8 %12, %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %10, %15
%17 = select i1 %16, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %17, i32 %5)
ret i32 0
}