// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: sqlite3_randomness
SQLITE_API void sqlite3_randomness(int N, void *pBuf){
  unsigned char t;
  unsigned char *zBuf = pBuf;

  /* The "wsdPrng" macro will resolve to the pseudo-random number generator
  ** state vector.  If writable static data is unsupported on the target,
  ** we have to locate the state vector at run-time.  In the more common
  ** case where writable static data is supported, wsdPrng can refer directly
  ** to the "sqlite3Prng" state vector declared above.
  */
#ifdef SQLITE_OMIT_WSD
  struct sqlite3PrngType *p = &GLOBAL(struct sqlite3PrngType, sqlite3Prng);
# define wsdPrng p[0]
#else
# define wsdPrng sqlite3Prng
#endif

#if SQLITE_THREADSAFE
  sqlite3_mutex *mutex;
#endif

#ifndef SQLITE_OMIT_AUTOINIT
  if( sqlite3_initialize() ) return;
#endif

#if SQLITE_THREADSAFE
  mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_PRNG);
#endif

  sqlite3_mutex_enter(mutex);
  if( N<=0 || pBuf==0 ){
    wsdPrng.isInit = 0;
    sqlite3_mutex_leave(mutex);
    return;
  }

  /* Initialize the state of the random number generator once,
  ** the first time this routine is called.  The seed value does
  ** not need to contain a lot of randomness since we are not
  ** trying to do secure encryption or anything like that...
  **
  ** Nothing in this file or anywhere else in SQLite does any kind of
  ** encryption.  The RC4 algorithm is being used as a PRNG (pseudo-random
  ** number generator) not as an encryption device.
  */
  if( !wsdPrng.isInit ){
    int i;
    char k[256];
    wsdPrng.j = 0;
    wsdPrng.i = 0;
    sqlite3OsRandomness(sqlite3_vfs_find(0), 256, k);
    for(i=0; i<256; i++){
      wsdPrng.s[i] = (u8)i;
    }
    for(i=0; i<256; i++){
      wsdPrng.j += wsdPrng.s[i] + k[i];
      t = wsdPrng.s[wsdPrng.j];
      wsdPrng.s[wsdPrng.j] = wsdPrng.s[i];
      wsdPrng.s[i] = t;
    }
    wsdPrng.isInit = 1;
  }

  assert( N>0 );
  do{
    wsdPrng.i++;
    t = wsdPrng.s[wsdPrng.i];
    wsdPrng.j += t;
    wsdPrng.s[wsdPrng.i] = wsdPrng.s[wsdPrng.j];
    wsdPrng.s[wsdPrng.j] = t;
    t += wsdPrng.s[wsdPrng.i];
    *(zBuf++) = wsdPrng.s[t];
  }while( --N );
  sqlite3_mutex_leave(mutex);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rsi, %rbx
movl %edi, %ebp
callq 0x27bed9
testl %eax, %eax
jne 0x27e8f7
testl %ebp, %ebp
setg %al
testq %rbx, %rbx
setne %cl
testb %cl, %al
jne 0x27e7e7
movb $0x0, 0x24b3de(%rip)    # 0x4c9bc0
jmp 0x27e8f7
cmpb $0x0, 0x24b3d2(%rip)    # 0x4c9bc0
jne 0x27e89a
movw $0x0, 0x24b3c4(%rip)    # 0x4c9bc1
callq 0x27bed9
movl 0x247ff3(%rip), %r15d   # 0x4c67fc
testl %r15d, %r15d
je 0x27e825
movq %rsp, %r14
movl $0x100, %edx            # imm = 0x100
movq %r14, %rdi
xorl %esi, %esi
callq 0x173a0
movl %r15d, (%r14)
jmp 0x27e83f
testl %eax, %eax
jne 0x27e832
movq 0x24b368(%rip), %rdi    # 0x4c9b98
jmp 0x27e834
xorl %edi, %edi
movq %rsp, %rdx
movl $0x100, %esi            # imm = 0x100
callq *0x68(%rdi)
xorl %ecx, %ecx
leaq 0x24b378(%rip), %rax    # 0x4c9bc0
movb %cl, 0x3(%rcx,%rax)
incq %rcx
cmpq $0x100, %rcx            # imm = 0x100
jne 0x27e848
movb 0x24b364(%rip), %cl     # 0x4c9bc2
xorl %edx, %edx
movb 0x3(%rdx,%rax), %sil
movb (%rsp,%rdx), %dil
addb %sil, %dil
addb %dil, %cl
movzbl %cl, %edi
movb 0x3(%rdi,%rax), %r8b
movb %sil, 0x3(%rdi,%rax)
movb %r8b, 0x3(%rdx,%rax)
incq %rdx
cmpq $0x100, %rdx            # imm = 0x100
jne 0x27e860
movb %cl, 0x24b32f(%rip)     # 0x4c9bc2
movb $0x1, 0x24b326(%rip)    # 0x4c9bc0
movb 0x24b321(%rip), %cl     # 0x4c9bc1
movb 0x24b31c(%rip), %al     # 0x4c9bc2
movl %ebp, %edx
xorl %esi, %esi
leaq 0x24b30f(%rip), %rdi    # 0x4c9bc0
incb %cl
movzbl %cl, %r8d
movb 0x3(%r8,%rdi), %r9b
addb %r9b, %al
movzbl %al, %r10d
movb 0x3(%r10,%rdi), %r11b
movb %r11b, 0x3(%r8,%rdi)
movb %r9b, 0x3(%r10,%rdi)
addb 0x3(%r8,%rdi), %r9b
movzbl %r9b, %r8d
movb 0x3(%r8,%rdi), %r8b
movb %r8b, (%rbx,%rsi)
incq %rsi
cmpl %esi, %edx
jne 0x27e8b1
movb %cl, 0x24b2d0(%rip)     # 0x4c9bc1
movb %al, 0x24b2cb(%rip)     # 0x4c9bc2
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r14
popq %r15
popq %rbp
retq