user: 请从给定的汇编指令推导出C源代码:

```asm
<rdmar>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x98,%rsp
  mov    %rdi,%r14
  mov    %rsi,%rbp
  mov    %rdx,0x10(%rsp)
  mov    %rcx,%r12
  mov    %r8,0x18(%rsp)
  mov    %r9,0x20(%rsp)
  mov    0x10d0(%rsp),%r15
  mov    %fs:0x28,%rax
  mov    %rax,0x1088(%rsp)
  xor    %eax,%eax
  movl   $0x1,0x4c(%rsp)
  call   <filec_getdebug@plt>
  mov    %eax,%ebx
  movq   $0x0,(%r12)
  movq   $0x0,0x0(%rbp)
  mov    $0x0,%eax
  call   <getbo@plt>
  mov    %eax,%r13d
  mov    %r14,%rdi
  call   <strlen@plt>
  mov    %eax,0x44(%rsp)
  test   %ebx,%ebx
  jne    L241
  lea    0x48(%rsp),%rcx
  lea    0x44(%rsp),%rdx
  lea    0x4c(%rsp),%rdi
  mov    %r14,%rsi
  call   <dskbor_@plt>
  cmpl   $0x0,0x48(%rsp)
  jne    L207
  movl   $0x1,0x50(%rsp)
  lea    0x50(%rsp),%rsi
  lea    0x4c(%rsp),%r14
  mov    %r14,%rdi
  call   <dskbwr_@plt>
  movl   $0x200,0x3c(%rsp)
  lea    0x48(%rsp),%rcx
  lea    0x3c(%rsp),%rdx
  lea    0x8b0(%rsp),%rsi
  mov    %r14,%rdi
  call   <dskbr_@plt>
  cmpl   $0x0,0x48(%rsp)
  je     L194
L280:
  lea    0x40(%rsp),%rsi
  lea    0x4c(%rsp),%rdi
  call   <dskbcr_@plt>
L353:
  test   %ebx,%ebx
  jne    L162
L145:
  mov    0x48(%rsp),%eax
  test   %eax,%eax
  je     L357
  mov    (%r12),%rdi
  test   %rdi,%rdi
  je     L54
  call   <free@plt>
L54:
  mov    0x0(%rbp),%rdi
  test   %rdi,%rdi
  je     L103
  call   <free@plt>
L103:
  mov    0x48(%rsp),%eax
L357:
  mov    0x1088(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L446
  add    $0x1098,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L241:
  mov    %r14,%rsi
  lea    D144(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    0x48(%rsp),%rcx
  lea    0x44(%rsp),%rdx
  lea    0x4c(%rsp),%rdi
  mov    %r14,%rsi
  call   <dskbor_@plt>
  cmpl   $0x0,0x48(%rsp)
  jne    L132
  movl   $0x1,0x50(%rsp)
  lea    D86(%rip),%rdi
  call   <puts@plt>
  lea    0x50(%rsp),%rsi
  lea    0x4c(%rsp),%r14
  mov    %r14,%rdi
  call   <dskbwr_@plt>
  movl   $0x200,0x3c(%rsp)
  lea    0x48(%rsp),%rcx
  lea    0x3c(%rsp),%rdx
  lea    0x8b0(%rsp),%rsi
  mov    %r14,%rdi
  call   <dskbr_@plt>
  mov    0x48(%rsp),%esi
  lea    D8(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  cmpl   $0x0,0x48(%rsp)
  jne    L354
L194:
  lea    0x8b0(%rsp),%rsi
  lea    0x60(%rsp),%rdi
  mov    $0x8,%edx
  call   <memcpy@plt>
  test   %ebx,%ebx
  je     L329
  test   %r13d,%r13d
  jne    L452
  lea    D143(%rip),%rdi
  call   <puts@plt>
L37:
  lea    0x60(%rsp),%rdx
  mov    $0x8,%esi
  mov    $0x1,%edi
  call   <swpbyt@plt>
  test   %ebx,%ebx
  je     L302
  jmp    L254
L452:
  lea    D109(%rip),%rdi
  call   <puts@plt>
L254:
  mov    0x64(%rsp),%edx
  mov    0x60(%rsp),%esi
  lea    D4(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L302
L399:
  cmpl   $0x7d0,0x64(%rsp)
  jne    L250
L431:
  mov    0x64(%rsp),%eax
  mov    %eax,0xc(%rsp)
  test   %ebx,%ebx
  jne    L374
  lea    -0x200(%r14,%r14,1),%eax
  mov    %eax,0x3c(%rsp)
  lea    0x48(%rsp),%rcx
  lea    0x3c(%rsp),%rdx
  lea    0x8b0(%rsp),%rax
  lea    0x4c(%rsp),%rdi
  mov    %rax,0x28(%rsp)
  mov    %rax,%rsi
  call   <dskbr_@plt>
  mov    0x28(%rsp),%rdi
  call   <mar_getnover@plt>
  mov    %eax,0x28(%rsp)
L169:
  mov    0x10(%rsp),%rax
  movl   $0x1000,(%rax)
  mov    $0x1000,%edi
  call   <malloc@plt>
  mov    %rax,%rdi
  mov    %rax,0x0(%rbp)
  mov    $0x1000,%edx
  mov    $0x0,%esi
  call   <memset@plt>
  mov    0x0(%rbp),%rdi
  call   <clrhd@plt>
  lea    0x8b0(%rsp),%rdi
  mov    0x0(%rbp),%rsi
  call   <mar_putheader@plt>
  mov    0x18(%rsp),%rax
  movl   $0x2,(%rax)
  mov    0x20(%rsp),%rax
  mov    %r14d,(%rax)
  mov    0xc(%rsp),%ecx
  mov    %ecx,0x4(%rax)
  mov    0x0(%rbp),%rdx
  lea    D186(%rip),%rsi
  lea    D121(%rip),%rdi
  call   <puthd@plt>
  lea    0x860(%rsp),%rax
  mov    %r14d,%edx
  lea    D161(%rip),%rsi
  mov    %rax,0x10(%rsp)
  mov    %rax,%rdi
  call   <sprintf@plt>
  mov    0x0(%rbp),%rdx
  mov    0x10(%rsp),%rsi
  lea    D66(%rip),%rdi
  call   <puthd@plt>
  mov    %r14d,%edx
  lea    D161(%rip),%rsi
  mov    0x10(%rsp),%rdi
  call   <sprintf@plt>
  mov    0x0(%rbp),%rdx
  mov    0x10(%rsp),%rsi
  lea    D184(%rip),%rdi
  call   <puthd@plt>
  test   %ebx,%ebx
  jne    L186
L19:
  cmpl   $0x0,0x28(%rsp)
  jle    L216
  movl   $0x5,(%r15)
  mov    0xc(%rsp),%eax
  imul   %r14d,%eax
  mov    %eax,0x10(%rsp)
  lea    0x0(,%rax,4),%edi
  call   <malloc@plt>
  mov    %rax,%r15
  mov    %rax,(%r12)
  mov    0x10(%rsp),%eax
  add    %eax,%eax
  mov    %eax,0x3c(%rsp)
  lea    0x48(%rsp),%rcx
  lea    0x3c(%rsp),%rdx
  lea    0x4c(%rsp),%rdi
  mov    %r15,%rsi
  call   <dskbr_@plt>
  test   %r13d,%r13d
  je     L269
L243:
  mov    0x10(%rsp),%eax
  sub    $0x1,%eax
  mov    %eax,0x44(%rsp)
  mov    %eax,0x40(%rsp)
  js     L424
L345:
  cltq
  lea    (%r15,%rax,2),%rdx
  movzwl (%rdx),%ecx
  mov    %ecx,(%rdx,%rax,2)
  mov    0x40(%rsp),%eax
  sub    $0x1,%eax
  mov    %eax,0x40(%rsp)
  jns    L345
L424:
  mov    0x28(%rsp),%eax
  lea    0x0(,%rax,8),%edi
  mov    %edi,0x3c(%rsp)
  call   <malloc@plt>
  mov    %rax,0x10(%rsp)
  lea    0x48(%rsp),%rcx
  lea    0x3c(%rsp),%rdx
  lea    0x4c(%rsp),%rdi
  mov    %rax,%rsi
  call   <dskbr_@plt>
  test   %r13d,%r13d
  je     L126
L213:
  movl   $0x0,0x40(%rsp)
  mov    $0x0,%esi
  lea    D175(%rip),%r13
  jmp    L384
L343:
  cmpl   $0x4b0,0x64(%rsp)
  jne    L250
  jmp    L431
L374:
  mov    %eax,%edx
  mov    %r14d,%esi
  lea    D101(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    -0x200(%r14,%r14,1),%eax
  mov    %eax,0x3c(%rsp)
  lea    0x48(%rsp),%rcx
  lea    0x3c(%rsp),%rdx
  lea    0x8b0(%rsp),%rax
  lea    0x4c(%rsp),%rdi
  mov    %rax,0x28(%rsp)
  mov    %rax,%rsi
  call   <dskbr_@plt>
  mov    0x28(%rsp),%rdi
  call   <mar_getnover@plt>
  mov    %eax,0x28(%rsp)
  mov    %eax,%esi
  lea    D195(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L169
L186:
  mov    0x0(%rbp),%rsi
  lea    D53(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L19
L216:
  movl   $0x4,(%r15)
  mov    0x0(%rbp),%rdx
  lea    D115(%rip),%rsi
  lea    D97(%rip),%rdi
  call   <puthd@plt>
  mov    0xc(%rsp),%edi
  imul   %r14d,%edi
  add    %edi,%edi
  mov    %edi,0x3c(%rsp)
  call   <malloc@plt>
  mov    %rax,%r15
  mov    %rax,(%r12)
  lea    0x48(%rsp),%rcx
  lea    0x3c(%rsp),%rdx
  lea    0x4c(%rsp),%rdi
  mov    %rax,%rsi
  call   <dskbr_@plt>
  test   %r13d,%r13d
  jne    L392
  mov    %r15,%rdx
  mov    0x3c(%rsp),%esi
  mov    $0x0,%edi
  call   <swpbyt@plt>
  jmp    L392
L269:
  mov    %r15,%rdx
  mov    0x3c(%rsp),%esi
  mov    $0x0,%edi
  call   <swpbyt@plt>
  jmp    L243
L126:
  mov    0x10(%rsp),%rdx
  mov    0x3c(%rsp),%esi
  mov    $0x1,%edi
  call   <swpbyt@plt>
  jmp    L213
L444:
  mov    %r14d,%eax
  imul   0x58(%rsp),%eax
  add    0x54(%rsp),%eax
  cltq
  mov    0x5c(%rsp),%edx
  mov    %edx,(%r15,%rax,4)
  mov    0x40(%rsp),%eax
  lea    0x1(%rax),%esi
  mov    %esi,0x40(%rsp)
  cmp    0x28(%rsp),%esi
  jge    L127
L384:
  lea    0x58(%rsp),%rcx
  lea    0x54(%rsp),%rdx
  lea    0x5c(%rsp),%r8
  mov    0x10(%rsp),%rdi
  call   <mar_getover@plt>
  test   %ebx,%ebx
  je     L444
  mov    0x5c(%rsp),%ecx
  mov    0x58(%rsp),%edx
  mov    0x54(%rsp),%esi
  mov    %r13,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L444
L127:
  mov    0x10(%rsp),%rdi
  call   <free@plt>
L392:
  test   %ebx,%ebx
  je     L184
  mov    0x48(%rsp),%esi
  lea    D8(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L83
L162:
  mov    0x48(%rsp),%esi
  lea    D2(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L145
L132:
  mov    $0xffffffff,%eax
  jmp    L357
L207:
  mov    $0xffffffff,%eax
  jmp    L357
L329:
  test   %r13d,%r13d
  je     L37
L302:
  mov    0x60(%rsp),%r14d
  cmp    $0x7d0,%r14d
  je     L399
  cmp    $0x4b0,%r14d
  je     L343
L250:
  movl   $0xffffffff,0x48(%rsp)
L354:
  movl   $0x0,0xc(%rsp)
  mov    $0x0,%r14d
  test   %ebx,%ebx
  je     L280
L83:
  mov    0x48(%rsp),%ecx
  mov    0xc(%rsp),%edx
  mov    %r14d,%esi
  lea    D112(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L184:
  cmpl   $0x0,0x48(%rsp)
  jne    L280
  lea    0x48(%rsp),%rsi
  lea    0x4c(%rsp),%rdi
  call   <dskbcr_@plt>
  jmp    L353
L446:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: label: D144
type_guessed: string
name: extract_symbolic_data
arguments: label: D86
type_guessed: string
name: extract_symbolic_data
arguments: label: D8
type_guessed: string
name: extract_symbolic_data
arguments: label: D143
type_guessed: string
name: extract_symbolic_data
arguments: label: D109
type_guessed: string
name: extract_symbolic_data
arguments: label: D4
type_guessed: string
name: extract_symbolic_data
arguments: label: D186
type_guessed: string
name: extract_symbolic_data
arguments: label: D121
type_guessed: string
name: extract_symbolic_data
arguments: label: D161
type_guessed: string
name: extract_symbolic_data
arguments: label: D66
type_guessed: string
name: extract_symbolic_data
arguments: label: D184
type_guessed: string
name: extract_symbolic_data
arguments: label: D175
type_guessed: string
name: extract_symbolic_data
arguments: label: D101
type_guessed: string
name: extract_symbolic_data
arguments: label: D195
type_guessed: string
name: extract_symbolic_data
arguments: label: D53
type_guessed: string
name: extract_symbolic_data
arguments: label: D115
type_guessed: string
name: extract_symbolic_data
arguments: label: D97
type_guessed: string
name: extract_symbolic_data
arguments: label: D2
type_guessed: string
name: extract_symbolic_data
arguments: label: D112
type_guessed: string

tool: D144: Opening file: %s


tool: D86: Reading header

tool: D8: Read Completion status : %d


tool: D143: This computer is little endian

tool: D109: This computer is big endian

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


tool: D186: 2

tool: D121: DIM

tool: D161: %d

tool: D66: SIZE1

tool: D184: SIZE2

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


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


tool: D195: Number of overflow pixels %d


tool: D53: Updated Header        : 
%s<END


tool: D115: unsigned_short

tool: D97: TYPE

tool: D2: RDMAR completion status %d


tool: D112: Done reading MAR image (size %d x %d) (istat %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;
}
```