// File: /workspace/github_c_makefile_star2_O3/pyk[P]simple-nn/deps/pcg/sample/pcg64-demo.c
// Function: main
int main(int argc, char** argv)
{
    // Read command-line options

    int rounds = 5;
    bool nondeterministic_seed = false;

    ++argv;
    --argc;
    if (argc > 0 && strcmp(argv[0], "-r") == 0) {
        nondeterministic_seed = true;
        ++argv;
        --argc;
    }
    if (argc > 0) {
        rounds = atoi(argv[0]);
    }

    // In this version of the code, we'll use a local rng, rather than the
    // global one.

    pcg64_random_t rng;

    // You should *always* seed the RNG.  The usual time to do it is the
    // point in time when you create RNG (typically at the beginning of the
    // program).
    //
    // pcg64_srandom_r takes two 128-bit constants (the initial state, and the
    // rng sequence selector; rngs with different sequence selectors will
    // *never* have random sequences that coincide, at all) - the code below
    // shows three possible ways to do so.

    if (nondeterministic_seed) {
        // Seed with external entropy

        pcg128_t seeds[2];
        entropy_getbytes((void*)seeds, sizeof(seeds));
        pcg64_srandom_r(&rng, seeds[0], seeds[1]);
    } else {
        // Seed with a fixed constant

        pcg64_srandom_r(&rng, 42u, 54u);
    }

    printf("pcg64_random_r:\n"
           "      -  result:      64-bit unsigned int (uint64_t)\n"
           "      -  period:      2^128   (* 2^127 streams)\n"
           "      -  state type:  pcg64_random_t (%zu bytes)\n"
           "      -  output func: XSL-RR\n"
           "\n",
           sizeof(pcg64_random_t));

    for (int round = 1; round <= rounds; ++round) {
        printf("Round %d:\n", round);

        /* Make some 64-bit numbers */
        printf("  64bit:");
        for (int i = 0; i < 6; ++i) {
            if (i > 0 && i % 3 == 0)
                printf("\n\t");
            printf(" 0x%016llx", pcg64_random_r(&rng));
        }
        printf("\n");

        printf("  Again:");
        pcg64_advance_r(&rng, -6);
        for (int i = 0; i < 6; ++i) {
            if (i > 0 && i % 3 == 0)
                printf("\n\t");
            printf(" 0x%016llx", pcg64_random_r(&rng));
        }
        printf("\n");

        /* Toss some coins */
        printf("  Coins: ");
        for (int i = 0; i < 65; ++i)
            printf("%c", pcg64_boundedrand_r(&rng, 2) ? 'H' : 'T');
        printf("\n");

        /* Roll some dice */
        printf("  Rolls:");
        for (int i = 0; i < 33; ++i)
            printf(" %d", (int)pcg64_boundedrand_r(&rng, 6) + 1);
        printf("\n");

        /* Deal some cards */
        enum { SUITS = 4, NUMBERS = 13, CARDS = 52 };
        char cards[CARDS];

        for (int i = 0; i < CARDS; ++i)
            cards[i] = i;

        for (int i = CARDS; i > 1; --i) {
            int chosen = pcg64_boundedrand_r(&rng, i);
            char card = cards[chosen];
            cards[chosen] = cards[i - 1];
            cards[i - 1] = card;
        }

        printf("  Cards:");
        static const char number[] = {'A', '2', '3', '4', '5', '6', '7',
                                      '8', '9', 'T', 'J', 'Q', 'K'};
        static const char suit[] = {'h', 'c', 'd', 's'};
        for (int i = 0; i < CARDS; ++i) {
            printf(" %c%c", number[cards[i] / SUITS], suit[cards[i] % SUITS]);
            if ((i + 1) % 22 == 0)
                printf("\n\t");
        }
        printf("\n");

        printf("\n");
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
cmpl $0x1, %edi
jle 0x1210
movq 0x8(%rsi), %rax
cmpb $0x2d, (%rax)
jne 0x11c8
cmpb $0x72, 0x1(%rax)
jne 0x11c8
cmpb $0x0, 0x2(%rax)
je 0x1694
movabsq $-0x21d431fa41fec41d, %r14 # imm = 0xDE2BCE05BE013BE3
movabsq $-0x2c093ba5be1abce0, %r15 # imm = 0xD3F6C45A41E54320
movq %rax, %rdi
callq 0x1090
movl %eax, %ebx
movl $0x6d, %ebp
movq $0x0, 0x8(%rsp)
leaq 0xe55(%rip), %rdi       # 0x2050
movl $0x20, %esi
xorl %eax, %eax
callq 0x1040
testl %ebx, %ebx
jg 0x124a
jmp 0x1683
movabsq $-0x21d431fa41fec41d, %r14 # imm = 0xDE2BCE05BE013BE3
movabsq $-0x2c093ba5be1abce0, %r15 # imm = 0xD3F6C45A41E54320
leaq 0xe25(%rip), %rdi       # 0x2050
movq $0x0, 0x8(%rsp)
movl $0x20, %esi
xorl %eax, %eax
callq 0x1040
movl $0x6d, %ebp
movl $0x5, %ebx
movabsq $0x4385df649fccf645, %r13 # imm = 0x4385DF649FCCF645
movl $0x1, %esi
pshufd $0xf5, 0xdce(%rip), %xmm0 # xmm0 = mem[1,1,3,3]
movdqa %xmm0, 0x60(%rsp)
movl %ebx, 0x14(%rsp)
leaq 0xea2(%rip), %rdi       # 0x2115
movq %rsi, 0x18(%rsp)
xorl %eax, %eax
callq 0x1040
leaq 0xe9a(%rip), %rdi       # 0x2120
xorl %eax, %eax
callq 0x1040
xorl %ebx, %ebx
xorl %r12d, %r12d
movl %r12d, %eax
subl $0x3, %eax
cmovbl %r12d, %eax
addl $-0x1, %ebx
jae 0x12b3
testl %eax, %eax
jne 0x12b3
leaq 0xe7d(%rip), %rdi       # 0x2129
xorl %eax, %eax
callq 0x1040
movq %r15, %rax
mulq %r13
movabsq $0x2360ed051fc65da4, %rcx # imm = 0x2360ED051FC65DA4
imulq %rcx, %r15
addq %rdx, %r15
imulq %r13, %r14
addq %r15, %r14
movq %rax, %r15
addq %rbp, %r15
adcq 0x8(%rsp), %r14
movq %r14, %rsi
xorq %r15, %rsi
movq %r14, %rcx
shrq $0x3a, %rcx
rorq %cl, %rsi
leaq 0xe39(%rip), %rdi       # 0x212c
xorl %eax, %eax
callq 0x1040
incl %r12d
cmpl $0x6, %r12d
jne 0x1292
movl $0xa, %edi
callq 0x1030
movl $0x0, 0x10(%rsp)
leaq 0xe1b(%rip), %rdi       # 0x2137
xorl %eax, %eax
callq 0x1040
movq %r15, %rdi
movq %r14, %rsi
movq $-0x6, %rdx
movq $-0x1, %rcx
movq %r13, %r8
movabsq $0x2360ed051fc65da4, %r9 # imm = 0x2360ED051FC65DA4
pushq 0x8(%rsp)
pushq %rbp
callq 0x1840
addq $0x10, %rsp
movq %rax, %r15
movq %rdx, %r14
xorl %r12d, %r12d
movl %r12d, %eax
subl $0x3, %eax
cmovbl %r12d, %eax
addl $-0x1, 0x10(%rsp)
jae 0x137e
testl %eax, %eax
jne 0x137e
leaq 0xdb2(%rip), %rdi       # 0x2129
xorl %eax, %eax
callq 0x1040
movq %r15, %rax
mulq %r13
movabsq $0x2360ed051fc65da4, %rcx # imm = 0x2360ED051FC65DA4
imulq %rcx, %r15
addq %rdx, %r15
imulq %r13, %r14
addq %r15, %r14
movq %rax, %r15
addq %rbp, %r15
adcq 0x8(%rsp), %r14
movq %r14, %rsi
xorq %r15, %rsi
movq %r14, %rcx
shrq $0x3a, %rcx
rorq %cl, %rsi
leaq 0xd6e(%rip), %rdi       # 0x212c
xorl %eax, %eax
callq 0x1040
incl %r12d
cmpl $0x6, %r12d
jne 0x135b
movl $0xa, %edi
callq 0x1030
leaq 0xd61(%rip), %rdi       # 0x2140
xorl %eax, %eax
callq 0x1040
movl $0x41, %r12d
movq %r15, %rax
mulq %r13
movabsq $0x2360ed051fc65da4, %rcx # imm = 0x2360ED051FC65DA4
imulq %rcx, %r15
addq %rdx, %r15
imulq %r13, %r14
addq %r15, %r14
movq %rax, %r15
addq %rbp, %r15
adcq 0x8(%rsp), %r14
movq %r14, %rax
xorq %r15, %rax
movq %r14, %rcx
shrq $0x3a, %rcx
rorq %cl, %rax
movl $0x54, %edi
testb $0x1, %al
je 0x1433
movl $0x48, %edi
callq 0x1030
decl %r12d
jne 0x13ec
movl $0xa, %edi
callq 0x1030
xorl %r12d, %r12d
leaq 0xcf9(%rip), %rdi       # 0x214a
xorl %eax, %eax
callq 0x1040
movq 0x8(%rsp), %rdi
movabsq $0x2360ed051fc65da4, %r8 # imm = 0x2360ED051FC65DA4
movq %r15, %rax
mulq %r13
imulq %r8, %r15
addq %rdx, %r15
imulq %r13, %r14
addq %r15, %r14
movq %rax, %r15
addq %rbp, %r15
adcq %rdi, %r14
movq %r14, %rsi
xorq %r15, %rsi
movq %r14, %rcx
shrq $0x3a, %rcx
rorq %cl, %rsi
cmpq $0x4, %rsi
jb 0x1467
movq %rsi, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
mulq %rcx
shrq $0x2, %rdx
addl %edx, %edx
leal (%rdx,%rdx,2), %eax
subl %eax, %esi
incl %esi
leaq 0xc95(%rip), %rdi       # 0x2153
xorl %eax, %eax
callq 0x1040
incl %r12d
cmpl $0x21, %r12d
jne 0x1458
movl $0xa, %edi
callq 0x1030
xorl %eax, %eax
movdqa 0xb2e(%rip), %xmm0      # 0x2010
movq 0x8(%rsp), %r8
movabsq $0x2360ed051fc65da4, %r9 # imm = 0x2360ED051FC65DA4
movdqa 0xb27(%rip), %xmm3      # 0x2020
movdqa 0xb2f(%rip), %xmm4      # 0x2030
movdqa 0x60(%rsp), %xmm5
movdqa 0xb31(%rip), %xmm6      # 0x2040
movdqa %xmm0, %xmm1
pxor %xmm3, %xmm1
movdqa %xmm4, %xmm2
pcmpgtd %xmm1, %xmm2
pshufd $0xf5, %xmm1, %xmm1     # xmm1 = xmm1[1,1,3,3]
pcmpeqd %xmm5, %xmm1
pand %xmm2, %xmm1
movd %xmm1, %ecx
testb $0x1, %cl
je 0x1539
movb %al, 0x20(%rsp,%rax)
pextrw $0x4, %xmm1, %ecx
testb $0x1, %cl
je 0x154a
leal 0x1(%rax), %ecx
movb %cl, 0x21(%rsp,%rax)
addq $0x2, %rax
paddq %xmm6, %xmm0
cmpq $0x34, %rax
jne 0x150f
movl $0x34, %edi
movq %rdi, %rax
negq %rax
xorl %edx, %edx
divq %rdi
movq %rdx, %rsi
movq %r15, %rax
mulq %r13
imulq %r9, %r15
addq %rdx, %r15
imulq %r13, %r14
addq %r15, %r14
movq %rax, %r15
addq %rbp, %r15
adcq %r8, %r14
movq %r14, %rax
xorq %r15, %rax
movq %r14, %rcx
shrq $0x3a, %rcx
rorq %cl, %rax
cmpq %rsi, %rax
jb 0x156b
xorl %edx, %edx
divq %rdi
movb 0x20(%rsp,%rdx), %al
movb 0x1f(%rsp,%rdi), %cl
movb %cl, 0x20(%rsp,%rdx)
movb %al, 0x1f(%rsp,%rdi)
leaq -0x1(%rdi), %rax
cmpq $0x2, %rdi
movq %rax, %rdi
ja 0x155d
leaq 0xb91(%rip), %rdi       # 0x2157
xorl %eax, %eax
callq 0x1040
movb $0x1, %al
xorl %r12d, %r12d
movb %al, 0x10(%rsp)
shrb %al
movzbl %al, %eax
imull $0xbb, %eax, %eax
shrl $0xb, %eax
leal (%rax,%rax,4), %ecx
leal (%rax,%rcx,4), %ebx
addl %eax, %ebx
movb 0x20(%rsp,%r12), %al
movl %eax, %ecx
sarb $0x7, %cl
shrb $0x6, %cl
addb %al, %cl
movl %ecx, %edx
sarb $0x2, %dl
movsbq %dl, %rdx
leaq 0xb5b(%rip), %rsi       # 0x2166
movsbl (%rdx,%rsi), %esi
andb $-0x4, %cl
subb %cl, %al
movsbq %al, %rax
leaq 0xb54(%rip), %rcx       # 0x2173
movsbl (%rax,%rcx), %edx
leaq 0xb36(%rip), %rdi       # 0x2160
xorl %eax, %eax
callq 0x1040
decb %bl
cmpb %r12b, %bl
jne 0x1646
leaq 0xaea(%rip), %rdi       # 0x2129
xorl %eax, %eax
callq 0x1040
incq %r12
movb 0x10(%rsp), %al
incb %al
cmpq $0x34, %r12
jne 0x15d2
movl $0xa, %edi
callq 0x1030
movl $0xa, %edi
callq 0x1030
movq 0x18(%rsp), %rcx
leal 0x1(%rcx), %eax
movl 0x14(%rsp), %ebx
cmpl %ebx, %ecx
movl %eax, %esi
jne 0x126c
xorl %eax, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x5, %ebx
cmpl $0x2, %edi
je 0x16a9
movq 0x10(%rsi), %rdi
callq 0x1090
movl %eax, %ebx
leaq 0x20(%rsp), %r14
movl $0x20, %esi
movq %r14, %rdi
callq 0x1718
movq 0x10(%r14), %rax
movq 0x18(%r14), %rdi
shldq $0x1, %rax, %rdi
leaq 0x1(,%rax,2), %rbp
movq (%r14), %rax
addq %rbp, %rax
movq 0x8(%r14), %r14
adcq %rdi, %r14
movabsq $0x2360ed051fc65da4, %rcx # imm = 0x2360ED051FC65DA4
imulq %rax, %rcx
movabsq $0x4385df649fccf645, %rsi # imm = 0x4385DF649FCCF645
mulq %rsi
movq %rax, %r15
addq %rcx, %rdx
imulq %rsi, %r14
addq %rdx, %r14
addq %rbp, %r15
movq %rdi, 0x8(%rsp)
adcq %rdi, %r14
jmp 0x11f4
nopl (%rax)