// File: /workspace/github_c_makefile_star2_O1/pyk[P]simple-nn/deps/pcg/sample/pcg32-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.

    pcg32_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).
    //
    // pcg32_srandom_r takes two 64-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

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

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

    printf("pcg32_random_r:\n"
           "      -  result:      32-bit unsigned int (uint32_t)\n"
           "      -  period:      2^64   (* 2^63 streams)\n"
           "      -  state type:  pcg32_random_t (%zu bytes)\n"
           "      -  output func: XSH-RR\n"
           "\n",
           sizeof(pcg32_random_t));

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

        /* Make some 32-bit numbers */
        printf("  32bit:");
        for (int i = 0; i < 6; ++i)
            printf(" 0x%08x", pcg32_random_r(&rng));
        printf("\n");

        printf("  Again:");
        pcg32_advance_r(&rng, -6);
        for (int i = 0; i < 6; ++i)
            printf(" 0x%08x", pcg32_random_r(&rng));
        printf("\n");

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

        /* Roll some dice */
        printf("  Rolls:");
        for (int i = 0; i < 33; ++i)
            printf(" %d", (int)pcg32_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 = pcg32_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 $0x48, %rsp
movl %edi, %ebx
leaq 0x8(%rsi), %r15
leal -0x1(%rbx), %r12d
cmpl $0x2, %edi
jl 0x11e3
movq %rsi, %r14
movq (%r15), %rdi
leaq 0xe2e(%rip), %rsi       # 0x2004
callq 0x1070
testl %eax, %eax
je 0x154c
xorl %ebp, %ebp
testl %r12d, %r12d
jle 0x11f8
movq (%r15), %rdi
callq 0x10a0
movl %eax, 0x4(%rsp)
jmp 0x1200
movl $0x5, 0x4(%rsp)
movabsq $0x5851f42d4c957f2d, %r14 # imm = 0x5851F42D4C957F2D
testb %bpl, %bpl
je 0x1240
leaq 0x10(%rsp), %rbx
movl $0x10, %esi
movq %rbx, %rdi
callq 0x1564
movq 0x8(%rbx), %rax
leaq 0x1(,%rax,2), %r15
movq (%rbx), %rcx
addq %r15, %rcx
imulq %r14, %rcx
leaq (%rcx,%rax,2), %r12
incq %r12
jmp 0x1250
movabsq $0x185706b82c2e03f8, %r12 # imm = 0x185706B82C2E03F8
movl $0x6d, %r15d
leaq 0xdb0(%rip), %rdi       # 0x2007
movl $0x10, %esi
xorl %eax, %eax
callq 0x1040
cmpl $0x0, 0x4(%rsp)
jle 0x153b
movl $0x1, %esi
leaq 0xe64(%rip), %rbx       # 0x20de
movl $0xaaaaaaab, %r13d      # imm = 0xAAAAAAAB
leaq 0xe43(%rip), %rdi       # 0x20ca
movq %rsi, 0x8(%rsp)
xorl %eax, %eax
callq 0x1040
leaq 0xe3b(%rip), %rdi       # 0x20d5
xorl %eax, %eax
callq 0x1040
movl $0x6, %ebp
movq %r12, %rcx
imulq %r14, %r12
addq %r15, %r12
movq %rcx, %rsi
shrq $0x2d, %rsi
movq %rcx, %rax
shrq $0x1b, %rax
xorl %eax, %esi
shrq $0x3b, %rcx
rorl %cl, %esi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1040
decl %ebp
jne 0x12a6
movl $0xa, %edi
callq 0x1030
leaq 0xe01(%rip), %rdi       # 0x20e6
xorl %eax, %eax
callq 0x1040
movq %r12, %rdi
movq $-0x6, %rsi
movq %r14, %rdx
movq %r15, %rcx
callq 0x168c
movq %rax, %r12
movl $0x6, %ebp
movq %r12, %rcx
imulq %r14, %r12
addq %r15, %r12
movq %rcx, %rsi
shrq $0x2d, %rsi
movq %rcx, %rax
shrq $0x1b, %rax
xorl %eax, %esi
shrq $0x3b, %rcx
rorl %cl, %esi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1040
decl %ebp
jne 0x1309
movl $0xa, %edi
callq 0x1030
leaq 0xda7(%rip), %rdi       # 0x20ef
xorl %eax, %eax
callq 0x1040
movl $0x41, %ebp
leaq 0xda7(%rip), %rbx       # 0x2102
movq %r12, %rax
shrq $0x2d, %rax
movq %r12, %rcx
shrq $0x1b, %rcx
xorl %ecx, %eax
movq %r12, %rcx
shrq $0x3b, %rcx
rorl %cl, %eax
movl $0x54, %edi
testb $0x1, %al
je 0x1382
movl $0x48, %edi
imulq %r14, %r12
addq %r15, %r12
callq 0x1030
decl %ebp
jne 0x135b
movl $0xa, %edi
callq 0x1030
xorl %ebp, %ebp
leaq 0xd54(%rip), %rdi       # 0x20f9
xorl %eax, %eax
callq 0x1040
movq %r12, %rcx
movq %r12, %rax
shrq $0x2d, %rax
movq %r12, %rdx
shrq $0x1b, %rdx
xorl %edx, %eax
shrq $0x3b, %rcx
rorl %cl, %eax
imulq %r14, %r12
addq %r15, %r12
movq %rax, %rcx
imulq %r13, %rcx
shrq $0x22, %rcx
addl %ecx, %ecx
leal (%rcx,%rcx,2), %ecx
movl %eax, %edx
subl %ecx, %edx
cmpl $0x4, %eax
cmovael %edx, %esi
jb 0x13ac
incl %esi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1040
incl %ebp
cmpl $0x21, %ebp
jne 0x13ac
movl $0xa, %edi
callq 0x1030
xorl %eax, %eax
movb %al, 0x10(%rsp,%rax)
incq %rax
cmpq $0x34, %rax
jne 0x1407
movl $0x34, %r8d
movl %r8d, %eax
negl %eax
xorl %edx, %edx
divl %r8d
movl %edx, %esi
movq %r12, %rdi
shrq $0x2d, %rdi
movq %r12, %rax
shrq $0x1b, %rax
xorl %eax, %edi
movq %r12, %rcx
shrq $0x3b, %rcx
rorl %cl, %edi
cmpl %esi, %edi
jb 0x144a
movl %edi, %eax
xorl %edx, %edx
divl %r8d
imulq %r14, %r12
addq %r15, %r12
cmpl %esi, %edi
jb 0x1426
movslq %edx, %rax
movb 0x10(%rsp,%rax), %cl
movb 0xf(%rsp,%r8), %dl
movb %dl, 0x10(%rsp,%rax)
movb %cl, 0xf(%rsp,%r8)
leaq -0x1(%r8), %rax
cmpq $0x2, %r8
movq %rax, %r8
ja 0x141a
leaq 0xc88(%rip), %rdi       # 0x2106
xorl %eax, %eax
callq 0x1040
movl $0x1, %ebp
xorl %r13d, %r13d
movl %ebp, %eax
movl $0xba2e8ba3, %ecx       # imm = 0xBA2E8BA3
imulq %rcx, %rax
shrq $0x24, %rax
leal (%rax,%rax,4), %ecx
leal (%rax,%rcx,4), %ecx
leal (%rax,%rcx), %ebx
decl %ebx
movsbl 0x10(%rsp,%r13), %eax
leal 0x3(%rax), %ecx
testl %eax, %eax
cmovnsl %eax, %ecx
movl %ecx, %edx
sarl $0x2, %edx
movslq %edx, %rdx
leaq 0xc54(%rip), %rsi       # 0x2118
movsbl (%rdx,%rsi), %esi
andl $-0x4, %ecx
subl %ecx, %eax
cltq
leaq 0xc4f(%rip), %rcx       # 0x2125
movsbl (%rax,%rcx), %edx
leaq 0xc2e(%rip), %rdi       # 0x210f
xorl %eax, %eax
callq 0x1040
cmpl %r13d, %ebx
jne 0x14fb
leaq 0xc21(%rip), %rdi       # 0x2115
xorl %eax, %eax
callq 0x1040
incq %r13
incl %ebp
cmpq $0x34, %r13
jne 0x148d
movl $0xa, %edi
callq 0x1030
movl $0xa, %edi
callq 0x1030
movq 0x8(%rsp), %rcx
leal 0x1(%rcx), %eax
cmpl 0x4(%rsp), %ecx
movl %eax, %esi
leaq 0xbaf(%rip), %rbx       # 0x20de
movl $0xaaaaaaab, %r13d      # imm = 0xAAAAAAAB
jne 0x1280
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq $0x10, %r14
addl $-0x2, %ebx
movb $0x1, %bpl
movq %r14, %r15
movl %ebx, %r12d
jmp 0x11e5
nopl (%rax)