// File: /workspace/github_c_makefile_star2_O1/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 0x19d4
leaq 0x3cea(%rip), %rsi      # 0x5004
movq %rbx, %rdi
movl $0xa, %edx
callq 0x2738
leaq 0x68(%rsp), %rdi
callq 0x19d4
leaq 0x3cff(%rip), %rsi      # 0x5037
leaq 0x68(%rsp), %rdi
movl $0xa, %edx
callq 0x2738
leaq 0x8(%rsp), %rdi
callq 0x19d4
leaq 0x8(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x1bd2
leaq 0x8(%rsp), %rdi
leaq 0x68(%rsp), %rdx
movq %rdi, %rsi
callq 0x3266
leaq 0x20(%rsp), %rdi
callq 0x19d4
leaq 0x20(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x1bd2
leaq 0x8(%rsp), %rdi
callq 0x1a59
leaq 0x8(%rsp), %rdi
callq 0x19d4
leaq 0x8(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x1bd2
leaq 0x8(%rsp), %rdi
leaq 0x20(%rsp), %rdx
movq %rdi, %rsi
callq 0x25a6
leaq 0x50(%rsp), %rdi
callq 0x19d4
leaq 0x50(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x1bd2
leaq 0x8(%rsp), %rdi
callq 0x1a59
leaq 0x8(%rsp), %rdi
callq 0x19d4
leaq 0x8(%rsp), %rdi
movl $0x75bcd15, %esi        # imm = 0x75BCD15
callq 0x280f
leaq 0x20(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x1b33
testl %eax, %eax
jne 0x1663
leaq 0x8(%rsp), %rdi
callq 0x1a59
leaq 0xb0(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x1b33
testl %eax, %eax
jne 0x1682
movq 0x6b97(%rip), %rsi      # 0x7fd8
leaq 0x20(%rsp), %rdi
movl $0xa, %edx
callq 0x17d6
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10f0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x10a0
movq 0x6b57(%rip), %rsi      # 0x7fd8
leaq 0x50(%rsp), %rdi
movl $0xa, %edx
callq 0x17d6
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10f0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x10a0
leaq 0x98(%rsp), %rdi
callq 0x19d4
leaq 0x98(%rsp), %rdi
movl $0xa, %esi
callq 0x280f
leaq 0xc8(%rsp), %rdi
leaq 0x98(%rsp), %rsi
movl $0x2a, %edx
callq 0x186a
leaq 0x80(%rsp), %rdi
callq 0x19d4
leaq 0x80(%rsp), %rdi
movl $0x1, %esi
callq 0x280f
leaq 0x8(%rsp), %rdi
callq 0x19d4
leaq 0x8(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x1bd2
leaq 0x8(%rsp), %rdi
leaq 0x80(%rsp), %rdx
movq %rdi, %rsi
callq 0x29f1
leaq 0x38(%rsp), %rdi
callq 0x19d4
leaq 0x38(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x1bd2
leaq 0x8(%rsp), %rdi
callq 0x1a59
leaq 0x80(%rsp), %rdi
callq 0x1a59
leaq 0xc8(%rsp), %rdi
callq 0x1a59
leaq 0x98(%rsp), %rdi
callq 0x1a59
movl $0x64, %ebp
leaq -0x2db(%rip), %rbx      # 0x12be
leaq 0x38(%rsp), %r14
movq %r14, %rdi
movl $0xa, %esi
movq %rbx, %rdx
callq 0x3b58
testl %eax, %eax
jne 0x15c8
movq %r14, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x2a6f
decl %ebp
jne 0x159e
jmp 0x1620
movq 0x6a09(%rip), %rdi      # 0x7fd8
leaq 0x3abd(%rip), %rsi      # 0x5093
movl $0xb, %edx
callq 0x1100
movq 0x69f1(%rip), %rsi      # 0x7fd8
leaq 0x38(%rsp), %rdi
movl $0xa, %edx
callq 0x17d6
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10f0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x10a0
leaq 0x38(%rsp), %rdi
callq 0x1a59
leaq 0x50(%rsp), %rdi
callq 0x1a59
leaq 0x20(%rsp), %rdi
callq 0x1a59
leaq 0x68(%rsp), %rdi
callq 0x1a59
leaq 0xb0(%rsp), %rdi
callq 0x1a59
xorl %eax, %eax
addq $0xe0, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x39f7(%rip), %rdi      # 0x5061
leaq 0x39ff(%rip), %rsi      # 0x5070
leaq 0x3a09(%rip), %rcx      # 0x5081
movl $0x1e, %edx
callq 0x1090
leaq 0x3a03(%rip), %rdi      # 0x508c
leaq 0x39e0(%rip), %rsi      # 0x5070
leaq 0x39ea(%rip), %rcx      # 0x5081
movl $0x1f, %edx
callq 0x1090
jmp 0x17ce
jmp 0x17ce
jmp 0x17ce
jmp 0x17ce
jmp 0x17ce
jmp 0x17ce
jmp 0x17ce
jmp 0x17ce
jmp 0x17ce
movq %rax, %rbx
jmp 0x1748
jmp 0x17ce
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x1a59
jmp 0x1793
jmp 0x17ce
jmp 0x17ce
jmp 0x17ce
movq %rax, %rbx
jmp 0x172e
movq %rax, %rbx
jmp 0x173b
jmp 0x1781
jmp 0x1781
movq %rax, %rbx
jmp 0x179d
movq %rax, %rbx
jmp 0x17a7
movq %rax, %rbx
jmp 0x17b1
jmp 0x1786
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x1a59
leaq 0x80(%rsp), %rdi
callq 0x1a59
leaq 0xc8(%rsp), %rdi
callq 0x1a59
leaq 0x98(%rsp), %rdi
callq 0x1a59
jmp 0x1793
jmp 0x17ce
jmp 0x17ce
jmp 0x17ce
jmp 0x17ce
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x1a59
jmp 0x179d
jmp 0x17ce
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x1a59
jmp 0x17a7
jmp 0x17ce
movq %rax, %rbx
jmp 0x1793
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x1a59
leaq 0x50(%rsp), %rdi
callq 0x1a59
leaq 0x20(%rsp), %rdi
callq 0x1a59
leaq 0x68(%rsp), %rdi
callq 0x1a59
leaq 0xb0(%rsp), %rdi
callq 0x1a59
movq %rbx, %rdi
callq 0x1160
jmp 0x17ce
jmp 0x17ce
jmp 0x17ce
jmp 0x17ce
movq %rax, %rdi
callq 0x18ab