#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 cube(int);
int judge(int input) {
  int a, b, c, n;
  a = input % 10;
  b = ((input - a) / 10) % 10;
  c = (input - (input % 100)) / 100;
  n = cube(a) + cube(b) + cube(c);
  if (n == input)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<judge>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    -0x24(%rbp),%eax
sub    %edx,%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <cube@plt>
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <cube@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <cube@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    11aa <judge+0x9a>
movl   $0x1,-0x4(%rbp)
jmp    11b1 <judge+0xa1>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<judge>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
movslq %edi,%r12
imul   $0x66666667,%r12,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
lea    (%rax,%rax,1),%ecx
lea    (%rcx,%rcx,4),%ecx
mov    %r12d,%edi
sub    %ecx,%edi
movslq %eax,%r14
imul   $0x66666667,%r14,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%r14d
imul   $0x51eb851f,%r12,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x25,%rbx
add    %eax,%ebx
call   1030 <cube@plt>
mov    %eax,%r15d
mov    %r14d,%edi
call   1030 <cube@plt>
mov    %eax,%ebp
add    %r15d,%ebp
mov    %ebx,%edi
call   1030 <cube@plt>
add    %ebp,%eax
xor    %ecx,%ecx
cmp    %r12d,%eax
sete   %cl
mov    %ecx,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @judge(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %3
%8 = load i32, i32* %3
%9 = srem i32 %8, 10
store i32 %9, i32* %4
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = sub nsw i32 %10, %11
%13 = sdiv i32 %12, 10
%14 = srem i32 %13, 10
store i32 %14, i32* %5
%15 = load i32, i32* %3
%16 = load i32, i32* %3
%17 = srem i32 %16, 100
%18 = sub nsw i32 %15, %17
%19 = sdiv i32 %18, 100
store i32 %19, i32* %6
%20 = load i32, i32* %4
%21 = call i32 @cube(i32 %20)
%22 = load i32, i32* %5
%23 = call i32 @cube(i32 %22)
%24 = add nsw i32 %21, %23
%25 = load i32, i32* %6
%26 = call i32 @cube(i32 %25)
%27 = add nsw i32 %24, %26
store i32 %27, i32* %7
%28 = load i32, i32* %7
%29 = load i32, i32* %3
%30 = icmp eq i32 %28, %29
br i1 %30, label %31, label %32
31: ; preds = %1
store i32 1, i32* %2
br label %33
32: ; preds = %1
store i32 0, i32* %2
br label %33
33: ; preds = %32, %31
%34 = load i32, i32* %2
ret i32 %34
}

LLVM IR (-O2):
define i32 @judge(i32 %0) {
%2 = srem i32 %0, 10
%3 = sdiv i32 %0, 10
%4 = srem i32 %3, 10
%5 = sdiv i32 %0, 100
%6 = tail call i32 @cube(i32 %2)
%7 = tail call i32 @cube(i32 %4)
%8 = add nsw i32 %7, %6
%9 = tail call i32 @cube(i32 %5)
%10 = add nsw i32 %8, %9
%11 = icmp eq i32 %10, %0
%12 = zext i1 %11 to i32
ret i32 %12
}