// File: /workspace/github_c_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
pushq $0x1
popq %rcx
movl %ecx, 0x8(%rsp)
cmpq $0x0, 0x797c8(%rip)     # 0xb4cb8
je 0x3b7e5
movq %rdx, %rbx
movq %rsi, %rax
movq %rdi, %r15
addq %rsi, %rbx
leaq 0xe0(%rdi), %rcx
movq %rcx, 0x58(%rsp)
leaq 0xb8(%rdi), %rcx
movq %rcx, 0x40(%rsp)
leaq 0x20(%rsp), %r8
leaq 0x4(%rsp), %r9
movq %rbx, 0x48(%rsp)
movq %rdi, 0x18(%rsp)
cmpq %rbx, %rax
jae 0x3b7e5
leaq 0x40000(%rax), %r13
cmpq %rbx, %r13
cmovaeq %rbx, %r13
movq 0x70(%r15), %rsi
movl 0x20(%rsi), %edx
movl 0x88(%r15), %ecx
cmpl %ecx, %edx
jne 0x3b7cc
movl 0x8(%rsi), %ecx
movq %rsi, 0x10(%rsp)
movl 0x3c(%rsi), %esi
xorl %edx, %edx
divq %rcx
movq %rax, %rbp
leaq (%rcx,%r13), %rax
decq %rax
xorl %edx, %edx
divq %rcx
movq %rax, %r14
movq %r15, %rdi
movl %ebp, %edx
movl %r14d, %ecx
callq 0x3b444
movl 0x4(%rsp), %eax
movq 0x20(%rsp), %r12
movl %ebp, %esi
subl %eax, %esi
movq %r14, 0x38(%rsp)
movl %eax, 0x2c(%rsp)
subl %eax, %r14d
movq %r12, %rdi
movl %esi, (%rsp)
movl %r14d, %edx
callq 0x186dd
movl %r14d, 0xc(%rsp)
cmpl %r14d, %eax
jge 0x3b6ee
movq %rbp, 0x30(%rsp)
movq %r13, 0x50(%rsp)
movb $0x1, %bpl
movq 0x10(%rsp), %r14
movl 0xc(%rsp), %r15d
movl (%rsp), %esi
movq %r12, 0x60(%rsp)
movq %r12, %rdi
movl %r15d, %edx
callq 0x186dd
cmpl %r15d, %eax
jge 0x3b6fe
movl %eax, %ebx
movq %r12, %rdi
movl %eax, %esi
movl %r15d, %edx
callq 0x186d3
movl %eax, %r13d
movl %eax, (%rsp)
subl %ebx, %r13d
movl %ebx, %eax
addl 0x2c(%rsp), %eax
movslq 0x8(%r14), %rbp
cltq
movslq %r13d, %r15
addq %rax, %r15
imulq %rbp, %r15
imulq %rax, %rbp
movq 0x18(%rsp), %rax
movq 0x28(%rax), %rax
cmpq %rax, %r15
cmovaeq %rax, %r15
subq %rbp, %r15
jbe 0x3b6cc
movq %r15, %rdi
callq 0x289b8
movq %rax, %rcx
movq %rax, 0x70(%rsp)
movq 0x18(%rsp), %r14
movq 0x8(%r14), %rdi
movq 0x18(%r14), %rax
movq %rbp, %rsi
movl %r15d, %edx
movq %rcx, 0x68(%rsp)
movq %r14, %r8
callq *0x8(%rax)
movslq %eax, %rcx
cmpq %rcx, %r15
je 0x3b68e
movq 0x8(%r14), %rdx
leaq 0x48d8e(%rip), %rdi     # 0x8440c
movq %r15, %rsi
movq %rbp, %rcx
movl %eax, %r8d
xorl %eax, %eax
callq 0x223fb
movl 0x58(%r14), %esi
movq 0x58(%rsp), %r12
movq %r12, %rdi
movq %rbp, %rdx
xorl %ecx, %ecx
callq 0x3b4c4
movl 0x58(%r14), %esi
movq %r12, %rdi
movq 0x68(%rsp), %rdx
movq %r15, %rcx
callq 0x3c4bc
leaq 0x70(%rsp), %rdi
callq 0x28c3d
movq 0x10(%rsp), %r14
movq 0x60(%rsp), %r12
movq %r12, %rdi
movl %ebx, %esi
movl %r13d, %edx
callq 0x184f0
xorl %ebp, %ebp
movl 0xc(%rsp), %r15d
movl (%rsp), %esi
cmpl %r15d, %esi
jl 0x3b5de
jmp 0x3b704
movq %r12, %rdi
callq 0x28c2d
movq %r13, %rax
jmp 0x3b7bd
testb $0x1, %bpl
jne 0x3b754
movq 0x30(%rsp), %rax
cltd
pushq $0x8
popq %rsi
idivl %esi
movl %eax, %ecx
movq 0x38(%rsp), %rax
addl $0x7, %eax
cltd
idivl %esi
movl %eax, %ebx
subl %ecx, %ebx
movl 0x3c(%r14), %esi
addl $0x40, %ecx
movslq %ecx, %rdx
movq 0x40(%rsp), %r14
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x3b4c4
movq 0x10(%rsp), %rax
movl 0x3c(%rax), %esi
movslq %ebx, %rcx
movq %r14, %rdi
movq 0x10(%rsp), %r14
movq %r12, %rdx
callq 0x3c4bc
movq %r12, %rdi
callq 0x28c2d
movl 0x8(%r14), %eax
movq 0x30(%rsp), %rdi
imull %eax, %edi
movq 0x38(%rsp), %r8
imull %eax, %r8d
movq 0x18(%rsp), %r15
movq 0x78(%r15), %rax
cmpq %rdi, %rax
movq %rdi, %rcx
cmovaq %rax, %rcx
movq 0x80(%r15), %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(%r15)
movq %rdx, 0x80(%r15)
movq 0x50(%rsp), %rax
movq 0x48(%rsp), %rbx
leaq 0x20(%rsp), %r8
leaq 0x4(%rsp), %r9
jmp 0x3b52e
leaq 0x48c0b(%rip), %rsi     # 0x843de
movl $0x0, 0x8(%rsp)
pushq $0x4
popq %rdi
xorl %eax, %eax
callq 0x3c521
movl 0x8(%rsp), %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq