// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/test/sam.c
// Function: test_header_pg_lines
static void test_header_pg_lines(void) {
    static const char header_text[] = "data:,"
        "@HD\tVN:1.5\n"
        "@PG\tID:prog1\tPN:prog1\n"
        "@PG\tID:prog2\tPN:prog2\tPP:prog1\n";

    static const char expected[] =
        "@HD\tVN:1.5\n"
        "@PG\tID:prog1\tPN:prog1\n"
        "@PG\tID:prog2\tPN:prog2\tPP:prog1\n"
        "@PG\tID:prog3\tPN:prog3\tPP:prog2\n"
        "@PG\tID:prog4\tPN:prog4\tPP:prog1\n"
        "@PG\tID:prog5\tPN:prog5\tPP:prog2\n"
        "@PG\tID:prog6\tPN:prog6\tPP:prog3\n"
        "@PG\tID:prog6.1\tPN:prog6\tPP:prog4\n"
        "@PG\tID:prog6.2\tPN:prog6\tPP:prog5\n"
        "@PG\tPN:prog7\tID:my_id\tPP:prog6\n";

    samFile *in = sam_open(header_text, "r");
    sam_hdr_t *header = NULL;
    const char *text = NULL;
    enum htsLogLevel old_log_level;
    int r;

    if (!in) {
        fail("couldn't open file");
        goto err;
    }

    header = sam_hdr_read(in);
    if (!header) {
        fail("reading header from file");
        goto err;
    }

    r = sam_hdr_add_pg(header, "prog3", NULL);
    if (r != 0) { fail("sam_hdr_add_pg prog3"); goto err; }


    r = sam_hdr_add_pg(header, "prog4", "PP", "prog1", NULL);
    if (r != 0) { fail("sam_hdr_add_pg prog4"); goto err; }

    r = sam_hdr_add_line(header, "PG", "ID",
                         "prog5", "PN", "prog5", "PP", "prog2", NULL);
    if (r != 0) { fail("sam_hdr_add_line @PG ID:prog5"); goto err; }

    r = sam_hdr_add_pg(header, "prog6", NULL);
    if (r != 0) { fail("sam_hdr_add_pg prog6"); goto err; }

    r = sam_hdr_add_pg(header, "prog7", "ID", "my_id", "PP", "prog6", NULL);
    if (r != 0) { fail("sam_hdr_add_pg prog7"); goto err; }

    text = sam_hdr_str(header);
    if (!text) { fail("sam_hdr_str"); goto err; }

    // These should fail
    old_log_level = hts_get_log_level();
    hts_set_log_level(HTS_LOG_OFF);

    r = sam_hdr_add_pg(header, "prog8", "ID", "my_id", NULL);
    if (r == 0) { fail("sam_hdr_add_pg prog8 (unexpected success)"); goto err; }

    r = sam_hdr_add_pg(header, "prog9", "PP", "non-existent", NULL);
    if (r == 0) { fail("sam_hdr_add_pg prog9 (unexpected success)"); goto err; }

    hts_set_log_level(old_log_level);
    // End failing tests

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

 err:
    sam_hdr_destroy(header);
    header = NULL;
    if (in) sam_close(in);
    return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
leaq 0xe7ba1(%rip), %rdi     # 0xefee0
leaq 0xef732(%rip), %rsi     # 0xf7a78
callq 0x232d0
movq %rax, -0x8(%rbp)
movq $0x0, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x8379
leaq 0xe933f(%rip), %rdi     # 0xf16ac
movb $0x0, %al
callq 0x5b50
jmp 0x861c
movq -0x8(%rbp), %rdi
callq 0x3c9b0
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x83a0
leaq 0xe932b(%rip), %rdi     # 0xf16bf
movb $0x0, %al
callq 0x5b50
jmp 0x861c
movq -0x10(%rbp), %rdi
leaq 0xe97fb(%rip), %rsi     # 0xf1ba6
xorl %eax, %eax
movl %eax, %edx
movb $0x0, %al
callq 0x19250
movl %eax, -0x20(%rbp)
cmpl $0x0, -0x20(%rbp)
je 0x83d2
leaq 0xe97d1(%rip), %rdi     # 0xf1b97
movb $0x0, %al
callq 0x5b50
jmp 0x861c
movq -0x10(%rbp), %rdi
leaq 0xe97e7(%rip), %rsi     # 0xf1bc4
leaq 0xe97c8(%rip), %rdx     # 0xf1bac
leaq 0xe97c4(%rip), %rcx     # 0xf1baf
xorl %eax, %eax
movl %eax, %r8d
movb $0x0, %al
callq 0x19250
movl %eax, -0x20(%rbp)
cmpl $0x0, -0x20(%rbp)
je 0x8413
leaq 0xe97ae(%rip), %rdi     # 0xf1bb5
movb $0x0, %al
callq 0x5b50
jmp 0x861c
movq -0x10(%rbp), %rdi
leaq 0xe959d(%rip), %rsi     # 0xf19bb
leaq 0xe9359(%rip), %rdx     # 0xf177e
leaq 0xe97b9(%rip), %r9      # 0xf1be5
leaq 0xe9797(%rip), %r8      # 0xf1bca
leaq 0xe9772(%rip), %r10     # 0xf1bac
leaq 0xe9b89(%rip), %rax     # 0xf1fca
xorl %ecx, %ecx
movq %r9, %rcx
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
movb $0x0, %al
callq 0x143a0
movl %eax, -0x20(%rbp)
cmpl $0x0, -0x20(%rbp)
je 0x847b
leaq 0xe975e(%rip), %rdi     # 0xf1bcd
movb $0x0, %al
callq 0x5b50
jmp 0x861c
movq -0x10(%rbp), %rdi
leaq 0xe9774(%rip), %rsi     # 0xf1bfa
xorl %eax, %eax
movl %eax, %edx
movb $0x0, %al
callq 0x19250
movl %eax, -0x20(%rbp)
cmpl $0x0, -0x20(%rbp)
je 0x84ad
leaq 0xe974a(%rip), %rdi     # 0xf1beb
movb $0x0, %al
callq 0x5b50
jmp 0x861c
movq -0x10(%rbp), %rdi
leaq 0xe975d(%rip), %rsi     # 0xf1c15
leaq 0xe92bf(%rip), %rdx     # 0xf177e
leaq 0xe973a(%rip), %rcx     # 0xf1c00
leaq 0xe96df(%rip), %r8      # 0xf1bac
leaq 0xe9726(%rip), %r9      # 0xf1bfa
xorl %eax, %eax
movq $0x0, (%rsp)
movb $0x0, %al
callq 0x19250
movl %eax, -0x20(%rbp)
cmpl $0x0, -0x20(%rbp)
je 0x8501
leaq 0xe9711(%rip), %rdi     # 0xf1c06
movb $0x0, %al
callq 0x5b50
jmp 0x861c
movq -0x10(%rbp), %rdi
callq 0x13c70
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x8528
leaq 0xe96ff(%rip), %rdi     # 0xf1c1b
movb $0x0, %al
callq 0x5b50
jmp 0x861c
callq 0x2ee00
movl %eax, -0x1c(%rbp)
xorl %edi, %edi
callq 0x2ede0
movq -0x10(%rbp), %rdi
leaq 0xe96e5(%rip), %rsi     # 0xf1c27
leaq 0xe9235(%rip), %rdx     # 0xf177e
leaq 0xe96b0(%rip), %rcx     # 0xf1c00
xorl %eax, %eax
movl %eax, %r8d
movb $0x0, %al
callq 0x19250
movl %eax, -0x20(%rbp)
cmpl $0x0, -0x20(%rbp)
jne 0x8578
leaq 0xe96c1(%rip), %rdi     # 0xf1c2d
movb $0x0, %al
callq 0x5b50
jmp 0x861c
movq -0x10(%rbp), %rdi
leaq 0xe96d4(%rip), %rsi     # 0xf1c57
leaq 0xe9622(%rip), %rdx     # 0xf1bac
leaq 0xe96cc(%rip), %rcx     # 0xf1c5d
xorl %eax, %eax
movl %eax, %r8d
movb $0x0, %al
callq 0x19250
movl %eax, -0x20(%rbp)
cmpl $0x0, -0x20(%rbp)
jne 0x85b6
leaq 0xe96bd(%rip), %rdi     # 0xf1c6a
movb $0x0, %al
callq 0x5b50
jmp 0x861c
movl -0x1c(%rbp), %edi
callq 0x2ede0
movq -0x10(%rbp), %rdi
callq 0x13c70
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x85e7
movq -0x18(%rbp), %rdi
leaq 0xe7953(%rip), %rsi     # 0xeff30
callq 0x4690
cmpl $0x0, %eax
je 0x861a
leaq 0xe9496(%rip), %rdi     # 0xf1a84
movb $0x0, %al
callq 0x5b50
movq 0x1089e4(%rip), %rax    # 0x110fe0
movq (%rax), %rdi
movq -0x18(%rbp), %rcx
leaq 0xe968a(%rip), %rsi     # 0xf1c94
leaq 0xe791f(%rip), %rdx     # 0xeff30
movb $0x0, %al
callq 0x46d0
jmp 0x861c
jmp 0x861c
movq -0x10(%rbp), %rdi
callq 0x36f50
movq $0x0, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x863d
movq -0x8(%rbp), %rdi
callq 0x253f0
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)