// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/test/test-bcf-translate.c
// Function: main
int main(int argc, char **argv)
{
    char *fname = argc>1 ? argv[1] : "/dev/null";
    htsFile *fp = hts_open(fname, "w");
    bcf_hdr_t *hdr1, *hdr2;

    hdr1 = bcf_hdr_init("w");
    hdr2 = bcf_hdr_init("w");

    // Add two shared and two private annotations
    bcf_hdr_append(hdr1, "##contig=<ID=1>");
    bcf_hdr_append(hdr1, "##contig=<ID=2>");
    bcf_hdr_append(hdr2, "##contig=<ID=2>");
    bcf_hdr_append(hdr2, "##contig=<ID=1>");
    bcf_hdr_append(hdr1, "##FILTER=<ID=FLT1,Description=\"Filter 1\">");
    bcf_hdr_append(hdr1, "##FILTER=<ID=FLT2,Description=\"Filter 2\">");
    bcf_hdr_append(hdr1, "##FILTER=<ID=FLT3,Description=\"Filter 3\">");
    bcf_hdr_append(hdr2, "##FILTER=<ID=FLT4,Description=\"Filter 4\">");
    bcf_hdr_append(hdr2, "##FILTER=<ID=FLT3,Description=\"Filter 3\">");
    bcf_hdr_append(hdr2, "##FILTER=<ID=FLT2,Description=\"Filter 2\">");
    bcf_hdr_append(hdr1, "##INFO=<ID=INF1,Number=.,Type=Integer,Description=\"Info 1\">");
    bcf_hdr_append(hdr1, "##INFO=<ID=INF2,Number=.,Type=Integer,Description=\"Info 2\">");
    bcf_hdr_append(hdr1, "##INFO=<ID=INF3,Number=.,Type=Integer,Description=\"Info 3\">");
    bcf_hdr_append(hdr2, "##INFO=<ID=INF4,Number=.,Type=Integer,Description=\"Info 4\">");
    bcf_hdr_append(hdr2, "##INFO=<ID=INF3,Number=.,Type=Integer,Description=\"Info 3\">");
    bcf_hdr_append(hdr2, "##INFO=<ID=INF2,Number=.,Type=Integer,Description=\"Info 2\">");
    bcf_hdr_append(hdr1, "##FORMAT=<ID=FMT1,Number=.,Type=Integer,Description=\"FMT 1\">");
    bcf_hdr_append(hdr1, "##FORMAT=<ID=FMT2,Number=.,Type=Integer,Description=\"FMT 2\">");
    bcf_hdr_append(hdr1, "##FORMAT=<ID=FMT3,Number=.,Type=Integer,Description=\"FMT 3\">");
    bcf_hdr_append(hdr2, "##FORMAT=<ID=FMT4,Number=.,Type=Integer,Description=\"FMT 4\">");
    bcf_hdr_append(hdr2, "##FORMAT=<ID=FMT3,Number=.,Type=Integer,Description=\"FMT 3\">");
    bcf_hdr_append(hdr2, "##FORMAT=<ID=FMT2,Number=.,Type=Integer,Description=\"FMT 2\">");
    bcf_hdr_add_sample(hdr1,"SMPL1");
    bcf_hdr_add_sample(hdr1,"SMPL2");
    bcf_hdr_add_sample(hdr2,"SMPL1");
    bcf_hdr_add_sample(hdr2,"SMPL2");
    if (bcf_hdr_sync(hdr1) < 0) error("bcf_hdr_sync(hdr1)");
    if (bcf_hdr_sync(hdr2) < 0) error("bcf_hdr_sync(hdr2)");

    hdr2 = bcf_hdr_merge(hdr2,hdr1);
    if (bcf_hdr_sync(hdr2) < 0) error("bcf_hdr_sync(hdr2) after merge");
    if ( bcf_hdr_write(fp, hdr2)!=0 ) error("Failed to write to %s\n", fname);

    bcf1_t *rec = bcf_init1();
    rec->rid = bcf_hdr_name2id(hdr1, "1");
    rec->pos = 0;
    bcf_update_alleles_str(hdr1, rec, "G,A");
    int32_t tmpi[3];
    tmpi[0] = bcf_hdr_id2int(hdr1, BCF_DT_ID, "FLT1");
    tmpi[1] = bcf_hdr_id2int(hdr1, BCF_DT_ID, "FLT2");
    tmpi[2] = bcf_hdr_id2int(hdr1, BCF_DT_ID, "FLT3");
    bcf_update_filter(hdr1, rec, tmpi, 3);
    tmpi[0] = 1; bcf_update_info_int32(hdr1, rec, "INF1", tmpi, 1);
    tmpi[0] = 2; bcf_update_info_int32(hdr1, rec, "INF2", tmpi, 1);
    tmpi[0] = 3; bcf_update_info_int32(hdr1, rec, "INF3", tmpi, 1);
    tmpi[0] = tmpi[1] = 1; bcf_update_format_int32(hdr1, rec, "FMT1", tmpi, 2);
    tmpi[0] = tmpi[1] = 2; bcf_update_format_int32(hdr1, rec, "FMT2", tmpi, 2);
    tmpi[0] = tmpi[1] = 3; bcf_update_format_int32(hdr1, rec, "FMT3", tmpi, 2);

    bcf_remove_filter(hdr1, rec, bcf_hdr_id2int(hdr1, BCF_DT_ID, "FLT2"), 0);
    bcf_update_info_int32(hdr1, rec, "INF2", NULL, 0);
    bcf_update_format_int32(hdr1, rec, "FMT2", NULL, 0);

    bcf_translate(hdr2, hdr1, rec);
    if ( bcf_write(fp, hdr2, rec)!=0 ) error("Failed to write to %s\n", fname);

    // Clean
    bcf_destroy1(rec);
    bcf_hdr_destroy(hdr1);
    bcf_hdr_destroy(hdr2);
    int ret;
    if ( (ret=hts_close(fp)) )
    {
        fprintf(stderr,"hts_close(%s): non-zero status %d\n",fname,ret);
        exit(ret);
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x1, -0x8(%rbp)
jle 0x5b9a
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x50(%rbp)
jmp 0x5ba7
leaq 0xfd463(%rip), %rax     # 0x103004
movq %rax, -0x50(%rbp)
jmp 0x5ba7
movq -0x50(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
leaq 0xffad2(%rip), %rsi     # 0x10568c
callq 0x9eb0
movq %rax, -0x20(%rbp)
leaq 0xffac2(%rip), %rdi     # 0x10568c
callq 0x3f560
movq %rax, -0x28(%rbp)
leaq 0xffab2(%rip), %rdi     # 0x10568c
callq 0x3f560
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rdi
leaq 0xfd420(%rip), %rsi     # 0x10300e
callq 0x3ebf0
movq -0x28(%rbp), %rdi
leaq 0xfd420(%rip), %rsi     # 0x10301e
callq 0x3ebf0
movq -0x30(%rbp), %rdi
leaq 0xfd410(%rip), %rsi     # 0x10301e
callq 0x3ebf0
movq -0x30(%rbp), %rdi
leaq 0xfd3f0(%rip), %rsi     # 0x10300e
callq 0x3ebf0
movq -0x28(%rbp), %rdi
leaq 0xfd400(%rip), %rsi     # 0x10302e
callq 0x3ebf0
movq -0x28(%rbp), %rdi
leaq 0xfd41a(%rip), %rsi     # 0x103058
callq 0x3ebf0
movq -0x28(%rbp), %rdi
leaq 0xfd434(%rip), %rsi     # 0x103082
callq 0x3ebf0
movq -0x30(%rbp), %rdi
leaq 0xfd44e(%rip), %rsi     # 0x1030ac
callq 0x3ebf0
movq -0x30(%rbp), %rdi
leaq 0xfd414(%rip), %rsi     # 0x103082
callq 0x3ebf0
movq -0x30(%rbp), %rdi
leaq 0xfd3da(%rip), %rsi     # 0x103058
callq 0x3ebf0
movq -0x28(%rbp), %rdi
leaq 0xfd448(%rip), %rsi     # 0x1030d6
callq 0x3ebf0
movq -0x28(%rbp), %rdi
leaq 0xfd474(%rip), %rsi     # 0x103112
callq 0x3ebf0
movq -0x28(%rbp), %rdi
leaq 0xfd4a0(%rip), %rsi     # 0x10314e
callq 0x3ebf0
movq -0x30(%rbp), %rdi
leaq 0xfd4cc(%rip), %rsi     # 0x10318a
callq 0x3ebf0
movq -0x30(%rbp), %rdi
leaq 0xfd480(%rip), %rsi     # 0x10314e
callq 0x3ebf0
movq -0x30(%rbp), %rdi
leaq 0xfd434(%rip), %rsi     # 0x103112
callq 0x3ebf0
movq -0x28(%rbp), %rdi
leaq 0xfd4d8(%rip), %rsi     # 0x1031c6
callq 0x3ebf0
movq -0x28(%rbp), %rdi
leaq 0xfd505(%rip), %rsi     # 0x103203
callq 0x3ebf0
movq -0x28(%rbp), %rdi
leaq 0xfd532(%rip), %rsi     # 0x103240
callq 0x3ebf0
movq -0x30(%rbp), %rdi
leaq 0xfd55f(%rip), %rsi     # 0x10327d
callq 0x3ebf0
movq -0x30(%rbp), %rdi
leaq 0xfd512(%rip), %rsi     # 0x103240
callq 0x3ebf0
movq -0x30(%rbp), %rdi
leaq 0xfd4c5(%rip), %rsi     # 0x103203
callq 0x3ebf0
movq -0x28(%rbp), %rdi
leaq 0xfd56c(%rip), %rsi     # 0x1032ba
callq 0x3a9f0
movq -0x28(%rbp), %rdi
leaq 0xfd562(%rip), %rsi     # 0x1032c0
callq 0x3a9f0
movq -0x30(%rbp), %rdi
leaq 0xfd54c(%rip), %rsi     # 0x1032ba
callq 0x3a9f0
movq -0x30(%rbp), %rdi
leaq 0xfd542(%rip), %rsi     # 0x1032c0
callq 0x3a9f0
movq -0x28(%rbp), %rdi
callq 0x3ae50
cmpl $0x0, %eax
jge 0x5d9f
leaq 0xfd52e(%rip), %rdi     # 0x1032c6
movb $0x0, %al
callq 0x5ac0
movq -0x30(%rbp), %rdi
callq 0x3ae50
cmpl $0x0, %eax
jge 0x5dbb
leaq 0xfd525(%rip), %rdi     # 0x1032d9
movb $0x0, %al
callq 0x5ac0
movq -0x30(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x4b470
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0x3ae50
cmpl $0x0, %eax
jge 0x5de8
leaq 0xfd50b(%rip), %rdi     # 0x1032ec
movb $0x0, %al
callq 0x5ac0
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x40710
cmpl $0x0, %eax
je 0x5e0c
movq -0x18(%rbp), %rsi
leaq 0xfd506(%rip), %rdi     # 0x10330b
movb $0x0, %al
callq 0x5ac0
callq 0x40bb0
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rdi
leaq 0xffee5(%rip), %rsi     # 0x105d05
callq 0x60c0
movl %eax, %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x38(%rbp), %rax
movq $0x0, (%rax)
movq -0x28(%rbp), %rdi
movq -0x38(%rbp), %rsi
leaq 0xfd4da(%rip), %rdx     # 0x103322
callq 0x4f9f0
movq -0x28(%rbp), %rdi
xorl %esi, %esi
leaq 0xfd4cc(%rip), %rdx     # 0x103326
callq 0x3e820
movl %eax, -0x44(%rbp)
movq -0x28(%rbp), %rdi
xorl %esi, %esi
leaq 0xfd4bc(%rip), %rdx     # 0x10332b
callq 0x3e820
movl %eax, -0x40(%rbp)
movq -0x28(%rbp), %rdi
xorl %esi, %esi
leaq 0xfd4ac(%rip), %rdx     # 0x103330
callq 0x3e820
movl %eax, -0x3c(%rbp)
movq -0x28(%rbp), %rdi
movq -0x38(%rbp), %rsi
leaq -0x44(%rbp), %rdx
movl $0x3, %ecx
callq 0x4f010
movl $0x1, -0x44(%rbp)
movq -0x28(%rbp), %rdi
movq -0x38(%rbp), %rsi
leaq -0x44(%rbp), %rcx
leaq 0xfd479(%rip), %rdx     # 0x103335
movl $0x1, %r9d
movl %r9d, %r8d
callq 0x4df10
movl $0x2, -0x44(%rbp)
movq -0x28(%rbp), %rdi
movq -0x38(%rbp), %rsi
leaq -0x44(%rbp), %rcx
leaq 0xfd456(%rip), %rdx     # 0x10333a
movl $0x1, %r9d
movl %r9d, %r8d
callq 0x4df10
movl $0x3, -0x44(%rbp)
movq -0x28(%rbp), %rdi
movq -0x38(%rbp), %rsi
leaq -0x44(%rbp), %rcx
leaq 0xfd433(%rip), %rdx     # 0x10333f
movl $0x1, %r9d
movl %r9d, %r8d
callq 0x4df10
movl $0x1, -0x40(%rbp)
movl $0x1, -0x44(%rbp)
movq -0x28(%rbp), %rdi
movq -0x38(%rbp), %rsi
leaq -0x44(%rbp), %rcx
leaq 0xfd409(%rip), %rdx     # 0x103344
movl $0x2, %r8d
movl $0x1, %r9d
callq 0x4e870
movl $0x2, -0x40(%rbp)
movl $0x2, -0x44(%rbp)
movq -0x28(%rbp), %rdi
movq -0x38(%rbp), %rsi
leaq -0x44(%rbp), %rcx
leaq 0xfd3dc(%rip), %rdx     # 0x103349
movl $0x2, %r8d
movl $0x1, %r9d
callq 0x4e870
movl $0x3, -0x40(%rbp)
movl $0x3, -0x44(%rbp)
movq -0x28(%rbp), %rdi
movq -0x38(%rbp), %rsi
leaq -0x44(%rbp), %rcx
leaq 0xfd3af(%rip), %rdx     # 0x10334e
movl $0x2, %r8d
movl $0x1, %r9d
callq 0x4e870
movq -0x28(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x28(%rbp), %rdi
xorl %esi, %esi
leaq 0xfd35e(%rip), %rdx     # 0x10332b
callq 0x3e820
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rsi
movl %eax, %edx
xorl %ecx, %ecx
callq 0x4f2b0
movq -0x28(%rbp), %rdi
movq -0x38(%rbp), %rsi
leaq 0xfd348(%rip), %rdx     # 0x10333a
xorl %eax, %eax
movl %eax, %ecx
xorl %r8d, %r8d
movl $0x1, %r9d
callq 0x4df10
movq -0x28(%rbp), %rdi
movq -0x38(%rbp), %rsi
leaq 0xfd336(%rip), %rdx     # 0x103349
xorl %eax, %eax
movl %eax, %ecx
xorl %r8d, %r8d
movl $0x1, %r9d
callq 0x4e870
movq -0x30(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq 0x4baa0
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq 0x43100
cmpl $0x0, %eax
je 0x605e
movq -0x18(%rbp), %rsi
leaq 0xfd2b4(%rip), %rdi     # 0x10330b
movb $0x0, %al
callq 0x5ac0
movq -0x38(%rbp), %rdi
callq 0x40fa0
movq -0x28(%rbp), %rdi
callq 0x3fd50
movq -0x30(%rbp), %rdi
callq 0x3fd50
movq -0x20(%rbp), %rdi
callq 0xbfd0
movl %eax, -0x48(%rbp)
cmpl $0x0, %eax
je 0x60b1
movq 0x11ef47(%rip), %rax    # 0x124fd8
movq (%rax), %rdi
movq -0x18(%rbp), %rdx
movl -0x48(%rbp), %ecx
leaq 0xfd2b1(%rip), %rsi     # 0x103353
movb $0x0, %al
callq 0x46f0
movl -0x48(%rbp), %edi
callq 0x45d0
xorl %eax, %eax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)