// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/test/sam.c
// Function: test_header_remove_lines
static void test_header_remove_lines(void) {
    static const char header_text[] =
        "@HD\tVN:1.4\n"
        "@SQ\tSN:chr1\tLN:100\n"
        "@SQ\tSN:chr2\tLN:200\n"
        "@SQ\tSN:chr3\tLN:300\n"
        "@RG\tID:run1\n"
        "@RG\tID:run2\n"
        "@RG\tID:run3\n"
        "@PG\tID:prog1\tPN:prog1\n";

    static const char expected[] =
        "@HD\tVN:1.4\n"
        "@SQ\tSN:chr1\tLN:100\n"
        "@SQ\tSN:chr3\tLN:300\n"
        "@PG\tID:prog1\tPN:prog1\n";

    sam_hdr_t *header = sam_hdr_parse(sizeof(header_text) - 1, header_text);
    keephash_t rh = kh_init(keep);
    khint_t k;
    const char *hdr_str;
    int r = 0;

    if (!header) {
        fail("creating sam header");
        goto err;
    }
    if (!rh) {
        fail("creating keep hash table");
        goto err;
    }

    kh_put(keep, rh, strdup("chr3"), &r);
    if (r < 0) { fail("adding chr3 to hash table"); goto err; }
    kh_put(keep, rh, strdup("chr1"), &r);
    if (r < 0) { fail("adding chr1 to hash table"); goto err; }

    r = sam_hdr_remove_lines(header, "SQ", "SN", rh);
    if (r != 0) { fail("sam_hdr_remove_lines SQ SN rh"); goto err; }

    r = sam_hdr_remove_lines(header, "RG", "ID", NULL);
    if (r != 0) { fail("sam_hdr_remove_lines RG ID NULL"); goto err; }

    hdr_str = sam_hdr_str(header);
    if (!hdr_str || strcmp(hdr_str, expected) != 0) {
        fail("edited header does not match expected version");
        fprintf(stderr,
                "---------- Expected:\n%s\n"
                "++++++++++ Got:\n%s\n"
                "====================\n",
                expected, hdr_str ? hdr_str : "<NULL>");
        goto err;
    }

 err:
    if (rh) {
        for (k = 0; k < kh_end(rh); ++k)
            if (kh_exist(rh, k)) free((char*)kh_key(rh, k));
        kh_destroy(keep, rh);
    }
    if (header) sam_hdr_destroy(header);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl $0x7e, %edi
leaq 0xe756c(%rip), %rsi     # 0xf0170
callq 0x3c940
movq %rax, -0x8(%rbp)
callq 0xdbf0
movq %rax, -0x10(%rbp)
movl $0x0, -0x24(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x8c37
leaq 0xe92a7(%rip), %rdi     # 0xf1ed2
movb $0x0, %al
callq 0x5b50
jmp 0x8dbd
cmpq $0x0, -0x10(%rbp)
jne 0x8c51
leaq 0xe9422(%rip), %rdi     # 0xf2067
movb $0x0, %al
callq 0x5b50
jmp 0x8dbd
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
leaq 0xe926d(%rip), %rdi     # 0xf1ecd
callq 0x4910
movq -0x30(%rbp), %rdi
movq %rax, %rsi
leaq -0x24(%rbp), %rdx
callq 0xdc10
cmpl $0x0, -0x24(%rbp)
jge 0x8c8e
leaq 0xe93fe(%rip), %rdi     # 0xf2080
movb $0x0, %al
callq 0x5b50
jmp 0x8dbd
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
leaq 0xe9249(%rip), %rdi     # 0xf1ee6
callq 0x4910
movq -0x38(%rbp), %rdi
movq %rax, %rsi
leaq -0x24(%rbp), %rdx
callq 0xdc10
cmpl $0x0, -0x24(%rbp)
jge 0x8ccb
leaq 0xe93db(%rip), %rdi     # 0xf209a
movb $0x0, %al
callq 0x5b50
jmp 0x8dbd
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rcx
leaq 0xe8a68(%rip), %rsi     # 0xf1742
leaq 0xe8a22(%rip), %rdx     # 0xf1703
callq 0x17e50
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0x8d02
leaq 0xe93be(%rip), %rdi     # 0xf20b4
movb $0x0, %al
callq 0x5b50
jmp 0x8dbd
movq -0x8(%rbp), %rdi
leaq 0xe8a6e(%rip), %rsi     # 0xf177b
leaq 0xe8a6a(%rip), %rdx     # 0xf177e
xorl %eax, %eax
movl %eax, %ecx
callq 0x17e50
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0x8d39
leaq 0xe93a5(%rip), %rdi     # 0xf20d2
movb $0x0, %al
callq 0x5b50
jmp 0x8dbd
movq -0x8(%rbp), %rdi
callq 0x13c70
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x8d62
movq -0x20(%rbp), %rdi
leaq 0xe7498(%rip), %rsi     # 0xf01f0
callq 0x4690
cmpl $0x0, %eax
je 0x8dbb
leaq 0xe8d1b(%rip), %rdi     # 0xf1a84
movb $0x0, %al
callq 0x5b50
movq 0x108269(%rip), %rax    # 0x110fe0
movq (%rax), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x8d8f
movq -0x20(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x8d9c
leaq 0xe92ca(%rip), %rax     # 0xf2060
movq %rax, -0x48(%rbp)
jmp 0x8d9c
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rcx
leaq 0xe8ee9(%rip), %rsi     # 0xf1c94
leaq 0xe743e(%rip), %rdx     # 0xf01f0
movb $0x0, %al
callq 0x46d0
jmp 0x8dbd
jmp 0x8dbd
cmpq $0x0, -0x10(%rbp)
je 0x8e25
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl (%rcx), %eax
jae 0x8e1c
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x14(%rbp), %ecx
shrl $0x4, %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %eax
movl -0x14(%rbp), %ecx
andl $0xf, %ecx
shll %ecx
shrl %cl, %eax
andl $0x3, %eax
cmpl $0x0, %eax
jne 0x8e0f
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x14(%rbp), %ecx
movq (%rax,%rcx,8), %rdi
callq 0x45a0
jmp 0x8e11
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x8dcb
movq -0x10(%rbp), %rdi
callq 0xdf70
cmpq $0x0, -0x8(%rbp)
je 0x8e35
movq -0x8(%rbp), %rdi
callq 0x36f50
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)