// File: tomfunkhouser[P]gaps/pkgs/R2Shapes/R2PixelDatabase.cpp
// Function: gaps::R2PixelDatabase::ReadEntries(_IO_FILE*, int)
int R2PixelDatabase::
ReadEntries(FILE *fp, int swap_endian)
{
  // Seek to entries seek
  RNFileSeek(fp, entries_seek, RN_FILE_SEEK_SET);

  // Read entries
  int dummy = 0;
  for (unsigned int i = 0; i < entries_count; i++) {
    R2PixelDatabaseEntry entry;
    if (!RNReadChar(fp, entry.key, 128, swap_endian)) return 0;
    if (!RNReadUnsignedInt(fp, &entry.format, 1, swap_endian)) return 0;
    if (!RNReadUnsignedInt(fp, &entry.size, 1, swap_endian)) return 0;
    if (!RNReadUnsignedLongLong(fp, &entry.seek, 1, swap_endian)) return 0;
    if (!RNReadDouble(fp, &entry.offset, 1, swap_endian)) return 0;
    if (!RNReadDouble(fp, &entry.scale, 1, swap_endian)) return 0;
    if (!RNReadDouble(fp, &entry.exponent, 1, swap_endian)) return 0;
    for (int j = 0; j < 12; j++) RNReadInt(fp, &dummy, 1, swap_endian);
    map.Insert(entry.key, entry);
    keys.push_back(entry.key);
  }

  // Return success
  return 1;
}

// Assembly:
subq $0x2b8, %rsp            # imm = 0x2B8
movq %rdi, 0x2a8(%rsp)
movq %rsi, 0x2a0(%rsp)
movl %edx, 0x29c(%rsp)
movq 0x2a8(%rsp), %rax
movq %rax, 0xd0(%rsp)
movq 0x2a0(%rsp), %rdi
movq 0x38(%rax), %rsi
xorl %edx, %edx
callq 0x145360
movl $0x0, 0x298(%rsp)
movl $0x0, 0x294(%rsp)
movq 0xd0(%rsp), %rcx
movl 0x294(%rsp), %eax
cmpl 0x34(%rcx), %eax
jae 0x12682c
leaq 0x1e8(%rsp), %rdi
xorl %eax, %eax
movl %eax, %r8d
xorl %ecx, %ecx
xorps %xmm0, %xmm0
movsd 0x7dcff(%rip), %xmm2    # 0x1a4168
movq %r8, %rsi
movl %ecx, %edx
movaps %xmm2, %xmm1
callq 0x126bf0
movq 0x2a0(%rsp), %rdi
leaq 0x1e8(%rsp), %rsi
movl 0x29c(%rsp), %ecx
movl $0x80, %edx
callq 0x1453c0
cmpl $0x0, %eax
jne 0x1264ac
movl $0x0, 0x2b4(%rsp)
jmp 0x126837
movq 0x2a0(%rsp), %rdi
leaq 0x1e8(%rsp), %rsi
addq $0x80, %rsi
movl 0x29c(%rsp), %ecx
movl $0x1, %edx
callq 0x145710
cmpl $0x0, %eax
jne 0x1264e9
movl $0x0, 0x2b4(%rsp)
jmp 0x126837
movq 0x2a0(%rsp), %rdi
leaq 0x1e8(%rsp), %rsi
addq $0x84, %rsi
movl 0x29c(%rsp), %ecx
movl $0x1, %edx
callq 0x145710
cmpl $0x0, %eax
jne 0x126526
movl $0x0, 0x2b4(%rsp)
jmp 0x126837
movq 0x2a0(%rsp), %rdi
leaq 0x1e8(%rsp), %rsi
addq $0x88, %rsi
movl 0x29c(%rsp), %ecx
movl $0x1, %edx
callq 0x145a10
cmpl $0x0, %eax
jne 0x126563
movl $0x0, 0x2b4(%rsp)
jmp 0x126837
movq 0x2a0(%rsp), %rdi
leaq 0x1e8(%rsp), %rsi
addq $0x90, %rsi
movl 0x29c(%rsp), %ecx
movl $0x1, %edx
callq 0x145810
cmpl $0x0, %eax
jne 0x1265a0
movl $0x0, 0x2b4(%rsp)
jmp 0x126837
movq 0x2a0(%rsp), %rdi
leaq 0x1e8(%rsp), %rsi
addq $0x98, %rsi
movl 0x29c(%rsp), %ecx
movl $0x1, %edx
callq 0x145810
cmpl $0x0, %eax
jne 0x1265dd
movl $0x0, 0x2b4(%rsp)
jmp 0x126837
movq 0x2a0(%rsp), %rdi
leaq 0x1e8(%rsp), %rsi
addq $0xa0, %rsi
movl 0x29c(%rsp), %ecx
movl $0x1, %edx
callq 0x145810
cmpl $0x0, %eax
jne 0x12661a
movl $0x0, 0x2b4(%rsp)
jmp 0x126837
movl $0x0, 0x1e4(%rsp)
cmpl $0xc, 0x1e4(%rsp)
jge 0x126663
movq 0x2a0(%rsp), %rdi
movl 0x29c(%rsp), %ecx
leaq 0x298(%rsp), %rsi
movl $0x1, %edx
callq 0x145610
movl 0x1e4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1e4(%rsp)
jmp 0x126625
movq 0xd0(%rsp), %rax
addq $0x40, %rax
movq %rax, 0xc0(%rsp)
leaq 0x1bf(%rsp), %rdi
movq %rdi, 0xc8(%rsp)
callq 0x13980
movq 0xc8(%rsp), %rdx
leaq 0x1c0(%rsp), %rdi
leaq 0x1e8(%rsp), %rsi
callq 0xbd8c0
jmp 0x1266ab
leaq 0x100(%rsp), %rdi
movq %rdi, 0xb8(%rsp)
leaq 0x1e8(%rsp), %rsi
movl $0xa8, %edx
callq 0x13460
movq 0xb8(%rsp), %rsi
movq %rsp, %rdi
movl $0x15, %ecx
rep  movsq (%rsi), %es:(%rdi)
movq 0xc0(%rsp), %rdi
leaq 0x1c0(%rsp), %rsi
callq 0x126d40
jmp 0x1266f7
leaq 0x1c0(%rsp), %rdi
callq 0x13340
leaq 0x1bf(%rsp), %rdi
callq 0x135f0
movq 0xd0(%rsp), %rax
addq $0x48, %rax
movq %rax, 0xa8(%rsp)
leaq 0xdf(%rsp), %rdi
movq %rdi, 0xb0(%rsp)
callq 0x13980
movq 0xb0(%rsp), %rdx
leaq 0xe0(%rsp), %rdi
leaq 0x1e8(%rsp), %rsi
callq 0xbd8c0
jmp 0x126759
movq 0xa8(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
callq 0x126d80
jmp 0x126770
leaq 0xe0(%rsp), %rdi
callq 0x13340
leaq 0xdf(%rsp), %rdi
callq 0x135f0
movl 0x294(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x294(%rsp)
jmp 0x126437
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1b0(%rsp)
movl %eax, 0x1ac(%rsp)
jmp 0x1267d7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1b0(%rsp)
movl %eax, 0x1ac(%rsp)
leaq 0x1c0(%rsp), %rdi
callq 0x13340
leaq 0x1bf(%rsp), %rdi
callq 0x135f0
jmp 0x126846
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1b0(%rsp)
movl %eax, 0x1ac(%rsp)
jmp 0x12681d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1b0(%rsp)
movl %eax, 0x1ac(%rsp)
leaq 0xe0(%rsp), %rdi
callq 0x13340
leaq 0xdf(%rsp), %rdi
callq 0x135f0
jmp 0x126846
movl $0x1, 0x2b4(%rsp)
movl 0x2b4(%rsp), %eax
addq $0x2b8, %rsp            # imm = 0x2B8
retq
movq 0x1b0(%rsp), %rdi
callq 0x13970
nopw %cs:(%rax,%rax)