// File: /workspace/github_c_makefile_star2_O3/icebert[P]pblat/lib/udc.c
// Function: udcCachePreload
static boolean udcCachePreload(struct udcFile *file, bits64 offset, bits64 size)
/* Make sure that given data is in cache - fetching it remotely if need be. 
 * Return TRUE on success. */
{
if (!udcCacheEnabled())
    return TRUE;

boolean ok = TRUE;
/* Original comment said:
 *  "We'll break this operation into blocks of a reasonable size to allow
 *   other processes to get cache access, since we have to lock the cache files."
 * However there is no locking done, so this whole splitting might be unnecessary
 * complexity.
 */
bits64 s,e, endPos=offset+size;
for (s = offset; s < endPos; s = e)
    {
    /* Figure out bounds of this section. */
    e = s + udcMaxBytesPerRemoteFetch;
    if (e > endPos)
	e = endPos;

    struct udcBitmap *bits = file->bits;
    if (bits->version == file->bitmapVersion)
	{
        udcFetchMissing(file, bits, s, e);
	}
    else
	{
	ok = FALSE;
	verbose(4, "udcCachePreload version check failed %d vs %d", 
		bits->version, file->bitmapVersion);
	}
    if (!ok)
        break;
    }
return ok;
}

// Assembly:
movl $0x1, %ecx
cmpq $0x0, 0x7f56e(%rip)     # 0xc0c98
je 0x41a89
movq %rdx, %r11
movq %rsi, %rax
addq %rsi, %r11
cmpq %rsi, %r11
jbe 0x41a89
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdi, %r14
leaq 0x40(%rsp), %r8
leaq 0xc(%rsp), %r9
movq %r11, 0x20(%rsp)
movq %rdi, 0x10(%rsp)
leaq 0x40000(%rax), %rsi
cmpq %r11, %rsi
movq %r11, %rdi
cmovbq %rsi, %rdi
movq 0x70(%r14), %r10
movl 0x20(%r10), %edx
movl 0x88(%r14), %ecx
cmpl %ecx, %edx
jne 0x41a66
movq %rsi, 0x50(%rsp)
movl 0x8(%r10), %ecx
movq %r10, 0x38(%rsp)
movl 0x3c(%r10), %esi
xorl %edx, %edx
divq %rcx
movq %rax, %rbx
movq %rdi, 0x48(%rsp)
leaq (%rdi,%rcx), %rax
decq %rax
xorl %edx, %edx
divq %rcx
movq %rax, %rbp
movq %r14, %rdi
movl %ebx, %edx
movl %ebp, %ecx
movq %r8, %r13
movq %r9, %r12
callq 0x41665
movl 0xc(%rsp), %ecx
movq 0x40(%rsp), %r15
movq %rbx, 0x30(%rsp)
subl %ecx, %ebx
movq %rbp, 0x28(%rsp)
movq %rcx, 0x68(%rsp)
subl %ecx, %ebp
movq %r15, %rdi
movl %ebx, %esi
movl %ebp, %edx
callq 0x1be37
cmpl %ebp, %eax
jge 0x41a3c
movq %r15, %rdi
movl %ebx, %esi
movl %ebp, %edx
callq 0x1be37
movl %eax, %r14d
cmpl %ebp, %eax
movq 0x38(%rsp), %r12
movq %r15, 0x60(%rsp)
jge 0x419cb
movq %r15, %rdi
movl %r14d, %esi
movl %ebp, %edx
callq 0x1be2b
movl %eax, %r13d
movl %eax, 0x1c(%rsp)
subl %r14d, %r13d
movq 0x68(%rsp), %rax
addl %r14d, %eax
movslq 0x8(%r12), %r15
cltq
movslq %r13d, %rbx
addq %rax, %rbx
imulq %r15, %rbx
imulq %rax, %r15
movq 0x10(%rsp), %rax
movq 0x28(%rax), %rax
cmpq %rax, %rbx
cmovaeq %rax, %rbx
subq %r15, %rbx
jbe 0x41921
movq %rbx, %rdi
callq 0x2ddfc
movq %rax, %rcx
movq %rax, 0x70(%rsp)
movq 0x10(%rsp), %r12
movq 0x8(%r12), %rdi
movq 0x18(%r12), %rax
movq %r15, %rsi
movl %ebx, %edx
movq %rcx, 0x58(%rsp)
movq %r12, %r8
callq *0x8(%rax)
movslq %eax, %rcx
cmpq %rcx, %rbx
je 0x418c0
movq 0x8(%r12), %rdx
leaq 0x53c5c(%rip), %rdi     # 0x9550c
movq %rbx, %rsi
movq %r15, %rcx
movl %eax, %r8d
xorl %eax, %eax
callq 0x26e94
movl 0x58(%r12), %edi
incq 0xe0(%r12)
movq %r15, %rsi
xorl %edx, %edx
callq 0x23550
movl 0x58(%r12), %edi
movdqu 0xf8(%r12), %xmm0
movq %rbx, %xmm1
movdqa 0x531ed(%rip), %xmm2    # 0x94ae0
punpcklqdq %xmm1, %xmm2    # xmm2 = xmm2[0],xmm1[0]
paddq %xmm0, %xmm2
movdqu %xmm2, 0xf8(%r12)
movq 0x58(%rsp), %rsi
movq %rbx, %rdx
callq 0x23517
leaq 0x70(%rsp), %rdi
callq 0x2e0b0
movq 0x38(%rsp), %r12
movq 0x60(%rsp), %r15
movq %r15, %rdi
movl %r14d, %esi
movl %r13d, %edx
callq 0x1bbf5
movl 0x1c(%rsp), %esi
cmpl %ebp, %esi
jge 0x41951
movq %r15, %rdi
movl %ebp, %edx
callq 0x1be37
movl %eax, %r14d
cmpl %ebp, %eax
jl 0x41820
movq 0x30(%rsp), %rcx
leal 0x7(%rcx), %eax
testl %ecx, %ecx
cmovnsl %ecx, %eax
sarl $0x3, %eax
movq 0x28(%rsp), %rdx
leal 0x7(%rdx), %ecx
leal 0xe(%rdx), %ebx
testl %ecx, %ecx
cmovnsl %ecx, %ebx
sarl $0x3, %ebx
subl %eax, %ebx
movl 0x3c(%r12), %edi
addl $0x40, %eax
movslq %eax, %rsi
movq 0x10(%rsp), %r14
incq 0xb8(%r14)
xorl %edx, %edx
callq 0x23550
movl 0x3c(%r12), %edi
movslq %ebx, %rdx
movdqu 0xd0(%r14), %xmm0
movq %rdx, %xmm1
movdqa 0x5312e(%rip), %xmm2    # 0x94ae0
punpcklqdq %xmm1, %xmm2    # xmm2 = xmm2[0],xmm1[0]
paddq %xmm0, %xmm2
movdqu %xmm2, 0xd0(%r14)
movq %r15, %rsi
callq 0x23517
movq %r15, %rdi
callq 0x2e0a0
movl 0x8(%r12), %eax
movq 0x30(%rsp), %rdi
imull %eax, %edi
movq 0x28(%rsp), %r8
imull %eax, %r8d
movq 0x10(%rsp), %r14
movq 0x78(%r14), %rax
cmpq %rdi, %rax
movq %rdi, %rcx
cmovaq %rax, %rcx
movq 0x80(%r14), %rdx
cmovaeq %rdi, %rax
cmpq %r8, %rdx
movq %r8, %rsi
cmovbq %rdx, %rsi
cmovbeq %r8, %rdx
cmpq %rcx, %rsi
cmovbq %rdi, %rax
cmovbq %r8, %rdx
movq %rax, 0x78(%r14)
movq %rdx, 0x80(%r14)
movq 0x20(%rsp), %r11
leaq 0x40(%rsp), %r8
leaq 0xc(%rsp), %r9
jmp 0x41a4f
movq %r15, %rdi
callq 0x2e0a0
movq 0x20(%rsp), %r11
movq %r13, %r8
movq %r12, %r9
movq 0x48(%rsp), %rax
cmpq %r11, 0x50(%rsp)
jb 0x41767
movl $0x1, %ecx
jmp 0x41a7b
leaq 0x53a71(%rip), %rsi     # 0x954de
movl $0x4, %edi
xorl %eax, %eax
callq 0x427e5
xorl %ecx, %ecx
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
movl %ecx, %eax
retq