// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/apps/scninfo/scninfo.cpp
// Function: PrintNodes(gaps::R3Scene*, gaps::R3SceneNode*, int, int)
static int
PrintNodes(R3Scene *scene, R3SceneNode *node, int index, int level)
{
  // Construct indent
  char indent[4096] = { '\0' };
  for (int i = 0; i < level; i++) {
    strcat(indent, "  ");
  }

  // Print node
  const char *name = node->Name();
  R3Box bbox = node->BBox();
  R3Point centroid = node->Centroid();
  R4Matrix m = node->Transformation().Matrix();
  printf("%sNode %s\n", indent, (name) ? name : "Null");
  printf("%s  Parent  = %s\n", indent, (node->Parent()) ? ((node->Parent()->Name()) ? node->Parent()->Name() : "NoName") : "None");
  printf("%s  Parent index = %d\n", indent, node->ParentIndex());
  printf("%s  Scene index = %d\n", indent, node->SceneIndex());
  printf("%s  # Elements = %d\n", indent, node->NElements());
  printf("%s  # References = %d\n", indent, node->NReferences());
  printf("%s  # Facets = %g\n", indent, node->NFacets().Mid());

  // Print properties
  printf("%s  Area = %g\n", indent, node->Area());
  printf("%s  Centroid = %g %g %g\n", indent, centroid[0], centroid[1], centroid[2]);
  printf("%s  BBox = ( %g %g %g ) ( %g %g %g )\n", indent, bbox[0][0], bbox[0][1], bbox[0][2], bbox[1][0], bbox[1][1], bbox[1][2]);

  // Print categories
  if (node->Info("index")) printf("%s  Category index = %s\n", indent, node->Info("index"));
  if (node->Info("model_id")) printf("%s  Category model id = %s\n", indent, node->Info("model_id"));
  if (node->Info("fine_grained_class")) printf("%s  Fine grained class = %s\n", indent, node->Info("fine_grained_class"));
  if (node->Info("coarse_grained_class")) printf("%s  Coarse grained class = %s\n", indent, node->Info("coarse_grained_class"));
  if (node->Info("nyuv2_40class")) printf("%s  NYUv2 40 class = %s\n", indent, node->Info("nyuv2_40class"));

  // Print transformation
  printf("%s  Transformation matrix = \n", indent);
  printf("%s    %12.3g %12.3g %12.3g %12.3g\n", indent, m[0][0], m[0][1], m[0][2], m[0][3]);
  printf("%s    %12.3g %12.3g %12.3g %12.3g\n", indent, m[1][0], m[1][1], m[1][2], m[1][3]);
  printf("%s    %12.3g %12.3g %12.3g %12.3g\n", indent, m[2][0], m[2][1], m[2][2], m[2][3]);
  printf("%s    %12.3g %12.3g %12.3g %12.3g\n", indent, m[3][0], m[3][1], m[3][2], m[3][3]);
  printf("\n");

  // Print elements
  if (print_elements) {
    for (int i = 0; i < node->NElements(); i++) {
      R3SceneElement *element = node->Element(i);
      if (!PrintElement(element, i, level+1)) return 0;
    }
  }

  // Print references
  if (print_references) {
    for (int i = 0; i < node->NReferences(); i++) {
      R3SceneReference *reference = node->Reference(i);
      if (!PrintReference(reference, i, level+1)) return 0;
    }
  }

  // Print children
  for (int i = 0; i < node->NChildren(); i++) {
    R3SceneNode *child = node->Child(i);
    if (!PrintNodes(scene, child, i, level+1)) return 0;
  }

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10e0, %rsp           # imm = 0x10E0
movl %esi, %ebx
movq %rdi, %r14
leaq 0xe0(%rsp), %r15
xorl %ebp, %ebp
movl $0x1000, %edx           # imm = 0x1000
movq %r15, %rdi
xorl %esi, %esi
callq 0x21450
testl %ebx, %ebx
cmovgl %ebx, %ebp
subl $0x1, %ebp
jb 0x2512a
movq %r15, %rdi
callq 0x21340
movw $0x2020, 0xe0(%rsp,%rax) # imm = 0x2020
movb $0x0, 0xe2(%rsp,%rax)
jmp 0x25109
movq 0x1a0(%r14), %r15
movq %r14, %rdi
callq 0x36b82
leaq 0x28(%rsp), %rdi
movq %rax, %rsi
callq 0x62142
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
callq 0x36ce2
leaq 0x60(%r14), %rsi
leaq 0x60(%rsp), %rdi
callq 0x66bd8
testq %r15, %r15
leaq 0x9e027(%rip), %rdx     # 0xc3192
cmovneq %r15, %rdx
leaq 0x9e011(%rip), %rdi     # 0xc3187
leaq 0xe0(%rsp), %rsi
xorl %eax, %eax
callq 0x21080
movq 0x10(%r14), %rax
testq %rax, %rax
je 0x251a5
movq 0x1a0(%rax), %rax
testq %rax, %rax
leaq 0x9e00a(%rip), %rdx     # 0xc31a9
cmovneq %rax, %rdx
jmp 0x251ac
leaq 0x9e004(%rip), %rdx     # 0xc31b0
leaq 0x9dfe4(%rip), %rdi     # 0xc3197
leaq 0xe0(%rsp), %r15
movq %r15, %rsi
xorl %eax, %eax
callq 0x21080
movl 0x18(%r14), %edx
leaq 0x9dfe5(%rip), %rdi     # 0xc31b5
movq %r15, %rsi
xorl %eax, %eax
callq 0x21080
movl 0x8(%r14), %edx
leaq 0x9dfe7(%rip), %rdi     # 0xc31cc
movq %r15, %rsi
xorl %eax, %eax
callq 0x21080
movl 0x3c(%r14), %edx
leaq 0x9dfe8(%rip), %rdi     # 0xc31e2
movq %r15, %rsi
xorl %eax, %eax
callq 0x21080
movl 0x4c(%r14), %edx
leaq 0x9dfe8(%rip), %rdi     # 0xc31f7
movq %r15, %rsi
xorl %eax, %eax
callq 0x21080
movq %rsp, %rdi
movq %r14, %rsi
callq 0x362f4
movsd (%rsp), %xmm0
addsd 0x8(%rsp), %xmm0
mulsd 0x9dde1(%rip), %xmm0    # 0xc3018
leaq 0x9dfd0(%rip), %rdi     # 0xc320e
leaq 0xe0(%rsp), %rsi
movb $0x1, %al
callq 0x21080
movq %r14, %rdi
callq 0x36466
leaq 0x9dfc5(%rip), %rdi     # 0xc3221
leaq 0xe0(%rsp), %r15
movq %r15, %rsi
movb $0x1, %al
callq 0x21080
movsd 0x10(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
movsd 0x20(%rsp), %xmm2
leaq 0x9dfa9(%rip), %rdi     # 0xc3230
movq %r15, %rsi
movb $0x3, %al
callq 0x21080
movsd 0x30(%rsp), %xmm0
movsd 0x38(%rsp), %xmm1
movsd 0x40(%rsp), %xmm2
movsd 0x48(%rsp), %xmm3
movsd 0x50(%rsp), %xmm4
movsd 0x58(%rsp), %xmm5
leaq 0x9df8d(%rip), %rdi     # 0xc3249
movq %r15, %rsi
movb $0x6, %al
callq 0x21080
leaq 0xacdec(%rip), %rsi     # 0xd20b9
movq %r14, %rdi
callq 0x25876
testq %rax, %rax
je 0x25302
leaq 0xacdd8(%rip), %rsi     # 0xd20b9
movq %r14, %rdi
callq 0x25876
leaq 0x9df7f(%rip), %rdi     # 0xc326f
leaq 0xe0(%rsp), %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x21080
leaq 0x9df7f(%rip), %rsi     # 0xc3288
movq %r14, %rdi
callq 0x25876
testq %rax, %rax
je 0x2533e
leaq 0x9df6b(%rip), %rsi     # 0xc3288
movq %r14, %rdi
callq 0x25876
leaq 0x9df65(%rip), %rdi     # 0xc3291
leaq 0xe0(%rsp), %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x21080
leaq 0x9df68(%rip), %rsi     # 0xc32ad
movq %r14, %rdi
callq 0x25876
testq %rax, %rax
je 0x2537a
leaq 0x9df54(%rip), %rsi     # 0xc32ad
movq %r14, %rdi
callq 0x25876
leaq 0x9df58(%rip), %rdi     # 0xc32c0
leaq 0xe0(%rsp), %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x21080
leaq 0x9df5c(%rip), %rsi     # 0xc32dd
movq %r14, %rdi
callq 0x25876
testq %rax, %rax
je 0x253b6
leaq 0x9df48(%rip), %rsi     # 0xc32dd
movq %r14, %rdi
callq 0x25876
leaq 0x9df4e(%rip), %rdi     # 0xc32f2
leaq 0xe0(%rsp), %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x21080
leaq 0x9df54(%rip), %rsi     # 0xc3311
movq %r14, %rdi
callq 0x25876
testq %rax, %rax
je 0x253f2
leaq 0x9df40(%rip), %rsi     # 0xc3311
movq %r14, %rdi
callq 0x25876
leaq 0x9df3f(%rip), %rdi     # 0xc331f
leaq 0xe0(%rsp), %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x21080
leaq 0x9df3f(%rip), %rdi     # 0xc3338
leaq 0xe0(%rsp), %r15
movq %r15, %rsi
xorl %eax, %eax
callq 0x21080
movsd 0x60(%rsp), %xmm0
movsd 0x68(%rsp), %xmm1
movsd 0x70(%rsp), %xmm2
movsd 0x78(%rsp), %xmm3
leaq 0x9df2c(%rip), %r12     # 0xc3356
movq %r12, %rdi
movq %r15, %rsi
movb $0x4, %al
callq 0x21080
movsd 0x80(%rsp), %xmm0
movsd 0x88(%rsp), %xmm1
movsd 0x90(%rsp), %xmm2
movsd 0x98(%rsp), %xmm3
movq %r12, %rdi
movq %r15, %rsi
movb $0x4, %al
callq 0x21080
movsd 0xa0(%rsp), %xmm0
movsd 0xa8(%rsp), %xmm1
movsd 0xb0(%rsp), %xmm2
movsd 0xb8(%rsp), %xmm3
movq %r12, %rdi
movq %r15, %rsi
movb $0x4, %al
callq 0x21080
movsd 0xc0(%rsp), %xmm0
movsd 0xc8(%rsp), %xmm1
movsd 0xd0(%rsp), %xmm2
movsd 0xd8(%rsp), %xmm3
movq %r12, %rdi
movq %r15, %rsi
movb $0x4, %al
callq 0x21080
pushq $0xa
popq %rdi
callq 0x21cd0
cmpb $0x1, 0x10c323(%rip)    # 0x1317fc
jne 0x25501
leal 0x1(%rbx), %ebp
xorl %r15d, %r15d
movslq 0x3c(%r14), %rax
cmpq %rax, %r15
jge 0x25501
movq 0x30(%r14), %rax
movq (%rax,%r15,8), %rdi
movl %r15d, %esi
movl %ebp, %edx
callq 0x2558a
incq %r15
jmp 0x254e1
cmpb $0x0, 0x10c2f8(%rip)    # 0x131800
je 0x2552f
incl %ebx
xorl %r15d, %r15d
movslq 0x4c(%r14), %rax
cmpq %rax, %r15
jge 0x25531
movq 0x40(%r14), %rax
movq (%rax,%r15,8), %rdi
movl %r15d, %esi
movl %ebx, %edx
callq 0x256d7
incq %r15
jmp 0x2550f
incl %ebx
xorl %r15d, %r15d
movslq 0x2c(%r14), %rax
cmpq %rax, %r15
jge 0x25551
movq 0x20(%r14), %rax
movq (%rax,%r15,8), %rdi
movl %ebx, %esi
callq 0x250d7
incq %r15
jmp 0x25534
leaq 0x28(%rsp), %rdi
callq 0x62dfa
addq $0x10e0, %rsp           # imm = 0x10E0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x25575
jmp 0x25575
jmp 0x25575
jmp 0x25575
jmp 0x25575
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x62dfa
movq %rbx, %rdi
callq 0x22080