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

```asm
<one_sensor_read>:
  endbr64
  push   %r15
  mov    %rdi,%rdx
  mov    %rsi,%r15
  lea    D31(%rip),%rsi
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0xb8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0xa8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%r12
  mov    %r12,%rdi
  call   <sprintf@plt>
  mov    %r12,%rdi
  call   <strlen@plt>
  mov    %r12,%rdi
  mov    %eax,%esi
  call   <send_msg@plt>
  test   %rax,%rax
  je     L63
  lea    0x50(%rsp),%rbx
  mov    $0x50,%edx
  xor    %esi,%esi
  mov    %rbx,%rdi
  lea    D23(%rip),%r13
  lea    D13(%rip),%r14
  call   <memset@plt>
  nopl   0x0(%rax)
L46:
  mov    $0x50,%esi
  mov    %rbx,%rdi
  call   <recv_msg@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L51
  mov    %r12,%rdi
  call   <strlen@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  lea    -0x1(%rax),%edx
  call   <strncmp@plt>
  test   %rax,%rax
  je     L77
  cmpb   $0x57,0x0(%rbp)
  jne    L37
  lea    0x2(%rbp),%rsi
  mov    %r14,%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L46
L51:
  mov    %r13,%rdi
  call   <puts@plt>
  jmp    L46
L63:
  lea    D20(%rip),%rdi
  call   <puts@plt>
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <one_sensor_read>
L78:
  mov    0xa8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L81
  add    $0xb8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L77:
  mov    %r12,%rdi
  call   <strlen@plt>
  cltq
  lea    0x0(%rbp,%rax,1),%rdi
  call   <atoi@plt>
  mov    %eax,(%r15)
  xor    %eax,%eax
  call   <check_errors@plt>
  xor    %eax,%eax
  jmp    L78
L37:
  mov    %rbp,%rsi
  lea    D15(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  xor    %eax,%eax
  call   <clear_input_stream@plt>
  mov    $0xffffffff,%eax
  jmp    L78
L81:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: tag: D31
data_type: string
name: extract_symbolic_data
arguments: tag: D23
data_type: string
name: extract_symbolic_data
arguments: tag: D13
data_type: string
name: extract_symbolic_data
arguments: tag: D20
data_type: string
name: extract_symbolic_data
arguments: tag: D15
data_type: string

tool: D31: S %s


tool: D23: one sensors read failed - retrying

tool: D13: Warning: %s

tool: D20: send failed!!!

tool: D15: got an error >>%s<<


assistant: ```c
int one_sensor_read(char *sensorname, int *value) {
  char sendbuf[80];
  char recvbuf[80];
  const char *arg;
  const char *reply_msg;
  sprintf(sendbuf, "S %s\n", sensorname);
  if (send_msg(sendbuf, strlen(sendbuf))) {
    memset(recvbuf, 0, 80);
    while (1) {
      reply_msg = 0;
      while (reply_msg == 0) {
        reply_msg = recv_msg(recvbuf, 80);
        if (reply_msg == 0) {
          printf("one sensors read failed - retrying\n");
        }
      }
      if (strncmp(reply_msg, sendbuf, strlen(sendbuf) - 1) == 0) {
        arg = reply_msg + strlen(sendbuf);
        *value = atoi(arg);
        check_errors();
        return 0;
      } else if (reply_msg[0] == 'W') {
        printf("Warning: %s", reply_msg + 2);
      } else {
        printf("got an error >>%s<<\n", reply_msg);
        clear_input_stream();
        return -1;
      }
    }
  } else {
    printf("send failed!!!\n");
    return one_sensor_read(sensorname, value);
  }
}
```