user: Please show me the C implementation that matches the assembly code listed below:

```asm
<_get_str2int>:
  endbr64
  push   %r15
  mov    $0x5,%edx
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0xa8,%rsp
  mov    %rsi,(%rsp)
  lea    D14(%rip),%rsi
  mov    %fs:0x28,%rax
  mov    %rax,0x98(%rsp)
  xor    %eax,%eax
  call   <strncmp@plt>
  test   %eax,%eax
  jne    L169
  movzbl 0x5(%rbx),%eax
  and    $0xffffffdf,%eax
  cmp    $0x50,%al
  jne    L800
  movzbl 0x6(%rbx),%eax
  lea    0x7(%rbx),%rsi
  mov    %eax,%edx
  and    $0xffffffdf,%edx
  cmp    $0x4f,%dl
  jne    L160
  movzbl 0x7(%rbx),%eax
  mov    %eax,%edx
  and    $0xffffffdf,%edx
  cmp    $0x57,%dl
  jne    L160
  movzbl 0x8(%rbx),%eax
  mov    %eax,%edx
  and    $0xffffffdf,%edx
  cmp    $0x45,%dl
  jne    L160
  movzbl 0x9(%rbx),%eax
  mov    %eax,%edx
  and    $0xffffffdf,%edx
  cmp    $0x52,%dl
  jne    L160
  lea    0xa(%rbx),%rsi
  mov    $0xffff,%eax
L833:
  mov    (%rsp),%rdi
  lea    0x1(%rsi),%r12
  mov    %eax,(%rdi)
  movsbl (%rsi),%eax
  cmp    $0x3c,%al
  je     L400
  lea    -0x30(%rax),%esi
  xor    %edx,%edx
  cmp    $0x9,%sil
  jbe    L704
  jmp    L734
  nopl   0x0(%rax)
L516:
  lea    -0x30(%rax),%esi
  cmp    $0x9,%sil
  ja     L734
L704:
  mov    %r12,%rsi
  lea    (%rdx,%rdx,4),%edx
  add    $0x1,%r12
  lea    -0x30(%rax,%rdx,2),%edx
  movsbl -0x1(%r12),%eax
  cmp    $0x3c,%al
  jne    L516
L899:
  mov    %r12,%rax
  lea    0x2(%rsi),%r12
L544:
  mov    (%rsp),%rdi
  mov    %edx,0x4(%rdi)
  movzbl (%rax),%ebx
  test   %bl,%bl
  je     L311
  lea    0x8(%rdi),%r13
  mov    $0x2,%ebp
  lea    0x10(%rsp),%r15
  movl   $0x1,0xc(%rsp)
  movabs $0x746c7561666564,%r14
  cs nopw 0x0(%rax,%rax,1)
L355:
  xor    %esi,%esi
  mov    $0x80,%edx
  mov    %r15,%rdi
  call   <memset@plt>
  cmp    $0x3e,%bl
  je     L691
  mov    $0x1,%eax
  lea    0xf(%rsp),%r8
  nopw   0x0(%rax,%rax,1)
L296:
  lea    -0x41(%rbx),%esi
  lea    0x20(%rbx),%edx
  cmp    $0x1a,%sil
  cmovb  %edx,%ebx
  add    $0x1,%r12
  movslq %eax,%rdx
  mov    %bl,(%r8,%rax,1)
  movzbl -0x1(%r12),%ebx
  add    $0x1,%rax
  cmp    $0x3e,%bl
  jne    L296
L686:
  movb   $0x0,0x10(%rsp,%rdx,1)
  cmp    %r14,(%r15)
  je     L547
  cmpl   $0x656e6f6e,(%r15)
  je     L454
L597:
  cmpl   $0x6c6c756e,(%r15)
  je     L743
  cmpw   $0x312d,(%r15)
  je     L284
L233:
  movsbl 0x10(%rsp),%eax
  mov    $0x1,%edx
  cmp    $0x2d,%al
  je     L554
L583:
  test   %al,%al
  je     L441
  lea    -0x30(%rax),%esi
  cmp    $0x9,%sil
  ja     L311
  add    %r15,%rdx
  xor    %esi,%esi
  jmp    L166
  nopl   0x0(%rax)
L178:
  lea    -0x30(%rax),%r8d
  add    $0x1,%rdx
  cmp    $0x9,%r8b
  ja     L311
L166:
  lea    (%rsi,%rsi,4),%esi
  lea    -0x30(%rax,%rsi,2),%esi
  movsbl (%rdx),%eax
  test   %al,%al
  jne    L178
  imul   0xc(%rsp),%esi
L449:
  mov    %esi,0x0(%r13)
  movzbl (%r12),%eax
  add    $0x1,%ebp
  cmp    $0x3c,%al
  je     L210
  nopl   0x0(%rax)
L366:
  test   %al,%al
  jne    L311
L111:
  cmp    $0x5,%ebp
  je     L51
  jg     L84
  cmp    $0x3,%ebp
  je     L15
  cmp    $0x4,%ebp
  jne    L311
L702:
  mov    (%rsp),%rax
  movl   $0xffffffff,0x10(%rax)
L51:
  mov    (%rsp),%rax
  movl   $0xffffffff,0x14(%rax)
  mov    $0x4,%eax
  jmp    L373
  nopw   0x0(%rax,%rax,1)
L800:
  movzbl (%rbx),%eax
L427:
  mov    %rbx,%rsi
L897:
  xor    %edx,%edx
  jmp    L508
  nopw   0x0(%rax,%rax,1)
L841:
  add    $0x1,%rdx
  cmp    $0x80,%rdx
  je     L608
  movzbl (%rsi,%rdx,1),%eax
L508:
  mov    %edx,%ecx
  test   %al,%al
  jne    L841
  test   $0x3,%dl
  je     L747
  and    $0xfffffffc,%ecx
L747:
  add    $0x4,%ecx
  sar    $0x2,%ecx
L1:
  mov    (%rsp),%rax
  mov    %ecx,(%rax)
  cmp    %rsi,%rbx
  je     L657
  movl   $0x0,0x4(%rax)
  mov    $0x2,%eax
  nopl   0x0(%rax)
L373:
  mov    0x98(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L191
  add    $0xa8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L169:
  mov    $0x7,%edx
  lea    D18(%rip),%rsi
  mov    %rbx,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  je     L514
  movsbl (%rbx),%eax
  cmp    $0x22,%al
  je     L496
  cmp    $0x30,%al
  je     L845
  lea    -0x30(%rax),%edx
  cmp    $0x9,%dl
  jbe    L430
  movzbl 0x1(%rbx),%edx
  lea    -0x30(%rdx),%ecx
  cmp    $0x9,%cl
  ja     L760
  cmp    $0x2d,%al
  je     L567
L760:
  test   %al,%al
  jne    L427
  mov    (%rsp),%rax
  movl   $0x1,(%rax)
  mov    $0x5,%eax
  jmp    L373
L514:
  movzbl 0x7(%rbx),%eax
  lea    0x7(%rbx),%rsi
  jmp    L897
  nopl   0x0(%rax)
L160:
  lea    -0x41(%rax),%edx
  cmp    $0x19,%dl
  jbe    L104
  lea    -0x61(%rax),%edx
  cmp    $0x19,%dl
  ja     L311
  sub    $0x60,%eax
  movsbl %al,%eax
  jmp    L833
L657:
  mov    (%rsp),%rax
  movl   $0x1,0x4(%rax)
  mov    $0x2,%eax
  jmp    L373
L496:
  lea    0x1(%rbx),%rdx
  xor    %eax,%eax
  jmp    L213
  nopl   0x0(%rax)
L584:
  add    $0x1,%rdx
  cmp    $0x80,%eax
  je     L692
L213:
  mov    %eax,%ecx
  add    $0x1,%eax
  cmpb   $0x22,(%rdx)
  jne    L584
  movb   $0x0,(%rdx)
  test   $0x3,%cl
  je     L650
  mov    %ecx,%eax
  and    $0xfffffffc,%eax
  add    $0x4,%eax
  sar    $0x2,%eax
L71:
  mov    (%rsp),%rdi
  mov    %eax,(%rdi)
  mov    $0x2,%eax
  movl   $0x5,0x4(%rdi)
  jmp    L373
L104:
  sub    $0x40,%eax
  movsbl %al,%eax
  jmp    L833
L650:
  lea    0x4(%rcx),%eax
  sar    $0x2,%eax
  jmp    L71
  cs nopw 0x0(%rax,%rax,1)
L454:
  cmpb   $0x0,0x4(%r15)
  jne    L597
  nopl   0x0(%rax,%rax,1)
L547:
  movl   $0xffffffff,0x0(%r13)
  movzbl (%r12),%eax
  add    $0x1,%ebp
  cmp    $0x3c,%al
  jne    L366
L210:
  movzbl 0x1(%r12),%ebx
  lea    0x2(%r12),%rax
  add    $0x4,%r13
  test   %bl,%bl
  je     L111
  mov    %rax,%r12
  jmp    L355
  nopw   0x0(%rax,%rax,1)
L691:
  xor    %edx,%edx
  jmp    L686
L845:
  movzbl 0x1(%rbx),%edx
  and    $0xffffffdf,%edx
  cmp    $0x58,%dl
  je     L519
L430:
  mov    $0x1,%esi
L218:
  xor    %edx,%edx
  jmp    L50
L862:
  lea    (%rdx,%rdx,4),%edx
  add    $0x1,%rbx
  lea    -0x30(%rax,%rdx,2),%edx
  movsbl (%rbx),%eax
  test   %al,%al
  je     L656
L50:
  lea    -0x30(%rax),%ecx
  cmp    $0x9,%cl
  jbe    L862
L311:
  mov    $0xffffffff,%eax
  jmp    L373
  nopl   0x0(%rax,%rax,1)
L743:
  cmpb   $0x0,0x4(%r15)
  je     L547
  cmpw   $0x312d,(%r15)
  jne    L233
L284:
  cmpb   $0x0,0x2(%r15)
  jne    L233
  jmp    L547
L734:
  test   %al,%al
  jne    L311
  lea    -0x1(%r12),%rax
  jmp    L544
L84:
  xor    %eax,%eax
  cmp    $0x6,%ebp
  sete   %al
  lea    -0x1(%rax,%rax,4),%eax
  jmp    L373
L519:
  movsbl 0x2(%rbx),%eax
  xor    %edx,%edx
  add    $0x3,%rbx
  test   %al,%al
  jne    L88
  jmp    L478
  cs nopw 0x0(%rax,%rax,1)
L14:
  shl    $0x4,%edx
  lea    -0x30(%rdx,%rax,1),%edx
L829:
  movsbl (%rbx),%eax
  add    $0x1,%rbx
  test   %al,%al
  je     L478
L88:
  lea    -0x30(%rax),%ecx
  cmp    $0x9,%cl
  jbe    L14
  lea    -0x41(%rax),%ecx
  cmp    $0x5,%cl
  ja     L817
  shl    $0x4,%edx
  add    $0x1,%rbx
  lea    -0x37(%rdx,%rax,1),%edx
  movsbl -0x1(%rbx),%eax
  test   %al,%al
  jne    L88
L478:
  mov    (%rsp),%rax
  mov    %edx,(%rax)
  mov    $0x1,%eax
  jmp    L373
  nopl   (%rax)
L817:
  lea    -0x61(%rax),%ecx
  cmp    $0x5,%cl
  ja     L311
  shl    $0x4,%edx
  lea    -0x57(%rdx,%rax,1),%edx
  jmp    L829
L656:
  mov    %esi,%eax
  mov    (%rsp),%rdi
  imul   %edx,%eax
  mov    %eax,(%rdi)
  mov    $0x1,%eax
  jmp    L373
L608:
  mov    $0x21,%ecx
  jmp    L1
L554:
  movl   $0xffffffff,0xc(%rsp)
  movsbl 0x11(%rsp),%eax
  mov    $0x2,%edx
  jmp    L583
L15:
  mov    (%rsp),%rax
  movl   $0xffffffff,0xc(%rax)
  jmp    L702
L692:
  movb   $0x0,0x81(%rbx)
  mov    $0x21,%eax
  jmp    L71
L400:
  xor    %edx,%edx
  jmp    L899
L567:
  add    $0x1,%rbx
  movsbl %dl,%eax
  mov    $0xffffffff,%esi
  jmp    L218
L441:
  xor    %esi,%esi
  jmp    L449
L191:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_label: D14
data_type: string
name: retrieve_data
arguments: data_label: D18
data_type: string

tool: D14: port:

tool: D18: string:

assistant: ```c
int _get_str2int(char *saddr, int value[]) {
  char *src;
  char off, ch;
  unsigned int tmp_value = 0;
  int data_count, i;
  char tmp_str[128];
  int sign = 1;
  data_count = 2;
  src = saddr;
  off = 0;
  if (!strncmp(src, "port:", 5)) {
    if ((src[5] == 'P') || (src[5] == 'p')) {
      off = 3;
      src += 6;
    }
  } else if (!strncmp(src, "string:", 7)) {
    off = 0;
    src += 7;
  } else if (src[0] == '"') {
    off = 5;
    src += 1;
  } else if ((src[0] == '0') && ((src[1] == 'x') || (src[1] == 'X'))) {
    src += 2;
    off = 2;
  } else if ((src[0] >= '0') && (src[0] <= '9')) {
    off = 1;
  } else if (((src[1] >= '0') && (src[1] <= '9')) && (src[0] == '-')) {
    src++;
    off = 1;
    sign = -1;
  } else if (src[0] == '\0') {
    src++;
    off = 4;
  }
  if (off == 0) {
    data_count = 0;
    while (src[data_count] != '\0') {
      data_count++;
      if (data_count > 127) {
        break;
      }
    }
    if (data_count & 0x03) {
      data_count = (data_count & (~0x03)) + 4;
    } else {
      data_count = data_count + 4;
    }
    value[0] = data_count >> 2;
    if (saddr != src) {
      value[1] = 0;
    } else {
      value[1] = 1;
    }
    return (2);
  } else if (off == 5) {
    data_count = 0;
    while (src[data_count] != '"') {
      data_count++;
      if (data_count > 127) {
        break;
      }
    }
    src[data_count] = '\0';
    if (data_count & 0x03) {
      data_count = (data_count & (~0x03)) + 4;
    } else {
      data_count = data_count + 4;
    }
    value[0] = data_count >> 2;
    value[1] = 5;
    return (2);
  } else if (off == 1) {
    while (*src != '\0') {
      if ((*src >= '0') && (*src <= '9')) {
        tmp_value = tmp_value * 10 + (*src - '0');
        src++;
      } else {
        return -1;
      }
    }
    value[0] = tmp_value * sign;
    return (1);
  } else if (off == 2) {
    while (*src != '\0') {
      if ((*src >= '0') && (*src <= '9')) {
        tmp_value = tmp_value * 16 + (*src - '0');
        src++;
      } else if ((*src >= 'A') && (*src <= 'F')) {
        tmp_value = tmp_value * 16 + (*src - 'A' + 10);
        src++;
      } else if ((*src >= 'a') && (*src <= 'f')) {
        tmp_value = tmp_value * 16 + (*src - 'a' + 10);
        src++;
      } else {
        return -1;
      }
    }
    value[0] = tmp_value;
    return (1);
  } else if (off == 3) {
    int tmp_flag = 0;
    ch = *src++;
    if ((ch == 'o') || (ch == 'O')) {
      ch = src[0];
      if ((ch == 'w') || (ch == 'W')) {
        ch = src[1];
        if ((ch == 'e') || (ch == 'E')) {
          ch = src[2];
          if ((ch == 'r') || (ch == 'R')) {
            value[0] = 0xffff;
            src += 3;
            tmp_flag = 1;
          }
        }
      }
    }
    if (!tmp_flag) {
      if ((ch >= 'A') && (ch <= 'Z')) {
        value[0] = ch - 'A' + 1;
      } else if ((ch >= 'a') && (ch <= 'z')) {
        value[0] = ch - 'a' + 1;
      } else {
        return -1;
      }
    }
    ch = *src++;
    tmp_value = 0;
    while (ch != '<') {
      if ((ch >= '0') && (ch <= '9')) {
        tmp_value = tmp_value * 10 + (ch - '0');
        ch = *src++;
      } else if (ch == 0) {
        src--;
        break;
      } else {
        return -1;
      }
    }
    value[1] = tmp_value;
    ch = *src++;
    while (ch != '\0') {
      i = 0;
      memset(tmp_str, 0, sizeof(tmp_str));
      while (ch != '>') {
        if ((ch >= 'A') && (ch <= 'Z')) {
          ch += 'a' - 'A';
        }
        tmp_str[i++] = ch;
        ch = *src++;
      }
      tmp_str[i] = '\0';
      if (!strcmp(tmp_str, "default")) {
        value[data_count] = -1;
      } else if (!strcmp(tmp_str, "none")) {
        value[data_count] = -1;
      } else if (!strcmp(tmp_str, "null")) {
        value[data_count] = -1;
      } else if (!strcmp(tmp_str, "-1")) {
        value[data_count] = -1;
      } else {
        i = 0;
        ch = tmp_str[i++];
        tmp_value = 0;
        if (ch == '-') {
          sign = -1;
          ch = tmp_str[i++];
        }
        while (ch != '\0') {
          if ((ch >= '0') && (ch <= '9')) {
            tmp_value = tmp_value * 10 + (ch - '0');
          } else {
            return -1;
          }
          ch = tmp_str[i++];
        }
        value[data_count] = tmp_value * sign;
      }
      data_count++;
      ch = *src++;
      if (ch == '<') {
        ch = *src++;
      } else if (ch == '\0') {
        ;
      } else {
        return -1;
      }
    }
    switch (data_count) {
    case 3:
      value[3] = -1;
    case 4:
      value[4] = -1;
    case 5:
      value[5] = -1;
    case 6:
      break;
    default:
      return -1;
    }
    return (4);
  } else if (off == 4) {
    value[0] = 4 >> 2;
    return (5);
  } else {
    return -1;
  }
}
```