// File: /workspace/github_cpp_makefile_star2_O1/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 0x551e8
leaq 0x489a6(%rip), %rsi     # 0x58270
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0xf98b
movq %r15, %rdi
movq %r14, %rsi
callq 0x105fa
testl %eax, %eax
js 0xf918
movq 0x8(%r15), %rcx
movl %eax, %eax
cmpq $0x0, (%rcx,%rax,8)
je 0xf918
movq %r15, %rdi
movq %r14, %rsi
callq 0x105fa
testl %eax, %eax
js 0xf9b6
movq 0x8(%r15), %rcx
movl %eax, %eax
movq (%rcx,%rax,8), %rsi
jmp 0xf9b8
leaq 0x489d8(%rip), %rsi     # 0x582f7
movq %r14, %rdi
callq 0xc450
testq %rax, %rax
je 0xfa0f
movq %rax, %r12
leaq 0x4963d(%rip), %r13     # 0x58f77
movq %rsp, %rbp
movq %r12, %rdi
movq %r13, %rsi
movq %rbp, %rdx
xorl %eax, %eax
callq 0xc6b0
cmpl $0x1, %eax
jne 0xf981
movq %r15, %rdi
movq %rbp, %rsi
callq 0x105fa
testl %eax, %eax
js 0xf96d
movq 0x8(%r15), %rcx
movl %eax, %eax
movq (%rcx,%rax,8), %rsi
jmp 0xf96f
xorl %esi, %esi
testq %rsi, %rsi
je 0xf9de
movl 0xc(%rbx), %edx
movq %rbx, %rdi
callq 0x5527e
jmp 0xf93d
movq %r12, %rdi
callq 0xc380
jmp 0xf9c3
cmpl $0x0, 0x14(%r15)
jle 0xf9c3
xorl %r12d, %r12d
movq 0x8(%r15), %rax
movq (%rax,%r12,8), %rsi
movl 0xc(%rbx), %edx
movq %rbx, %rdi
callq 0x5527e
incq %r12
movslq 0x14(%r15), %rax
cmpq %rax, %r12
jl 0xf995
jmp 0xf9c3
xorl %esi, %esi
movl 0xc(%rbx), %edx
movq %rbx, %rdi
callq 0x5527e
cmpl $0x0, 0xc(%rbx)
je 0xf9fc
movq %rbx, %rax
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x488aa(%rip), %rdi     # 0x5828f
movq %rsp, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x5761a
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0xc470
leaq 0x488b1(%rip), %rdi     # 0x582b4
movq %r14, %rsi
xorl %eax, %eax
callq 0x5761a
jmp 0xf9f2
leaq 0x4885e(%rip), %rdi     # 0x58274
movq %r14, %rsi
xorl %eax, %eax
callq 0x5761a
jmp 0xf9f2
jmp 0xfa2e
jmp 0xfa2e
jmp 0xfa2e
jmp 0xfa2e
jmp 0xfa2e
jmp 0xfa2e
movq %rax, %r14
movq %rbx, %rdi
callq 0x55252
movq %r14, %rdi
callq 0xc650