// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/apps/conf2conf/conf2conf.cpp
// Function: ComputeSurfaceTextures(gaps::RGBDConfiguration*)
static int
ComputeSurfaceTextures(RGBDConfiguration *configuration)
{
  // Start statistics
  RNTime start_time;
  start_time.Read();
  if (print_verbose) {
    printf("Computing surface textures ...\n");
    fflush(stdout);
  }

  // Set texture directory 
  if (output_texture_directory) configuration->SetTextureDirectory(output_texture_directory);
  if (!configuration->TextureDirectory()) configuration->SetTextureDirectory("texture");

  // Create texture directory
  if (configuration->TextureDirectory()) {
    char cmd[4096];
    sprintf(cmd, "mkdir -p %s", configuration->TextureDirectory());
    system(cmd);
  }

  // Set texel spacing if specified on command line                       
  if (texel_spacing > 0) {
    for (int i = 0; i < configuration->NSurfaces(); i++) {
      RGBDSurface *surface = configuration->Surface(i);
      surface->SetWorldTexelSpacing(texel_spacing);
    }
  }

  // Compute surface textures
  if (!RGBDComputeSurfaceTextures(configuration)) return 0;

  // Print statistics
  if (print_verbose) {
    printf("  Time = %.2f seconds\n", start_time.Elapsed());
    printf("  Texture directory = %s\n", configuration->TextureDirectory());
    printf("  # Surfaces = %d\n", configuration->NSurfaces());
    fflush(stdout);
  }

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1338, %rsp           # imm = 0x1338
movq %rdi, %r15
leaq 0xf8(%rsp), %rbx
movq %rbx, %rdi
callq 0x74e34
movq %rbx, %rdi
xorl %esi, %esi
callq 0x119a0
cmpb $0x1, 0xefe24(%rip)     # 0x104de8
jne 0x14fe1
leaq 0xa646f(%rip), %rdi     # 0xbb43c
callq 0x11900
movq 0xeef87(%rip), %rax     # 0x103f60
movq (%rax), %rdi
callq 0x116f0
movq 0xefe30(%rip), %rsi     # 0x104e18
testq %rsi, %rsi
je 0x14ff6
movq (%r15), %rax
movq %r15, %rdi
callq *0x60(%rax)
movq 0x50(%r15), %rdx
testq %rdx, %rdx
jne 0x15018
movq (%r15), %rax
leaq 0xa636c(%rip), %rsi     # 0xbb375
movq %r15, %rdi
callq *0x60(%rax)
movq 0x50(%r15), %rdx
testq %rdx, %rdx
je 0x15039
leaq 0xa635e(%rip), %rsi     # 0xbb37d
leaq 0x330(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x11110
movq %rbx, %rdi
callq 0x114d0
movsd 0xefde7(%rip), %xmm0    # 0x104e28
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
seta %cl
movl 0x24(%r15), %eax
testl %eax, %eax
setg %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x15083
xorl %ebx, %ebx
movq 0x18(%r15), %rax
movq (%rax,%rbx,8), %rdi
movsd 0xefdba(%rip), %xmm0    # 0x104e28
movq (%rdi), %rax
callq *0xd0(%rax)
incq %rbx
movslq 0x24(%r15), %rax
cmpq %rax, %rbx
jl 0x1505e
testl %eax, %eax
je 0x159f8
movq (%r15), %rax
movq %r15, %rdi
callq *0xd8(%rax)
cmpl $0x0, 0x24(%r15)
jle 0x159ec
leaq 0x120(%rsp), %r14
leaq 0x330(%rsp), %r12
leaq 0x260(%rsp), %rbp
xorl %r13d, %r13d
movq %r15, 0x98(%rsp)
movq 0x18(%r15), %rax
movq (%rax,%r13,8), %rax
movq 0x8(%rax), %rcx
movq %rcx, 0x40(%rsp)
testq %rcx, %rcx
je 0x15aa0
movl 0x28(%rax), %ecx
movl %ecx, 0xc(%rsp)
testl %ecx, %ecx
je 0x15aa0
movl 0x2c(%rax), %ecx
testl %ecx, %ecx
je 0x15aa0
movsd 0x60(%rax), %xmm0
movq %rax, 0x38(%rsp)
subsd 0x50(%rax), %xmm0
movl %ecx, 0x8(%rsp)
movl 0xc(%rsp), %ebx
cvtsi2sd %ebx, %xmm2
divsd %xmm2, %xmm0
mulsd %xmm0, %xmm2
cvtsi2sdl 0x8(%rsp), %xmm3
mulsd %xmm0, %xmm3
xorpd %xmm0, %xmm0
xorpd %xmm1, %xmm1
movq %r14, %rdi
callq 0x6c3cc
movq %r12, %rdi
movl %ebx, %esi
movl 0x8(%rsp), %edx
movq %r14, %rcx
callq 0x5f72a
movq %r12, %rdi
movsd 0xa5ec6(%rip), %xmm0    # 0xbb018
callq 0x617b0
movq %rbp, %rdi
movq %r12, %rsi
callq 0x6008c
movq %r13, 0xa0(%rsp)
leaq 0x190(%rsp), %rdi
movq %r12, %rsi
callq 0x6008c
movq 0x40(%rsp), %rax
movslq 0x14(%rax), %r13
testq %r13, %r13
je 0x159af
movq %r13, %rax
movl $0x18, %ecx
mulq %rcx
movq %rax, %r12
movq $-0x1, %rax
cmovoq %rax, %r12
movq %r12, %rdi
callq 0x11040
movq %rax, 0x28(%rsp)
shlq $0x3, %r13
leaq (,%r13,2), %rbx
addq %r13, %rbx
xorl %r14d, %r14d
movq 0x38(%rsp), %r13
movq 0x40(%rsp), %rbp
movq 0x28(%rsp), %rax
leaq (%rax,%r14), %rdi
callq 0x75224
addq $0x18, %r14
cmpq %r14, %rbx
jne 0x151ce
movslq 0x14(%rbp), %rax
leaq (,%rax,8), %rdi
testq %rax, %rax
movq $-0x1, %rax
cmovsq %rax, %rdi
callq 0x11040
leaq 0x68(%rsp), %r14
movl 0x8(%rsp), %ebx
movq %rax, %rbp
cmpl $0x0, 0xc(%rsp)
jle 0x158e4
movq 0x28(%rsp), %rax
addq $0x10, %rax
movq %rax, 0xb0(%rsp)
movl $0x0, 0x4(%rsp)
testl %ebx, %ebx
jle 0x158d0
xorps %xmm0, %xmm0
cvtsi2sdl 0x4(%rsp), %xmm0
addsd 0xa5dd3(%rip), %xmm0    # 0xbb020
movsd %xmm0, 0xa8(%rsp)
xorl %esi, %esi
movq 0x90(%r13), %rax
testq %rax, %rax
je 0x1528f
movq 0xb8(%rax), %rcx
movl 0xc8(%rax), %eax
imull %esi, %eax
addl 0x4(%rsp), %eax
cltq
movsd (%rcx,%rax,8), %xmm0
ucomisd 0xa5d91(%rip), %xmm0    # 0xbb018
jne 0x1528f
jnp 0x158c6
movl %esi, 0x4c(%rsp)
xorps %xmm1, %xmm1
cvtsi2sd %esi, %xmm1
addsd 0xa5d7e(%rip), %xmm1    # 0xbb020
leaq 0xb8(%rsp), %rdi
movsd 0xa8(%rsp), %xmm0
callq 0x6f0d6
xorpd %xmm0, %xmm0
xorpd %xmm1, %xmm1
xorpd %xmm2, %xmm2
leaq 0xe0(%rsp), %rdi
callq 0x75244
movq 0x40(%rsp), %rax
cmpl $0x0, 0x14(%rax)
jle 0x1574a
xorpd %xmm0, %xmm0
movsd %xmm0, 0x50(%rsp)
xorl %r13d, %r13d
xorl %r15d, %r15d
movq 0x40(%rsp), %rcx
movq 0x8(%rcx), %rax
movq (%rax,%r13,8), %r12
leaq 0x148(%rsp), %rbx
movq %rbx, %rdi
callq 0x4b600
leaq 0xb8(%rsp), %rdi
movq %rbx, %rsi
movq 0x38(%rsp), %rdx
movq %r12, %rcx
callq 0x15f64
testl %eax, %eax
je 0x15633
leaq 0x58(%rsp), %rbx
movq %rbx, %rdi
callq 0x6f0d4
leaq 0x148(%rsp), %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x161db
testl %eax, %eax
je 0x15633
movq 0x18(%r12), %rax
movq (%rax), %rdi
movsd 0x58(%rsp), %xmm0
movsd 0x60(%rsp), %xmm1
callq 0x609d4
movsd %xmm0, 0x10(%rsp)
movq 0x18(%r12), %rax
movq 0x8(%rax), %rdi
movsd 0x58(%rsp), %xmm0
movsd 0x60(%rsp), %xmm1
callq 0x609d4
movsd %xmm0, 0x30(%rsp)
movq 0x18(%r12), %rax
movq 0x10(%rax), %rdi
movsd 0x58(%rsp), %xmm0
movsd 0x60(%rsp), %xmm1
callq 0x609d4
movapd %xmm0, %xmm2
movsd 0xa5c5e(%rip), %xmm3    # 0xbb018
movsd 0x10(%rsp), %xmm0
ucomisd %xmm3, %xmm0
jne 0x153cc
jnp 0x15633
movsd 0x30(%rsp), %xmm1
ucomisd %xmm3, %xmm1
jne 0x153de
jnp 0x15633
ucomisd %xmm3, %xmm2
jne 0x153ea
jnp 0x15633
leaq 0xc8(%rsp), %rbx
movq %rbx, %rdi
callq 0x75244
movq %rbx, %rdi
leaq 0xf20ec(%rip), %rsi     # 0x1074f0
callq 0x75272
testl %eax, %eax
jne 0x15633
cmpl $0x1, 0xef1e4(%rip)     # 0x1045fc
movsd 0xa5c08(%rip), %xmm3    # 0xbb028
jne 0x155b0
addq $0x38, %r12
movq %r14, %rdi
movq %r12, %rsi
leaq 0xf0769(%rip), %rdx     # 0x105ba0
callq 0x49ffa
leaq 0x108(%rsp), %rdi
movq 0x38(%rsp), %rsi
leaq 0xb8(%rsp), %rdx
callq 0x1aff8
leaq 0x178(%rsp), %rdi
movq 0x38(%rsp), %rsi
leaq 0xb8(%rsp), %rdx
callq 0x1b07a
leaq 0x80(%rsp), %rdi
movq %r12, %rsi
leaq 0xa7b66(%rip), %rdx     # 0xbcfe8
callq 0x49f82
leaq 0x160(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x4ccd0
leaq 0x80(%rsp), %rdi
movq %r14, %rsi
leaq 0x108(%rsp), %rdx
callq 0x4b85e
leaq 0x80(%rsp), %rdi
callq 0x4c19c
movsd %xmm0, 0x10(%rsp)
leaq 0xef80a(%rip), %rax     # 0x104cd8
movsd (%rax), %xmm2
movapd %xmm2, %xmm1
xorpd 0xa5b72(%rip), %xmm1    # 0xbb050
movsd 0x10(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x154f4
ucomisd %xmm0, %xmm2
jae 0x15633
leaq 0x80(%rsp), %rdi
callq 0x4cc68
leaq 0x178(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x4c322
movsd %xmm0, 0x30(%rsp)
leaq 0xef7b5(%rip), %rax     # 0x104cd8
movsd (%rax), %xmm0
ucomisd 0x30(%rsp), %xmm0
jae 0x15633
leaq 0x160(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x4c322
leaq 0xef789(%rip), %rax     # 0x104cd8
movsd (%rax), %xmm1
ucomisd %xmm0, %xmm1
movsd 0x10(%rsp), %xmm3
jae 0x15633
movsd 0xa5abd(%rip), %xmm2    # 0xbb028
movapd %xmm2, %xmm0
cmpltsd %xmm3, %xmm0
mulsd %xmm3, %xmm3
movapd %xmm2, %xmm1
divsd %xmm3, %xmm1
andpd %xmm0, %xmm1
andnpd %xmm2, %xmm0
orpd %xmm1, %xmm0
mulsd 0x30(%rsp), %xmm0
movapd %xmm0, %xmm3
mulsd %xmm0, %xmm3
mulsd %xmm0, %xmm3
mulsd %xmm0, %xmm3
xorpd %xmm0, %xmm0
ucomisd %xmm3, %xmm0
jae 0x15633
movsd 0xc8(%rsp), %xmm0
mulsd %xmm3, %xmm0
movsd 0xd0(%rsp), %xmm1
mulsd %xmm3, %xmm1
movsd 0xd8(%rsp), %xmm2
movapd %xmm3, 0x10(%rsp)
mulsd %xmm3, %xmm2
movq %r14, %rdi
callq 0x75244
leaq 0xe0(%rsp), %rdi
movq %r14, %rsi
callq 0x752f6
movslq %r15d, %rax
movapd 0x10(%rsp), %xmm0
movsd %xmm0, (%rbp,%rax,8)
leaq (%rax,%rax,2), %rax
movq 0x28(%rsp), %rcx
leaq (%rcx,%rax,8), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x752d6
movsd 0x50(%rsp), %xmm0
addsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x50(%rsp)
incl %r15d
incq %r13
movq 0x40(%rsp), %rcx
movslq 0x14(%rcx), %rax
cmpq %rax, %r13
jl 0x152f5
testl %r15d, %r15d
movl 0x8(%rsp), %ebx
leaq 0x108(%rsp), %r12
je 0x1574a
movsd 0x50(%rsp), %xmm0
ucomisd 0xa59a5(%rip), %xmm0    # 0xbb010
jne 0x15673
jnp 0x1574a
movq %r14, %rdi
leaq 0xf1e73(%rip), %rsi     # 0x1074f0
callq 0x75226
movl 0xef79c(%rip), %esi     # 0x104e24
testl %esi, %esi
je 0x1580e
cmpl $0x1, %esi
je 0x15758
cmpl $0x2, %esi
jne 0x15a5a
testl %r15d, %r15d
jle 0x1584e
movl %r15d, %r14d
xorpd %xmm0, %xmm0
movsd %xmm0, 0x30(%rsp)
xorl %r15d, %r15d
leaq (%r15,%r15,2), %rax
movq 0x28(%rsp), %r13
leaq (,%rax,8), %r12
addq %r13, %r12
xorl %ebx, %ebx
xorpd %xmm0, %xmm0
movsd %xmm0, 0x10(%rsp)
movq %r12, %rdi
movq %r13, %rsi
callq 0x75272
testl %eax, %eax
je 0x156fc
movsd 0x10(%rsp), %xmm0
addsd (%rbp,%rbx,8), %xmm0
movsd %xmm0, 0x10(%rsp)
incq %rbx
addq $0x18, %r13
cmpq %rbx, %r14
jne 0x156db
movsd 0x10(%rsp), %xmm0
ucomisd 0x30(%rsp), %xmm0
jbe 0x15735
leaq 0x68(%rsp), %rdi
movq %r12, %rsi
movsd %xmm0, 0x10(%rsp)
callq 0x752d6
movsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x30(%rsp)
incq %r15
cmpq %r14, %r15
movl 0x8(%rsp), %ebx
jne 0x156bb
jmp 0x1584e
movq 0x38(%rsp), %r13
movl 0x4c(%rsp), %esi
jmp 0x158c6
testl %r15d, %r15d
jle 0x1584e
movl %r15d, %r12d
xorl %r13d, %r13d
movsd 0xa58c1(%rip), %xmm0    # 0xbb030
leaq (,%r13,2), %rax
addq %r13, %rax
movq 0x28(%rsp), %rcx
leaq (%rcx,%rax,8), %rsi
xorpd %xmm5, %xmm5
movq 0xb0(%rsp), %rax
xorl %ecx, %ecx
leaq 0x68(%rsp), %rdi
cmpq %rcx, %r13
je 0x157dd
movsd (%rsi), %xmm1
movsd 0x8(%rsi), %xmm2
subsd -0x10(%rax), %xmm1
subsd -0x8(%rax), %xmm2
movsd 0x10(%rsi), %xmm3
subsd (%rax), %xmm3
movsd (%rbp,%rcx,8), %xmm4
mulsd %xmm4, %xmm4
mulsd %xmm2, %xmm2
mulsd %xmm1, %xmm1
addsd %xmm2, %xmm1
mulsd %xmm3, %xmm3
addsd %xmm1, %xmm3
mulsd %xmm4, %xmm3
addsd %xmm3, %xmm5
incq %rcx
addq $0x18, %rax
cmpq %rcx, %r12
jne 0x15796
ucomisd %xmm5, %xmm0
jbe 0x15800
movsd %xmm5, 0x10(%rsp)
callq 0x752d6
movsd 0x10(%rsp), %xmm0
incq %r13
cmpq %r12, %r13
jne 0x1576f
jmp 0x1584e
movsd 0xe0(%rsp), %xmm0
movsd 0xe8(%rsp), %xmm1
movsd 0x50(%rsp), %xmm3
divsd %xmm3, %xmm0
divsd %xmm3, %xmm1
movsd 0xf0(%rsp), %xmm2
divsd %xmm3, %xmm2
movq %r12, %rdi
callq 0x75244
movq %r14, %rdi
movq %r12, %rsi
callq 0x752d6
movsd 0x68(%rsp), %xmm0
movq 0x3e8(%rsp), %rax
movl 0x3f8(%rsp), %ecx
movl 0x4c(%rsp), %esi
imull %esi, %ecx
movl 0x4(%rsp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd 0x70(%rsp), %xmm0
movq 0x318(%rsp), %rax
movl 0x328(%rsp), %ecx
imull %esi, %ecx
addl %edx, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd 0x78(%rsp), %xmm0
movq 0x248(%rsp), %rax
movl 0x258(%rsp), %ecx
imull %esi, %ecx
addl %edx, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
leaq 0x68(%rsp), %r14
movq 0x38(%rsp), %r13
incl %esi
cmpl %ebx, %esi
jne 0x15258
movl 0x4(%rsp), %eax
incl %eax
movl %eax, 0x4(%rsp)
cmpl 0xc(%rsp), %eax
jne 0x15234
movq 0x28(%rsp), %rdi
callq 0x117a0
movq %rbp, %rdi
callq 0x117a0
leaq 0x330(%rsp), %rdi
callq 0x60e90
leaq 0x260(%rsp), %rdi
callq 0x60e90
leaq 0x190(%rsp), %rdi
callq 0x60e90
movq %r14, %rdi
movl 0xc(%rsp), %esi
movl %ebx, %edx
movl $0x3, %ecx
callq 0x6fc8a
movq 0x98(%rsp), %r15
movq %r14, %rsi
leaq 0x120(%rsp), %r14
movq (%r13), %rax
movq %r13, %rdi
callq *0xb8(%rax)
leaq 0x330(%rsp), %r12
leaq 0x260(%rsp), %rbp
movq (%r13), %rax
movq %r13, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq *0x20(%rax)
movq (%r13), %rax
movq %r13, %rdi
movl $0x1, %esi
movq %rbp, %rdx
callq *0x20(%rax)
movq (%r13), %rax
movq %r13, %rdi
movl $0x2, %esi
leaq 0x190(%rsp), %rdx
callq *0x20(%rax)
movq (%r13), %rax
movq %r13, %rdi
callq *0xa0(%rax)
leaq 0x68(%rsp), %rdi
callq 0x6fee4
leaq 0x190(%rsp), %rdi
callq 0x60264
movq %rbp, %rdi
callq 0x60264
movq %r12, %rdi
callq 0x60264
movq %r14, %rdi
callq 0x6cc44
movq 0xa0(%rsp), %r13
incq %r13
movslq 0x24(%r15), %rax
cmpq %rax, %r13
jl 0x150c5
movq (%r15), %rax
movq %r15, %rdi
callq *0xe0(%rax)
movl $0x1, %ebx
cmpb $0x1, 0xef3e4(%rip)     # 0x104de8
jne 0x15aa2
leaq 0xf8(%rsp), %rdi
callq 0x74e96
leaq 0xa58d0(%rip), %rdi     # 0xbb2ee
movb $0x1, %al
callq 0x11080
movq 0x50(%r15), %rsi
leaq 0xa5959(%rip), %rdi     # 0xbb389
xorl %eax, %eax
callq 0x11080
movl 0x24(%r15), %esi
leaq 0xa58d4(%rip), %rdi     # 0xbb316
xorl %eax, %eax
callq 0x11080
movq 0xee510(%rip), %rax     # 0x103f60
movq (%rax), %rdi
callq 0x116f0
jmp 0x15aa2
leaq 0xa5942(%rip), %rdi     # 0xbb3a3
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x77f42
leaq 0x190(%rsp), %rdi
callq 0x60264
leaq 0x260(%rsp), %rdi
callq 0x60264
leaq 0x330(%rsp), %rdi
callq 0x60264
leaq 0x120(%rsp), %rdi
callq 0x6cc44
jmp 0x15aa2
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x1338, %rsp           # imm = 0x1338
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x15b0c
jmp 0x15b0c
jmp 0x15b0c
movq %rax, %rbx
jmp 0x15b1c
jmp 0x15ac3
movq %rax, %rbx
jmp 0x15b29
movq %rax, %rbx
jmp 0x15b36
jmp 0x15b0c
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x6fee4
jmp 0x15b0f
jmp 0x15b0c
jmp 0x15b0c
movq %rax, %rbx
movq 0x28(%rsp), %rdi
movq %r12, %rsi
callq 0x11b90
jmp 0x15b0f
jmp 0x15b0c
jmp 0x15b0c
jmp 0x15b0c
jmp 0x15b0c
jmp 0x15b0c
jmp 0x15b0c
jmp 0x15b0c
jmp 0x15b0c
jmp 0x15b0c
jmp 0x15b0c
jmp 0x15b0c
jmp 0x15b0c
movq %rax, %rbx
leaq 0x190(%rsp), %rdi
callq 0x60264
leaq 0x260(%rsp), %rdi
callq 0x60264
leaq 0x330(%rsp), %rdi
callq 0x60264
leaq 0x120(%rsp), %rdi
callq 0x6cc44
movq %rbx, %rdi
callq 0x11a60