// File: /workspace/github_cpp_makefile_star2_O1/tomfunkhouser[P]gaps/apps/prp2prp/prp2prp.cpp
// Function: ApplyOperation(gaps::R3MeshPropertySet*, gaps::R3MeshProperty*, char const*, int&, char**&, int)
static void
ApplyOperation(R3MeshPropertySet *properties, R3MeshProperty *property, const char *operation_name, 
  int& argc, char **& argv, RNBoolean update_name = TRUE)
{
  // Get convenient variables
  R3Mesh *mesh = property->Mesh();

  // Apply operation
  if (!strcmp(operation_name, "Test")) Test(property);
  else if (!strcmp(operation_name, "Abs")) property->Abs();
  else if (!strcmp(operation_name, "Sqrt")) property->Sqrt();
  else if (!strcmp(operation_name, "Square")) property->Square();
  else if (!strcmp(operation_name, "Negate")) property->Negate();
  else if (!strcmp(operation_name, "Invert")) property->Invert();
  else if (!strcmp(operation_name, "Clear")) property->Clear();
  else if (!strcmp(operation_name, "Normalize")) property->Normalize();
  else if (!strcmp(operation_name, "Percentile")) property->Percentilize();
  else if (!strcmp(operation_name, "Laplace")) property->Laplace();
  else if (!strcmp(operation_name, "Substitute")) {
    argc--; argv++; RNScalar current = atof(*argv);
    if (!strcmp(*argv, "unknown")) current = RN_UNKNOWN;
    else if (!strcmp(*argv, "infinity")) current = RN_INFINITY;
    argc--; argv++; RNScalar replacement = atof(*argv);
    if (!strcmp(*argv, "unknown")) replacement = RN_UNKNOWN;
    else if (!strcmp(*argv, "infinity")) replacement = RN_INFINITY;
    property->Substitute(current, replacement);
  }
  else if (!strcmp(operation_name, "Add")) {
    argc--; argv++; const char *operand = *argv;
    if (IsNumber(operand)) property->Add(atof(operand));
    else property->Add(GetProperty(properties, operand));
  }
  else if (!strcmp(operation_name, "Subtract")) {
    argc--; argv++; const char *operand = *argv;
    if (IsNumber(operand)) property->Subtract(atof(operand));
    else property->Subtract(GetProperty(properties, operand));
  }
  else if (!strcmp(operation_name, "Multiply")) {
    argc--; argv++; const char *operand = *argv;
    if (IsNumber(operand)) property->Multiply(atof(operand));
    else property->Multiply(GetProperty(properties, operand));
  }
  else if (!strcmp(operation_name, "Divide")) {
    argc--; argv++; const char *operand = *argv;
    if (IsNumber(operand)) property->Divide(atof(operand));
    else property->Divide(GetProperty(properties, operand));
  }
  else if (!strcmp(operation_name, "Pow")) {
    argc--; argv++; const char *operand = *argv;
    if (IsNumber(operand)) property->Pow(atof(operand));
    else property->Pow(GetProperty(properties, operand));
  }
  else if (!strcmp(operation_name, "Mask")) {
    argc--; argv++; const char *operand = *argv;
    property->Mask(GetProperty(properties, operand));
  }
  else if (!strcmp(operation_name, "Dilate")) {
    argc--; argv++; RNScalar radius = atof(*argv);
    property->Dilate(radius * Scale(mesh));
  }
  else if (!strcmp(operation_name, "Erode")) {
    argc--; argv++; RNScalar radius = atof(*argv);
    property->Erode(radius * Scale(mesh));
  }
  else if (!strcmp(operation_name, "NonExtremumSuppression")) {
    argc--; argv++; RNScalar radius = atof(*argv);
    property->NonExtremumSuppression(radius * Scale(mesh));
  }
  else if (!strcmp(operation_name, "NonMaximumSuppression")) {
    argc--; argv++; RNScalar radius = atof(*argv);
    property->NonMaximumSuppression(radius * Scale(mesh));
  }
  else if (!strcmp(operation_name, "NonMinimumSuppression")) {
    argc--; argv++; RNScalar radius = atof(*argv);
    property->NonMinimumSuppression(radius * Scale(mesh));
  }
  else if (!strcmp(operation_name, "Blur")) {
    argc--; argv++; RNScalar sigma = atof(*argv);
    property->Blur(sigma * Scale(mesh));
  }
  else if (!strcmp(operation_name, "DoG")) {
    argc--; argv++; RNScalar sigma = atof(*argv);
    property->DoG(sigma * Scale(mesh));
  }
  else if (!strcmp(operation_name, "Strength")) {
    argc--; argv++; RNScalar sigma = atof(*argv);
    property->Strength(sigma * Scale(mesh));
  }
  else if (!strcmp(operation_name, "Threshold")) {
    argc--; argv++; RNScalar threshold = atof(*argv);
    argc--; argv++; const char *below_str = *argv;
    argc--; argv++; const char *above_str = *argv;
    RNScalar below_value = RN_UNKNOWN;
    if (!strcmp(below_str, "keep")) below_value = R3_MESH_PROPERTY_KEEP_VALUE;
    else if (strcmp(below_str, "unknown")) below_value = atof(below_str);
    RNScalar above_value = RN_UNKNOWN;
    if (!strcmp(above_str, "keep")) above_value = R3_MESH_PROPERTY_KEEP_VALUE;
    else if (strcmp(above_str, "unknown")) above_value = atof(above_str);
    property->Threshold(threshold, below_value, above_value);
  }
  else { 
    RNFail("Unrecognized operation: %s\n", operation_name); 
    exit(-1); 
  }

  // Set new property name
  if (update_name) {
    char name[4096] = { '\0' };
    strcpy(name, property->Name());
    strcat(name, "_"); strcat(name, operation_name);
    property->SetName(name);
  }

  // Print message
  if (print_debug) {
    printf("  %s\n", property->Name());
    fflush(stdout);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1028, %rsp           # imm = 0x1028
movl %r9d, 0x14(%rsp)
movq %r8, %r15
movq %rcx, %r13
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %rbp
movq (%rsi), %r12
leaq 0x48860(%rip), %rsi     # 0x582d0
movq %rdx, %rdi
callq 0xc500
testl %eax, %eax
je 0xfd47
leaq 0x4884e(%rip), %rsi     # 0x582d5
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0xfd9d
leaq 0x4883b(%rip), %rsi     # 0x582d9
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0xfdaa
leaq 0x48829(%rip), %rsi     # 0x582de
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0xfdb7
leaq 0x48819(%rip), %rsi     # 0x582e5
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0xfdc4
leaq 0x48809(%rip), %rsi     # 0x582ec
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0xfdd1
leaq 0x487f9(%rip), %rsi     # 0x582f3
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0xfdde
leaq 0x487e8(%rip), %rsi     # 0x582f9
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0xfdef
leaq 0x487db(%rip), %rsi     # 0x58303
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0xfdfc
leaq 0x487cf(%rip), %rsi     # 0x5830e
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0xfe09
leaq 0x487c0(%rip), %rsi     # 0x58316
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0xfe16
leaq 0x487c5(%rip), %rsi     # 0x58332
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0xfefd
leaq 0x487b2(%rip), %rsi     # 0x58336
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0xff34
leaq 0x487a4(%rip), %rsi     # 0x5833f
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0xff6b
leaq 0x48796(%rip), %rsi     # 0x58348
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0xffc5
leaq 0x48786(%rip), %rsi     # 0x5834f
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0x1001f
leaq 0x48773(%rip), %rsi     # 0x58353
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0x10079
leaq 0x48761(%rip), %rsi     # 0x58358
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0x100c8
leaq 0x48751(%rip), %rsi     # 0x5835f
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0x101ae
leaq 0x48740(%rip), %rsi     # 0x58365
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0x101e4
leaq 0x48740(%rip), %rsi     # 0x5837c
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0x10224
leaq 0x4873f(%rip), %rsi     # 0x58392
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0x1025a
leaq 0x4873e(%rip), %rsi     # 0x583a8
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0x10290
leaq 0x4872c(%rip), %rsi     # 0x583ad
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0x102c6
leaq 0x48719(%rip), %rsi     # 0x583b1
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0x102fc
leaq 0x4870b(%rip), %rsi     # 0x583ba
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
jne 0x103ad
movl (%r13), %ebp
leal -0x1(%rbp), %eax
movl %eax, (%r13)
movq (%r15), %r12
leaq 0x8(%r12), %rax
movq %rax, (%r15)
movq 0x8(%r12), %rdi
callq 0xc480
movsd %xmm0, (%rsp)
leal -0x2(%rbp), %eax
movl %eax, (%r13)
leaq 0x10(%r12), %rax
movq %rax, (%r15)
movq 0x10(%r12), %rdi
addl $-0x3, %ebp
movl %ebp, (%r13)
leaq 0x18(%r12), %rax
movq %rax, (%r15)
movq 0x18(%r12), %r15
leaq 0x486b1(%rip), %rsi     # 0x583c4
movq %rdi, %r12
callq 0xc500
testl %eax, %eax
je 0x10332
leaq 0x485f7(%rip), %rsi     # 0x58321
movq %r12, %rdi
callq 0xc500
testl %eax, %eax
je 0x1033f
movq %r12, %rdi
callq 0xc480
jmp 0x10347
cmpl $0x0, 0x14(%r12)
jle 0x10123
xorl %r15d, %r15d
movq 0x410(%rbx), %rax
movsd (%rax,%r15,8), %xmm0
mulsd 0x482bd(%rip), %xmm0    # 0x58028
callq 0xc0e0
movsd 0x482b8(%rip), %xmm1    # 0x58030
mulsd %xmm1, %xmm0
addsd %xmm1, %xmm0
movq %rbx, %rdi
movl %r15d, %esi
callq 0x13974
incq %r15
movslq 0x14(%r12), %rax
cmpq %rax, %r15
jl 0xfd56
jmp 0x10123
movq %rbx, %rdi
callq 0x12d80
jmp 0x10123
movq %rbx, %rdi
callq 0x12de0
jmp 0x10123
movq %rbx, %rdi
callq 0x12ec2
jmp 0x10123
movq %rbx, %rdi
callq 0x12f1a
jmp 0x10123
movq %rbx, %rdi
callq 0x12f7a
jmp 0x10123
xorpd %xmm0, %xmm0
movq %rbx, %rdi
callq 0x12fea
jmp 0x10123
movq %rbx, %rdi
callq 0x13b1c
jmp 0x10123
movq %rbx, %rdi
callq 0x13bee
jmp 0x10123
movq %rbx, %rdi
callq 0x13d36
jmp 0x10123
movl (%r13), %eax
movq %rax, 0x18(%rsp)
decl %eax
movl %eax, (%r13)
movq (%r15), %rbp
leaq 0x8(%rbp), %rax
movq %rax, (%r15)
movq 0x8(%rbp), %r12
leaq 0x484e7(%rip), %rsi     # 0x58321
movq %r12, %rdi
callq 0xc500
movsd 0x481d6(%rip), %xmm0    # 0x58020
movsd %xmm0, (%rsp)
movsd %xmm0, 0x8(%rsp)
testl %eax, %eax
je 0xfe8b
movq %r12, %rdi
callq 0xc480
movsd %xmm0, 0x8(%rsp)
leaq 0x484bb(%rip), %rsi     # 0x58329
movq %r12, %rdi
callq 0xc500
testl %eax, %eax
jne 0xfe8b
leaq 0x6dc27(%rip), %rax     # 0x7daa8
movsd (%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x18(%rsp), %rax
addl $-0x2, %eax
movl %eax, (%r13)
leaq 0x10(%rbp), %rax
movq %rax, (%r15)
movq 0x10(%rbp), %r15
leaq 0x48478(%rip), %rsi     # 0x58321
movq %r15, %rdi
callq 0xc500
testl %eax, %eax
je 0xfee5
movq %r15, %rdi
callq 0xc480
movsd %xmm0, (%rsp)
leaq 0x48460(%rip), %rsi     # 0x58329
movq %r15, %rdi
callq 0xc500
testl %eax, %eax
jne 0xfee5
leaq 0x6dbcc(%rip), %rax     # 0x7daa8
movsd (%rax), %xmm0
movsd %xmm0, (%rsp)
movq %rbx, %rdi
movsd 0x8(%rsp), %xmm0
movsd (%rsp), %xmm1
callq 0x13176
jmp 0x10123
decl (%r13)
movq (%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, (%r15)
movq 0x8(%rax), %r15
movq %r15, %rdi
callq 0x103e7
testl %eax, %eax
je 0xffa2
movq %r15, %rdi
callq 0xc480
movq %rbx, %rdi
callq 0x131c2
jmp 0x10123
decl (%r13)
movq (%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, (%r15)
movq 0x8(%rax), %r15
movq %r15, %rdi
callq 0x103e7
testl %eax, %eax
je 0xfffc
movq %r15, %rdi
callq 0xc480
movq %rbx, %rdi
callq 0x13286
jmp 0x10123
decl (%r13)
movq (%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, (%r15)
movq 0x8(%rax), %r15
movq %r15, %rdi
callq 0x103e7
testl %eax, %eax
je 0x10056
movq %r15, %rdi
callq 0xc480
movq %rbx, %rdi
callq 0x1334a
jmp 0x10123
leaq 0x20(%rsp), %r12
movq %r12, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0xe7fc
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1321a
jmp 0x10119
decl (%r13)
movq (%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, (%r15)
movq 0x8(%rax), %r15
movq %r15, %rdi
callq 0x103e7
testl %eax, %eax
je 0x100a8
movq %r15, %rdi
callq 0xc480
movq %rbx, %rdi
callq 0x1340e
jmp 0x10123
leaq 0x20(%rsp), %r12
movq %r12, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0xe7fc
movq %rbx, %rdi
movq %r12, %rsi
callq 0x132de
jmp 0x10119
decl (%r13)
movq (%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, (%r15)
movq 0x8(%rax), %r15
movq %r15, %rdi
callq 0x103e7
testl %eax, %eax
je 0x100fb
movq %r15, %rdi
callq 0xc480
movq %rbx, %rdi
callq 0x134ec
jmp 0x10123
leaq 0x20(%rsp), %r12
movq %r12, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0xe7fc
movq %rbx, %rdi
movq %r12, %rsi
callq 0x133a2
jmp 0x10119
decl (%r13)
movq (%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, (%r15)
movq 0x8(%rax), %rdx
leaq 0x20(%rsp), %r15
movq %r15, %rdi
movq %rbp, %rsi
callq 0xe7fc
movq %rbx, %rdi
movq %r15, %rsi
callq 0x130fe
jmp 0x10119
leaq 0x20(%rsp), %r12
movq %r12, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0xe7fc
movq %rbx, %rdi
movq %r12, %rsi
callq 0x13474
jmp 0x10119
decl (%r13)
movq (%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, (%r15)
movq 0x8(%rax), %rdi
callq 0xc480
movsd %xmm0, (%rsp)
movq %r12, %rdi
callq 0x10479
mulsd (%rsp), %xmm0
movq %rbx, %rdi
callq 0x13e26
jmp 0x10123
leaq 0x20(%rsp), %r12
movq %r12, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0xe7fc
movq %rbx, %rdi
movq %r12, %rsi
callq 0x13574
leaq 0x20(%rsp), %rdi
callq 0x120ec
cmpl $0x0, 0x14(%rsp)
je 0x1016f
leaq 0x20(%rsp), %r15
movl $0x1000, %edx           # imm = 0x1000
movq %r15, %rdi
xorl %esi, %esi
callq 0xc200
leaq 0x8(%rbx), %rsi
movq %r15, %rdi
callq 0xc330
movq %r15, %rdi
callq 0xc1a0
movw $0x5f, 0x20(%rsp,%rax)
movq %r15, %rdi
movq %r14, %rsi
callq 0xc660
movq %rbx, %rdi
movq %r15, %rsi
callq 0x13b04
cmpb $0x1, 0x6d946(%rip)     # 0x7dabc
jne 0x1019c
addq $0x8, %rbx
leaq 0x48262(%rip), %rdi     # 0x583e5
movq %rbx, %rsi
xorl %eax, %eax
callq 0xc070
movq 0x6cdf4(%rip), %rax     # 0x7cf88
movq (%rax), %rdi
callq 0xc440
addq $0x1028, %rsp           # imm = 0x1028
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
decl (%r13)
movq (%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, (%r15)
movq 0x8(%rax), %rdi
callq 0xc480
movsd %xmm0, (%rsp)
movq %r12, %rdi
callq 0x10479
mulsd (%rsp), %xmm0
movq %rbx, %rdi
callq 0x13ff8
jmp 0x10123
decl (%r13)
movq (%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, (%r15)
movq 0x8(%rax), %rdi
callq 0xc480
movsd %xmm0, (%rsp)
movq %r12, %rdi
callq 0x10479
mulsd (%rsp), %xmm0
movq %rbx, %rdi
movl $0x1, %esi
movl $0x1, %edx
callq 0x1371e
jmp 0x10123
decl (%r13)
movq (%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, (%r15)
movq 0x8(%rax), %rdi
callq 0xc480
movsd %xmm0, (%rsp)
movq %r12, %rdi
callq 0x10479
mulsd (%rsp), %xmm0
movq %rbx, %rdi
callq 0x139a0
jmp 0x10123
decl (%r13)
movq (%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, (%r15)
movq 0x8(%rax), %rdi
callq 0xc480
movsd %xmm0, (%rsp)
movq %r12, %rdi
callq 0x10479
mulsd (%rsp), %xmm0
movq %rbx, %rdi
callq 0x139ac
jmp 0x10123
decl (%r13)
movq (%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, (%r15)
movq 0x8(%rax), %rdi
callq 0xc480
movsd %xmm0, (%rsp)
movq %r12, %rdi
callq 0x10479
mulsd (%rsp), %xmm0
movq %rbx, %rdi
callq 0x14122
jmp 0x10123
decl (%r13)
movq (%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, (%r15)
movq 0x8(%rax), %rdi
callq 0xc480
movsd %xmm0, (%rsp)
movq %r12, %rdi
callq 0x10479
mulsd (%rsp), %xmm0
movq %rbx, %rdi
callq 0x1436a
jmp 0x10123
decl (%r13)
movq (%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, (%r15)
movq 0x8(%rax), %rdi
callq 0xc480
movsd %xmm0, (%rsp)
movq %r12, %rdi
callq 0x10479
mulsd (%rsp), %xmm0
movq %rbx, %rdi
callq 0x14400
jmp 0x10123
leaq 0x487f7(%rip), %rax     # 0x58b30
movsd (%rax), %xmm0
jmp 0x10347
movsd 0x47cd9(%rip), %xmm0    # 0x58020
movsd %xmm0, 0x8(%rsp)
leaq 0x48070(%rip), %rsi     # 0x583c4
movq %r15, %rdi
callq 0xc500
testl %eax, %eax
je 0x10380
leaq 0x47fba(%rip), %rsi     # 0x58321
movq %r15, %rdi
callq 0xc500
testl %eax, %eax
je 0x1038d
movq %r15, %rdi
callq 0xc480
movaps %xmm0, %xmm2
jmp 0x10395
leaq 0x487a9(%rip), %rax     # 0x58b30
movsd (%rax), %xmm2
jmp 0x10395
movsd 0x47c8b(%rip), %xmm2    # 0x58020
movq %rbx, %rdi
movsd (%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
callq 0x139b8
jmp 0x10123
leaq 0x48015(%rip), %rdi     # 0x583c9
movq %r14, %rsi
xorl %eax, %eax
callq 0x5761a
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0xc470
jmp 0x103d2
jmp 0x103d2
jmp 0x103d2
jmp 0x103d2
jmp 0x103d2
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x120ec
movq %rbx, %rdi
callq 0xc650