#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 num;
  printf("Enter the number: ");
  scanf("%d", &num);
  int square = num * num;
  while (num > 0) {
    if (num % 10 != square % 10) {
      printf("Not Automorphic");
      return 0;
    }
    num /= 10;
    square /= 10;
  }
  printf("Automorphic");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xed1(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    11be <main+0x9e>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    -0x10(%rbp),%edx
cmp    %eax,%edx
je     119d <main+0x7d>
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11d1 <main+0xb1>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
jmp    1155 <main+0x35>
lea    0xe55(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
lea    0xedf(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%r10d
lea    0xed0(%rip),%rdi
test   %r10d,%r10d
jle    11bd <main+0x9d>
mov    %r10d,%ecx
imul   %ecx,%ecx
mov    $0xcccccccd,%r9d
lea    0xeb4(%rip),%r8
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r10d,%edx
imul   %r9,%rdx
shr    $0x23,%rdx
lea    (%rdx,%rdx,1),%esi
lea    (%rsi,%rsi,4),%esi
mov    %r10d,%r11d
sub    %esi,%r11d
movslq %ecx,%rsi
imul   $0x66666667,%rsi,%rcx
mov    %rcx,%rax
shr    $0x3f,%rax
sar    $0x22,%rcx
add    %eax,%ecx
lea    (%rcx,%rcx,1),%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%esi
cmp    %esi,%r11d
jne    11ba <main+0x9a>
mov    %edx,0x4(%rsp)
cmp    $0x9,%r10d
mov    %edx,%r10d
ja     1170 <main+0x50>
jmp    11bd <main+0x9d>
mov    %r8,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Enter the number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [16 x i8] c"Not Automorphic\00"
@.str.3 = [12 x i8] c"Automorphic\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = load i32, i32* %2
%8 = mul nsw i32 %6, %7
store i32 %8, i32* %3
br label %9
9: ; preds = %20, %0
%10 = load i32, i32* %2
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %25
12: ; preds = %9
%13 = load i32, i32* %2
%14 = srem i32 %13, 10
%15 = load i32, i32* %3
%16 = srem i32 %15, 10
%17 = icmp ne i32 %14, %16
br i1 %17, label %18, label %20
18: ; preds = %12
%19 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %1
br label %27
20: ; preds = %12
%21 = load i32, i32* %2
%22 = sdiv i32 %21, 10
store i32 %22, i32* %2
%23 = load i32, i32* %3
%24 = sdiv i32 %23, 10
store i32 %24, i32* %3
br label %9
25: ; preds = %9
%26 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %1
br label %27
27: ; preds = %25, %18
%28 = load i32, i32* %1
ret i32 %28
}

LLVM IR (-O2):
@.str = [19 x i8] c"Enter the number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [16 x i8] c"Not Automorphic\00"
@.str.3 = [12 x i8] c"Automorphic\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 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 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %19
7: ; preds = %0
%8 = mul nsw i32 %5, %5
br label %9
9: ; preds = %7, %17
%10 = phi i32 [ %15, %17 ], [ %8, %7 ]
%11 = phi i32 [ %13, %17 ], [ %5, %7 ]
%12 = urem i32 %11, 10
%13 = udiv i32 %11, 10
%14 = srem i32 %10, 10
%15 = sdiv i32 %10, 10
%16 = icmp eq i32 %12, %14
br i1 %16, label %17, label %19
17: ; preds = %9
store i32 %13, i32* %1
%18 = icmp ult i32 %11, 10
br i1 %18, label %19, label %9
19: ; preds = %17, %9, %0
%20 = phi i8* [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), %0 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), %9 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), %17 ]
%21 = call i32 @printf(i8* dereferenceable(1) %20)
ret i32 0
}