// File: /workspace/github_cpp_makefile_star2_O3/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 0x27ec0
testb %al, %al
je 0x45fe7
movq %rbx, %rdi
callq 0x27af0
testb %al, %al
je 0x4605b
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x27958(%rip), %rsi     # 0x6d710
movq 0x27959(%rip), %rdx     # 0x6d718
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 0x28f20
leaq 0xb0(%rbx), %rdx
leaq 0x48(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x29120
leaq 0x2788b(%rip), %rdx     # 0x6d690
leaq 0x68(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x29120
leaq 0x58(%rsp), %r14
movq -0x10(%r14), %rdi
cmpq %r14, %rdi
je 0x45e27
callq 0x27560
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x45e36
callq 0x27560
leaq 0x68(%rsp), %rsi
movq %rbx, %rdi
movl $0x1, %edx
callq 0x28360
testb %al, %al
je 0x4607a
leaq 0x38(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x278cf(%rip), %rsi     # 0x6d730
movq 0x278d0(%rip), %rdx     # 0x6d738
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 0x28f20
leaq 0xd0(%rbx), %rdx
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x29120
leaq 0x277e3(%rip), %rdx     # 0x6d690
leaq 0x48(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x29120
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x45ecb
callq 0x27560
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x45eda
callq 0x27560
leaq 0x48(%rsp), %rsi
movq %rbx, %rdi
movl $0x1, %edx
callq 0x28360
testb %al, %al
je 0x46087
leaq 0x98(%rsp), %r13
movq %r13, -0x10(%r13)
movq 0x278c9(%rip), %rsi     # 0x6d7d0
movq 0x278ca(%rip), %rdx     # 0x6d7d8
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 0x28f20
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 0x28f20
leaq 0x27712(%rip), %rdx     # 0x6d690
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x29120
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x45f9c
callq 0x27560
movq 0x88(%rsp), %rdi
cmpq %r13, %rdi
je 0x45fae
callq 0x27560
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
movl $0x1, %edx
callq 0x28360
movl %eax, %ebp
testb %al, %al
jne 0x45fcf
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x46092
callq 0x27560
jmp 0x46092
leaq 0x78(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x109aa(%rip), %rsi     # 0x569a1
leaq 0x109bf(%rip), %rdx     # 0x569bd
leaq 0x68(%rsp), %rdi
callq 0x26750
leaq 0x58(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x109a6(%rip), %rsi     # 0x569be
leaq 0x109bb(%rip), %rdx     # 0x569da
leaq 0x48(%rsp), %rdi
callq 0x26750
leaq 0x68(%rsp), %rsi
leaq 0x48(%rsp), %rdx
movq %rbx, %rdi
callq 0x288b0
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x4604a
callq 0x27560
movq 0x68(%rsp), %rdi
cmpq %r14, %rdi
je 0x46064
callq 0x27560
jmp 0x46064
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 0x460a1
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
xorl %ebp, %ebp
movq 0x48(%rsp), %rdi
cmpq %r14, %rdi
je 0x460a1
callq 0x27560
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x46066
callq 0x27560
jmp 0x46066
jmp 0x460b8
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x460d1
callq 0x27560
jmp 0x460d1
jmp 0x460ce
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %r13, %rdi
jne 0x460ef
jmp 0x46120
jmp 0x4611d
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x46120
callq 0x27560
jmp 0x46120
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x4610f
callq 0x27560
jmp 0x4610f
jmp 0x4610c
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
jne 0x4612a
jmp 0x4615d
jmp 0x4615a
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r14, %rdi
je 0x4615d
callq 0x27560
jmp 0x4615d
movq %rax, %rbx
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4614e
callq 0x27560
jmp 0x4614e
jmp 0x4614b
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
jne 0x4618e
jmp 0x46198
movq %rax, %rbx
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x4618e
jmp 0x46198
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x46184
callq 0x27560
jmp 0x46184
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r14, %rdi
je 0x46198
callq 0x27560
jmp 0x46198
movq %rax, %rbx
movq %rbx, %rdi
callq 0x28c10