// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/lib/net.c
// Function: netGetFtpInfo
boolean netGetFtpInfo(char *url, long long *retSize, time_t *retTime)
/* Return date in UTC and size of ftp url file */
{
/* Parse the URL and connect. */
struct netParsedUrl npu;
netParseUrl(url, &npu);
if (!sameString(npu.protocol, "ftp"))
    errAbort("netGetFtpInfo: url (%s) is not for ftp.", url);

// TODO maybe remove this workaround where udc cache wants info on URL "/" ?
if (sameString(npu.file,"/"))
    {
    *retSize = 0;
    *retTime = time(NULL);
    return TRUE;
    }

int sd = openFtpControlSocket(npu.host, atoi(npu.port), npu.user, npu.password);
if (sd < 0)
    return FALSE;
char cmd[256];
safef(cmd,sizeof(cmd),"SIZE %s\r\n", npu.file);
struct dyString *rs = NULL;
if (!sendFtpCommand(sd, cmd, &rs, NULL))
    {
    close(sd);
    return FALSE;
    }
*retSize = parseFtpSIZE(rs->string);
/* 200 12345 */
dyStringFree(&rs);

safef(cmd,sizeof(cmd),"MDTM %s\r\n", npu.file);
if (!sendFtpCommand(sd, cmd, &rs, NULL))
    {
    close(sd);
    return FALSE;
    }
*retTime = parseFtpMDTM(rs->string);
/* 200 YYYYMMDDhhmmss */
dyStringFree(&rs);
close(sd);   
return TRUE;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2970, %rsp           # imm = 0x2970
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x2850(%rbp), %rsi
callq 0x42160
leaq -0x2850(%rbp), %rdi
leaq 0x9c31b(%rip), %rsi     # 0xdee30
callq 0x6a40
cmpl $0x0, %eax
je 0x42b31
movq -0x10(%rbp), %rsi
leaq 0x99282(%rip), %rdi     # 0xdbdac
movb $0x0, %al
callq 0x35d40
leaq -0x2850(%rbp), %rdi
addq $0x1820, %rdi           # imm = 0x1820
leaq 0x9c539(%rip), %rsi     # 0xdf07f
callq 0x6a40
cmpl $0x0, %eax
jne 0x42b7a
movq -0x18(%rbp), %rax
movq $0x0, (%rax)
xorl %eax, %eax
movl %eax, %edi
callq 0x6660
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0x42d0b
leaq -0x2850(%rbp), %rax
addq $0x1010, %rax           # imm = 0x1010
movq %rax, -0x2970(%rbp)
leaq -0x2850(%rbp), %rdi
addq $0x1810, %rdi           # imm = 0x1810
callq 0x6bd0
movq -0x2970(%rbp), %rdi
movl %eax, %esi
leaq -0x2850(%rbp), %rdx
addq $0x10, %rdx
leaq -0x2850(%rbp), %rcx
addq $0x810, %rcx            # imm = 0x810
callq 0x42d20
movl %eax, -0x2854(%rbp)
cmpl $0x0, -0x2854(%rbp)
jge 0x42be3
movl $0x0, -0x4(%rbp)
jmp 0x42d0b
leaq -0x2960(%rbp), %rdi
leaq -0x2850(%rbp), %rcx
addq $0x1820, %rcx           # imm = 0x1820
movl $0x100, %esi            # imm = 0x100
leaq 0x991d0(%rip), %rdx     # 0xdbdd4
movb $0x0, %al
callq 0x31090
movq $0x0, -0x2968(%rbp)
movl -0x2854(%rbp), %edi
leaq -0x2960(%rbp), %rsi
leaq -0x2968(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x42e80
cmpl $0x0, %eax
jne 0x42c4f
movl -0x2854(%rbp), %edi
callq 0x6e90
movl $0x0, -0x4(%rbp)
jmp 0x42d0b
movq -0x2968(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x42ec0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
leaq -0x2968(%rbp), %rdi
callq 0x35080
leaq -0x2960(%rbp), %rdi
leaq -0x2850(%rbp), %rcx
addq $0x1820, %rcx           # imm = 0x1820
movl $0x100, %esi            # imm = 0x100
leaq 0x99148(%rip), %rdx     # 0xdbdde
movb $0x0, %al
callq 0x31090
movl -0x2854(%rbp), %edi
leaq -0x2960(%rbp), %rsi
leaq -0x2968(%rbp), %rdx
xorl %eax, %eax
movl %eax, %ecx
callq 0x42e80
cmpl $0x0, %eax
jne 0x42cd3
movl -0x2854(%rbp), %edi
callq 0x6e90
movl $0x0, -0x4(%rbp)
jmp 0x42d0b
movq -0x2968(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x42f30
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
leaq -0x2968(%rbp), %rdi
callq 0x35080
movl -0x2854(%rbp), %edi
callq 0x6e90
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x2970, %rsp           # imm = 0x2970
popq %rbp
retq
nopw (%rax,%rax)