// File: /workspace/github_cpp_makefile_star2_O1/Mariotti94[P]BigFloat/Factorial.cpp
// Function: main
int main()
{
    //For reference, execution times on an old Core 2 Duo
    //200!  --> 375 digits  - no optimization: 5 seconds
    //300!  --> 615 digits  - no optimization: 20 seconds,   compiled with -O3: 1 seconds
    //500!  --> 1135 digits - no optimization: 115 seconds,  compiled with -O3: 4 seconds
    //1000! --> 2568 digits - no optimization: 1200 seconds, compiled with -O3: 47 seconds
    BigFloat fact, num(1000);
    fact = factorial(num);
    std::cout << fact << std::endl;
    std::cout << fact.Ints() << std::endl;
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
leaq 0x28(%rsp), %rdi
callq 0x27f8
leaq 0xa8(%rsp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x277c
leaq 0x128(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x23bc
leaq 0x130(%rsp), %r14
movb -0x8(%r14), %al
leaq 0x30(%rsp), %rdi
movb %al, -0x8(%rdi)
movups (%rdi), %xmm0
movaps %xmm0, 0x10(%rsp)
movq 0x10(%rdi), %rdx
movq 0x18(%rdi), %r13
movq 0x20(%rdi), %rbp
movq 0x28(%rdi), %r12
movq 0x40(%rdi), %rax
movq 0x48(%rdi), %r15
movups 0x30(%rdi), %xmm0
movl $0xa, %ecx
movq %r14, %rsi
rep  movsq (%rsi), %es:(%rdi)
movaps 0x10(%rsp), %xmm1
movups %xmm1, (%r14)
movq %rdx, 0x8(%rsp)
movq %rdx, 0x10(%r14)
movq %r13, 0x18(%r14)
movq %rbp, 0x20(%r14)
movq %r12, 0x28(%r14)
movups %xmm0, 0x30(%r14)
movq %rax, 0x40(%r14)
movq %r15, 0x48(%r14)
cmpq %r15, %r12
jae 0x25dc
movq %r12, %rbx
movq 0x8(%rbx), %rdi
addq $0x8, %rbx
callq 0x2120
cmpq %r15, %rbx
jb 0x25ca
leaq 0x188(%rsp), %r15
movq 0x8(%rsp), %rax
movq %rax, -0x28(%r15)
movq %r13, -0x20(%r15)
movq %rbp, -0x18(%r15)
movq %r12, -0x10(%r15)
movl -0x8(%r15), %eax
leaq 0x88(%rsp), %rdi
movl %eax, -0x8(%rdi)
movb -0x4(%r15), %al
movb %al, -0x4(%rdi)
movq %r15, %rsi
callq 0x2170
movq (%r15), %rdi
leaq 0x198(%rsp), %rax
cmpq %rax, %rdi
je 0x262c
callq 0x2120
movq %r14, %rdi
callq 0x28a2
movq 0xd99d(%rip), %rdi      # 0xffd8
leaq 0x28(%rsp), %rsi
callq 0x8a1b
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20b0
movq 0x78(%rsp), %rax
movl 0x58(%rsp), %ecx
movl %eax, %edx
subl %ecx, %edx
shrl $0x3, %edx
cmpq $0x1, %rax
adcl $-0x1, %edx
movl 0x60(%rsp), %esi
subl 0x68(%rsp), %esi
shll $0x9, %edx
addl 0x50(%rsp), %esi
addl %edx, %esi
subl 0x40(%rsp), %esi
subl 0x80(%rsp), %esi
movq 0xd92f(%rip), %rdi      # 0xffd8
callq 0x21f0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2130
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20b0
leaq 0x118(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x26ee
callq 0x2120
leaq 0xb0(%rsp), %rdi
callq 0x28a2
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2711
callq 0x2120
leaq 0x30(%rsp), %rdi
callq 0x28a2
xorl %eax, %eax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2736
movq %rax, %rbx
jmp 0x2746
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x2758
leaq 0x28(%rsp), %rdi
callq 0x2758
movq %rbx, %rdi
callq 0x2200