#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) {
      arr[count++] = i;
    }
  }
  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     11ce <main+0xae>
mov    -0x8(%rbp),%eax
cltd
idivl  -0x1a4(%rbp)
cmp    $0x0,%edx
jne    11b5 <main+0x95>
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    11ba <main+0x9a>
mov    -0x1a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a4(%rbp)
jmp    1161 <main+0x41>
mov    -0x8(%rbp),%esi
lea    0xe3c(%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    1231 <main+0x111>
mov    -0x1b0(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%esi
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1b0(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x1b0(%rbp)
jmp    11ea <main+0xca>
xor    %eax,%eax
add    $0x1c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x1a0,%rsp
lea    0xecd(%rip),%rdi
xor    %ebx,%ebx
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     1166 <main+0x46>
lea    0xeb7(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11c7 <main+0xa7>
mov    %esi,%eax
shr    %eax
lea    -0x1(%rax),%r8d
cmp    $0x2,%eax
jne    11d6 <main+0xb6>
mov    $0x2,%edi
test   $0x1,%r8b
je     1191 <main+0x71>
mov    %esi,%eax
cltd
idiv   %edi
test   %edx,%edx
jne    1191 <main+0x71>
movslq %ebx,%rax
add    $0x1,%ebx
mov    %edi,0x10(%rsp,%rax,4)
lea    0xe7c(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
test   %ebx,%ebx
je     11c7 <main+0xa7>
movslq %ebx,%r15
lea    0xe86(%rip),%r14
xor    %ebx,%ebx
nop
mov    0x10(%rsp,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    11b0 <main+0x90>
xor    %eax,%eax
add    $0x1a0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
mov    %r8d,%r9d
and    $0xfffffffe,%r9d
neg    %r9d
xor    %ebx,%ebx
mov    $0x2,%ecx
jmp    1207 <main+0xe7>
nopl   0x0(%rax)
mov    %ecx,%edi
add    $0x2,%edi
lea    (%r9,%rcx,1),%eax
add    $0x2,%eax
mov    %edi,%ecx
cmp    $0x2,%eax
je     1178 <main+0x58>
mov    %esi,%eax
cltd
idiv   %ecx
test   %edx,%edx
jne    121a <main+0xfa>
movslq %ebx,%rax
add    $0x1,%ebx
mov    %ecx,0x10(%rsp,%rax,4)
lea    0x1(%rcx),%edi
mov    %esi,%eax
cltd
idiv   %edi
test   %edx,%edx
jne    11f0 <main+0xd0>
movslq %ebx,%rax
add    $0x1,%ebx
mov    %edi,0x10(%rsp,%rax,4)
jmp    11f0 <main+0xd0>

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 i64
store i32 0, i32* %1
store i32 0, i32* %3
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%8 = 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 %9
9: ; preds = %26, %0
%10 = load i32, i32* %5
%11 = load i32, i32* %2
%12 = sdiv i32 %11, 2
%13 = icmp sle i32 %10, %12
br i1 %13, label %14, label %29
14: ; preds = %9
%15 = load i32, i32* %2
%16 = load i32, i32* %5
%17 = srem i32 %15, %16
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %25
19: ; preds = %14
%20 = load i32, i32* %5
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
store i32 %22, i32* %3
%23 = sext i32 %21 to i64
%24 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 %23
store i32 %20, i32* %24
br label %25
25: ; preds = %19, %14
br label %26
26: ; preds = %25
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
store i32 %28, i32* %5
br label %9
29: ; preds = %9
%30 = load i32, i32* %2
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %30)
store i64 0, i64* %6
br label %32
32: ; preds = %42, %29
%33 = load i64, i64* %6
%34 = load i32, i32* %3
%35 = sext i32 %34 to i64
%36 = icmp ult i64 %33, %35
br i1 %36, label %37, label %45
37: ; preds = %32
%38 = load i64, i64* %6
%39 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 %38
%40 = load i32, i32* %39
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %40)
br label %42
42: ; preds = %37
%43 = load i64, i64* %6
%44 = add i64 %43, 1
store i64 %44, i64* %6
br label %32
45: ; preds = %32
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 %60
11: ; preds = %0
%12 = lshr i32 %7, 1
%13 = add nsw i32 %12, -1
%14 = and i32 %13, 1
%15 = icmp eq i32 %12, 2
br i1 %15, label %18, label %16
16: ; preds = %11
%17 = and i32 %13, -2
br label %36
18: ; preds = %55, %11
%19 = phi i32 [ undef, %11 ], [ %56, %55 ]
%20 = phi i32 [ 2, %11 ], [ %57, %55 ]
%21 = phi i32 [ 0, %11 ], [ %56, %55 ]
%22 = icmp eq i32 %14, 0
br i1 %22, label %30, label %23
23: ; preds = %18
%24 = srem i32 %7, %20
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %30
26: ; preds = %23
%27 = add nsw i32 %21, 1
%28 = sext i32 %21 to i64
%29 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %28
store i32 %20, i32* %29
br label %30
30: ; preds = %23, %26, %18
%31 = phi i32 [ %19, %18 ], [ %27, %26 ], [ %21, %23 ]
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%33 = icmp eq i32 %31, 0
br i1 %33, label %60, label %34
34: ; preds = %30
%35 = sext i32 %31 to i64
br label %61
36: ; preds = %55, %16
%37 = phi i32 [ 2, %16 ], [ %57, %55 ]
%38 = phi i32 [ 0, %16 ], [ %56, %55 ]
%39 = phi i32 [ 0, %16 ], [ %58, %55 ]
%40 = srem i32 %7, %37
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %46
42: ; preds = %36
%43 = add nsw i32 %38, 1
%44 = sext i32 %38 to i64
%45 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %44
store i32 %37, i32* %45
br label %46
46: ; preds = %36, %42
%47 = phi i32 [ %43, %42 ], [ %38, %36 ]
%48 = or i32 %37, 1
%49 = srem i32 %7, %48
%50 = icmp eq i32 %49, 0
br i1 %50, label %51, label %55
51: ; preds = %46
%52 = add nsw i32 %47, 1
%53 = sext i32 %47 to i64
%54 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %53
store i32 %48, i32* %54
br label %55
55: ; preds = %51, %46
%56 = phi i32 [ %52, %51 ], [ %47, %46 ]
%57 = add nuw nsw i32 %37, 2
%58 = add i32 %39, 2
%59 = icmp eq i32 %58, %17
br i1 %59, label %18, label %36
60: ; preds = %61, %9, %30
ret i32 0
61: ; preds = %34, %61
%62 = phi i64 [ %66, %61 ], [ 0, %34 ]
%63 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %62
%64 = load i32, i32* %63
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %64)
%66 = add nuw i64 %62, 1
%67 = icmp eq i64 %66, %35
br i1 %67, label %60, label %61
}