// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3VdbeChangeEncoding
SQLITE_PRIVATE int sqlite3VdbeChangeEncoding(Mem *pMem, int desiredEnc){
#ifndef SQLITE_OMIT_UTF16
  int rc;
#endif
  assert( (pMem->flags&MEM_RowSet)==0 );
  assert( desiredEnc==SQLITE_UTF8 || desiredEnc==SQLITE_UTF16LE
           || desiredEnc==SQLITE_UTF16BE );
  if( !(pMem->flags&MEM_Str) || pMem->enc==desiredEnc ){
    return SQLITE_OK;
  }
  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
#ifdef SQLITE_OMIT_UTF16
  return SQLITE_ERROR;
#else

  /* MemTranslate() may return SQLITE_OK or SQLITE_NOMEM. If NOMEM is returned,
  ** then the encoding of the value may not have changed.
  */
  rc = sqlite3VdbeMemTranslate(pMem, (u8)desiredEnc);
  assert(rc==SQLITE_OK    || rc==SQLITE_NOMEM);
  assert(rc==SQLITE_OK    || pMem->enc!=desiredEnc);
  assert(rc==SQLITE_NOMEM || pMem->enc==desiredEnc);
  return rc;
#endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
xorl %r15d, %r15d
testb $0x2, 0x24(%rdi)
je 0x253c3
movl %esi, %r14d
movq %rdi, %rbx
movzbl 0x27(%rdi), %eax
cmpl %esi, %eax
je 0x253c3
cmpb $0x1, %al
sete %al
cmpl $0x1, %r14d
sete %cl
orb %al, %cl
jne 0x24ed8
movq %rbx, %rdi
callq 0x253d5
movl $0x7, %r15d
testl %eax, %eax
jne 0x253c3
movslq 0x20(%rbx), %rax
andq $-0x2, %rax
testl %eax, %eax
jle 0x24ecc
movq 0x8(%rbx), %rcx
addq %rcx, %rax
rolw $0x8, (%rcx)
addq $0x2, %rcx
cmpq %rax, %rcx
jb 0x24ebf
movb %r14b, 0x27(%rbx)
xorl %r15d, %r15d
jmp 0x253c3
movl 0x20(%rbx), %eax
cmpl $0x1, %r14d
jne 0x24ef0
andl $-0x2, %eax
movl %eax, 0x20(%rbx)
leal 0x1(,%rax,2), %esi
jmp 0x24ef7
leal 0x2(,%rax,2), %esi
movq (%rbx), %rdi
movq 0x8(%rbx), %r13
movslq 0x20(%rbx), %r12
callq 0x115e9
testq %rax, %rax
je 0x2504f
movq %r12, %r11
addq %r13, %r11
movzbl 0x27(%rbx), %ecx
cmpl $0x1, %ecx
je 0x2505a
cmpl $0x2, %ecx
jne 0x2515f
movq %rax, %rcx
testl %r12d, %r12d
jle 0x2527b
movq %rax, %rcx
movzbl (%r13), %esi
leaq 0x2(%r13), %rdi
movzbl 0x1(%r13), %r8d
movl %r8d, %edx
shll $0x8, %edx
orl %esi, %edx
andb $-0x8, %r8b
cmpb $-0x28, %r8b
sete %r8b
cmpq %r11, %rdi
setb %r9b
andb %r8b, %r9b
cmpb $0x1, %r9b
jne 0x24fa1
movzbl 0x2(%r13), %edi
movzbl 0x3(%r13), %r8d
addq $0x4, %r13
andl $0x3, %r8d
shll $0x8, %r8d
shll $0xa, %esi
movzwl %si, %esi
shll $0xa, %edx
andl $0xf0000, %edx          # imm = 0xF0000
orl %esi, %edx
orl %edi, %edx
addl %r8d, %edx
addl $0x10000, %edx          # imm = 0x10000
jmp 0x24fa4
movq %rdi, %r13
cmpl $0x7f, %edx
ja 0x24fb3
movb %dl, (%rcx)
incq %rcx
jmp 0x25041
movl %edx, %esi
cmpl $0x7ff, %edx            # imm = 0x7FF
ja 0x24fd6
shrl $0x6, %esi
orb $-0x40, %sil
movb %sil, (%rcx)
andb $0x3f, %dl
orb $-0x80, %dl
movb %dl, 0x1(%rcx)
addq $0x2, %rcx
jmp 0x25041
cmpl $0xffff, %edx           # imm = 0xFFFF
ja 0x25008
shrl $0xc, %esi
orb $-0x20, %sil
movb %sil, (%rcx)
movl %edx, %esi
shrl $0x6, %esi
andb $0x3f, %sil
orb $-0x80, %sil
movb %sil, 0x1(%rcx)
andb $0x3f, %dl
orb $-0x80, %dl
movb %dl, 0x2(%rcx)
addq $0x3, %rcx
jmp 0x25041
shrl $0x12, %esi
orb $-0x10, %sil
movb %sil, (%rcx)
movl %edx, %esi
shrl $0xc, %esi
andb $0x3f, %sil
orb $-0x80, %sil
movb %sil, 0x1(%rcx)
movl %edx, %esi
shrl $0x6, %esi
andb $0x3f, %sil
orb $-0x80, %sil
movb %sil, 0x2(%rcx)
andb $0x3f, %dl
orb $-0x80, %dl
movb %dl, 0x3(%rcx)
addq $0x4, %rcx
cmpq %r11, %r13
jb 0x24f3b
jmp 0x2527b
movl $0x7, %r15d
jmp 0x253c3
movq %rax, %rcx
cmpl $0x2, %r14d
jne 0x25287
testl %r12d, %r12d
jle 0x2538b
leaq 0x51319(%rip), %rdx     # 0x76390
movl $0xfffd, %esi           # imm = 0xFFFD
movq %rax, %rcx
movzbl (%r13), %edi
incq %r13
cmpl $0xc0, %edi
jb 0x250f3
addl $0xffffff40, %edi       # imm = 0xFFFFFF40
movzbl (%rdi,%rdx), %r8d
cmpq %r11, %r13
je 0x250c3
movzbl (%r13), %edi
movl %edi, %r9d
andl $-0x40, %r9d
cmpl $0x80, %r9d
jne 0x250c3
shll $0x6, %r8d
incq %r13
andl $0x3f, %edi
orl %edi, %r8d
jmp 0x2509a
movl %r8d, %edi
andl $0xfffff800, %edi       # imm = 0xFFFFF800
movl %r8d, %r9d
andl $-0x2, %r9d
cmpl $0xd800, %edi           # imm = 0xD800
movl %r8d, %edi
cmovel %esi, %edi
cmpl $0x80, %r8d
cmovbl %esi, %edi
cmpl $0xfffe, %r9d           # imm = 0xFFFE
cmovel %esi, %edi
cmpl $0xffff, %edi           # imm = 0xFFFF
ja 0x25104
movw %di, (%rcx)
addq $0x2, %rcx
jmp 0x25151
movl %edi, %r8d
shrl $0xa, %r8d
andl $0x3f, %r8d
leal -0x10000(%rdi), %r9d
movl %r9d, %r10d
shrl $0xa, %r10d
andl $0xc0, %r10d
orl %r8d, %r10d
movb %r10b, (%rcx)
shrl $0x12, %r9d
andb $0x3, %r9b
orb $-0x28, %r9b
movb %r9b, 0x1(%rcx)
movb %dil, 0x2(%rcx)
shrl $0x8, %edi
andb $0x3, %dil
orb $-0x24, %dil
movb %dil, 0x3(%rcx)
addq $0x4, %rcx
cmpq %r11, %r13
jb 0x2507f
jmp 0x2538b
movq %rax, %rcx
testl %r12d, %r12d
jle 0x2527b
movq %rax, %rcx
movzbl (%r13), %r8d
movl %r8d, %edx
shll $0x8, %edx
leaq 0x2(%r13), %rdi
movzbl 0x1(%r13), %esi
orl %esi, %edx
andb $-0x8, %r8b
cmpb $-0x28, %r8b
sete %r8b
cmpq %r11, %rdi
setb %r9b
andb %r8b, %r9b
cmpb $0x1, %r9b
jne 0x251d2
movzbl 0x2(%r13), %edi
movzbl 0x3(%r13), %r8d
addq $0x4, %r13
andl $0x3, %edi
shll $0x8, %edi
shll $0xa, %esi
movzwl %si, %esi
shll $0xa, %edx
andl $0xf0000, %edx          # imm = 0xF0000
orl %esi, %edx
orl %r8d, %edx
addl %edi, %edx
addl $0x10000, %edx          # imm = 0x10000
jmp 0x251d5
movq %rdi, %r13
cmpl $0x7f, %edx
ja 0x251e4
movb %dl, (%rcx)
incq %rcx
jmp 0x25272
movl %edx, %esi
cmpl $0x7ff, %edx            # imm = 0x7FF
ja 0x25207
shrl $0x6, %esi
orb $-0x40, %sil
movb %sil, (%rcx)
andb $0x3f, %dl
orb $-0x80, %dl
movb %dl, 0x1(%rcx)
addq $0x2, %rcx
jmp 0x25272
cmpl $0xffff, %edx           # imm = 0xFFFF
ja 0x25239
shrl $0xc, %esi
orb $-0x20, %sil
movb %sil, (%rcx)
movl %edx, %esi
shrl $0x6, %esi
andb $0x3f, %sil
orb $-0x80, %sil
movb %sil, 0x1(%rcx)
andb $0x3f, %dl
orb $-0x80, %dl
movb %dl, 0x2(%rcx)
addq $0x3, %rcx
jmp 0x25272
shrl $0x12, %esi
orb $-0x10, %sil
movb %sil, (%rcx)
movl %edx, %esi
shrl $0xc, %esi
andb $0x3f, %sil
orb $-0x80, %sil
movb %sil, 0x1(%rcx)
movl %edx, %esi
shrl $0x6, %esi
andb $0x3f, %sil
orb $-0x80, %sil
movb %sil, 0x2(%rcx)
andb $0x3f, %dl
orb $-0x80, %dl
movb %dl, 0x3(%rcx)
addq $0x4, %rcx
cmpq %r11, %r13
jb 0x2516e
movl %ecx, %edx
subl %eax, %edx
movl %edx, 0x20(%rbx)
jmp 0x25398
testl %r12d, %r12d
jle 0x2538b
leaq 0x510f9(%rip), %rdi     # 0x76390
movl $0xfffd, %esi           # imm = 0xFFFD
movq %rax, %rcx
movzbl (%r13), %edx
incq %r13
cmpl $0xc0, %edx
jb 0x25313
addl $0xffffff40, %edx       # imm = 0xFFFFFF40
movzbl (%rdx,%rdi), %r8d
cmpq %r11, %r13
je 0x252e3
movzbl (%r13), %edx
movl %edx, %r9d
andl $-0x40, %r9d
cmpl $0x80, %r9d
jne 0x252e3
shll $0x6, %r8d
incq %r13
andl $0x3f, %edx
orl %edx, %r8d
jmp 0x252ba
movl %r8d, %edx
andl $0xfffff800, %edx       # imm = 0xFFFFF800
movl %r8d, %r9d
andl $-0x2, %r9d
cmpl $0xd800, %edx           # imm = 0xD800
movl %r8d, %edx
cmovel %esi, %edx
cmpl $0x80, %r8d
cmovbl %esi, %edx
cmpl $0xfffe, %r9d           # imm = 0xFFFE
cmovel %esi, %edx
cmpl $0xffff, %edx           # imm = 0xFFFF
ja 0x25329
leaq 0x1(%rcx), %r8
movb %dh, (%rcx)
movl $0x2, %r9d
jmp 0x2537c
leal -0x10000(%rdx), %r8d
movl %r8d, %r9d
shrl $0x12, %r9d
andb $0x3, %r9b
orb $-0x28, %r9b
movb %r9b, (%rcx)
movl %edx, %r9d
shrl $0xa, %r9d
andl $0x3f, %r9d
shrl $0xa, %r8d
andl $0xc0, %r8d
orl %r9d, %r8d
movb %r8b, 0x1(%rcx)
movl %edx, %r9d
shrl $0x8, %r9d
andb $0x3, %r9b
orb $-0x24, %r9b
leaq 0x3(%rcx), %r8
movb %r9b, 0x2(%rcx)
movl $0x4, %r9d
addq %r9, %rcx
movb %dl, (%r8)
cmpq %r11, %r13
jb 0x2529f
movl %ecx, %edx
subl %eax, %edx
movl %edx, 0x20(%rbx)
movb $0x0, (%rcx)
incq %rcx
movq %rax, %r12
movb $0x0, (%rcx)
movq %rbx, %rdi
callq 0xec23
movl $0x600, %eax            # imm = 0x600
orl 0x24(%rbx), %eax
movb %r14b, 0x27(%rbx)
andl $0xe7ff, %eax           # imm = 0xE7FF
movw %ax, 0x24(%rbx)
movq %r12, 0x8(%rbx)
movq %r12, 0x30(%rbx)
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq