// File: /workspace/github_c_makefile_star2_O2/icebert[P]pblat/lib/udc.c
// Function: udcDataViaHttpOrFtp
int udcDataViaHttpOrFtp( char *url, bits64 offset, int size, void *buffer, struct udcFile *file)
/* Fetch a block of data of given size into buffer using url's protocol,
 * which must be http, https or ftp.  Returns number of bytes actually read.
 * Does an errAbort on error.
 * Typically will be called with size in the 8k-64k range. */
{
if (startsWith("http://",url) || startsWith("https://",url) || startsWith("ftp://",url))
    verbose(4, "reading http/https/ftp data - %d bytes at %lld - on %s\n", size, offset, url);
else
    errAbort("Invalid protocol in url [%s] in udcDataViaFtp, only http, https, or ftp supported",
	     url); 
int sd = connInfoGetSocket(file, url, offset, size);
if (sd < 0)
    errAbort("Can't get data socket for %s", url);
int rd = 0, total = 0, remaining = size;
char *buf = (char *)buffer;
while ((remaining > 0) && ((rd = ourRead(&file->ios.net, sd, buf, remaining)) > 0))
    {
    total += rd;
    buf += rd;
    remaining -= rd;
    }
if (rd == -1)
    errnoAbort("udcDataViaHttpOrFtp: error reading socket");
struct connInfo *ci = &file->connInfo;
if (ci == NULL)
    mustCloseFd(&sd);
else
    ci->offset += total;
return total;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x848, %rsp            # imm = 0x848
movq %r8, %r15
movq %rcx, %r14
movl %edx, %ebp
movq %rsi, 0x8(%rsp)
movq %rdi, %rbx
leaq 0x46dc8(%rip), %rdi     # 0x805a8
movq %rbx, %rsi
callq 0x1db41
testl %eax, %eax
jne 0x39816
leaq 0x46dbd(%rip), %rdi     # 0x805b0
movq %rbx, %rsi
callq 0x1db41
testl %eax, %eax
jne 0x39816
leaq 0x46db3(%rip), %rdi     # 0x805b9
movq %rbx, %rsi
callq 0x1db41
testl %eax, %eax
je 0x39b05
leaq 0x4a1ea(%rip), %rsi     # 0x83a07
pushq $0x4
popq %rdi
movl %ebp, %edx
movq 0x8(%rsp), %rcx
movq %rbx, %r8
xorl %eax, %eax
callq 0x3c521
leaq 0x90(%r15), %rax
movq %rax, 0x18(%rsp)
movl 0x90(%r15), %r13d
testl %r13d, %r13d
movq %r15, 0x20(%rsp)
jle 0x399a5
movq 0x98(%r15), %rcx
movq 0x8(%rsp), %r12
subq %rcx, %r12
je 0x39a9a
cmpq $0x20000, %r12          # imm = 0x20000
ja 0x39913
movq %rbx, 0x10(%rsp)
leaq 0x4a772(%rip), %rsi     # 0x83ff2
pushq $0x4
popq %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x3c521
movl 0x90(%r15), %eax
movl %eax, 0x28(%rsp)
cmpq $0x0, 0x7e988(%rip)     # 0xb8228
jne 0x398b3
movl $0x2000, %edi           # imm = 0x2000
callq 0x28bb0
movq %rax, 0x7e975(%rip)     # 0xb8228
leaq 0x130(%r15), %rbx
xorl %r15d, %r15d
movq %r12, 0x30(%rsp)
movq %r12, %r13
testq %r13, %r13
je 0x3995d
movl $0x2000, %eax           # imm = 0x2000
cmpq %rax, %r13
movl $0x2000, %ecx           # imm = 0x2000
cmovbq %r13, %rcx
movq 0x7e942(%rip), %rdx     # 0xb8228
movq %rbx, %rdi
movl 0x28(%rsp), %esi
callq 0x39b1b
movq %rax, %r12
testq %rax, %rax
jns 0x3990b
leaq 0x4a765(%rip), %rdi     # 0x84066
movq %r15, %rsi
xorl %eax, %eax
callq 0x22504
subq %r12, %r13
addq %r12, %r15
jmp 0x398c5
leaq 0x4a706(%rip), %rsi     # 0x84020
pushq $0x4
popq %rdi
movq %rcx, %rdx
movq 0x8(%rsp), %rcx
xorl %eax, %eax
callq 0x3c521
movq 0x18(%rsp), %rdi
callq 0x1f1b0
cmpl $0x0, 0xa0(%r15)
jle 0x3994c
leaq 0xa0(%r15), %rdi
callq 0x1f1b0
xorps %xmm0, %xmm0
movq 0x18(%rsp), %rax
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
jmp 0x399a5
movq 0x30(%rsp), %rdx
cmpq %rdx, %r15
jae 0x39978
leaq 0x4a730(%rip), %rdi     # 0x8409e
movq %r15, %rsi
xorl %eax, %eax
callq 0x223fb
movq 0x20(%rsp), %r15
movq 0x8(%rsp), %rax
movq %rax, 0x98(%r15)
incq 0x160(%r15)
movl 0x90(%r15), %r13d
testl %r13d, %r13d
movq 0x10(%rsp), %rbx
jg 0x39a9a
incq 0x158(%r15)
movq 0xa8(%r15), %rsi
movq %rbx, %r15
testq %rsi, %rsi
je 0x399c6
movq %r15, %rdi
callq 0x2b481
movq %rax, %rbx
movq %r15, 0x10(%rsp)
leaq 0x4a681(%rip), %rdx     # 0x84053
leaq 0x40(%rsp), %r15
movq %r15, %rdi
movl $0x800, %esi            # imm = 0x800
movq %rbx, %rcx
movq 0x8(%rsp), %r12
movq %r12, %r8
xorl %eax, %eax
callq 0x1fab2
movq 0x20(%rsp), %rax
leaq 0xa0(%rax), %rsi
movq %r15, %rdi
movq %rax, %r15
callq 0x2a951
movl %eax, 0x90(%r15)
movq %r12, 0x98(%r15)
testl %eax, %eax
js 0x39a7a
movl %eax, %r13d
leaq 0x4746e(%rip), %rdi     # 0x80e92
movq %rbx, %rsi
callq 0x1db41
testl %eax, %eax
je 0x39a9a
leaq 0x38(%rsp), %rcx
andq $0x0, (%rcx)
leaq 0x2c(%rsp), %rdx
andl $0x0, (%rdx)
leaq 0x40(%rsp), %rsi
movl %r13d, %edi
callq 0x2b52b
testl %eax, %eax
movq 0x10(%rsp), %rbx
je 0x39a85
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x39a9a
callq 0x28c2d
movl 0x2c(%rsp), %r13d
movq 0x18(%rsp), %rax
movl %r13d, (%rax)
testl %r13d, %r13d
jns 0x39a9a
jmp 0x39a89
pushq $-0x1
popq %r13
movq 0x10(%rsp), %rbx
jmp 0x39a89
pushq $-0x1
popq %r13
leaq 0x4a001(%rip), %rdi     # 0x83a91
movq %rbx, %rsi
xorl %eax, %eax
callq 0x223fb
leaq 0x130(%r15), %rbx
xorl %r15d, %r15d
testl %ebp, %ebp
jle 0x39ae1
movl %ebp, %ecx
movq %rbx, %rdi
movl %r13d, %esi
movq %r14, %rdx
callq 0x39b1b
testl %eax, %eax
jle 0x39ace
addl %eax, %r15d
movl %eax, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
addq %rcx, %r14
subl %eax, %ebp
jmp 0x39aa4
cmpl $-0x1, %eax
jne 0x39ae1
leaq 0x49fd4(%rip), %rdi     # 0x83aae
xorl %eax, %eax
callq 0x22504
movl %r15d, %eax
movq 0x20(%rsp), %rcx
addq %rax, 0x98(%rcx)
movl %r15d, %eax
addq $0x848, %rsp            # imm = 0x848
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x49f33(%rip), %rdi     # 0x83a3f
movq %rbx, %rsi
xorl %eax, %eax
callq 0x223fb
jmp 0x39831