#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*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int i, j, range, a, r;
  puts("Enter Range");
  scanf("%d", &range);
  for (i = 1; i <= range; i++) {
    j = i;
    a = 0;
    while (j > 0) {
      r = j % 10;
      a = a + r * r * r;
      j = j / 10;
    }
    if (a == i)
      printf("%d,", a);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <puts@plt>
lea    0xeba(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     11e7 <main+0xb7>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    11b9 <main+0x89>
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
imul   -0x18(%rbp),%ecx
imul   -0x18(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
jmp    117b <main+0x4b>
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    11d4 <main+0xa4>
mov    -0x14(%rbp),%esi
lea    0xe40(%rip),%rdi
call   1040 <printf@plt>
jmp    11d9 <main+0xa9>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1162 <main+0x32>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xec0(%rip),%rdi
call   1030 <puts@plt>
lea    0xec0(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%r8d
test   %r8d,%r8d
jle    11dc <main+0xac>
mov    $0x1,%r15d
mov    $0xcccccccd,%ebx
lea    0xe9d(%rip),%r14
jmp    118c <main+0x5c>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0x1(%r15),%eax
cmp    %r8d,%r15d
mov    %eax,%r15d
jge    11dc <main+0xac>
xor    %ecx,%ecx
mov    %r15d,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %eax,%esi
imul   %rbx,%rsi
shr    $0x23,%rsi
lea    (%rsi,%rsi,1),%edi
lea    (%rdi,%rdi,4),%edi
mov    %eax,%edx
sub    %edi,%edx
mov    %edx,%edi
imul   %edx,%edi
imul   %edx,%edi
add    %edi,%ecx
cmp    $0x9,%eax
mov    %esi,%eax
ja     11a0 <main+0x70>
cmp    %r15d,%ecx
jne    1180 <main+0x50>
mov    %r14,%rdi
mov    %r15d,%esi
call   1040 <printf@plt>
mov    0xc(%rsp),%r8d
jmp    1180 <main+0x50>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

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