// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/cram/cram_io.c
// Function: cram_init_tables
static void cram_init_tables(cram_fd *fd) {
    int i;

    memset(fd->L1, 4, 256);
    fd->L1['A'] = 0; fd->L1['a'] = 0;
    fd->L1['C'] = 1; fd->L1['c'] = 1;
    fd->L1['G'] = 2; fd->L1['g'] = 2;
    fd->L1['T'] = 3; fd->L1['t'] = 3;

    memset(fd->L2, 5, 256);
    fd->L2['A'] = 0; fd->L2['a'] = 0;
    fd->L2['C'] = 1; fd->L2['c'] = 1;
    fd->L2['G'] = 2; fd->L2['g'] = 2;
    fd->L2['T'] = 3; fd->L2['t'] = 3;
    fd->L2['N'] = 4; fd->L2['n'] = 4;

    if (CRAM_MAJOR_VERS(fd->version) == 1) {
        for (i = 0; i < 0x200; i++) {
            int f = 0;

            if (i & CRAM_FPAIRED)      f |= BAM_FPAIRED;
            if (i & CRAM_FPROPER_PAIR) f |= BAM_FPROPER_PAIR;
            if (i & CRAM_FUNMAP)       f |= BAM_FUNMAP;
            if (i & CRAM_FREVERSE)     f |= BAM_FREVERSE;
            if (i & CRAM_FREAD1)       f |= BAM_FREAD1;
            if (i & CRAM_FREAD2)       f |= BAM_FREAD2;
            if (i & CRAM_FSECONDARY)   f |= BAM_FSECONDARY;
            if (i & CRAM_FQCFAIL)      f |= BAM_FQCFAIL;
            if (i & CRAM_FDUP)         f |= BAM_FDUP;

            fd->bam_flag_swap[i]  = f;
        }

        for (i = 0; i < 0x1000; i++) {
            int g = 0;

            if (i & BAM_FPAIRED)           g |= CRAM_FPAIRED;
            if (i & BAM_FPROPER_PAIR)  g |= CRAM_FPROPER_PAIR;
            if (i & BAM_FUNMAP)        g |= CRAM_FUNMAP;
            if (i & BAM_FREVERSE)      g |= CRAM_FREVERSE;
            if (i & BAM_FREAD1)        g |= CRAM_FREAD1;
            if (i & BAM_FREAD2)        g |= CRAM_FREAD2;
            if (i & BAM_FSECONDARY)    g |= CRAM_FSECONDARY;
            if (i & BAM_FQCFAIL)       g |= CRAM_FQCFAIL;
            if (i & BAM_FDUP)          g |= CRAM_FDUP;

            fd->cram_flag_swap[i] = g;
        }
    } else {
        /* NOP */
        for (i = 0; i < 0x1000; i++)
            fd->bam_flag_swap[i] = i;
        for (i = 0; i < 0x1000; i++)
            fd->cram_flag_swap[i] = i;
    }

    memset(fd->cram_sub_matrix, 4, 32*32);
    for (i = 0; i < 32; i++) {
        fd->cram_sub_matrix[i]['A'&0x1f]=0;
        fd->cram_sub_matrix[i]['C'&0x1f]=1;
        fd->cram_sub_matrix[i]['G'&0x1f]=2;
        fd->cram_sub_matrix[i]['T'&0x1f]=3;
        fd->cram_sub_matrix[i]['N'&0x1f]=4;
    }
    for (i = 0; i < 20; i+=4) {
        int j;
        for (j = 0; j < 20; j++) {
            fd->cram_sub_matrix["ACGTN"[i>>2]&0x1f][j]=3;
            fd->cram_sub_matrix["ACGTN"[i>>2]&0x1f][j]=3;
            fd->cram_sub_matrix["ACGTN"[i>>2]&0x1f][j]=3;
            fd->cram_sub_matrix["ACGTN"[i>>2]&0x1f][j]=3;
        }
        fd->cram_sub_matrix["ACGTN"[i>>2]&0x1f][CRAM_SUBST_MATRIX[i+0]&0x1f]=0;
        fd->cram_sub_matrix["ACGTN"[i>>2]&0x1f][CRAM_SUBST_MATRIX[i+1]&0x1f]=1;
        fd->cram_sub_matrix["ACGTN"[i>>2]&0x1f][CRAM_SUBST_MATRIX[i+2]&0x1f]=2;
        fd->cram_sub_matrix["ACGTN"[i>>2]&0x1f][CRAM_SUBST_MATRIX[i+3]&0x1f]=3;
    }

    cram_init_varint(&fd->vv, CRAM_MAJOR_VERS(fd->version));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
addq $0x8270, %rdi           # imm = 0x8270
movl $0x100, %edx            # imm = 0x100
movl $0x4, %esi
callq 0x4260
xorl %ebp, %ebp
movb %bpl, 0x82b1(%rbx)
movb %bpl, 0x82d1(%rbx)
movb $0x1, %r14b
movb %r14b, 0x82b3(%rbx)
movb %r14b, 0x82d3(%rbx)
movb $0x2, %r15b
movb %r15b, 0x82b7(%rbx)
movb %r15b, 0x82d7(%rbx)
movb $0x3, %r12b
movb %r12b, 0x82c4(%rbx)
movb %r12b, 0x82e4(%rbx)
leaq 0x8370(%rbx), %rdi
movl $0x100, %edx            # imm = 0x100
movl $0x5, %esi
callq 0x4260
movb %bpl, 0x83b1(%rbx)
movb %bpl, 0x83d1(%rbx)
movb %r14b, 0x83b3(%rbx)
movb %r14b, 0x83d3(%rbx)
movb %r15b, 0x83b7(%rbx)
movb %r15b, 0x83d7(%rbx)
movb %r12b, 0x83c4(%rbx)
movb %r12b, 0x83e4(%rbx)
movb $0x4, %al
movb %al, 0x83be(%rbx)
movb %al, 0x83de(%rbx)
movl 0xc(%rbx), %ebp
movl %ebp, %eax
andl $0xffffff00, %eax       # imm = 0xFFFFFF00
cmpl $0x100, %eax            # imm = 0x100
jne 0x52d61
movdqa 0x41e0a(%rip), %xmm2    # 0x94870
movdqa 0x41e12(%rip), %xmm4    # 0x94880
movdqa 0x481d9(%rip), %xmm15   # 0x9ac50
xorl %eax, %eax
movaps 0x481f0(%rip), %xmm7    # 0x9ac70
movaps %xmm7, %xmm8
shufps $0xdd, %xmm7, %xmm8     # xmm8 = xmm8[1,3],xmm7[1,3]
movdqa 0x481cf(%rip), %xmm1    # 0x9ac60
movdqa 0x41e06(%rip), %xmm14   # 0x948a0
movdqa %xmm15, %xmm13
movdqa %xmm15, %xmm9
movdqa %xmm15, %xmm10
movdqa %xmm15, %xmm11
movdqa %xmm15, %xmm12
movdqa %xmm4, %xmm5
movdqa 0x41dd1(%rip), %xmm6    # 0x94890
pxor %xmm6, %xmm5
movdqa %xmm5, %xmm0
pcmpgtd %xmm7, %xmm0
movdqa %xmm2, %xmm3
pxor %xmm6, %xmm3
shufps $0xdd, %xmm3, %xmm5     # xmm5 = xmm5[1,3],xmm3[1,3]
pcmpgtd %xmm7, %xmm3
movdqa %xmm0, %xmm6
shufps $0x88, %xmm3, %xmm6     # xmm6 = xmm6[0,2],xmm3[0,2]
pcmpeqd %xmm8, %xmm5
pand %xmm6, %xmm5
shufps $0xdd, %xmm3, %xmm0     # xmm0 = xmm0[1,3],xmm3[1,3]
orps %xmm5, %xmm0
movdqa %xmm15, %xmm5
psrld $0x6, %xmm5
pand 0x4817b(%rip), %xmm5    # 0x9ac80
psubd %xmm0, %xmm5
movdqa %xmm15, %xmm0
psrld $0x4, %xmm0
pand %xmm1, %xmm0
movdqa %xmm15, %xmm3
psrld $0x1, %xmm3
pand 0x48167(%rip), %xmm3    # 0x9ac90
por %xmm0, %xmm3
movdqa %xmm13, %xmm0
pslld $0x2, %xmm0
pand 0x48161(%rip), %xmm0    # 0x9aca0
por %xmm3, %xmm0
movdqa %xmm9, %xmm3
pslld $0x4, %xmm3
pand 0x4815b(%rip), %xmm3    # 0x9acb0
por %xmm0, %xmm3
movdqa %xmm10, %xmm0
pslld $0x6, %xmm0
pand 0x48155(%rip), %xmm0    # 0x9acc0
por %xmm3, %xmm0
movdqa %xmm11, %xmm3
pslld $0x8, %xmm3
pand 0x4814f(%rip), %xmm3    # 0x9acd0
por %xmm0, %xmm3
por %xmm5, %xmm3
movdqa %xmm12, %xmm0
pslld $0xa, %xmm0
pand 0x48145(%rip), %xmm0    # 0x9ace0
por %xmm3, %xmm0
movdqu %xmm0, 0x270(%rbx,%rax,4)
addq $0x4, %rax
paddq %xmm14, %xmm4
paddq %xmm14, %xmm2
paddd %xmm1, %xmm15
paddd %xmm1, %xmm13
paddd %xmm1, %xmm9
paddd %xmm1, %xmm10
paddd %xmm1, %xmm11
paddd %xmm1, %xmm12
cmpq $0x200, %rax            # imm = 0x200
jne 0x52ab3
movdqa 0x48068(%rip), %xmm3    # 0x9ac50
xorl %eax, %eax
movdqa 0x480fe(%rip), %xmm4    # 0x9acf0
pxor %xmm5, %xmm5
movdqa 0x45f72(%rip), %xmm6    # 0x98b70
movdqa 0x480fa(%rip), %xmm7    # 0x9ad00
movdqa 0x48101(%rip), %xmm8    # 0x9ad10
movdqa 0x48108(%rip), %xmm9    # 0x9ad20
movdqa 0x4810f(%rip), %xmm10   # 0x9ad30
movdqa 0x48116(%rip), %xmm11   # 0x9ad40
movdqa %xmm3, %xmm12
movdqa %xmm3, %xmm13
movdqa %xmm12, %xmm0
pand %xmm4, %xmm0
movdqa %xmm0, %xmm2
punpckhbw %xmm5, %xmm2    # xmm2 = xmm2[8],xmm5[8],xmm2[9],xmm5[9],xmm2[10],xmm5[10],xmm2[11],xmm5[11],xmm2[12],xmm5[12],xmm2[13],xmm5[13],xmm2[14],xmm5[14],xmm2[15],xmm5[15]
pshuflw $0x1b, %xmm2, %xmm2     # xmm2 = xmm2[3,2,1,0,4,5,6,7]
pshufhw $0x1b, %xmm2, %xmm2     # xmm2 = xmm2[0,1,2,3,7,6,5,4]
punpcklbw %xmm5, %xmm0    # xmm0 = xmm0[0],xmm5[0],xmm0[1],xmm5[1],xmm0[2],xmm5[2],xmm0[3],xmm5[3],xmm0[4],xmm5[4],xmm0[5],xmm5[5],xmm0[6],xmm5[6],xmm0[7],xmm5[7]
pshuflw $0x1b, %xmm0, %xmm0     # xmm0 = xmm0[3,2,1,0,4,5,6,7]
pshufhw $0x1b, %xmm0, %xmm14    # xmm14 = xmm0[0,1,2,3,7,6,5,4]
packuswb %xmm2, %xmm14
movdqa %xmm14, %xmm0
psllw $0x4, %xmm0
psrlw $0x4, %xmm14
pand %xmm6, %xmm14
por %xmm0, %xmm14
movdqa %xmm14, %xmm0
psrlw $0x2, %xmm0
pand %xmm7, %xmm0
pand %xmm7, %xmm14
psllw $0x2, %xmm14
por %xmm0, %xmm14
movdqa %xmm14, %xmm0
psrlw $0x1, %xmm0
pand %xmm8, %xmm0
pand %xmm8, %xmm14
paddb %xmm14, %xmm14
por %xmm0, %xmm14
movdqa %xmm13, %xmm0
paddd %xmm13, %xmm0
pand %xmm9, %xmm0
movdqa %xmm3, %xmm2
psrld $0x2, %xmm2
pand 0x47fb7(%rip), %xmm2    # 0x9ac90
por %xmm0, %xmm2
movdqa %xmm3, %xmm0
psrld $0x4, %xmm0
pand %xmm10, %xmm0
movdqa %xmm3, %xmm15
psrld $0x6, %xmm15
pand %xmm1, %xmm15
por %xmm0, %xmm15
por %xmm2, %xmm15
movdqa %xmm3, %xmm0
psrld $0x8, %xmm0
pand 0x47f6a(%rip), %xmm0    # 0x9ac80
movdqa %xmm3, %xmm2
psrld $0xa, %xmm2
pand %xmm11, %xmm2
por %xmm0, %xmm2
por %xmm15, %xmm2
psrld $0x17, %xmm14
por %xmm14, %xmm2
movdqu %xmm2, 0x4270(%rbx,%rax,4)
addq $0x4, %rax
paddd %xmm1, %xmm3
paddd %xmm1, %xmm12
paddd %xmm1, %xmm13
cmpq $0x1000, %rax           # imm = 0x1000
jne 0x52c34
jmp 0x52daf
movdqa 0x47ee7(%rip), %xmm1    # 0x9ac50
xorl %eax, %eax
movdqa 0x47eed(%rip), %xmm0    # 0x9ac60
movdqu %xmm1, 0x270(%rbx,%rax,4)
addq $0x4, %rax
paddd %xmm0, %xmm1
cmpq $0x1000, %rax           # imm = 0x1000
jne 0x52d73
movdqa 0x47ebc(%rip), %xmm1    # 0x9ac50
xorl %eax, %eax
movdqu %xmm1, 0x4270(%rbx,%rax,4)
addq $0x4, %rax
paddd %xmm0, %xmm1
cmpq $0x1000, %rax           # imm = 0x1000
jne 0x52d96
leaq 0x8470(%rbx), %r14
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
movl $0x4, %esi
callq 0x4260
xorl %eax, %eax
movb $0x0, 0x8471(%rbx,%rax)
movb $0x1, 0x8473(%rbx,%rax)
movb $0x2, 0x8477(%rbx,%rax)
movb $0x3, 0x8484(%rbx,%rax)
movb $0x4, 0x847e(%rbx,%rax)
addq $0x20, %rax
cmpq $0x400, %rax            # imm = 0x400
jne 0x52dca
movq $-0x4, %rax
leaq 0x46fe9(%rip), %rcx     # 0x99df5
movaps 0x47f3d(%rip), %xmm0    # 0x9ad50
leaq 0x46e50(%rip), %rdx     # 0x99c6a
movzbl (%rcx), %esi
andl $0x1f, %esi
shll $0x5, %esi
movups %xmm0, (%r14,%rsi)
movl $0x3030303, 0x10(%r14,%rsi) # imm = 0x3030303
movzbl 0x4(%rax,%rdx), %edi
andl $0x1f, %edi
addq %r14, %rsi
movb $0x0, (%rdi,%rsi)
movzbl 0x5(%rax,%rdx), %edi
andl $0x1f, %edi
movb $0x1, (%rdi,%rsi)
movzbl 0x6(%rax,%rdx), %edi
andl $0x1f, %edi
movb $0x2, (%rdi,%rsi)
movzbl 0x7(%rax,%rdx), %edi
andl $0x1f, %edi
movb $0x3, (%rdi,%rsi)
addq $0x4, %rax
incq %rcx
cmpq $0x10, %rax
jb 0x52e1a
cmpl $0x400, %ebp            # imm = 0x400
leaq 0x1e34(%rip), %rax      # 0x54cb2
leaq 0x295c(%rip), %rdx      # 0x557e1
cmovlq %rdx, %rax
movq %rax, 0x10(%rsp)
leaq 0x1ecb(%rip), %rax      # 0x54d60
cmovlq %rdx, %rax
movq %rax, 0x8(%rsp)
leaq 0x1f74(%rip), %rax      # 0x54e19
leaq 0x2a26(%rip), %rdi      # 0x558d2
cmovlq %rdi, %rax
movq %rax, (%rsp)
leaq 0x1ff6(%rip), %rsi      # 0x54eb1
cmovlq %rdi, %rsi
leaq 0x2092(%rip), %rdi      # 0x54f58
leaq 0x2bf7(%rip), %r9       # 0x55ac4
cmovlq %r9, %rdi
leaq 0x21b5(%rip), %r8       # 0x5508d
cmovlq %r9, %r8
leaq 0x22e7(%rip), %r9       # 0x551ca
leaq 0x2c6a(%rip), %r11      # 0x55b54
cmovlq %r11, %r9
leaq 0x22da(%rip), %r10      # 0x551cf
cmovlq %r11, %r10
leaq 0x22df(%rip), %r11      # 0x551df
leaq -0x6f86(%rip), %r15     # 0x4bf81
cmovlq %r15, %r11
leaq 0x2429(%rip), %r14      # 0x5533b
cmovlq %r15, %r14
leaq 0x2582(%rip), %r15      # 0x5549f
leaq -0x6dee(%rip), %r12     # 0x4c136
cmovlq %r12, %r15
leaq 0x2610(%rip), %r13      # 0x5553f
cmovlq %r12, %r13
leaq 0x26b0(%rip), %r12      # 0x555ea
leaq 0x2dda(%rip), %rbp      # 0x55d1b
cmovgeq %r12, %rbp
leaq 0x26b3(%rip), %r12      # 0x555ff
leaq -0x7fbf(%rip), %rax     # 0x4af94
cmovlq %rax, %r12
leaq 0x2736(%rip), %rcx      # 0x55694
cmovlq %rax, %rcx
leaq 0x27dc(%rip), %rdx      # 0x55745
leaq -0x7450(%rip), %rax     # 0x4bb20
cmovgeq %rdx, %rax
movq 0x10(%rsp), %rdx
movq %rdx, 0x89a8(%rbx)
movq 0x8(%rsp), %rdx
movq %rdx, 0x89b0(%rbx)
movq (%rsp), %rdx
movq %rdx, 0x89b8(%rbx)
movq %rsi, 0x89c0(%rbx)
movq %rdi, 0x89c8(%rbx)
movq %r8, 0x89d0(%rbx)
movq %r9, 0x89d8(%rbx)
movq %r10, 0x89e0(%rbx)
movq %r11, 0x89e8(%rbx)
movq %r14, 0x89f0(%rbx)
movq %r15, 0x89f8(%rbx)
movq %r13, 0x8a00(%rbx)
movq %rbp, 0x8a08(%rbx)
movq %r12, 0x8990(%rbx)
movq %rcx, 0x8998(%rbx)
movq %rax, 0x89a0(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq