// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
addq $0x8270, %rdi           # imm = 0x8270
movl $0x4, %esi
movl $0x100, %edx            # imm = 0x100
callq 0x4250
movq -0x8(%rbp), %rax
movb $0x0, 0x82b1(%rax)
movq -0x8(%rbp), %rax
movb $0x0, 0x82d1(%rax)
movq -0x8(%rbp), %rax
movb $0x1, 0x82b3(%rax)
movq -0x8(%rbp), %rax
movb $0x1, 0x82d3(%rax)
movq -0x8(%rbp), %rax
movb $0x2, 0x82b7(%rax)
movq -0x8(%rbp), %rax
movb $0x2, 0x82d7(%rax)
movq -0x8(%rbp), %rax
movb $0x3, 0x82c4(%rax)
movq -0x8(%rbp), %rax
movb $0x3, 0x82e4(%rax)
movq -0x8(%rbp), %rdi
addq $0x8370, %rdi           # imm = 0x8370
movl $0x5, %esi
movl $0x100, %edx            # imm = 0x100
callq 0x4250
movq -0x8(%rbp), %rax
movb $0x0, 0x83b1(%rax)
movq -0x8(%rbp), %rax
movb $0x0, 0x83d1(%rax)
movq -0x8(%rbp), %rax
movb $0x1, 0x83b3(%rax)
movq -0x8(%rbp), %rax
movb $0x1, 0x83d3(%rax)
movq -0x8(%rbp), %rax
movb $0x2, 0x83b7(%rax)
movq -0x8(%rbp), %rax
movb $0x2, 0x83d7(%rax)
movq -0x8(%rbp), %rax
movb $0x3, 0x83c4(%rax)
movq -0x8(%rbp), %rax
movb $0x3, 0x83e4(%rax)
movq -0x8(%rbp), %rax
movb $0x4, 0x83be(%rax)
movq -0x8(%rbp), %rax
movb $0x4, 0x83de(%rax)
movq -0x8(%rbp), %rax
movl 0xc(%rax), %eax
sarl $0x8, %eax
cmpl $0x1, %eax
jne 0x794b1
movl $0x0, -0xc(%rbp)
cmpl $0x200, -0xc(%rbp)      # imm = 0x200
jge 0x793b4
movl $0x0, -0x10(%rbp)
movl -0xc(%rbp), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x792ea
movl -0x10(%rbp), %eax
orl $0x1, %eax
movl %eax, -0x10(%rbp)
movl -0xc(%rbp), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x79300
movl -0x10(%rbp), %eax
orl $0x2, %eax
movl %eax, -0x10(%rbp)
movl -0xc(%rbp), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0x79314
movl -0x10(%rbp), %eax
orl $0x4, %eax
movl %eax, -0x10(%rbp)
movl -0xc(%rbp), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x79328
movl -0x10(%rbp), %eax
orl $0x10, %eax
movl %eax, -0x10(%rbp)
movl -0xc(%rbp), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x7933c
movl -0x10(%rbp), %eax
orl $0x40, %eax
movl %eax, -0x10(%rbp)
movl -0xc(%rbp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x79352
movl -0x10(%rbp), %eax
orl $0x80, %eax
movl %eax, -0x10(%rbp)
movl -0xc(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x79368
movl -0x10(%rbp), %eax
orl $0x100, %eax            # imm = 0x100
movl %eax, -0x10(%rbp)
movl -0xc(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x7937e
movl -0x10(%rbp), %eax
orl $0x200, %eax            # imm = 0x200
movl %eax, -0x10(%rbp)
movl -0xc(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x79394
movl -0x10(%rbp), %eax
orl $0x400, %eax            # imm = 0x400
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %edx
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
movl %edx, 0x270(%rax,%rcx,4)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x792c0
movl $0x0, -0xc(%rbp)
cmpl $0x1000, -0xc(%rbp)     # imm = 0x1000
jge 0x794af
movl $0x0, -0x14(%rbp)
movl -0xc(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x793e5
movl -0x14(%rbp), %eax
orl $0x100, %eax            # imm = 0x100
movl %eax, -0x14(%rbp)
movl -0xc(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x793fb
movl -0x14(%rbp), %eax
orl $0x80, %eax
movl %eax, -0x14(%rbp)
movl -0xc(%rbp), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x7940f
movl -0x14(%rbp), %eax
orl $0x40, %eax
movl %eax, -0x14(%rbp)
movl -0xc(%rbp), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x79423
movl -0x14(%rbp), %eax
orl $0x20, %eax
movl %eax, -0x14(%rbp)
movl -0xc(%rbp), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0x79437
movl -0x14(%rbp), %eax
orl $0x10, %eax
movl %eax, -0x14(%rbp)
movl -0xc(%rbp), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x7944d
movl -0x14(%rbp), %eax
orl $0x8, %eax
movl %eax, -0x14(%rbp)
movl -0xc(%rbp), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x79463
movl -0x14(%rbp), %eax
orl $0x4, %eax
movl %eax, -0x14(%rbp)
movl -0xc(%rbp), %eax
andl $0x200, %eax            # imm = 0x200
cmpl $0x0, %eax
je 0x79479
movl -0x14(%rbp), %eax
orl $0x2, %eax
movl %eax, -0x14(%rbp)
movl -0xc(%rbp), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x7948f
movl -0x14(%rbp), %eax
orl $0x1, %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %edx
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
movl %edx, 0x4270(%rax,%rcx,4)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x793bb
jmp 0x7950d
movl $0x0, -0xc(%rbp)
cmpl $0x1000, -0xc(%rbp)     # imm = 0x1000
jge 0x794de
movl -0xc(%rbp), %edx
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
movl %edx, 0x270(%rax,%rcx,4)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x794b8
movl $0x0, -0xc(%rbp)
cmpl $0x1000, -0xc(%rbp)     # imm = 0x1000
jge 0x7950b
movl -0xc(%rbp), %edx
movq -0x8(%rbp), %rax
movslq -0xc(%rbp), %rcx
movl %edx, 0x4270(%rax,%rcx,4)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x794e5
jmp 0x7950d
movq -0x8(%rbp), %rdi
addq $0x8470, %rdi           # imm = 0x8470
movl $0x4, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x4250
movl $0x0, -0xc(%rbp)
cmpl $0x20, -0xc(%rbp)
jge 0x795c3
movq -0x8(%rbp), %rax
addq $0x8470, %rax           # imm = 0x8470
movslq -0xc(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movb $0x0, 0x1(%rax)
movq -0x8(%rbp), %rax
addq $0x8470, %rax           # imm = 0x8470
movslq -0xc(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movb $0x1, 0x3(%rax)
movq -0x8(%rbp), %rax
addq $0x8470, %rax           # imm = 0x8470
movslq -0xc(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movb $0x2, 0x7(%rax)
movq -0x8(%rbp), %rax
addq $0x8470, %rax           # imm = 0x8470
movslq -0xc(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movb $0x3, 0x14(%rax)
movq -0x8(%rbp), %rax
addq $0x8470, %rax           # imm = 0x8470
movslq -0xc(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movb $0x4, 0xe(%rax)
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x7952e
movl $0x0, -0xc(%rbp)
cmpl $0x14, -0xc(%rbp)
jge 0x797f1
movl $0x0, -0x18(%rbp)
cmpl $0x14, -0x18(%rbp)
jge 0x796bf
movq -0x8(%rbp), %rax
addq $0x8470, %rax           # imm = 0x8470
movl -0xc(%rbp), %ecx
sarl $0x2, %ecx
movslq %ecx, %rdx
leaq 0x7b0a6(%rip), %rcx     # 0xf46a5
movsbl (%rcx,%rdx), %ecx
andl $0x1f, %ecx
movslq %ecx, %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movslq -0x18(%rbp), %rcx
movb $0x3, (%rax,%rcx)
movq -0x8(%rbp), %rax
addq $0x8470, %rax           # imm = 0x8470
movl -0xc(%rbp), %ecx
sarl $0x2, %ecx
movslq %ecx, %rdx
leaq 0x7b073(%rip), %rcx     # 0xf46a5
movsbl (%rcx,%rdx), %ecx
andl $0x1f, %ecx
movslq %ecx, %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movslq -0x18(%rbp), %rcx
movb $0x3, (%rax,%rcx)
movq -0x8(%rbp), %rax
addq $0x8470, %rax           # imm = 0x8470
movl -0xc(%rbp), %ecx
sarl $0x2, %ecx
movslq %ecx, %rdx
leaq 0x7b040(%rip), %rcx     # 0xf46a5
movsbl (%rcx,%rdx), %ecx
andl $0x1f, %ecx
movslq %ecx, %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movslq -0x18(%rbp), %rcx
movb $0x3, (%rax,%rcx)
movq -0x8(%rbp), %rax
addq $0x8470, %rax           # imm = 0x8470
movl -0xc(%rbp), %ecx
sarl $0x2, %ecx
movslq %ecx, %rdx
leaq 0x7b00d(%rip), %rcx     # 0xf46a5
movsbl (%rcx,%rdx), %ecx
andl $0x1f, %ecx
movslq %ecx, %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movslq -0x18(%rbp), %rcx
movb $0x3, (%rax,%rcx)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x795db
movq -0x8(%rbp), %rax
addq $0x8470, %rax           # imm = 0x8470
movl -0xc(%rbp), %ecx
sarl $0x2, %ecx
movslq %ecx, %rdx
leaq 0x7afcc(%rip), %rcx     # 0xf46a5
movsbl (%rcx,%rdx), %ecx
andl $0x1f, %ecx
movslq %ecx, %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl -0xc(%rbp), %ecx
addl $0x0, %ecx
movslq %ecx, %rdx
leaq 0x7ae20(%rip), %rcx     # 0xf451a
movsbl (%rcx,%rdx), %ecx
andl $0x1f, %ecx
movslq %ecx, %rcx
movb $0x0, (%rax,%rcx)
movq -0x8(%rbp), %rax
addq $0x8470, %rax           # imm = 0x8470
movl -0xc(%rbp), %ecx
sarl $0x2, %ecx
movslq %ecx, %rdx
leaq 0x7af83(%rip), %rcx     # 0xf46a5
movsbl (%rcx,%rdx), %ecx
andl $0x1f, %ecx
movslq %ecx, %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl -0xc(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rdx
leaq 0x7add7(%rip), %rcx     # 0xf451a
movsbl (%rcx,%rdx), %ecx
andl $0x1f, %ecx
movslq %ecx, %rcx
movb $0x1, (%rax,%rcx)
movq -0x8(%rbp), %rax
addq $0x8470, %rax           # imm = 0x8470
movl -0xc(%rbp), %ecx
sarl $0x2, %ecx
movslq %ecx, %rdx
leaq 0x7af3a(%rip), %rcx     # 0xf46a5
movsbl (%rcx,%rdx), %ecx
andl $0x1f, %ecx
movslq %ecx, %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl -0xc(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rdx
leaq 0x7ad8e(%rip), %rcx     # 0xf451a
movsbl (%rcx,%rdx), %ecx
andl $0x1f, %ecx
movslq %ecx, %rcx
movb $0x2, (%rax,%rcx)
movq -0x8(%rbp), %rax
addq $0x8470, %rax           # imm = 0x8470
movl -0xc(%rbp), %ecx
sarl $0x2, %ecx
movslq %ecx, %rdx
leaq 0x7aef1(%rip), %rcx     # 0xf46a5
movsbl (%rcx,%rdx), %ecx
andl $0x1f, %ecx
movslq %ecx, %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl -0xc(%rbp), %ecx
addl $0x3, %ecx
movslq %ecx, %rdx
leaq 0x7ad45(%rip), %rcx     # 0xf451a
movsbl (%rcx,%rdx), %ecx
andl $0x1f, %ecx
movslq %ecx, %rcx
movb $0x3, (%rax,%rcx)
movl -0xc(%rbp), %eax
addl $0x4, %eax
movl %eax, -0xc(%rbp)
jmp 0x795ca
movq -0x8(%rbp), %rdi
addq $0x8990, %rdi           # imm = 0x8990
movq -0x8(%rbp), %rax
movl 0xc(%rax), %esi
sarl $0x8, %esi
callq 0x7cb60
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)