// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3JoinType
SQLITE_PRIVATE int sqlite3JoinType(Parse *pParse, Token *pA, Token *pB, Token *pC){
  int jointype = 0;
  Token *apAll[3];
  Token *p;
                             /*   0123456789 123456789 123456789 123 */
  static const char zKeyText[] = "naturaleftouterightfullinnercross";
  static const struct {
    u8 i;        /* Beginning of keyword text in zKeyText[] */
    u8 nChar;    /* Length of the keyword in characters */
    u8 code;     /* Join type mask */
  } aKeyword[] = {
    /* natural */ { 0,  7, JT_NATURAL                },
    /* left    */ { 6,  4, JT_LEFT|JT_OUTER          },
    /* outer   */ { 10, 5, JT_OUTER                  },
    /* right   */ { 14, 5, JT_RIGHT|JT_OUTER         },
    /* full    */ { 19, 4, JT_LEFT|JT_RIGHT|JT_OUTER },
    /* inner   */ { 23, 5, JT_INNER                  },
    /* cross   */ { 28, 5, JT_INNER|JT_CROSS         },
  };
  int i, j;
  apAll[0] = pA;
  apAll[1] = pB;
  apAll[2] = pC;
  for(i=0; i<3 && apAll[i]; i++){
    p = apAll[i];
    for(j=0; j<ArraySize(aKeyword); j++){
      if( p->n==aKeyword[j].nChar 
          && sqlite3StrNICmp((char*)p->z, &zKeyText[aKeyword[j].i], p->n)==0 ){
        jointype |= aKeyword[j].code;
        break;
      }
    }
    testcase( j==0 || j==1 || j==2 || j==3 || j==4 || j==5 || j==6 );
    if( j>=ArraySize(aKeyword) ){
      jointype |= JT_ERROR;
      break;
    }
  }
  if(
     (jointype & (JT_INNER|JT_OUTER))==(JT_INNER|JT_OUTER) ||
     (jointype & JT_ERROR)!=0
  ){
    const char *zSp = " ";
    assert( pB!=0 );
    if( pC==0 ){ zSp++; }
    sqlite3ErrorMsg(pParse, "unknown or unsupported join type: "
       "%T %T%s%T", pA, pB, zSp, pC);
    jointype = JT_INNER;
  }else if( (jointype & JT_OUTER)!=0 
         && (jointype & (JT_LEFT|JT_RIGHT))!=JT_LEFT ){
    sqlite3ErrorMsg(pParse, 
      "RIGHT and FULL OUTER JOINs are not currently supported");
    jointype = JT_INNER;
  }
  return jointype;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movl $0x0, -0x4c(%rbp)
xorl %eax, %eax
cmpl $0x3, -0x4c(%rbp)
movb %al, -0x59(%rbp)
jge 0x54ce9
movslq -0x4c(%rbp), %rax
cmpq $0x0, -0x40(%rbp,%rax,8)
setne %al
movb %al, -0x59(%rbp)
movb -0x59(%rbp), %al
testb $0x1, %al
jne 0x54cf5
jmp 0x54dba
movslq -0x4c(%rbp), %rax
movq -0x40(%rbp,%rax,8), %rax
movq %rax, -0x48(%rbp)
movl $0x0, -0x50(%rbp)
cmpl $0x7, -0x50(%rbp)
jge 0x54d99
movq -0x48(%rbp), %rax
movl 0x8(%rax), %eax
movslq -0x50(%rbp), %rdx
leaq 0x5873b(%rip), %rcx     # 0xad460
imulq $0x3, %rdx, %rdx
addq %rdx, %rcx
movzbl 0x1(%rcx), %ecx
cmpl %ecx, %eax
jne 0x54d89
movq -0x48(%rbp), %rax
movq (%rax), %rdi
movslq -0x50(%rbp), %rcx
leaq 0x5871a(%rip), %rax     # 0xad460
imulq $0x3, %rcx, %rcx
addq %rcx, %rax
movzbl (%rax), %eax
leaq 0x586d9(%rip), %rsi     # 0xad430
addq %rax, %rsi
movq -0x48(%rbp), %rax
movl 0x8(%rax), %edx
callq 0x9210
cmpl $0x0, %eax
jne 0x54d89
movslq -0x50(%rbp), %rcx
leaq 0x586ea(%rip), %rax     # 0xad460
imulq $0x3, %rcx, %rcx
addq %rcx, %rax
movzbl 0x2(%rax), %eax
orl -0x24(%rbp), %eax
movl %eax, -0x24(%rbp)
jmp 0x54d99
jmp 0x54d8b
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x54d09
cmpl $0x7, -0x50(%rbp)
jl 0x54daa
movl -0x24(%rbp), %eax
orl $0x40, %eax
movl %eax, -0x24(%rbp)
jmp 0x54dba
jmp 0x54dac
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x54cce
movl -0x24(%rbp), %eax
andl $0x21, %eax
cmpl $0x21, %eax
je 0x54dd0
movl -0x24(%rbp), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0x54e19
leaq 0x5b077(%rip), %rax     # 0xafe4e
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x54dee
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movq -0x58(%rbp), %r8
movq -0x20(%rbp), %r9
leaq 0x5b9bc(%rip), %rsi     # 0xb07c5
movb $0x0, %al
callq 0x136f0
movl $0x1, -0x24(%rbp)
jmp 0x54e4a
movl -0x24(%rbp), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x54e48
movl -0x24(%rbp), %eax
andl $0x18, %eax
cmpl $0x8, %eax
je 0x54e48
movq -0x8(%rbp), %rdi
leaq 0x5b9b7(%rip), %rsi     # 0xb07f1
movb $0x0, %al
callq 0x136f0
movl $0x1, -0x24(%rbp)
jmp 0x54e4a
movl -0x24(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)