// File: zeeev[P]DASVC/bamtools/src/api/internal/io/BamHttp_p.cpp
// Function: BamTools::Internal::BamHttp::ReceiveResponse()
bool BamHttp::ReceiveResponse(void) {

    // fetch header, up until double new line
    string responseHeader;
    do {

        // make sure we can read a line
        if ( !m_socket->WaitForReadLine() )
            return false;

        // read line & append to full header
        const string headerLine = m_socket->ReadLine();
        responseHeader += headerLine;

    } while ( !endsWith(responseHeader, DOUBLE_NEWLINE) );

    // sanity check
    if ( responseHeader.empty() ) {
        SetErrorString("BamHttp::ReceiveResponse", "empty HTTP response");
        Close();
        return false;
    }

    // create response from header text
    m_response = new HttpResponseHeader(responseHeader);
    if ( !m_response->IsValid() ) {
        SetErrorString("BamHttp::ReceiveResponse", "could not parse HTTP response");
        Close();
        return false;
    }

    // if we get here, success
    return true;
}

// Assembly:
subq $0x148, %rsp            # imm = 0x148
movq %rdi, 0x138(%rsp)
movq 0x138(%rsp), %rax
movq %rax, 0x40(%rsp)
leaq 0x118(%rsp), %rdi
callq 0x79100
movq 0x40(%rsp), %rax
movq 0x30(%rax), %rdi
callq 0x72410
movb %al, 0x3f(%rsp)
jmp 0xcbe7d
movb 0x3f(%rsp), %al
testb $0x1, %al
jne 0xcbeb8
jmp 0xcbe87
movb $0x0, 0x147(%rsp)
movl $0x1, 0x108(%rsp)
jmp 0xcc279
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x110(%rsp)
movl %eax, 0x10c(%rsp)
jmp 0xcc297
movq 0x40(%rsp), %rax
movq 0x30(%rax), %rsi
xorl %eax, %eax
movl %eax, %edx
leaq 0xe8(%rsp), %rdi
callq 0x74c80
jmp 0xcbed4
leaq 0x118(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
callq 0x78530
jmp 0xcbeeb
leaq 0xe8(%rsp), %rdi
callq 0x7cce8
jmp 0xcbefa
jmp 0xcbefc
leaq 0x4ce75(%rip), %rsi     # 0x118d78
leaq 0x118(%rsp), %rdi
callq 0xcc2c0
movb %al, 0x3e(%rsp)
jmp 0xcbf16
movb 0x3e(%rsp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0xcbe69
leaq 0x118(%rsp), %rdi
callq 0x7aba0
movb %al, 0x3d(%rsp)
jmp 0xcbf37
movb 0x3d(%rsp), %al
testb $0x1, %al
jne 0xcbf44
jmp 0xcc0c3
leaq 0xc7(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0x7b5f0
movq 0x30(%rsp), %rdx
leaq 0x1feb2(%rip), %rsi     # 0xebe14
leaq 0xc8(%rsp), %rdi
callq 0x78e70
jmp 0xcbf71
leaq 0x9f(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0x7b5f0
movq 0x28(%rsp), %rdx
leaq 0x1fe9e(%rip), %rsi     # 0xebe2d
leaq 0xa0(%rsp), %rdi
callq 0x78e70
jmp 0xcbf9e
movq 0x40(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
leaq 0xa0(%rsp), %rdx
callq 0x7ab60
jmp 0xcbfba
leaq 0xa0(%rsp), %rdi
callq 0x7cce8
jmp 0xcbfc9
leaq 0x9f(%rsp), %rdi
callq 0x76f80
leaq 0xc8(%rsp), %rdi
callq 0x7cce8
jmp 0xcbfe5
leaq 0xc7(%rsp), %rdi
callq 0x76f80
movq 0x40(%rsp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
jmp 0xcc002
movb $0x0, 0x147(%rsp)
movl $0x1, 0x108(%rsp)
jmp 0xcc279
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x110(%rsp)
movl %eax, 0x10c(%rsp)
leaq 0xe8(%rsp), %rdi
callq 0x7cce8
jmp 0xcc03d
jmp 0xcc297
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x110(%rsp)
movl %eax, 0x10c(%rsp)
jmp 0xcc0b1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x110(%rsp)
movl %eax, 0x10c(%rsp)
jmp 0xcc093
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x110(%rsp)
movl %eax, 0x10c(%rsp)
leaq 0xa0(%rsp), %rdi
callq 0x7cce8
jmp 0xcc091
jmp 0xcc093
leaq 0x9f(%rsp), %rdi
callq 0x76f80
leaq 0xc8(%rsp), %rdi
callq 0x7cce8
jmp 0xcc0af
jmp 0xcc0b1
leaq 0xc7(%rsp), %rdi
callq 0x76f80
jmp 0xcc297
movl $0x68, %edi
callq 0x76970
movq %rax, 0x20(%rsp)
jmp 0xcc0d4
movq 0x20(%rsp), %rdi
leaq 0x118(%rsp), %rsi
callq 0x74930
jmp 0xcc0e8
movq 0x40(%rsp), %rax
movq 0x20(%rsp), %rcx
movq %rcx, 0xa0(%rax)
movq 0xa0(%rax), %rdi
callq 0x73200
movb %al, 0x1f(%rsp)
jmp 0xcc10b
movb 0x1f(%rsp), %al
testb $0x1, %al
jne 0xcc266
jmp 0xcc119
leaq 0x77(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x7b5f0
movq 0x10(%rsp), %rdx
leaq 0x1fce0(%rip), %rsi     # 0xebe14
leaq 0x78(%rsp), %rdi
callq 0x78e70
jmp 0xcc140
leaq 0x4f(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x7b5f0
movq 0x8(%rsp), %rdx
leaq 0x1fce6(%rip), %rsi     # 0xebe41
leaq 0x50(%rsp), %rdi
callq 0x78e70
jmp 0xcc167
movq 0x40(%rsp), %rdi
leaq 0x78(%rsp), %rsi
leaq 0x50(%rsp), %rdx
callq 0x7ab60
jmp 0xcc17d
leaq 0x50(%rsp), %rdi
callq 0x7cce8
jmp 0xcc189
leaq 0x4f(%rsp), %rdi
callq 0x76f80
leaq 0x78(%rsp), %rdi
callq 0x7cce8
jmp 0xcc19f
leaq 0x77(%rsp), %rdi
callq 0x76f80
movq 0x40(%rsp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
jmp 0xcc1b9
movb $0x0, 0x147(%rsp)
movl $0x1, 0x108(%rsp)
jmp 0xcc279
movq 0x20(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x110(%rsp)
movl %eax, 0x10c(%rsp)
callq 0x764d0
jmp 0xcc297
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x110(%rsp)
movl %eax, 0x10c(%rsp)
jmp 0xcc25a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x110(%rsp)
movl %eax, 0x10c(%rsp)
jmp 0xcc242
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x110(%rsp)
movl %eax, 0x10c(%rsp)
leaq 0x50(%rsp), %rdi
callq 0x7cce8
jmp 0xcc240
jmp 0xcc242
leaq 0x4f(%rsp), %rdi
callq 0x76f80
leaq 0x78(%rsp), %rdi
callq 0x7cce8
jmp 0xcc258
jmp 0xcc25a
leaq 0x77(%rsp), %rdi
callq 0x76f80
jmp 0xcc297
movb $0x1, 0x147(%rsp)
movl $0x1, 0x108(%rsp)
leaq 0x118(%rsp), %rdi
callq 0x7cce8
movb 0x147(%rsp), %al
andb $0x1, %al
addq $0x148, %rsp            # imm = 0x148
retq
leaq 0x118(%rsp), %rdi
callq 0x7cce8
jmp 0xcc2a6
jmp 0xcc2a8
movq 0x110(%rsp), %rdi
callq 0x7b550
movq %rax, %rdi
callq 0x88ef0
nopl (%rax)