// File: /workspace/github_c_makefile_star2_O0/icebert[P]pblat/htslib/knetfile.c
// Function: kftp_parse_url
knetFile *kftp_parse_url(const char *fn, const char *mode)
{
	knetFile *fp;
	char *p;
	int l;
	if (strstr(fn, "ftp://") != fn) return 0;
	for (p = (char*)fn + 6; *p && *p != '/'; ++p);
	if (*p != '/') return 0;
	l = p - fn - 6;
	fp = (knetFile*)calloc(1, sizeof(knetFile));
	fp->type = KNF_TYPE_FTP;
	fp->fd = -1;
	/* the Linux/Mac version of socket_connect() also recognizes a port
	 * like "ftp", but the Windows version does not. */
	fp->port = strdup("21");
	fp->host = (char*)calloc(l + 1, 1);
	if (strchr(mode, 'c')) fp->no_reconnect = 1;
	strncpy(fp->host, fn + 6, l);
	fp->retr = (char*)calloc(strlen(p) + 8, 1);
	sprintf(fp->retr, "RETR %s\r\n", p);
    fp->size_cmd = (char*)calloc(strlen(p) + 8, 1);
    sprintf(fp->size_cmd, "SIZE %s\r\n", p);
	fp->seek_offset = 0;
	return fp;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
leaq 0xf6f6(%rip), %rsi      # 0xdb471
callq 0x6170
cmpq -0x10(%rbp), %rax
je 0xcbd93
movq $0x0, -0x8(%rbp)
jmp 0xcbf2b
movq -0x10(%rbp), %rax
addq $0x6, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x2d(%rbp)
je 0xcbdc0
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
setne %al
movb %al, -0x2d(%rbp)
movb -0x2d(%rbp), %al
testb $0x1, %al
jne 0xcbdc9
jmp 0xcbdd9
jmp 0xcbdcb
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0xcbd9f
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
je 0xcbdf2
movq $0x0, -0x8(%rbp)
jmp 0xcbf2b
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
subq %rcx, %rax
subq $0x6, %rax
movl %eax, -0x2c(%rbp)
movl $0x1, %edi
movl $0x88, %esi
callq 0x6460
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl $0x2, (%rax)
movq -0x20(%rbp), %rax
movl $0xffffffff, 0x4(%rax)  # imm = 0xFFFFFFFF
leaq 0xff49(%rip), %rdi      # 0xdbd7c
callq 0x6dd0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdi
movl $0x1, %esi
callq 0x6460
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rdi
movl $0x63, %esi
callq 0x6260
cmpq $0x0, %rax
je 0xcbe80
movq -0x20(%rbp), %rax
movl $0x1, 0x3c(%rax)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x10(%rbp), %rsi
addq $0x6, %rsi
movslq -0x2c(%rbp), %rdx
callq 0x6370
movq -0x28(%rbp), %rdi
callq 0x62c0
movq %rax, %rdi
addq $0x8, %rdi
movl $0x1, %esi
callq 0x6460
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x20(%rbp), %rax
movq 0x50(%rax), %rdi
movq -0x28(%rbp), %rdx
leaq 0x199cd(%rip), %rsi     # 0xe589e
movb $0x0, %al
callq 0x6160
movq -0x28(%rbp), %rdi
callq 0x62c0
movq %rax, %rdi
addq $0x8, %rdi
movl $0x1, %esi
callq 0x6460
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x20(%rbp), %rax
movq 0x58(%rax), %rdi
movq -0x28(%rbp), %rdx
leaq 0xfec4(%rip), %rsi      # 0xdbdd4
movb $0x0, %al
callq 0x6160
movq -0x20(%rbp), %rax
movq $0x0, 0x60(%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)