#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(void) {
  int number, count = 0;
  int arr[100];
  printf("Enter a number: ");
  scanf("%d", &number);
  for (int i = 2; i <= number / 2; i++) {
    if (number % i == 0) {
      for (int j = 2; j <= i / 2; j++) {
        if (i % j != 0) {
          arr[count++] = i;
          break;
        }
      }
    }
  }
  printf("The factor of a number %d is: ", number);
  for (size_t i = 0; i < count; i++) {
    printf("%d ", arr[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x2,-0x1a4(%rbp)
mov    -0x1a4(%rbp),%eax
mov    %eax,-0x1b4(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x1b4(%rbp),%eax
cmp    %ecx,%eax
jg     123b <main+0x11b>
mov    -0x8(%rbp),%eax
cltd
idivl  -0x1a4(%rbp)
cmp    $0x0,%edx
jne    1222 <main+0x102>
movl   $0x2,-0x1a8(%rbp)
mov    -0x1a8(%rbp),%eax
mov    %eax,-0x1b8(%rbp)
mov    -0x1a4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x1b8(%rbp),%eax
cmp    %ecx,%eax
jg     121d <main+0xfd>
mov    -0x1a4(%rbp),%eax
cltd
idivl  -0x1a8(%rbp)
cmp    $0x0,%edx
je     1204 <main+0xe4>
mov    -0x1a4(%rbp),%ecx
mov    -0xc(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
cltq
mov    %ecx,-0x1a0(%rbp,%rax,4)
jmp    121d <main+0xfd>
jmp    1209 <main+0xe9>
mov    -0x1a8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a8(%rbp)
jmp    11a5 <main+0x85>
jmp    1222 <main+0x102>
jmp    1227 <main+0x107>
mov    -0x1a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a4(%rbp)
jmp    1161 <main+0x41>
mov    -0x8(%rbp),%esi
lea    0xdcf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movq   $0x0,-0x1b0(%rbp)
mov    -0x1b0(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmp    %rcx,%rax
jae    129e <main+0x17e>
mov    -0x1b0(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%esi
lea    0xdb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1b0(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x1b0(%rbp)
jmp    1257 <main+0x137>
xor    %eax,%eax
add    $0x1c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x1a0,%rsp
lea    0xece(%rip),%rdi
xor    %r14d,%r14d
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
cmp    $0x3,%esi
jg     1169 <main+0x49>
lea    0xeb7(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1217 <main+0xf7>
mov    %esi,%edi
shr    %edi
mov    $0x2,%r8d
mov    $0x2,%ebx
jmp    1194 <main+0x74>
nopw   0x0(%rax,%rax,1)
movslq %r14d,%rax
add    $0x1,%r14d
mov    %ebx,0x10(%rsp,%rax,4)
lea    0x1(%rbx),%eax
cmp    %edi,%ebx
mov    %eax,%ebx
je     11de <main+0xbe>
mov    %ebx,%ecx
shr    %ecx
cmp    $0x3,%ecx
cmovb  %r8d,%ecx
mov    %esi,%eax
cltd
idiv   %ebx
test   %edx,%edx
jne    118b <main+0x6b>
cmp    $0x4,%ebx
jb     118b <main+0x6b>
neg    %ecx
mov    $0x2,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ebx,%eax
xor    %edx,%edx
div    %ebp
test   %edx,%edx
jne    1180 <main+0x60>
lea    (%rcx,%rbp,1),%eax
add    $0x1,%eax
mov    %ebp,%edx
add    $0x1,%edx
mov    %edx,%ebp
cmp    $0x1,%eax
jne    11c0 <main+0xa0>
jmp    118b <main+0x6b>
lea    0xe2f(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
test   %r14d,%r14d
je     1217 <main+0xf7>
movslq %r14d,%rbp
lea    0xe38(%rip),%r14
xor    %ebx,%ebx
nopl   (%rax)
mov    0x10(%rsp,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1200 <main+0xe0>
xor    %eax,%eax
add    $0x1a0,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Enter a number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [31 x i8] c"The factor of a number %d is: \00"
@.str.3 = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [100 x i32]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i64
store i32 0, i32* %1
store i32 0, i32* %3
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
store i32 2, i32* %5
br label %10
10: ; preds = %43, %0
%11 = load i32, i32* %5
%12 = load i32, i32* %2
%13 = sdiv i32 %12, 2
%14 = icmp sle i32 %11, %13
br i1 %14, label %15, label %46
15: ; preds = %10
%16 = load i32, i32* %2
%17 = load i32, i32* %5
%18 = srem i32 %16, %17
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %42
20: ; preds = %15
store i32 2, i32* %6
br label %21
21: ; preds = %38, %20
%22 = load i32, i32* %6
%23 = load i32, i32* %5
%24 = sdiv i32 %23, 2
%25 = icmp sle i32 %22, %24
br i1 %25, label %26, label %41
26: ; preds = %21
%27 = load i32, i32* %5
%28 = load i32, i32* %6
%29 = srem i32 %27, %28
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %37
31: ; preds = %26
%32 = load i32, i32* %5
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
store i32 %34, i32* %3
%35 = sext i32 %33 to i64
%36 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 %35
store i32 %32, i32* %36
br label %41
37: ; preds = %26
br label %38
38: ; preds = %37
%39 = load i32, i32* %6
%40 = add nsw i32 %39, 1
store i32 %40, i32* %6
br label %21
41: ; preds = %31, %21
br label %42
42: ; preds = %41, %15
br label %43
43: ; preds = %42
%44 = load i32, i32* %5
%45 = add nsw i32 %44, 1
store i32 %45, i32* %5
br label %10
46: ; preds = %10
%47 = load i32, i32* %2
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %47)
store i64 0, i64* %7
br label %49
49: ; preds = %59, %46
%50 = load i64, i64* %7
%51 = load i32, i32* %3
%52 = sext i32 %51 to i64
%53 = icmp ult i64 %50, %52
br i1 %53, label %54, label %62
54: ; preds = %49
%55 = load i64, i64* %7
%56 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 %55
%57 = load i32, i32* %56
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %57)
br label %59
59: ; preds = %54
%60 = load i64, i64* %7
%61 = add i64 %60, 1
store i64 %61, i64* %7
br label %49
62: ; preds = %49
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"Enter a number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [31 x i8] c"The factor of a number %d is: \00"
@.str.3 = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i32]
%3 = bitcast i32* %1 to i8*
%4 = bitcast [100 x i32]* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = icmp slt i32 %7, 4
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %7)
br label %42
11: ; preds = %0
%12 = lshr i32 %7, 1
br label %18
13: ; preds = %38
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%15 = icmp eq i32 %39, 0
br i1 %15, label %42, label %16
16: ; preds = %13
%17 = sext i32 %39 to i64
br label %43
18: ; preds = %11, %38
%19 = phi i32 [ %40, %38 ], [ 2, %11 ]
%20 = phi i32 [ %39, %38 ], [ 0, %11 ]
%21 = lshr i32 %19, 1
%22 = call i32 @llvm.umax.i32(i32 %21, i32 2)
%23 = srem i32 %7, %19
%24 = icmp ne i32 %23, 0
%25 = icmp ult i32 %19, 4
%26 = or i1 %24, %25
br i1 %26, label %38, label %30
27: ; preds = %30
%28 = add nuw nsw i32 %31, 1
%29 = icmp eq i32 %31, %22
br i1 %29, label %38, label %30
30: ; preds = %18, %27
%31 = phi i32 [ %28, %27 ], [ 2, %18 ]
%32 = urem i32 %19, %31
%33 = icmp eq i32 %32, 0
br i1 %33, label %27, label %34
34: ; preds = %30
%35 = add nsw i32 %20, 1
%36 = sext i32 %20 to i64
%37 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %36
store i32 %19, i32* %37
br label %38
38: ; preds = %27, %34, %18
%39 = phi i32 [ %20, %18 ], [ %35, %34 ], [ %20, %27 ]
%40 = add nuw nsw i32 %19, 1
%41 = icmp eq i32 %19, %12
br i1 %41, label %13, label %18
42: ; preds = %43, %9, %13
ret i32 0
43: ; preds = %16, %43
%44 = phi i64 [ %48, %43 ], [ 0, %16 ]
%45 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %44
%46 = load i32, i32* %45
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %46)
%48 = add nuw i64 %44, 1
%49 = icmp eq i64 %48, %17
br i1 %49, label %42, label %43
}