#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);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int num, sum, temp, one_digit;
  sum = 0;
  one_digit = 0;
  scanf("%d", &num);
  temp = num;
  while (0 != temp) {
    one_digit = temp % 10;
    sum += one_digit * one_digit * one_digit;
    temp = temp / 10;
  }
  printf("sum=%d\n", sum);
  if (num != sum) {
    printf("number %d is NOT a asphdol number.", num);
  } else {
    printf("number %d is  a asphdol number.", num);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xebc(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%eax
je     1190 <main+0x70>
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
imul   -0x14(%rbp),%eax
imul   -0x14(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
jmp    1153 <main+0x33>
mov    -0xc(%rbp),%esi
lea    0xe69(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     11bf <main+0x9f>
mov    -0x8(%rbp),%esi
lea    0xe56(%rip),%rdi
call   1030 <printf@plt>
jmp    11ce <main+0xae>
mov    -0x8(%rbp),%esi
lea    0xe65(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
xor    %ebx,%ebx
test   %eax,%eax
je     1173 <main+0x53>
movslq %eax,%rcx
imul   $0x66666667,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rax
add    %edx,%eax
lea    (%rax,%rax,1),%edx
lea    (%rdx,%rdx,4),%edx
mov    %ecx,%esi
sub    %edx,%esi
mov    %esi,%edx
imul   %esi,%edx
imul   %esi,%edx
add    %edx,%ebx
add    $0x9,%ecx
cmp    $0x12,%ecx
ja     1140 <main+0x20>
lea    0xe89(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
cmp    %ebx,%esi
jne    1194 <main+0x74>
lea    0xe9e(%rip),%rdi
mov    %ebx,%esi
jmp    119b <main+0x7b>
lea    0xe70(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [8 x i8] c"sum=%d\0A\00"
@.str.2 = [35 x i8] c"number %d is NOT a asphdol number.\00"
@.str.3 = [32 x i8] c"number %d is a asphdol number.\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, 0
br i1 %5, label %16, label %6
6: ; preds = %0, %6
%7 = phi i32 [ %13, %6 ], [ %4, %0 ]
%8 = phi i32 [ %12, %6 ], [ 0, %0 ]
%9 = srem i32 %7, 10
%10 = mul nsw i32 %9, %9
%11 = mul nsw i32 %10, %9
%12 = add nsw i32 %11, %8
%13 = sdiv i32 %7, 10
%14 = add i32 %7, 9
%15 = icmp ult i32 %14, 19
br i1 %15, label %16, label %6
16: ; preds = %6, %0
%17 = phi i32 [ 0, %0 ], [ %12, %6 ]
%18 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%19 = load i32, i32* %1
%20 = icmp eq i32 %19, %17
br i1 %20, label %23, label %21
21: ; preds = %16
%22 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i32 %19)
br label %25
23: ; preds = %16
%24 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i32 %17)
br label %25
25: ; preds = %23, %21
ret i32 0
}