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

```asm
<rdangle>:
  endbr64
  push   %r15
  mov    %rsi,%r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  movsbl (%rdi),%esi
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  test   %sil,%sil
  je     L73
  mov    %rdi,%rbx
  mov    %edx,%r13d
  lea    D10(%rip),%rbp
  mov    %rcx,%r12
  jmp    L94
  nopl   0x0(%rax,%rax,1)
L146:
  movsbl 0x1(%rbx),%esi
  add    $0x1,%rbx
  test   %sil,%sil
  je     L73
L94:
  mov    %rbp,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  jne    L146
  movzbl (%rbx),%eax
  test   %al,%al
  je     L73
  cmp    $0x68,%r13b
  jne    L141
  mov    $0x1,%r13d
  cmp    $0x2d,%al
  jne    L107
  add    $0x1,%rbx
  mov    $0xffffffff,%r13d
L107:
  lea    0xc(%rsp),%rcx
  lea    0x8(%rsp),%rdx
  mov    %rbx,%rdi
  xor    %eax,%eax
  lea    0x10(%rsp),%r8
  lea    D7(%rip),%rsi
  call   <sscanf@plt>
  movsd  0x10(%rsp),%xmm0
  pxor   %xmm2,%xmm2
  movsd  D15(%rip),%xmm1
  mov    %eax,%r14d
  mov    0xc(%rsp),%eax
  divsd  %xmm1,%xmm0
  cvtsi2sd %rax,%xmm2
  mov    0x8(%rsp),%eax
  addsd  %xmm2,%xmm0
  divsd  %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2sd %rax,%xmm1
  addsd  %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2sd %r13d,%xmm1
  xor    %r13d,%r13d
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,(%r12)
  lea    D37(%rip),%r12
  test   %r14d,%r14d
  jg     L130
  jmp    L1
  xchg   %ax,%ax
L76:
  mov    %rbp,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L121
  add    $0x1,%rbx
L130:
  movsbl (%rbx),%esi
  test   %sil,%sil
  jne    L76
L52:
  add    $0x1,%r13d
  cmp    %r13d,%r14d
  jne    L130
L1:
  xor    %r12d,%r12d
  cmp    $0x3,%r14d
  sete   %r12b
L217:
  mov    %rbx,(%r15)
L96:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L181
  add    $0x28,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L141:
  mov    %r12,%rdx
  lea    D20(%rip),%rsi
  mov    %rbx,%rdi
  xor    %eax,%eax
  call   <sscanf@plt>
  movsbl (%rbx),%esi
  lea    D37(%rip),%rbp
  mov    %eax,%r12d
  test   %sil,%sil
  jne    L207
  jmp    L217
  nopl   0x0(%rax,%rax,1)
L149:
  movsbl 0x1(%rbx),%esi
  add    $0x1,%rbx
  test   %sil,%sil
  je     L217
L207:
  mov    %rbp,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  jne    L149
  jmp    L217
  nopl   0x0(%rax)
L121:
  movsbl (%rbx),%esi
  test   %sil,%sil
  jne    L132
  jmp    L52
  nopl   (%rax)
L124:
  movsbl 0x1(%rbx),%esi
  add    $0x1,%rbx
  test   %sil,%sil
  je     L52
L132:
  mov    %r12,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  jne    L124
  add    $0x1,%r13d
  cmp    %r13d,%r14d
  jne    L130
  jmp    L1
L73:
  xor    %r12d,%r12d
  jmp    L96
L181:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_tag: D10
data_type: string
name: read_data
arguments: data_tag: D7
data_type: string
name: read_data
arguments: data_tag: D15
data_type: f64
name: read_data
arguments: data_tag: D37
data_type: string
name: read_data
arguments: data_tag: D20
data_type: string

tool: D10:  	


tool: D7: %d %d %lf

tool: D15: 60

tool: D37: +-.0123456789eE

tool: D20: %lf

assistant: ```c
int rdangle(char *word, char **next, char unit, double *angle) {
  const char *blank = " \t\n";
  const char *number = "+-.0123456789eE";
  int i, ird, sgn;
  unsigned int deg, min;
  double sec;
  char *ch;
  ch = word;
  while (*ch && strchr(blank, *ch))
    ch++;
  if (!*ch)
    return (0);
  if (unit == 'h') {
    sgn = 1;
    if (*ch == '-') {
      sgn = -1;
      ch++;
    }
    ird = sscanf(ch, "%d %d %lf", &deg, &min, &sec);
    *angle = sgn * ((sec / 60. + min) / 60. + deg);
    for (i = 0; i < ird; i++) {
      while (*ch && strchr(blank, *ch))
        ch++;
      while (*ch && strchr(number, *ch))
        ch++;
    }
    if (ird == 3) {
      ird = 1;
    } else {
      ird = 0;
    }
  } else {
    ird = sscanf(ch, "%lf", angle);
    while (*ch && strchr(number, *ch))
      ch++;
  }
  *next = ch;
  return (ird);
}
```