// File: /workspace/github_c_makefile_star2_O2/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 %r15
pushq %r14
pushq %rbx
subq $0xc8, %rsp
leaq 0x2d56(%rip), %rsi      # 0x4004
leaq 0x68(%rsp), %rdi
pushq $0xa
popq %rbx
movl %ebx, %edx
callq 0x1552
leaq 0x2d73(%rip), %rsi      # 0x4037
leaq 0x50(%rsp), %rdi
movl %ebx, %edx
callq 0x1552
leaq 0x20(%rsp), %rdi
leaq 0x68(%rsp), %rsi
leaq 0x50(%rsp), %rdx
callq 0x1576
leaq 0x38(%rsp), %rdi
leaq 0x50(%rsp), %rsi
leaq 0x20(%rsp), %rdx
callq 0x15d4
leaq 0x8(%rsp), %rdi
movl $0x75bcd15, %esi        # imm = 0x75BCD15
callq 0x1640
leaq 0x20(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x1632
testb %al, %al
je 0x1491
leaq 0x8(%rsp), %rdi
callq 0x1660
leaq 0x68(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x1632
testb %al, %al
je 0x14aa
movq 0x5c92(%rip), %rsi      # 0x6fd8
leaq 0x20(%rsp), %rdi
pushq $0xa
popq %rdx
callq 0x1670
movq %rax, %rdi
callq 0x1060
movq 0x5c76(%rip), %rsi      # 0x6fd8
leaq 0x38(%rsp), %rdi
pushq $0xa
popq %rdx
callq 0x1670
movq %rax, %rdi
callq 0x1060
leaq 0x98(%rsp), %rdi
pushq $0xa
popq %rsi
callq 0x1640
leaq 0xb0(%rsp), %rdi
leaq 0x98(%rsp), %rsi
pushq $0x2a
popq %rdx
callq 0x1736
leaq 0x80(%rsp), %rdi
pushq $0x1
popq %rsi
callq 0x1640
leaq 0x8(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
leaq 0x80(%rsp), %rdx
callq 0x16d7
leaq 0x80(%rsp), %rdi
callq 0x1660
leaq 0xb0(%rsp), %rdi
callq 0x1660
leaq 0x98(%rsp), %rdi
callq 0x1660
pushq $0x64
popq %r15
leaq -0x18d(%rip), %rbx      # 0x126e
leaq 0x8(%rsp), %r14
pushq $0xa
popq %rbp
subl $0x1, %r15d
jb 0x144f
movq %r14, %rdi
movl %ebp, %esi
movq %rbx, %rdx
callq 0x1770
testb %al, %al
jne 0x1424
movq %r14, %rdi
callq 0x177e
jmp 0x1403
movq 0x5bad(%rip), %rdi      # 0x6fd8
leaq 0x2c61(%rip), %rsi      # 0x4093
callq 0x10c0
leaq 0x8(%rsp), %rdi
pushq $0xa
popq %rdx
movq %rax, %rsi
callq 0x1670
movq %rax, %rdi
callq 0x1060
leaq 0x8(%rsp), %rdi
callq 0x1660
leaq 0x38(%rsp), %rdi
callq 0x1660
leaq 0x20(%rsp), %rdi
callq 0x1660
leaq 0x50(%rsp), %rdi
callq 0x1660
leaq 0x68(%rsp), %rdi
callq 0x1660
xorl %eax, %eax
addq $0xc8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2bc9(%rip), %rdi      # 0x4061
leaq 0x2bd1(%rip), %rsi      # 0x4070
leaq 0x2bdb(%rip), %rcx      # 0x4081
pushq $0x1e
jmp 0x14c1
leaq 0x2bdb(%rip), %rdi      # 0x408c
leaq 0x2bb8(%rip), %rsi      # 0x4070
leaq 0x2bc2(%rip), %rcx      # 0x4081
pushq $0x1f
popq %rdx
callq 0x1080
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x1660
jmp 0x14dc
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
callq 0x1660
jmp 0x14ee
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
jmp 0x151c
jmp 0x150f
jmp 0x1514
jmp 0x150f
movq %rax, %rbx
jmp 0x152b
movq %rax, %rbx
jmp 0x1535
movq %rax, %rbx
jmp 0x153f
jmp 0x1514
movq %rax, %rbx
jmp 0x1521
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x1660
leaq 0x38(%rsp), %rdi
callq 0x1660
leaq 0x20(%rsp), %rdi
callq 0x1660
leaq 0x50(%rsp), %rdi
callq 0x1660
leaq 0x68(%rsp), %rdi
callq 0x1660
movq %rbx, %rdi
callq 0x1110
nop