// File: tomfunkhouser[P]gaps/pkgs/R3Shapes/R3Grid.cpp
// Function: gaps::R3Grid::ReadDelphiFile(char const*)
int R3Grid::
ReadDelphiFile(const char *filename)
{
  // Delphi writes phi files as follows.
  // Each fortran write appears as <leading_record_size> data <trailing_record_size>
  // write(14)'now starting phimap '
  // write(14)nxtlbl,toplbl
  // write(14)phimap
  // write(14)' end of phimap  '
  // write(14)scale,oldmid,igrid
 
  // Open file
  FILE *fp = fopen(filename, "rb");
  if (!fp) {
    RNFail("Unable to open delphi file %s\n", filename);
    return 0;
  }

  // Read leading record size for uplbl
  int uplbl_record_size;
  if (fread(&uplbl_record_size, sizeof(int), 1, fp) != 1) {
    RNFail("Unable to read uplbl_record_size from delphi file: %s", filename);
    return 0;
  }
  else if (uplbl_record_size != 20) {
    RNFail("Wrong uplbl record size (%d) in delphi file: %s\n", uplbl_record_size, filename);
    return 0;
  }

  // Read uplbl from file 
  char uplbl[32];
  if (fread(uplbl, sizeof(char), 20, fp) != 20) {
    RNFail("Unable to read uplbl from delphi file: %s\n", filename);
    return 0;
  }

  // Read trailing record size for uplbl
  if (fread(&uplbl_record_size, sizeof(int), 1, fp) != 1) {
    RNFail("Unable to read uplbl_record_size from delphi file: %s", filename);
    return 0;
  }
  else if (uplbl_record_size != 20) {
    RNFail("Wrong uplbl record size (%d) in delphi file: %s\n", uplbl_record_size, filename);
    return 0;
  }

  // Read leading record size for nextlbl and toplbl
  int nextlbl_record_size;
  if (fread(&nextlbl_record_size, sizeof(int), 1, fp) != 1) {
    RNFail("Unable to read nextlbl_record_size from delphi file: %s", filename);
    return 0;
  }
  else if (nextlbl_record_size != 70) {
    RNFail("Wrong nextlbl record size (%d) in delphi file: %s\n", nextlbl_record_size, filename);
    return 0;
  }

  // Read nextlbl from file 
  char nextlbl[32];
  if (fread(nextlbl, sizeof(char), 10, fp) != 10) {
    RNFail("Unable to read nextlbl from delphi file: %s\n", filename);
    return 0;
  }

  // Read toplbl from file 
  char toplbl[64];
  if (fread(toplbl, sizeof(char), 60, fp) != 60) {
    RNFail("Unable to read toplbl from delphi file: %s\n", filename);
    return 0;
  }

  // Read trailing record size for nextlbl and toplbl
  if (fread(&nextlbl_record_size, sizeof(int), 1, fp) != 1) {
    RNFail("Unable to read nextlbl_record_size from delphi file: %s", filename);
    return 0;
  }
  else if (nextlbl_record_size != 70) {
    RNFail("Wrong nextlbl record size (%d) in delphi file: %s\n", nextlbl_record_size, filename);
    return 0;
  }

  // Read leading record size for grid values
  int res = 65;
  unsigned int values_record_size;
  if (fread(&values_record_size, sizeof(int), 1, fp) != 1) {
    RNFail("Unable to read values_record_size from delphi file: %s", filename);
    return 0;
  }
  else if (values_record_size != res*res*res*sizeof(float)) {
    RNFail("Wrong values record size (%d) in delphi file: %s\n", values_record_size, filename);
    return 0;
  }

  // Re-allocate grid values
  int new_size = res * res * res;
  if (!grid_values || (new_size > grid_size)) { 
    if (grid_values) delete [] grid_values;
    grid_values = new RNScalar [ new_size ];
    assert(grid_values);
  }
  // Update grid resolution variables
  grid_resolution[0] = res;
  grid_resolution[1] = res;
  grid_resolution[2] = res;
  grid_row_size = grid_resolution[0];
  grid_sheet_size = grid_row_size * grid_resolution[1];
  grid_size = grid_sheet_size * grid_resolution[2];
  if (grid_size <= 0) {
    RNFail("Invalid grid size (%d) in file", grid_size);
    return 0;
  }

  // Read grid values
  RNScalar *grid_valuesp = grid_values;
  for (int i = 0; i < grid_size; i++) {
    float value;
    if (fread(&value, sizeof(float), 1, fp) != 1) {
      RNFail("Unable to read grid value %d of %d from file", i, grid_size);
      return 0;
    }
    else {
      *(grid_valuesp++) = (RNScalar) value;
    }
  }

  // Read trailing record size for grid values
  if (fread(&values_record_size, sizeof(int), 1, fp) != 1) {
    RNFail("Unable to read values_record_size from delphi file: %s", filename);
    return 0;
  }
  else if (values_record_size != res*res*res*sizeof(float)) {
    RNFail("Wrong values record size (%d) in delphi file: %s\n", values_record_size, filename);
    return 0;
  }

  // Read leading record size for trailer text
  int trailer_record_size;
  if (fread(&trailer_record_size, sizeof(int), 1, fp) != 1) {
    RNFail("Unable to read trailer_record_size from delphi file: %s", filename);
    return 0;
  }
  else if (trailer_record_size != 16) {
    RNFail("Wrong trailer record size (%d) in delphi file: %s\n", trailer_record_size, filename);
    return 0;
  }

  // Read trailer from file 
  char trailer[128];
  if (fread(trailer, sizeof(char), 16, fp) != 16) {
    RNFail("Unable to read trailer from delphi file: %s\n", filename);
    return 0;
  }

  // Read trailing record size for trailer text
  if (fread(&trailer_record_size, sizeof(int), 1, fp) != 1) {
    RNFail("Unable to read trailer_record_size from delphi file: %s", filename);
    return 0;
  }
  else if (trailer_record_size != 16) {
    RNFail("Wrong trailer record size (%d) in delphi file: %s\n", trailer_record_size, filename);
    return 0;
  }

  // Read leading record size for scale, center, and igrid
  int scale_record_size;
  if (fread(&scale_record_size, sizeof(int), 1, fp) != 1) {
    RNFail("Unable to read scale_record_size from delphi file: %s", filename);
    return 0;
  }
  else if (scale_record_size != 20) {
    RNFail("Wrong scale record size (%d) in delphi file: %s\n", scale_record_size, filename);
    return 0;
  }

  // Read scale
  float scale;
  if (fread(&scale, sizeof(float), 1, fp) != 1) {
    RNFail("Unable to read scale from delphi file");
    return 0;
  }

  // Read center
  float center[3];
  if (fread(center, sizeof(float), 3, fp) != 3) {
    RNFail("Unable to read center from delphi file");
    return 0;
  }

  // Read grid resolution
  int igrid;
  if (fread(&igrid, sizeof(int), 1, fp) != 1) {
    RNFail("Unable to read igrid from delphi file");
    return 0;
  }

  // Check grid resolution
  if (igrid != 65) {
    RNFail("Phi grid file has invalid igrid: %d\n", igrid);
    return 0;
  }

  // Read trailing record size for scale, center, and igrid
  if (fread(&scale_record_size, sizeof(int), 1, fp) != 1) {
    RNFail("Unable to read scale_record_size from delphi file: %s", filename);
    return 0;
  }
  else if (scale_record_size != 20) {
    RNFail("Wrong scale record size (%d) in delphi file: %s\n", scale_record_size, filename);
    return 0;
  }

  // Make sure at end of file
  int count = 0;
  char dummytrailer;
  while (fread(&dummytrailer, sizeof(char), 1, fp) == 1) count++;
  if (count != 0) {
    RNFail("%d bytes of extra data at end of delphi file %s\n", count, filename);
    return 0;
  }

  // Determine world-grid transformation
  R3Point start_point(center[0] - 32 / scale, center[1] - 32 / scale, center[2] - 32 / scale);
  R3Point end_point(center[0] + 32 / scale, center[1] + 32 / scale, center[2] + 32 / scale);
  R3Box world_box(start_point, end_point);
  SetWorldToGridTransformation(world_box);

  // Close file
  fclose(fp);

  // Return number of grid values read
  return grid_size;
}

// Assembly:
subq $0x238, %rsp            # imm = 0x238
movq %rdi, 0x228(%rsp)
movq %rsi, 0x220(%rsp)
movq 0x228(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x220(%rsp), %rdi
leaq 0xd05d6(%rip), %rsi     # 0x1335d9
callq 0xf5e0
movq %rax, 0x218(%rsp)
cmpq $0x0, 0x218(%rsp)
jne 0x63041
movq 0x220(%rsp), %rsi
leaq 0xd151e(%rip), %rdi     # 0x134548
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x234(%rsp)
jmp 0x63b80
movq 0x218(%rsp), %rcx
leaq 0x214(%rsp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0xf780
cmpq $0x1, %rax
je 0x6308c
movq 0x220(%rsp), %rsi
leaq 0xd14f2(%rip), %rdi     # 0x134567
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x234(%rsp)
jmp 0x63b80
cmpl $0x14, 0x214(%rsp)
je 0x630c3
movl 0x214(%rsp), %esi
movq 0x220(%rsp), %rdx
leaq 0xd14f1(%rip), %rdi     # 0x13459d
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x234(%rsp)
jmp 0x63b80
jmp 0x630c5
leaq 0x1f0(%rsp), %rdi
movq 0x218(%rsp), %rcx
movl $0x1, %esi
movl $0x14, %edx
callq 0xf780
cmpq $0x14, %rax
je 0x63110
movq 0x220(%rsp), %rsi
leaq 0xd14d5(%rip), %rdi     # 0x1345ce
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x234(%rsp)
jmp 0x63b80
movq 0x218(%rsp), %rcx
leaq 0x214(%rsp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0xf780
cmpq $0x1, %rax
je 0x6315b
movq 0x220(%rsp), %rsi
leaq 0xd1423(%rip), %rdi     # 0x134567
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x234(%rsp)
jmp 0x63b80
cmpl $0x14, 0x214(%rsp)
je 0x63192
movl 0x214(%rsp), %esi
movq 0x220(%rsp), %rdx
leaq 0xd1422(%rip), %rdi     # 0x13459d
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x234(%rsp)
jmp 0x63b80
jmp 0x63194
movq 0x218(%rsp), %rcx
leaq 0x1ec(%rsp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0xf780
cmpq $0x1, %rax
je 0x631df
movq 0x220(%rsp), %rsi
leaq 0xd1431(%rip), %rdi     # 0x1345f9
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x234(%rsp)
jmp 0x63b80
cmpl $0x46, 0x1ec(%rsp)
je 0x63216
movl 0x1ec(%rsp), %esi
movq 0x220(%rsp), %rdx
leaq 0xd1432(%rip), %rdi     # 0x134631
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x234(%rsp)
jmp 0x63b80
jmp 0x63218
leaq 0x1c0(%rsp), %rdi
movq 0x218(%rsp), %rcx
movl $0x1, %esi
movl $0xa, %edx
callq 0xf780
cmpq $0xa, %rax
je 0x63263
movq 0x220(%rsp), %rsi
leaq 0xd1418(%rip), %rdi     # 0x134664
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x234(%rsp)
jmp 0x63b80
leaq 0x180(%rsp), %rdi
movq 0x218(%rsp), %rcx
movl $0x1, %esi
movl $0x3c, %edx
callq 0xf780
cmpq $0x3c, %rax
je 0x632ae
movq 0x220(%rsp), %rsi
leaq 0xd13fa(%rip), %rdi     # 0x134691
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x234(%rsp)
jmp 0x63b80
movq 0x218(%rsp), %rcx
leaq 0x1ec(%rsp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0xf780
cmpq $0x1, %rax
je 0x632f9
movq 0x220(%rsp), %rsi
leaq 0xd1317(%rip), %rdi     # 0x1345f9
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x234(%rsp)
jmp 0x63b80
cmpl $0x46, 0x1ec(%rsp)
je 0x63330
movl 0x1ec(%rsp), %esi
movq 0x220(%rsp), %rdx
leaq 0xd1318(%rip), %rdi     # 0x134631
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x234(%rsp)
jmp 0x63b80
jmp 0x63332
movl $0x41, 0x17c(%rsp)
movq 0x218(%rsp), %rcx
leaq 0x178(%rsp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0xf780
cmpq $0x1, %rax
je 0x63388
movq 0x220(%rsp), %rsi
leaq 0xd134c(%rip), %rdi     # 0x1346bd
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x234(%rsp)
jmp 0x63b80
movl 0x178(%rsp), %eax
movl 0x17c(%rsp), %ecx
imull 0x17c(%rsp), %ecx
imull 0x17c(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x2, %rcx
cmpq %rcx, %rax
je 0x633df
movl 0x178(%rsp), %esi
movq 0x220(%rsp), %rdx
leaq 0xd132c(%rip), %rdi     # 0x1346f4
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x234(%rsp)
jmp 0x63b80
jmp 0x633e1
movq 0x30(%rsp), %rax
movl 0x17c(%rsp), %ecx
imull 0x17c(%rsp), %ecx
imull 0x17c(%rsp), %ecx
movl %ecx, 0x174(%rsp)
cmpq $0x0, 0x230(%rax)
je 0x63422
movq 0x30(%rsp), %rcx
movl 0x174(%rsp), %eax
cmpl 0x24c(%rcx), %eax
jle 0x6348c
movq 0x30(%rsp), %rax
cmpq $0x0, 0x230(%rax)
je 0x63454
movq 0x30(%rsp), %rax
movq 0x230(%rax), %rax
movq %rax, 0x28(%rsp)
cmpq $0x0, %rax
je 0x63452
movq 0x28(%rsp), %rdi
callq 0xf670
jmp 0x63454
movslq 0x174(%rsp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0xf030
movq %rax, %rcx
movq 0x30(%rsp), %rax
movq %rcx, 0x230(%rax)
movq 0x30(%rsp), %rax
movl 0x17c(%rsp), %ecx
movl %ecx, 0x238(%rax)
movl 0x17c(%rsp), %ecx
movl %ecx, 0x23c(%rax)
movl 0x17c(%rsp), %ecx
movl %ecx, 0x240(%rax)
movl 0x238(%rax), %ecx
movl %ecx, 0x244(%rax)
movl 0x244(%rax), %ecx
imull 0x23c(%rax), %ecx
movl %ecx, 0x248(%rax)
movl 0x248(%rax), %ecx
imull 0x240(%rax), %ecx
movl %ecx, 0x24c(%rax)
cmpl $0x0, 0x24c(%rax)
jg 0x6351c
movq 0x30(%rsp), %rax
movl 0x24c(%rax), %esi
leaq 0xd0e74(%rip), %rdi     # 0x134379
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x234(%rsp)
jmp 0x63b80
movq 0x30(%rsp), %rax
movq 0x230(%rax), %rax
movq %rax, 0x168(%rsp)
movl $0x0, 0x164(%rsp)
movq 0x30(%rsp), %rcx
movl 0x164(%rsp), %eax
cmpl 0x24c(%rcx), %eax
jge 0x635e8
movq 0x218(%rsp), %rcx
leaq 0x160(%rsp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0xf780
cmpq $0x1, %rax
je 0x635a8
movq 0x30(%rsp), %rax
movl 0x164(%rsp), %esi
movl 0x24c(%rax), %edx
leaq 0xd0e3a(%rip), %rdi     # 0x1343cb
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x234(%rsp)
jmp 0x63b80
movss 0x160(%rsp), %xmm0
cvtss2sd %xmm0, %xmm0
movq 0x168(%rsp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, 0x168(%rsp)
movsd %xmm0, (%rax)
jmp 0x635d2
movl 0x164(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x164(%rsp)
jmp 0x6353b
movq 0x218(%rsp), %rcx
leaq 0x178(%rsp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0xf780
cmpq $0x1, %rax
je 0x63633
movq 0x220(%rsp), %rsi
leaq 0xd10a1(%rip), %rdi     # 0x1346bd
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x234(%rsp)
jmp 0x63b80
movl 0x178(%rsp), %eax
movl 0x17c(%rsp), %ecx
imull 0x17c(%rsp), %ecx
imull 0x17c(%rsp), %ecx
movslq %ecx, %rcx
shlq $0x2, %rcx
cmpq %rcx, %rax
je 0x6368a
movl 0x178(%rsp), %esi
movq 0x220(%rsp), %rdx
leaq 0xd1081(%rip), %rdi     # 0x1346f4
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x234(%rsp)
jmp 0x63b80
jmp 0x6368c
movq 0x218(%rsp), %rcx
leaq 0x15c(%rsp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0xf780
cmpq $0x1, %rax
je 0x636d7
movq 0x220(%rsp), %rsi
leaq 0xd1066(%rip), %rdi     # 0x134726
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x234(%rsp)
jmp 0x63b80
cmpl $0x10, 0x15c(%rsp)
je 0x6370e
movl 0x15c(%rsp), %esi
movq 0x220(%rsp), %rdx
leaq 0xd1067(%rip), %rdi     # 0x13475e
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x234(%rsp)
jmp 0x63b80
jmp 0x63710
leaq 0xd0(%rsp), %rdi
movq 0x218(%rsp), %rcx
movl $0x1, %esi
movl $0x10, %edx
callq 0xf780
cmpq $0x10, %rax
je 0x6375b
movq 0x220(%rsp), %rsi
leaq 0xd104d(%rip), %rdi     # 0x134791
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x234(%rsp)
jmp 0x63b80
movq 0x218(%rsp), %rcx
leaq 0x15c(%rsp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0xf780
cmpq $0x1, %rax
je 0x637a6
movq 0x220(%rsp), %rsi
leaq 0xd0f97(%rip), %rdi     # 0x134726
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x234(%rsp)
jmp 0x63b80
cmpl $0x10, 0x15c(%rsp)
je 0x637dd
movl 0x15c(%rsp), %esi
movq 0x220(%rsp), %rdx
leaq 0xd0f98(%rip), %rdi     # 0x13475e
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x234(%rsp)
jmp 0x63b80
jmp 0x637df
movq 0x218(%rsp), %rcx
leaq 0xcc(%rsp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0xf780
cmpq $0x1, %rax
je 0x6382a
movq 0x220(%rsp), %rsi
leaq 0xd0fab(%rip), %rdi     # 0x1347be
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x234(%rsp)
jmp 0x63b80
cmpl $0x14, 0xcc(%rsp)
je 0x63861
movl 0xcc(%rsp), %esi
movq 0x220(%rsp), %rdx
leaq 0xd0faa(%rip), %rdi     # 0x1347f4
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x234(%rsp)
jmp 0x63b80
jmp 0x63863
movq 0x218(%rsp), %rcx
leaq 0xc8(%rsp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0xf780
cmpq $0x1, %rax
je 0x638a6
leaq 0xd0f96(%rip), %rdi     # 0x134825
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x234(%rsp)
jmp 0x63b80
leaq 0xbc(%rsp), %rdi
movq 0x218(%rsp), %rcx
movl $0x4, %esi
movl $0x3, %edx
callq 0xf780
cmpq $0x3, %rax
je 0x638e9
leaq 0xd0f79(%rip), %rdi     # 0x13484b
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x234(%rsp)
jmp 0x63b80
movq 0x218(%rsp), %rcx
leaq 0xb8(%rsp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0xf780
cmpq $0x1, %rax
je 0x6392c
leaq 0xd0f5d(%rip), %rdi     # 0x134872
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x234(%rsp)
jmp 0x63b80
cmpl $0x41, 0xb8(%rsp)
je 0x6395b
movl 0xb8(%rsp), %esi
leaq 0xd0f54(%rip), %rdi     # 0x134898
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x234(%rsp)
jmp 0x63b80
movq 0x218(%rsp), %rcx
leaq 0xcc(%rsp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0xf780
cmpq $0x1, %rax
je 0x639a6
movq 0x220(%rsp), %rsi
leaq 0xd0e2f(%rip), %rdi     # 0x1347be
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x234(%rsp)
jmp 0x63b80
cmpl $0x14, 0xcc(%rsp)
je 0x639dd
movl 0xcc(%rsp), %esi
movq 0x220(%rsp), %rdx
leaq 0xd0e2e(%rip), %rdi     # 0x1347f4
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x234(%rsp)
jmp 0x63b80
jmp 0x639df
movl $0x0, 0xb4(%rsp)
movq 0x218(%rsp), %rcx
leaq 0xb3(%rsp), %rdi
movl $0x1, %edx
movq %rdx, %rsi
callq 0xf780
cmpq $0x1, %rax
jne 0x63a20
movl 0xb4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xb4(%rsp)
jmp 0x639ea
cmpl $0x0, 0xb4(%rsp)
je 0x63a57
movl 0xb4(%rsp), %esi
movq 0x220(%rsp), %rdx
leaq 0xd0e7d(%rip), %rdi     # 0x1348bd
movb $0x0, %al
callq 0xd4f30
movl $0x0, 0x234(%rsp)
jmp 0x63b80
movss 0xc8(%rsp), %xmm0
movss 0xd0478(%rip), %xmm3    # 0x133ee0
movss %xmm3, 0xc(%rsp)
divss %xmm0, %xmm3
movss 0xbc(%rsp), %xmm0
movss 0xc0(%rsp), %xmm1
subss %xmm3, %xmm0
cvtss2sd %xmm0, %xmm0
subss %xmm3, %xmm1
cvtss2sd %xmm1, %xmm1
movss 0xc4(%rsp), %xmm2
subss %xmm3, %xmm2
cvtss2sd %xmm2, %xmm2
leaq 0x98(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x6eb50
movss 0xc(%rsp), %xmm3
movss 0xc8(%rsp), %xmm0
divss %xmm0, %xmm3
movss 0xbc(%rsp), %xmm0
movss 0xc0(%rsp), %xmm1
addss %xmm3, %xmm0
cvtss2sd %xmm0, %xmm0
addss %xmm3, %xmm1
cvtss2sd %xmm1, %xmm1
movss 0xc4(%rsp), %xmm2
addss %xmm3, %xmm2
cvtss2sd %xmm2, %xmm2
leaq 0x80(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x6eb50
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
leaq 0x48(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x42940
movq 0x30(%rsp), %rdi
movq 0x20(%rsp), %rsi
callq 0x559e0
jmp 0x63b39
movq 0x218(%rsp), %rdi
callq 0xf4b0
jmp 0x63b48
movq 0x30(%rsp), %rax
movl 0x24c(%rax), %eax
movl %eax, 0x234(%rsp)
leaq 0x48(%rsp), %rdi
callq 0x36a80
jmp 0x63b80
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x40(%rsp)
movl %eax, 0x3c(%rsp)
leaq 0x48(%rsp), %rdi
callq 0x36a80
jmp 0x63b8f
movl 0x234(%rsp), %eax
addq $0x238, %rsp            # imm = 0x238
retq
movq 0x40(%rsp), %rdi
callq 0xf890
nopl (%rax)