#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 /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int n, m, res, nBack;
  printf("Enter a two numbers (n,m) m > n:\n");
  scanf("%d %d", &n, &m);
  for (n; n <= m; n++) {
    res = 0;
    nBack = n;
    while (n != 0) {
      res += ((n % 10) * (n % 10) * (n % 10));
      n /= 10;
    }
    if (nBack == res)
      printf("%3d is an Armstrong number.\n", nBack);
    else
      printf("%3d is not an Armstrong number.\n", nBack);
    n = nBack;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xede(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1209 <main+0xe9>
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     11c2 <main+0xa2>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    -0x1c(%rbp),%edx
imul   %eax,%edx
mov    %edx,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x18(%rbp),%eax
imul   %edx,%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    116a <main+0x4a>
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    11e4 <main+0xc4>
mov    -0x14(%rbp),%esi
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f5 <main+0xd5>
mov    -0x14(%rbp),%esi
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1151 <main+0x31>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xf04(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb4(%rip),%rdi
lea    0x8(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   1050 <scanf@plt>
mov    0x8(%rsp),%ebx
cmp    0xc(%rsp),%ebx
jle    1171 <main+0x41>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xe8e(%rip),%r14
lea    0xea4(%rip),%r15
jmp    11b1 <main+0x81>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmp    %eax,%ebx
mov    %r15,%rdi
cmove  %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x1(%rbx),%eax
mov    %eax,0x8(%rsp)
cmp    0xc(%rsp),%ebx
mov    %eax,%ebx
jge    1165 <main+0x35>
mov    $0x0,%eax
test   %ebx,%ebx
je     1190 <main+0x60>
xor    %eax,%eax
mov    %ebx,%ecx
xchg   %ax,%ax
movslq %ecx,%rdx
imul   $0x66666667,%rdx,%rcx
mov    %rcx,%rsi
shr    $0x3f,%rsi
sar    $0x22,%rcx
add    %esi,%ecx
lea    (%rcx,%rcx,1),%esi
lea    (%rsi,%rsi,4),%esi
mov    %edx,%edi
sub    %esi,%edi
mov    %edi,%esi
imul   %edi,%esi
imul   %edi,%esi
add    %esi,%eax
add    $0x9,%edx
cmp    $0x12,%edx
ja     11c0 <main+0x90>
mov    %ecx,0x8(%rsp)
jmp    1190 <main+0x60>

LLVM IR (-O0):
@.str = [34 x i8] c"Enter a two numbers (n,m) m > n:\0A\00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [29 x i8] c"%3d is an Armstrong number.\0A\00"
@.str.3 = [33 x i8] c"%3d is not an Armstrong number.\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
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%8 = load i32, i32* %2
br label %9
9: ; preds = %43, %0
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = icmp sle i32 %10, %11
br i1 %12, label %13, label %46
13: ; preds = %9
store i32 0, i32* %4
%14 = load i32, i32* %2
store i32 %14, i32* %5
br label %15
15: ; preds = %18, %13
%16 = load i32, i32* %2
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %31
18: ; preds = %15
%19 = load i32, i32* %2
%20 = srem i32 %19, 10
%21 = load i32, i32* %2
%22 = srem i32 %21, 10
%23 = mul nsw i32 %20, %22
%24 = load i32, i32* %2
%25 = srem i32 %24, 10
%26 = mul nsw i32 %23, %25
%27 = load i32, i32* %4
%28 = add nsw i32 %27, %26
store i32 %28, i32* %4
%29 = load i32, i32* %2
%30 = sdiv i32 %29, 10
store i32 %30, i32* %2
br label %15
31: ; preds = %15
%32 = load i32, i32* %5
%33 = load i32, i32* %4
%34 = icmp eq i32 %32, %33
br i1 %34, label %35, label %38
35: ; preds = %31
%36 = load i32, i32* %5
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %36)
br label %41
38: ; preds = %31
%39 = load i32, i32* %5
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 %39)
br label %41
41: ; preds = %38, %35
%42 = load i32, i32* %5
store i32 %42, i32* %2
br label %43
43: ; preds = %41
%44 = load i32, i32* %2
%45 = add nsw i32 %44, 1
store i32 %45, i32* %2
br label %9
46: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [29 x i8] c"%3d is an Armstrong number.\0A\00"
@.str.3 = [33 x i8] c"%3d is not an Armstrong number.\0A\00"
@str = [33 x i8] c"Enter a two numbers (n,m) m > n:\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = icmp sgt i32 %7, %8
br i1 %9, label %32, label %10
10: ; preds = %0, %24
%11 = phi i32 [ %29, %24 ], [ %7, %0 ]
%12 = icmp eq i32 %11, 0
br i1 %12, label %24, label %13
13: ; preds = %10, %13
%14 = phi i32 [ %19, %13 ], [ 0, %10 ]
%15 = phi i32 [ %20, %13 ], [ %11, %10 ]
%16 = srem i32 %15, 10
%17 = mul nsw i32 %16, %16
%18 = mul nsw i32 %17, %16
%19 = add nsw i32 %18, %14
%20 = sdiv i32 %15, 10
%21 = add i32 %15, 9
%22 = icmp ult i32 %21, 19
br i1 %22, label %23, label %13
23: ; preds = %13
store i32 %20, i32* %1
br label %24
24: ; preds = %23, %10
%25 = phi i32 [ %19, %23 ], [ 0, %10 ]
%26 = icmp eq i32 %11, %25
%27 = select i1 %26, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0)
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %27, i32 %11)
%29 = add nsw i32 %11, 1
store i32 %29, i32* %1
%30 = load i32, i32* %2
%31 = icmp slt i32 %11, %30
br i1 %31, label %10, label %32
32: ; preds = %24, %0
ret i32 0
}