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

```asm
<iw_print_retry_value>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  cmp    $0x13,%esi
  jle    L58
  mov    %edx,%r12d
  mov    %ecx,%ebx
  lea    -0x14(%rsi),%r13d
  mov    %r8d,%r14d
  test   $0x1,%cl
  jne    L45
L101:
  test   $0x2,%bl
  jne    L27
L67:
  test   $0x10,%bl
  jne    L114
L15:
  test   $0x20,%bl
  jne    L80
L48:
  test   $0x20,%bh
  jne    L110
  mov    %r12d,%ecx
  lea    D132(%rip),%rdx
  mov    %r13d,%esi
  mov    %rbp,%rdi
L91:
  pop    %rbx
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  jmp    1070 <snprintf@plt>
  nopl   0x0(%rax)
L110:
  mov    %rbp,%rdi
  lea    D105(%rip),%rsi
  call   <strcpy@plt>
  and    $0x4,%ebx
  lea    0xa(%rbp),%rdi
  jne    L32
  cmp    $0xf423f,%r12d
  jg     L13
  cmp    $0x3e7,%r12d
  jle    L33
  pxor   %xmm0,%xmm0
  lea    D74(%rip),%rdx
  cvtsi2sd %r12d,%xmm0
  divsd  D71(%rip),%xmm0
L134:
  pop    %rbx
  mov    %r13d,%esi
  pop    %rbp
  mov    $0x1,%eax
  pop    %r12
  pop    %r13
  pop    %r14
  jmp    1070 <snprintf@plt>
  nopl   0x0(%rax,%rax,1)
L80:
  mov    %rbp,%rdi
  lea    D52(%rip),%rsi
  add    $0x6,%rbp
  call   <strcpy@plt>
  jmp    L48
L114:
  mov    %rbp,%rdi
  lea    D53(%rip),%rsi
  add    $0x6,%rbp
  call   <strcpy@plt>
  jmp    L15
  nopl   0x0(%rax,%rax,1)
L27:
  mov    %rbp,%rdi
  lea    D84(%rip),%rsi
  add    $0x4,%rbp
  call   <strcpy@plt>
  jmp    L67
  nopl   0x0(%rax,%rax,1)
L45:
  lea    D139(%rip),%rsi
  add    $0x4,%rbp
  call   <strcpy@plt>
  jmp    L101
  nopl   (%rax)
L58:
  pop    %rbx
  lea    D75(%rip),%rdx
  pop    %rbp
  xor    %eax,%eax
  pop    %r12
  pop    %r13
  pop    %r14
  jmp    1070 <snprintf@plt>
  xchg   %ax,%ax
L32:
  cmp    $0x14,%r14d
  jg     L109
  pxor   %xmm0,%xmm0
  cvtsi2sd %r12d,%xmm0
  divsd  D14(%rip),%xmm0
  cvttsd2si %xmm0,%r12d
L109:
  pop    %rbx
  mov    %r12d,%ecx
  pop    %rbp
  mov    %r13d,%esi
  pop    %r12
  lea    D96(%rip),%rdx
  pop    %r13
  xor    %eax,%eax
  pop    %r14
  jmp    1070 <snprintf@plt>
  nopl   0x0(%rax,%rax,1)
L33:
  mov    %r12d,%ecx
  lea    D15(%rip),%rdx
  mov    %r13d,%esi
  jmp    L91
  nopw   0x0(%rax,%rax,1)
L13:
  pxor   %xmm0,%xmm0
  lea    D101(%rip),%rdx
  cvtsi2sd %r12d,%xmm0
  divsd  D14(%rip),%xmm0
  jmp    L134
```

tool_calls: name: unpack_data
arguments: data_tag: D132
type_guessed: string
name: unpack_data
arguments: data_tag: D105
type_guessed: string
name: unpack_data
arguments: data_tag: D74
type_guessed: string
name: unpack_data
arguments: data_tag: D71
type_guessed: f64
name: unpack_data
arguments: data_tag: D52
type_guessed: string
name: unpack_data
arguments: data_tag: D53
type_guessed: string
name: unpack_data
arguments: data_tag: D84
type_guessed: string
name: unpack_data
arguments: data_tag: D139
type_guessed: string
name: unpack_data
arguments: data_tag: D75
type_guessed: string
name: unpack_data
arguments: data_tag: D14
type_guessed: f64
name: unpack_data
arguments: data_tag: D96
type_guessed: string
name: unpack_data
arguments: data_tag: D15
type_guessed: string
name: unpack_data
arguments: data_tag: D101
type_guessed: string

tool: D132:  limit:%d

tool: D105:  lifetime:

tool: D74: %gms

tool: D71: 1000

tool: D52:   long

tool: D53:  short

tool: D84:  max

tool: D139:  min

tool: D75: <too big>

tool: D14: 1000000

tool: D96: %d

tool: D15: %dus

tool: D101: %gs

assistant: ```c
void iw_print_retry_value(char *buffer, int buflen, int value, int flags, int we_version) {
  if (buflen < 20) {
    snprintf(buffer, buflen, "<too big>");
    return;
  }
  buflen -= 20;
  if (flags & 0x0001) {
    strcpy(buffer, " min");
    buffer += 4;
  }
  if (flags & 0x0002) {
    strcpy(buffer, " max");
    buffer += 4;
  }
  if (flags & 0x0010) {
    strcpy(buffer, " short");
    buffer += 6;
  }
  if (flags & 0x0020) {
    strcpy(buffer, "  long");
    buffer += 6;
  }
  if (flags & 0x2000) {
    strcpy(buffer, " lifetime:");
    buffer += 10;
    if (flags & 0x0004) {
      if (we_version < 21)
        value /= 1e6;
      snprintf(buffer, buflen, "%d", value);
    } else {
      if (value >= (int)1e6)
        snprintf(buffer, buflen, "%gs", ((double)value) / 1e6);
      else if (value >= (int)1e3)
        snprintf(buffer, buflen, "%gms", ((double)value) / 1e3);
      else
        snprintf(buffer, buflen, "%dus", value);
    }
  } else
    snprintf(buffer, buflen, " limit:%d", value);
}
```