// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x128, %rsp            # imm = 0x128
movl $0x0, 0x124(%rsp)
leaq 0x4ccb(%rip), %rsi      # 0x6004
leaq 0x108(%rsp), %rdi
movl $0xa, %edx
movl %edx, 0x30(%rsp)
callq 0x1790
movl 0x30(%rsp), %edx
leaq 0x4cdd(%rip), %rsi      # 0x6037
leaq 0xf0(%rsp), %rdi
callq 0x1790
jmp 0x1369
leaq 0xc8(%rsp), %rdi
leaq 0x108(%rsp), %rsi
leaq 0xf0(%rsp), %rdx
callq 0x17d0
jmp 0x1388
leaq 0xb0(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
leaq 0xc8(%rsp), %rdx
callq 0x1870
jmp 0x13a7
leaq 0x98(%rsp), %rdi
movl $0x75bcd15, %esi        # imm = 0x75BCD15
callq 0x1940
jmp 0x13bb
leaq 0xc8(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0x1910
movb %al, 0x2f(%rsp)
jmp 0x13d6
movb 0x2f(%rsp), %al
testb $0x1, %al
jne 0x13e0
jmp 0x13e5
jmp 0x148e
leaq 0x4c75(%rip), %rdi      # 0x6061
leaq 0x4c7d(%rip), %rsi      # 0x6070
movl $0x1e, %edx
leaq 0x4c82(%rip), %rcx      # 0x6081
callq 0x1070
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe8(%rsp)
movl %eax, 0xe4(%rsp)
jmp 0x176c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe8(%rsp)
movl %eax, 0xe4(%rsp)
jmp 0x175f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe8(%rsp)
movl %eax, 0xe4(%rsp)
jmp 0x1752
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe8(%rsp)
movl %eax, 0xe4(%rsp)
jmp 0x1745
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe8(%rsp)
movl %eax, 0xe4(%rsp)
leaq 0x98(%rsp), %rdi
callq 0x1970
jmp 0x1745
leaq 0x98(%rsp), %rdi
callq 0x1970
leaq 0x108(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x1910
movb %al, 0x2e(%rsp)
jmp 0x14b6
movb 0x2e(%rsp), %al
testb $0x1, %al
jne 0x14c0
jmp 0x14c2
jmp 0x14e1
leaq 0x4bc3(%rip), %rdi      # 0x608c
leaq 0x4ba0(%rip), %rsi      # 0x6070
movl $0x1f, %edx
leaq 0x4ba5(%rip), %rcx      # 0x6081
callq 0x1070
movq 0x7af0(%rip), %rsi      # 0x8fd8
leaq 0xc8(%rsp), %rdi
movl $0xa, %edx
callq 0x1990
movq %rax, 0x20(%rsp)
jmp 0x1501
movq 0x20(%rsp), %rdi
movq 0x7abb(%rip), %rsi      # 0x8fc8
callq 0x10d0
jmp 0x1514
movq 0x7abd(%rip), %rsi      # 0x8fd8
leaq 0xb0(%rsp), %rdi
movl $0xa, %edx
callq 0x1990
movq %rax, 0x18(%rsp)
jmp 0x1534
movq 0x18(%rsp), %rdi
movq 0x7a88(%rip), %rsi      # 0x8fc8
callq 0x10d0
jmp 0x1547
leaq 0x50(%rsp), %rdi
movl $0xa, %esi
callq 0x1940
jmp 0x1558
leaq 0x68(%rsp), %rdi
leaq 0x50(%rsp), %rsi
movl $0x2a, %edx
callq 0x1ab0
jmp 0x156e
leaq 0x38(%rsp), %rdi
movl $0x1, %esi
callq 0x1940
jmp 0x157f
leaq 0x80(%rsp), %rdi
leaq 0x68(%rsp), %rsi
leaq 0x38(%rsp), %rdx
callq 0x1a10
jmp 0x1598
leaq 0x38(%rsp), %rdi
callq 0x1970
leaq 0x68(%rsp), %rdi
callq 0x1970
leaq 0x50(%rsp), %rdi
callq 0x1970
movl $0x0, 0x34(%rsp)
cmpl $0x64, 0x34(%rsp)
jge 0x16ea
leaq -0x300(%rip), %rdx      # 0x12d0
leaq 0x80(%rsp), %rdi
movl $0xa, %esi
callq 0x1b40
movb %al, 0x17(%rsp)
jmp 0x15e8
movb 0x17(%rsp), %al
testb $0x1, %al
jne 0x15f5
jmp 0x16c9
movq 0x79dc(%rip), %rdi      # 0x8fd8
leaq 0x4a90(%rip), %rsi      # 0x6093
callq 0x10c0
movq %rax, 0x8(%rsp)
jmp 0x160f
movq 0x8(%rsp), %rsi
leaq 0x80(%rsp), %rdi
movl $0xa, %edx
callq 0x1990
movq %rax, (%rsp)
jmp 0x162c
movq (%rsp), %rdi
movq 0x7991(%rip), %rsi      # 0x8fc8
callq 0x10d0
jmp 0x163e
jmp 0x16ea
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe8(%rsp)
movl %eax, 0xe4(%rsp)
jmp 0x1697
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe8(%rsp)
movl %eax, 0xe4(%rsp)
jmp 0x168d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe8(%rsp)
movl %eax, 0xe4(%rsp)
leaq 0x38(%rsp), %rdi
callq 0x1970
leaq 0x68(%rsp), %rdi
callq 0x1970
leaq 0x50(%rsp), %rdi
callq 0x1970
jmp 0x1745
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe8(%rsp)
movl %eax, 0xe4(%rsp)
leaq 0x80(%rsp), %rdi
callq 0x1970
jmp 0x1745
leaq 0x80(%rsp), %rdi
callq 0x1b70
jmp 0x16d8
jmp 0x16da
movl 0x34(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x34(%rsp)
jmp 0x15be
movl $0x0, 0x124(%rsp)
leaq 0x80(%rsp), %rdi
callq 0x1970
leaq 0xb0(%rsp), %rdi
callq 0x1970
leaq 0xc8(%rsp), %rdi
callq 0x1970
leaq 0xf0(%rsp), %rdi
callq 0x1970
leaq 0x108(%rsp), %rdi
callq 0x1970
movl 0x124(%rsp), %eax
addq $0x128, %rsp            # imm = 0x128
retq
leaq 0xb0(%rsp), %rdi
callq 0x1970
leaq 0xc8(%rsp), %rdi
callq 0x1970
leaq 0xf0(%rsp), %rdi
callq 0x1970
leaq 0x108(%rsp), %rdi
callq 0x1970
movq 0xe8(%rsp), %rdi
callq 0x1130
nopw %cs:(%rax,%rax)