// File: /workspace/github_cpp_makefile_star2_O3/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 0xa921f(%rip), %rsi     # 0xc1a63
movq %r14, %rdi
callq 0x11700
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x18a22
leaq 0x28(%rsp), %rdi
callq 0x4b600
xorl %r14d, %r14d
leaq (%rsp,%r14), %rdi
addq $0x40, %rdi
callq 0x4c094
addq $0x18, %r14
cmpq $0x30, %r14
jne 0x18867
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 0xa3276(%rip), %rsi     # 0xbbb28
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 0x11ad0
addq $0x40, %rsp
cmpl $0xc, %eax
jne 0x18a11
leaq 0x40(%rsp), %rbp
leaq 0x28(%rsp), %r14
movq %rbp, %rdi
callq 0x4c3ac
leaq 0x90(%rsp), %r15
movq %r15, %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x4c9ca
leaq 0x78(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x4c9ca
movq %r13, %rdi
movq %r12, %rsi
callq 0x4c822
movq %r13, %rdi
callq 0x4c3ac
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 0x40bf4
movl $0xa0, %edi
callq 0x115b0
movq %rax, %r12
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
movsd 0xa2b37(%rip), %xmm0    # 0xbb4b8
callq 0x1a9be
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 0xa317a(%rip), %rsi     # 0xbbb28
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 0x11ad0
addq $0x40, %rsp
cmpl $0xc, %eax
je 0x188f6
movq 0x8(%rsp), %rdi
callq 0x115a0
movl $0x1, %ebx
jmp 0x18a35
leaq 0xa3124(%rip), %rdi     # 0xbbb4d
xorl %ebx, %ebx
movq %r14, %rsi
xorl %eax, %eax
callq 0x77f42
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 0x18a61
movq %rax, %rbx
movl $0xa0, %esi
movq %r12, %rdi
callq 0x115c0
movq %rbx, %rdi
callq 0x11a60