// File: /workspace/github_cpp_makefile_star2_O1/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 0x1188e7(%rip), %rax    # 0x1319f8
addq $0x10, %rax
testl %edx, %edx
je 0x1924d
leaq 0x8(%rsp), %rdi
movq %rax, -0x8(%rdi)
leaq 0x11ca03(%rip), %r12    # 0x135b30
leaq 0x8(%r12), %r15
movq %r15, %rsi
callq 0x73052
movl $0x88, %esi
movq %rsp, %rdi
addq %rsi, %rdi
addq 0x11ae94(%rip), %rsi    # 0x133fe0
callq 0x73052
movq 0x108(%r12), %rax
movq %rsp, %rdi
movq %rax, 0x108(%rdi)
movq %r14, %rsi
callq 0x70e82
leaq 0xb0(%rbx), %rsi
movq %rsp, %rdi
callq 0x70e82
leaq 0xb8(%rbx), %rdi
movq %r15, %rsi
callq 0x74c36
leaq 0x138(%rbx), %rdi
movl $0x88, %esi
addq 0x11ae44(%rip), %rsi    # 0x133fe0
callq 0x74c36
movq 0x108(%r12), %rax
movq %rax, 0x1b8(%rbx)
movq 0x8(%rbx), %r15
cmpl $0x0, 0x24(%r15)
jle 0x191de
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 0x191c1
cmpl $0x0, 0x8c(%rbx)
jle 0x19210
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 0x191ed
cmpl $0x0, 0x9c(%rbx)
jle 0x19245
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 0x1921f
movq %rsp, %rdi
jmp 0x192da
leaq 0x8(%rsp), %r15
movq %rax, -0x8(%r15)
leaq 0x11c8d3(%rip), %r13    # 0x135b30
leaq 0x8(%r13), %rsi
movq %r15, %rdi
callq 0x73052
movl $0x88, %esi
movq %rsp, %r12
addq %rsi, %r12
addq 0x11ad65(%rip), %rsi    # 0x133fe0
movq %r12, %rdi
callq 0x73052
movq 0x108(%r13), %rax
movq %rsp, %rdi
movq %rax, 0x108(%rdi)
movq %r14, %rsi
callq 0x70e82
leaq 0xb0(%rbx), %rsi
movq %rsp, %rdi
callq 0x70e82
leaq 0xb8(%rbx), %rdi
movq %r15, %rsi
callq 0x74c36
leaq 0x138(%rbx), %rdi
movq %r12, %rsi
callq 0x74c36
movq %rsp, %rdi
movq 0x108(%rdi), %rax
movq %rax, 0x1b8(%rbx)
callq 0x70d14
orb $0x1, 0x1e8(%rbx)
addq $0x110, %rsp            # imm = 0x110
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0x192f9
movq %rax, %rbx
movq %rsp, %rdi
callq 0x7139c
jmp 0x19319
jmp 0x1930e
jmp 0x1930e
jmp 0x1930e
jmp 0x1930e
movq %rax, %rbx
movq %rsp, %rdi
callq 0x70d14
movq %rbx, %rdi
callq 0x138b0
nop