user: 下面的汇编指令对应的C源代码是什么:

```asm
<rdsmv>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  lea    -0x5000(%rsp),%r11
L622:
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  cmp    %r11,%rsp
  jne    L622
  sub    $0x138,%rsp
  mov    0x5170(%rsp),%rax
  mov    %rdx,(%rsp)
  mov    %rsi,%rbx
  mov    %rcx,%r14
  mov    %rdi,%r12
  mov    %rcx,0x8(%rsp)
  mov    %r8,0x10(%rsp)
  mov    %r9,0x20(%rsp)
  mov    %rax,0x28(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x5128(%rsp)
  xor    %eax,%eax
  movl   $0x1,0x74(%rsp)
  call   <filec_getdebug@plt>
  movq   $0x0,(%rbx)
  mov    %r12,%rdi
  movq   $0x0,(%r14)
  mov    %eax,%r15d
  call   <strlen@plt>
  mov    %eax,0x64(%rsp)
  test   %r15d,%r15d
  jne    L588
  lea    0x6c(%rsp),%r14
  lea    0x74(%rsp),%rbp
  mov    %r12,%rsi
  xor    %eax,%eax
  lea    0x64(%rsp),%rdx
  mov    %r14,%rcx
  mov    %rbp,%rdi
  call   <dskbor_@plt>
  mov    0x6c(%rsp),%eax
  test   %eax,%eax
  jne    L1548
  lea    0x78(%rsp),%r12
  mov    %rbp,%rdi
  xor    %eax,%eax
  movl   $0x1,0x78(%rsp)
  mov    %r12,%rsi
  call   <dskbwr_@plt>
  mov    $0x1,%esi
  mov    $0x200,%edi
  movl   $0x200,0x5c(%rsp)
  call   <calloc@plt>
  mov    %r14,%rcx
  mov    %rbp,%rdi
  mov    %rax,%r13
  lea    0x5c(%rsp),%rax
  mov    %rax,0x18(%rsp)
  mov    %rax,%rdx
  mov    %r13,%rsi
  xor    %eax,%eax
  call   <dskbr_@plt>
L580:
  mov    0x6c(%rsp),%eax
  mov    %eax,0x30(%rsp)
  test   %eax,%eax
  je     L1500
L917:
  mov    $0xfffffffe,%eax
L759:
  mov    %eax,0x6c(%rsp)
  test   %r15d,%r15d
  jne    L1318
L1069:
  mov    %rbp,%rdi
  lea    0x60(%rsp),%rsi
  xor    %eax,%eax
  call   <dskbcr_@plt>
  mov    (%rbx),%rdi
  test   %rdi,%rdi
  je     L1225
  call   <free@plt>
L1225:
  mov    0x8(%rsp),%rax
  mov    (%rax),%rdi
  test   %rdi,%rdi
  je     L304
  call   <free@plt>
L304:
  test   %r15d,%r15d
  jne    L1024
L602:
  mov    0x6c(%rsp),%eax
L347:
  mov    0x5128(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L608
  add    $0x5138,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L1500:
  lea    0x68(%rsp),%rdi
  mov    %r13,%rsi
  xor    %eax,%eax
  call   <gethdl@plt>
  mov    %eax,0x6c(%rsp)
  test   %eax,%eax
  js     L486
  test   %r15d,%r15d
  jne    L925
L857:
  mov    0x68(%rsp),%r8d
  test   %r8d,%r8d
  lea    0x3ff(%r8),%eax
  mov    %r8d,0x38(%rsp)
  cmovns %r8d,%eax
  and    $0xfffffc00,%eax
  lea    0x400(%rax),%edi
  mov    (%rsp),%rax
  mov    %edi,(%rax)
  movslq %edi,%rdi
  call   <malloc@plt>
  xor    %esi,%esi
  mov    %rax,%r9
  mov    %rax,(%rbx)
  mov    (%rsp),%rax
  mov    %r9,%rdi
  movslq (%rax),%rdx
  call   <memset@plt>
  mov    $0x40,%ecx
  mov    %r13,%rsi
  mov    %rax,%rdi
  mov    %rax,(%rsp)
  rep movsq %ds:(%rsi),%es:(%rdi)
  mov    %r13,%rdi
  call   <free@plt>
  mov    0x38(%rsp),%r8d
  lea    -0x200(%r8),%eax
  mov    %eax,0x5c(%rsp)
  test   %eax,%eax
  jle    L1164
  mov    (%rsp),%r9
  mov    0x18(%rsp),%rdx
  mov    %r14,%rcx
  mov    %rbp,%rdi
  xor    %eax,%eax
  lea    0x200(%r9),%rsi
  call   <dskbr_@plt>
  mov    0x6c(%rsp),%r10d
  test   %r10d,%r10d
  jne    L917
L1164:
  mov    %r12,%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  movl   $0x0,0x78(%rsp)
  call   <dskbwr_@plt>
  mov    0x10(%rsp),%rax
  mov    (%rbx),%rdx
  lea    0x80(%rsp),%r13
  mov    %r13,%rsi
  lea    D495(%rip),%rdi
  movl   $0x0,(%rax)
  xor    %eax,%eax
  call   <gethd@plt>
  cmpb   $0x0,0x80(%rsp)
  jne    L1066
L762:
  test   %r15d,%r15d
  je     L417
  lea    D318(%rip),%rdi
  call   <puts@plt>
L1318:
  lea    D529(%rip),%rdi
  call   <puts@plt>
L417:
  mov    0x6c(%rsp),%edx
  test   %edx,%edx
  jne    L1069
  xor    %eax,%eax
  mov    %r14,%rsi
  mov    %rbp,%rdi
  call   <dskbcr_@plt>
  test   %r15d,%r15d
  je     L602
L1024:
  mov    0x6c(%rsp),%esi
  lea    D412(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L602
  nopl   (%rax)
L588:
  mov    %r12,%rsi
  lea    0x6c(%rsp),%r14
  lea    0x74(%rsp),%rbp
  xor    %eax,%eax
  lea    D30(%rip),%rdi
  call   <printf@plt>
  lea    0x64(%rsp),%rdx
  mov    %r14,%rcx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <dskbor_@plt>
  mov    0x6c(%rsp),%edx
  test   %edx,%edx
  jne    L1674
  lea    0x78(%rsp),%r12
  mov    %rbp,%rdi
  xor    %eax,%eax
  movl   $0x1,0x78(%rsp)
  mov    %r12,%rsi
  call   <dskbwr_@plt>
  mov    $0x1,%esi
  mov    $0x200,%edi
  movl   $0x200,0x5c(%rsp)
  call   <calloc@plt>
  lea    D423(%rip),%rdi
  mov    %rax,%r13
  call   <puts@plt>
  lea    0x5c(%rsp),%rax
  mov    %r13,%rsi
  mov    %rbp,%rdi
  mov    %rax,0x18(%rsp)
  mov    %rax,%rdx
  mov    %r14,%rcx
  xor    %eax,%eax
  call   <dskbr_@plt>
  mov    0x6c(%rsp),%esi
  lea    D572(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L580
  nopl   0x0(%rax,%rax,1)
L1066:
  lea    0x70(%rsp),%rdx
  lea    D564(%rip),%rsi
  mov    %r13,%rdi
  xor    %eax,%eax
  call   <sscanf@plt>
  mov    %eax,(%rsp)
  cmp    $0x1,%eax
  jne    L762
  test   %r15d,%r15d
  jne    L1089
L534:
  mov    0x70(%rsp),%eax
  mov    0x10(%rsp),%rcx
  movl   $0x0,0x60(%rsp)
  mov    %eax,(%rcx)
  test   %eax,%eax
  jle    L1135
  lea    0xd0(%rsp),%rcx
  mov    $0x1,%esi
  mov    %r15d,0x10(%rsp)
  xor    %eax,%eax
  mov    %r14,0x38(%rsp)
  mov    %esi,%r15d
  mov    0x20(%rsp),%r14
  mov    %r12,0x48(%rsp)
  mov    %rcx,%r12
  mov    %rcx,0x40(%rsp)
  jmp    L1579
  cs nopw 0x0(%rax,%rax,1)
L1416:
  movslq 0x60(%rsp),%rax
  lea    D564(%rip),%rsi
  mov    %r13,%rdi
  lea    (%r14,%rax,4),%rdx
  xor    %eax,%eax
  call   <sscanf@plt>
  cmp    $0x1,%eax
  jne    L229
  movslq 0x60(%rsp),%rdx
  mov    %rdx,%rax
  imul   (%r14,%rdx,4),%r15d
  add    $0x1,%eax
  mov    %eax,0x60(%rsp)
  cmp    0x70(%rsp),%eax
  jge    L1031
L1579:
  lea    0x1(%rax),%edx
  lea    D80(%rip),%rsi
  mov    %r12,%rdi
  xor    %eax,%eax
  call   <sprintf@plt>
  mov    (%rbx),%rdx
  xor    %eax,%eax
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <gethd@plt>
  cmpb   $0x0,0x80(%rsp)
  jne    L1416
L229:
  mov    0x10(%rsp),%r15d
  mov    0x38(%rsp),%r14
  test   %r15d,%r15d
  je     L417
  mov    0x40(%rsp),%rsi
  lea    D68(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L1318
  cs nopw 0x0(%rax,%rax,1)
L486:
  mov    $0xfffffffc,%eax
  jmp    L759
  nopw   0x0(%rax,%rax,1)
L925:
  mov    0x68(%rsp),%esi
  lea    D246(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L857
  nopw   0x0(%rax,%rax,1)
L1089:
  mov    0x70(%rsp),%esi
  lea    D212(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L534
  nopw   0x0(%rax,%rax,1)
L1031:
  mov    0x38(%rsp),%r14
  mov    0x48(%rsp),%r12
  mov    %r15d,0x40(%rsp)
  mov    0x10(%rsp),%r15d
L1609:
  mov    (%rbx),%rdx
  xor    %eax,%eax
  mov    %r13,%rsi
  lea    D627(%rip),%rdi
  call   <gethd@plt>
  cmpb   $0x0,0x80(%rsp)
  je     L1402
  movabs $0x655f656c7474696c,%rax
  cmp    %rax,0x80(%rsp)
  je     L905
L329:
  movabs $0x69646e655f676962,%rax
  cmp    %rax,0x80(%rsp)
  jne    L486
  cmpw   $0x6e61,0x88(%rsp)
  jne    L486
  cmpb   $0x0,0x8a(%rsp)
  jne    L486
  movl   $0x1,0x10(%rsp)
L335:
  mov    (%rbx),%rdx
  xor    %eax,%eax
  mov    %r13,%rsi
  lea    D378(%rip),%rdi
  call   <gethd@plt>
  test   %r15d,%r15d
  jne    L1228
  movabs $0x64656e6769736e75,%rax
  cmp    %rax,0x80(%rsp)
  je     L1575
L630:
  cmpl   $0x65747962,0x80(%rsp)
  je     L495
L213:
  movabs $0x64656e6769736e75,%rax
  cmp    %rax,0x80(%rsp)
  je     L1334
L221:
  cmpl   $0x72616863,0x80(%rsp)
  je     L871
L1563:
  cmpl   $0x746962,0x80(%rsp)
  je     L1282
  lea    D56(%rip),%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L708
  lea    D543(%rip),%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L708
  lea    D347(%rip),%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L104
  lea    D587(%rip),%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L104
  lea    D385(%rip),%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L104
  lea    D91(%rip),%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L312
  lea    D461(%rip),%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L312
  lea    D156(%rip),%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L772
  lea    D189(%rip),%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L772
  lea    D350(%rip),%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L1289
  mov    0x20(%rsp),%rax
  mov    (%rax),%ecx
  mov    0x4(%rax),%eax
  mov    %ecx,0x10(%rsp)
  mov    %eax,0x20(%rsp)
  test   %r15d,%r15d
  jne    L413
L1665:
  cmpl   $0x2,0x70(%rsp)
  je     L904
  nopl   0x0(%rax,%rax,1)
L1605:
  test   %r15d,%r15d
  je     L417
  jmp    L1318
  xchg   %ax,%ax
L1548:
  mov    $0xfffffffd,%eax
  jmp    L347
L1402:
  movl   $0xffffffff,0x10(%rsp)
  jmp    L335
L1228:
  mov    %r13,%rsi
  lea    D475(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x70(%rsp),%esi
  lea    D21(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x70(%rsp),%r9d
  movl   $0x0,0x60(%rsp)
  xor    %eax,%eax
  test   %r9d,%r9d
  jle    L1107
  mov    %r15d,0x38(%rsp)
  mov    0x20(%rsp),%r15
  nopl   0x0(%rax,%rax,1)
L1438:
  cltq
  lea    D306(%rip),%rdi
  mov    (%r15,%rax,4),%esi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x60(%rsp),%eax
  add    $0x1,%eax
  mov    %eax,0x60(%rsp)
  cmp    0x70(%rsp),%eax
  jl     L1438
  mov    0x38(%rsp),%r15d
L1107:
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    0x40(%rsp),%esi
  lea    D281(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x10(%rsp),%r8d
  test   %r8d,%r8d
  je     L137
  lea    D677(%rip),%rdi
  call   <puts@plt>
L1704:
  movabs $0x64656e6769736e75,%rax
  cmp    %rax,0x80(%rsp)
  je     L1348
L831:
  cmpl   $0x65747962,0x80(%rsp)
  je     L765
L814:
  movabs $0x64656e6769736e75,%rax
  cmp    %rax,0x80(%rsp)
  je     L1706
L131:
  lea    D606(%rip),%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L1563
L1406:
  lea    D678(%rip),%rdi
  call   <puts@plt>
  movslq 0x40(%rsp),%r8
  mov    %r8,%rdi
  mov    %r8d,0x5c(%rsp)
  mov    %r8,(%rsp)
  call   <malloc@plt>
  mov    0x40(%rsp),%esi
  lea    D71(%rip),%rdi
  mov    %rax,%r13
  xor    %eax,%eax
  call   <printf@plt>
  lea    D451(%rip),%rdi
  call   <puts@plt>
  mov    0x18(%rsp),%rdx
  mov    %r14,%rcx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <dskbr_@plt>
  mov    0x6c(%rsp),%esi
  lea    D563(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x6c(%rsp),%esi
  test   %esi,%esi
  jne    L917
  mov    %r12,%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  movl   $0x1,0x78(%rsp)
  call   <dskbwr_@plt>
  mov    0x40(%rsp),%eax
  lea    D498(%rip),%rdi
  lea    (%rax,%rax,1),%esi
  xor    %eax,%eax
  mov    %esi,0x5c(%rsp)
  call   <printf@plt>
  mov    (%rsp),%r8
  lea    (%r8,%r8,1),%rdi
  call   <malloc@plt>
  mov    0x8(%rsp),%rcx
  mov    0x40(%rsp),%esi
  lea    D369(%rip),%rdi
  mov    %rax,%r12
  mov    %rax,(%rcx)
  mov    0x28(%rsp),%rcx
  xor    %eax,%eax
  movl   $0x4,(%rcx)
  call   <printf@plt>
L141:
  mov    0x40(%rsp),%ecx
  test   %ecx,%ecx
  jle    L1012
  mov    0x40(%rsp),%ecx
  lea    -0x1(%rcx),%eax
  cmp    $0xe,%eax
  jbe    L1600
  shr    $0x4,%ecx
  xor    %eax,%eax
  pxor   %xmm1,%xmm1
  mov    %ecx,%edx
  shl    $0x4,%rdx
  nopl   0x0(%rax)
L460:
  movdqu 0x0(%r13,%rax,1),%xmm0
  movdqa %xmm0,%xmm2
  punpckhbw %xmm1,%xmm0
  punpcklbw %xmm1,%xmm2
  movups %xmm0,0x10(%r12,%rax,2)
  movups %xmm2,(%r12,%rax,2)
  add    $0x10,%rax
  cmp    %rax,%rdx
  jne    L460
  mov    0x40(%rsp),%ecx
  mov    %ecx,%esi
  and    $0xfffffff0,%esi
  mov    %esi,%edx
  mov    %esi,0x30(%rsp)
  lea    0x0(%r13,%rdx,1),%rax
  lea    (%r12,%rdx,2),%r12
  cmp    %esi,%ecx
  je     L1012
L1117:
  movzbl (%rax),%edx
  mov    0x30(%rsp),%ecx
  mov    0x40(%rsp),%esi
  mov    %dx,(%r12)
  lea    0x1(%rcx),%edx
  cmp    %esi,%edx
  jge    L1012
  movzbl 0x1(%rax),%edx
  mov    %dx,0x2(%r12)
  lea    0x2(%rcx),%edx
  cmp    %esi,%edx
  jge    L1012
  movzbl 0x2(%rax),%edx
  mov    %dx,0x4(%r12)
  lea    0x3(%rcx),%edx
  cmp    %esi,%edx
  jge    L1012
  movzbl 0x3(%rax),%edx
  mov    %dx,0x6(%r12)
  lea    0x4(%rcx),%edx
  cmp    %esi,%edx
  jge    L1012
  movzbl 0x4(%rax),%edx
  mov    %dx,0x8(%r12)
  lea    0x5(%rcx),%edx
  cmp    %esi,%edx
  jge    L1012
  movzbl 0x5(%rax),%edx
  mov    %dx,0xa(%r12)
  lea    0x6(%rcx),%edx
  cmp    %esi,%edx
  jge    L1012
  movzbl 0x6(%rax),%edx
  mov    %dx,0xc(%r12)
  lea    0x7(%rcx),%edx
  cmp    %esi,%edx
  jge    L1012
  movzbl 0x7(%rax),%edx
  mov    %dx,0xe(%r12)
  lea    0x8(%rcx),%edx
  cmp    %esi,%edx
  jge    L1012
  movzbl 0x8(%rax),%edx
  mov    %dx,0x10(%r12)
  lea    0x9(%rcx),%edx
  cmp    %esi,%edx
  jge    L1012
  movzbl 0x9(%rax),%edx
  mov    %dx,0x12(%r12)
  lea    0xa(%rcx),%edx
  cmp    %esi,%edx
  jge    L1012
  movzbl 0xa(%rax),%edx
  mov    %dx,0x14(%r12)
  lea    0xb(%rcx),%edx
  cmp    %esi,%edx
  jge    L1012
  movzbl 0xb(%rax),%edx
  mov    %dx,0x16(%r12)
  lea    0xc(%rcx),%edx
  cmp    %esi,%edx
  jge    L1012
  movzbl 0xc(%rax),%edx
  mov    %dx,0x18(%r12)
  lea    0xd(%rcx),%edx
  cmp    %esi,%edx
  jge    L1012
  movzbl 0xd(%rax),%edx
  add    $0xe,%ecx
  mov    %dx,0x1a(%r12)
  cmp    %esi,%ecx
  jge    L1012
  movzbl 0xe(%rax),%eax
  mov    %ax,0x1c(%r12)
L1012:
  mov    %r13,%rdi
  call   <free@plt>
  jmp    L1605
L1674:
  mov    %r12,%rsi
  lea    D256(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0xfffffffd,%eax
  jmp    L347
L905:
  cmpl   $0x6169646e,0x88(%rsp)
  jne    L329
  cmpw   $0x6e,0x8c(%rsp)
  jne    L329
  movl   $0x0,0x10(%rsp)
  jmp    L335
L1575:
  cmpl   $0x7479625f,0x88(%rsp)
  jne    L630
  cmpw   $0x65,0x8c(%rsp)
  jne    L630
L873:
  movslq 0x40(%rsp),%r8
  mov    %r8,%rdi
  mov    %r8d,0x5c(%rsp)
  mov    %r8,(%rsp)
  call   <malloc@plt>
  mov    0x18(%rsp),%rdx
  mov    %rbp,%rdi
  mov    %r14,%rcx
  mov    %rax,%rsi
  mov    %rax,%r13
  xor    %eax,%eax
  call   <dskbr_@plt>
  mov    0x6c(%rsp),%edi
  test   %edi,%edi
  jne    L917
  mov    %r12,%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  movl   $0x1,0x78(%rsp)
  call   <dskbwr_@plt>
  mov    (%rsp),%r8
  lea    (%r8,%r8,1),%rdi
  call   <malloc@plt>
  mov    %rax,%r12
  mov    0x8(%rsp),%rax
  mov    %r12,(%rax)
  mov    0x28(%rsp),%rax
  movl   $0x4,(%rax)
  jmp    L141
L137:
  lea    D249(%rip),%rdi
  call   <puts@plt>
  jmp    L1704
L1135:
  movl   $0x1,0x40(%rsp)
  jmp    L1609
L1348:
  cmpl   $0x7479625f,0x88(%rsp)
  jne    L831
  cmpw   $0x65,0x8c(%rsp)
  jne    L831
  jmp    L1406
L495:
  cmpb   $0x0,0x84(%rsp)
  je     L873
  jmp    L213
L1334:
  cmpl   $0x6168635f,0x88(%rsp)
  jne    L221
  cmpw   $0x72,0x8c(%rsp)
  jne    L221
  jmp    L873
L765:
  cmpb   $0x0,0x84(%rsp)
  je     L1406
  jmp    L814
L1600:
  mov    %r13,%rax
  jmp    L1117
L1706:
  cmpl   $0x6168635f,0x88(%rsp)
  jne    L131
  cmpw   $0x72,0x8c(%rsp)
  jne    L131
  jmp    L1406
L871:
  cmpb   $0x0,0x84(%rsp)
  jne    L1563
  jmp    L873
L708:
  mov    0x40(%rsp),%edx
  add    %edx,%edx
  test   %r15d,%r15d
  jne    L1255
  movslq %edx,%rdi
  mov    %edx,0x5c(%rsp)
  call   <malloc@plt>
  mov    0x18(%rsp),%rdx
  mov    %r14,%rcx
  mov    %rbp,%rdi
  mov    %rax,%rsi
  mov    0x8(%rsp),%rax
  mov    %rsi,(%rax)
  mov    0x28(%rsp),%rax
  movl   $0x4,(%rax)
  xor    %eax,%eax
  call   <dskbr_@plt>
L1083:
  cmpl   $0x0,0x6c(%rsp)
  jne    L917
  xor    %eax,%eax
  mov    %r12,%rsi
  mov    %rbp,%rdi
  movl   $0x1,0x78(%rsp)
  call   <dskbwr_@plt>
  xor    %eax,%eax
  call   <getbo@plt>
  cmp    0x10(%rsp),%eax
  je     L1605
  test   %r15d,%r15d
  jne    L244
L482:
  mov    0x8(%rsp),%rax
  mov    0x5c(%rsp),%esi
  xor    %edi,%edi
  mov    (%rax),%rdx
  xor    %eax,%eax
  call   <swpbyt@plt>
  jmp    L1605
L1282:
  movslq 0x40(%rsp),%rax
  mov    %rax,%rdx
  mov    %rax,(%rsp)
  sar    $0x3,%rax
  shr    $0x3,%rdx
  mov    %rax,%r13
  test   %r15d,%r15d
  jne    L1657
  mov    %rax,%rdi
  mov    %edx,0x5c(%rsp)
  call   <malloc@plt>
  mov    0x18(%rsp),%rdx
  mov    %r14,%rcx
  mov    %rbp,%rdi
  mov    %rax,%r13
  mov    %rax,%rsi
  xor    %eax,%eax
  call   <dskbr_@plt>
L1231:
  cmpl   $0x0,0x6c(%rsp)
  jne    L917
  mov    %r12,%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  movl   $0x1,0x78(%rsp)
  call   <dskbwr_@plt>
  mov    (%rsp),%rdi
  add    %rdi,%rdi
  call   <malloc@plt>
  mov    %rax,%rcx
  mov    0x8(%rsp),%rax
  mov    %rcx,(%rax)
  mov    0x28(%rsp),%rax
  movl   $0x4,(%rax)
  mov    0x40(%rsp),%eax
  test   %eax,%eax
  jle    L1012
  sub    $0x1,%eax
  movdqa D422(%rip),%xmm1
  mov    %r13,%rsi
  mov    %eax,%edx
  shr    $0x3,%edx
  add    $0x1,%edx
  add    %r13,%rdx
L629:
  movzbl (%rsi),%eax
  add    $0x1,%rsi
  add    $0x10,%rcx
  movd   %eax,%xmm0
  punpcklwd %xmm0,%xmm0
  pshufd $0x0,%xmm0,%xmm0
  pand   %xmm1,%xmm0
  movups %xmm0,-0x10(%rcx)
  cmp    %rsi,%rdx
  jne    L629
  movl   $0x8,0x64(%rsp)
  jmp    L1012
L608:
  call   <__stack_chk_fail@plt>
L1657:
  lea    D270(%rip),%r8
  mov    %rdx,0x10(%rsp)
  mov    %r8,%rdi
  call   <puts@plt>
  mov    0x10(%rsp),%rdx
  mov    %r13,%rdi
  mov    %edx,0x5c(%rsp)
  call   <malloc@plt>
  lea    D270(%rip),%r8
  mov    %r8,%rdi
  mov    %rax,%r13
  call   <puts@plt>
  mov    0x18(%rsp),%rdx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  mov    %r14,%rcx
  xor    %eax,%eax
  call   <dskbr_@plt>
  mov    0x6c(%rsp),%esi
  lea    D572(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L1231
L1255:
  lea    D641(%rip),%r13
  mov    %edx,(%rsp)
  mov    %r13,%rdi
  call   <puts@plt>
  mov    (%rsp),%edx
  mov    %r13,%rdi
  mov    %edx,0x5c(%rsp)
  call   <puts@plt>
  mov    0x5c(%rsp),%esi
  lea    D607(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  movslq 0x5c(%rsp),%rdi
  call   <malloc@plt>
  mov    0x18(%rsp),%rdx
  mov    %rbp,%rdi
  mov    %r14,%rcx
  mov    %rax,%rsi
  mov    0x8(%rsp),%rax
  mov    %rsi,(%rax)
  mov    0x28(%rsp),%rax
  movl   $0x4,(%rax)
  xor    %eax,%eax
  call   <dskbr_@plt>
  mov    0x6c(%rsp),%esi
  lea    D572(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L1083
L244:
  lea    D179(%rip),%rdi
  call   <puts@plt>
  jmp    L482
L104:
  mov    0x40(%rsp),%r13d
  shl    $0x2,%r13d
  test   %r15d,%r15d
  jne    L585
  movslq %r13d,%rdi
  mov    %r13d,0x5c(%rsp)
  call   <malloc@plt>
  mov    %rax,%rsi
  mov    0x8(%rsp),%rax
  mov    %rsi,(%rax)
  mov    0x28(%rsp),%rax
  movl   $0x5,(%rax)
L897:
  mov    0x18(%rsp),%rdx
  mov    %r14,%rcx
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <dskbr_@plt>
L511:
  cmpl   $0x0,0x6c(%rsp)
  jne    L917
  xor    %eax,%eax
  mov    %r12,%rsi
  mov    %rbp,%rdi
  movl   $0x1,0x78(%rsp)
  call   <dskbwr_@plt>
  xor    %eax,%eax
  call   <getbo@plt>
  cmp    0x10(%rsp),%eax
  je     L1605
  test   %r15d,%r15d
  jne    L898
L182:
  mov    0x8(%rsp),%rax
  mov    0x5c(%rsp),%esi
  mov    $0x1,%edi
  mov    (%rax),%rdx
  xor    %eax,%eax
  call   <swpbyt@plt>
  jmp    L1605
L904:
  mov    0x40(%rsp),%eax
  add    %eax,%eax
  movslq %eax,%rdi
  mov    %eax,0x5c(%rsp)
  call   <malloc@plt>
  mov    0x8(%rsp),%rcx
  mov    %rax,(%rcx)
  xor    %eax,%eax
  call   <getbo@plt>
  mov    %eax,0x18(%rsp)
  test   %eax,%eax
  je     L829
  sub    $0x1,%eax
  movl   $0x0,(%rsp)
  sete   %al
  movzbl %al,%eax
  mov    %eax,0x18(%rsp)
L829:
  lea    0x7c(%rsp),%r12
  mov    %r14,%rcx
  mov    %rbp,%rdi
  xor    %eax,%eax
  lea    0x120(%rsp),%r13
  mov    %r12,%rdx
  movl   $0x2,0x7c(%rsp)
  mov    %r13,%rsi
  call   <dskbr_@plt>
  mov    0x6c(%rsp),%edx
  test   %edx,%edx
  jne    L578
  mov    0x7c(%rsp),%eax
  lea    -0x2(%rax),%ecx
  sub    $0x1,%eax
  movslq %ecx,%rcx
  cltq
  movzbl 0x120(%rsp,%rcx,1),%ecx
  movzbl 0x120(%rsp,%rax,1),%eax
  shl    $0x8,%ecx
  add    %ecx,%eax
  mov    %eax,0x7c(%rsp)
  mov    0x20(%rsp),%eax
  sub    $0x1,%eax
  mov    %eax,0x38(%rsp)
  movslq 0x10(%rsp),%rax
  mov    %rax,0x40(%rsp)
  movslq 0x18(%rsp),%rax
  mov    %rax,0x48(%rsp)
L1101:
  mov    %edx,0x64(%rsp)
  cmp    %edx,0x38(%rsp)
  jle    L1705
  test   %r15d,%r15d
  jne    L1265
  xor    %eax,%eax
  mov    %r14,%rcx
  mov    %r12,%rdx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <dskbr_@plt>
  cmpl   $0x0,0x6c(%rsp)
  jne    L578
L688:
  mov    0x40(%rsp),%rax
  lea    0x2920(%rsp),%r9
  mov    0x60(%rsp),%esi
  mov    %r9,%rdx
  lea    0x0(%r13,%rax,1),%r8
  movslq 0x7c(%rsp),%rax
  mov    %r8,0x30(%rsp)
  lea    -0x2(%r13,%rax,1),%r10
  xor    %eax,%eax
  jmp    L1429
L1470:
  movzbl (%r8),%r11d
  movzbl 0x1(%r8),%eax
  mov    %rdx,%rdi
  add    $0x2,%r8
  mov    %r11,%rcx
  mov    %r11,%rsi
  rep stos %al,%es:(%rdi)
  mov    $0x1,%eax
  mov    %rdi,%rdx
L1429:
  cmp    %r8,%r10
  ja     L1470
  test   %al,%al
  je     L1278
  mov    %esi,0x60(%rsp)
L1278:
  test   %r15d,%r15d
  jne    L46
L587:
  mov    0x8(%rsp),%rax
  mov    0x48(%rsp),%rcx
  movslq (%rsp),%rdx
  mov    (%rax),%rax
  mov    %rax,0x20(%rsp)
  mov    0x10(%rsp),%eax
  imul   0x64(%rsp),%eax
  add    %eax,%eax
  cltq
  lea    (%rcx,%rax,1),%rsi
  mov    0x20(%rsp),%rcx
  add    %rdx,%rax
  add    0x20(%rsp),%rsi
  mov    %r13,%rdx
  add    %rax,%rcx
  xor    %eax,%eax
  jmp    L1473
L65:
  movzbl (%rdx),%edi
  add    $0x1,%rdx
  mov    %dil,(%rsi,%rax,2)
  movzbl (%r9,%rax,1),%edi
  mov    %dil,(%rcx,%rax,2)
  add    $0x1,%rax
L1473:
  cmp    0x30(%rsp),%rdx
  jb     L65
  test   %r15d,%r15d
  jne    L250
L1529:
  mov    0x7c(%rsp),%eax
  lea    -0x2(%rax),%edx
  sub    $0x1,%eax
  movslq %edx,%rdx
  cltq
  movzbl 0x120(%rsp,%rdx,1),%edx
  movzbl 0x120(%rsp,%rax,1),%eax
  shl    $0x8,%edx
  add    %edx,%eax
  mov    %eax,0x7c(%rsp)
  mov    0x64(%rsp),%eax
  lea    0x1(%rax),%edx
  jmp    L1101
L898:
  lea    D179(%rip),%rdi
  call   <puts@plt>
  jmp    L182
L585:
  lea    D490(%rip),%rdi
  call   <puts@plt>
  lea    D194(%rip),%rdi
  mov    %r13d,0x5c(%rsp)
  call   <puts@plt>
  mov    0x5c(%rsp),%esi
  lea    D607(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  movslq 0x5c(%rsp),%rdi
  call   <malloc@plt>
  mov    %rax,%rsi
  mov    0x8(%rsp),%rax
  mov    %rsi,(%rax)
  mov    0x28(%rsp),%rax
  movl   $0x5,(%rax)
L1322:
  mov    0x18(%rsp),%rdx
  mov    %rbp,%rdi
  mov    %r14,%rcx
  xor    %eax,%eax
  call   <dskbr_@plt>
  mov    0x6c(%rsp),%esi
  lea    D572(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L511
L1265:
  mov    0x7c(%rsp),%esi
  lea    D514(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  xor    %eax,%eax
  mov    %r14,%rcx
  mov    %r12,%rdx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <dskbr_@plt>
  cmpl   $0x0,0x6c(%rsp)
  jne    L578
  mov    0x7c(%rsp),%esi
  sub    0x10(%rsp),%esi
  lea    D630(%rip),%rdi
  xor    %eax,%eax
  sub    $0x2,%esi
  call   <printf@plt>
  jmp    L688
L46:
  mov    %rdx,%rsi
  lea    D655(%rip),%rdi
  xor    %eax,%eax
  mov    %r9,0x20(%rsp)
  sub    %r9,%rsi
  call   <printf@plt>
  mov    0x20(%rsp),%r9
  jmp    L587
L250:
  mov    0x64(%rsp),%esi
  lea    D40(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  lea    D363(%rip),%rdi
  call   <puts@plt>
  jmp    L1529
L1705:
  xor    %eax,%eax
  mov    %r14,%rcx
  mov    %r12,%rdx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  subl   $0x2,0x7c(%rsp)
  call   <dskbr_@plt>
  cmpl   $0x0,0x6c(%rsp)
  jne    L578
  movslq 0x10(%rsp),%rax
  lea    0x2920(%rsp),%r12
  mov    0x60(%rsp),%esi
  mov    %r12,%rdx
  lea    0x0(%r13,%rax,1),%r11
  movslq 0x7c(%rsp),%rax
  mov    %r11,%r8
  lea    0x0(%r13,%rax,1),%r10
  xor    %eax,%eax
  jmp    L956
L593:
  movzbl (%r8),%r9d
  movzbl 0x1(%r8),%eax
  mov    %rdx,%rdi
  add    $0x2,%r8
  mov    %r9,%rcx
  mov    %r9,%rsi
  rep stos %al,%es:(%rdi)
  mov    $0x1,%eax
  mov    %rdi,%rdx
L956:
  cmp    %r8,%r10
  ja     L593
  test   %al,%al
  je     L1490
  mov    %esi,0x60(%rsp)
L1490:
  test   %r15d,%r15d
  jne    L237
L7:
  mov    0x8(%rsp),%rax
  movslq (%rsp),%rcx
  movslq 0x18(%rsp),%rdx
  mov    (%rax),%rax
  mov    %rax,0x20(%rsp)
  mov    0x10(%rsp),%eax
  imul   0x64(%rsp),%eax
  add    %eax,%eax
  cltq
  add    %rax,%rdx
  add    %rcx,%rax
  mov    0x20(%rsp),%rcx
  add    0x20(%rsp),%rdx
  add    %rax,%rcx
  xor    %eax,%eax
  jmp    L377
L671:
  movzbl 0x0(%r13),%esi
  add    $0x1,%r13
  mov    %sil,(%rdx,%rax,2)
  movzbl (%r12,%rax,1),%esi
  mov    %sil,(%rcx,%rax,2)
  add    $0x1,%rax
L377:
  cmp    %r11,%r13
  jb     L671
  test   %r15d,%r15d
  jne    L719
L340:
  mov    (%rbx),%rdx
  lea    D543(%rip),%rsi
  lea    D378(%rip),%rdi
  xor    %eax,%eax
  call   <puthd@plt>
  mov    0x28(%rsp),%rax
  movl   $0x4,(%rax)
  jmp    L1605
L578:
  movl   $0xfffffffe,0x6c(%rsp)
  jmp    L1605
L772:
  mov    0x40(%rsp),%edx
  shl    $0x3,%edx
  test   %r15d,%r15d
  jne    L785
  movslq %edx,%rdi
  mov    %edx,0x5c(%rsp)
  call   <malloc@plt>
  mov    %rax,%rsi
  mov    0x8(%rsp),%rax
  mov    %rsi,(%rax)
  mov    0x28(%rsp),%rax
  movl   $0x9,(%rax)
  jmp    L897
L312:
  mov    0x40(%rsp),%edx
  shl    $0x2,%edx
  test   %r15d,%r15d
  jne    L751
  movslq %edx,%rdi
  mov    %edx,0x5c(%rsp)
  call   <malloc@plt>
  mov    %rax,%rsi
  mov    0x8(%rsp),%rax
  mov    %rsi,(%rax)
  mov    0x28(%rsp),%rax
  movl   $0x7,(%rax)
  jmp    L897
L785:
  lea    D96(%rip),%r13
  mov    %edx,(%rsp)
  mov    %r13,%rdi
  call   <puts@plt>
  mov    (%rsp),%edx
  mov    %r13,%rdi
  mov    %edx,0x5c(%rsp)
  call   <puts@plt>
  mov    0x5c(%rsp),%esi
  lea    D607(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  movslq 0x5c(%rsp),%rdi
  call   <malloc@plt>
  mov    %rax,%rsi
  mov    0x8(%rsp),%rax
  mov    %rsi,(%rax)
  mov    0x28(%rsp),%rax
  movl   $0x9,(%rax)
  jmp    L1322
L751:
  lea    D598(%rip),%r13
  mov    %edx,(%rsp)
  mov    %r13,%rdi
  call   <puts@plt>
  mov    (%rsp),%edx
  mov    %r13,%rdi
  mov    %edx,0x5c(%rsp)
  call   <puts@plt>
  mov    0x5c(%rsp),%esi
  lea    D607(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  movslq 0x5c(%rsp),%rdi
  call   <malloc@plt>
  mov    %rax,%rsi
  mov    0x8(%rsp),%rax
  mov    %rsi,(%rax)
  mov    0x28(%rsp),%rax
  movl   $0x7,(%rax)
  jmp    L1322
L413:
  lea    D503(%rip),%rdi
  call   <puts@plt>
  jmp    L1665
L1289:
  test   %r15d,%r15d
  jne    L1191
  movl   $0xfffffffc,0x6c(%rsp)
  jmp    L1069
L237:
  mov    %rdx,%rsi
  lea    D655(%rip),%rdi
  xor    %eax,%eax
  mov    %r11,0x20(%rsp)
  sub    %r12,%rsi
  call   <printf@plt>
  mov    0x20(%rsp),%r11
  jmp    L7
L1191:
  lea    D42(%rip),%rdi
  call   <puts@plt>
  movl   $0xfffffffc,0x6c(%rsp)
  jmp    L1318
L719:
  mov    0x64(%rsp),%esi
  lea    D40(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  lea    D174(%rip),%rdi
  call   <puts@plt>
  jmp    L340
```

tool_calls: name: read_data
arguments: data_label: D495
type_infered: string
name: read_data
arguments: data_label: D318
type_infered: string
name: read_data
arguments: data_label: D529
type_infered: string
name: read_data
arguments: data_label: D412
type_infered: string
name: read_data
arguments: data_label: D30
type_infered: string
name: read_data
arguments: data_label: D423
type_infered: string
name: read_data
arguments: data_label: D572
type_infered: string
name: read_data
arguments: data_label: D564
type_infered: string
name: read_data
arguments: data_label: D80
type_infered: string
name: read_data
arguments: data_label: D68
type_infered: string
name: read_data
arguments: data_label: D246
type_infered: string
name: read_data
arguments: data_label: D212
type_infered: string
name: read_data
arguments: data_label: D627
type_infered: string
name: read_data
arguments: data_label: D378
type_infered: string
name: read_data
arguments: data_label: D56
type_infered: string
name: read_data
arguments: data_label: D543
type_infered: string
name: read_data
arguments: data_label: D347
type_infered: string
name: read_data
arguments: data_label: D587
type_infered: string
name: read_data
arguments: data_label: D385
type_infered: string
name: read_data
arguments: data_label: D91
type_infered: string
name: read_data
arguments: data_label: D461
type_infered: string
name: read_data
arguments: data_label: D156
type_infered: string
name: read_data
arguments: data_label: D189
type_infered: string
name: read_data
arguments: data_label: D350
type_infered: string
name: read_data
arguments: data_label: D475
type_infered: string
name: read_data
arguments: data_label: D21
type_infered: string
name: read_data
arguments: data_label: D306
type_infered: string
name: read_data
arguments: data_label: D281
type_infered: string
name: read_data
arguments: data_label: D677
type_infered: string
name: read_data
arguments: data_label: D606
type_infered: string
name: read_data
arguments: data_label: D678
type_infered: string
name: read_data
arguments: data_label: D71
type_infered: string
name: read_data
arguments: data_label: D451
type_infered: string
name: read_data
arguments: data_label: D563
type_infered: string
name: read_data
arguments: data_label: D498
type_infered: string
name: read_data
arguments: data_label: D369
type_infered: string
name: read_data
arguments: data_label: D256
type_infered: string
name: read_data
arguments: data_label: D249
type_infered: string
name: read_data
arguments: data_label: D422
type_infered: byte[16]
name: read_data
arguments: data_label: D270
type_infered: string
name: read_data
arguments: data_label: D641
type_infered: string
name: read_data
arguments: data_label: D607
type_infered: string
name: read_data
arguments: data_label: D179
type_infered: string
name: read_data
arguments: data_label: D490
type_infered: string
name: read_data
arguments: data_label: D194
type_infered: string
name: read_data
arguments: data_label: D514
type_infered: string
name: read_data
arguments: data_label: D630
type_infered: string
name: read_data
arguments: data_label: D655
type_infered: string
name: read_data
arguments: data_label: D40
type_infered: string
name: read_data
arguments: data_label: D363
type_infered: string
name: read_data
arguments: data_label: D96
type_infered: string
name: read_data
arguments: data_label: D598
type_infered: string
name: read_data
arguments: data_label: D503
type_infered: string
name: read_data
arguments: data_label: D42
type_infered: string
name: read_data
arguments: data_label: D174
type_infered: string

tool: D495: DIM

tool: D318: Error reading dimensions

tool: D529: Done reading file

tool: D412: RDSMV completion status %d


tool: D30: Opening file: %s


tool: D423: Reading header

tool: D572: Read Completion status : %d


tool: D564: %d

tool: D80: SIZE%d

tool: D68: Error reading %s


tool: D246: Header length : %d


tool: D212: Number of dimensions : %d


tool: D627: BYTE_ORDER

tool: D378: TYPE

tool: D56: mad

tool: D543: unsigned_short

tool: D347: long

tool: D587: long_integer

tool: D385: signed_long

tool: D91: float

tool: D461: ieee_float

tool: D156: complex

tool: D189: ieee_complex

tool: D350: swap_rlmsb

tool: D475: Type >%s<


tool: D21: Image size (%d)

tool: D306:  %d 

tool: D281: Number of elements : %d


tool: D677: Byte order : big_endian

tool: D606: char

tool: D678: Reading byte image

tool: D71: Allocating %d bytes for byte image


tool: D451: Reading unsigned byte image

tool: D563: Read Byte Completion status : %d


tool: D498: Allocating %d bytes for short image


tool: D369: Converting %d bytes to short image


tool: D256: Error opening file %s, istat=%d


tool: D249: Byte order : little_endian

tool: {"D422": [0x02,0x00,0x04,0x00,0x08,0x00,0x10,0x00,0x20,0x00,0x40,0x00,0x80,0x00,0x00,0x01]}

tool: D270: Reading bit image

tool: D641: Reading unsigned short image

tool: D607: Allocating %d bytes


tool: D179: Swapping bytes

tool: D490: Reading long image

tool: D194: Reading signed long image

tool: D514: Reading %d bytes


tool: D630: Uncompressing %d bytes


tool: D655: Restored %d bytes in MSB


tool: D40: Done line %d


tool: D363: =================================

tool: D96: Reading complex image

tool: D598: Reading float image

tool: D503: Reading compressed image

tool: D42: Unsupported Filetype

tool: D174: ===================================

assistant: ```c
int rdsmv(char *filename, char **head, int *lhead, char **array, int *naxis, int *axis, int *type) {
  int readl;
  int i, j, k;
  int istat, bo, dim;
  char s[80], s1[80];
  int lun = 1;
  int lflag;
  int nelm;
  char *thead;
  int filec_debug = filec_getdebug();
  *head = 0;
  *array = 0;
  j = strlen(filename);
  if (filec_debug)
    printf("Opening file: %s\n", filename);
  dskbor_(&lun, filename, &j, &istat);
  if (istat != 0) {
    if (filec_debug)
      printf("Error opening file %s, istat=%d\n", filename, istat);
    return (-3);
  }
  lflag = (1 == 1);
  dskbwr_(&lun, &lflag);
  readl = 512;
  thead = malloc(512);
  memset(thead, 0, 512);
  if (filec_debug)
    printf("Reading header\n");
  dskbr_(&lun, thead, &readl, &istat);
  if (filec_debug)
    printf("Read Completion status : %d\n", istat);
  if (istat != 0) {
    istat = -2;
    goto close;
  }
  if ((istat = gethdl(&k, thead)) < 0) {
    istat = -4;
    goto close;
  }
  if (filec_debug)
    printf("Header length : %d\n", k);
  *lhead = ((k / 1024) + 1) * 1024;
  *head = malloc(*lhead);
  memset(*head, 0, *lhead);
  memcpy(*head, thead, 512);
  free(thead);
  readl = k - 512;
  if (readl > 0) {
    dskbr_(&lun, *head + 512, &readl, &istat);
    if (istat != 0) {
      istat = -2;
      goto close;
    }
  }
  lflag = (1 == 0);
  dskbwr_(&lun, &lflag);
  *naxis = 0;
  gethd("DIM", s, *head);
  if (*s == 0 || sscanf(s, "%d", &dim) != 1) {
    if (filec_debug)
      printf("Error reading dimensions\n");
    goto close;
  }
  if (filec_debug)
    printf("Number of dimensions : %d\n", dim);
  *naxis = dim;
  for (i = 0, nelm = 1; i < dim; i++) {
    sprintf(s1, "SIZE%d", i + 1);
    gethd(s1, s, *head);
    if (*s == 0 || sscanf(s, "%d", &axis[i]) != 1) {
      if (filec_debug)
        printf("Error reading %s\n", s1);
      goto close;
    }
    nelm *= axis[i];
  }
  gethd("BYTE_ORDER", s, *head);
  if (*s) {
    if (strcmp(s, "little_endian") == 0)
      bo = 0;
    else if (strcmp(s, "big_endian") == 0)
      bo = 1;
    else {
      istat = -4;
      goto close;
    }
  } else
    bo = -1;
  gethd("TYPE", s, *head);
  if (filec_debug) {
    printf("Type >%s<\n", s);
    printf("Image size (%d)", dim);
    for (i = 0; i < dim; i++)
      printf(" %d ", axis[i]);
    printf("\n");
    printf("Number of elements : %d\n", nelm);
    if (bo)
      printf("Byte order : big_endian\n");
    else
      printf("Byte order : little_endian\n");
  }
  if (strcmp(s, "unsigned_byte") == 0 || strcmp(s, "byte") == 0 || strcmp(s, "unsigned_char") == 0 || strcmp(s, "char") == 0) {
    int i;
    unsigned char *char_array, *cp;
    unsigned short *ap;
    if (filec_debug)
      printf("Reading byte image\n");
    readl = nelm * sizeof(char);
    char_array = malloc(readl);
    if (filec_debug) {
      printf("Allocating %d bytes for byte image\n", readl);
      printf("Reading unsigned byte image\n");
    }
    dskbr_(&lun, (char *)char_array, &readl, &istat);
    if (filec_debug)
      printf("Read Byte Completion status : %d\n", istat);
    if (istat != 0) {
      istat = -2;
      goto close;
    }
    lflag = (1 == 1);
    dskbwr_(&lun, &lflag);
    if (filec_debug) {
      readl = nelm * sizeof(unsigned short);
      printf("Allocating %d bytes for short image\n", readl);
    }
    *array = malloc(nelm * sizeof(unsigned short));
    *type = 4;
    ap = (unsigned short *)*array;
    cp = char_array;
    if (filec_debug)
      printf("Converting %d bytes to short image\n", nelm);
    for (i = 0; i < nelm; i++)
      *ap++ = *cp++;
    free(char_array);
  } else if (strcmp(s, "bit") == 0) {
    int i;
    unsigned char *bit_array, *bp;
    unsigned short *ap;
    if (filec_debug)
      printf("Reading bit image\n");
    readl = nelm * sizeof(char) / 8;
    bit_array = malloc(readl);
    if (filec_debug)
      printf("Reading bit image\n");
    dskbr_(&lun, (char *)bit_array, &readl, &istat);
    if (filec_debug)
      printf("Read Completion status : %d\n", istat);
    if (istat != 0) {
      istat = -2;
      goto close;
    }
    lflag = (1 == 1);
    dskbwr_(&lun, &lflag);
    *array = malloc(nelm * sizeof(unsigned short));
    *type = 4;
    ap = (unsigned short *)*array;
    bp = bit_array;
    for (i = 0; i < nelm; i += 8) {
      for (j = 0; j < 8; j++)
        *ap++ = *bp & 2 << j;
      bp++;
    }
    free(bit_array);
  } else if (strcmp(s, "mad") == 0 || strcmp(s, "unsigned_short") == 0) {
    if (filec_debug)
      printf("Reading unsigned short image\n");
    readl = nelm * sizeof(unsigned short);
    if (filec_debug) {
      printf("Reading unsigned short image\n");
      printf("Allocating %d bytes\n", readl);
    }
    *array = malloc(readl);
    *type = 4;
    dskbr_(&lun, *array, &readl, &istat);
    if (filec_debug)
      printf("Read Completion status : %d\n", istat);
    if (istat != 0) {
      istat = -2;
      goto close;
    }
    lflag = (1 == 1);
    dskbwr_(&lun, &lflag);
    if (bo != getbo()) {
      if (filec_debug)
        printf("Swapping bytes\n");
      swpbyt(0, readl, *array);
    }
  } else if (strcmp(s, "long") == 0 || strcmp(s, "long_integer") == 0 || strcmp(s, "signed_long") == 0) {
    if (filec_debug)
      printf("Reading long image\n");
    readl = nelm * sizeof(int);
    if (filec_debug) {
      printf("Reading signed long image\n");
      printf("Allocating %d bytes\n", readl);
    }
    *array = malloc(readl);
    *type = 5;
    dskbr_(&lun, *array, &readl, &istat);
    if (filec_debug)
      printf("Read Completion status : %d\n", istat);
    if (istat != 0) {
      istat = -2;
      goto close;
    }
    lflag = (1 == 1);
    dskbwr_(&lun, &lflag);
    if (bo != getbo()) {
      if (filec_debug)
        printf("Swapping bytes\n");
      swpbyt(1, readl, *array);
    }
  } else if (strcmp(s, "float") == 0 || strcmp(s, "ieee_float") == 0) {
    if (filec_debug)
      printf("Reading float image\n");
    readl = nelm * sizeof(float);
    if (filec_debug) {
      printf("Reading float image\n");
      printf("Allocating %d bytes\n", readl);
    }
    *array = malloc(readl);
    *type = 7;
    dskbr_(&lun, *array, &readl, &istat);
    if (filec_debug)
      printf("Read Completion status : %d\n", istat);
    if (istat != 0) {
      istat = -2;
      goto close;
    }
    lflag = (1 == 1);
    dskbwr_(&lun, &lflag);
    if (bo != getbo()) {
      if (filec_debug)
        printf("Swapping bytes\n");
      swpbyt(1, readl, *array);
    }
  } else if (strcmp(s, "complex") == 0 || strcmp(s, "ieee_complex") == 0) {
    if (filec_debug)
      printf("Reading complex image\n");
    readl = nelm * 2 * sizeof(float);
    if (filec_debug) {
      printf("Reading complex image\n");
      printf("Allocating %d bytes\n", readl);
    }
    *array = malloc(readl);
    *type = 9;
    dskbr_(&lun, *array, &readl, &istat);
    if (filec_debug)
      printf("Read Completion status : %d\n", istat);
    if (istat != 0) {
      istat = -2;
      goto close;
    }
    lflag = (1 == 1);
    dskbwr_(&lun, &lflag);
    if (bo != getbo()) {
      if (filec_debug)
        printf("Swapping bytes\n");
      swpbyt(1, readl, *array);
    }
  } else if (strcmp(s, "swap_rlmsb") == 0) {
    unsigned char lsb[10 * 1024], msb[10 * 1024];
    unsigned char *lp, *mp, *alp, *amp;
    int lstart = 0, mstart = 0;
    int llen, n, val;
    int is1 = axis[0], is2 = axis[1];
    if (filec_debug)
      printf("Reading compressed image\n");
    if (dim != 2)
      goto close;
    readl = nelm * sizeof(unsigned short);
    *array = malloc(readl);
    bo = getbo();
    if (bo == 0) {
      lstart = 0;
      mstart = 1;
    } else if (bo == 1) {
      lstart = 1;
      mstart = 0;
    }
    llen = 2;
    dskbr_(&lun, (char *)lsb, &llen, &istat);
    if (istat != 0) {
      istat = -2;
      goto close;
    }
    llen = (int)lsb[llen - 2] * 256 + lsb[llen - 1];
    for (j = 0; j < (is2 - 1); j++) {
      if (filec_debug)
        printf("Reading %d bytes\n", llen);
      dskbr_(&lun, (char *)lsb, &llen, &istat);
      if (istat != 0) {
        istat = -2;
        goto close;
      }
      if (filec_debug)
        printf("Uncompressing %d bytes\n", llen - (is1)-2);
      for (lp = lsb + (is1), mp = msb; lp < lsb + llen - 2;) {
        n = *lp++;
        val = *lp++;
        if (filec_debug && 0)
          printf("Line %d, n %d, val %d\n", j, n, val);
        for (i = 0; i < n; i++)
          *mp++ = val;
      }
      if (filec_debug)
        printf("Restored %d bytes in MSB\n", mp - msb);
      alp = (unsigned char *)*array + 2 * j * is1 + lstart;
      amp = (unsigned char *)*array + 2 * j * is1 + mstart;
      for (lp = lsb, mp = msb; lp < lsb + (is1); alp += 2, amp += 2) {
        *alp = *lp++;
        *amp = *mp++;
      }
      if (filec_debug) {
        printf("Done line %d\n", j);
        printf("=================================\n");
      }
      llen = (int)lsb[llen - 2] * 256 + lsb[llen - 1];
    }
    llen -= 2;
    dskbr_(&lun, (char *)lsb, &llen, &istat);
    if (istat != 0) {
      istat = -2;
      goto close;
    }
    for (lp = lsb + (is1), mp = msb; lp < lsb + llen;) {
      n = *lp++;
      val = *lp++;
      if (filec_debug && 0)
        printf("Line %d, n %d, val %d\n", j, n, val);
      for (i = 0; i < n; i++)
        *mp++ = val;
    }
    if (filec_debug)
      printf("Restored %d bytes in MSB\n", mp - msb);
    alp = (unsigned char *)*array + 2 * j * is1 + lstart;
    amp = (unsigned char *)*array + 2 * j * is1 + mstart;
    for (lp = lsb, mp = msb; lp < lsb + (is1); alp += 2, amp += 2) {
      *alp = *lp++;
      *amp = *mp++;
    }
    if (filec_debug) {
      printf("Done line %d\n", j);
      printf("===================================\n");
    }
    puthd("TYPE", "unsigned_short", *head);
    *type = 4;
  } else {
    if (filec_debug)
      printf("Unsupported Filetype\n");
    istat = -4;
    goto close;
  }
close:
  if (filec_debug)
    printf("Done reading file\n");
  if (istat) {
    dskbcr_(&lun, &i);
    if (*head != 0)
      free(*head);
    if (*array != 0)
      free(*array);
  } else
    dskbcr_(&lun, &istat);
  if (filec_debug)
    printf("RDSMV completion status %d\n", istat);
  return istat;
}
```