// File: /workspace/github_cpp_makefile_star2_O3/tomfunkhouser[P]gaps/apps/prp2prp/prp2prp.cpp
// Function: FindProperties(gaps::R3MeshPropertySet*, char const*)
static RNArray<R3MeshProperty *>
FindProperties(R3MeshPropertySet *properties, const char *property_name)
{
  // Make an array of matching properties
  RNArray<R3MeshProperty *> result;

  // Check if "all"
  if (!strcmp(property_name, "all")) {
    // Insert all properties
    for (int i = 0; i < properties->NProperties(); i++) {
      R3MeshProperty *property = properties->Property(i);
      result.Insert(property);
    }
  }
  else if (properties->Property(property_name)) { 
    // Insert single property
    R3MeshProperty *property = properties->Property(property_name);
    result.Insert(property);
  }
  else { 
    // Insert properties names read from a file
    char buffer[1024];
    FILE *fp = fopen(property_name, "r");
    if (!fp) { RNFail("Invalid property name: %s\n", property_name); exit(-1); }
    while (fscanf(fp, "%s", buffer) == (unsigned int) 1) {
      R3MeshProperty *property = properties->Property(buffer);
      if (!property) { RNFail("Unrecognized property %s in file %s\n", buffer, property_name); exit(-1); }
      result.Insert(property);
    }
    fclose(fp);
  }

  // Check if found any properties
  if (result.IsEmpty()) {
    RNFail("No properties found for %s\n", property_name);
    exit(-1);
  }

  // Return array of properties
  return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
callq 0x5452c
leaq 0x47a6f(%rip), %rsi     # 0x5726d
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0xf8bb
movq %r15, %rdi
movq %r14, %rsi
callq 0x10516
testl %eax, %eax
js 0xf84c
movq 0x8(%r15), %rcx
movl %eax, %eax
cmpq $0x0, (%rcx,%rax,8)
je 0xf84c
movq %r15, %rdi
movq %r14, %rsi
callq 0x10516
testl %eax, %eax
js 0xf8e6
movq 0x8(%r15), %rcx
movl %eax, %eax
movq (%rcx,%rax,8), %rsi
jmp 0xf8e8
leaq 0x47aa1(%rip), %rsi     # 0x572f4
movq %r14, %rdi
callq 0xc450
testq %rax, %rax
je 0xf93c
movq %rax, %r12
leaq 0x48706(%rip), %r13     # 0x57f74
movq %rsp, %rbp
movq %r12, %rdi
movq %r13, %rsi
movq %rbp, %rdx
xorl %eax, %eax
callq 0xc6b0
cmpl $0x1, %eax
jne 0xf8b1
movq %r15, %rdi
movq %rbp, %rsi
callq 0x10516
testl %eax, %eax
js 0xf90b
movq 0x8(%r15), %rcx
movl %eax, %eax
movq (%rcx,%rax,8), %rsi
testq %rsi, %rsi
je 0xf90b
movl 0xc(%rbx), %edx
movq %rbx, %rdi
callq 0x545c2
jmp 0xf871
movq %r12, %rdi
callq 0xc380
jmp 0xf8f3
cmpl $0x0, 0x14(%r15)
jle 0xf8f3
xorl %r12d, %r12d
movq 0x8(%r15), %rax
movq (%rax,%r12,8), %rsi
movl 0xc(%rbx), %edx
movq %rbx, %rdi
callq 0x545c2
incq %r12
movslq 0x14(%r15), %rax
cmpq %rax, %r12
jl 0xf8c5
jmp 0xf8f3
xorl %esi, %esi
movl 0xc(%rbx), %edx
movq %rbx, %rdi
callq 0x545c2
cmpl $0x0, 0xc(%rbx)
je 0xf929
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4797a(%rip), %rdi     # 0x5728c
movq %rsp, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x566f2
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0xc470
leaq 0x47981(%rip), %rdi     # 0x572b1
movq %r14, %rsi
xorl %eax, %eax
callq 0x566f2
jmp 0xf91f
leaq 0x4792e(%rip), %rdi     # 0x57271
movq %r14, %rsi
xorl %eax, %eax
callq 0x566f2
jmp 0xf91f
jmp 0xf95b
jmp 0xf95b
jmp 0xf95b
jmp 0xf95b
jmp 0xf95b
jmp 0xf95b
movq %rax, %r14
movq %rbx, %rdi
callq 0x54596
movq %r14, %rdi
callq 0xc650