#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 *, unsigned int *);
int main() {
  unsigned int num;
  unsigned int pri[] = {
      2,   3,   5,   7,   11,  13,  17,  19,  23,  29,  31,  37,  41,  43,
      47,  53,  59,  61,  67,  71,  73,  79,  83,  89,  97,  101, 103, 107,
      109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181,
      191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263,
      269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349,
      353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433,
      439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521,
      523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613,
      617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701,
      709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809,
      811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887,
      907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997};
  unsigned int i;
  printf("======FATORAÇÃO======\n=Para sair digite 0=\n");
  while (1) {
    i = 0;
    printf("==Insira o Número: ");
    scanf("%d", &num);
    if (num == 0) {
      break;
    }
    if (num > 999) {
      printf("[Aviso]Erros podem ocorrer com números maiores que 999!\n\n");
    }
    while (i <= num) {
      if ((num % pri[i]) == 0) {
        printf("%d | %d\n", num, pri[i]);
        num = num / pri[i];
      } else {
        i++;
      }
    }
    printf("1\n");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2c0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x2b0(%rbp),%rdi
lea    0xeb0(%rip),%rsi
mov    $0x2a0,%edx
call   1040 <memcpy@plt>
lea    0x113f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x2b4(%rbp)
lea    0x1155(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0x115c(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jne    119f <main+0x6f>
jmp    1248 <main+0x118>
cmpl   $0x3e7,-0x8(%rbp)
jbe    11ba <main+0x8a>
lea    0x1133(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11bf <main+0x8f>
mov    -0x2b4(%rbp),%eax
cmp    -0x8(%rbp),%eax
ja     1235 <main+0x105>
mov    -0x8(%rbp),%eax
mov    -0x2b4(%rbp),%ecx
xor    %edx,%edx
divl   -0x2b0(%rbp,%rcx,4)
cmp    $0x0,%edx
jne    1221 <main+0xf1>
mov    -0x8(%rbp),%esi
mov    -0x2b4(%rbp),%eax
mov    -0x2b0(%rbp,%rax,4),%edx
lea    0x1121(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    -0x2b4(%rbp),%ecx
xor    %edx,%edx
divl   -0x2b0(%rbp,%rcx,4)
mov    %eax,-0x8(%rbp)
jmp    1230 <main+0x100>
mov    -0x2b4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2b4(%rbp)
jmp    11bf <main+0x8f>
lea    0x10ee(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1168 <main+0x38>
lea    0x10d0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x2c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0x116f(%rip),%rdi
call   1040 <puts@plt>
lea    0x1142(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x1149(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%esi
test   %esi,%esi
je     1231 <main+0xf1>
lea    0xe77(%rip),%r15
lea    0x1128(%rip),%rbx
lea    0x111e(%rip),%r13
lea    0x4(%rsp),%rbp
jmp    11cd <main+0x8d>
xchg   %ax,%ax
lea    0x1147(%rip),%rdi
call   1040 <puts@plt>
lea    0x10ed(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%esi
test   %esi,%esi
je     1231 <main+0xf1>
cmp    $0x3e8,%esi
jb     11e5 <main+0xa5>
lea    0x1114(%rip),%rdi
call   1040 <puts@plt>
mov    0x4(%rsp),%esi
xor    %r12d,%r12d
jmp    11f9 <main+0xb9>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r12d
cmp    %esi,%r12d
ja     11a0 <main+0x60>
mov    %r12d,%eax
mov    (%r15,%rax,4),%r14d
mov    %esi,%eax
xor    %edx,%edx
div    %r14d
test   %edx,%edx
jne    11f0 <main+0xb0>
mov    %rbx,%rdi
mov    %r14d,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rsp),%eax
xor    %edx,%edx
div    %r14d
mov    %eax,%esi
mov    %eax,0x4(%rsp)
cmp    %esi,%r12d
jbe    11f9 <main+0xb9>
jmp    11a0 <main+0x60>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.pri = [168 x i32] [i32 2, i32 3, i32 5, i32 7, i32 11, i32 13, i32 17, i32 19, i32 23, i32 29, i32 31, i32 37, i32 41, i32 43, i32 47, i32 53, i32 59, i32 61, i32 67, i32 71, i32 73, i32 79, i32 83, i32 89, i32 97, i32 101, i32 103, i32 107, i32 109, i32 113, i32 127, i32 131, i32 137, i32 139, i32 149, i32 151, i32 157, i32 163, i32 167, i32 173, i32 179, i32 181, i32 191, i32 193, i32 197, i32 199, i32 211, i32 223, i32 227, i32 229, i32 233, i32 239, i32 241, i32 251, i32 257, i32 263, i32 269, i32 271, i32 277, i32 281, i32 283, i32 293, i32 307, i32 311, i32 313, i32 317, i32 331, i32 337, i32 347, i32 349, i32 353, i32 359, i32 367, i32 373, i32 379, i32 383, i32 389, i32 397, i32 401, i32 409, i32 419, i32 421, i32 431, i32 433, i32 439, i32 443, i32 449, i32 457, i32 461, i32 463, i32 467, i32 479, i32 487, i32 491, i32 499, i32 503, i32 509, i32 521, i32 523, i32 541, i32 547, i32 557, i32 563, i32 569, i32 571, i32 577, i32 587, i32 593, i32 599, i32 601, i32 607, i32 613, i32 617, i32 619, i32 631, i32 641, i32 643, i32 647, i32 653, i32 659, i32 661, i32 673, i32 677, i32 683, i32 691, i32 701, i32 709, i32 719, i32 727, i32 733, i32 739, i32 743, i32 751, i32 757, i32 761, i32 769, i32 773, i32 787, i32 797, i32 809, i32 811, i32 821, i32 823, i32 827, i32 829, i32 839, i32 853, i32 857, i32 859, i32 863, i32 877, i32 881, i32 883, i32 887, i32 907, i32 911, i32 919, i32 929, i32 937, i32 941, i32 947, i32 953, i32 967, i32 971, i32 977, i32 983, i32 991, i32 997]
@.str = [46 x i8] c"======FATORA\C3\87\C3\83O======\0A=Para sair digite 0=\0A\00"
@.str.1 = [21 x i8] c"==Insira o N\C3\BAmero: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [59 x i8] c"[Aviso]Erros podem ocorrer com n\C3\BAmeros maiores que 999!\0A\0A\00"
@.str.4 = [9 x i8] c"%d | %d\0A\00"
@.str.5 = [3 x i8] c"1\0A\00"
@.str.6 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [168 x i32]
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [168 x i32]* %3 to i8*
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %0, %48
store i32 0, i32* %4
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %7
br label %50
13: ; preds = %7
%14 = load i32, i32* %2
%15 = icmp ugt i32 %14, 999
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.3, i64 0, i64 0))
br label %18
18: ; preds = %16, %13
br label %19
19: ; preds = %47, %18
%20 = load i32, i32* %4
%21 = load i32, i32* %2
%22 = icmp ule i32 %20, %21
br i1 %22, label %23, label %48
23: ; preds = %19
%24 = load i32, i32* %2
%25 = load i32, i32* %4
%26 = zext i32 %25 to i64
%27 = getelementptr inbounds [168 x i32], [168 x i32]* %3, i64 0, i64 %26
%28 = load i32, i32* %27
%29 = urem i32 %24, %28
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %44
31: ; preds = %23
%32 = load i32, i32* %2
%33 = load i32, i32* %4
%34 = zext i32 %33 to i64
%35 = getelementptr inbounds [168 x i32], [168 x i32]* %3, i64 0, i64 %34
%36 = load i32, i32* %35
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 %32, i32 %36)
%38 = load i32, i32* %2
%39 = load i32, i32* %4
%40 = zext i32 %39 to i64
%41 = getelementptr inbounds [168 x i32], [168 x i32]* %3, i64 0, i64 %40
%42 = load i32, i32* %41
%43 = udiv i32 %38, %42
store i32 %43, i32* %2
br label %47
44: ; preds = %23
%45 = load i32, i32* %4
%46 = add i32 %45, 1
store i32 %46, i32* %4
br label %47
47: ; preds = %44, %31
br label %19
48: ; preds = %19
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %7
50: ; preds = %12
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%52 = load i32, i32* %1
ret i32 %52
}

LLVM IR (-O2):
@__const.main.pri = [168 x i32] [i32 2, i32 3, i32 5, i32 7, i32 11, i32 13, i32 17, i32 19, i32 23, i32 29, i32 31, i32 37, i32 41, i32 43, i32 47, i32 53, i32 59, i32 61, i32 67, i32 71, i32 73, i32 79, i32 83, i32 89, i32 97, i32 101, i32 103, i32 107, i32 109, i32 113, i32 127, i32 131, i32 137, i32 139, i32 149, i32 151, i32 157, i32 163, i32 167, i32 173, i32 179, i32 181, i32 191, i32 193, i32 197, i32 199, i32 211, i32 223, i32 227, i32 229, i32 233, i32 239, i32 241, i32 251, i32 257, i32 263, i32 269, i32 271, i32 277, i32 281, i32 283, i32 293, i32 307, i32 311, i32 313, i32 317, i32 331, i32 337, i32 347, i32 349, i32 353, i32 359, i32 367, i32 373, i32 379, i32 383, i32 389, i32 397, i32 401, i32 409, i32 419, i32 421, i32 431, i32 433, i32 439, i32 443, i32 449, i32 457, i32 461, i32 463, i32 467, i32 479, i32 487, i32 491, i32 499, i32 503, i32 509, i32 521, i32 523, i32 541, i32 547, i32 557, i32 563, i32 569, i32 571, i32 577, i32 587, i32 593, i32 599, i32 601, i32 607, i32 613, i32 617, i32 619, i32 631, i32 641, i32 643, i32 647, i32 653, i32 659, i32 661, i32 673, i32 677, i32 683, i32 691, i32 701, i32 709, i32 719, i32 727, i32 733, i32 739, i32 743, i32 751, i32 757, i32 761, i32 769, i32 773, i32 787, i32 797, i32 809, i32 811, i32 821, i32 823, i32 827, i32 829, i32 839, i32 853, i32 857, i32 859, i32 863, i32 877, i32 881, i32 883, i32 887, i32 907, i32 911, i32 919, i32 929, i32 937, i32 941, i32 947, i32 953, i32 967, i32 971, i32 977, i32 983, i32 991, i32 997]
@.str.1 = [21 x i8] c"==Insira o N\C3\BAmero: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.4 = [9 x i8] c"%d | %d\0A\00"
@str = [45 x i8] c"======FATORA\C3\87\C3\83O======\0A=Para sair digite 0=\00"
@str.7 = [2 x i8] c"1\00"
@str.8 = [58 x i8] c"[Aviso]Erros podem ocorrer com n\C3\BAmeros maiores que 999!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str, i64 0, i64 0))
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp eq i32 %6, 0
br i1 %7, label %40, label %8
8: ; preds = %0, %34
%9 = phi i32 [ %38, %34 ], [ %6, %0 ]
%10 = icmp ugt i32 %9, 999
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @str.8, i64 0, i64 0))
%13 = load i32, i32* %1
br label %14
14: ; preds = %11, %8
%15 = phi i32 [ %9, %8 ], [ %13, %11 ]
br label %16
16: ; preds = %14, %30
%17 = phi i32 [ %31, %30 ], [ %15, %14 ]
%18 = phi i32 [ %32, %30 ], [ 0, %14 ]
%19 = zext i32 %18 to i64
%20 = getelementptr inbounds [168 x i32], [168 x i32]* @__const.main.pri, i64 0, i64 %19
%21 = load i32, i32* %20
%22 = urem i32 %17, %21
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %28
24: ; preds = %16
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 %17, i32 %21)
%26 = load i32, i32* %1
%27 = udiv i32 %26, %21
store i32 %27, i32* %1
br label %30
28: ; preds = %16
%29 = add i32 %18, 1
br label %30
30: ; preds = %28, %24
%31 = phi i32 [ %27, %24 ], [ %17, %28 ]
%32 = phi i32 [ %18, %24 ], [ %29, %28 ]
%33 = icmp ugt i32 %32, %31
br i1 %33, label %34, label %16
34: ; preds = %30
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.7, i64 0, i64 0))
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%37 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%38 = load i32, i32* %1
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %8
40: ; preds = %34, %0
%41 = call i32 @putchar(i32 10)
ret i32 0
}