#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__ pow(int, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  for (int i = 1; i < 501; i++) {
    int t = i;
    int sum = 0;
    while (t) {
      sum += pow(t % 10, 3);
      t /= 10;
    }
    if (sum == i)
      printf("%d\t", i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x1f5,-0x8(%rbp)
jge    11bf <main+0x9f>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1191 <main+0x71>
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
mov    $0x3,%esi
call   1040 <pow@plt>
mov    %rax,%rcx
movslq -0x10(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
jmp    1150 <main+0x30>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    11ac <main+0x8c>
mov    -0x8(%rbp),%esi
lea    0xe59(%rip),%rdi
call   1030 <printf@plt>
jmp    11b1 <main+0x91>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    $0x1,%r15d
lea    0xecb(%rip),%r14
jmp    114d <main+0x2d>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r15d
cmp    $0x1f5,%r15d
je     11a8 <main+0x88>
xor    %r12d,%r12d
mov    %r15d,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movslq %ebx,%rbp
imul   $0x66666667,%rbp,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x22,%rbx
add    %eax,%ebx
lea    (%rbx,%rbx,1),%eax
lea    (%rax,%rax,4),%eax
mov    %ebp,%edi
sub    %eax,%edi
mov    $0x3,%esi
call   1040 <pow@plt>
add    %eax,%r12d
add    $0x9,%ebp
cmp    $0x12,%ebp
ja     1160 <main+0x40>
cmp    %r15d,%r12d
jne    1140 <main+0x20>
mov    %r14,%rdi
mov    %r15d,%esi
call   1030 <printf@plt>
jmp    1140 <main+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\09\00"
define i32 @main() {
br label %1
1: ; preds = %0, %18
%2 = phi i32 [ 1, %0 ], [ %19, %18 ]
br label %4
3: ; preds = %18
ret i32 0
4: ; preds = %1, %4
%5 = phi i32 [ 0, %1 ], [ %10, %4 ]
%6 = phi i32 [ %2, %1 ], [ %11, %4 ]
%7 = srem i32 %6, 10
%8 = tail call i64 @pow(i32 %7, i32 3)
%9 = trunc i64 %8 to i32
%10 = add i32 %5, %9
%11 = sdiv i32 %6, 10
%12 = add nsw i32 %6, 9
%13 = icmp ult i32 %12, 19
br i1 %13, label %14, label %4
14: ; preds = %4
%15 = icmp eq i32 %10, %2
br i1 %15, label %16, label %18
16: ; preds = %14
%17 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %18
18: ; preds = %16, %14
%19 = add nuw nsw i32 %2, 1
%20 = icmp eq i32 %19, 501
br i1 %20, label %3, label %1
}