#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 /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int n1, n2, i, temp1, temp2, remainder, n = 0, result = 0;
  printf("Enter two numbers(intervals): ");
  scanf("%d %d", &n1, &n2);
  printf("Armstrong numbers between %d an %d are: ", n1, n2);
  for (i = n1 + 1; i < n2; ++i) {
    temp2 = i;
    temp1 = i;
    while (temp1 != 0) {
      temp1 /= 10;
      ++n;
    }
    while (temp2 != 0) {
      remainder = temp2 % 10;
      result += pow(remainder, n);
      temp2 /= 10;
    }
    if (result == i) {
      printf("%d ", i);
    }
    n = 0;
    result = 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebd(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    124b <main+0x11b>
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11ca <main+0x9a>
mov    -0x14(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11a4 <main+0x74>
jmp    11cf <main+0x9f>
cmpl   $0x0,-0x18(%rbp)
je     1212 <main+0xe2>
mov    -0x18(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%esi
call   1050 <pow@plt>
mov    %rax,%rcx
movslq -0x24(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
jmp    11cf <main+0x9f>
mov    -0x24(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    122f <main+0xff>
mov    -0x10(%rbp),%esi
lea    0xe26(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    118c <main+0x5c>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xebe(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xecf(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
lea    0xeba(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%r15d
add    $0x1,%r15d
cmp    (%rsp),%r15d
jge    122f <main+0xff>
lea    0xec2(%rip),%r14
jmp    119e <main+0x6e>
xchg   %ax,%ax
add    $0x1,%r15d
cmp    (%rsp),%r15d
jge    122f <main+0xff>
mov    $0x0,%r12d
test   %r15d,%r15d
je     1214 <main+0xe4>
xor    %r13d,%r13d
mov    %r15d,%eax
nop
movslq %eax,%rcx
imul   $0x66666667,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rax
add    %edx,%eax
add    $0x1,%r13d
add    $0x9,%ecx
cmp    $0x13,%ecx
jae    11b0 <main+0x80>
xor    %r12d,%r12d
test   %r15d,%r15d
je     1214 <main+0xe4>
mov    %r15d,%ebx
xchg   %ax,%ax
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    %r13d,%esi
call   1050 <pow@plt>
add    %eax,%r12d
add    $0x9,%ebp
cmp    $0x12,%ebp
ja     11e0 <main+0xb0>
cmp    %r15d,%r12d
jne    1190 <main+0x60>
mov    %r14,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1190 <main+0x60>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Enter two numbers(intervals): \00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [41 x i8] c"Armstrong numbers between %d an %d are: \00"
@.str.3 = [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
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %8
store i32 0, i32* %9
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i32 %12, i32 %13)
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 1
store i32 %16, i32* %4
br label %17
17: ; preds = %56, %0
%18 = load i32, i32* %4
%19 = load i32, i32* %3
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %59
21: ; preds = %17
%22 = load i32, i32* %4
store i32 %22, i32* %6
%23 = load i32, i32* %4
store i32 %23, i32* %5
br label %24
24: ; preds = %27, %21
%25 = load i32, i32* %5
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %32
27: ; preds = %24
%28 = load i32, i32* %5
%29 = sdiv i32 %28, 10
store i32 %29, i32* %5
%30 = load i32, i32* %8
%31 = add nsw i32 %30, 1
store i32 %31, i32* %8
br label %24
32: ; preds = %24
br label %33
33: ; preds = %36, %32
%34 = load i32, i32* %6
%35 = icmp ne i32 %34, 0
br i1 %35, label %36, label %48
36: ; preds = %33
%37 = load i32, i32* %6
%38 = srem i32 %37, 10
store i32 %38, i32* %7
%39 = load i32, i32* %7
%40 = load i32, i32* %8
%41 = call i64 @pow(i32 %39, i32 %40)
%42 = load i32, i32* %9
%43 = sext i32 %42 to i64
%44 = add nsw i64 %43, %41
%45 = trunc i64 %44 to i32
store i32 %45, i32* %9
%46 = load i32, i32* %6
%47 = sdiv i32 %46, 10
store i32 %47, i32* %6
br label %33
48: ; preds = %33
%49 = load i32, i32* %9
%50 = load i32, i32* %4
%51 = icmp eq i32 %49, %50
br i1 %51, label %52, label %55
52: ; preds = %48
%53 = load i32, i32* %4
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %53)
br label %55
55: ; preds = %52, %48
store i32 0, i32* %8
store i32 0, i32* %9
br label %56
56: ; preds = %55
%57 = load i32, i32* %4
%58 = add nsw i32 %57, 1
store i32 %58, i32* %4
br label %17
59: ; preds = %17
ret i32 0
}

LLVM IR (-O2):
@.str = [31 x i8] c"Enter two numbers(intervals): \00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [41 x i8] c"Armstrong numbers between %d an %d are: \00"
@.str.3 = [4 x i8] c"%d \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 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 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 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 %8)
%10 = load i32, i32* %1
%11 = add nsw i32 %10, 1
%12 = load i32, i32* %2
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %44
14: ; preds = %0, %40
%15 = phi i32 [ %41, %40 ], [ %11, %0 ]
%16 = icmp eq i32 %15, 0
br i1 %16, label %35, label %18
17: ; preds = %18
br i1 %16, label %35, label %25
18: ; preds = %14, %18
%19 = phi i32 [ %22, %18 ], [ 0, %14 ]
%20 = phi i32 [ %21, %18 ], [ %15, %14 ]
%21 = sdiv i32 %20, 10
%22 = add nuw nsw i32 %19, 1
%23 = add i32 %20, 9
%24 = icmp ult i32 %23, 19
br i1 %24, label %17, label %18
25: ; preds = %17, %25
%26 = phi i32 [ %31, %25 ], [ 0, %17 ]
%27 = phi i32 [ %32, %25 ], [ %15, %17 ]
%28 = srem i32 %27, 10
%29 = call i64 @pow(i32 %28, i32 %22)
%30 = trunc i64 %29 to i32
%31 = add i32 %26, %30
%32 = sdiv i32 %27, 10
%33 = add i32 %27, 9
%34 = icmp ult i32 %33, 19
br i1 %34, label %35, label %25
35: ; preds = %25, %14, %17
%36 = phi i32 [ 0, %17 ], [ 0, %14 ], [ %31, %25 ]
%37 = icmp eq i32 %36, %15
br i1 %37, label %38, label %40
38: ; preds = %35
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %15)
br label %40
40: ; preds = %38, %35
%41 = add nsw i32 %15, 1
%42 = load i32, i32* %2
%43 = icmp slt i32 %41, %42
br i1 %43, label %14, label %44
44: ; preds = %40, %0
ret i32 0
}