#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 n;
  printf("Enter a 5-digit integer: ");
  scanf("%d", &n);
  int str[6];
  int i;
  for (i = 0; i < 5; i++) {
    str[i] = n % 10;
    n /= 10;
  }
  str[5] = n;
  if (str[5] != 0 || str[4] == 0)
    printf("Your input is not a 5-digit integer. Exit");
  else if (str[0] == str[4] && str[1] == str[3])
    printf("It is a palindrome.");
  else
    printf("It is not a palindrome");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jge    118b <main+0x6b>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
movslq -0x24(%rbp),%rax
mov    %edx,-0x20(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1152 <main+0x32>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    11a5 <main+0x85>
cmpl   $0x0,-0x10(%rbp)
jne    11b6 <main+0x96>
lea    0xe71(%rip),%rdi
call   1030 <printf@plt>
jmp    11f0 <main+0xd0>
mov    -0x20(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    11df <main+0xbf>
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    11df <main+0xbf>
lea    0xe72(%rip),%rdi
call   1030 <printf@plt>
jmp    11eb <main+0xcb>
lea    0xe75(%rip),%rdi
call   1030 <printf@plt>
jmp    11f0 <main+0xd0>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
lea    0xee6(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movslq 0x4(%rsp),%rcx
imul   $0x68db8bad,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x2c,%rax
imul   $0x14f8b589,%rcx,%rsi
mov    %rsi,%rdi
shr    $0x3f,%rdi
sar    $0x2d,%rsi
add    %edi,%esi
mov    %esi,0x4(%rsp)
lea    (%rax,%rdx,1),%esi
add    $0xfffffff6,%esi
lea    0xea3(%rip),%rdi
cmp    $0xffffffed,%esi
jb     1233 <main+0x113>
add    %edx,%eax
movslq %eax,%r8
imul   $0x66666667,%r8,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x22,%rdx
add    %esi,%edx
add    %edx,%edx
lea    (%rdx,%rdx,4),%edx
sub    %edx,%r8d
je     1233 <main+0x113>
movslq %ecx,%rcx
imul   $0x10624dd3,%rcx,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x26,%rdx
add    %esi,%edx
movslq %edx,%rdx
imul   $0x66666667,%rdx,%rsi
mov    %rsi,%rdi
shr    $0x3f,%rdi
sar    $0x22,%rsi
add    %edi,%esi
add    %esi,%esi
lea    (%rsi,%rsi,4),%esi
sub    %esi,%edx
imul   $0x66666667,%rcx,%rsi
mov    %rsi,%rdi
shr    $0x3f,%rdi
sar    $0x22,%rsi
add    %edi,%esi
movslq %esi,%rsi
imul   $0x66666667,%rsi,%rdi
mov    %rdi,%rax
shr    $0x3f,%rax
sar    $0x22,%rdi
add    %eax,%edi
add    %edi,%edi
lea    (%rdi,%rdi,4),%edi
mov    %esi,%eax
sub    %edi,%eax
xor    %edx,%eax
add    %esi,%esi
lea    (%rsi,%rsi,4),%edx
sub    %edx,%ecx
xor    %r8d,%ecx
lea    0xe21(%rip),%rdx
lea    0xe2e(%rip),%rdi
or     %eax,%ecx
cmove  %rdx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [26 x i8] c"Enter a 5-digit integer: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [42 x i8] c"Your input is not a 5-digit integer. Exit\00"
@.str.3 = [20 x i8] c"It is a palindrome.\00"
@.str.4 = [23 x i8] c"It is not a palindrome\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 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, 10000
%7 = srem i32 %6, 10
%8 = sdiv i32 %5, 100000
store i32 %8, i32* %1
%9 = add nsw i32 %6, -10
%10 = icmp ult i32 %9, -19
%11 = icmp eq i32 %7, 0
%12 = or i1 %10, %11
br i1 %12, label %23, label %13
13: ; preds = %0
%14 = sdiv i32 %5, 1000
%15 = srem i32 %14, 10
%16 = sdiv i32 %5, 10
%17 = srem i32 %16, 10
%18 = srem i32 %5, 10
%19 = icmp eq i32 %18, %7
%20 = icmp eq i32 %17, %15
%21 = select i1 %19, i1 %20, i1 false
%22 = select i1 %21, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0)
br label %23
23: ; preds = %13, %0
%24 = phi i8* [ getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), %0 ], [ %22, %13 ]
%25 = call i32 @printf(i8* dereferenceable(1) %24)
ret i32 0
}