// File: /workspace/github_cpp_makefile_star2_O1/sundale[P]gcode/rs274ngc/interp_read.cc
// Function: Interp::read_parameter_setting(char*, int*, block_struct*, double*)
int Interp::read_parameter_setting(
    char *line,   //!< string: line of RS274/NGC code being processed
    int *counter, //!< pointer to a counter for position on the line 
    block_pointer block,  //!< pointer to a block being filled from the line 
    double *parameters)   //!< array of system parameters
{
  static char name[] = "read_parameter_setting";
  int index;
  double value;
  char *param;
  char *dup;

  CHKS((line[*counter] != '#'), NCE_BUG_FUNCTION_SHOULD_NOT_HAVE_BEEN_CALLED);
  *counter = (*counter + 1);

  // named parameters look like '<letter...>' or '<_letter.....>'
  if((line[*counter] == '<') || isalpha(line[*(counter)]))
  {
      CHP(read_named_parameter_setting(line, counter, &param, parameters));

      CHKS((line[*counter] != '='),
          NCE_EQUAL_SIGN_MISSING_IN_PARAMETER_SETTING);
      *counter = (*counter + 1);
      CHP(read_real_value(line, counter, &value, parameters));

      logDebug("setting up named param[%d]:|%s| value:%lf",
               _setup.named_parameter_occurrence, param, value);

      dup = strdup(param);
      if(dup == 0)
      {
          ERS(NCE_OUT_OF_MEMORY);
      }
      logDebug("%s strdup[0x%x]:|%s|", name, dup, dup);
      _setup.named_parameters[_setup.named_parameter_occurrence] = dup;

      _setup.named_parameter_values[_setup.named_parameter_occurrence] = value;
      _setup.named_parameter_occurrence++;
      logDebug("done setting up named param[%d]:|%s| value:%lf",
               _setup.named_parameter_occurrence, param, value);
  }
  else
  {
      CHP(read_integer_value(line, counter, &index, parameters));
      CHKS(((index < 1) || (index >= RS274NGC_MAX_PARAMETERS)),
          NCE_PARAMETER_NUMBER_OUT_OF_RANGE);
      CHKS((isreadonly(index)), NCE_PARAMETER_NUMBER_READONLY);
      CHKS((line[*counter] != '='),
          NCE_EQUAL_SIGN_MISSING_IN_PARAMETER_SETTING);
      *counter = (*counter + 1);
      CHP(read_real_value(line, counter, &value, parameters));
      _setup.parameter_numbers[_setup.parameter_occurrence] = index;
      _setup.parameter_values[_setup.parameter_occurrence] = value;
      _setup.parameter_occurrence++;
  }
  return INTERP_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movslq (%rdx), %rax
cmpb $0x23, (%rsi,%rax)
jne 0x2d077
movq %r8, %r15
movq %rdx, %r12
movq %rsi, %r13
leaq 0x1(%rax), %rcx
movl %ecx, (%rdx)
movsbl 0x1(%rsi,%rax), %edi
cmpl $0x3c, %edi
je 0x2cff5
callq 0xb140
testl %eax, %eax
je 0x2d2ae
leaq -0x38(%rbp), %rcx
movq %rbx, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0xb240
movl %eax, %r14d
testl %eax, %eax
je 0x2d0e4
movq 0x16f47(%rip), %rbx     # 0x43f60
movslq 0xd670(%rbx), %rax
cmpq $0x30, %rax
jg 0x2d0d2
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq (%rbx,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0xe96c(%rip), %rsi      # 0x3b9b0
movl $0x50, %edx
callq 0xa8a0
movslq 0xd670(%rbx), %rax
leaq (%rax,%rax,4), %rcx
shlq $0x4, %rcx
xorl %edx, %edx
movb %dl, 0xc71f(%rbx,%rcx)
incl %eax
movl %eax, 0xd670(%rbx)
movb %dl, 0xc720(%rbx,%rcx)
jmp 0x2d0d2
leaq 0xd1d9(%rip), %rdi      # 0x3a257
callq 0xa1f0
movq %rbx, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0xa850
movq 0x16ec9(%rip), %rbx     # 0x43f60
movl $0x0, 0xd670(%rbx)
leaq 0xc6d0(%rbx), %rdi
leaq 0xe901(%rip), %rsi      # 0x3b9b0
movl $0x50, %edx
callq 0xa8a0
movw $0x0, 0xc71f(%rbx)
movl $0x1, 0xd670(%rbx)
movl $0x5, %r14d
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movslq (%r12), %rax
cmpb $0x3d, (%r13,%rax)
jne 0x2d470
incl %eax
movl %eax, (%r12)
leaq -0x30(%rbp), %rcx
movq %rbx, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r15, %r8
callq 0xaf10
movl %eax, %r15d
testl %eax, %eax
je 0x2d17b
movq 0x16e43(%rip), %r14     # 0x43f60
movslq 0xd670(%r14), %rax
cmpq $0x30, %rax
jg 0x2d178
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq (%r14,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0xe86c(%rip), %rsi      # 0x3b9b0
movl $0x50, %edx
callq 0xa8a0
movslq 0xd670(%r14), %rax
leaq (%rax,%rax,4), %rcx
shlq $0x4, %rcx
xorl %edx, %edx
movb %dl, 0xc71f(%r14,%rcx)
incl %eax
movl %eax, 0xd670(%r14)
movb %dl, 0xc720(%r14,%rcx)
movl %r15d, %r14d
testl %r15d, %r15d
jne 0x2d0d2
movq 0x16dd5(%rip), %r12     # 0x43f60
cmpl $0x0, 0x1b6b4(%r12)
jle 0x2d1d3
callq 0xaf80
movl 0xc350(%r12), %r10d
movsd -0x30(%rbp), %xmm0
leaq 0xf81d(%rip), %rsi      # 0x3c9cc
leaq 0xf300(%rip), %r8       # 0x3c4b6
movq %rbx, %rdi
xorl %edx, %edx
movl %eax, %ecx
movl $0x8a3, %r9d            # imm = 0x8A3
movb $0x1, %al
pushq -0x38(%rbp)
pushq %r10
callq 0xb470
addq $0x10, %rsp
movq -0x38(%rbp), %r15
movq %r15, %rdi
callq 0xb4e0
testq %rax, %rax
je 0x2d332
movq %rax, %r14
cmpl $0x0, 0x1b6b4(%r12)
jle 0x2d232
callq 0xaf80
subq $0x8, %rsp
leaq 0x179ba(%rip), %r10     # 0x44bc0
leaq 0xf6ed(%rip), %rsi      # 0x3c8fa
leaq 0xf2a2(%rip), %r8       # 0x3c4b6
movq %rbx, %rdi
xorl %edx, %edx
movl %eax, %ecx
movl $0x8aa, %r9d            # imm = 0x8AA
xorl %eax, %eax
pushq %r14
pushq %r14
pushq %r10
callq 0xb470
addq $0x20, %rsp
movslq 0xc350(%r12), %rax
movq %r14, 0xc358(%r12,%rax,8)
movsd -0x30(%rbp), %xmm0
movsd %xmm0, 0xc4e8(%r12,%rax,8)
incl %eax
movl %eax, 0xc350(%r12)
cmpl $0x0, 0x1b6b4(%r12)
jle 0x2d468
callq 0xaf80
movl 0xc350(%r12), %r10d
movsd -0x30(%rbp), %xmm0
leaq 0xf786(%rip), %rsi      # 0x3ca09
leaq 0xf22c(%rip), %r8       # 0x3c4b6
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %edx, %edx
movl %eax, %ecx
movl $0x8b0, %r9d            # imm = 0x8B0
movb $0x1, %al
pushq %r15
pushq %r10
callq 0xb470
addq $0x10, %rsp
jmp 0x2d0d2
leaq -0x38(%rbp), %rcx
movq %rbx, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r15, %r8
callq 0xab30
movl %eax, %r14d
testl %eax, %eax
jne 0x2d012
movl -0x38(%rbp), %edi
movl $0xffffeada, %eax       # imm = 0xFFFFEADA
leal (%rdi,%rax), %ecx
cmpl %eax, %ecx
ja 0x2d2e9
leaq 0xf6a2(%rip), %rdi      # 0x3c986
jmp 0x2d07e
movq 0x16c80(%rip), %rax     # 0x43f70
movslq (%rax), %rax
testq %rax, %rax
setg %cl
jle 0x2d322
movq 0x16ca6(%rip), %rcx     # 0x43fa8
cmpl %edi, (%rcx)
je 0x2d326
movl $0x1, %esi
movq %rsi, %rdx
cmpq %rsi, %rax
je 0x2d31c
leaq 0x1(%rdx), %rsi
cmpl %edi, (%rcx,%rdx,4)
jne 0x2d30b
cmpq %rax, %rdx
setb %cl
testb %cl, %cl
je 0x2d38c
leaq 0xf71e(%rip), %rdi      # 0x3ca4b
jmp 0x2d07e
leaq 0xf5b3(%rip), %rdi      # 0x3c8ec
callq 0xa1f0
movq %rbx, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0xa850
movl $0x0, 0xd670(%r12)
leaq 0xc6d0(%r12), %rdi
leaq 0xe64a(%rip), %rsi      # 0x3b9b0
movl $0x50, %edx
callq 0xa8a0
movw $0x0, 0xc71f(%r12)
movl $0x1, 0xd670(%r12)
jmp 0x2d0cc
movslq (%r12), %rax
cmpb $0x3d, (%r13,%rax)
jne 0x2d470
incl %eax
movl %eax, (%r12)
leaq -0x30(%rbp), %rcx
movq %rdi, -0x40(%rbp)
movq %rbx, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r15, %r8
callq 0xaf10
movq -0x40(%rbp), %rsi
movl %eax, %ebx
testl %eax, %eax
je 0x2d42e
movq 0x16b94(%rip), %r14     # 0x43f60
movslq 0xd670(%r14), %rax
cmpq $0x30, %rax
jg 0x2d42b
leaq (%rax,%rax,4), %rax
shlq $0x4, %rax
leaq (%r14,%rax), %rdi
addq $0xc6d0, %rdi           # imm = 0xC6D0
leaq 0xe5bd(%rip), %rsi      # 0x3b9b0
movl $0x50, %edx
callq 0xa8a0
movq -0x40(%rbp), %rsi
movslq 0xd670(%r14), %rax
leaq (%rax,%rax,4), %rcx
shlq $0x4, %rcx
xorl %edx, %edx
movb %dl, 0xc71f(%r14,%rcx)
incl %eax
movl %eax, 0xd670(%r14)
movb %dl, 0xc720(%r14,%rcx)
movl %ebx, %r14d
testl %ebx, %ebx
jne 0x2d0d2
movq 0x16b23(%rip), %rax     # 0x43f60
movslq 0xc0f0(%rax), %rcx
movl %esi, 0xc0f4(%rax,%rcx,4)
movsd -0x30(%rbp), %xmm0
movslq 0xc0f0(%rax), %rcx
movsd %xmm0, 0xc1c0(%rax,%rcx,8)
incl %ecx
movl %ecx, 0xc0f0(%rax)
xorl %r14d, %r14d
jmp 0x2d0d2
leaq 0xf52d(%rip), %rdi      # 0x3c9a4
jmp 0x2d07e