// File: /workspace/github_cpp_makefile_star2_O3/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 0x47930(%rip), %rsi     # 0x572cd
movq %rdx, %rdi
callq 0xc500
testl %eax, %eax
je 0xfc6d
leaq 0x4791e(%rip), %rsi     # 0x572d2
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0xfcc3
leaq 0x4790b(%rip), %rsi     # 0x572d6
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0xfcd0
leaq 0x478f9(%rip), %rsi     # 0x572db
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0xfcdd
leaq 0x478e9(%rip), %rsi     # 0x572e2
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0xfcea
leaq 0x478d9(%rip), %rsi     # 0x572e9
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0xfcf7
leaq 0x478c9(%rip), %rsi     # 0x572f0
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0xfd04
leaq 0x478b8(%rip), %rsi     # 0x572f6
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0xfd15
leaq 0x478ab(%rip), %rsi     # 0x57300
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0xfd22
leaq 0x4789f(%rip), %rsi     # 0x5730b
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0xfd2f
leaq 0x47890(%rip), %rsi     # 0x57313
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0xfd3c
leaq 0x47895(%rip), %rsi     # 0x5732f
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0xfe23
leaq 0x47882(%rip), %rsi     # 0x57333
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0xfe5a
leaq 0x47874(%rip), %rsi     # 0x5733c
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0xfe91
leaq 0x47866(%rip), %rsi     # 0x57345
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0xfeeb
leaq 0x47856(%rip), %rsi     # 0x5734c
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0xff45
leaq 0x47843(%rip), %rsi     # 0x57350
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0xff9f
leaq 0x47831(%rip), %rsi     # 0x57355
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0xffee
leaq 0x47821(%rip), %rsi     # 0x5735c
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0x100d4
leaq 0x47810(%rip), %rsi     # 0x57362
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0x1010a
leaq 0x47810(%rip), %rsi     # 0x57379
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0x1014a
leaq 0x4780f(%rip), %rsi     # 0x5738f
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0x10180
leaq 0x4780e(%rip), %rsi     # 0x573a5
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0x101b6
leaq 0x477fc(%rip), %rsi     # 0x573aa
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0x101ec
leaq 0x477e9(%rip), %rsi     # 0x573ae
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
je 0x10222
leaq 0x477db(%rip), %rsi     # 0x573b7
movq %r14, %rdi
callq 0xc500
testl %eax, %eax
jne 0x102d3
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)
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 0x47788(%rip), %rsi     # 0x573c1
movq %rdi, %r12
callq 0xc500
testl %eax, %eax
je 0x10258
leaq 0x476ce(%rip), %rsi     # 0x5731e
movq %r12, %rdi
callq 0xc500
testl %eax, %eax
je 0x10265
movq %r12, %rdi
callq 0xc480
jmp 0x1026d
cmpl $0x0, 0x14(%r12)
jle 0x10049
xorl %r15d, %r15d
movq 0x410(%rbx), %rax
movsd (%rax,%r15,8), %xmm0
mulsd 0x47397(%rip), %xmm0    # 0x57028
callq 0xc0e0
movsd 0x47392(%rip), %xmm1    # 0x57030
mulsd %xmm1, %xmm0
addsd %xmm1, %xmm0
movq %rbx, %rdi
movl %r15d, %esi
callq 0x1384a
incq %r15
movslq 0x14(%r12), %rax
cmpq %rax, %r15
jl 0xfc7c
jmp 0x10049
movq %rbx, %rdi
callq 0x12c50
jmp 0x10049
movq %rbx, %rdi
callq 0x12cb0
jmp 0x10049
movq %rbx, %rdi
callq 0x12d92
jmp 0x10049
movq %rbx, %rdi
callq 0x12dea
jmp 0x10049
movq %rbx, %rdi
callq 0x12e4a
jmp 0x10049
xorpd %xmm0, %xmm0
movq %rbx, %rdi
callq 0x12eba
jmp 0x10049
movq %rbx, %rdi
callq 0x139f2
jmp 0x10049
movq %rbx, %rdi
callq 0x13ac4
jmp 0x10049
movq %rbx, %rdi
callq 0x13c0a
jmp 0x10049
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 0x475be(%rip), %rsi     # 0x5731e
movq %r12, %rdi
callq 0xc500
movsd 0x472b0(%rip), %xmm0    # 0x57020
movsd %xmm0, (%rsp)
movsd %xmm0, 0x8(%rsp)
testl %eax, %eax
je 0xfdb1
movq %r12, %rdi
callq 0xc480
movsd %xmm0, 0x8(%rsp)
leaq 0x47592(%rip), %rsi     # 0x57326
movq %r12, %rdi
callq 0xc500
testl %eax, %eax
jne 0xfdb1
leaq 0x6cd01(%rip), %rax     # 0x7caa8
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 0x4754f(%rip), %rsi     # 0x5731e
movq %r15, %rdi
callq 0xc500
testl %eax, %eax
je 0xfe0b
movq %r15, %rdi
callq 0xc480
movsd %xmm0, (%rsp)
leaq 0x47537(%rip), %rsi     # 0x57326
movq %r15, %rdi
callq 0xc500
testl %eax, %eax
jne 0xfe0b
leaq 0x6cca6(%rip), %rax     # 0x7caa8
movsd (%rax), %xmm0
movsd %xmm0, (%rsp)
movq %rbx, %rdi
movsd 0x8(%rsp), %xmm0
movsd (%rsp), %xmm1
callq 0x13046
jmp 0x10049
decl (%r13)
movq (%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, (%r15)
movq 0x8(%rax), %r15
movq %r15, %rdi
callq 0x1030d
testl %eax, %eax
je 0xfec8
movq %r15, %rdi
callq 0xc480
movq %rbx, %rdi
callq 0x13092
jmp 0x10049
decl (%r13)
movq (%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, (%r15)
movq 0x8(%rax), %r15
movq %r15, %rdi
callq 0x1030d
testl %eax, %eax
je 0xff22
movq %r15, %rdi
callq 0xc480
movq %rbx, %rdi
callq 0x13156
jmp 0x10049
decl (%r13)
movq (%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, (%r15)
movq 0x8(%rax), %r15
movq %r15, %rdi
callq 0x1030d
testl %eax, %eax
je 0xff7c
movq %r15, %rdi
callq 0xc480
movq %rbx, %rdi
callq 0x1321a
jmp 0x10049
leaq 0x20(%rsp), %r12
movq %r12, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0xe7dc
movq %rbx, %rdi
movq %r12, %rsi
callq 0x130ea
jmp 0x1003f
decl (%r13)
movq (%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, (%r15)
movq 0x8(%rax), %r15
movq %r15, %rdi
callq 0x1030d
testl %eax, %eax
je 0xffce
movq %r15, %rdi
callq 0xc480
movq %rbx, %rdi
callq 0x132de
jmp 0x10049
leaq 0x20(%rsp), %r12
movq %r12, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0xe7dc
movq %rbx, %rdi
movq %r12, %rsi
callq 0x131ae
jmp 0x1003f
decl (%r13)
movq (%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, (%r15)
movq 0x8(%rax), %r15
movq %r15, %rdi
callq 0x1030d
testl %eax, %eax
je 0x10021
movq %r15, %rdi
callq 0xc480
movq %rbx, %rdi
callq 0x133bc
jmp 0x10049
leaq 0x20(%rsp), %r12
movq %r12, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0xe7dc
movq %rbx, %rdi
movq %r12, %rsi
callq 0x13272
jmp 0x1003f
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 0xe7dc
movq %rbx, %rdi
movq %r15, %rsi
callq 0x12fce
jmp 0x1003f
leaq 0x20(%rsp), %r12
movq %r12, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0xe7dc
movq %rbx, %rdi
movq %r12, %rsi
callq 0x13344
jmp 0x1003f
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 0x103a1
mulsd (%rsp), %xmm0
movq %rbx, %rdi
callq 0x13cfa
jmp 0x10049
leaq 0x20(%rsp), %r12
movq %r12, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0xe7dc
movq %rbx, %rdi
movq %r12, %rsi
callq 0x13446
leaq 0x20(%rsp), %rdi
callq 0x11fa8
cmpl $0x0, 0x14(%rsp)
je 0x10095
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 0x139da
cmpb $0x1, 0x6ca20(%rip)     # 0x7cabc
jne 0x100c2
addq $0x8, %rbx
leaq 0x47339(%rip), %rdi     # 0x573e2
movq %rbx, %rsi
xorl %eax, %eax
callq 0xc070
movq 0x6bece(%rip), %rax     # 0x7bf88
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 0x103a1
mulsd (%rsp), %xmm0
movq %rbx, %rdi
callq 0x13ecc
jmp 0x10049
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 0x103a1
mulsd (%rsp), %xmm0
movq %rbx, %rdi
movl $0x1, %esi
movl $0x1, %edx
callq 0x135f4
jmp 0x10049
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 0x103a1
mulsd (%rsp), %xmm0
movq %rbx, %rdi
callq 0x13876
jmp 0x10049
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 0x103a1
mulsd (%rsp), %xmm0
movq %rbx, %rdi
callq 0x13882
jmp 0x10049
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 0x103a1
mulsd (%rsp), %xmm0
movq %rbx, %rdi
callq 0x13fce
jmp 0x10049
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 0x103a1
mulsd (%rsp), %xmm0
movq %rbx, %rdi
callq 0x14202
jmp 0x10049
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 0x103a1
mulsd (%rsp), %xmm0
movq %rbx, %rdi
callq 0x14298
jmp 0x10049
leaq 0x478d1(%rip), %rax     # 0x57b30
movsd (%rax), %xmm0
jmp 0x1026d
movsd 0x46db3(%rip), %xmm0    # 0x57020
movsd %xmm0, 0x8(%rsp)
leaq 0x47147(%rip), %rsi     # 0x573c1
movq %r15, %rdi
callq 0xc500
testl %eax, %eax
je 0x102a6
leaq 0x47091(%rip), %rsi     # 0x5731e
movq %r15, %rdi
callq 0xc500
testl %eax, %eax
je 0x102b3
movq %r15, %rdi
callq 0xc480
movaps %xmm0, %xmm2
jmp 0x102bb
leaq 0x47883(%rip), %rax     # 0x57b30
movsd (%rax), %xmm2
jmp 0x102bb
movsd 0x46d65(%rip), %xmm2    # 0x57020
movq %rbx, %rdi
movsd (%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
callq 0x1388e
jmp 0x10049
leaq 0x470ec(%rip), %rdi     # 0x573c6
movq %r14, %rsi
xorl %eax, %eax
callq 0x566f2
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0xc470
jmp 0x102f8
jmp 0x102f8
jmp 0x102f8
jmp 0x102f8
jmp 0x102f8
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x11fa8
movq %rbx, %rdi
callq 0xc650