#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 fact(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int n, t, s = 0, r;
  printf("Enter the number: ");
  scanf("%d", &n);
  t = n;
  while (t > 0) {
    r = t % 10;
    t = t / 10;
    s = s + fact(r);
  }
  (s == n) ? printf("\nThis is a strong number")
           : printf("\nThis is not a strong number");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    11ab <main+0x7b>
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <fact@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
jmp    1168 <main+0x38>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    11c8 <main+0x98>
lea    0xe58(%rip),%rdi
call   1030 <printf@plt>
jmp    11d4 <main+0xa4>
lea    0xe60(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
lea    0xec9(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%r15d
xor    %ebp,%ebp
test   %r15d,%r15d
jle    119b <main+0x6b>
mov    $0xcccccccd,%r14d
cs nopw 0x0(%rax,%rax,1)
mov    %r15d,%ebx
imul   %r14,%rbx
shr    $0x23,%rbx
lea    (%rbx,%rbx,1),%eax
lea    (%rax,%rax,4),%eax
mov    %r15d,%edi
sub    %eax,%edi
call   1040 <fact@plt>
add    %eax,%ebp
cmp    $0x9,%r15d
mov    %ebx,%r15d
ja     1170 <main+0x40>
mov    0x4(%rsp),%r15d
cmp    %r15d,%ebp
lea    0xe71(%rip),%rax
lea    0xe83(%rip),%rdi
cmove  %rax,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Enter the number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [25 x i8] c"\0AThis is a strong number\00"
@.str.3 = [29 x i8] c"\0AThis is not a strong number\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 0, i32* %4
%6 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%8 = load i32, i32* %2
store i32 %8, i32* %3
br label %9
9: ; preds = %12, %0
%10 = load i32, i32* %3
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %21
12: ; preds = %9
%13 = load i32, i32* %3
%14 = srem i32 %13, 10
store i32 %14, i32* %5
%15 = load i32, i32* %3
%16 = sdiv i32 %15, 10
store i32 %16, i32* %3
%17 = load i32, i32* %4
%18 = load i32, i32* %5
%19 = call i32 @fact(i32 %18)
%20 = add nsw i32 %17, %19
store i32 %20, i32* %4
br label %9
21: ; preds = %9
%22 = load i32, i32* %4
%23 = load i32, i32* %2
%24 = icmp eq i32 %22, %23
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
br label %29
27: ; preds = %21
%28 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
br label %29
29: ; preds = %27, %25
%30 = phi i32 [ %26, %25 ], [ %28, %27 ]
%31 = load i32, i32* %1
ret i32 %31
}

LLVM IR (-O2):
@.str = [19 x i8] c"Enter the number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [25 x i8] c"\0AThis is a strong number\00"
@.str.3 = [29 x i8] c"\0AThis is not a strong number\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 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 sgt i32 %5, 0
br i1 %6, label %7, label %17
7: ; preds = %0, %7
%8 = phi i32 [ %11, %7 ], [ %5, %0 ]
%9 = phi i32 [ %13, %7 ], [ 0, %0 ]
%10 = urem i32 %8, 10
%11 = udiv i32 %8, 10
%12 = call i32 @fact(i32 %10)
%13 = add nsw i32 %12, %9
%14 = icmp ult i32 %8, 10
br i1 %14, label %15, label %7
15: ; preds = %7
%16 = load i32, i32* %1
br label %17
17: ; preds = %15, %0
%18 = phi i32 [ %5, %0 ], [ %16, %15 ]
%19 = phi i32 [ 0, %0 ], [ %13, %15 ]
%20 = icmp eq i32 %19, %18
%21 = select i1 %20, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0)
%22 = call i32 @printf(i8* dereferenceable(1) %21)
ret i32 0
}