// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/test/sam.c
// Function: test_bam_set1_full
static void test_bam_set1_full(void)
{
    const char *qname = "!??AAA~~~~";
    const uint32_t cigar[] = { 6 << BAM_CIGAR_SHIFT | BAM_CMATCH, 2 << BAM_CIGAR_SHIFT | BAM_CINS, 2 << BAM_CIGAR_SHIFT | BAM_CMATCH };
    const char *seq = "TGGACTACGA";
    const char *qual = "DBBBB+=7=0";

    int r, i;
    bam1_t *bam = NULL;
    bam = bam_init1();
    VERIFY(bam != NULL, "failed to initialize BAM struct.");

    r = bam_set1(bam, strlen(qname), qname,
                 BAM_FREVERSE, 1, 1000, 42,
                 sizeof(cigar) / 4, cigar, 2, 2000, 3000,
                 strlen(seq), seq, qual, 64);
    // expected number of bytes written is qname: 12, cigar: 12, sequence: 5, qual: 10, aux: 0.
    VERIFY(r == 39, "call to bam_set1() failed or did not write the correct number of bytes.");

    VERIFY(bam->core.l_qname == 12, "l_qname should include terminating null and be padded to the nearest 32-bit boundary.");
    VERIFY(bam->core.l_extranul == 1, "l_extranul not set correctly");
    VERIFY(strcmp(bam_get_qname(bam), qname) == 0, "qname not set correctly.");

    VERIFY(bam->core.n_cigar == sizeof(cigar) / 4, "n_cigar not set correctly.");
    VERIFY(memcmp(bam_get_cigar(bam), cigar, sizeof(cigar)) == 0, "cigar not set correctly.");

    VERIFY(bam->core.l_qseq == strlen(seq), "l_seq not set correctly.");
    for (i = 0; i < strlen(seq); i++) {
        VERIFY(bam_seqi(bam_get_seq(bam), i) == seq_nt16_table[(uint8_t)seq[i]], "seq not set correctly.");
    }
    VERIFY(memcmp(bam_get_qual(bam), qual, strlen(seq)) == 0, "qual not set correctly.");

    VERIFY(bam->core.pos == 1000, "pos not set correctly.");
    VERIFY(bam->core.tid == 1, "tid not set correctly.");
    VERIFY(bam->core.bin == hts_reg2bin(1000, 1010, 14, 5), "bin not set correctly.");
    VERIFY(bam->core.qual == 42, "mapq not set correctly.");
    VERIFY(bam->core.flag == BAM_FREVERSE, "flag not set correctly.");
    VERIFY(bam->core.mtid == 2, "mtid not set correctly.");
    VERIFY(bam->core.mpos == 2000, "mpos not set correctly.");
    VERIFY(bam->core.isize == 3000, "isize not set correctly.");
    VERIFY(bam_get_l_aux(bam) == 0, "l_aux not set correctly.");
    VERIFY(bam->m_data - bam->l_data >= 64, "not enough memory allocated for aux data.");

cleanup:
    if (bam != NULL) bam_destroy1(bam);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0xc8, %rsp
leaq 0xe7c9d(%rip), %rax     # 0xf2cf0
movq %rax, -0x10(%rbp)
movq 0xe5942(%rip), %rax     # 0xf09a0
movq %rax, -0x1c(%rbp)
movl 0xe5940(%rip), %eax     # 0xf09a8
movl %eax, -0x14(%rbp)
leaq 0xe7c89(%rip), %rax     # 0xf2cfb
movq %rax, -0x28(%rbp)
leaq 0xe7c89(%rip), %rax     # 0xf2d06
movq %rax, -0x30(%rbp)
movq $0x0, -0x40(%rbp)
callq 0x37e90
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0xb0ba
leaq 0xe8b17(%rip), %rdi     # 0xf3bb7
leaq 0xe7c6a(%rip), %rsi     # 0xf2d11
leaq 0xe7a70(%rip), %rdx     # 0xf2b1e
movb $0x0, %al
callq 0x5b50
jmp 0xb61c
movq -0x40(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rdi
callq 0x41a0
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
leaq -0x1c(%rbp), %rbx
movq -0x28(%rbp), %rdi
callq 0x41a0
movq -0x58(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq %rax, %r11
movq -0x28(%rbp), %r10
movq -0x30(%rbp), %rax
movl $0x10, %ecx
movl $0x1, %r8d
movl $0x3e8, %r9d            # imm = 0x3E8
movl $0x2a, (%rsp)
movq $0x3, 0x8(%rsp)
movq %rbx, 0x10(%rsp)
movl $0x2, 0x18(%rsp)
movq $0x7d0, 0x20(%rsp)      # imm = 0x7D0
movq $0xbb8, 0x28(%rsp)      # imm = 0xBB8
movq %r11, 0x30(%rsp)
movq %r10, 0x38(%rsp)
movq %rax, 0x40(%rsp)
movq $0x40, 0x48(%rsp)
callq 0x382b0
movl %eax, -0x34(%rbp)
cmpl $0x27, -0x34(%rbp)
je 0xb182
leaq 0xe8a4f(%rip), %rdi     # 0xf3bb7
leaq 0xe7ba2(%rip), %rsi     # 0xf2d11
leaq 0xe79c9(%rip), %rdx     # 0xf2b3f
movb $0x0, %al
callq 0x5b50
jmp 0xb61c
movq -0x40(%rbp), %rax
movzwl 0x12(%rax), %eax
cmpl $0xc, %eax
je 0xb1b0
leaq 0xe8a21(%rip), %rdi     # 0xf3bb7
leaq 0xe7b74(%rip), %rsi     # 0xf2d11
leaq 0xe79e3(%rip), %rdx     # 0xf2b87
movb $0x0, %al
callq 0x5b50
jmp 0xb61c
movq -0x40(%rbp), %rax
movzbl 0xf(%rax), %eax
cmpl $0x1, %eax
je 0xb1de
leaq 0xe89f3(%rip), %rdi     # 0xf3bb7
leaq 0xe7b46(%rip), %rsi     # 0xf2d11
leaq 0xe7a0b(%rip), %rdx     # 0xf2bdd
movb $0x0, %al
callq 0x5b50
jmp 0xb61c
movq -0x40(%rbp), %rax
movq 0x38(%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x4690
cmpl $0x0, %eax
je 0xb215
leaq 0xe89bc(%rip), %rdi     # 0xf3bb7
leaq 0xe7b0f(%rip), %rsi     # 0xf2d11
leaq 0xe79f1(%rip), %rdx     # 0xf2bfa
movb $0x0, %al
callq 0x5b50
jmp 0xb61c
movq -0x40(%rbp), %rax
movl 0x14(%rax), %eax
cmpq $0x3, %rax
je 0xb243
leaq 0xe898e(%rip), %rdi     # 0xf3bb7
leaq 0xe7ae1(%rip), %rsi     # 0xf2d11
leaq 0xe7a23(%rip), %rdx     # 0xf2c5a
movb $0x0, %al
callq 0x5b50
jmp 0xb61c
movq -0x40(%rbp), %rax
movq 0x38(%rax), %rdi
movq -0x40(%rbp), %rax
movzwl 0x12(%rax), %eax
cltq
addq %rax, %rdi
leaq -0x1c(%rbp), %rsi
movl $0xc, %edx
callq 0x41b0
cmpl $0x0, %eax
je 0xb28c
leaq 0xe8945(%rip), %rdi     # 0xf3bb7
leaq 0xe7a98(%rip), %rsi     # 0xf2d11
leaq 0xe79dc(%rip), %rdx     # 0xf2c5c
movb $0x0, %al
callq 0x5b50
jmp 0xb61c
movq -0x40(%rbp), %rax
movslq 0x18(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x28(%rbp), %rdi
callq 0x41a0
movq %rax, %rcx
movq -0x60(%rbp), %rax
cmpq %rcx, %rax
je 0xb2ce
leaq 0xe8903(%rip), %rdi     # 0xf3bb7
leaq 0xe7a56(%rip), %rsi     # 0xf2d11
leaq 0xe79fc(%rip), %rdx     # 0xf2cbe
movb $0x0, %al
callq 0x5b50
jmp 0xb61c
movl $0x0, -0x38(%rbp)
movslq -0x38(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x28(%rbp), %rdi
callq 0x41a0
movq %rax, %rcx
movq -0x68(%rbp), %rax
cmpq %rcx, %rax
jae 0xb386
movq -0x40(%rbp), %rax
movq 0x38(%rax), %rax
movq -0x40(%rbp), %rcx
movl 0x14(%rcx), %ecx
shll $0x2, %ecx
movl %ecx, %ecx
addq %rcx, %rax
movq -0x40(%rbp), %rcx
movzwl 0x12(%rcx), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movl -0x38(%rbp), %ecx
sarl %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
movl -0x38(%rbp), %ecx
xorl $-0x1, %ecx
andl $0x1, %ecx
shll $0x2, %ecx
sarl %cl, %eax
andl $0xf, %eax
movq -0x28(%rbp), %rcx
movslq -0x38(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
movl %ecx, %edx
leaq 0xe9993(%rip), %rcx     # 0xf4ce0
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
je 0xb376
leaq 0xe885b(%rip), %rdi     # 0xf3bb7
leaq 0xe79ae(%rip), %rsi     # 0xf2d11
leaq 0xe7956(%rip), %rdx     # 0xf2cc0
movb $0x0, %al
callq 0x5b50
jmp 0xb61c
jmp 0xb378
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0xb2d5
movq -0x40(%rbp), %rax
movq 0x38(%rax), %rax
movq -0x40(%rbp), %rcx
movl 0x14(%rcx), %ecx
shll $0x2, %ecx
movl %ecx, %ecx
addq %rcx, %rax
movq -0x40(%rbp), %rcx
movzwl 0x12(%rcx), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq -0x40(%rbp), %rcx
movl 0x18(%rcx), %ecx
addl $0x1, %ecx
sarl %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x78(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x28(%rbp), %rdi
callq 0x41a0
movq -0x78(%rbp), %rdi
movq -0x70(%rbp), %rsi
movq %rax, %rdx
callq 0x41b0
cmpl $0x0, %eax
je 0xb408
leaq 0xe87c9(%rip), %rdi     # 0xf3bb7
leaq 0xe791c(%rip), %rsi     # 0xf2d11
leaq 0xe7928(%rip), %rdx     # 0xf2d24
movb $0x0, %al
callq 0x5b50
jmp 0xb61c
movq -0x40(%rbp), %rax
cmpq $0x3e8, (%rax)          # imm = 0x3E8
je 0xb436
leaq 0xe879b(%rip), %rdi     # 0xf3bb7
leaq 0xe78ee(%rip), %rsi     # 0xf2d11
leaq 0xe7864(%rip), %rdx     # 0xf2c8e
movb $0x0, %al
callq 0x5b50
jmp 0xb61c
movq -0x40(%rbp), %rax
cmpl $0x1, 0x8(%rax)
je 0xb461
leaq 0xe8770(%rip), %rdi     # 0xf3bb7
leaq 0xe78c3(%rip), %rsi     # 0xf2d11
leaq 0xe7821(%rip), %rdx     # 0xf2c76
movb $0x0, %al
callq 0x5b50
jmp 0xb61c
movq -0x40(%rbp), %rax
movzwl 0xc(%rax), %eax
movl %eax, -0x7c(%rbp)
movl $0x3e8, %edi            # imm = 0x3E8
movl $0x3f2, %esi            # imm = 0x3F2
movl $0xe, %edx
movl $0x5, %ecx
callq 0xec30
movl %eax, %ecx
movl -0x7c(%rbp), %eax
cmpl %ecx, %eax
je 0xb4af
leaq 0xe8722(%rip), %rdi     # 0xf3bb7
leaq 0xe7875(%rip), %rsi     # 0xf2d11
leaq 0xe7770(%rip), %rdx     # 0xf2c13
movb $0x0, %al
callq 0x5b50
jmp 0xb61c
movq -0x40(%rbp), %rax
movzbl 0xe(%rax), %eax
cmpl $0x2a, %eax
je 0xb4dd
leaq 0xe86f4(%rip), %rdi     # 0xf3bb7
leaq 0xe7847(%rip), %rsi     # 0xf2d11
leaq 0xe7759(%rip), %rdx     # 0xf2c2a
movb $0x0, %al
callq 0x5b50
jmp 0xb61c
movq -0x40(%rbp), %rax
movzwl 0x10(%rax), %eax
cmpl $0x10, %eax
je 0xb50b
leaq 0xe86c6(%rip), %rdi     # 0xf3bb7
leaq 0xe7819(%rip), %rsi     # 0xf2d11
leaq 0xe7743(%rip), %rdx     # 0xf2c42
movb $0x0, %al
callq 0x5b50
jmp 0xb61c
movq -0x40(%rbp), %rax
cmpl $0x2, 0x1c(%rax)
je 0xb536
leaq 0xe869b(%rip), %rdi     # 0xf3bb7
leaq 0xe77ee(%rip), %rsi     # 0xf2d11
leaq 0xe774b(%rip), %rdx     # 0xf2c75
movb $0x0, %al
callq 0x5b50
jmp 0xb61c
movq -0x40(%rbp), %rax
cmpq $0x7d0, 0x20(%rax)      # imm = 0x7D0
je 0xb565
leaq 0xe866c(%rip), %rdi     # 0xf3bb7
leaq 0xe77bf(%rip), %rsi     # 0xf2d11
leaq 0xe7734(%rip), %rdx     # 0xf2c8d
movb $0x0, %al
callq 0x5b50
jmp 0xb61c
movq -0x40(%rbp), %rax
cmpq $0xbb8, 0x28(%rax)      # imm = 0xBB8
je 0xb594
leaq 0xe863d(%rip), %rdi     # 0xf3bb7
leaq 0xe7790(%rip), %rsi     # 0xf2d11
leaq 0xe771d(%rip), %rdx     # 0xf2ca5
movb $0x0, %al
callq 0x5b50
jmp 0xb61c
movq -0x40(%rbp), %rax
movl 0x40(%rax), %eax
movq -0x40(%rbp), %rcx
movl 0x14(%rcx), %ecx
shll $0x2, %ecx
subl %ecx, %eax
movq -0x40(%rbp), %rcx
movzwl 0x12(%rcx), %ecx
subl %ecx, %eax
movq -0x40(%rbp), %rcx
subl 0x18(%rcx), %eax
movq -0x40(%rbp), %rcx
movl 0x18(%rcx), %ecx
addl $0x1, %ecx
sarl %ecx
subl %ecx, %eax
cmpl $0x0, %eax
je 0xb5e9
leaq 0xe85e5(%rip), %rdi     # 0xf3bb7
leaq 0xe7738(%rip), %rsi     # 0xf2d11
leaq 0xe76f7(%rip), %rdx     # 0xf2cd7
movb $0x0, %al
callq 0x5b50
jmp 0xb61c
movq -0x40(%rbp), %rax
movl 0x44(%rax), %eax
movq -0x40(%rbp), %rcx
subl 0x40(%rcx), %eax
cmpl $0x40, %eax
jae 0xb61a
leaq 0xe85b4(%rip), %rdi     # 0xf3bb7
leaq 0xe7707(%rip), %rsi     # 0xf2d11
leaq 0xe772b(%rip), %rdx     # 0xf2d3c
movb $0x0, %al
callq 0x5b50
jmp 0xb61c
jmp 0xb61c
cmpq $0x0, -0x40(%rbp)
je 0xb62c
movq -0x40(%rbp), %rdi
callq 0x380d0
addq $0xc8, %rsp
popq %rbx
popq %rbp
retq
nopw %cs:(%rax,%rax)