// File: /workspace/github_c_makefile_star2_O3/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 0x2725a7
testl %eax, %eax
jne 0x274fd9
testl %ebp, %ebp
setg %al
testq %rbx, %rbx
setne %cl
testb %cl, %al
jne 0x274eb8
movb $0x0, 0x249d0d(%rip)    # 0x4bebc0
jmp 0x274fd9
cmpb $0x0, 0x249d01(%rip)    # 0x4bebc0
je 0x274ecc
movb 0x249cfb(%rip), %al     # 0x4bebc2
jmp 0x274f82
movw $0x0, 0x249cec(%rip)    # 0x4bebc1
callq 0x2725a7
movl 0x24691b(%rip), %r15d   # 0x4bb7fc
testl %r15d, %r15d
je 0x274efd
movq %rsp, %r14
movl $0x100, %edx            # imm = 0x100
movq %r14, %rdi
xorl %esi, %esi
callq 0x173a0
movl %r15d, (%r14)
jmp 0x274f17
testl %eax, %eax
jne 0x274f0a
movq 0x249c90(%rip), %rdi    # 0x4beb98
jmp 0x274f0c
xorl %edi, %edi
movq %rsp, %rdx
movl $0x100, %esi            # imm = 0x100
callq *0x68(%rdi)
movdqa 0x1607e1(%rip), %xmm0   # 0x3d5700
xorl %eax, %eax
leaq 0x249c98(%rip), %rcx    # 0x4bebc0
movdqa 0x1607e0(%rip), %xmm1   # 0x3d5710
movdqu %xmm0, 0x3(%rax,%rcx)
addq $0x10, %rax
paddb %xmm1, %xmm0
cmpq $0x100, %rax            # imm = 0x100
jne 0x274f30
movb 0x249c76(%rip), %al     # 0x4bebc2
xorl %edx, %edx
movb 0x3(%rdx,%rcx), %sil
movb (%rsp,%rdx), %dil
addb %sil, %dil
addb %dil, %al
movzbl %al, %edi
movb 0x3(%rdi,%rcx), %r8b
movb %sil, 0x3(%rdi,%rcx)
movb %r8b, 0x3(%rdx,%rcx)
incq %rdx
cmpq $0x100, %rdx            # imm = 0x100
jne 0x274f4e
movb $0x1, 0x249c3e(%rip)    # 0x4bebc0
movb 0x249c39(%rip), %cl     # 0x4bebc1
movl %ebp, %edx
xorl %esi, %esi
leaq 0x249c2d(%rip), %rdi    # 0x4bebc0
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 0x274f93
movb %cl, 0x249bee(%rip)     # 0x4bebc1
movb %al, 0x249be9(%rip)     # 0x4bebc2
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r14
popq %r15
popq %rbp
retq