// File: /workspace/github_c_makefile_star2_O3/983[P]bigint/cpp_examples.cpp
// Function: main
int main(){
    // BigInts can be created from strings or from integers
    BigInt a = "-1137531041259095389425522063651335971086542522289";
    BigInt b = "-9214001518046086468566115579527473139501";

    // Available operators:
    // +, -, *, /, %, <<, >>
    // +=, -=, *=, /=, %=, <<=, >>=, ++, --
    // ==, !=, <=, >=, <, >
    BigInt c = a / b;
    BigInt d = b * c;
    assert(c == 123456789);
    assert(a == d);

    // write to any output stream
    c.write(std::cout) << std::endl;
    d.write(std::cout) << std::endl;

    // find the biggest probable prime less than 10^42
    BigInt p = BigInt(10).pow(42) - 1;

    for (int i = 0; i < 100; i++){
        if (p.is_probable_prime(10, not_secure_random)){
            p.write(std::cout << "Big prime: ") << std::endl;
            break;
        }
        --p;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0xe0, %rsp
leaq 0xb0(%rsp), %rbx
movq %rbx, %rdi
callq 0x19c4
leaq 0x3cfa(%rip), %rsi      # 0x5004
movq %rbx, %rdi
movl $0xa, %edx
callq 0x2759
leaq 0x68(%rsp), %rdi
callq 0x19c4
leaq 0x3d0f(%rip), %rsi      # 0x5037
leaq 0x68(%rsp), %rdi
movl $0xa, %edx
callq 0x2759
leaq 0x8(%rsp), %rdi
callq 0x19c4
leaq 0x8(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x1bc2
leaq 0x8(%rsp), %rdi
leaq 0x68(%rsp), %rdx
movq %rdi, %rsi
callq 0x3271
leaq 0x20(%rsp), %rdi
callq 0x19c4
leaq 0x20(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x1bc2
leaq 0x8(%rsp), %rdi
callq 0x1a49
leaq 0x8(%rsp), %rdi
callq 0x19c4
leaq 0x8(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x1bc2
leaq 0x8(%rsp), %rdi
leaq 0x20(%rsp), %rdx
movq %rdi, %rsi
callq 0x25c7
leaq 0x50(%rsp), %rdi
callq 0x19c4
leaq 0x50(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x1bc2
leaq 0x8(%rsp), %rdi
callq 0x1a49
leaq 0x8(%rsp), %rdi
callq 0x19c4
leaq 0x8(%rsp), %rdi
movl $0x75bcd15, %esi        # imm = 0x75BCD15
callq 0x2830
leaq 0x20(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x1b23
testl %eax, %eax
jne 0x1653
leaq 0x8(%rsp), %rdi
callq 0x1a49
leaq 0xb0(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x1b23
testl %eax, %eax
jne 0x1672
movq 0x6ba7(%rip), %rsi      # 0x7fd8
leaq 0x20(%rsp), %rdi
movl $0xa, %edx
callq 0x17c6
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10e0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x10a0
movq 0x6b67(%rip), %rsi      # 0x7fd8
leaq 0x50(%rsp), %rdi
movl $0xa, %edx
callq 0x17c6
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10e0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x10a0
leaq 0x98(%rsp), %rdi
callq 0x19c4
leaq 0x98(%rsp), %rdi
movl $0xa, %esi
callq 0x2830
leaq 0xc8(%rsp), %rdi
leaq 0x98(%rsp), %rsi
movl $0x2a, %edx
callq 0x185a
leaq 0x80(%rsp), %rdi
callq 0x19c4
leaq 0x80(%rsp), %rdi
movl $0x1, %esi
callq 0x2830
leaq 0x8(%rsp), %rdi
callq 0x19c4
leaq 0x8(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x1bc2
leaq 0x8(%rsp), %rdi
leaq 0x80(%rsp), %rdx
movq %rdi, %rsi
callq 0x2a12
leaq 0x38(%rsp), %rdi
callq 0x19c4
leaq 0x38(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x1bc2
leaq 0x8(%rsp), %rdi
callq 0x1a49
leaq 0x80(%rsp), %rdi
callq 0x1a49
leaq 0xc8(%rsp), %rdi
callq 0x1a49
leaq 0x98(%rsp), %rdi
callq 0x1a49
movl $0x64, %ebp
leaq -0x2db(%rip), %rbx      # 0x12ae
leaq 0x38(%rsp), %r14
movq %r14, %rdi
movl $0xa, %esi
movq %rbx, %rdx
callq 0x3b34
testl %eax, %eax
jne 0x15b8
movq %r14, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x2a90
decl %ebp
jne 0x158e
jmp 0x1610
movq 0x6a19(%rip), %rdi      # 0x7fd8
leaq 0x3acd(%rip), %rsi      # 0x5093
movl $0xb, %edx
callq 0x10f0
movq 0x6a01(%rip), %rsi      # 0x7fd8
leaq 0x38(%rsp), %rdi
movl $0xa, %edx
callq 0x17c6
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10e0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x10a0
leaq 0x38(%rsp), %rdi
callq 0x1a49
leaq 0x50(%rsp), %rdi
callq 0x1a49
leaq 0x20(%rsp), %rdi
callq 0x1a49
leaq 0x68(%rsp), %rdi
callq 0x1a49
leaq 0xb0(%rsp), %rdi
callq 0x1a49
xorl %eax, %eax
addq $0xe0, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x3a07(%rip), %rdi      # 0x5061
leaq 0x3a0f(%rip), %rsi      # 0x5070
leaq 0x3a19(%rip), %rcx      # 0x5081
movl $0x1e, %edx
callq 0x1090
leaq 0x3a13(%rip), %rdi      # 0x508c
leaq 0x39f0(%rip), %rsi      # 0x5070
leaq 0x39fa(%rip), %rcx      # 0x5081
movl $0x1f, %edx
callq 0x1090
jmp 0x17be
jmp 0x17be
jmp 0x17be
jmp 0x17be
jmp 0x17be
jmp 0x17be
jmp 0x17be
jmp 0x17be
jmp 0x17be
movq %rax, %rbx
jmp 0x1738
jmp 0x17be
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x1a49
jmp 0x1783
jmp 0x17be
jmp 0x17be
jmp 0x17be
movq %rax, %rbx
jmp 0x171e
movq %rax, %rbx
jmp 0x172b
jmp 0x1771
jmp 0x1771
movq %rax, %rbx
jmp 0x178d
movq %rax, %rbx
jmp 0x1797
movq %rax, %rbx
jmp 0x17a1
jmp 0x1776
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x1a49
leaq 0x80(%rsp), %rdi
callq 0x1a49
leaq 0xc8(%rsp), %rdi
callq 0x1a49
leaq 0x98(%rsp), %rdi
callq 0x1a49
jmp 0x1783
jmp 0x17be
jmp 0x17be
jmp 0x17be
jmp 0x17be
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x1a49
jmp 0x178d
jmp 0x17be
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x1a49
jmp 0x1797
jmp 0x17be
movq %rax, %rbx
jmp 0x1783
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x1a49
leaq 0x50(%rsp), %rdi
callq 0x1a49
leaq 0x20(%rsp), %rdi
callq 0x1a49
leaq 0x68(%rsp), %rdi
callq 0x1a49
leaq 0xb0(%rsp), %rdi
callq 0x1a49
movq %rbx, %rdi
callq 0x1150
jmp 0x17be
jmp 0x17be
jmp 0x17be
jmp 0x17be
movq %rax, %rdi
callq 0x189b