user: 请从给定的汇编指令推导出C源代码:

```asm
<bcd2_div>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  movq   $0x0,-0x30(%rbp)
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x20(%rbp)
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x40(%rbp),%rax
  movq   $0x0,(%rax)
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x38(%rbp),%rax
  mov    %rdx,(%rax)
  movq   $0xd,-0x28(%rbp)
  jmp    L16
L23:
  cmpq   $0x6,-0x28(%rbp)
  jle    L37
  mov    -0x28(%rbp),%rax
  sub    $0x7,%rax
  shl    $0x2,%eax
  mov    $0xf,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  cltq
  and    -0x18(%rbp),%rax
  mov    %rax,%rdx
  mov    -0x28(%rbp),%rax
  sub    $0x7,%rax
  shl    $0x2,%eax
  mov    %eax,%ecx
  sar    %cl,%rdx
  mov    %rdx,%rax
  jmp    L6
L37:
  mov    -0x28(%rbp),%rax
  shl    $0x2,%eax
  mov    $0xf,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  cltq
  and    -0x20(%rbp),%rax
  mov    %rax,%rdx
  mov    -0x28(%rbp),%rax
  shl    $0x2,%eax
  mov    %eax,%ecx
  sar    %cl,%rdx
  mov    %rdx,%rax
L6:
  mov    %rax,-0x10(%rbp)
  mov    -0x30(%rbp),%rdx
  mov    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  add    %rax,%rax
  add    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  cqto
  idivq  -0x48(%rbp)
  mov    %rax,-0x8(%rbp)
  mov    -0x10(%rbp),%rax
  cqto
  idivq  -0x48(%rbp)
  mov    %rdx,-0x30(%rbp)
  cmpq   $0x6,-0x28(%rbp)
  jle    L13
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x28(%rbp),%rax
  sub    $0x7,%rax
  shl    $0x2,%eax
  mov    $0xf,%esi
  mov    %eax,%ecx
  shl    %cl,%esi
  mov    %esi,%eax
  xor    $0xfffffff,%eax
  cltq
  and    %rax,%rdx
  mov    -0x40(%rbp),%rax
  mov    %rdx,(%rax)
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rsi
  mov    -0x28(%rbp),%rax
  sub    $0x7,%rax
  shl    $0x2,%eax
  mov    -0x8(%rbp),%rdx
  mov    %eax,%ecx
  shl    %cl,%rdx
  mov    %rdx,%rax
  or     %rax,%rsi
  mov    %rsi,%rdx
  mov    -0x40(%rbp),%rax
  mov    %rdx,(%rax)
  jmp    L35
L13:
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x28(%rbp),%rax
  shl    $0x2,%eax
  mov    $0xf,%esi
  mov    %eax,%ecx
  shl    %cl,%esi
  mov    %esi,%eax
  xor    $0xfffffff,%eax
  cltq
  and    %rax,%rdx
  mov    -0x38(%rbp),%rax
  mov    %rdx,(%rax)
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rsi
  mov    -0x28(%rbp),%rax
  shl    $0x2,%eax
  mov    -0x8(%rbp),%rdx
  mov    %eax,%ecx
  shl    %cl,%rdx
  mov    %rdx,%rax
  or     %rax,%rsi
  mov    %rsi,%rdx
  mov    -0x38(%rbp),%rax
  mov    %rdx,(%rax)
L35:
  subq   $0x1,-0x28(%rbp)
L16:
  cmpq   $0x0,-0x28(%rbp)
  jns    L23
  mov    -0x30(%rbp),%rax
  pop    %rbp
  ret
```

assistant: ```c
int bcd2_div(long *bcd_low, long *bcd_high, long divisor) {
  long tmp_lo, tmp_hi, carry, d1, res, digit;
  carry = 0;
  tmp_lo = *bcd_low;
  tmp_hi = *bcd_high;
  *bcd_low = *bcd_high = 0;
  for (digit = 13; digit >= 0; digit--) {
    d1 = ((digit) >= 7) ? (tmp_hi & (0xF << (4 * ((digit)-7)))) >> (((digit)-7) * 4) : (tmp_lo & (0xF << (4 * (digit)))) >> ((digit)*4);
    d1 += 10 * carry;
    res = d1 / divisor;
    carry = d1 % divisor;
    if ((digit) >= 7) {
      *bcd_high &= (0xFFFFFFF ^ (0xF << (4 * ((digit)-7))));
      *bcd_high |= (res << (4 * ((digit)-7)));
    } else {
      *bcd_low = (*bcd_low & (0xFFFFFFF ^ (0xF << (4 * (digit)))));
      *bcd_low |= (res << (4 * (digit)));
    };
  }
  return (carry);
}
```