// File: /workspace/github_cpp_makefile_star2_O2/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 0x41143(%rip), %rsi     # 0x512cd
movq %rdx, %rdi
callq 0xd530
testl %eax, %eax
je 0x1045a
leaq 0x41131(%rip), %rsi     # 0x512d2
movq %r14, %rdi
callq 0xd530
testl %eax, %eax
je 0x104a5
leaq 0x4111e(%rip), %rsi     # 0x512d6
movq %r14, %rdi
callq 0xd530
testl %eax, %eax
je 0x104b2
leaq 0x4110c(%rip), %rsi     # 0x512db
movq %r14, %rdi
callq 0xd530
testl %eax, %eax
je 0x104bf
leaq 0x410fc(%rip), %rsi     # 0x512e2
movq %r14, %rdi
callq 0xd530
testl %eax, %eax
je 0x104cc
leaq 0x410ec(%rip), %rsi     # 0x512e9
movq %r14, %rdi
callq 0xd530
testl %eax, %eax
je 0x104d9
leaq 0x410dc(%rip), %rsi     # 0x512f0
movq %r14, %rdi
callq 0xd530
testl %eax, %eax
je 0x104e6
leaq 0x410cb(%rip), %rsi     # 0x512f6
movq %r14, %rdi
callq 0xd530
testl %eax, %eax
je 0x104f7
leaq 0x410be(%rip), %rsi     # 0x51300
movq %r14, %rdi
callq 0xd530
testl %eax, %eax
je 0x10504
leaq 0x410b2(%rip), %rsi     # 0x5130b
movq %r14, %rdi
callq 0xd530
testl %eax, %eax
je 0x10511
leaq 0x410a3(%rip), %rsi     # 0x51313
movq %r14, %rdi
callq 0xd530
testl %eax, %eax
je 0x1051e
leaq 0x410a8(%rip), %rsi     # 0x5132f
movq %r14, %rdi
callq 0xd530
testl %eax, %eax
je 0x10605
leaq 0x41095(%rip), %rsi     # 0x51333
movq %r14, %rdi
callq 0xd530
testl %eax, %eax
je 0x1063c
leaq 0x41087(%rip), %rsi     # 0x5133c
movq %r14, %rdi
callq 0xd530
testl %eax, %eax
je 0x10673
leaq 0x41079(%rip), %rsi     # 0x51345
movq %r14, %rdi
callq 0xd530
testl %eax, %eax
je 0x106cd
leaq 0x41069(%rip), %rsi     # 0x5134c
movq %r14, %rdi
callq 0xd530
testl %eax, %eax
je 0x10727
leaq 0x41056(%rip), %rsi     # 0x51350
movq %r14, %rdi
callq 0xd530
testl %eax, %eax
je 0x10781
leaq 0x41044(%rip), %rsi     # 0x51355
movq %r14, %rdi
callq 0xd530
testl %eax, %eax
je 0x107d0
leaq 0x41034(%rip), %rsi     # 0x5135c
movq %r14, %rdi
callq 0xd530
testl %eax, %eax
je 0x108b6
leaq 0x41023(%rip), %rsi     # 0x51362
movq %r14, %rdi
callq 0xd530
testl %eax, %eax
je 0x108ec
leaq 0x41023(%rip), %rsi     # 0x51379
movq %r14, %rdi
callq 0xd530
testl %eax, %eax
je 0x10927
leaq 0x41022(%rip), %rsi     # 0x5138f
movq %r14, %rdi
callq 0xd530
testl %eax, %eax
je 0x1095d
leaq 0x41021(%rip), %rsi     # 0x513a5
movq %r14, %rdi
callq 0xd530
testl %eax, %eax
je 0x10993
leaq 0x4100f(%rip), %rsi     # 0x513aa
movq %r14, %rdi
callq 0xd530
testl %eax, %eax
je 0x109c9
leaq 0x40ffc(%rip), %rsi     # 0x513ae
movq %r14, %rdi
callq 0xd530
testl %eax, %eax
je 0x109ff
leaq 0x40fee(%rip), %rsi     # 0x513b7
movq %r14, %rdi
callq 0xd530
testl %eax, %eax
jne 0x10ab0
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 0xd4a0
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 0x40f9b(%rip), %rsi     # 0x513c1
movq %rdi, %r12
callq 0xd530
testl %eax, %eax
je 0x10a35
leaq 0x40ee1(%rip), %rsi     # 0x5131e
movq %r12, %rdi
callq 0xd530
testl %eax, %eax
je 0x10a42
movq %r12, %rdi
callq 0xd4a0
jmp 0x10a4a
xorl %r15d, %r15d
movslq 0x14(%r12), %rax
cmpq %rax, %r15
jge 0x1082b
movq 0x410(%rbx), %rax
movsd (%rax,%r15,8), %xmm0
mulsd 0x40ba8(%rip), %xmm0    # 0x51028
callq 0xd0e0
movsd 0x40ba3(%rip), %xmm1    # 0x51030
mulsd %xmm1, %xmm0
addsd %xmm1, %xmm0
movq %rbx, %rdi
movl %r15d, %esi
callq 0x13cc4
incq %r15
jmp 0x1045d
movq %rbx, %rdi
callq 0x131d6
jmp 0x1082b
movq %rbx, %rdi
callq 0x13234
jmp 0x1082b
movq %rbx, %rdi
callq 0x1330e
jmp 0x1082b
movq %rbx, %rdi
callq 0x13364
jmp 0x1082b
movq %rbx, %rdi
callq 0x133c2
jmp 0x1082b
xorpd %xmm0, %xmm0
movq %rbx, %rdi
callq 0x13430
jmp 0x1082b
movq %rbx, %rdi
callq 0x13e3c
jmp 0x1082b
movq %rbx, %rdi
callq 0x13f04
jmp 0x1082b
movq %rbx, %rdi
callq 0x14012
jmp 0x1082b
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 0x40ddc(%rip), %rsi     # 0x5131e
movq %r12, %rdi
callq 0xd530
movsd 0x40ace(%rip), %xmm0    # 0x51020
movsd %xmm0, (%rsp)
movsd %xmm0, 0x8(%rsp)
testl %eax, %eax
je 0x10593
movq %r12, %rdi
callq 0xd4a0
movsd %xmm0, 0x8(%rsp)
leaq 0x40db0(%rip), %rsi     # 0x51326
movq %r12, %rdi
callq 0xd530
testl %eax, %eax
jne 0x10593
leaq 0x6952f(%rip), %rax     # 0x79ab8
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 0x40d6d(%rip), %rsi     # 0x5131e
movq %r15, %rdi
callq 0xd530
testl %eax, %eax
je 0x105ed
movq %r15, %rdi
callq 0xd4a0
movsd %xmm0, (%rsp)
leaq 0x40d55(%rip), %rsi     # 0x51326
movq %r15, %rdi
callq 0xd530
testl %eax, %eax
jne 0x105ed
leaq 0x694d4(%rip), %rax     # 0x79ab8
movsd (%rax), %xmm0
movsd %xmm0, (%rsp)
movq %rbx, %rdi
movsd 0x8(%rsp), %xmm0
movsd (%rsp), %xmm1
callq 0x13526
jmp 0x1082b
decl (%r13)
movq (%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, (%r15)
movq 0x8(%rax), %r15
movq %r15, %rdi
callq 0x10ae8
testl %eax, %eax
je 0x106aa
movq %r15, %rdi
callq 0xd4a0
movq %rbx, %rdi
callq 0x13570
jmp 0x1082b
decl (%r13)
movq (%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, (%r15)
movq 0x8(%rax), %r15
movq %r15, %rdi
callq 0x10ae8
testl %eax, %eax
je 0x10704
movq %r15, %rdi
callq 0xd4a0
movq %rbx, %rdi
callq 0x13634
jmp 0x1082b
decl (%r13)
movq (%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, (%r15)
movq 0x8(%rax), %r15
movq %r15, %rdi
callq 0x10ae8
testl %eax, %eax
je 0x1075e
movq %r15, %rdi
callq 0xd4a0
movq %rbx, %rdi
callq 0x136f4
jmp 0x1082b
leaq 0x20(%rsp), %r12
movq %r12, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0xf09c
movq %rbx, %rdi
movq %r12, %rsi
callq 0x135ca
jmp 0x10821
decl (%r13)
movq (%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, (%r15)
movq 0x8(%rax), %r15
movq %r15, %rdi
callq 0x10ae8
testl %eax, %eax
je 0x107b0
movq %r15, %rdi
callq 0xd4a0
movq %rbx, %rdi
callq 0x137b8
jmp 0x1082b
leaq 0x20(%rsp), %r12
movq %r12, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0xf09c
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1368a
jmp 0x10821
decl (%r13)
movq (%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, (%r15)
movq 0x8(%rax), %r15
movq %r15, %rdi
callq 0x10ae8
testl %eax, %eax
je 0x10803
movq %r15, %rdi
callq 0xd4a0
movq %rbx, %rdi
callq 0x13894
jmp 0x1082b
leaq 0x20(%rsp), %r12
movq %r12, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0xf09c
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1374e
jmp 0x10821
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 0xf09c
movq %rbx, %rdi
movq %r15, %rsi
callq 0x134b4
jmp 0x10821
leaq 0x20(%rsp), %r12
movq %r12, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0xf09c
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1381e
jmp 0x10821
decl (%r13)
movq (%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, (%r15)
movq 0x8(%rax), %rdi
callq 0xd4a0
movsd %xmm0, (%rsp)
movq %r12, %rdi
callq 0x10b77
mulsd (%rsp), %xmm0
movq %rbx, %rdi
callq 0x140e8
jmp 0x1082b
leaq 0x20(%rsp), %r12
movq %r12, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0xf09c
movq %rbx, %rdi
movq %r12, %rsi
callq 0x13914
leaq 0x20(%rsp), %rdi
callq 0x12624
cmpl $0x0, 0x14(%rsp)
je 0x10877
leaq 0x20(%rsp), %r15
movl $0x1000, %edx           # imm = 0x1000
movq %r15, %rdi
xorl %esi, %esi
callq 0xd210
leaq 0x8(%rbx), %rsi
movq %r15, %rdi
callq 0xd340
movq %r15, %rdi
callq 0xd1a0
movw $0x5f, 0x20(%rsp,%rax)
movq %r15, %rdi
movq %r14, %rsi
callq 0xd690
movq %rbx, %rdi
movq %r15, %rsi
callq 0x13e24
cmpb $0x1, 0x6924e(%rip)     # 0x79acc
jne 0x108a4
addq $0x8, %rbx
leaq 0x40b57(%rip), %rdi     # 0x513e2
movq %rbx, %rsi
xorl %eax, %eax
callq 0xd070
movq 0x686fc(%rip), %rax     # 0x78f98
movq (%rax), %rdi
callq 0xd460
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 0xd4a0
movsd %xmm0, (%rsp)
movq %r12, %rdi
callq 0x10b77
mulsd (%rsp), %xmm0
movq %rbx, %rdi
callq 0x14274
jmp 0x1082b
decl (%r13)
movq (%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, (%r15)
movq 0x8(%rax), %rdi
callq 0xd4a0
movsd %xmm0, (%rsp)
movq %r12, %rdi
callq 0x10b77
mulsd (%rsp), %xmm0
pushq $0x1
popq %rdx
movq %rbx, %rdi
movl %edx, %esi
callq 0x13aae
jmp 0x1082b
decl (%r13)
movq (%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, (%r15)
movq 0x8(%rax), %rdi
callq 0xd4a0
movsd %xmm0, (%rsp)
movq %r12, %rdi
callq 0x10b77
mulsd (%rsp), %xmm0
movq %rbx, %rdi
callq 0x13cf0
jmp 0x1082b
decl (%r13)
movq (%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, (%r15)
movq 0x8(%rax), %rdi
callq 0xd4a0
movsd %xmm0, (%rsp)
movq %r12, %rdi
callq 0x10b77
mulsd (%rsp), %xmm0
movq %rbx, %rdi
callq 0x13cfa
jmp 0x1082b
decl (%r13)
movq (%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, (%r15)
movq 0x8(%rax), %rdi
callq 0xd4a0
movsd %xmm0, (%rsp)
movq %r12, %rdi
callq 0x10b77
mulsd (%rsp), %xmm0
movq %rbx, %rdi
callq 0x14368
jmp 0x1082b
decl (%r13)
movq (%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, (%r15)
movq 0x8(%rax), %rdi
callq 0xd4a0
movsd %xmm0, (%rsp)
movq %r12, %rdi
callq 0x10b77
mulsd (%rsp), %xmm0
movq %rbx, %rdi
callq 0x14598
jmp 0x1082b
decl (%r13)
movq (%r15), %rax
leaq 0x8(%rax), %rcx
movq %rcx, (%r15)
movq 0x8(%rax), %rdi
callq 0xd4a0
movsd %xmm0, (%rsp)
movq %r12, %rdi
callq 0x10b77
mulsd (%rsp), %xmm0
movq %rbx, %rdi
callq 0x1461e
jmp 0x1082b
leaq 0x410c4(%rip), %rax     # 0x51b00
movsd (%rax), %xmm0
jmp 0x10a4a
movsd 0x405d6(%rip), %xmm0    # 0x51020
movsd %xmm0, 0x8(%rsp)
leaq 0x4096a(%rip), %rsi     # 0x513c1
movq %r15, %rdi
callq 0xd530
testl %eax, %eax
je 0x10a83
leaq 0x408b4(%rip), %rsi     # 0x5131e
movq %r15, %rdi
callq 0xd530
testl %eax, %eax
je 0x10a90
movq %r15, %rdi
callq 0xd4a0
movaps %xmm0, %xmm2
jmp 0x10a98
leaq 0x41076(%rip), %rax     # 0x51b00
movsd (%rax), %xmm2
jmp 0x10a98
movsd 0x40588(%rip), %xmm2    # 0x51020
movq %rbx, %rdi
movsd (%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
callq 0x13d04
jmp 0x1082b
leaq 0x4090f(%rip), %rdi     # 0x513c6
movq %r14, %rsi
xorl %eax, %eax
callq 0x50826
pushq $-0x1
popq %rdi
callq 0xd490
jmp 0x10ad3
jmp 0x10ad3
jmp 0x10ad3
jmp 0x10ad3
jmp 0x10ad3
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x12624
movq %rbx, %rdi
callq 0xd680