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

```asm
<deg2str>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x90,%rsp
  mov    %rdi,-0x78(%rbp)
  mov    %esi,-0x7c(%rbp)
  movsd  %xmm0,-0x88(%rbp)
  mov    %edx,-0x80(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movsd  -0x88(%rbp),%xmm0
  movsd  %xmm0,-0x68(%rbp)
  pxor   %xmm0,%xmm0
  comisd -0x68(%rbp),%xmm0
  jbe    L24
  movsd  -0x68(%rbp),%xmm0
  movq   D25(%rip),%xmm1
  xorpd  %xmm1,%xmm0
  movsd  %xmm0,-0x68(%rbp)
  movsd  D59(%rip),%xmm0
  movsd  %xmm0,-0x60(%rbp)
  jmp    L15
L24:
  movsd  D21(%rip),%xmm0
  movsd  %xmm0,-0x60(%rbp)
L15:
  movsd  D70(%rip),%xmm0
  mov    -0x68(%rbp),%rax
  movapd %xmm0,%xmm1
  movq   %rax,%xmm0
  call   <fmod@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x68(%rbp)
  movsd  -0x68(%rbp),%xmm0
  mulsd  -0x60(%rbp),%xmm0
  movsd  %xmm0,-0x68(%rbp)
  movsd  D17(%rip),%xmm0
  comisd -0x68(%rbp),%xmm0
  jb     L5
  movsd  -0x68(%rbp),%xmm1
  movsd  D70(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x68(%rbp)
L5:
  mov    -0x80(%rbp),%eax
  add    $0x4,%eax
  mov    %eax,-0x70(%rbp)
  cmpl   $0x0,-0x80(%rbp)
  jle    L44
  mov    -0x80(%rbp),%ecx
  mov    -0x70(%rbp),%edx
  lea    -0x58(%rbp),%rax
  lea    D12(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  movsd  -0x68(%rbp),%xmm0
  cvttsd2si %xmm0,%edx
  lea    -0x58(%rbp),%rcx
  lea    -0x50(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  jmp    L71
L44:
  mov    -0x70(%rbp),%edx
  lea    -0x58(%rbp),%rax
  lea    D42(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  movsd  -0x68(%rbp),%xmm0
  cvttsd2si %xmm0,%edx
  lea    -0x58(%rbp),%rcx
  lea    -0x50(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
L71:
  lea    -0x50(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x6c(%rbp)
  mov    -0x7c(%rbp),%eax
  sub    $0x1,%eax
  cmp    %eax,-0x6c(%rbp)
  jge    L54
  lea    -0x50(%rbp),%rdx
  mov    -0x78(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  jmp    L74
L54:
  mov    -0x7c(%rbp),%eax
  lea    -0x1(%rax),%edx
  lea    -0x50(%rbp),%rcx
  mov    -0x78(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  mov    -0x7c(%rbp),%eax
  cltq
  lea    -0x1(%rax),%rdx
  mov    -0x78(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  nop
L74:
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L62
  call   <__stack_chk_fail@plt>
L62:
  leave
  ret
```

tool_calls: name: unpack_data
arguments: label: D25
type_infered: f32[2]
name: unpack_data
arguments: label: D59
type_infered: f32[2]
name: unpack_data
arguments: label: D21
type_infered: f64
name: unpack_data
arguments: label: D70
type_infered: f64
name: unpack_data
arguments: label: D17
type_infered: f32[2]
name: unpack_data
arguments: label: D12
type_infered: string
name: unpack_data
arguments: label: D42
type_infered: string

tool: {"D25": [0.0,-0.0]}

tool: {"D59": [0.0,-1.875]}

tool: D21: 1

tool: D70: 360

tool: {"D17": [0.0,-3.6015625]}

tool: D12: %%%d.%df

tool: D42: %%%4d

assistant: ```c
void deg2str(char *string, int lstr, double deg, int ndec) {
  char degform[8];
  int field, ltstr;
  char tstring[64];
  double deg1;
  double dsgn;
  deg1 = deg;
  if (deg1 < 0.0) {
    deg1 = -deg1;
    dsgn = -1.0;
  } else {
    dsgn = 1.0;
  }
  deg1 = fmod(deg1, 360.0);
  deg1 *= dsgn;
  if (deg1 <= -180.0) {
    deg1 = deg1 + 360.0;
  }
  field = ndec + 4;
  if (ndec > 0) {
    sprintf(degform, "%%%d.%df", field, ndec);
    sprintf(tstring, degform, deg1);
  } else {
    sprintf(degform, "%%%4d", field);
    sprintf(tstring, degform, (int)deg1);
  }
  ltstr = (int)strlen(tstring);
  if (ltstr < lstr - 1) {
    strcpy(string, tstring);
  } else {
    strncpy(string, tstring, lstr - 1);
    string[lstr - 1] = 0;
  }
  return;
}
```