#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 main() {
  int n, n1, n2, n3;
  for (n = 100; n < 1000; n++) {
    n1 = (n / 100) % 10;
    n2 = (n / 10) % 10;
    n3 = n % 10;
    if (n == n1 + n2 * n2 + n3 * n3 * n3)
      printf("%d\n", n);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x64,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jge    11b3 <main+0xa3>
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%edx
imul   -0x10(%rbp),%edx
add    %edx,%ecx
mov    -0x14(%rbp),%edx
imul   -0x14(%rbp),%edx
imul   -0x14(%rbp),%edx
add    %edx,%ecx
cmp    %ecx,%eax
jne    11a0 <main+0x90>
mov    -0x8(%rbp),%esi
lea    0xe65(%rip),%rdi
call   1030 <printf@plt>
jmp    11a5 <main+0x95>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0x64,%ebx
mov    $0xcccccccd,%r15d
lea    0xed9(%rip),%r14
jmp    113b <main+0x2b>
nopl   0x0(%rax)
add    $0x1,%ebx
cmp    $0x3e8,%ebx
je     11b8 <main+0xa8>
mov    %ebx,%eax
imul   %r15,%rax
shr    $0x23,%rax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
movzwl %bx,%ecx
imul   $0xcccd,%ecx,%edx
shr    $0x2,%ecx
imul   $0x147b,%ecx,%ecx
shr    $0x11,%ecx
movzbl %cl,%ecx
imul   $0xcd,%ecx,%esi
shr    $0xa,%esi
and    $0xfffffffe,%esi
lea    (%rsi,%rsi,4),%esi
sub    %sil,%cl
movzbl %cl,%ecx
shr    $0x13,%edx
movzbl %dl,%edx
imul   $0xcd,%edx,%esi
shr    $0xa,%esi
and    $0xfffffffe,%esi
lea    (%rsi,%rsi,4),%esi
sub    %sil,%dl
movzbl %dl,%edx
mov    %ebx,%esi
sub    %eax,%esi
imul   %edx,%edx
mov    %esi,%eax
imul   %esi,%eax
imul   %esi,%eax
add    %ecx,%eax
add    %edx,%eax
cmp    %eax,%ebx
jne    1130 <main+0x20>
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
jmp    1130 <main+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\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 100, i32* %2
br label %6
6: ; preds = %35, %0
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 1000
br i1 %8, label %9, label %38
9: ; preds = %6
%10 = load i32, i32* %2
%11 = sdiv i32 %10, 100
%12 = srem i32 %11, 10
store i32 %12, i32* %3
%13 = load i32, i32* %2
%14 = sdiv i32 %13, 10
%15 = srem i32 %14, 10
store i32 %15, i32* %4
%16 = load i32, i32* %2
%17 = srem i32 %16, 10
store i32 %17, i32* %5
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = load i32, i32* %4
%21 = load i32, i32* %4
%22 = mul nsw i32 %20, %21
%23 = add nsw i32 %19, %22
%24 = load i32, i32* %5
%25 = load i32, i32* %5
%26 = mul nsw i32 %24, %25
%27 = load i32, i32* %5
%28 = mul nsw i32 %26, %27
%29 = add nsw i32 %23, %28
%30 = icmp eq i32 %18, %29
br i1 %30, label %31, label %34
31: ; preds = %9
%32 = load i32, i32* %2
%33 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %32)
br label %34
34: ; preds = %31, %9
br label %35
35: ; preds = %34
%36 = load i32, i32* %2
%37 = add nsw i32 %36, 1
store i32 %37, i32* %2
br label %6
38: ; preds = %6
%39 = load i32, i32* %1
ret i32 %39
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %22
%2 = phi i32 [ 100, %0 ], [ %23, %22 ]
%3 = trunc i32 %2 to i16
%4 = udiv i16 %3, 100
%5 = trunc i16 %4 to i8
%6 = urem i8 %5, 10
%7 = zext i8 %6 to i32
%8 = udiv i16 %3, 10
%9 = trunc i16 %8 to i8
%10 = urem i8 %9, 10
%11 = zext i8 %10 to i32
%12 = urem i16 %3, 10
%13 = zext i16 %12 to i32
%14 = mul nuw nsw i32 %11, %11
%15 = mul nuw nsw i32 %13, %13
%16 = mul nuw nsw i32 %15, %13
%17 = add nuw nsw i32 %16, %7
%18 = add nuw nsw i32 %17, %14
%19 = icmp eq i32 %2, %18
br i1 %19, label %20, label %22
20: ; preds = %1
%21 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %22
22: ; preds = %1, %20
%23 = add nuw nsw i32 %2, 1
%24 = icmp eq i32 %23, 1000
br i1 %24, label %25, label %1
25: ; preds = %22
ret i32 0
}