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

```asm
<divide>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %esi,-0x18(%rbp)
  cmpl   $0x0,-0x14(%rbp)
  jle    L114
  cmpl   $0x0,-0x18(%rbp)
  jg     L62
L114:
  cmpl   $0x0,-0x14(%rbp)
  jns    L99
  cmpl   $0x0,-0x18(%rbp)
  jns    L99
L62:
  mov    $0x1,%eax
  jmp    L169
L99:
  mov    $0xffffffff,%eax
L169:
  mov    %eax,-0x4(%rbp)
  movl   $0x0,-0xc(%rbp)
  cmpl   $0x0,-0x18(%rbp)
  jne    L15
  mov    $0x7fffffff,%eax
  jmp    L185
L15:
  mov    -0x14(%rbp),%eax
  cmp    -0x18(%rbp),%eax
  jne    L277
  mov    $0x1,%eax
  jmp    L185
L277:
  cmpl   $0x1,-0x18(%rbp)
  jne    L73
  mov    -0x14(%rbp),%eax
  jmp    L185
L73:
  cmpl   $0xffffffff,-0x18(%rbp)
  jne    L226
  cmpl   $0x80000000,-0x14(%rbp)
  je     L5
  mov    -0x14(%rbp),%eax
  neg    %eax
  jmp    L185
L5:
  mov    $0x7fffffff,%eax
  jmp    L185
L226:
  cmpl   $0x80000000,-0x18(%rbp)
  jne    L36
  mov    $0x0,%eax
  jmp    L185
L36:
  cmpl   $0x80000000,-0x14(%rbp)
  jne    L156
  cmpl   $0x1,-0x4(%rbp)
  jne    L130
  mov    -0x18(%rbp),%eax
  neg    %eax
  jmp    L219
L130:
  mov    -0x18(%rbp),%eax
L219:
  add    %eax,-0x14(%rbp)
  addl   $0x1,-0xc(%rbp)
L156:
  mov    -0x14(%rbp),%eax
  mov    %eax,%edx
  neg    %edx
  cmovns %edx,%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x18(%rbp),%eax
  mov    %eax,%edx
  neg    %edx
  cmovns %edx,%eax
  mov    %eax,-0x18(%rbp)
  movl   $0x0,-0x8(%rbp)
  jmp    L248
L96:
  movl   $0x0,-0x8(%rbp)
  jmp    L81
L34:
  addl   $0x1,-0x8(%rbp)
  cmpl   $0x3ffffffe,-0x18(%rbp)
  jg     L192
  mov    -0x8(%rbp),%eax
  mov    -0x18(%rbp),%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  cmp    $0x3ffffffe,%eax
  jg     L192
L81:
  mov    -0x8(%rbp),%eax
  mov    -0x18(%rbp),%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  cmp    %eax,-0x14(%rbp)
  jge    L34
L192:
  cmpl   $0x0,-0x8(%rbp)
  je     L217
  subl   $0x1,-0x8(%rbp)
  mov    -0x8(%rbp),%eax
  mov    %eax,%esi
  mov    $0x2,%edi
  call   <pow@plt>
  add    %eax,-0xc(%rbp)
  mov    -0x8(%rbp),%eax
  mov    -0x18(%rbp),%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  sub    %eax,-0x14(%rbp)
L248:
  mov    -0x14(%rbp),%eax
  cmp    -0x18(%rbp),%eax
  jge    L96
  jmp    L123
L217:
  nop
L123:
  cmpl   $0x1,-0x4(%rbp)
  je     L32
  mov    -0xc(%rbp),%eax
  neg    %eax
  jmp    L185
L32:
  mov    -0xc(%rbp),%eax
L185:
  leave
  ret
```

assistant: ```c
int divide(int A, int B) {
  int flags = ((A > 0 && B > 0) || (A < 0 && B < 0)) ? 1 : -1;
  int out = 0;
  if (B == 0)
    return ((int)(~0U >> 1));
  if (A == B)
    return 1;
  if (B == 1)
    return A;
  if (B == -1)
    return (A == (-((int)(~0U >> 1)) - 1)) ? ((int)(~0U >> 1)) : -A;
  if (B == (-((int)(~0U >> 1)) - 1))
    return 0;
  if (A == (-((int)(~0U >> 1)) - 1)) {
    A += (flags == 1) ? -B : B;
    out++;
  }
  A = abs(A);
  B = abs(B);
  int shift = 0;
  while (A >= B) {
    shift = 0;
    while (A >= B << shift) {
      shift++;
      if (B >= ((int)(~0U >> 1)) / 2 || B << shift >= ((int)(~0U >> 1)) / 2)
        break;
    }
    if (shift == 0)
      break;
    shift--;
    out += (int)pow(2, shift);
    A -= B << shift;
  }
  return (flags == 1) ? out : -out;
}
```