#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 */
scalar_t__ is_automorphic(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int num_to_check;
  printf("Input a non-negative integer less than 44720: ");
  scanf(" %d", &num_to_check);
  if (num_to_check > 44720)
    printf("Invalid input.\n");
  else
    printf("%d is%s an automorphic number.\n", num_to_check,
           (is_automorphic(num_to_check) ? "" : " not"));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0xaeb0,-0x8(%rbp)
jle    117d <main+0x4d>
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b5 <main+0x85>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <is_automorphic@plt>
mov    -0xc(%rbp),%esi
mov    %rax,%rcx
lea    0xecb(%rip),%rdx
lea    0xec3(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rdx
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xeb4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed5(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%ebx
cmp    $0xaeb1,%ebx
jl     117e <main+0x3e>
lea    0xee1(%rip),%rdi
call   1030 <puts@plt>
jmp    11aa <main+0x6a>
mov    %ebx,%edi
call   1050 <is_automorphic@plt>
test   %rax,%rax
lea    0xec4(%rip),%rax
lea    0xebc(%rip),%rdx
cmove  %rax,%rdx
lea    0xe92(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"Input a non-negative integer less than 44720: \00"
@.str.1 = [4 x i8] c" %d\00"
@.str.2 = [16 x i8] c"Invalid input.\0A\00"
@.str.3 = [32 x i8] c"%d is%s an automorphic number.\0A\00"
@.str.4 = [1 x i8] zeroinitializer
@.str.5 = [5 x i8] c" not\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = icmp sgt i32 %5, 44720
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %17
9: ; preds = %0
%10 = load i32, i32* %2
%11 = load i32, i32* %2
%12 = call i64 @is_automorphic(i32 %11)
%13 = icmp ne i64 %12, 0
%14 = zext i1 %13 to i64
%15 = select i1 %13, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i32 %10, i8* %15)
br label %17
17: ; preds = %9, %7
ret i32 0
}

LLVM IR (-O2):
@.str = [47 x i8] c"Input a non-negative integer less than 44720: \00"
@.str.1 = [4 x i8] c" %d\00"
@.str.3 = [32 x i8] c"%d is%s an automorphic number.\0A\00"
@.str.4 = [1 x i8] zeroinitializer
@.str.5 = [5 x i8] c" not\00"
@str = [15 x i8] c"Invalid input.\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp sgt i32 %5, 44720
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
br label %14
9: ; preds = %0
%10 = call i64 @is_automorphic(i32 %5)
%11 = icmp eq i64 %10, 0
%12 = select i1 %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i32 %5, i8* %12)
br label %14
14: ; preds = %9, %7
ret i32 0
}