// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelImage.cpp
// Function: gaps::R3SurfelImage::R3SurfelImage(gaps::R3SurfelImage const&)
R3SurfelImage::
R3SurfelImage(const R3SurfelImage& image)
  : scene(NULL),
    scene_index(-1),
    scan(NULL),
    channels(),
    pose(image.pose),
    timestamp(image.timestamp),
    image_width(image.image_width), 
    image_height(image.image_height),
    image_center(image.image_center),
    xfocal(image.xfocal),
    yfocal(image.yfocal),
    distortion_type(R3_SURFEL_NO_DISTORTION),
    name((image.name) ? RNStrdup(image.name) : NULL),
    flags(0),
    data(NULL)
{
  // Intialize distortion parameters
  radial_distortion[0] = image.radial_distortion[0];
  radial_distortion[1] = image.radial_distortion[1];
  radial_distortion[2] = image.radial_distortion[2];
  tangential_distortion[0] = image.tangential_distortion[0];
  tangential_distortion[1] = image.tangential_distortion[1];

  // Initialize rolling shutter pose parameters
  rolling_shutter_poses[0] = image.rolling_shutter_poses[0];
  rolling_shutter_poses[1] = image.rolling_shutter_poses[1];
  rolling_shutter_timestamps[0] = image.rolling_shutter_timestamps[0];
  rolling_shutter_timestamps[1] = image.rolling_shutter_timestamps[1];

  // Copy all channels
  for (int i = 0; i < image.channels.NEntries(); i++) {
    R2Grid *channel = image.channels.Kth(i);
    if (channel) channels.Insert(new R2Grid(*channel));
    else channels.Insert(NULL);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %r15
leaq 0xf3f90(%rip), %rax     # 0x12fc60
movq %rax, (%rdi)
xorl %eax, %eax
movq %rax, 0x8(%rdi)
movl $0xffffffff, 0x10(%rdi) # imm = 0xFFFFFFFF
movq %rax, 0x18(%rdi)
leaq 0x20(%rdi), %rbx
movq %rbx, %rdi
callq 0xaaf34
leaq 0x30(%r15), %rdi
leaq 0x30(%r14), %rsi
callq 0x713de
movsd 0x90(%r14), %xmm0
movsd %xmm0, 0x90(%r15)
movq 0x98(%r14), %rax
movq %rax, 0x98(%r15)
movl $0xa0, %esi
leaq (%r15,%rsi), %rdi
addq %r14, %rsi
callq 0xa3780
movups 0xb0(%r14), %xmm0
movups %xmm0, 0xb0(%r15)
movl $0x0, 0xc0(%r15)
leaq 0xf0(%r15), %r12
xorl %r13d, %r13d
leaq (%r12,%r13), %rdi
callq 0x713c8
addq $0x60, %r13
cmpq $0xc0, %r13
jne 0x3bd53
movq 0x1c0(%r14), %rdi
testq %rdi, %rdi
je 0x3bd7c
callq 0xadc0f
jmp 0x3bd7e
xorl %eax, %eax
movq %rax, 0x1c0(%r15)
xorps %xmm0, %xmm0
movups %xmm0, 0x1c8(%r15)
movsd 0xc8(%r14), %xmm0
movsd %xmm0, 0xc8(%r15)
movsd 0xd0(%r14), %xmm0
movsd %xmm0, 0xd0(%r15)
movsd 0xd8(%r14), %xmm0
movsd %xmm0, 0xd8(%r15)
movsd 0xe0(%r14), %xmm0
movsd %xmm0, 0xe0(%r15)
movsd 0xe8(%r14), %xmm0
movsd %xmm0, 0xe8(%r15)
leaq 0xf0(%r14), %rsi
movq %r12, %rdi
callq 0x850ec
movl $0x108, %esi            # imm = 0x108
leaq (%r15,%rsi), %rdi
addq %r14, %rsi
callq 0x85fc2
movl $0x120, %edi            # imm = 0x120
leaq (%r14,%rdi), %rsi
addq %r15, %rdi
callq 0x85fc2
movl $0x138, %edi            # imm = 0x138
leaq (%r14,%rdi), %rsi
addq %r15, %rdi
callq 0x85fc2
movl $0x150, %edi            # imm = 0x150
leaq (%r14,%rdi), %rsi
addq %r15, %rdi
callq 0x850ec
movl $0x168, %esi            # imm = 0x168
leaq (%r15,%rsi), %rdi
addq %r14, %rsi
callq 0x85fc2
movl $0x180, %edi            # imm = 0x180
leaq (%r14,%rdi), %rsi
addq %r15, %rdi
callq 0x85fc2
movl $0x198, %edi            # imm = 0x198
leaq (%r14,%rdi), %rsi
addq %r15, %rdi
callq 0x85fc2
movsd 0x1b0(%r14), %xmm0
movsd %xmm0, 0x1b0(%r15)
movsd 0x1b8(%r14), %xmm0
movsd %xmm0, 0x1b8(%r15)
cmpl $0x0, 0x2c(%r14)
jle 0x3beed
xorl %ebp, %ebp
movq 0x20(%r14), %rax
movq (%rax,%rbp,8), %r13
testq %r13, %r13
je 0x3bed3
movl $0xd0, %edi
callq 0x134e0
movq %rax, %r12
movq %rax, %rdi
movq %r13, %rsi
callq 0x92870
movl 0x2c(%r15), %edx
movq %rbx, %rdi
movq %r12, %rsi
callq 0xaafca
jmp 0x3bee1
movl 0x2c(%r15), %edx
movq %rbx, %rdi
xorl %esi, %esi
callq 0xaafca
incq %rbp
movslq 0x2c(%r14), %rax
cmpq %rax, %rbp
jl 0x3be9d
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3bf12
movq %rax, %r14
movl $0xd0, %esi
movq %r12, %rdi
callq 0x134f0
jmp 0x3bf15
jmp 0x3bf12
movq %rax, %r14
movq %rbx, %rdi
callq 0xaaf9e
movq %r14, %rdi
callq 0x138b0
nop