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

```asm
<process_buffer>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x198,%rsp
  mov    %edx,0x2c(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x1188(%rsp)
  mov    %esi,%eax
  shr    $0x1f,%eax
  lea    (%rax,%rsi,1),%r15d
  sar    %r15d
  lea    -0x1164(%r15),%eax
  mov    %eax,0x14(%rsp)
  test   %eax,%eax
  jle    L188
  lea    0x38(%rsp),%rax
  mov    %rdi,%r13
  xor    %ebp,%ebp
  xor    %r12d,%r12d
  mov    %rax,0x20(%rsp)
  xor    %ebx,%ebx
  jmp    L254
  nopl   0x0(%rax,%rax,1)
L70:
  mov    0x38(%rsp),%r9d
  mov    0x3c(%rsp),%edx
  cmp    %edx,%r9d
  jle    L182
  test   %ecx,%ecx
  jne    L255
L169:
  mov    %ebp,%r15d
L41:
  lea    0x1(%r15),%ebp
  cmp    %ebp,0x14(%rsp)
  jle    L91
L254:
  lea    0x0(%rbp,%rbp,1),%r14d
  add    %ebx,%ebx
  movslq %r14d,%rax
  lea    0x4(%r13,%rax,4),%rcx
  mov    0x0(%r13,%rax,4),%edi
  lea    0x0(,%rax,4),%r8
  mov    (%rcx),%esi
  mov    %r8,0x8(%rsp)
  mov    %rcx,(%rsp)
  call   <phi_difference@plt>
  mov    0x8(%rsp),%r8
  mov    (%rsp),%rcx
  mov    %rax,%r15
  mov    0x8(%r13,%r8,1),%esi
  mov    (%rcx),%edi
  call   <phi_difference@plt>
  xor    %edx,%edx
  test   %r15,%r15
  mov    %ebp,%r15d
  setg   %dl
  add    %r12d,%r12d
  or     %edx,%ebx
  test   %rax,%rax
  setg   %al
  movzbl %al,%eax
  or     %eax,%r12d
  cmp    $0x23,%ebp
  jle    L41
  mov    $0xacdda4e2,%esi
  mov    %ebx,%edi
  call   <sync_word_fuzzy_compare@plt>
  test   %rax,%rax
  jne    L106
  mov    $0xacdda4e2,%esi
  mov    %r12d,%edi
  call   <sync_word_fuzzy_compare@plt>
  test   %rax,%rax
  je     L147
L106:
  lea    -0x23(%rbp),%eax
  mov    $0xacdda4e2,%esi
  mov    %ebx,%edi
  mov    %eax,0x28(%rsp)
  lea    0x8e0(%rsp),%r15
  call   <sync_word_fuzzy_compare@plt>
  lea    0x40(%rsp),%r8
  mov    0x20(%rsp),%rdx
  movl   $0xffffffff,0x38(%rsp)
  cmp    $0x1,%rax
  mov    %r8,%rsi
  mov    %r8,0x8(%rsp)
  adc    $0xffffffba,%r14d
  movl   $0xffffffff,0x3c(%rsp)
  movslq %r14d,%rcx
  shl    $0x2,%rcx
  lea    0x0(%r13,%rcx,1),%rdi
  mov    %rcx,0x18(%rsp)
  call   <demod_adsb_frame@plt>
  mov    0x18(%rsp),%rcx
  lea    0x3c(%rsp),%rdx
  mov    %r15,%rsi
  mov    %eax,(%rsp)
  lea    0x4(%r13,%rcx,1),%rdi
  call   <demod_adsb_frame@plt>
  mov    0x8(%rsp),%r8
  mov    %eax,%ecx
  mov    (%rsp),%eax
  test   %eax,%eax
  jne    L70
  test   %ecx,%ecx
  je     L169
  mov    0x3c(%rsp),%edx
  cmp    0x38(%rsp),%edx
  jg     L169
  nopl   0x0(%rax)
L255:
  mov    0x2c(%rsp),%eax
  mov    %r15,%rsi
  mov    %ecx,(%rsp)
  lea    0x1(%r14,%rax,1),%edi
  call   <handle_adsb_frame@plt>
  mov    0x28(%rsp),%r15d
  mov    (%rsp),%ecx
  add    %ecx,%r15d
  lea    0x1(%r15),%ebp
  cmp    %ebp,0x14(%rsp)
  jg     L254
  nopl   (%rax)
L91:
  lea    -0x46(%r15,%r15,1),%eax
L212:
  mov    0x1188(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L130
  add    $0x1198,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  cs nopw 0x0(%rax,%rax,1)
L147:
  mov    $0x53225b1d,%esi
  mov    %ebx,%edi
  call   <sync_word_fuzzy_compare@plt>
  test   %rax,%rax
  je     L154
L107:
  lea    -0x23(%rbp),%eax
  mov    $0x53225b1d,%esi
  mov    %ebx,%edi
  mov    %eax,0x18(%rsp)
  lea    0x8e0(%rsp),%r15
  call   <sync_word_fuzzy_compare@plt>
  lea    0x40(%rsp),%r8
  mov    0x20(%rsp),%rdx
  movl   $0xffffffff,0x38(%rsp)
  cmp    $0x1,%rax
  mov    %r8,%rsi
  mov    %r8,(%rsp)
  adc    $0xffffffba,%r14d
  movl   $0xffffffff,0x3c(%rsp)
  movslq %r14d,%rcx
  mov    %r14d,0x28(%rsp)
  shl    $0x2,%rcx
  lea    0x0(%r13,%rcx,1),%rdi
  mov    %rcx,0x8(%rsp)
  call   <demod_uplink_frame@plt>
  mov    0x8(%rsp),%rcx
  lea    0x3c(%rsp),%rdx
  mov    %r15,%rsi
  mov    %eax,%r14d
  lea    0x4(%r13,%rcx,1),%rdi
  call   <demod_uplink_frame@plt>
  test   %r14d,%r14d
  mov    (%rsp),%r8
  mov    %eax,%ecx
  je     L175
  mov    0x38(%rsp),%r9d
  mov    0x3c(%rsp),%edx
  cmp    %edx,%r9d
  jle    L192
  test   %eax,%eax
  je     L169
L240:
  mov    0x2c(%rsp),%esi
  mov    0x28(%rsp),%eax
  mov    %ecx,(%rsp)
  lea    0x1(%rax,%rsi,1),%edi
  mov    %r15,%rsi
  call   <handle_uplink_frame@plt>
  mov    0x18(%rsp),%r15d
  mov    (%rsp),%ecx
  add    %ecx,%r15d
  jmp    L41
  nopw   0x0(%rax,%rax,1)
L154:
  mov    $0x53225b1d,%esi
  mov    %r12d,%edi
  call   <sync_word_fuzzy_compare@plt>
  test   %rax,%rax
  jne    L107
  jmp    L41
  nopl   0x0(%rax,%rax,1)
L175:
  test   %eax,%eax
  je     L169
  mov    0x3c(%rsp),%edx
  cmp    0x38(%rsp),%edx
  jg     L169
  jmp    L240
  nopl   0x0(%rax,%rax,1)
L182:
  mov    0x2c(%rsp),%eax
  mov    %r9d,%edx
  mov    %r8,%rsi
  lea    (%rax,%r14,1),%edi
  call   <handle_adsb_frame@plt>
  mov    0x28(%rsp),%r15d
  add    (%rsp),%r15d
  jmp    L41
  nopl   0x0(%rax)
L188:
  mov    $0xffffffb8,%eax
  jmp    L212
L192:
  mov    0x28(%rsp),%edi
  mov    %r9d,%edx
  add    0x2c(%rsp),%edi
  mov    %r8,%rsi
  call   <handle_uplink_frame@plt>
  mov    0x18(%rsp),%r15d
  add    %r14d,%r15d
  jmp    L41
L130:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int process_buffer(uint16_t *phi, int len, uint64_t offset) {
  uint64_t sync0 = 0, sync1 = 0;
  int lenbits;
  int bit;
  uint8_t demod_buf_a[(((6) * ((576) + 160)) / 8)];
  uint8_t demod_buf_b[(((6) * ((576) + 160)) / 8)];
  lenbits = len / 2 - ((36) + ((6) * ((576) + 160)));
  for (bit = 0; bit < lenbits; ++bit) {
    int16_t dphi0 = phi_difference(phi[bit * 2], phi[bit * 2 + 1]);
    int16_t dphi1 = phi_difference(phi[bit * 2 + 1], phi[bit * 2 + 2]);
    sync0 = ((sync0 << 1) | (dphi0 > 0 ? 1 : 0)) & ((((uint64_t)1) << (36)) - 1);
    sync1 = ((sync1 << 1) | (dphi1 > 0 ? 1 : 0)) & ((((uint64_t)1) << (36)) - 1);
    if (bit < (36))
      continue;
    if (sync_word_fuzzy_compare(sync0, 0xEACDDA4E2UL) || sync_word_fuzzy_compare(sync1, 0xEACDDA4E2UL)) {
      int startbit = (bit - (36) + 1);
      int shift = (sync_word_fuzzy_compare(sync0, 0xEACDDA4E2UL) ? 0 : 1);
      int index = startbit * 2 + shift;
      int skip_0, skip_1;
      int rs_0 = -1, rs_1 = -1;
      skip_0 = demod_adsb_frame(phi + index, demod_buf_a, &rs_0);
      skip_1 = demod_adsb_frame(phi + index + 1, demod_buf_b, &rs_1);
      if (skip_0 && rs_0 <= rs_1) {
        handle_adsb_frame(offset + index, demod_buf_a, rs_0);
        bit = startbit + skip_0;
        continue;
      } else if (skip_1 && rs_1 <= rs_0) {
        handle_adsb_frame(offset + index + 1, demod_buf_b, rs_1);
        bit = startbit + skip_1;
        continue;
      } else {
      }
    } else if (sync_word_fuzzy_compare(sync0, 0x153225B1DUL) || sync_word_fuzzy_compare(sync1, 0x153225B1DUL)) {
      int startbit = (bit - (36) + 1);
      int shift = (sync_word_fuzzy_compare(sync0, 0x153225B1DUL) ? 0 : 1);
      int index = startbit * 2 + shift;
      int skip_0, skip_1;
      int rs_0 = -1, rs_1 = -1;
      skip_0 = demod_uplink_frame(phi + index, demod_buf_a, &rs_0);
      skip_1 = demod_uplink_frame(phi + index + 1, demod_buf_b, &rs_1);
      if (skip_0 && rs_0 <= rs_1) {
        handle_uplink_frame(offset + index, demod_buf_a, rs_0);
        bit = startbit + skip_0;
        continue;
      } else if (skip_1 && rs_1 <= rs_0) {
        handle_uplink_frame(offset + index + 1, demod_buf_b, rs_1);
        bit = startbit + skip_1;
        continue;
      } else {
      }
    }
  }
  return (bit - (36)) * 2;
}
```