user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<_to_octal>:
  endbr64
  test   %ecx,%ecx
  mov    %esi,%eax
  mov    %edx,%esi
  mov    %ecx,%edx
  mov    $0x1,%ecx
  movb   $0x0,(%rdi)
  cmovs  %ecx,%edx
  mov    %eax,%ecx
  shr    $0x1e,%ecx
  setne  %r8b
  cmp    $0xa,%edx
  jg     L400
  test   %r8b,%r8b
  jne    L400
  mov    %eax,%ecx
  sar    $0x1b,%ecx
  and    $0x7,%ecx
  setne  %r8b
  cmp    $0x9,%edx
  jg     L268
  test   %r8b,%r8b
  jne    L268
  mov    %eax,%ecx
  sar    $0x18,%ecx
  and    $0x7,%ecx
  setne  %r8b
  cmp    $0x8,%edx
  jg     L74
  test   %r8b,%r8b
  jne    L74
  mov    %eax,%ecx
  sar    $0x15,%ecx
  and    $0x7,%ecx
  setne  %r8b
  cmp    $0x7,%edx
  jg     L194
  test   %r8b,%r8b
  jne    L194
  mov    %eax,%ecx
  sar    $0x12,%ecx
  and    $0x7,%ecx
  setne  %r8b
  cmp    $0x6,%edx
  jg     L454
  test   %r8b,%r8b
  jne    L454
  mov    %eax,%ecx
  sar    $0xf,%ecx
  and    $0x7,%ecx
  setne  %r8b
  cmp    $0x5,%edx
  jg     L124
  test   %r8b,%r8b
  jne    L124
  mov    %eax,%ecx
  sar    $0xc,%ecx
  and    $0x7,%ecx
  setne  %r8b
  cmp    $0x4,%edx
  jg     L28
  test   %r8b,%r8b
  jne    L28
  mov    %eax,%ecx
  sar    $0x9,%ecx
  and    $0x7,%ecx
  setne  %r8b
  cmp    $0x3,%edx
  jg     L182
  test   %r8b,%r8b
  jne    L182
  mov    %eax,%ecx
  sar    $0x6,%ecx
  and    $0x7,%ecx
  setne  %r8b
  cmp    $0x2,%edx
  jg     L419
  test   %r8b,%r8b
  jne    L419
  mov    %eax,%ecx
  sar    $0x3,%ecx
  and    $0x7,%ecx
  setne  %r8b
  cmp    $0x1,%edx
  jg     L605
  test   %r8b,%r8b
  jne    L605
  and    $0x7,%eax
  setne  %cl
  test   %edx,%edx
  jg     L204
  test   %cl,%cl
  jne    L204
  mov    %rdi,%rcx
  mov    %ecx,%eax
  movb   $0x0,(%rcx)
  sub    %edi,%eax
  ret
  nopl   0x0(%rax)
L400:
  test   %esi,%esi
  je     L290
  test   %r8b,%r8b
  je     L290
  movb   $0x30,(%rdi)
  lea    0x1(%rdi),%rdx
L599:
  add    $0x30,%ecx
  lea    0x1(%rdx),%rsi
  mov    %cl,(%rdx)
  mov    %eax,%ecx
  sar    $0x1b,%ecx
  and    $0x7,%ecx
L187:
  add    $0x30,%ecx
  lea    0x1(%rsi),%rdx
  mov    %cl,(%rsi)
  mov    %eax,%ecx
  sar    $0x18,%ecx
  and    $0x7,%ecx
L10:
  add    $0x30,%ecx
  lea    0x1(%rdx),%rsi
  mov    %cl,(%rdx)
  mov    %eax,%ecx
  sar    $0x15,%ecx
  and    $0x7,%ecx
L208:
  add    $0x30,%ecx
  lea    0x1(%rsi),%rdx
  mov    %cl,(%rsi)
  mov    %eax,%ecx
  sar    $0x12,%ecx
  and    $0x7,%ecx
L230:
  add    $0x30,%ecx
  lea    0x1(%rdx),%rsi
  mov    %cl,(%rdx)
  mov    %eax,%ecx
  sar    $0xf,%ecx
  and    $0x7,%ecx
L269:
  add    $0x30,%ecx
  lea    0x1(%rsi),%rdx
  mov    %cl,(%rsi)
  mov    %eax,%ecx
  sar    $0xc,%ecx
  and    $0x7,%ecx
L291:
  add    $0x30,%ecx
  lea    0x1(%rdx),%rsi
  mov    %cl,(%rdx)
  mov    %eax,%ecx
  sar    $0x9,%ecx
  and    $0x7,%ecx
L547:
  add    $0x30,%ecx
  lea    0x1(%rsi),%rdx
  mov    %cl,(%rsi)
  mov    %eax,%ecx
  sar    $0x6,%ecx
  and    $0x7,%ecx
L555:
  add    $0x30,%ecx
  lea    0x1(%rdx),%rsi
  mov    %cl,(%rdx)
  mov    %eax,%ecx
  sar    $0x3,%ecx
  and    $0x7,%ecx
L212:
  add    $0x30,%ecx
  lea    0x1(%rsi),%r8
  and    $0x7,%eax
  mov    %cl,(%rsi)
L66:
  lea    0x1(%r8),%rcx
  lea    0x30(%rax),%edx
  mov    %ecx,%eax
  mov    %dl,(%r8)
  sub    %edi,%eax
  movb   $0x0,(%rcx)
  ret
  nopw   0x0(%rax,%rax,1)
L290:
  mov    %rdi,%rdx
  jmp    L599
L268:
  test   %esi,%esi
  je     L29
  test   %r8b,%r8b
  je     L29
  movb   $0x30,(%rdi)
  lea    0x1(%rdi),%rsi
  jmp    L187
L74:
  test   %esi,%esi
  je     L510
  test   %r8b,%r8b
  je     L510
  movb   $0x30,(%rdi)
  lea    0x1(%rdi),%rdx
  jmp    L10
L194:
  test   %esi,%esi
  je     L348
  test   %r8b,%r8b
  je     L348
  movb   $0x30,(%rdi)
  lea    0x1(%rdi),%rsi
  jmp    L208
L454:
  test   %esi,%esi
  je     L347
  test   %r8b,%r8b
  je     L347
  movb   $0x30,(%rdi)
  lea    0x1(%rdi),%rdx
  jmp    L230
L124:
  test   %esi,%esi
  je     L381
  test   %r8b,%r8b
  je     L381
  movb   $0x30,(%rdi)
  lea    0x1(%rdi),%rsi
  jmp    L269
L28:
  test   %esi,%esi
  je     L236
  test   %r8b,%r8b
  je     L236
  movb   $0x30,(%rdi)
  lea    0x1(%rdi),%rdx
  jmp    L291
L182:
  test   %esi,%esi
  je     L401
  test   %r8b,%r8b
  je     L401
  movb   $0x30,(%rdi)
  lea    0x1(%rdi),%rsi
  jmp    L547
L419:
  test   %esi,%esi
  je     L451
  test   %r8b,%r8b
  je     L451
  movb   $0x30,(%rdi)
  lea    0x1(%rdi),%rdx
  jmp    L555
L605:
  test   %esi,%esi
  je     L133
  test   %r8b,%r8b
  je     L133
  movb   $0x30,(%rdi)
  lea    0x1(%rdi),%rsi
  jmp    L212
L204:
  test   %esi,%esi
  je     L337
  test   %cl,%cl
  je     L337
  movb   $0x30,(%rdi)
  lea    0x1(%rdi),%r8
  jmp    L66
L348:
  mov    %rdi,%rsi
  jmp    L208
L29:
  mov    %rdi,%rsi
  jmp    L187
L510:
  mov    %rdi,%rdx
  jmp    L10
L337:
  mov    %rdi,%r8
  jmp    L66
L133:
  mov    %rdi,%rsi
  jmp    L212
L451:
  mov    %rdi,%rdx
  jmp    L555
L401:
  mov    %rdi,%rsi
  jmp    L547
L236:
  mov    %rdi,%rdx
  jmp    L291
L381:
  mov    %rdi,%rsi
  jmp    L269
L347:
  mov    %rdi,%rdx
  jmp    L230
```

assistant: ```c
int _to_octal(char *buf, uint32_t value, int alt_form, int precision) {
  register int i;
  register int temp;
  char *start = buf;
  if (precision < 0)
    precision = 1;
  *buf = '\0';
  for (i = 10; i >= 0; i--) {
    temp = (value >> (i * 3));
    if (i == 10)
      temp &= 0x3;
    else
      temp &= 0x7;
    if ((precision > i) || (temp != 0)) {
      precision = i;
      if ((temp != 0) && alt_form)
        *buf++ = '0';
      alt_form = false;
      *buf++ = (char)(temp + '0');
    }
  }
  *buf = 0;
  return buf - start;
}
```