// File: zeeev[P]DASVC/bamtools/src/api/internal/sam/SamHeaderValidator_p.cpp
// Function: BamTools::Internal::SamHeaderValidator::ContainsUniqueProgramIds()
bool SamHeaderValidator::ContainsUniqueProgramIds(void) {

    bool isValid = true;
    set<string> programIds;
    set<string>::iterator pgIdIter;

    // iterate over program records
    const SamProgramChain& programs = m_header.Programs;
    SamProgramConstIterator pgIter = programs.ConstBegin();
    SamProgramConstIterator pgEnd  = programs.ConstEnd();
    for ( ; pgIter != pgEnd; ++pgIter ) {
        const SamProgram& pg = (*pgIter);

        // lookup program ID
        const string& pgId = pg.ID;
        pgIdIter = programIds.find(pgId);

        // error if found (duplicate entry)
        if ( pgIdIter != programIds.end() ) {
            AddError("Program ID (ID): " + pgId + " is not unique");
            isValid = false;
        }

        // otherwise ok, store ID
        programIds.insert(pgId);
    }

    // return validation state
    return isValid;
}

// Assembly:
subq $0x138, %rsp            # imm = 0x138
movq %rdi, 0x130(%rsp)
movq 0x130(%rsp), %rax
movq %rax, 0x50(%rsp)
movb $0x1, 0x12f(%rsp)
leaq 0xf8(%rsp), %rdi
callq 0x75d80
leaq 0xf0(%rsp), %rdi
callq 0x74ef0
jmp 0xe7e70
movq 0x50(%rsp), %rax
movq (%rax), %rax
addq $0x108, %rax            # imm = 0x108
movq %rax, 0xd8(%rsp)
movq 0xd8(%rsp), %rdi
callq 0x738b0
movq %rax, 0x48(%rsp)
jmp 0xe7e9a
movq 0x48(%rsp), %rax
movq %rax, 0xd0(%rsp)
movq 0xd8(%rsp), %rdi
callq 0x7c8a0
movq %rax, 0x40(%rsp)
jmp 0xe7ebb
movq 0x40(%rsp), %rax
movq %rax, 0xc8(%rsp)
leaq 0xd0(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x71760
movb %al, 0x3f(%rsp)
jmp 0xe7ee3
movb 0x3f(%rsp), %al
testb $0x1, %al
jne 0xe7ef0
jmp 0xe80be
leaq 0xd0(%rsp), %rdi
callq 0x7b140
movq %rax, 0x30(%rsp)
jmp 0xe7f04
movq 0x30(%rsp), %rax
movq %rax, 0xc0(%rsp)
movq 0xc0(%rsp), %rax
addq $0x20, %rax
movq %rax, 0xb8(%rsp)
movq 0xb8(%rsp), %rsi
leaq 0xf8(%rsp), %rdi
callq 0x78740
movq %rax, 0x28(%rsp)
jmp 0xe7f41
movq 0x28(%rsp), %rax
movq %rax, 0xb0(%rsp)
movq 0xb0(%rsp), %rax
movq %rax, 0xf0(%rsp)
leaq 0xf8(%rsp), %rdi
callq 0x714b0
movq %rax, 0x20(%rsp)
jmp 0xe7f72
movq 0x20(%rsp), %rax
movq %rax, 0xa8(%rsp)
leaq 0xf0(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x713b0
movb %al, 0x1f(%rsp)
jmp 0xe7f9a
movb 0x1f(%rsp), %al
testb $0x1, %al
jne 0xe7fa7
jmp 0xe8078
movq 0xb8(%rsp), %rdx
leaq 0x498d(%rip), %rsi      # 0xec943
leaq 0x68(%rsp), %rdi
callq 0x75e70
jmp 0xe7fc2
leaq 0x485a(%rip), %rdx      # 0xec823
leaq 0x88(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x785a0
jmp 0xe7fdd
movq 0x50(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x763a0
jmp 0xe7ff1
leaq 0x88(%rsp), %rdi
callq 0x7cce8
jmp 0xe8000
leaq 0x68(%rsp), %rdi
callq 0x7cce8
jmp 0xe800c
movb $0x0, 0x12f(%rsp)
jmp 0xe8078
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe8(%rsp)
movl %eax, 0xe4(%rsp)
jmp 0xe80e4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe8(%rsp)
movl %eax, 0xe4(%rsp)
jmp 0xe806a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe8(%rsp)
movl %eax, 0xe4(%rsp)
leaq 0x88(%rsp), %rdi
callq 0x7cce8
jmp 0xe8068
jmp 0xe806a
leaq 0x68(%rsp), %rdi
callq 0x7cce8
jmp 0xe8076
jmp 0xe80e4
movq 0xb8(%rsp), %rsi
leaq 0xf8(%rsp), %rdi
callq 0x76af0
movb %dl, 0xf(%rsp)
movq %rax, 0x10(%rsp)
jmp 0xe8098
movb 0xf(%rsp), %al
movq 0x10(%rsp), %rcx
movq %rcx, 0x58(%rsp)
movb %al, 0x60(%rsp)
leaq 0xd0(%rsp), %rdi
callq 0x78180
jmp 0xe80b9
jmp 0xe7ec8
movb 0x12f(%rsp), %al
movb %al, 0xe(%rsp)
leaq 0xf8(%rsp), %rdi
callq 0x724c0
movb 0xe(%rsp), %al
andb $0x1, %al
addq $0x138, %rsp            # imm = 0x138
retq
leaq 0xf8(%rsp), %rdi
callq 0x724c0
jmp 0xe80f3
jmp 0xe80f5
movq 0xe8(%rsp), %rdi
callq 0x7b550
movq %rax, %rdi
callq 0x88ef0
nopw (%rax,%rax)