// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/pkgs/R3Surfels/R3SurfelScene.cpp
// Function: gaps::R3SurfelScene::Transform(gaps::R3Affine const&, int)
void R3SurfelScene::
Transform(const R3Affine& transformation, RNBoolean update_surfels)
{
  // Check if should update surfels
  if (update_surfels) {
    // Compute total transformation
    R3Affine t = R3identity_affine;
    t.Transform(transformation);
    t.Transform(this->transformation);
    this->transformation = R3identity_affine;
    
    // Transform all nodes                                                                                                     
    R3SurfelTree *tree = Tree();
    for (int i = 0; i < tree->NNodes(); i++) {
      R3SurfelNode *node = tree->Node(i);
      node->Transform(t);
    }

    // Transform all scans                                                                                                
    for (int i = 0; i < NScans(); i++) {
      R3SurfelScan *scan = Scan(i);
      scan->Transform(t);
    }

    // Transform all image poses                                                                                               
    for (int i = 0; i < NImages(); i++) {
      R3SurfelImage *image = Image(i);
      image->Transform(t);
    }
  }
  else {
    // Update transformation only
    R3Affine t = R3identity_affine;
    t.Transform(transformation);
    t.Transform(this->transformation);
    this->transformation = t;
  }

  // Mark scene as dirty
  flags.Add(R3_SURFEL_SCENE_DIRTY_FLAG);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x110, %rsp            # imm = 0x110
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x117a2d(%rip), %rax    # 0x1309f8
addq $0x10, %rax
testl %edx, %edx
je 0x19107
leaq 0x8(%rsp), %rdi
movq %rax, -0x8(%rdi)
leaq 0x11bb49(%rip), %r12    # 0x134b30
leaq 0x8(%r12), %r15
movq %r15, %rsi
callq 0x7233e
movl $0x88, %esi
movq %rsp, %rdi
addq %rsi, %rdi
addq 0x119fda(%rip), %rsi    # 0x132fe0
callq 0x7233e
movq 0x108(%r12), %rax
movq %rsp, %rdi
movq %rax, 0x108(%rdi)
movq %r14, %rsi
callq 0x70216
leaq 0xb0(%rbx), %rsi
movq %rsp, %rdi
callq 0x70216
leaq 0xb8(%rbx), %rdi
movq %r15, %rsi
callq 0x73f22
leaq 0x138(%rbx), %rdi
movl $0x88, %esi
addq 0x119f8a(%rip), %rsi    # 0x132fe0
callq 0x73f22
movq 0x108(%r12), %rax
movq %rax, 0x1b8(%rbx)
movq 0x8(%rbx), %r15
cmpl $0x0, 0x24(%r15)
jle 0x19098
xorl %r12d, %r12d
movq %rsp, %r14
movq 0x18(%r15), %rax
movq (%rax,%r12,8), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0x38(%rax)
incq %r12
movslq 0x24(%r15), %rax
cmpq %rax, %r12
jl 0x1907b
cmpl $0x0, 0x8c(%rbx)
jle 0x190ca
xorl %r15d, %r15d
movq %rsp, %r14
movq 0x80(%rbx), %rax
movq (%rax,%r15,8), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0x70(%rax)
incq %r15
movslq 0x8c(%rbx), %rax
cmpq %rax, %r15
jl 0x190a7
cmpl $0x0, 0x9c(%rbx)
jle 0x190ff
xorl %r15d, %r15d
movq %rsp, %r14
movq 0x90(%rbx), %rax
movq (%rax,%r15,8), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0xe8(%rax)
incq %r15
movslq 0x9c(%rbx), %rax
cmpq %rax, %r15
jl 0x190d9
movq %rsp, %rdi
jmp 0x19194
leaq 0x8(%rsp), %r15
movq %rax, -0x8(%r15)
leaq 0x11ba19(%rip), %r13    # 0x134b30
leaq 0x8(%r13), %rsi
movq %r15, %rdi
callq 0x7233e
movl $0x88, %esi
movq %rsp, %r12
addq %rsi, %r12
addq 0x119eab(%rip), %rsi    # 0x132fe0
movq %r12, %rdi
callq 0x7233e
movq 0x108(%r13), %rax
movq %rsp, %rdi
movq %rax, 0x108(%rdi)
movq %r14, %rsi
callq 0x70216
leaq 0xb0(%rbx), %rsi
movq %rsp, %rdi
callq 0x70216
leaq 0xb8(%rbx), %rdi
movq %r15, %rsi
callq 0x73f22
leaq 0x138(%rbx), %rdi
movq %r12, %rsi
callq 0x73f22
movq %rsp, %rdi
movq 0x108(%rdi), %rax
movq %rax, 0x1b8(%rbx)
callq 0x700a8
orb $0x1, 0x1e8(%rbx)
addq $0x110, %rsp            # imm = 0x110
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0x191b3
movq %rax, %rbx
movq %rsp, %rdi
callq 0x7073c
jmp 0x191d3
jmp 0x191c8
jmp 0x191c8
jmp 0x191c8
jmp 0x191c8
movq %rax, %rbx
movq %rsp, %rdi
callq 0x700a8
movq %rbx, %rdi
callq 0x138b0
nop