user: 请将以下的汇编代码转换成C语言代码：

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x438,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x428(%rsp)
  xor    %eax,%eax
  mov    $0x100,%esi
  mov    $0xd,%edi
  call   <long2d@plt>
  mov    %rax,0x10(%rsp)
  mov    $0x100,%esi
  mov    $0xd,%edi
  call   <long2d@plt>
  mov    %rax,0x18(%rsp)
  lea    D50(%rip),%rsi
  lea    D156(%rip),%rdi
  call   <fopen@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L104
L172:
  lea    0x20(%rsp),%r12
  lea    0x420(%rsp),%rdx
  mov    %r12,%rax
L214:
  movl   $0x0,(%rax)
  add    $0x4,%rax
  cmp    %rdx,%rax
  jne    L214
  mov    $0x0,%r13d
  mov    $0x1,%r15d
  jmp    L398
L104:
  lea    D50(%rip),%rdx
  lea    D156(%rip),%rsi
  lea    D95(%rip),%rdi
  call   <perror_exit@plt>
  jmp    L172
L141:
  add    $0x1,%r13d
  cmp    $0xd,%r13d
  je     L76
L398:
  lea    0x3(%r13),%ecx
  mov    %r15d,%r14d
  shl    %cl,%r14d
  mov    $0xffff8000,%ebx
L257:
  mov    %ebx,%edi
  call   <Slinear2ulaw@plt>
  mov    %r13d,0x20(%rsp,%rax,4)
  add    %r14d,%ebx
  cmp    $0x7fff,%ebx
  jle    L257
  jmp    L141
L76:
  mov    $0x100,%edx
  lea    D44(%rip),%rsi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  lea    0x3fc(%r12),%r13
  lea    D6(%rip),%rbx
L368:
  mov    (%r12),%edx
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  add    $0x4,%r12
  cmp    %r12,%r13
  jne    L368
  mov    0x41c(%rsp),%edx
  lea    D12(%rip),%rsi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    0x18(%rsp),%rdi
  mov    %rdi,%r12
  mov    0x10(%rsp),%rsi
  mov    %rsi,%r13
  mov    $0x0,%edx
  mov    $0x0,%r8d
  lea    0x20(%rsp),%rcx
  mov    $0xffffffff,%r9d
  jmp    L182
L179:
  sub    $0x4,%rax
  cmp    $0x1fc,%rax
  je     L39
L185:
  cmp    %edx,(%rax,%rcx,1)
  jl     L179
  mov    (%rsi),%r11
  mov    %r10d,(%r11,%rax,1)
  lea    0x1(%r10),%r10d
  jmp    L179
L39:
  mov    $0x3fc,%eax
  jmp    L5
L393:
  sub    $0x4,%rax
  cmp    $0x1fc,%rax
  je     L297
L5:
  cmp    %edx,(%rax,%rcx,1)
  jge    L393
  mov    (%rsi),%r11
  mov    %r10d,(%r11,%rax,1)
  lea    0x1(%r10),%r10d
  jmp    L393
L297:
  mov    $0x1f8,%eax
  mov    %r9d,%r10d
  jmp    L90
L136:
  sub    $0x4,%rax
  cmp    $0xfffffffffffffffc,%rax
  je     L295
L90:
  cmp    %edx,(%rax,%rcx,1)
  jl     L136
  mov    (%rsi),%r11
  mov    %r10d,(%r11,%rax,1)
  lea    -0x1(%r10),%r10d
  jmp    L136
L295:
  lea    -0x1(%r10),%ebx
  mov    %rsi,%r11
  mov    (%rsi),%rax
  mov    %r10d,0x1fc(%rax)
  mov    $0x1f8,%eax
  jmp    L278
L3:
  sub    $0x4,%rax
  cmp    $0xfffffffffffffffc,%rax
  je     L313
L278:
  cmp    %edx,(%rax,%rcx,1)
  jge    L3
  mov    (%r11),%r10
  mov    %ebx,(%r10,%rax,1)
  lea    -0x1(%rbx),%ebx
  jmp    L3
L313:
  mov    $0x0,%eax
L166:
  mov    (%r11),%r10
  movslq (%r10,%rax,4),%rbx
  mov    (%rdi),%r10
  mov    %eax,0x200(%r10,%rbx,4)
  add    $0x1,%rax
  cmp    $0x100,%rax
  jne    L166
  add    $0x1,%edx
  add    $0x8,%rdi
  add    $0x8,%rsi
  cmp    $0xd,%edx
  je     L218
L182:
  mov    $0x3fc,%eax
  mov    %r8d,%r10d
  jmp    L185
L193:
  add    $0x1,%rbx
  cmp    $0x100,%rbx
  je     L54
L351:
  mov    %ebx,%edx
  mov    (%r15),%rax
  movslq (%rax,%rbx,4),%rcx
  mov    (%r14),%rsi
  lea    -0x80(%rbx),%eax
  cmp    %eax,(%rsi,%rcx,4)
  je     L193
  mov    (%rsp),%esi
  lea    D129(%rip),%rdi
  call   <error_exit@plt>
  jmp    L193
L54:
  addl   $0x1,(%rsp)
  mov    (%rsp),%eax
  add    $0x8,%r14
  add    $0x8,%r15
  cmp    $0xd,%eax
  je     L287
L110:
  mov    $0x0,%ebx
  jmp    L351
L218:
  mov    0x18(%rsp),%r15
  mov    0x10(%rsp),%r14
  movl   $0x0,(%rsp)
  jmp    L110
L287:
  mov    $0x100,%ecx
  mov    $0xd,%edx
  lea    D153(%rip),%rsi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    0x10(%rsp),%rax
  lea    0x68(%rax),%rdi
  mov    %rdi,0x8(%rsp)
  add    $0x60,%rax
  mov    %rax,(%rsp)
  lea    D27(%rip),%r15
  jmp    L412
L100:
  mov    0x0(%r13),%rax
  mov    0x3fc(%rax),%edx
  lea    D120(%rip),%rsi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  add    $0x8,%r13
  cmp    0x8(%rsp),%r13
  je     L66
L412:
  mov    %rbp,%rsi
  mov    $0x7b,%edi
  call   <fputc@plt>
  mov    $0x0,%ebx
L228:
  mov    0x0(%r13),%rax
  mov    (%rax,%rbx,1),%edx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  add    $0x4,%rbx
  cmp    $0x3fc,%rbx
  jne    L228
  cmp    %r13,(%rsp)
  jne    L100
  mov    0x10(%rsp),%rax
  mov    0x60(%rax),%rax
  mov    0x3fc(%rax),%edx
  lea    D29(%rip),%rsi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
L66:
  mov    %rbp,%rsi
  mov    $0xa,%edi
  call   <fputc@plt>
  mov    $0x100,%ecx
  mov    $0xd,%edx
  lea    D88(%rip),%rsi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    0x18(%rsp),%rax
  lea    0x68(%rax),%rdi
  mov    %rdi,(%rsp)
  lea    0x60(%rax),%r15
  lea    D27(%rip),%r14
  jmp    L380
L250:
  mov    (%r12),%rax
  mov    0x3fc(%rax),%edx
  lea    D120(%rip),%rsi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  add    $0x8,%r12
  cmp    %r12,(%rsp)
  je     L328
L380:
  mov    %rbp,%rsi
  mov    $0x7b,%edi
  call   <fputc@plt>
  mov    $0x0,%ebx
L309:
  mov    (%r12),%rax
  mov    (%rax,%rbx,1),%edx
  mov    %r14,%rsi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  add    $0x4,%rbx
  cmp    $0x3fc,%rbx
  jne    L309
  cmp    %r12,%r15
  jne    L250
  mov    0x18(%rsp),%rax
  mov    0x60(%rax),%rax
  mov    0x3fc(%rax),%edx
  lea    D29(%rip),%rsi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
L328:
  mov    %rbp,%rdi
  call   <fclose@plt>
  mov    0x428(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L390
  mov    $0x0,%eax
  add    $0x438,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L390:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_tag: D50
type_infered: string
name: read_data
arguments: data_tag: D156
type_infered: string
name: read_data
arguments: data_tag: D95
type_infered: string
name: read_data
arguments: data_tag: D44
type_infered: string
name: read_data
arguments: data_tag: D6
type_infered: string
name: read_data
arguments: data_tag: D12
type_infered: string
name: read_data
arguments: data_tag: D129
type_infered: string
name: read_data
arguments: data_tag: D153
type_infered: string
name: read_data
arguments: data_tag: D27
type_infered: string
name: read_data
arguments: data_tag: D120
type_infered: string
name: read_data
arguments: data_tag: D29
type_infered: string
name: read_data
arguments: data_tag: D88
type_infered: string

tool: D50: w

tool: D156: bitshift.h

tool: D95: fopen("%s", "%s")

tool: D44: char ulaw_maxshift[%d] = {

tool: D6: %d,

tool: D12: %d};



tool: D129: identity maping failed for shift: %d	index: %d


tool: D153: schar ulaw_inward[%d][%d] = {


tool: D27: %ld,

tool: D120: %ld},


tool: D29: %ld}
};


tool: D88: uchar ulaw_outward[%d][%d] = {


assistant: ```c
int main() {
  FILE *fout;
  char *filename = "bitshift.h", *writemode = "w";
  int shift, i;
  int tab[256];
  int sample;
  int **forwardmap = long2d((unsigned int)13, (unsigned int)256);
  int **reversemap = long2d((unsigned int)13, (unsigned int)256);
  fout = fopen(filename, writemode);
  if (fout == NULL)
    perror_exit("fopen(\"%s\", \"%s\")", filename, writemode);
  for (i = 0; i < 256; i++)
    tab[i] = 0;
  for (shift = 0; shift < 13; shift++)
    for (sample = -(1L << 15); sample < (1L << 15); sample += 1 << (shift + 3))
      tab[Slinear2ulaw(sample)] = shift;
  fprintf(fout, "char ulaw_maxshift[%d] = {", 256);
  for (i = 0; i < 256 - 1; i++)
    fprintf(fout, "%d,", tab[i]);
  fprintf(fout, "%d};\n\n", tab[256 - 1]);
  for (shift = 0; shift < 13; shift++) {
    int nused;
    nused = 0;
    for (i = 255; i >= 128; i--)
      if (tab[i] >= shift)
        forwardmap[shift][i] = nused++;
    for (i = 255; i >= 128; i--)
      if (tab[i] < shift)
        forwardmap[shift][i] = nused++;
    nused = -1;
    for (i = 126; i >= 0; i--)
      if (tab[i] >= shift)
        forwardmap[shift][i] = nused--;
    forwardmap[shift][127] = nused--;
    for (i = 126; i >= 0; i--)
      if (tab[i] < shift)
        forwardmap[shift][i] = nused--;
    for (i = 0; i < 256; i++)
      reversemap[shift][forwardmap[shift][i] + 128] = i;
  }
  for (shift = 0; shift < 13; shift++)
    for (i = 0; i < 256; i++)
      if (forwardmap[shift][reversemap[shift][i]] != i - 128)
        error_exit("identity maping failed for shift: %d\tindex: %d\n", shift, i);
  fprintf(fout, "schar ulaw_inward[%d][%d] = {\n", 13, 256);
  for (shift = 0; shift < 13; shift++) {
    fprintf(fout, "{");
    for (i = 0; i < 256 - 1; i++)
      fprintf(fout, "%ld,", forwardmap[shift][i]);
    if (shift != 13 - 1)
      fprintf(fout, "%ld},\n", forwardmap[shift][256 - 1]);
    else
      fprintf(fout, "%ld}\n};\n", forwardmap[shift][256 - 1]);
  }
  fprintf(fout, "\n");
  fprintf(fout, "uchar ulaw_outward[%d][%d] = {\n", 13, 256);
  for (shift = 0; shift < 13; shift++) {
    fprintf(fout, "{");
    for (i = 0; i < 256 - 1; i++)
      fprintf(fout, "%ld,", reversemap[shift][i]);
    if (shift != 13 - 1)
      fprintf(fout, "%ld},\n", reversemap[shift][256 - 1]);
    else
      fprintf(fout, "%ld}\n};\n", reversemap[shift][256 - 1]);
  }
  fclose(fout);
  return (0);
}
```