#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*/ exit(int /*<<< orphan*/);
long long factor(long long);
int /*<<< orphan*/ printf(char *, ...);
long long strtoll(char const *, int /*<<< orphan*/ *, int);
int main(const int argc, const char **argv) {
  long long f, i = strtoll(argv[1], NULL, 10);
  bool first = true;
  if (i == 0) {
    printf("0\n");
    exit(0);
  }
  if (i < 0) {
    printf("-1");
    first = false;
    i = -i;
  }
  do {
    f = factor(i);
    if (first) {
      printf("%lld", f);
      first = false;
    } else {
      printf(" %lld", f);
    }
    i = i / f;
  } while (i != 1);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1040 <strtoll@plt>
mov    %rax,-0x20(%rbp)
movl   $0x1,-0x24(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1197 <main+0x57>
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>
cmpq   $0x0,-0x20(%rbp)
jge    11c1 <main+0x81>
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x24(%rbp)
xor    %eax,%eax
sub    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    11c6 <main+0x86>
mov    -0x20(%rbp),%rdi
call   1050 <factor@plt>
mov    %rax,-0x18(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     11fb <main+0xbb>
mov    -0x18(%rbp),%rsi
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x24(%rbp)
jmp    120d <main+0xcd>
mov    -0x18(%rbp),%rsi
lea    0xe00(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
cqto
idivq  -0x18(%rbp)
mov    %rax,-0x20(%rbp)
cmpq   $0x1,-0x20(%rbp)
jne    11c6 <main+0x86>
lea    0xdd4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    0x8(%rsi),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1060 <strtoll@plt>
test   %rax,%rax
je     1257 <main+0xf7>
mov    %rax,%rbx
js     1197 <main+0x37>
mov    %rbx,%rdi
call   1070 <factor@plt>
mov    %rax,%r14
lea    0xe6f(%rip),%rdi
jmp    11ba <main+0x5a>
lea    0xe62(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
neg    %rbx
mov    %rbx,%rdi
call   1070 <factor@plt>
mov    %rax,%r14
lea    0xe49(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rax
or     %r14,%rax
shr    $0x20,%rax
je     11e3 <main+0x83>
mov    %rbx,%rax
cqto
idiv   %r14
mov    %rax,%r15
cmp    $0x1,%r15
jne    11f3 <main+0x93>
jmp    1245 <main+0xe5>
mov    %ebx,%eax
xor    %edx,%edx
div    %r14d
mov    %eax,%r15d
cmp    $0x1,%r15
je     1245 <main+0xe5>
lea    0xe09(%rip),%r14
jmp    1211 <main+0xb1>
nopl   0x0(%rax)
mov    %r15,%rax
cqto
idiv   %rbx
mov    %rax,%r15
cmp    $0x1,%r15
je     1245 <main+0xe5>
mov    %r15,%rdi
call   1070 <factor@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rax
or     %r15,%rax
shr    $0x20,%rax
jne    1200 <main+0xa0>
mov    %r15d,%eax
xor    %edx,%edx
div    %ebx
mov    %eax,%r15d
cmp    $0x1,%r15
jne    1211 <main+0xb1>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xdab(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"0\0A\00"
@.str.1 = [3 x i8] c"-1\00"
@.str.2 = [5 x i8] c"%lld\00"
@.str.3 = [6 x i8] c" %lld\00"
@.str.4 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i64 @strtoll(i8* %11, i32* null, i32 10)
store i64 %12, i64* %7
store i32 1, i32* %8
%13 = load i64, i64* %7
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %2
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%17 = call i32 @exit(i32 0)
unreachable
18: ; preds = %2
%19 = load i64, i64* %7
%20 = icmp slt i64 %19, 0
br i1 %20, label %21, label %25
21: ; preds = %18
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %8
%23 = load i64, i64* %7
%24 = sub nsw i64 0, %23
store i64 %24, i64* %7
br label %25
25: ; preds = %21, %18
br label %26
26: ; preds = %41, %25
%27 = load i64, i64* %7
%28 = call i64 @factor(i64 %27)
store i64 %28, i64* %6
%29 = load i32, i32* %8
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %26
%32 = load i64, i64* %6
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i64 %32)
store i32 0, i32* %8
br label %37
34: ; preds = %26
%35 = load i64, i64* %6
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i64 %35)
br label %37
37: ; preds = %34, %31
%38 = load i64, i64* %7
%39 = load i64, i64* %6
%40 = sdiv i64 %38, %39
store i64 %40, i64* %7
br label %41
41: ; preds = %37
%42 = load i64, i64* %7
%43 = icmp ne i64 %42, 1
br i1 %43, label %26, label %44
44: ; preds = %41
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"-1\00"
@.str.2 = [5 x i8] c"%lld\00"
@.str.3 = [6 x i8] c" %lld\00"
@str = [2 x i8] c"0\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i64 @strtoll(i8* nocapture %4, i32* null, i32 10)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%9 = tail call i32 @exit(i32 0)
unreachable
10: ; preds = %2
%11 = icmp slt i64 %5, 0
br i1 %11, label %15, label %12
12: ; preds = %10
%13 = tail call i64 @factor(i64 %5)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i64 %13)
br label %20
15: ; preds = %10
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%17 = sub nsw i64 0, %5
%18 = tail call i64 @factor(i64 %17)
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i64 %18)
br label %20
20: ; preds = %15, %12
%21 = phi i64 [ %18, %15 ], [ %13, %12 ]
%22 = phi i64 [ %17, %15 ], [ %5, %12 ]
%23 = sdiv i64 %22, %21
%24 = icmp eq i64 %23, 1
br i1 %24, label %31, label %25
25: ; preds = %20, %25
%26 = phi i64 [ %29, %25 ], [ %23, %20 ]
%27 = tail call i64 @factor(i64 %26)
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i64 %27)
%29 = sdiv i64 %26, %27
%30 = icmp eq i64 %29, 1
br i1 %30, label %31, label %25
31: ; preds = %25, %20
%32 = tail call i32 @putchar(i32 10)
ret i32 0
}