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

```asm
<rdmar>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0xb8,%rsp
  mov    0x10f0(%rsp),%rax
  mov    %rsi,0x8(%rsp)
  mov    %rsi,%r15
  mov    %rcx,%r14
  mov    %rdi,%r13
  mov    %rdx,0x20(%rsp)
  mov    %rcx,0x18(%rsp)
  mov    %r8,0x28(%rsp)
  mov    %r9,0x30(%rsp)
  mov    %rax,0x38(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x10a8(%rsp)
  xor    %eax,%eax
  movl   $0x1,0x6c(%rsp)
  call   <filec_getdebug@plt>
  movq   $0x0,(%r14)
  movq   $0x0,(%r15)
  mov    %eax,%ebx
  xor    %eax,%eax
  call   <getbo@plt>
  mov    %r13,%rdi
  mov    %eax,0x10(%rsp)
  call   <strlen@plt>
  mov    %eax,0x64(%rsp)
  test   %ebx,%ebx
  jne    L245
  lea    0x68(%rsp),%r12
  lea    0x6c(%rsp),%rbp
  mov    %r13,%rsi
  mov    %r12,%rcx
  lea    0x64(%rsp),%rdx
  mov    %rbp,%rdi
  call   <dskbor_@plt>
  mov    0x68(%rsp),%ecx
  test   %ecx,%ecx
  jne    L283
  lea    0x70(%rsp),%rsi
  mov    %rbp,%rdi
  lea    0x5c(%rsp),%r14
  movl   $0x1,0x70(%rsp)
  call   <dskbwr_@plt>
  mov    %r12,%rcx
  mov    %r14,%rdx
  mov    %rbp,%rdi
  lea    0x8d0(%rsp),%r13
  movl   $0x200,0x5c(%rsp)
  mov    %r13,%rsi
  call   <dskbr_@plt>
  mov    0x68(%rsp),%esi
  test   %esi,%esi
  je     L408
L162:
  lea    0x60(%rsp),%rsi
  mov    %rbp,%rdi
  call   <dskbcr_@plt>
  test   %ebx,%ebx
  jne    L413
L291:
  mov    0x68(%rsp),%eax
  test   %eax,%eax
  je     L109
  mov    0x18(%rsp),%rax
  mov    (%rax),%rdi
  test   %rdi,%rdi
  je     L160
  call   <free@plt>
L160:
  mov    0x8(%rsp),%rax
  mov    (%rax),%rdi
  test   %rdi,%rdi
  je     L347
  call   <free@plt>
L347:
  mov    0x68(%rsp),%eax
L109:
  mov    0x10a8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L405
  add    $0x10b8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L408:
  lea    0x80(%rsp),%r15
  mov    $0x8,%edx
  mov    %r13,%rsi
  mov    %r15,%rdi
  call   <memcpy@plt>
  mov    0x10(%rsp),%edx
  test   %edx,%edx
  je     L140
L1:
  mov    0x80(%rsp),%r15d
  cmp    $0x7d0,%r15d
  je     L126
  cmp    $0x4b0,%r15d
  je     L136
L312:
  movl   $0xffffffff,0x68(%rsp)
  test   %ebx,%ebx
  je     L162
L386:
  movl   $0x0,0x40(%rsp)
  mov    $0xffffffff,%ecx
  xor    %r15d,%r15d
L289:
  mov    0x40(%rsp),%edx
  mov    %r15d,%esi
  lea    D204(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
L98:
  mov    0x68(%rsp),%edi
  test   %edi,%edi
  jne    L162
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <dskbcr_@plt>
  test   %ebx,%ebx
  je     L291
L413:
  mov    0x68(%rsp),%esi
  lea    D143(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L291
  nopl   0x0(%rax)
L245:
  mov    %r13,%rsi
  lea    0x68(%rsp),%r12
  lea    0x6c(%rsp),%rbp
  xor    %eax,%eax
  lea    D208(%rip),%rdi
  call   <printf@plt>
  lea    0x64(%rsp),%rdx
  mov    %r12,%rcx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <dskbor_@plt>
  mov    0x68(%rsp),%r15d
  test   %r15d,%r15d
  jne    L283
  lea    D35(%rip),%rdi
  movl   $0x1,0x70(%rsp)
  lea    0x5c(%rsp),%r14
  call   <puts@plt>
  lea    0x8d0(%rsp),%r13
  lea    0x70(%rsp),%rsi
  mov    %rbp,%rdi
  call   <dskbwr_@plt>
  mov    %r12,%rcx
  mov    %r14,%rdx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  movl   $0x200,0x5c(%rsp)
  call   <dskbr_@plt>
  mov    0x68(%rsp),%esi
  lea    D189(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x68(%rsp),%ecx
  movl   $0x0,0x40(%rsp)
  test   %ecx,%ecx
  jne    L289
  lea    0x80(%rsp),%r15
  mov    $0x8,%edx
  mov    %r13,%rsi
  mov    %r15,%rdi
  call   <memcpy@plt>
  mov    0x10(%rsp),%eax
  test   %eax,%eax
  je     L243
  lea    D95(%rip),%rdi
  call   <puts@plt>
L67:
  mov    0x84(%rsp),%edx
  mov    0x80(%rsp),%esi
  lea    D141(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L1
  nopw   0x0(%rax,%rax,1)
L136:
  mov    0x84(%rsp),%eax
  mov    %eax,0x40(%rsp)
  cmp    $0x4b0,%eax
  jne    L312
L15:
  movd   0x40(%rsp),%xmm1
  movd   %r15d,%xmm0
  lea    -0x200(%r15,%r15,1),%ecx
  punpckldq %xmm1,%xmm0
  movq   %xmm0,0x48(%rsp)
  test   %ebx,%ebx
  jne    L284
  mov    %ecx,0x5c(%rsp)
  mov    %r14,%rdx
  mov    %r12,%rcx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <dskbr_@plt>
  mov    %r13,%rdi
  call   <mar_getnover@plt>
  mov    %eax,0x44(%rsp)
L430:
  mov    0x20(%rsp),%rax
  mov    $0x1000,%edi
  movl   $0x1000,(%rax)
  call   <malloc@plt>
  mov    $0x1000,%edx
  xor    %esi,%esi
  mov    %rax,%rdi
  mov    0x8(%rsp),%rax
  mov    %rdi,(%rax)
  call   <memset@plt>
  mov    0x8(%rsp),%rax
  mov    (%rax),%rdi
  call   <clrhd@plt>
  mov    0x8(%rsp),%rax
  mov    %r13,%rdi
  lea    0x880(%rsp),%r13
  mov    (%rax),%rsi
  call   <mar_putheader@plt>
  mov    0x28(%rsp),%rcx
  mov    0x48(%rsp),%rdx
  lea    D62(%rip),%rsi
  mov    0x8(%rsp),%rax
  lea    D18(%rip),%rdi
  movl   $0x2,(%rcx)
  mov    0x30(%rsp),%rcx
  mov    %rdx,(%rcx)
  mov    (%rax),%rdx
  call   <puthd@plt>
  lea    D151(%rip),%r8
  mov    %r15d,%edx
  mov    %r13,%rdi
  mov    %r8,%rsi
  call   <sprintf@plt>
  mov    0x8(%rsp),%rax
  mov    %r13,%rsi
  lea    D166(%rip),%rdi
  mov    (%rax),%rdx
  call   <puthd@plt>
  lea    D151(%rip),%r8
  mov    %r15d,%edx
  mov    %r13,%rdi
  mov    %r8,%rsi
  call   <sprintf@plt>
  mov    0x8(%rsp),%rax
  mov    %r13,%rsi
  lea    D98(%rip),%rdi
  mov    (%rax),%rdx
  call   <puthd@plt>
  test   %ebx,%ebx
  jne    L52
L434:
  mov    0x40(%rsp),%r9d
  mov    0x44(%rsp),%r11d
  imul   %r15d,%r9d
  lea    (%r9,%r9,1),%r8d
  test   %r11d,%r11d
  jle    L350
  mov    0x38(%rsp),%rax
  lea    0x0(,%r9,4),%edi
  mov    %r9d,0x20(%rsp)
  mov    %r8d,0x28(%rsp)
  movl   $0x5,(%rax)
  call   <malloc@plt>
  mov    0x28(%rsp),%r8d
  mov    %r12,%rcx
  mov    %r14,%rdx
  mov    %rax,%r13
  mov    0x18(%rsp),%rax
  mov    %rbp,%rdi
  mov    %r13,%rsi
  mov    %r8d,0x5c(%rsp)
  mov    %r13,(%rax)
  call   <dskbr_@plt>
  mov    0x10(%rsp),%r9d
  test   %r9d,%r9d
  mov    0x20(%rsp),%r9d
  je     L169
  lea    -0x1(%r9),%eax
  mov    %eax,0x64(%rsp)
  mov    %eax,0x60(%rsp)
  test   %eax,%eax
  js     L438
  nopw   0x0(%rax,%rax,1)
L127:
  cltq
  lea    0x0(%r13,%rax,2),%rdx
  movzwl (%rdx),%ecx
  mov    %ecx,(%rdx,%rax,2)
  mov    0x60(%rsp),%eax
  sub    $0x1,%eax
  mov    %eax,0x60(%rsp)
  jns    L127
  mov    0x44(%rsp),%eax
  lea    0x0(,%rax,8),%edi
  mov    %edi,0x5c(%rsp)
  call   <malloc@plt>
  mov    %r12,%rcx
  mov    %r14,%rdx
  mov    %rbp,%rdi
  mov    %rax,%rsi
  mov    %rax,0x20(%rsp)
  call   <dskbr_@plt>
  mov    0x10(%rsp),%r8d
  mov    0x20(%rsp),%r10
  test   %r8d,%r8d
  je     L135
L73:
  xor    %esi,%esi
  lea    0x7c(%rsp),%r8
  lea    0x78(%rsp),%rax
  test   %ebx,%ebx
  mov    %ebx,0x10(%rsp)
  lea    0x74(%rsp),%r14
  mov    %r10,%rbx
  mov    %r12,0x20(%rsp)
  mov    %rax,%r12
  mov    %rbp,0x28(%rsp)
  mov    %r8,%rbp
  movl   $0x0,0x60(%rsp)
  jne    L290
  nopw   0x0(%rax,%rax,1)
L147:
  mov    %r14,%rdx
  mov    %rbp,%r8
  mov    %r12,%rcx
  mov    %rbx,%rdi
  call   <mar_getover@plt>
  mov    0x78(%rsp),%eax
  mov    0x7c(%rsp),%edx
  imul   %r15d,%eax
  add    0x74(%rsp),%eax
  cltq
  mov    %edx,0x0(%r13,%rax,4)
  mov    0x60(%rsp),%eax
  lea    0x1(%rax),%esi
  mov    %esi,0x60(%rsp)
  cmp    0x44(%rsp),%esi
  jl     L147
L130:
  mov    %rbx,%r10
  mov    0x20(%rsp),%r12
  mov    0x10(%rsp),%ebx
  mov    %r10,%rdi
  mov    0x28(%rsp),%rbp
  call   <free@plt>
L184:
  test   %ebx,%ebx
  je     L98
  mov    0x68(%rsp),%esi
  lea    D189(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x68(%rsp),%ecx
  jmp    L289
  nopl   (%rax)
L243:
  lea    D17(%rip),%rdi
  call   <puts@plt>
  mov    %r15,%rdx
  mov    $0x8,%esi
  mov    $0x1,%edi
  call   <swpbyt@plt>
  jmp    L67
  nopl   0x0(%rax,%rax,1)
L126:
  mov    0x84(%rsp),%eax
  mov    %eax,0x40(%rsp)
  cmp    $0x7d0,%eax
  je     L15
  movl   $0xffffffff,0x68(%rsp)
  test   %ebx,%ebx
  je     L162
  jmp    L386
  nopl   0x0(%rax,%rax,1)
L290:
  mov    %rbp,%r8
  mov    %r12,%rcx
  mov    %r14,%rdx
  mov    %rbx,%rdi
  call   <mar_getover@plt>
  mov    0x78(%rsp),%edx
  mov    0x74(%rsp),%esi
  xor    %eax,%eax
  mov    0x7c(%rsp),%ecx
  lea    D106(%rip),%rdi
  call   <printf@plt>
  mov    0x78(%rsp),%eax
  mov    0x7c(%rsp),%edx
  imul   %r15d,%eax
  add    0x74(%rsp),%eax
  cltq
  mov    %edx,0x0(%r13,%rax,4)
  mov    0x60(%rsp),%eax
  lea    0x1(%rax),%esi
  mov    %esi,0x60(%rsp)
  cmp    0x44(%rsp),%esi
  jl     L290
  jmp    L130
  nopl   0x0(%rax,%rax,1)
L169:
  mov    0x5c(%rsp),%esi
  mov    %r13,%rdx
  xor    %edi,%edi
  call   <swpbyt@plt>
  mov    0x20(%rsp),%r9d
  lea    -0x1(%r9),%eax
  mov    %eax,0x64(%rsp)
  mov    %eax,0x60(%rsp)
  test   %eax,%eax
  jns    L127
  mov    0x44(%rsp),%eax
  lea    0x0(,%rax,8),%edi
  mov    %edi,0x5c(%rsp)
  call   <malloc@plt>
  mov    %r12,%rcx
  mov    %r14,%rdx
  mov    %rbp,%rdi
  mov    %rax,%rsi
  mov    %rax,0x10(%rsp)
  call   <dskbr_@plt>
  mov    0x10(%rsp),%r10
  cs nopw 0x0(%rax,%rax,1)
L135:
  mov    0x5c(%rsp),%esi
  mov    %r10,%rdx
  mov    $0x1,%edi
  mov    %r10,0x10(%rsp)
  call   <swpbyt@plt>
  mov    0x10(%rsp),%r10
  jmp    L73
L350:
  mov    0x38(%rsp),%rax
  lea    D147(%rip),%rsi
  mov    %r8d,0x20(%rsp)
  lea    D40(%rip),%rdi
  movl   $0x4,(%rax)
  mov    0x8(%rsp),%rax
  mov    (%rax),%rdx
  call   <puthd@plt>
  mov    0x20(%rsp),%r8d
  mov    %r8d,%edi
  mov    %r8d,0x5c(%rsp)
  call   <malloc@plt>
  mov    %r12,%rcx
  mov    %r14,%rdx
  mov    %rbp,%rdi
  mov    %rax,%r13
  mov    0x18(%rsp),%rax
  mov    %r13,%rsi
  mov    %r13,(%rax)
  call   <dskbr_@plt>
  mov    0x10(%rsp),%r10d
  test   %r10d,%r10d
  jne    L184
  mov    0x5c(%rsp),%esi
  mov    %r13,%rdx
  xor    %edi,%edi
  call   <swpbyt@plt>
  jmp    L184
  nopw   0x0(%rax,%rax,1)
L140:
  mov    %r15,%rdx
  mov    $0x8,%esi
  mov    $0x1,%edi
  call   <swpbyt@plt>
  jmp    L1
  nopw   0x0(%rax,%rax,1)
L52:
  mov    0x8(%rsp),%rax
  lea    D26(%rip),%rdi
  mov    (%rax),%rsi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L434
  nopl   0x0(%rax,%rax,1)
L284:
  movd   %xmm1,%edx
  mov    %r15d,%esi
  lea    D200(%rip),%rdi
  xor    %eax,%eax
  mov    %ecx,0x44(%rsp)
  call   <printf@plt>
  mov    0x44(%rsp),%ecx
  mov    %r13,%rsi
  mov    %r14,%rdx
  mov    %rbp,%rdi
  mov    %ecx,0x5c(%rsp)
  mov    %r12,%rcx
  call   <dskbr_@plt>
  mov    %r13,%rdi
  call   <mar_getnover@plt>
  lea    D61(%rip),%rdi
  mov    %eax,0x44(%rsp)
  mov    %eax,%esi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L430
  nopl   0x0(%rax,%rax,1)
L283:
  mov    $0xffffffff,%eax
  jmp    L109
L438:
  mov    0x44(%rsp),%eax
  lea    0x0(,%rax,8),%edi
  mov    %edi,0x5c(%rsp)
  call   <malloc@plt>
  mov    %r12,%rcx
  mov    %r14,%rdx
  mov    %rbp,%rdi
  mov    %rax,%rsi
  mov    %rax,0x10(%rsp)
  call   <dskbr_@plt>
  mov    0x10(%rsp),%r10
  jmp    L73
L405:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_label: D204
type_guessed: string
name: unpack_data
arguments: data_label: D143
type_guessed: string
name: unpack_data
arguments: data_label: D208
type_guessed: string
name: unpack_data
arguments: data_label: D35
type_guessed: string
name: unpack_data
arguments: data_label: D189
type_guessed: string
name: unpack_data
arguments: data_label: D95
type_guessed: string
name: unpack_data
arguments: data_label: D141
type_guessed: string
name: unpack_data
arguments: data_label: D62
type_guessed: string
name: unpack_data
arguments: data_label: D18
type_guessed: string
name: unpack_data
arguments: data_label: D151
type_guessed: string
name: unpack_data
arguments: data_label: D166
type_guessed: string
name: unpack_data
arguments: data_label: D98
type_guessed: string
name: unpack_data
arguments: data_label: D17
type_guessed: string
name: unpack_data
arguments: data_label: D106
type_guessed: string
name: unpack_data
arguments: data_label: D147
type_guessed: string
name: unpack_data
arguments: data_label: D40
type_guessed: string
name: unpack_data
arguments: data_label: D26
type_guessed: string
name: unpack_data
arguments: data_label: D200
type_guessed: string
name: unpack_data
arguments: data_label: D61
type_guessed: string

tool: D204: Done reading MAR image (size %d x %d) (istat %d)


tool: D143: RDMAR completion status %d


tool: D208: Opening file: %s


tool: D35: Reading header

tool: D189: Read Completion status : %d


tool: D95: This computer is big endian

tool: D141: Checking if mar image %d %d 


tool: D62: 2

tool: D18: DIM

tool: D151: %d

tool: D166: SIZE1

tool: D98: SIZE2

tool: D17: This computer is little endian

tool: D106: Overflow (%d,%d) : %d


tool: D147: unsigned_short

tool: D40: TYPE

tool: D26: Updated Header        : 
%s<END


tool: D200: Read MAR Image Plate (%d x %d)


tool: D61: Number of overflow pixels %d


assistant: ```c
int rdmar(char *filename, char **head, int *lhead, char **array, int *naxis, int *axis, int *type) {
  int readl;
  int i, j;
  int istat, cbo;
  char s[80];
  int lun = 1;
  int lflag;
  int is1, is2;
  int martest[512];
  char marhead[2000];
  int nover;
  int filec_debug = filec_getdebug();
  *array = 0;
  *head = 0;
  is1 = 0;
  is2 = 0;
  cbo = getbo();
  j = strlen(filename);
  if (filec_debug)
    printf("Opening file: %s\n", filename);
  dskbor_(&lun, filename, &j, &istat);
  if (istat != 0)
    return -1;
  lflag = (1 == 1);
  if (filec_debug)
    printf("Reading header\n");
  dskbwr_(&lun, &lflag);
  readl = 512;
  dskbr_(&lun, marhead, &readl, &istat);
  if (filec_debug)
    printf("Read Completion status : %d\n", istat);
  if (istat != 0)
    goto close;
  memcpy(martest, marhead, 8);
  if (filec_debug) {
    if (cbo == 0)
      printf("This computer is little endian\n");
    else
      printf("This computer is big endian\n");
  }
  if (cbo == 0)
    swpbyt(1, 8, (char *)martest);
  if (filec_debug)
    printf("Checking if mar image %d %d \n", *martest, *(martest + 1));
  if ((*martest == 2000 && *(martest + 1) == 2000) || (*martest == 1200 && *(martest + 1) == 1200)) {
    is1 = *martest;
    is2 = *(martest + 1);
    if (filec_debug)
      printf("Read MAR Image Plate (%d x %d)\n", is1, is2);
    readl = is1 * 2 - 512;
    dskbr_(&lun, marhead, &readl, &istat);
    nover = mar_getnover(marhead);
    if (filec_debug)
      printf("Number of overflow pixels %d\n", nover);
    *lhead = 4096;
    *head = malloc(4096);
    memset(*head, 0, 4096);
    clrhd(*head);
    mar_putheader(marhead, *head);
    *naxis = 2;
    axis[0] = is1;
    axis[1] = is2;
    puthd("DIM", "2", *head);
    sprintf(s, "%d", is1);
    puthd("SIZE1", s, *head);
    sprintf(s, "%d", is1);
    puthd("SIZE2", s, *head);
    if (filec_debug)
      printf("Updated Header        : \n%s<END\n", *head);
    if (nover <= 0) {
      unsigned int *data;
      *type = 4;
      puthd("TYPE", "unsigned_short", *head);
      readl = is1 * is2 * sizeof(unsigned short);
      data = malloc(readl);
      *array = (char *)data;
      dskbr_(&lun, (char *)data, &readl, &istat);
      if (cbo == 0)
        swpbyt(0, readl, (char *)data);
    } else {
      unsigned short *a;
      unsigned int *b;
      int x, y, val;
      int datal;
      int *data;
      *type = 5;
      datal = is1 * is2 * sizeof(int);
      data = malloc(datal);
      *array = (char *)data;
      readl = is1 * is2 * sizeof(unsigned short);
      a = (unsigned short *)data;
      dskbr_(&lun, (char *)a, &readl, &istat);
      if (cbo == 0)
        swpbyt(0, readl, (char *)a);
      j = is1 * is2 - 1;
      for (i = j; i >= 0; i--)
        data[i] = (int)a[i];
      readl = nover * sizeof(unsigned int) * 2;
      b = (unsigned int *)malloc(readl);
      dskbr_(&lun, (char *)b, &readl, &istat);
      if (cbo == 0)
        swpbyt(1, readl, (char *)b);
      for (i = 0; i < nover; i++) {
        mar_getover(b, i, &x, &y, &val);
        if (filec_debug)
          printf("Overflow (%d,%d) : %d\n", x, y, val);
        data[y * is1 + x] = val;
      }
      free((char *)b);
    }
    if (filec_debug)
      printf("Read Completion status : %d\n", istat);
  } else
    istat = -1;
close:
  if (filec_debug)
    printf("Done reading MAR image (size %d x %d) (istat %d)\n", is1, is2, istat);
  if (istat != 0)
    dskbcr_(&lun, &i);
  else
    dskbcr_(&lun, &istat);
  if (filec_debug)
    printf("RDMAR completion status %d\n", istat);
  if (istat != 0) {
    if (*array != 0)
      free(*array);
    if (*head != 0)
      free(*head);
    return istat;
  } else
    return 0;
}
```