// File: /workspace/github_c_makefile_star2_O3/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 $0x838, %rsp            # imm = 0x838
movq %r8, %rbx
movq %rcx, %r14
movl %edx, %ebp
movq %rsi, %r15
movq %rdi, %r12
leaq 0x51e03(%rip), %rdi     # 0x916a8
movq %r12, %rsi
callq 0x21b23
testl %eax, %eax
jne 0x3f8db
leaq 0x51df8(%rip), %rdi     # 0x916b0
movq %r12, %rsi
callq 0x21b23
testl %eax, %eax
jne 0x3f8db
leaq 0x51dee(%rip), %rdi     # 0x916b9
movq %r12, %rsi
callq 0x21b23
testl %eax, %eax
je 0x3fbc6
leaq 0x55225(%rip), %rsi     # 0x94b07
movl $0x4, %edi
movl %ebp, %edx
movq %r15, %rcx
movq %r12, %r8
xorl %eax, %eax
callq 0x427e5
leaq 0x90(%rbx), %rax
movq %rax, 0x8(%rsp)
movl 0x90(%rbx), %r13d
testl %r13d, %r13d
jle 0x3fa6a
movq 0x98(%rbx), %rcx
movq %r15, %rax
subq %rcx, %rax
je 0x3fb5a
cmpq $0x20000, %rax          # imm = 0x20000
ja 0x3f9dc
leaq 0x557ba(%rip), %rsi     # 0x950f2
movl $0x4, %edi
movq %rax, %r13
movq %rax, %rdx
xorl %eax, %eax
callq 0x427e5
movq 0x8(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x18(%rsp)
cmpq $0x0, 0x848ab(%rip)     # 0xc4208
jne 0x3f970
movl $0x2000, %edi           # imm = 0x2000
callq 0x2dff4
movq %rax, 0x84898(%rip)     # 0xc4208
movq %r15, 0x10(%rsp)
movq %r12, (%rsp)
testq %r13, %r13
movq %r13, 0x20(%rsp)
je 0x3fa25
xorl %r15d, %r15d
movl $0x2000, %eax           # imm = 0x2000
cmpq %rax, %r13
movl $0x2000, %edx           # imm = 0x2000
cmovbq %r13, %rdx
movq 0x84866(%rip), %rsi     # 0xc4208
incq 0x138(%rbx)
movl 0x18(%rsp), %edi
callq 0x6aa0
movq %rax, %r12
addq %rax, 0x140(%rbx)
testq %rax, %rax
jns 0x3f9d2
leaq 0x5579e(%rip), %rdi     # 0x95166
movq %r15, %rsi
xorl %eax, %eax
callq 0x26fc7
addq %r12, %r15
subq %r12, %r13
jne 0x3f98a
jmp 0x3fa28
leaq 0x5573d(%rip), %rsi     # 0x95120
movl $0x4, %edi
movq %rcx, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x427e5
movq 0x8(%rsp), %rdi
callq 0x235bf
cmpl $0x0, 0xa0(%rbx)
jle 0x3fa14
leaq 0xa0(%rbx), %rdi
callq 0x235bf
xorps %xmm0, %xmm0
movq 0x8(%rsp), %rax
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
jmp 0x3fa6a
xorl %r15d, %r15d
movq 0x20(%rsp), %rdx
cmpq %rdx, %r15
jae 0x3fa43
leaq 0x55765(%rip), %rdi     # 0x9519e
movq %r15, %rsi
xorl %eax, %eax
callq 0x26e94
movq 0x10(%rsp), %r15
movq %r15, 0x98(%rbx)
incq 0x160(%rbx)
movl 0x90(%rbx), %r13d
testl %r13d, %r13d
movq (%rsp), %r12
jg 0x3fb5a
movq %r15, 0x10(%rsp)
incq 0x158(%rbx)
movq 0xa8(%rbx), %rsi
movq %r12, %r15
testq %rsi, %rsi
je 0x3fa90
movq %r12, %rdi
callq 0x30a18
movq %rax, %r15
movq %r12, (%rsp)
leaq 0x556b8(%rip), %rdx     # 0x95153
leaq 0x30(%rsp), %r13
movq %r13, %rdi
movl $0x800, %esi            # imm = 0x800
movq %r15, %rcx
movq 0x10(%rsp), %r12
movq %r12, %r8
xorl %eax, %eax
callq 0x23f33
leaq 0xa0(%rbx), %rsi
movq %r13, %rdi
callq 0x2ff0b
movl %eax, 0x90(%rbx)
movq %r12, 0x98(%rbx)
testl %eax, %eax
js 0x3fb3f
movl %eax, %r13d
leaq 0x524ae(%rip), %rdi     # 0x91f92
movq %r15, %rsi
callq 0x21b23
testl %eax, %eax
je 0x3fb5a
leaq 0x28(%rsp), %rcx
movq $0x0, (%rcx)
leaq 0x1c(%rsp), %rdx
movl $0x0, (%rdx)
leaq 0x30(%rsp), %rsi
movl %r13d, %edi
callq 0x30ac2
testl %eax, %eax
je 0x3fb3f
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
movq (%rsp), %r15
je 0x3fb5a
callq 0x2e0a0
movl 0x1c(%rsp), %r13d
movq 0x8(%rsp), %rax
movl %r13d, (%rax)
testl %r13d, %r13d
jns 0x3fb5a
jmp 0x3fb49
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
movq (%rsp), %r15
leaq 0x55041(%rip), %rdi     # 0x94b91
movq %r15, %rsi
xorl %eax, %eax
callq 0x26e94
xorl %r15d, %r15d
testl %ebp, %ebp
jle 0x3fba7
movl %ebp, %edx
incq 0x138(%rbx)
movl %r13d, %edi
movq %r14, %rsi
callq 0x6aa0
addq %rax, 0x140(%rbx)
testl %eax, %eax
jle 0x3fb94
addl %eax, %r15d
movl %eax, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
addq %rcx, %r14
subl %eax, %ebp
jg 0x3fb61
jmp 0x3fba7
cmpl $-0x1, %eax
jne 0x3fba7
leaq 0x5500e(%rip), %rdi     # 0x94bae
xorl %eax, %eax
callq 0x26fc7
movl %r15d, %eax
addq %rax, 0x98(%rbx)
movl %r15d, %eax
addq $0x838, %rsp            # imm = 0x838
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x54f72(%rip), %rdi     # 0x94b3f
movq %r12, %rsi
xorl %eax, %eax
callq 0x26e94
jmp 0x3f8f6