// File: /workspace/github_cpp_makefile_star2_O1/zeeev[P]DASVC/bamtools/src/api/internal/io/BamFtp_p.cpp
// Function: BamTools::Internal::BamFtp::ConnectCommandSocket()
bool BamFtp::ConnectCommandSocket(void) {

    BT_ASSERT_X(m_commandSocket, "null command socket?");

    // connect to FTP server
    if ( !m_commandSocket->ConnectToHost(m_hostname, m_port, m_mode) ) {
        SetErrorString("BamFtp::ConnectCommandSocket", "could not connect to host - ");
        return false;
    }

    // receive initial reply from host
    if ( !ReceiveReply() ) {
        Close();
        return false;
    }

    // send USER command
    string userCommand = USER_CMD + CMD_SEPARATOR + m_username + FTP_NEWLINE;
    if ( !SendCommand(userCommand, true) ) {
        Close();
        return false;
    }

    // send PASS command
    string passwordCommand = PASS_CMD + CMD_SEPARATOR + m_password + FTP_NEWLINE;
    if ( !SendCommand(passwordCommand, true) ) {
        Close();
        return false;
    }

    // send TYPE command
    string typeCommand = TYPE_CMD + CMD_SEPARATOR + 'I' + FTP_NEWLINE;
    if ( !SendCommand(typeCommand, true) ) {
        Close();
        return false;
    }

    // return success
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdi, %rbx
movq 0x30(%rdi), %rdi
leaq 0x40(%rbx), %rsi
movzwl 0x60(%rbx), %edx
movl 0x8(%rbx), %ecx
callq 0x27ed0
testb %al, %al
je 0x4600f
movq %rbx, %rdi
callq 0x27af0
testb %al, %al
je 0x46083
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x27938(%rip), %rsi     # 0x6d718
movq 0x27939(%rip), %rdx     # 0x6d720
addq %rsi, %rdx
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x267c0
movq 0x8(%r14), %rsi
movl $0x1, %ecx
movq %r14, %rdi
xorl %edx, %edx
movl $0x20, %r8d
callq 0x28f30
leaq 0xb0(%rbx), %rdx
leaq 0x48(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x29130
leaq 0x2786b(%rip), %rdx     # 0x6d698
leaq 0x68(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x29130
leaq 0x58(%rsp), %r14
movq -0x10(%r14), %rdi
cmpq %r14, %rdi
je 0x45e4f
callq 0x27560
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x45e5e
callq 0x27560
leaq 0x68(%rsp), %rsi
movq %rbx, %rdi
movl $0x1, %edx
callq 0x28370
testb %al, %al
je 0x460a2
leaq 0x38(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x278af(%rip), %rsi     # 0x6d738
movq 0x278b0(%rip), %rdx     # 0x6d740
addq %rsi, %rdx
leaq 0x28(%rsp), %rdi
callq 0x267c0
leaq 0x28(%rsp), %rdi
movq 0x8(%rdi), %rsi
movl $0x1, %ecx
xorl %edx, %edx
movl $0x20, %r8d
callq 0x28f30
leaq 0xd0(%rbx), %rdx
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x29130
leaq 0x277c3(%rip), %rdx     # 0x6d698
leaq 0x48(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x29130
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x45ef3
callq 0x27560
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x45f02
callq 0x27560
leaq 0x48(%rsp), %rsi
movq %rbx, %rdi
movl $0x1, %edx
callq 0x28370
testb %al, %al
je 0x460af
leaq 0x98(%rsp), %r13
movq %r13, -0x10(%r13)
movq 0x278a9(%rip), %rsi     # 0x6d7d8
movq 0x278aa(%rip), %rdx     # 0x6d7e0
addq %rsi, %rdx
leaq 0x88(%rsp), %rdi
callq 0x267c0
leaq 0x88(%rsp), %rdi
movq 0x8(%rdi), %rsi
movl $0x1, %ecx
xorl %edx, %edx
movl $0x20, %r8d
callq 0x28f30
leaq 0x28(%rsp), %rdi
movq %r12, (%rdi)
movq 0x88(%rsp), %rsi
movq 0x90(%rsp), %rdx
addq %rsi, %rdx
callq 0x267c0
leaq 0x28(%rsp), %rdi
movq 0x8(%rdi), %rsi
movl $0x1, %ecx
xorl %edx, %edx
movl $0x49, %r8d
callq 0x28f30
leaq 0x276f2(%rip), %rdx     # 0x6d698
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x29130
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x45fc4
callq 0x27560
movq 0x88(%rsp), %rdi
cmpq %r13, %rdi
je 0x45fd6
callq 0x27560
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
movl $0x1, %edx
callq 0x28370
movl %eax, %ebp
testb %al, %al
jne 0x45ff7
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x460ba
callq 0x27560
jmp 0x460ba
leaq 0x78(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x10982(%rip), %rsi     # 0x569a1
leaq 0x10997(%rip), %rdx     # 0x569bd
leaq 0x68(%rsp), %rdi
callq 0x26750
leaq 0x58(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1097e(%rip), %rsi     # 0x569be
leaq 0x10993(%rip), %rdx     # 0x569da
leaq 0x48(%rsp), %rdi
callq 0x26750
leaq 0x68(%rsp), %rsi
leaq 0x48(%rsp), %rdx
movq %rbx, %rdi
callq 0x288c0
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x46072
callq 0x27560
movq 0x68(%rsp), %rdi
cmpq %r14, %rdi
je 0x4608c
callq 0x27560
jmp 0x4608c
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
xorl %ebp, %ebp
movl %ebp, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
xorl %ebp, %ebp
jmp 0x460c9
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
xorl %ebp, %ebp
movq 0x48(%rsp), %rdi
cmpq %r14, %rdi
je 0x460c9
callq 0x27560
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4608e
callq 0x27560
jmp 0x4608e
jmp 0x460e0
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x460f9
callq 0x27560
jmp 0x460f9
jmp 0x460f6
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %r13, %rdi
jne 0x46117
jmp 0x46148
jmp 0x46145
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x46148
callq 0x27560
jmp 0x46148
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x46137
callq 0x27560
jmp 0x46137
jmp 0x46134
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
jne 0x46152
jmp 0x46185
jmp 0x46182
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r14, %rdi
je 0x46185
callq 0x27560
jmp 0x46185
movq %rax, %rbx
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x46176
callq 0x27560
jmp 0x46176
jmp 0x46173
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
jne 0x461b6
jmp 0x461c0
movq %rax, %rbx
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x461b6
jmp 0x461c0
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x461ac
callq 0x27560
jmp 0x461ac
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r14, %rdi
je 0x461c0
callq 0x27560
jmp 0x461c0
movq %rax, %rbx
movq %rbx, %rdi
callq 0x28c20