// File: /workspace/github_c_makefile_star2_O1/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 0x5202f(%rip), %rdi     # 0x915b8
movq %r12, %rsi
callq 0x217c8
testl %eax, %eax
jne 0x3f5bf
leaq 0x52024(%rip), %rdi     # 0x915c0
movq %r12, %rsi
callq 0x217c8
testl %eax, %eax
jne 0x3f5bf
leaq 0x5201a(%rip), %rdi     # 0x915c9
movq %r12, %rsi
callq 0x217c8
testl %eax, %eax
je 0x3f8b9
leaq 0x55459(%rip), %rsi     # 0x94a1f
movl $0x4, %edi
movl %ebp, %edx
movq %r15, %rcx
movq %r12, %r8
xorl %eax, %eax
callq 0x4246e
leaq 0x90(%rbx), %r13
cmpl $0x0, 0x90(%rbx)
jle 0x3f732
movq 0x98(%rbx), %rcx
movq %r15, %rax
subq %rcx, %rax
je 0x3f732
cmpq $0x20000, %rax          # imm = 0x20000
ja 0x3f6ef
leaq 0x559f6(%rip), %rsi     # 0x9500a
movl $0x4, %edi
movq %rax, %rdx
movq %rax, 0x20(%rsp)
xorl %eax, %eax
callq 0x4246e
movl (%r13), %eax
movl %eax, 0x18(%rsp)
cmpq $0x0, 0x84bd0(%rip)     # 0xc4208
jne 0x3f64b
movl $0x2000, %edi           # imm = 0x2000
callq 0x2dc95
movq %rax, 0x84bbd(%rip)     # 0xc4208
movq %r13, 0x8(%rsp)
movq %r15, 0x10(%rsp)
movq %r12, (%rsp)
movq 0x20(%rsp), %r15
xorl %r12d, %r12d
testq %r15, %r15
je 0x3f6b6
movl $0x2000, %eax           # imm = 0x2000
cmpq %rax, %r15
movl $0x2000, %edx           # imm = 0x2000
cmovbq %r15, %rdx
movq 0x84b8a(%rip), %rsi     # 0xc4208
incq 0x138(%rbx)
movl 0x18(%rsp), %edi
callq 0x6aa0
movq %rax, %r13
addq %rax, 0x140(%rbx)
testq %rax, %rax
jns 0x3f6ae
leaq 0x559da(%rip), %rdi     # 0x9507e
movq %r12, %rsi
xorl %eax, %eax
callq 0x26c9f
addq %r13, %r12
subq %r13, %r15
jne 0x3f666
movq 0x20(%rsp), %rdx
cmpq %rdx, %r12
jae 0x3f6d1
leaq 0x559ef(%rip), %rdi     # 0x950b6
movq %r12, %rsi
xorl %eax, %eax
callq 0x26b6f
movq 0x10(%rsp), %r15
movq %r15, 0x98(%rbx)
incq 0x160(%rbx)
movq (%rsp), %r12
movq 0x8(%rsp), %r13
jmp 0x3f732
leaq 0x55942(%rip), %rsi     # 0x95038
movl $0x4, %edi
movq %rcx, %rdx
movq %r15, %rcx
xorl %eax, %eax
callq 0x4246e
movq %r13, %rdi
callq 0x232a1
cmpl $0x0, 0xa0(%rbx)
jle 0x3f725
leaq 0xa0(%rbx), %rdi
callq 0x232a1
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r13)
movups %xmm0, (%r13)
movq %r13, %rax
movl (%r13), %r13d
testl %r13d, %r13d
jg 0x3f825
movq %rax, 0x8(%rsp)
movq %r15, 0x10(%rsp)
incq 0x158(%rbx)
movq 0xa8(%rbx), %rsi
movq %r12, %r15
testq %rsi, %rsi
je 0x3f76d
movq %r12, %rdi
callq 0x3070a
movq %rax, %r15
movq %r12, (%rsp)
leaq 0x558f3(%rip), %rdx     # 0x9506b
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 0x23c18
leaq 0xa0(%rbx), %rsi
movq %r13, %rdi
callq 0x2fc1b
movl %eax, 0x90(%rbx)
movq %r12, 0x98(%rbx)
testl %eax, %eax
js 0x3f81b
movl %eax, %r13d
leaq 0x526e1(%rip), %rdi     # 0x91ea2
movq %r15, %rsi
callq 0x217c8
testl %eax, %eax
je 0x3f821
leaq 0x28(%rsp), %rcx
movq $0x0, (%rcx)
leaq 0x1c(%rsp), %rdx
movl $0x0, (%rdx)
leaq 0x30(%rsp), %rsi
movl %r13d, %edi
callq 0x307b4
testl %eax, %eax
movq (%rsp), %r12
je 0x3f8ae
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x3f825
callq 0x2dd41
movl 0x1c(%rsp), %r13d
movq 0x8(%rsp), %rax
movl %r13d, (%rax)
jmp 0x3f825
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
movq (%rsp), %r12
testl %r13d, %r13d
jns 0x3f83b
leaq 0x55278(%rip), %rdi     # 0x94aa9
movq %r12, %rsi
xorl %eax, %eax
callq 0x26b6f
xorl %r15d, %r15d
testl %ebp, %ebp
jle 0x3f87b
movl %ebp, %edx
incq 0x138(%rbx)
movl %r13d, %edi
movq %r14, %rsi
callq 0x6aa0
addq %rax, 0x140(%rbx)
testl %eax, %eax
jle 0x3f873
addl %eax, %r15d
movl %eax, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
addq %rcx, %r14
subl %eax, %ebp
jg 0x3f842
cmpl $-0x1, %eax
sete %al
jmp 0x3f87d
xorl %eax, %eax
testb %al, %al
je 0x3f88f
leaq 0x5523e(%rip), %rdi     # 0x94ac6
xorl %eax, %eax
callq 0x26c9f
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
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
jmp 0x3f825
leaq 0x55197(%rip), %rdi     # 0x94a57
movq %r12, %rsi
xorl %eax, %eax
callq 0x26b6f
jmp 0x3f5da