// File: tomfunkhouser[P]gaps/pkgs/RGBD/RGBDImage.cpp
// Function: gaps::RGBDImage::CreateColorChannels(gaps::R2Image const&)
int RGBDImage::
CreateColorChannels(const R2Image& image)
{
  // Create color channels
  while (channels.NEntries() <= RGBD_BLUE_CHANNEL) channels.Insert(NULL);
  if (!channels[RGBD_RED_CHANNEL]) channels[RGBD_RED_CHANNEL] = new R2Grid(image.Width(), image.Height());
  if (!channels[RGBD_GREEN_CHANNEL]) channels[RGBD_GREEN_CHANNEL] = new R2Grid(image.Width(), image.Height());
  if (!channels[RGBD_BLUE_CHANNEL]) channels[RGBD_BLUE_CHANNEL] = new R2Grid(image.Width(), image.Height());

  // Update resident count
  color_resident_count++;

  // Initialize color channels
  SetColorChannels(image);

  // Set width and height
  this->width = image.Width();
  this->height = image.Height();

  // Return success
  return 1;
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x60(%rsp)
movq %rsi, 0x58(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rdi
addq $0x18, %rdi
callq 0x19e00
cmpl $0x2, %eax
jg 0x2cfbf
movq 0x40(%rsp), %rdi
addq $0x18, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x27fb0
jmp 0x2cf98
movq 0x40(%rsp), %rdi
addq $0x18, %rdi
xorl %esi, %esi
callq 0x277c0
cmpq $0x0, (%rax)
jne 0x2d054
movl $0xd0, %edi
callq 0x126d0
movq %rax, 0x30(%rsp)
movq 0x58(%rsp), %rdi
callq 0x22940
movl %eax, 0x3c(%rsp)
jmp 0x2cff4
movq 0x58(%rsp), %rdi
callq 0x22950
movl %eax, 0x2c(%rsp)
jmp 0x2d004
movl 0x2c(%rsp), %edx
movl 0x3c(%rsp), %esi
movq 0x30(%rsp), %rdi
callq 0xb1ee0
jmp 0x2d018
movq 0x40(%rsp), %rdi
addq $0x18, %rdi
xorl %esi, %esi
callq 0x277c0
movq 0x30(%rsp), %rcx
movq %rcx, (%rax)
jmp 0x2d054
movq 0x30(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x50(%rsp)
movl %eax, 0x4c(%rsp)
movl $0xd0, %esi
callq 0x126e0
jmp 0x2d1dc
movq 0x40(%rsp), %rdi
addq $0x18, %rdi
movl $0x1, %esi
callq 0x277c0
cmpq $0x0, (%rax)
jne 0x2d0f3
movl $0xd0, %edi
callq 0x126d0
movq %rax, 0x20(%rsp)
movq 0x58(%rsp), %rdi
callq 0x22940
movl %eax, 0x28(%rsp)
jmp 0x2d090
movq 0x58(%rsp), %rdi
callq 0x22950
movl %eax, 0x1c(%rsp)
jmp 0x2d0a0
movl 0x1c(%rsp), %edx
movl 0x28(%rsp), %esi
movq 0x20(%rsp), %rdi
callq 0xb1ee0
jmp 0x2d0b4
movq 0x40(%rsp), %rdi
addq $0x18, %rdi
movl $0x1, %esi
callq 0x277c0
movq 0x20(%rsp), %rcx
movq %rcx, (%rax)
jmp 0x2d0f3
movq 0x20(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x50(%rsp)
movl %eax, 0x4c(%rsp)
movl $0xd0, %esi
callq 0x126e0
jmp 0x2d1dc
movq 0x40(%rsp), %rdi
addq $0x18, %rdi
movl $0x2, %esi
callq 0x277c0
cmpq $0x0, (%rax)
jne 0x2d18b
movl $0xd0, %edi
callq 0x126d0
movq %rax, 0x10(%rsp)
movq 0x58(%rsp), %rdi
callq 0x22940
movl %eax, 0x18(%rsp)
jmp 0x2d12b
movq 0x58(%rsp), %rdi
callq 0x22950
movl %eax, 0xc(%rsp)
jmp 0x2d13b
movl 0xc(%rsp), %edx
movl 0x18(%rsp), %esi
movq 0x10(%rsp), %rdi
callq 0xb1ee0
jmp 0x2d14f
movq 0x40(%rsp), %rdi
addq $0x18, %rdi
movl $0x2, %esi
callq 0x277c0
movq 0x10(%rsp), %rcx
movq %rcx, (%rax)
jmp 0x2d18b
movq 0x10(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x50(%rsp)
movl %eax, 0x4c(%rsp)
movl $0xd0, %esi
callq 0x126e0
jmp 0x2d1dc
movq 0x40(%rsp), %rdi
movl 0x1f8(%rdi), %eax
addl $0x1, %eax
movl %eax, 0x1f8(%rdi)
movq 0x58(%rsp), %rsi
movq (%rdi), %rax
callq *0x50(%rax)
movq 0x58(%rsp), %rdi
callq 0x22940
movl %eax, %ecx
movq 0x40(%rsp), %rax
movl %ecx, 0x28(%rax)
movq 0x58(%rsp), %rdi
callq 0x22950
movl %eax, %ecx
movq 0x40(%rsp), %rax
movl %ecx, 0x2c(%rax)
movl $0x1, %eax
addq $0x68, %rsp
retq
movq 0x50(%rsp), %rdi
callq 0x12c20
nopw %cs:(%rax,%rax)