// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/RGBD/RGBDConfiguration.cpp
// Function: gaps::RGBDConfiguration::ReadOrientedBoxFile(char const*)
int RGBDConfiguration::
ReadOrientedBoxFile(const char *filename)
{
  // Open file
  FILE *fp = fopen(filename, "r");
  if (!fp) {
    RNFail("Unable to open obb file %s\n", filename);
    return 0;
  }

  // Read file
  R3Point center;
  R3Vector axis[2];
  double radius[3];
  while (fscanf(fp, "%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf",
    &center[0], &center[1], &center[2],
    &axis[0][0], &axis[0][1], &axis[0][2],
    &axis[1][0], &axis[1][1], &axis[1][2],
    &radius[0], &radius[1], &radius[2]) == (unsigned int) 12) {
    // Make sure axes are orthogonal
    axis[0].Normalize();
    R3Vector axis2 = axis[0] % axis[1];
    axis[1] = axis2 % axis[0];
    axis[1].Normalize();
    
    // Create rectangle
    R3Rectangle *rectangle = new R3Rectangle(center,
      axis[0], axis[1], radius[0], radius[1]);

    // Create RGBD surface
    RGBDSurface *rgbd_surface = new RGBDSurface(NULL, rectangle);
    rgbd_surface->thickness = radius[2];

    // Insert RGBD surface
    InsertSurface(rgbd_surface);
  }

  // Close file
  fclose(fp);

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0xaaf21(%rip), %rsi     # 0xc3a33
movq %r14, %rdi
callq 0x11710
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x18cf0
leaq 0x28(%rsp), %rdi
callq 0x4be44
xorl %r14d, %r14d
leaq (%rsp,%r14), %rdi
addq $0x40, %rdi
callq 0x4c8dc
addq $0x18, %r14
cmpq $0x30, %r14
jne 0x18b35
leaq 0x30(%rsp), %rcx
leaq 0x38(%rsp), %r8
leaq 0x50(%rsp), %r11
leaq 0x58(%rsp), %r13
leaq 0x60(%rsp), %r14
leaq 0x68(%rsp), %r15
leaq 0x18(%rsp), %r12
leaq 0x20(%rsp), %rbp
leaq 0x10(%rsp), %r10
leaq 0xa4fa8(%rip), %rsi     # 0xbdb28
leaq 0x28(%rsp), %rdx
leaq 0x40(%rsp), %r9
movq 0x8(%rsp), %rdi
xorl %eax, %eax
pushq %rbp
pushq %r12
pushq %r10
pushq %r15
pushq %r14
pushq %r13
pushq %r11
leaq 0x80(%rsp), %r10
pushq %r10
callq 0x11ae0
addq $0x40, %rsp
cmpl $0xc, %eax
jne 0x18cdf
leaq 0x40(%rsp), %rbp
leaq 0x28(%rsp), %r14
movq %rbp, %rdi
callq 0x4cc00
leaq 0x90(%rsp), %r15
movq %r15, %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x4d232
leaq 0x78(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x4d232
movq %r13, %rdi
movq %r12, %rsi
callq 0x4d08a
movq %r13, %rdi
callq 0x4cc00
movl $0x78, %edi
callq 0x115b0
movq %rax, %r15
movsd 0x10(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
movq %rax, %rdi
movq %r14, %rsi
movq %rbp, %rdx
movq %r13, %rcx
callq 0x413ec
movl $0xa0, %edi
callq 0x115b0
movq %rax, %r12
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
movsd 0xa4869(%rip), %xmm0    # 0xbd4b8
callq 0x1ac82
movsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x98(%r12)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r12, %rsi
callq *0x20(%rax)
movq 0x8(%rsp), %rdi
leaq 0xa4eac(%rip), %rsi     # 0xbdb28
movq %r14, %rdx
leaq 0x30(%rsp), %rcx
leaq 0x38(%rsp), %r8
movq %rbp, %r9
xorl %eax, %eax
leaq 0x20(%rsp), %r10
pushq %r10
leaq 0x20(%rsp), %r10
pushq %r10
leaq 0x20(%rsp), %r10
pushq %r10
leaq 0x80(%rsp), %r10
pushq %r10
leaq 0x80(%rsp), %r10
pushq %r10
pushq %r13
leaq 0x80(%rsp), %r10
pushq %r10
leaq 0x80(%rsp), %r10
pushq %r10
callq 0x11ae0
addq $0x40, %rsp
cmpl $0xc, %eax
je 0x18bc4
movq 0x8(%rsp), %rdi
callq 0x115a0
movl $0x1, %ebx
jmp 0x18d03
leaq 0xa4e56(%rip), %rdi     # 0xbdb4d
xorl %ebx, %ebx
movq %r14, %rsi
xorl %eax, %eax
callq 0x79092
movl %ebx, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movl $0x78, %esi
movq %r15, %rdi
jmp 0x18d2f
movq %rax, %rbx
movl $0xa0, %esi
movq %r12, %rdi
callq 0x115c0
movq %rbx, %rdi
callq 0x11a70