// File: /workspace/github_cpp_makefile_star2_O2/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 %r14
pushq %rbx
subq $0xa0, %rsp
movq %rdi, %rbx
movq 0x30(%rdi), %rdi
leaq 0x40(%rbx), %rsi
movzwl 0x60(%rbx), %edx
movl 0x8(%rbx), %ecx
callq 0x33cf0
testb %al, %al
je 0x4dbbb
movq %rbx, %rdi
callq 0x33760
testb %al, %al
je 0x4dc0d
leaq 0x2a743(%rip), %rsi     # 0x781b8
movq %rsp, %r14
pushq $0x20
popq %rdx
movq %r14, %rdi
callq 0x32560
leaq 0xb0(%rbx), %rdx
leaq 0x20(%rsp), %rdi
movq %r14, %rsi
callq 0x355e0
leaq 0x2a69a(%rip), %rdx     # 0x78138
leaq 0x60(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x355e0
leaq 0x20(%rsp), %rdi
callq 0x33a00
movq %rsp, %rdi
callq 0x33a00
leaq 0x60(%rsp), %rsi
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq 0x34370
testb %al, %al
je 0x4dc1a
leaq 0x2a6fa(%rip), %rsi     # 0x781d8
leaq 0x40(%rsp), %rdi
pushq $0x20
popq %rdx
callq 0x32560
leaq 0xd0(%rbx), %rdx
movq %rsp, %rdi
leaq 0x40(%rsp), %rsi
callq 0x355e0
leaq 0x2a632(%rip), %rdx     # 0x78138
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
callq 0x355e0
movq %rsp, %rdi
callq 0x33a00
leaq 0x40(%rsp), %rdi
callq 0x33a00
leaq 0x20(%rsp), %rsi
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq 0x34370
testb %al, %al
je 0x4dc27
leaq 0x2a734(%rip), %rsi     # 0x78278
leaq 0x80(%rsp), %rdi
pushq $0x20
popq %rdx
callq 0x32560
leaq 0x40(%rsp), %rdi
leaq 0x80(%rsp), %rsi
pushq $0x49
popq %rdx
callq 0x32560
leaq 0x2a5c8(%rip), %rdx     # 0x78138
movq %rsp, %rdi
leaq 0x40(%rsp), %rsi
callq 0x355e0
leaq 0x40(%rsp), %rdi
callq 0x33a00
leaq 0x80(%rsp), %rdi
callq 0x33a00
movq %rsp, %rsi
pushq $0x1
popq %rdx
movq %rbx, %rdi
callq 0x34370
movl %eax, %ebp
testb %al, %al
jne 0x4dbb1
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movq %rsp, %rdi
callq 0x33a00
jmp 0x4dc32
leaq 0xedfe(%rip), %rsi      # 0x5c9c0
leaq 0x60(%rsp), %rdi
movq %rsp, %rdx
callq 0x31b30
leaq 0xee07(%rip), %rsi      # 0x5c9dd
leaq 0x20(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0x31b30
leaq 0x60(%rsp), %rsi
leaq 0x20(%rsp), %rdx
movq %rbx, %rdi
callq 0x34ab0
leaq 0x20(%rsp), %rdi
callq 0x33a00
leaq 0x60(%rsp), %rdi
callq 0x33a00
jmp 0x4dc16
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
xorl %ebp, %ebp
jmp 0x4dc46
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
xorl %ebp, %ebp
jmp 0x4dc3c
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
xorl %ebp, %ebp
leaq 0x20(%rsp), %rdi
callq 0x33a00
leaq 0x60(%rsp), %rdi
callq 0x33a00
movl %ebp, %eax
addq $0xa0, %rsp
popq %rbx
popq %r14
popq %rbp
retq
jmp 0x4dc95
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x33a00
jmp 0x4dc79
movq %rax, %rbx
movq %rsp, %rdi
callq 0x33a00
jmp 0x4dc98
jmp 0x4dcc4
jmp 0x4dc95
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x33a00
jmp 0x4dc98
movq %rax, %rbx
movq %rsp, %rdi
callq 0x33a00
jmp 0x4dca9
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x33a00
jmp 0x4dcc7
jmp 0x4dcc4
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x33a00
jmp 0x4dcc7
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x33a00
jmp 0x4dce5
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x33a00
jmp 0x4dd01
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x33a00
jmp 0x4dcf7
movq %rax, %rbx
movq %rsp, %rdi
callq 0x33a00
jmp 0x4dd01
movq %rax, %rbx
jmp 0x4dd01
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x33a00
movq %rbx, %rdi
callq 0x34ed0
movq %rax, %rdi
callq 0x39b2f
nop