// File: tomfunkhouser[P]gaps/apps/scninfo/scninfo.cpp
// Function: PrintElement(gaps::R3SceneElement*, int, int)
static int
PrintElement(R3SceneElement *element, int index, int level)
{
  // Construct indent
  char indent[4096] = { '\0' };
  for (int i = 0; i < level; i++) {
    strcat(indent, "  ");
  }

  // Print element stuff
  R3Box bbox = element->BBox();
  R3Point centroid = element->Centroid();
  R3Material *material = element->Material();
  printf("%sElement %d\n", indent, index);
  printf("%s  # Shapes = %d\n", indent, element->NShapes());
  if (material) printf("%s  Material = %d\n", indent, material->SceneIndex());
  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]);
  printf("%s  Centroid = %g %g %g\n", indent, centroid[0], centroid[1], centroid[2]);
  printf("\n");

  // Return success
  return 1;
}

// Assembly:
subq $0x1108, %rsp           # imm = 0x1108
movq %rdi, 0x1100(%rsp)
movl %esi, 0x10fc(%rsp)
movl %edx, 0x10f8(%rsp)
leaq 0xf0(%rsp), %rdi
xorl %esi, %esi
movl $0x1000, %edx           # imm = 0x1000
callq 0x224b0
movl $0x0, 0xec(%rsp)
movl 0xec(%rsp), %eax
cmpl 0x10f8(%rsp), %eax
jge 0x29243
leaq 0xf0(%rsp), %rdi
leaq 0x166636(%rip), %rsi    # 0x18f861
callq 0x23230
movl 0xec(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xec(%rsp)
jmp 0x2920c
movq 0x1100(%rsp), %rdi
callq 0x2aa00
movq %rax, %rsi
leaq 0xb0(%rsp), %rdi
callq 0xb53c0
movq 0x1100(%rsp), %rsi
leaq 0x98(%rsp), %rdi
callq 0x57040
jmp 0x29277
movq 0x1100(%rsp), %rdi
callq 0x2aa50
movq %rax, 0x78(%rsp)
jmp 0x2928b
movq 0x78(%rsp), %rax
movq %rax, 0x80(%rsp)
movl 0x10fc(%rsp), %edx
leaq 0x163160(%rip), %rdi    # 0x18c406
xorl %eax, %eax
leaq 0xf0(%rsp), %rsi
callq 0x22090
jmp 0x292b7
leaq 0xf0(%rsp), %rax
movq %rax, 0x68(%rsp)
movq 0x1100(%rsp), %rdi
callq 0x2aa60
movl %eax, 0x74(%rsp)
jmp 0x292d7
movl 0x74(%rsp), %edx
movq 0x68(%rsp), %rsi
leaq 0x16312d(%rip), %rdi    # 0x18c414
xorl %eax, %eax
callq 0x22090
jmp 0x292f0
cmpq $0x0, 0x80(%rsp)
je 0x2935c
leaq 0xf0(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x80(%rsp), %rdi
callq 0x2aa80
movl %eax, 0x64(%rsp)
jmp 0x2931b
movl 0x64(%rsp), %edx
movq 0x58(%rsp), %rsi
leaq 0x1630fc(%rip), %rdi    # 0x18c427
xorl %eax, %eax
callq 0x22090
jmp 0x29334
jmp 0x2935c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x90(%rsp)
movl %eax, 0x8c(%rsp)
leaq 0xb0(%rsp), %rdi
callq 0x29f40
jmp 0x2950d
leaq 0xb0(%rsp), %rdi
movq %rdi, 0x20(%rsp)
xorl %esi, %esi
movl %esi, 0x1c(%rsp)
callq 0x29d30
movl 0x1c(%rsp), %esi
movq %rax, %rdi
callq 0x29b10
movl 0x1c(%rsp), %esi
movq 0x20(%rsp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, 0x30(%rsp)
callq 0x29d30
movq %rax, %rdi
movl $0x1, %esi
movl %esi, 0x28(%rsp)
callq 0x29b10
movl 0x1c(%rsp), %esi
movq 0x20(%rsp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, 0x38(%rsp)
callq 0x29d30
movq %rax, %rdi
movl $0x2, %esi
movl %esi, 0x2c(%rsp)
callq 0x29b10
movq 0x20(%rsp), %rdi
movl 0x28(%rsp), %esi
movsd (%rax), %xmm0
movsd %xmm0, 0x40(%rsp)
callq 0x29d30
movl 0x1c(%rsp), %esi
movq %rax, %rdi
callq 0x29b10
movq 0x20(%rsp), %rdi
movl 0x28(%rsp), %esi
movsd (%rax), %xmm0
movsd %xmm0, 0x48(%rsp)
callq 0x29d30
movl 0x28(%rsp), %esi
movq %rax, %rdi
callq 0x29b10
movq 0x20(%rsp), %rdi
movl 0x28(%rsp), %esi
movsd (%rax), %xmm0
movsd %xmm0, 0x50(%rsp)
callq 0x29d30
movl 0x2c(%rsp), %esi
movq %rax, %rdi
callq 0x29b10
movsd 0x30(%rsp), %xmm0
movsd 0x38(%rsp), %xmm1
movsd 0x40(%rsp), %xmm2
movsd 0x48(%rsp), %xmm3
movsd 0x50(%rsp), %xmm4
movsd (%rax), %xmm5
leaq 0x162e45(%rip), %rdi    # 0x18c2ac
leaq 0xf0(%rsp), %rsi
movb $0x6, %al
callq 0x22090
jmp 0x29478
leaq 0x98(%rsp), %rdi
movq %rdi, (%rsp)
xorl %esi, %esi
callq 0x29b10
movq (%rsp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
movl $0x1, %esi
callq 0x29b10
movq (%rsp), %rdi
movsd (%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movl $0x2, %esi
callq 0x29b10
movsd 0x8(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movsd (%rax), %xmm2
leaq 0x162dc1(%rip), %rdi    # 0x18c293
leaq 0xf0(%rsp), %rsi
movb $0x3, %al
callq 0x22090
jmp 0x294e3
leaq 0x16a218(%rip), %rdi    # 0x193702
xorl %eax, %eax
callq 0x22090
jmp 0x294f3
leaq 0xb0(%rsp), %rdi
callq 0x29f40
movl $0x1, %eax
addq $0x1108, %rsp           # imm = 0x1108
retq
movq 0x90(%rsp), %rdi
callq 0x23210
nopw (%rax,%rax)