user: Converte this assembly snippet into its equivalent C code:

```asm
<sscanf_lat_lon>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %rsi,%rbx
  lea    D22(%rip),%rsi
  sub    $0x48,%rsp
  mov    %rdx,0x8(%rsp)
  lea    0x36(%rsp),%r12
  lea    0x18(%rsp),%r14
  lea    0x34(%rsp),%r15
  lea    0x20(%rsp),%rcx
  mov    %r14,%r9
  lea    0x10(%rsp),%r13
  mov    %r15,%r8
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  push   %r12
  mov    %r13,%rdx
  lea    0x30(%rsp),%rax
  push   %rax
  xor    %eax,%eax
  call   <sscanf@plt>
  pop    %rdx
  pop    %rcx
  cmp    $0x6,%eax
  jne    L151
  movsd  D40(%rip),%xmm1
  movsd  0x20(%rsp),%xmm0
  movzbl 0x34(%rsp),%eax
  divsd  %xmm1,%xmm0
  and    $0xffffffdf,%eax
  addsd  0x10(%rsp),%xmm0
  movsd  %xmm0,(%rbx)
  cmp    $0x53,%al
  jne    L142
  xorpd  D67(%rip),%xmm0
  movsd  %xmm0,(%rbx)
L167:
  movsd  0x28(%rsp),%xmm0
  mov    0x8(%rsp),%rax
  divsd  %xmm1,%xmm0
  addsd  0x18(%rsp),%xmm0
  movsd  %xmm0,(%rax)
  movzbl 0x36(%rsp),%eax
  and    $0xffffffdf,%eax
  cmp    $0x57,%al
  je     L91
  cmp    $0x45,%al
  sete   %al
  movzbl %al,%eax
  add    %eax,%eax
L12:
  mov    0x38(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L104
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L142:
  cmp    $0x4e,%al
  je     L167
L13:
  xor    %eax,%eax
  jmp    L12
  nopl   0x0(%rax,%rax,1)
L151:
  xor    %eax,%eax
  mov    %r12,%r9
  mov    %r14,%r8
  mov    %r15,%rcx
  mov    %r13,%rdx
  lea    D60(%rip),%rsi
  mov    %rbp,%rdi
  call   <sscanf@plt>
  cmp    $0x4,%eax
  jne    L89
  movzbl 0x34(%rsp),%eax
  movsd  0x10(%rsp),%xmm0
  and    $0xffffffdf,%eax
  movsd  %xmm0,(%rbx)
  cmp    $0x53,%al
  je     L82
  cmp    $0x4e,%al
  jne    L13
L62:
  mov    0x8(%rsp),%rax
  movsd  0x18(%rsp),%xmm0
  movsd  %xmm0,(%rax)
  movzbl 0x36(%rsp),%eax
  and    $0xffffffdf,%eax
  cmp    $0x57,%al
  je     L51
  cmp    $0x45,%al
  jne    L13
L162:
  mov    0x8(%rsp),%rax
  movsd  %xmm0,(%rax)
  mov    $0x2,%eax
  jmp    L12
  cs nopw 0x0(%rax,%rax,1)
L89:
  xor    %eax,%eax
  mov    %r14,%rcx
  mov    %r13,%rdx
  mov    %rbp,%rdi
  lea    D95(%rip),%rsi
  call   <sscanf@plt>
  cmp    $0x2,%eax
  je     L72
  mov    %r13,%rdx
  lea    D72(%rip),%rsi
  mov    %rbp,%rdi
  call   <lat_lon_decode@plt>
  test   %rax,%rax
  je     L13
  mov    %r14,%rdx
  lea    D27(%rip),%rsi
  mov    %rbp,%rdi
  call   <lat_lon_decode@plt>
  test   %rax,%rax
  je     L13
  movsd  0x10(%rsp),%xmm0
  movsd  %xmm0,(%rbx)
  movsd  0x18(%rsp),%xmm0
  jmp    L162
  nopw   0x0(%rax,%rax,1)
L82:
  xorpd  D67(%rip),%xmm0
  movsd  %xmm0,(%rbx)
  jmp    L62
  nopl   0x0(%rax)
L72:
  movsd  0x10(%rsp),%xmm0
  movsd  %xmm0,(%rbx)
  movsd  0x18(%rsp),%xmm0
  mov    0x8(%rsp),%rbx
  movsd  %xmm0,(%rbx)
  jmp    L12
  cs nopw 0x0(%rax,%rax,1)
L91:
  mov    0x8(%rsp),%rax
  xorpd  D67(%rip),%xmm0
  movsd  %xmm0,(%rax)
  mov    $0x2,%eax
  jmp    L12
  nopl   0x0(%rax,%rax,1)
L51:
  xorpd  D67(%rip),%xmm0
  jmp    L162
L104:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: tag: D22
datatype: string
name: retrieve_data
arguments: tag: D40
datatype: f64
name: retrieve_data
arguments: tag: D67
datatype: byte[16]
name: retrieve_data
arguments: tag: D60
datatype: string
name: retrieve_data
arguments: tag: D95
datatype: string
name: retrieve_data
arguments: tag: D72
datatype: string
name: retrieve_data
arguments: tag: D27
datatype: string

tool: D22: %lf %lf %s %lf %lf %s

tool: D40: 60

tool: {"D67": [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]}

tool: D60: %lf %s %lf %s

tool: D95: %lf %lf

tool: D72: NSns

tool: D27: EWew

assistant: ```c
int sscanf_lat_lon(char *readln, double *lat, double *lon) {
  double dlat, dlon, mlat, mlon;
  char ns[2], ew[2];
  if (sscanf(readln, "%lf %lf %s %lf %lf %s", &dlat, &mlat, ns, &dlon, &mlon, ew) == 6) {
    *lat = (dlat + mlat / 60.);
    if (*ns == 's' || *ns == 'S')
      *lat = -*lat;
    else if (*ns != 'n' && *ns != 'N')
      return 0;
    *lon = (dlon + mlon / 60.);
    if (*ew == 'w' || *ew == 'W')
      *lon = -*lon;
    else if (*ew != 'e' && *ew != 'E')
      return 0;
    return 2;
  } else if (sscanf(readln, "%lf %s %lf %s", &dlat, ns, &dlon, ew) == 4) {
    *lat = dlat;
    if (*ns == 's' || *ns == 'S')
      *lat = -*lat;
    else if (*ns != 'n' && *ns != 'N')
      return 0;
    *lon = dlon;
    if (*ew == 'w' || *ew == 'W')
      *lon = -*lon;
    else if (*ew != 'e' && *ew != 'E')
      return 0;
    *lon = dlon * (*ew == 'e' || *ew == 'E' ? 1 : -1);
    return 2;
  } else if (sscanf(readln, "%lf %lf", &dlat, &dlon) == 2) {
    *lat = dlat;
    *lon = dlon;
    return 2;
  } else if (lat_lon_decode(readln, "NSns", &dlat) && lat_lon_decode(readln, "EWew", &dlon)) {
    *lat = dlat;
    *lon = dlon;
    return 2;
  } else
    return 0;
}
```