#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 *);
void main() {
  int ful, num1, num2, num3, num4, num5;
  int digits;
  int ispal = 0;
  printf("Please enter a integer with five or less digits: ");
  scanf("%d", &ful);
  num1 = ful / 10000;
  ful = ful % 10000;
  num2 = ful / 1000;
  ful = ful % 1000;
  num3 = ful / 100;
  ful = ful % 100;
  num4 = ful / 10;
  ful = ful % 10;
  num5 = ful;
  if (num1 == 0) {
    digits = 4;
    if (num2 == 0) {
      digits = 3;
      if (num3 == 0) {
        digits = 2;
        if (num4 == 0)
          digits = 1;
      }
    }
  } else
    digits = 5;
  if (digits == 1)
    ispal = 1;
  else if (digits == 2) {
    if (num4 == num5)
      ispal = 1;
  } else if (digits == 3) {
    if (num3 == num5)
      ispal = 1;
  } else if (digits == 4) {
    if (num2 == num5)
      if (num3 == num4)
        ispal = 1;
  } else if (digits == 5) {
    if (num1 == num5)
      if (num2 == num4)
        ispal = 1;
  }
  printf("Digits: %d\n", digits);
  printf("%d   ", num1);
  printf("%d   ", num2);
  printf("%d   ", num3);
  printf("%d   ", num4);
  printf("%d   \n", num5);
  if (ispal == 1)
    printf("The integer you entered is a palindrome.");
  if (ispal == 0)
    printf("The integer you entered is not a palindrome.");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x20(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeee(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%eax
mov    $0x2710,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2710,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1216 <main+0xf6>
movl   $0x4,-0x1c(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1211 <main+0xf1>
movl   $0x3,-0x1c(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    120c <main+0xec>
movl   $0x2,-0x1c(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1207 <main+0xe7>
movl   $0x1,-0x1c(%rbp)
jmp    120c <main+0xec>
jmp    1211 <main+0xf1>
jmp    121d <main+0xfd>
movl   $0x5,-0x1c(%rbp)
cmpl   $0x1,-0x1c(%rbp)
jne    1233 <main+0x113>
movl   $0x1,-0x20(%rbp)
jmp    12f1 <main+0x1d1>
cmpl   $0x2,-0x1c(%rbp)
jne    1255 <main+0x135>
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jne    1250 <main+0x130>
movl   $0x1,-0x20(%rbp)
jmp    12ec <main+0x1cc>
cmpl   $0x3,-0x1c(%rbp)
jne    1277 <main+0x157>
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
jne    1272 <main+0x152>
movl   $0x1,-0x20(%rbp)
jmp    12e7 <main+0x1c7>
cmpl   $0x4,-0x1c(%rbp)
jne    12aa <main+0x18a>
mov    -0xc(%rbp),%eax
cmp    -0x18(%rbp),%eax
jne    12a5 <main+0x185>
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    12a0 <main+0x180>
movl   $0x1,-0x20(%rbp)
jmp    12a5 <main+0x185>
jmp    12e2 <main+0x1c2>
cmpl   $0x5,-0x1c(%rbp)
jne    12dd <main+0x1bd>
mov    -0x8(%rbp),%eax
cmp    -0x18(%rbp),%eax
jne    12d8 <main+0x1b8>
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    12d3 <main+0x1b3>
movl   $0x1,-0x20(%rbp)
jmp    12d8 <main+0x1b8>
jmp    12dd <main+0x1bd>
jmp    12e2 <main+0x1c2>
jmp    12e7 <main+0x1c7>
jmp    12ec <main+0x1cc>
jmp    12f1 <main+0x1d1>
mov    -0x1c(%rbp),%esi
lea    0xd3a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xd35(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xd24(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xd13(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xd02(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xcf7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x1,-0x20(%rbp)
jne    136f <main+0x24f>
lea    0xce6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x20(%rbp)
jne    1387 <main+0x267>
lea    0xcf7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xecb(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeef(%rip),%rdi
lea    0x14(%rsp),%rsi
call   1040 <scanf@plt>
movslq 0x14(%rsp),%rax
imul   $0x68db8bad,%rax,%r13
mov    %r13,%rcx
shr    $0x3f,%rcx
sar    $0x2c,%r13
add    %ecx,%r13d
imul   $0x2710,%r13d,%ecx
lea    0x270f(%rax),%r8d
sub    %ecx,%eax
movswl %ax,%ecx
imul   $0xffff8313,%ecx,%ecx
shr    $0x10,%ecx
add    %eax,%ecx
movzwl %cx,%ecx
movswl %cx,%edx
shr    $0xf,%ecx
sar    $0x9,%edx
add    %ecx,%edx
movswl %dx,%r12d
imul   $0x3e8,%edx,%ecx
mov    %eax,%edx
sub    %ecx,%edx
movswl %dx,%ecx
imul   $0x147b,%ecx,%ebp
mov    %ebp,%ecx
shr    $0x1f,%ecx
sar    $0x13,%ebp
add    %ecx,%ebp
imul   $0x64,%ebp,%ecx
mov    %edx,%esi
sub    %ecx,%esi
movsbl %sil,%ecx
imul   $0x67,%ecx,%ecx
movzwl %cx,%ebx
movswl %bx,%ecx
shr    $0xf,%ebx
shr    $0xa,%ecx
add    %bl,%cl
movsbl %cl,%r15d
movzbl %r15b,%ebx
add    %ebx,%ebx
lea    (%rbx,%rbx,4),%edi
mov    %esi,%ebx
sub    %dil,%bl
movsbl %bl,%r14d
mov    %r14d,0x14(%rsp)
cmp    $0x4e1e,%r8d
ja     122a <main+0x10a>
add    $0x3e7,%eax
cmp    $0x7ce,%eax
ja     124b <main+0x12b>
lea    0x63(%rdx),%eax
movzwl %ax,%eax
cmp    $0xc6,%eax
ja     126b <main+0x14b>
lea    0x9(%rsi),%eax
cmp    $0x13,%ax
jae    1281 <main+0x161>
movb   $0x1,0xf(%rsp)
mov    $0x1,%esi
movl   $0x0,0x10(%rsp)
jmp    1294 <main+0x174>
mov    %r13d,%eax
xor    %r14d,%eax
mov    %r12d,%ecx
xor    %r15d,%ecx
or     %eax,%ecx
sete   0xf(%rsp)
setne  %al
mov    %eax,0x10(%rsp)
mov    $0x5,%esi
jmp    1294 <main+0x174>
mov    %r12d,%eax
xor    %r14d,%eax
mov    %ebp,%ecx
xor    %r15d,%ecx
or     %eax,%ecx
sete   0xf(%rsp)
setne  %al
mov    %eax,0x10(%rsp)
mov    $0x4,%esi
jmp    1294 <main+0x174>
cmp    %r14d,%ebp
sete   0xf(%rsp)
setne  %al
mov    %eax,0x10(%rsp)
mov    $0x3,%esi
jmp    1294 <main+0x174>
cmp    %bl,%cl
sete   0xf(%rsp)
setne  %al
mov    %eax,0x10(%rsp)
mov    $0x2,%esi
lea    0xd9a(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xd98(%rip),%rbx
mov    %rbx,%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xd64(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmpb   $0x0,0xf(%rsp)
je     1302 <main+0x1e2>
lea    0xd53(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
cmpb   $0x0,0x10(%rsp)
je     1317 <main+0x1f7>
lea    0xd67(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [50 x i8] c"Please enter a integer with five or less digits: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [12 x i8] c"Digits: %d\0A\00"
@.str.3 = [6 x i8] c"%d \00"
@.str.4 = [7 x i8] c"%d \0A\00"
@.str.5 = [41 x i8] c"The integer you entered is a palindrome.\00"
@.str.6 = [45 x i8] c"The integer you entered is not a palindrome.\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %8
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%11 = load i32, i32* %1
%12 = sdiv i32 %11, 10000
store i32 %12, i32* %2
%13 = load i32, i32* %1
%14 = srem i32 %13, 10000
store i32 %14, i32* %1
%15 = load i32, i32* %1
%16 = sdiv i32 %15, 1000
store i32 %16, i32* %3
%17 = load i32, i32* %1
%18 = srem i32 %17, 1000
store i32 %18, i32* %1
%19 = load i32, i32* %1
%20 = sdiv i32 %19, 100
store i32 %20, i32* %4
%21 = load i32, i32* %1
%22 = srem i32 %21, 100
store i32 %22, i32* %1
%23 = load i32, i32* %1
%24 = sdiv i32 %23, 10
store i32 %24, i32* %5
%25 = load i32, i32* %1
%26 = srem i32 %25, 10
store i32 %26, i32* %1
%27 = load i32, i32* %1
store i32 %27, i32* %6
%28 = load i32, i32* %2
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %43
30: ; preds = %0
store i32 4, i32* %7
%31 = load i32, i32* %3
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %42
33: ; preds = %30
store i32 3, i32* %7
%34 = load i32, i32* %4
%35 = icmp eq i32 %34, 0
br i1 %35, label %36, label %41
36: ; preds = %33
store i32 2, i32* %7
%37 = load i32, i32* %5
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %40
39: ; preds = %36
store i32 1, i32* %7
br label %40
40: ; preds = %39, %36
br label %41
41: ; preds = %40, %33
br label %42
42: ; preds = %41, %30
br label %44
43: ; preds = %0
store i32 5, i32* %7
br label %44
44: ; preds = %43, %42
%45 = load i32, i32* %7
%46 = icmp eq i32 %45, 1
br i1 %46, label %47, label %48
47: ; preds = %44
store i32 1, i32* %8
br label %98
48: ; preds = %44
%49 = load i32, i32* %7
%50 = icmp eq i32 %49, 2
br i1 %50, label %51, label %57
51: ; preds = %48
%52 = load i32, i32* %5
%53 = load i32, i32* %6
%54 = icmp eq i32 %52, %53
br i1 %54, label %55, label %56
55: ; preds = %51
store i32 1, i32* %8
br label %56
56: ; preds = %55, %51
br label %97
57: ; preds = %48
%58 = load i32, i32* %7
%59 = icmp eq i32 %58, 3
br i1 %59, label %60, label %66
60: ; preds = %57
%61 = load i32, i32* %4
%62 = load i32, i32* %6
%63 = icmp eq i32 %61, %62
br i1 %63, label %64, label %65
64: ; preds = %60
store i32 1, i32* %8
br label %65
65: ; preds = %64, %60
br label %96
66: ; preds = %57
%67 = load i32, i32* %7
%68 = icmp eq i32 %67, 4
br i1 %68, label %69, label %80
69: ; preds = %66
%70 = load i32, i32* %3
%71 = load i32, i32* %6
%72 = icmp eq i32 %70, %71
br i1 %72, label %73, label %79
73: ; preds = %69
%74 = load i32, i32* %4
%75 = load i32, i32* %5
%76 = icmp eq i32 %74, %75
br i1 %76, label %77, label %78
77: ; preds = %73
store i32 1, i32* %8
br label %78
78: ; preds = %77, %73
br label %79
79: ; preds = %78, %69
br label %95
80: ; preds = %66
%81 = load i32, i32* %7
%82 = icmp eq i32 %81, 5
br i1 %82, label %83, label %94
83: ; preds = %80
%84 = load i32, i32* %2
%85 = load i32, i32* %6
%86 = icmp eq i32 %84, %85
br i1 %86, label %87, label %93
87: ; preds = %83
%88 = load i32, i32* %3
%89 = load i32, i32* %5
%90 = icmp eq i32 %88, %89
br i1 %90, label %91, label %92
91: ; preds = %87
store i32 1, i32* %8
br label %92
92: ; preds = %91, %87
br label %93
93: ; preds = %92, %83
br label %94
94: ; preds = %93, %80
br label %95
95: ; preds = %94, %79
br label %96
96: ; preds = %95, %65
br label %97
97: ; preds = %96, %56
br label %98
98: ; preds = %97, %47
%99 = load i32, i32* %7
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %99)
%101 = load i32, i32* %2
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %101)
%103 = load i32, i32* %3
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %103)
%105 = load i32, i32* %4
%106 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %105)
%107 = load i32, i32* %5
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %107)
%109 = load i32, i32* %6
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %109)
%111 = load i32, i32* %8
%112 = icmp eq i32 %111, 1
br i1 %112, label %113, label %115
113: ; preds = %98
%114 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0))
br label %115
115: ; preds = %113, %98
%116 = load i32, i32* %8
%117 = icmp eq i32 %116, 0
br i1 %117, label %118, label %120
118: ; preds = %115
%119 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.6, i64 0, i64 0))
br label %120
120: ; preds = %118, %115
ret void
}

LLVM IR (-O2):
@.str = [50 x i8] c"Please enter a integer with five or less digits: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [12 x i8] c"Digits: %d\0A\00"
@.str.3 = [6 x i8] c"%d \00"
@.str.4 = [7 x i8] c"%d \0A\00"
@.str.5 = [41 x i8] c"The integer you entered is a palindrome.\00"
@.str.6 = [45 x i8] c"The integer you entered is not a palindrome.\00"
define void @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 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 %5, 10000
%8 = trunc i32 %7 to i16
%9 = sdiv i16 %8, 1000
%10 = sext i16 %9 to i32
%11 = srem i16 %8, 1000
%12 = sdiv i16 %11, 100
%13 = sext i16 %12 to i32
%14 = srem i16 %11, 100
%15 = trunc i16 %14 to i8
%16 = sdiv i8 %15, 10
%17 = sext i8 %16 to i32
%18 = srem i8 %15, 10
%19 = sext i8 %18 to i32
store i32 %19, i32* %1
%20 = add i32 %5, 9999
%21 = icmp ult i32 %20, 19999
br i1 %21, label %22, label %42
22: ; preds = %0
%23 = add nsw i32 %7, 999
%24 = icmp ult i32 %23, 1999
br i1 %24, label %25, label %37
25: ; preds = %22
%26 = add nsw i16 %11, 99
%27 = icmp ult i16 %26, 199
br i1 %27, label %28, label %34
28: ; preds = %25
%29 = add nsw i16 %14, 9
%30 = icmp ult i16 %29, 19
br i1 %30, label %47, label %31
31: ; preds = %28
%32 = icmp eq i8 %16, %18
%33 = xor i1 %32, true
br label %47
34: ; preds = %25
%35 = icmp eq i32 %13, %19
%36 = xor i1 %35, true
br label %47
37: ; preds = %22
%38 = icmp eq i32 %10, %19
%39 = icmp eq i32 %13, %17
%40 = select i1 %38, i1 %39, i1 false
%41 = xor i1 %40, true
br label %47
42: ; preds = %0
%43 = icmp eq i32 %6, %19
%44 = icmp eq i32 %10, %17
%45 = select i1 %43, i1 %44, i1 false
%46 = xor i1 %45, true
br label %47
47: ; preds = %28, %42, %37, %34, %31
%48 = phi i32 [ 2, %31 ], [ 3, %34 ], [ 4, %37 ], [ 5, %42 ], [ 1, %28 ]
%49 = phi i1 [ %32, %31 ], [ %35, %34 ], [ %40, %37 ], [ %45, %42 ], [ true, %28 ]
%50 = phi i1 [ %33, %31 ], [ %36, %34 ], [ %41, %37 ], [ %46, %42 ], [ false, %28 ]
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %48)
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %6)
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %10)
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %13)
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %17)
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %19)
br i1 %49, label %57, label %59
57: ; preds = %47
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0))
br label %59
59: ; preds = %57, %47
br i1 %50, label %60, label %62
60: ; preds = %59
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.6, i64 0, i64 0))
br label %62
62: ; preds = %60, %59
ret void
}