// File: /workspace/github_cpp_makefile_star2_O3/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 0xf332e(%rip), %rax     # 0x12ec60
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 0xa9ca8
leaq 0x30(%r15), %rdi
leaq 0x30(%r14), %rsi
callq 0x7077e
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 0xa254c
movups 0xb0(%r14), %xmm0
movups %xmm0, 0xb0(%r15)
movl $0x0, 0xc0(%r15)
leaq 0xf0(%r15), %r13
movq %r13, %rdi
callq 0x70768
leaq 0x150(%r15), %r12
movq %r12, %rdi
callq 0x70768
movq 0x1c0(%r14), %rdi
testq %rdi, %rdi
je 0x3b9dc
callq 0xac67b
jmp 0x3b9de
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 %r13, %rdi
callq 0x8412a
movl $0x108, %esi            # imm = 0x108
leaq (%r15,%rsi), %rdi
addq %r14, %rsi
callq 0x84fe2
movl $0x120, %edi            # imm = 0x120
leaq (%r14,%rdi), %rsi
addq %r15, %rdi
callq 0x84fe2
movl $0x138, %edi            # imm = 0x138
leaq (%r14,%rdi), %rsi
addq %r15, %rdi
callq 0x84fe2
leaq 0x150(%r14), %rsi
movq %r12, %rdi
callq 0x8412a
movl $0x168, %esi            # imm = 0x168
leaq (%r15,%rsi), %rdi
addq %r14, %rsi
callq 0x84fe2
movl $0x180, %edi            # imm = 0x180
leaq (%r14,%rdi), %rsi
addq %r15, %rdi
callq 0x84fe2
movl $0x198, %edi            # imm = 0x198
leaq (%r14,%rdi), %rsi
addq %r15, %rdi
callq 0x84fe2
movsd 0x1b0(%r14), %xmm0
movsd %xmm0, 0x1b0(%r15)
movsd 0x1b8(%r14), %xmm0
movsd %xmm0, 0x1b8(%r15)
cmpl $0x0, 0x2c(%r14)
jle 0x3bb4b
xorl %ebp, %ebp
movq 0x20(%r14), %rax
movq (%rax,%rbp,8), %r13
testq %r13, %r13
je 0x3bb31
movl $0xd0, %edi
callq 0x134e0
movq %rax, %r12
movq %rax, %rdi
movq %r13, %rsi
callq 0x91714
movl 0x2c(%r15), %edx
movq %rbx, %rdi
movq %r12, %rsi
callq 0xa9d3e
jmp 0x3bb3f
movl 0x2c(%r15), %edx
movq %rbx, %rdi
xorl %esi, %esi
callq 0xa9d3e
incq %rbp
movslq 0x2c(%r14), %rax
cmpq %rax, %rbp
jl 0x3bafb
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3bb70
jmp 0x3bb70
movq %rax, %r14
movl $0xd0, %esi
movq %r12, %rdi
callq 0x134f0
jmp 0x3bb73
movq %rax, %r14
movq %rbx, %rdi
callq 0xa9d12
movq %r14, %rdi
callq 0x138b0
nop