// File: /workspace/github_c_makefile_star2_O1/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 %r14d, %r14d
movb %r14b, 0x82b1(%rbx)
movb %r14b, 0x82d1(%rbx)
movb $0x1, %bpl
movb %bpl, 0x82b3(%rbx)
movb %bpl, 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 %r14b, 0x83b1(%rbx)
movb %r14b, 0x83d1(%rbx)
movb %bpl, 0x83b3(%rbx)
movb %bpl, 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 0x55716
movl $0x100, %eax            # imm = 0x100
movl $0x400, %ecx            # imm = 0x400
xorl %edx, %edx
xorl %esi, %esi
xorl %edi, %edi
xorl %r8d, %r8d
xorl %r9d, %r9d
xorl %r10d, %r10d
cmpq $0x100, %r9             # imm = 0x100
setae %r10b
movl %r9d, %r11d
shrl $0x6, %r11d
andl $0x2, %r11d
orl %r10d, %r11d
movl %r9d, %r10d
shrl $0x4, %r10d
andl $0x4, %r10d
orl %r11d, %r10d
movl %r9d, %r11d
shrl %r11d
andl $0x10, %r11d
orl %r10d, %r11d
movl %r14d, %r10d
andl $0x40, %r10d
orl %r11d, %r10d
movl %edx, %r11d
andl $0x80, %r11d
orl %r10d, %r11d
movl %esi, %r10d
andl %eax, %r10d
orl %r11d, %r10d
movl %edi, %r11d
andl $0x200, %r11d           # imm = 0x200
movl %r8d, %r15d
andl %ecx, %r15d
orl %r11d, %r15d
orl %r10d, %r15d
movl %r15d, 0x270(%rbx,%r9,4)
incq %r9
addl %ecx, %r8d
addl %eax, %edi
addl $0x40, %esi
addl $0x10, %edx
addl $0x4, %r14d
cmpq $0x200, %r9             # imm = 0x200
jne 0x555c4
xorl %eax, %eax
movl $0xf0f, %ecx            # imm = 0xF0F
movl $0x3333, %edx           # imm = 0x3333
xorl %esi, %esi
movl %esi, %edi
andl $0x7, %edi
rolw $0x8, %di
movl %edi, %r8d
shrl $0x4, %r8d
andl %ecx, %r8d
andl %ecx, %edi
shll $0x4, %edi
orl %r8d, %edi
movl %edi, %r8d
andl %edx, %r8d
shrl $0x2, %edi
andl %edx, %edi
leal (%rdi,%r8,4), %edi
movl %edi, %r8d
andl $0x5540, %r8d           # imm = 0x5540
shrl %edi
andl $0x5500, %edi           # imm = 0x5500
leal (%rdi,%r8,2), %edi
shrl $0x7, %edi
movl %eax, %r8d
andl $0x20, %r8d
movl %esi, %r9d
shrl $0x2, %r9d
andl $0x10, %r9d
orl %r8d, %r9d
movl %esi, %r8d
shrl $0x4, %r8d
andl $0x8, %r8d
orl %r9d, %r8d
movl %esi, %r9d
shrl $0x6, %r9d
andl $0x4, %r9d
orl %r8d, %r9d
movl %esi, %r8d
shrl $0x8, %r8d
andl $0x2, %r8d
orl %r9d, %r8d
movl %esi, %r9d
shrl $0xa, %r9d
andl $0x1, %r9d
orl %r8d, %r9d
orl %edi, %r9d
movl %r9d, 0x4270(%rbx,%rsi,4)
incq %rsi
addl $0x2, %eax
cmpq $0x1000, %rsi           # imm = 0x1000
jne 0x55666
jmp 0x5573e
xorl %eax, %eax
movl %eax, 0x270(%rbx,%rax,4)
incq %rax
cmpq $0x1000, %rax           # imm = 0x1000
jne 0x55718
xorl %eax, %eax
movl %eax, 0x4270(%rbx,%rax,4)
incq %rax
cmpq $0x1000, %rax           # imm = 0x1000
jne 0x5572c
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 0x55759
movq $-0x4, %rax
leaq 0x475fa(%rip), %rcx     # 0x9cd95
movaps 0x4839e(%rip), %xmm0    # 0x9db40
leaq 0x47461(%rip), %rdx     # 0x9cc0a
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 0x557a9
cmpl $0x400, %ebp            # imm = 0x400
leaq 0x1e55(%rip), %rax      # 0x57662
leaq 0x2954(%rip), %rdx      # 0x58168
cmovlq %rdx, %rax
movq %rax, 0x10(%rsp)
leaq 0x1eea(%rip), %rax      # 0x5770e
cmovlq %rdx, %rax
movq %rax, 0x8(%rsp)
leaq 0x1f92(%rip), %rax      # 0x577c6
leaq 0x2a1e(%rip), %rdi      # 0x58259
cmovlq %rdi, %rax
movq %rax, (%rsp)
leaq 0x2014(%rip), %rsi      # 0x5785e
cmovlq %rdi, %rsi
leaq 0x20b0(%rip), %rdi      # 0x57905
leaq 0x2bef(%rip), %r9       # 0x5844b
cmovlq %r9, %rdi
leaq 0x21d3(%rip), %r8       # 0x57a3a
cmovlq %r9, %r8
leaq 0x2305(%rip), %r9       # 0x57b77
leaq 0x2c62(%rip), %r11      # 0x584db
cmovlq %r11, %r9
leaq 0x22f8(%rip), %r10      # 0x57b7c
cmovlq %r11, %r10
leaq 0x22fd(%rip), %r11      # 0x57b8c
leaq -0x714d(%rip), %r15     # 0x4e749
cmovlq %r15, %r11
leaq 0x2441(%rip), %r14      # 0x57ce2
cmovlq %r15, %r14
leaq 0x2594(%rip), %r15      # 0x57e40
leaq -0x6fbb(%rip), %r12     # 0x4e8f8
cmovlq %r12, %r15
leaq 0x261d(%rip), %r13      # 0x57edb
cmovlq %r12, %r13
leaq 0x26b6(%rip), %r12      # 0x57f7f
leaq 0x2dd2(%rip), %rbp      # 0x586a2
cmovgeq %r12, %rbp
leaq 0x26b9(%rip), %r12      # 0x57f94
leaq -0x8135(%rip), %rax     # 0x4d7ad
cmovlq %rax, %r12
leaq 0x2737(%rip), %rcx      # 0x58024
cmovlq %rax, %rcx
leaq 0x27d8(%rip), %rdx      # 0x580d0
leaq -0x7620(%rip), %rax     # 0x4e2df
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