// File: /workspace/github_c_makefile_star2_O2/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 %r12d, %r12d
testb $0x2, 0x24(%rdi)
je 0x2198d
movl %esi, %ebx
movq %rdi, %r14
movzbl 0x27(%rdi), %eax
cmpl %esi, %eax
je 0x2198d
cmpb $0x1, %al
sete %al
cmpl $0x1, %ebx
sete %cl
orb %al, %cl
pushq $0x7
popq %r12
jne 0x214bc
movq %r14, %rdi
callq 0x2199f
testl %eax, %eax
jne 0x2198d
movq 0x8(%r14), %rax
movslq 0x20(%r14), %rcx
andq $-0x2, %rcx
addq %rax, %rcx
cmpq %rcx, %rax
jae 0x2174f
rolw $0x8, (%rax)
addq $0x2, %rax
jmp 0x214a9
movl 0x20(%r14), %r15d
cmpl $0x1, %ebx
jne 0x214d7
andl $-0x2, %r15d
movl %r15d, 0x20(%r14)
leal 0x1(,%r15,2), %esi
jmp 0x214df
leal 0x2(,%r15,2), %esi
movq (%r14), %rdi
movq 0x8(%r14), %r13
callq 0x103b4
testq %rax, %rax
je 0x2198d
movslq %r15d, %rcx
addq %r13, %rcx
movzbl 0x27(%r14), %edx
cmpl $0x1, %edx
je 0x21758
movl %ebx, %r12d
movq %rax, %rbx
cmpl $0x2, %edx
jne 0x21739
cmpq %rcx, %r13
jae 0x21742
movb (%r13), %dil
movzbl %dil, %r8d
leaq 0x2(%r13), %rdx
movzbl 0x1(%r13), %r9d
movl %r9d, %esi
shll $0x8, %esi
orl %r8d, %esi
movl %r9d, %r10d
andb $-0x8, %r10b
cmpb $-0x28, %r10b
jne 0x215cb
cmpq %rcx, %rdx
jae 0x215cb
movzbl 0x2(%r13), %edx
movzbl 0x3(%r13), %edi
addq $0x4, %r13
andl $0x3, %edi
shll $0x8, %edi
shll $0xa, %r8d
orl %edx, %edi
orl %r8d, %edi
andl $0xf000, %r8d           # imm = 0xF000
shll $0xa, %esi
andl $0xf0000, %esi          # imm = 0xF0000
movl %esi, %r9d
addl $0x10000, %r9d          # imm = 0x10000
addl %r8d, %esi
addl $0x10000, %esi          # imm = 0x10000
shrl $0x12, %r9d
orb $-0x10, %r9b
movb %r9b, (%rbx)
shrl $0xc, %esi
andb $0x3f, %sil
orb $-0x80, %sil
movb %sil, 0x1(%rbx)
shrl $0x6, %edi
andb $0x3f, %dil
orb $-0x80, %dil
movb %dil, 0x2(%rbx)
andb $0x3f, %dl
orb $-0x80, %dl
movb %dl, 0x3(%rbx)
addq $0x4, %rbx
jmp 0x21517
cmpl $0x7f, %esi
ja 0x215de
movb %dil, (%rbx)
incq %rbx
movq %rdx, %r13
jmp 0x21517
cmpb $0x7, %r9b
ja 0x21606
shrl $0x6, %esi
orb $-0x40, %sil
movb %sil, (%rbx)
andb $0x3f, %dil
orb $-0x80, %dil
movb %dil, 0x1(%rbx)
addq $0x2, %rbx
movq %rdx, %r13
jmp 0x21517
shrb $0x4, %r9b
orb $-0x20, %r9b
movb %r9b, (%rbx)
shrl $0x6, %esi
andb $0x3f, %sil
orb $-0x80, %sil
movb %sil, 0x1(%rbx)
andb $0x3f, %dil
orb $-0x80, %dil
movb %dil, 0x2(%rbx)
addq $0x3, %rbx
movq %rdx, %r13
jmp 0x21517
movzbl (%r13), %r9d
movl %r9d, %edx
shll $0x8, %edx
leaq 0x2(%r13), %rsi
movb 0x1(%r13), %dil
movzbl %dil, %r8d
orl %r8d, %edx
movl %r9d, %r10d
andb $-0x8, %r10b
cmpb $-0x28, %r10b
jne 0x216dc
cmpq %rcx, %rsi
jae 0x216dc
movzbl 0x2(%r13), %edi
movzbl 0x3(%r13), %esi
addq $0x4, %r13
andl $0x3, %edi
shll $0x8, %edi
shll $0xa, %r8d
orl %esi, %edi
orl %r8d, %edi
andl $0xf000, %r8d           # imm = 0xF000
shll $0xa, %edx
andl $0xf0000, %edx          # imm = 0xF0000
movl %edx, %r9d
addl $0x10000, %r9d          # imm = 0x10000
addl %r8d, %edx
addl $0x10000, %edx          # imm = 0x10000
shrl $0x12, %r9d
orb $-0x10, %r9b
movb %r9b, (%rbx)
shrl $0xc, %edx
andb $0x3f, %dl
orb $-0x80, %dl
movb %dl, 0x1(%rbx)
shrl $0x6, %edi
andb $0x3f, %dil
orb $-0x80, %dil
movb %dil, 0x2(%rbx)
andb $0x3f, %sil
orb $-0x80, %sil
movb %sil, 0x3(%rbx)
addq $0x4, %rbx
jmp 0x21739
cmpl $0x7f, %edx
ja 0x216ec
movb %dil, (%rbx)
incq %rbx
movq %rsi, %r13
jmp 0x21739
cmpb $0x7, %r9b
ja 0x2170f
shrl $0x6, %edx
orb $-0x40, %dl
movb %dl, (%rbx)
andb $0x3f, %dil
orb $-0x80, %dil
movb %dil, 0x1(%rbx)
addq $0x2, %rbx
movq %rsi, %r13
jmp 0x21739
shrb $0x4, %r9b
orb $-0x20, %r9b
movb %r9b, (%rbx)
shrl $0x6, %edx
andb $0x3f, %dl
orb $-0x80, %dl
movb %dl, 0x1(%rbx)
andb $0x3f, %dil
orb $-0x80, %dil
movb %dil, 0x2(%rbx)
addq $0x3, %rbx
movq %rsi, %r13
cmpq %rcx, %r13
jb 0x21638
movl %ebx, %ecx
subl %eax, %ecx
movl %ecx, 0x20(%r14)
jmp 0x2195d
movb %bl, 0x27(%r14)
jmp 0x2198a
movl %ebx, %r12d
cmpl $0x2, %ebx
jne 0x21850
leaq 0x46c35(%rip), %rdx     # 0x683a0
movq %rax, %rbx
cmpq %rcx, %r13
jae 0x2194f
movzbl (%r13), %edi
incq %r13
cmpl $0xc0, %edi
jb 0x217f5
addl $0xffffff40, %edi       # imm = 0xFFFFFF40
movzbl (%rdi,%rdx), %esi
cmpq %rcx, %r13
je 0x217b8
movzbl (%r13), %edi
movl %edi, %r8d
andl $-0x40, %r8d
cmpl $0x80, %r8d
jne 0x217bb
shll $0x6, %esi
incq %r13
andl $0x3f, %edi
orl %edi, %esi
jmp 0x21791
movq %rcx, %r13
movl %esi, %r8d
andl $-0x2, %r8d
movl $0xfffd, %edi           # imm = 0xFFFD
cmpl $0xfffe, %r8d           # imm = 0xFFFE
je 0x217f5
cmpl $0x80, %esi
jb 0x217f5
movl %esi, %r8d
andl $0xfffff800, %r8d       # imm = 0xFFFFF800
cmpl $0xd800, %r8d           # imm = 0xD800
je 0x217f5
cmpl $0xffff, %esi           # imm = 0xFFFF
ja 0x21801
movl %esi, %edi
movw %di, (%rbx)
addq $0x2, %rbx
jmp 0x2176e
movl %esi, %edi
shrl $0xa, %edi
andl $0x3f, %edi
leal -0x10000(%rsi), %r8d
movl %r8d, %r9d
shrl $0xa, %r9d
andl $0xc0, %r9d
orl %edi, %r9d
movb %r9b, (%rbx)
shrl $0x12, %r8d
andb $0x3, %r8b
orb $-0x28, %r8b
movb %r8b, 0x1(%rbx)
movb %sil, 0x2(%rbx)
shrl $0x8, %esi
andb $0x3, %sil
orb $-0x24, %sil
movb %sil, 0x3(%rbx)
addq $0x4, %rbx
jmp 0x2176e
leaq 0x46b49(%rip), %r9      # 0x683a0
pushq $0x4
popq %rsi
pushq $0x2
popq %rdi
movq %rax, %rbx
cmpq %rcx, %r13
jae 0x2194f
movzbl (%r13), %edx
incq %r13
cmpl $0xc0, %edx
jb 0x218ed
addl $0xffffff40, %edx       # imm = 0xFFFFFF40
movzbl (%rdx,%r9), %r8d
cmpq %rcx, %r13
je 0x218ad
movzbl (%r13), %edx
movl %edx, %r10d
andl $-0x40, %r10d
cmpl $0x80, %r10d
jne 0x218b0
shll $0x6, %r8d
incq %r13
andl $0x3f, %edx
orl %edx, %r8d
jmp 0x21884
movq %rcx, %r13
movl %r8d, %r10d
andl $-0x2, %r10d
movl $0xfffd, %edx           # imm = 0xFFFD
cmpl $0xfffe, %r10d          # imm = 0xFFFE
je 0x218ed
cmpl $0x80, %r8d
jb 0x218ed
movl %r8d, %r10d
andl $0xfffff800, %r10d      # imm = 0xFFFFF800
cmpl $0xd800, %r10d          # imm = 0xD800
je 0x218ed
cmpl $0xffff, %r8d           # imm = 0xFFFF
ja 0x21904
movl %r8d, %edx
leaq 0x1(%rbx), %r10
movb %dh, (%rbx)
movl %edx, %r8d
movq %rdi, %rdx
addq %rdx, %rbx
movb %r8b, (%r10)
jmp 0x21860
leal -0x10000(%r8), %edx
movl %edx, %r10d
shrl $0x12, %r10d
andb $0x3, %r10b
orb $-0x28, %r10b
movb %r10b, (%rbx)
movl %r8d, %r10d
shrl $0xa, %r10d
andl $0x3f, %r10d
shrl $0xa, %edx
andl $0xc0, %edx
orl %r10d, %edx
movb %dl, 0x1(%rbx)
movl %r8d, %edx
shrl $0x8, %edx
andb $0x3, %dl
orb $-0x24, %dl
leaq 0x3(%rbx), %r10
movb %dl, 0x2(%rbx)
movq %rsi, %rdx
jmp 0x218f9
movl %ebx, %ecx
subl %eax, %ecx
movl %ecx, 0x20(%r14)
movb $0x0, (%rbx)
incq %rbx
movq %rax, %r15
movb $0x0, (%rbx)
movq %r14, %rdi
callq 0xde44
movl $0xffffe1ff, %eax       # imm = 0xFFFFE1FF
andl 0x24(%r14), %eax
movb %r12b, 0x27(%r14)
orl $0x600, %eax            # imm = 0x600
movw %ax, 0x24(%r14)
movq %r15, 0x8(%r14)
movq %r15, 0x30(%r14)
xorl %r12d, %r12d
movl %r12d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq