#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 *, long long);
void findFactor(long long int num) {
  long long int counter = 2;
  for (; counter <= num; ++counter) {
    if (num % counter == 0) {
      printf("%lli ", counter);
      findFactor(num / counter);
      break;
    }
  }
}


x86 assembly (clang, -O0):
<findFactor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x2,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x8(%rbp),%rax
jg     1193 <findFactor+0x73>
mov    -0x8(%rbp),%rax
cqto
idivq  -0x10(%rbp)
cmp    $0x0,%rdx
jne    117d <findFactor+0x5d>
mov    -0x10(%rbp),%rsi
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
cqto
idivq  -0x10(%rbp)
mov    %rax,%rdi
call   1040 <findFactor@plt>
jmp    1193 <findFactor+0x73>
jmp    1182 <findFactor+0x62>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1134 <findFactor+0x14>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findFactor>:
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%rdi
jge    1122 <findFactor+0x12>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xed7(%rip),%r14
mov    $0x1,%ecx
sub    %rdi,%rcx
mov    $0x2,%esi
cs nopw 0x0(%rax,%rax,1)
mov    %rdi,%rax
or     %rsi,%rax
shr    $0x20,%rax
je     1160 <findFactor+0x50>
mov    %rdi,%rax
cqto
idiv   %rsi
mov    %rax,%rbx
test   %rdx,%rdx
jne    116d <findFactor+0x5d>
jmp    1190 <findFactor+0x80>
xchg   %ax,%ax
mov    %edi,%eax
xor    %edx,%edx
div    %esi
mov    %eax,%ebx
test   %rdx,%rdx
je     1190 <findFactor+0x80>
lea    (%rcx,%rsi,1),%rax
add    $0x1,%rax
add    $0x1,%rsi
cmp    $0x2,%rax
jne    1140 <findFactor+0x30>
jmp    111a <findFactor+0xa>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
cmp    $0x2,%rbx
jge    1129 <findFactor+0x19>
jmp    111a <findFactor+0xa>

LLVM IR (-O0):
@.str = [6 x i8] c"%lli \00"
define void @findFactor(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
store i64 2, i64* %3
br label %4
4: ; preds = %20, %1
%5 = load i64, i64* %3
%6 = load i64, i64* %2
%7 = icmp sle i64 %5, %6
br i1 %7, label %8, label %23
8: ; preds = %4
%9 = load i64, i64* %2
%10 = load i64, i64* %3
%11 = srem i64 %9, %10
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %19
13: ; preds = %8
%14 = load i64, i64* %3
%15 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 %14)
%16 = load i64, i64* %2
%17 = load i64, i64* %3
%18 = sdiv i64 %16, %17
br label %23
19: ; preds = %8
br label %20
20: ; preds = %19
%21 = load i64, i64* %3
%22 = add nsw i64 %21, 1
store i64 %22, i64* %3
br label %4
23: ; preds = %13, %4
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%lli \00"
define void @findFactor(i64 %0) {
%2 = icmp slt i64 %0, 2
br i1 %2, label %16, label %3
3: ; preds = %1, %10
%4 = phi i64 [ %8, %10 ], [ %0, %1 ]
br label %5
5: ; preds = %3, %13
%6 = phi i64 [ 2, %3 ], [ %14, %13 ]
%7 = srem i64 %4, %6
%8 = sdiv i64 %4, %6
%9 = icmp eq i64 %7, 0
br i1 %9, label %10, label %13
10: ; preds = %5
%11 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 %6)
%12 = icmp slt i64 %8, 2
br i1 %12, label %16, label %3
13: ; preds = %5
%14 = add nuw i64 %6, 1
%15 = icmp eq i64 %6, %4
br i1 %15, label %16, label %5
16: ; preds = %10, %13, %1
ret void
}