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

```asm
<in_flush>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x970,%rsp
  mov    %edi,-0x954(%rbp)
  mov    %esi,-0x958(%rbp)
  mov    %edx,-0x95c(%rbp)
  mov    %rcx,-0x968(%rbp)
  mov    %r8,-0x970(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x95c(%rbp),%edx
  mov    -0x958(%rbp),%ecx
  mov    -0x970(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <write_type_count@plt>
  cmpl   $0x0,-0x958(%rbp)
  jne    L11
  jmp    L130
L9:
  mov    -0x95c(%rbp),%eax
  mov    %eax,-0x944(%rbp)
  cmpl   $0x930,-0x944(%rbp)
  jbe    L108
  movl   $0x930,-0x944(%rbp)
L108:
  mov    -0x944(%rbp),%edx
  mov    -0x968(%rbp),%rcx
  lea    -0x940(%rbp),%rax
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <fread@plt>
  mov    -0x944(%rbp),%edx
  lea    -0x940(%rbp),%rcx
  mov    -0x954(%rbp),%eax
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <edc_computeblock@plt>
  mov    %eax,-0x954(%rbp)
  mov    -0x944(%rbp),%edx
  mov    -0x970(%rbp),%rcx
  lea    -0x940(%rbp),%rax
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <fwrite@plt>
  mov    -0x944(%rbp),%eax
  sub    %eax,-0x95c(%rbp)
  mov    -0x968(%rbp),%rax
  mov    %rax,%rdi
  call   <ftell@plt>
  mov    %eax,%edi
  call   <setcounter_encode@plt>
L130:
  cmpl   $0x0,-0x95c(%rbp)
  jne    L9
  mov    -0x954(%rbp),%eax
  jmp    L13
L4:
  cmpl   $0x3,-0x958(%rbp)
  je     L41
  cmpl   $0x3,-0x958(%rbp)
  ja     L11
  cmpl   $0x1,-0x958(%rbp)
  je     L137
  cmpl   $0x2,-0x958(%rbp)
  je     L133
  jmp    L11
L137:
  mov    -0x968(%rbp),%rdx
  lea    -0x940(%rbp),%rax
  mov    %rdx,%rcx
  mov    $0x930,%edx
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <fread@plt>
  lea    -0x940(%rbp),%rcx
  mov    -0x954(%rbp),%eax
  mov    $0x930,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <edc_computeblock@plt>
  mov    %eax,-0x954(%rbp)
  lea    -0x940(%rbp),%rax
  add    $0xc,%rax
  mov    -0x970(%rbp),%rdx
  mov    %rdx,%rcx
  mov    $0x3,%edx
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <fwrite@plt>
  lea    -0x940(%rbp),%rax
  add    $0x10,%rax
  mov    -0x970(%rbp),%rdx
  mov    %rdx,%rcx
  mov    $0x800,%edx
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <fwrite@plt>
  mov    -0x968(%rbp),%rax
  mov    %rax,%rdi
  call   <ftell@plt>
  mov    %eax,%edi
  call   <setcounter_encode@plt>
  jmp    L11
L133:
  mov    -0x968(%rbp),%rdx
  lea    -0x940(%rbp),%rax
  mov    %rdx,%rcx
  mov    $0x920,%edx
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <fread@plt>
  lea    -0x940(%rbp),%rcx
  mov    -0x954(%rbp),%eax
  mov    $0x920,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <edc_computeblock@plt>
  mov    %eax,-0x954(%rbp)
  lea    -0x940(%rbp),%rax
  add    $0x4,%rax
  mov    -0x970(%rbp),%rdx
  mov    %rdx,%rcx
  mov    $0x804,%edx
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <fwrite@plt>
  mov    -0x968(%rbp),%rax
  mov    %rax,%rdi
  call   <ftell@plt>
  mov    %eax,%edi
  call   <setcounter_encode@plt>
  jmp    L11
L41:
  mov    -0x968(%rbp),%rdx
  lea    -0x940(%rbp),%rax
  mov    %rdx,%rcx
  mov    $0x920,%edx
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <fread@plt>
  lea    -0x940(%rbp),%rcx
  mov    -0x954(%rbp),%eax
  mov    $0x920,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <edc_computeblock@plt>
  mov    %eax,-0x954(%rbp)
  lea    -0x940(%rbp),%rax
  add    $0x4,%rax
  mov    -0x970(%rbp),%rdx
  mov    %rdx,%rcx
  mov    $0x918,%edx
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <fwrite@plt>
  mov    -0x968(%rbp),%rax
  mov    %rax,%rdi
  call   <ftell@plt>
  mov    %eax,%edi
  call   <setcounter_encode@plt>
  nop
L11:
  mov    -0x95c(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,-0x95c(%rbp)
  test   %eax,%eax
  jne    L4
  mov    -0x954(%rbp),%eax
L13:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L117
  call   <__stack_chk_fail@plt>
L117:
  leave
  ret
```

assistant: ```c
unsigned in_flush(unsigned edc, unsigned type, unsigned count, FILE *in, FILE *out) {
  unsigned char buf[2352];
  write_type_count(out, type, count);
  if (!type) {
    while (count) {
      unsigned b = count;
      if (b > 2352)
        b = 2352;
      fread(buf, 1, b, in);
      edc = edc_computeblock(edc, buf, b);
      fwrite(buf, 1, b, out);
      count -= b;
      setcounter_encode(ftell(in));
    }
    return edc;
  }
  while (count--) {
    switch (type) {
    case 1:
      fread(buf, 1, 2352, in);
      edc = edc_computeblock(edc, buf, 2352);
      fwrite(buf + 0x00C, 1, 0x003, out);
      fwrite(buf + 0x010, 1, 0x800, out);
      setcounter_encode(ftell(in));
      break;
    case 2:
      fread(buf, 1, 2336, in);
      edc = edc_computeblock(edc, buf, 2336);
      fwrite(buf + 0x004, 1, 0x804, out);
      setcounter_encode(ftell(in));
      break;
    case 3:
      fread(buf, 1, 2336, in);
      edc = edc_computeblock(edc, buf, 2336);
      fwrite(buf + 0x004, 1, 0x918, out);
      setcounter_encode(ftell(in));
      break;
    }
  }
  return edc;
}
```