#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 main(int argc, char const *argv[]) {
  int i, j = 0, x, num, cont;
  int div[num];
  printf("Digite o numero inteiro positivo: ");
  scanf("\n %d", &num);
  for (i = 1; i <= num; i++) {
    if (num % i == 0) {
      cont++;
      div[j] = i;
      j++;
    }
  }
  if (cont > 2) {
    printf("Numero nao Primo. \n");
    printf("Numero e divisivel pelos seguintes numeros: \n");
    for (x = 0; x < cont; x++) {
      printf("%d \t", div[x]);
    }
    printf(" \n ");
  } else {
    printf("Numero  Primo. \n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x20(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x30(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x38(%rbp)
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeaa(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x20(%rbp),%eax
jg     11d8 <main+0xb8>
mov    -0x20(%rbp),%eax
cltd
idivl  -0x14(%rbp)
cmp    $0x0,%edx
jne    11c5 <main+0xa5>
mov    -0x40(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x24(%rbp)
mov    -0x14(%rbp),%edx
movslq -0x18(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11ca <main+0xaa>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1189 <main+0x69>
cmpl   $0x2,-0x24(%rbp)
jle    124b <main+0x12b>
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1238 <main+0x118>
mov    -0x40(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1205 <main+0xe5>
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1259 <main+0x139>
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %rsp,%r14
lea    0xec2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed7(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%ecx
test   %ecx,%ecx
jle    11b6 <main+0x86>
cmp    $0x1,%ecx
jne    116a <main+0x3a>
mov    $0x1,%edi
jmp    11a1 <main+0x71>
mov    %ecx,%r8d
and    $0xfffffffe,%r8d
mov    $0x1,%edi
cs nopw 0x0(%rax,%rax,1)
mov    %ecx,%eax
cltd
idiv   %edi
cmp    $0x1,%edx
adc    $0x0,%esi
lea    0x1(%rdi),%ebx
mov    %ecx,%eax
cltd
idiv   %ebx
cmp    $0x1,%edx
adc    $0x0,%esi
add    $0x2,%edi
cmp    %r8d,%ebx
jne    1180 <main+0x50>
test   $0x1,%cl
je     11b1 <main+0x81>
mov    %ecx,%eax
cltd
idiv   %edi
cmp    $0x1,%edx
adc    $0x0,%esi
cmp    $0x3,%esi
jge    11cf <main+0x9f>
lea    0xe6b(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%rsp
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe62(%rip),%rdi
call   1030 <puts@plt>
lea    0xe69(%rip),%rdi
call   1030 <puts@plt>

LLVM IR (-O0):
@.str = [35 x i8] c"Digite o numero inteiro positivo: \00"
@.str.1 = [5 x i8] c"\0A %d\00"
@.str.2 = [20 x i8] c"Numero nao Primo. \0A\00"
@.str.3 = [46 x i8] c"Numero e divisivel pelos seguintes numeros: \0A\00"
@.str.4 = [5 x i8] c"%d \09\00"
@.str.5 = [4 x i8] c" \0A \00"
@.str.6 = [17 x i8] c"Numero Primo. \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
%13 = load i32, i32* %9
%14 = zext i32 %13 to i64
%15 = call i8* @llvm.stacksave()
store i8* %15, i8** %11
%16 = alloca i32, i64 %14
store i64 %14, i64* %12
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %9)
store i32 1, i32* %6
br label %19
19: ; preds = %38, %2
%20 = load i32, i32* %6
%21 = load i32, i32* %9
%22 = icmp sle i32 %20, %21
br i1 %22, label %23, label %41
23: ; preds = %19
%24 = load i32, i32* %9
%25 = load i32, i32* %6
%26 = srem i32 %24, %25
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %37
28: ; preds = %23
%29 = load i32, i32* %10
%30 = add nsw i32 %29, 1
store i32 %30, i32* %10
%31 = load i32, i32* %6
%32 = load i32, i32* %7
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i32, i32* %16, i64 %33
store i32 %31, i32* %34
%35 = load i32, i32* %7
%36 = add nsw i32 %35, 1
store i32 %36, i32* %7
br label %37
37: ; preds = %28, %23
br label %38
38: ; preds = %37
%39 = load i32, i32* %6
%40 = add nsw i32 %39, 1
store i32 %40, i32* %6
br label %19
41: ; preds = %19
%42 = load i32, i32* %10
%43 = icmp sgt i32 %42, 2
br i1 %43, label %44, label %62
44: ; preds = %41
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %8
br label %47
47: ; preds = %57, %44
%48 = load i32, i32* %8
%49 = load i32, i32* %10
%50 = icmp slt i32 %48, %49
br i1 %50, label %51, label %60
51: ; preds = %47
%52 = load i32, i32* %8
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i32, i32* %16, i64 %53
%55 = load i32, i32* %54
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %55)
br label %57
57: ; preds = %51
%58 = load i32, i32* %8
%59 = add nsw i32 %58, 1
store i32 %59, i32* %8
br label %47
60: ; preds = %47
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
br label %64
62: ; preds = %41
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0))
br label %64
64: ; preds = %62, %60
%65 = load i8*, i8** %11
%66 = load i32, i32* %3
ret i32 %66
}

LLVM IR (-O2):
@.str = [35 x i8] c"Digite o numero inteiro positivo: \00"
@.str.1 = [5 x i8] c"\0A %d\00"
@str = [16 x i8] c"Numero Primo. \00"
@str.7 = [19 x i8] c"Numero nao Primo. \00"
@str.8 = [45 x i8] c"Numero e divisivel pelos seguintes numeros: \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i8* @llvm.stacksave()
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 1
br i1 %9, label %46, label %10
10: ; preds = %2
%11 = and i32 %8, 1
%12 = icmp eq i32 %8, 1
br i1 %12, label %31, label %13
13: ; preds = %10
%14 = and i32 %8, -2
br label %15
15: ; preds = %15, %13
%16 = phi i32 [ 1, %13 ], [ %28, %15 ]
%17 = phi i32 [ undef, %13 ], [ %27, %15 ]
%18 = phi i32 [ 0, %13 ], [ %29, %15 ]
%19 = srem i32 %8, %16
%20 = icmp eq i32 %19, 0
%21 = zext i1 %20 to i32
%22 = add nsw i32 %17, %21
%23 = add nuw i32 %16, 1
%24 = srem i32 %8, %23
%25 = icmp eq i32 %24, 0
%26 = zext i1 %25 to i32
%27 = add nsw i32 %22, %26
%28 = add nuw i32 %16, 2
%29 = add i32 %18, 2
%30 = icmp eq i32 %29, %14
br i1 %30, label %31, label %15
31: ; preds = %15, %10
%32 = phi i32 [ 1, %10 ], [ %28, %15 ]
%33 = phi i32 [ undef, %10 ], [ %27, %15 ]
%34 = icmp eq i32 %11, 0
br i1 %34, label %40, label %35
35: ; preds = %31
%36 = srem i32 %8, %32
%37 = icmp eq i32 %36, 0
%38 = zext i1 %37 to i32
%39 = add nsw i32 %33, %38
br label %40
40: ; preds = %31, %35
%41 = phi i32 [ %33, %31 ], [ %39, %35 ]
%42 = icmp sgt i32 %41, 2
br i1 %42, label %43, label %46
43: ; preds = %40
%44 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.7, i64 0, i64 0))
%45 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.8, i64 0, i64 0))
unreachable
46: ; preds = %2, %40
%47 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
ret i32 0
}