user: Demonstrate the C code that generates the assembly output below:

```asm
<rdsmv>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  lea    -0x5000(%rsp),%r11
L111:
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  cmp    %r11,%rsp
  jne    L111
  sub    $0x138,%rsp
  mov    0x5170(%rsp),%rax
  mov    %rcx,0x8(%rsp)
  mov    %rsi,%r15
  mov    %rcx,%r14
  mov    %rdi,%r12
  mov    %r8,0x10(%rsp)
  mov    %rdx,%r13
  mov    %r9,0x28(%rsp)
  mov    %rax,0x30(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x5128(%rsp)
  xor    %eax,%eax
  movl   $0x1,0x74(%rsp)
  call   <filec_getdebug@plt>
  movq   $0x0,(%r15)
  mov    %r12,%rdi
  movq   $0x0,(%r14)
  mov    %eax,%ebx
  call   <strlen@plt>
  mov    %eax,0x64(%rsp)
  test   %ebx,%ebx
  jne    L1138
  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    L244
  lea    0x78(%rsp),%rax
  mov    %rbp,%rdi
  movl   $0x1,0x78(%rsp)
  mov    %rax,%rsi
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  call   <dskbwr_@plt>
  mov    $0x1,%esi
  mov    $0x200,%edi
  movl   $0x200,0x5c(%rsp)
  call   <calloc@plt>
  mov    %r14,%rcx
  mov    %rbp,%rdi
  mov    %rax,%r12
  lea    0x5c(%rsp),%rax
  mov    %rax,0x20(%rsp)
  mov    %rax,%rdx
  mov    %r12,%rsi
  xor    %eax,%eax
  call   <dskbr_@plt>
L341:
  mov    0x6c(%rsp),%eax
  mov    %eax,0x38(%rsp)
  test   %eax,%eax
  je     L712
L1011:
  mov    $0xfffffffe,%eax
L431:
  mov    %eax,0x6c(%rsp)
  test   %ebx,%ebx
  jne    L1151
L1297:
  mov    %rbp,%rdi
  lea    0x60(%rsp),%rsi
  xor    %eax,%eax
  call   <dskbcr_@plt>
  mov    (%r15),%rdi
  test   %rdi,%rdi
  je     L835
  call   <free@plt>
L835:
  mov    0x8(%rsp),%rax
  mov    (%rax),%rdi
  test   %rdi,%rdi
  je     L212
  call   <free@plt>
L212:
  test   %ebx,%ebx
  jne    L714
L808:
  mov    0x6c(%rsp),%eax
L245:
  mov    0x5128(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L587
  add    $0x5138,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L712:
  lea    0x68(%rsp),%rdi
  mov    %r12,%rsi
  xor    %eax,%eax
  call   <gethdl@plt>
  mov    %eax,0x6c(%rsp)
  test   %eax,%eax
  js     L910
  test   %ebx,%ebx
  jne    L1125
L746:
  mov    0x68(%rsp),%r8d
  test   %r8d,%r8d
  lea    0x3ff(%r8),%eax
  mov    %r8d,0x3c(%rsp)
  cmovns %r8d,%eax
  and    $0xfffffc00,%eax
  lea    0x400(%rax),%edi
  mov    %edi,0x0(%r13)
  movslq %edi,%rdi
  call   <malloc@plt>
  movslq 0x0(%r13),%rdx
  xor    %esi,%esi
  mov    %rax,(%r15)
  mov    %rax,%rdi
  call   <memset@plt>
  mov    $0x40,%ecx
  mov    %r12,%rsi
  mov    %rax,%rdi
  mov    %rax,0x40(%rsp)
  rep movsq %ds:(%rsi),%es:(%rdi)
  mov    %r12,%rdi
  call   <free@plt>
  mov    0x3c(%rsp),%r8d
  lea    -0x200(%r8),%eax
  mov    %eax,0x5c(%rsp)
  test   %eax,%eax
  jle    L476
  mov    0x40(%rsp),%r9
  mov    0x20(%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    L1011
L476:
  mov    0x18(%rsp),%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  movl   $0x0,0x78(%rsp)
  lea    0x80(%rsp),%r12
  call   <dskbwr_@plt>
  mov    0x10(%rsp),%rax
  mov    (%r15),%rdx
  mov    %r12,%rsi
  lea    D665(%rip),%rdi
  movl   $0x0,(%rax)
  xor    %eax,%eax
  call   <gethd@plt>
  cmpb   $0x0,0x80(%rsp)
  jne    L370
L988:
  test   %ebx,%ebx
  je     L418
  lea    D42(%rip),%rdi
  call   <puts@plt>
L1151:
  lea    D646(%rip),%rdi
  call   <puts@plt>
L418:
  mov    0x6c(%rsp),%edx
  test   %edx,%edx
  jne    L1297
  xor    %eax,%eax
  mov    %r14,%rsi
  mov    %rbp,%rdi
  call   <dskbcr_@plt>
  test   %ebx,%ebx
  je     L808
L714:
  mov    0x6c(%rsp),%esi
  lea    D466(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L808
  xchg   %ax,%ax
L1138:
  mov    %r12,%rsi
  lea    0x6c(%rsp),%r14
  lea    0x74(%rsp),%rbp
  xor    %eax,%eax
  lea    D20(%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    L819
  lea    0x78(%rsp),%rax
  mov    %rbp,%rdi
  movl   $0x1,0x78(%rsp)
  mov    %rax,0x18(%rsp)
  mov    %rax,%rsi
  xor    %eax,%eax
  call   <dskbwr_@plt>
  mov    $0x1,%esi
  mov    $0x200,%edi
  movl   $0x200,0x5c(%rsp)
  call   <calloc@plt>
  lea    D330(%rip),%rdi
  mov    %rax,%r12
  call   <puts@plt>
  lea    0x5c(%rsp),%rax
  mov    %r12,%rsi
  mov    %rbp,%rdi
  mov    %rax,0x20(%rsp)
  mov    %rax,%rdx
  mov    %r14,%rcx
  xor    %eax,%eax
  call   <dskbr_@plt>
  mov    0x6c(%rsp),%esi
  lea    D252(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L341
  nopl   (%rax)
L370:
  lea    0x70(%rsp),%rdx
  lea    D411(%rip),%rsi
  mov    %r12,%rdi
  xor    %eax,%eax
  call   <sscanf@plt>
  mov    %eax,0x3c(%rsp)
  cmp    $0x1,%eax
  jne    L988
  test   %ebx,%ebx
  jne    L871
L1014:
  mov    0x70(%rsp),%eax
  mov    0x10(%rsp),%rcx
  movl   $0x0,0x60(%rsp)
  mov    %eax,(%rcx)
  test   %eax,%eax
  jle    L678
  mov    $0x1,%ecx
  mov    %ebx,0x10(%rsp)
  xor    %eax,%eax
  mov    0x28(%rsp),%rbx
  mov    %r14,0x40(%rsp)
  lea    0xd0(%rsp),%r13
  mov    %ecx,%r14d
  jmp    L1179
L303:
  movslq 0x60(%rsp),%rax
  lea    D411(%rip),%rsi
  mov    %r12,%rdi
  lea    (%rbx,%rax,4),%rdx
  xor    %eax,%eax
  call   <sscanf@plt>
  cmp    $0x1,%eax
  jne    L630
  movslq 0x60(%rsp),%rdx
  mov    %rdx,%rax
  imul   (%rbx,%rdx,4),%r14d
  add    $0x1,%eax
  mov    %eax,0x60(%rsp)
  cmp    0x70(%rsp),%eax
  jge    L351
L1179:
  lea    0x1(%rax),%edx
  lea    D270(%rip),%rsi
  mov    %r13,%rdi
  xor    %eax,%eax
  call   <sprintf@plt>
  mov    (%r15),%rdx
  xor    %eax,%eax
  mov    %r12,%rsi
  mov    %r13,%rdi
  call   <gethd@plt>
  cmpb   $0x0,0x80(%rsp)
  jne    L303
L630:
  mov    0x10(%rsp),%ebx
  mov    0x40(%rsp),%r14
  test   %ebx,%ebx
  je     L418
  mov    %r13,%rsi
  lea    D291(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L1151
  nopw   0x0(%rax,%rax,1)
L910:
  mov    $0xfffffffc,%eax
  jmp    L431
  nopw   0x0(%rax,%rax,1)
L1125:
  mov    0x68(%rsp),%esi
  lea    D582(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L746
  nop
L871:
  mov    0x70(%rsp),%esi
  lea    D593(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L1014
  nopw   0x0(%rax,%rax,1)
L351:
  mov    0x10(%rsp),%ebx
  mov    %r14d,0x10(%rsp)
  mov    0x40(%rsp),%r14
L1027:
  mov    (%r15),%rdx
  xor    %eax,%eax
  mov    %r12,%rsi
  lea    D603(%rip),%rdi
  call   <gethd@plt>
  cmpb   $0x0,0x80(%rsp)
  je     L1163
  movabs $0x655f656c7474696c,%rax
  cmp    %rax,0x80(%rsp)
  je     L1217
L21:
  movabs $0x69646e655f676962,%rax
  cmp    %rax,0x80(%rsp)
  jne    L910
  cmpw   $0x6e61,0x88(%rsp)
  jne    L910
  cmpb   $0x0,0x8a(%rsp)
  jne    L910
  movl   $0x1,0x40(%rsp)
L1110:
  mov    (%r15),%rdx
  xor    %eax,%eax
  mov    %r12,%rsi
  lea    D280(%rip),%rdi
  call   <gethd@plt>
  test   %ebx,%ebx
  jne    L86
  movabs $0x64656e6769736e75,%rax
  cmp    %rax,0x80(%rsp)
  je     L991
L821:
  cmpl   $0x65747962,0x80(%rsp)
  je     L1098
L1147:
  movabs $0x64656e6769736e75,%rax
  cmp    %rax,0x80(%rsp)
  je     L319
L609:
  cmpl   $0x72616863,0x80(%rsp)
  je     L365
L458:
  cmpl   $0x746962,0x80(%rsp)
  je     L1400
  lea    D504(%rip),%rsi
  mov    %r12,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L241
  lea    D87(%rip),%rsi
  mov    %r12,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L241
  lea    D511(%rip),%rsi
  mov    %r12,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L1180
  lea    D583(%rip),%rsi
  mov    %r12,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L1180
  lea    D151(%rip),%rsi
  mov    %r12,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L1180
  lea    D120(%rip),%rsi
  mov    %r12,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L330
  lea    D651(%rip),%rsi
  mov    %r12,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L330
  lea    D558(%rip),%rsi
  mov    %r12,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L905
  lea    D67(%rip),%rsi
  mov    %r12,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  je     L905
  lea    D201(%rip),%rsi
  mov    %r12,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L47
  mov    0x28(%rsp),%rax
  mov    (%rax),%ecx
  mov    0x4(%rax),%eax
  mov    %ecx,0x18(%rsp)
  mov    %eax,0x20(%rsp)
  test   %ebx,%ebx
  jne    L573
L356:
  cmpl   $0x2,0x70(%rsp)
  je     L352
L96:
  test   %ebx,%ebx
  je     L418
  jmp    L1151
  nopl   (%rax)
L244:
  mov    $0xfffffffd,%eax
  jmp    L245
L1163:
  movl   $0xffffffff,0x40(%rsp)
  jmp    L1110
L86:
  mov    %r12,%rsi
  lea    D157(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x70(%rsp),%esi
  xor    %eax,%eax
  lea    D577(%rip),%rdi
  lea    D617(%rip),%r13
  call   <printf@plt>
  mov    0x70(%rsp),%r9d
  movl   $0x0,0x60(%rsp)
  test   %r9d,%r9d
  jle    L619
  mov    0x38(%rsp),%eax
  mov    %ebx,0x38(%rsp)
  mov    0x28(%rsp),%rbx
L668:
  cltq
  mov    %r13,%rdi
  mov    (%rbx,%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     L668
  mov    0x38(%rsp),%ebx
L619:
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    0x10(%rsp),%esi
  lea    D311(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x40(%rsp),%r8d
  test   %r8d,%r8d
  je     L652
  lea    D553(%rip),%rdi
  call   <puts@plt>
L753:
  movabs $0x64656e6769736e75,%rax
  cmp    %rax,0x80(%rsp)
  je     L527
L1012:
  cmpl   $0x65747962,0x80(%rsp)
  je     L1487
L1224:
  movabs $0x64656e6769736e75,%rax
  cmp    %rax,0x80(%rsp)
  je     L790
L675:
  lea    D649(%rip),%rsi
  mov    %r12,%rdi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L458
L1164:
  lea    D282(%rip),%rdi
  call   <puts@plt>
  movslq 0x10(%rsp),%r8
  mov    %r8,%rdi
  mov    %r8,%r13
  mov    %r8d,0x5c(%rsp)
  mov    %r8,0x28(%rsp)
  call   <malloc@plt>
  mov    %r13d,%esi
  lea    D26(%rip),%rdi
  mov    %rax,%r12
  xor    %eax,%eax
  call   <printf@plt>
  lea    D111(%rip),%rdi
  call   <puts@plt>
  mov    0x20(%rsp),%rdx
  mov    %r14,%rcx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <dskbr_@plt>
  mov    0x6c(%rsp),%esi
  lea    D476(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x6c(%rsp),%esi
  test   %esi,%esi
  jne    L1011
  mov    0x28(%rsp),%r8
  mov    0x18(%rsp),%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  movl   $0x1,0x78(%rsp)
  mov    %r8,0x20(%rsp)
  call   <dskbwr_@plt>
  mov    0x10(%rsp),%eax
  lea    D109(%rip),%rdi
  lea    (%rax,%rax,1),%esi
  xor    %eax,%eax
  mov    %esi,0x5c(%rsp)
  call   <printf@plt>
  mov    0x20(%rsp),%r8
  lea    (%r8,%r8,1),%rdi
  mov    %r8,0x18(%rsp)
  call   <malloc@plt>
  mov    0x8(%rsp),%rcx
  mov    0x10(%rsp),%esi
  lea    D343(%rip),%rdi
  mov    %rax,%r13
  mov    %rax,(%rcx)
  mov    0x30(%rsp),%rcx
  xor    %eax,%eax
  movl   $0x4,(%rcx)
  call   <printf@plt>
  mov    0x18(%rsp),%r8
L9:
  mov    0x10(%rsp),%ecx
  xor    %eax,%eax
  test   %ecx,%ecx
  jle    L1384
  nop
L791:
  movzbl (%r12,%rax,1),%edx
  mov    %dx,0x0(%r13,%rax,2)
  add    $0x1,%rax
  cmp    %r8,%rax
  jne    L791
L1384:
  mov    %r12,%rdi
  call   <free@plt>
  jmp    L96
L819:
  mov    %r12,%rsi
  lea    D59(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0xfffffffd,%eax
  jmp    L245
L1217:
  cmpl   $0x6169646e,0x88(%rsp)
  jne    L21
  cmpw   $0x6e,0x8c(%rsp)
  jne    L21
  movl   $0x0,0x40(%rsp)
  jmp    L1110
L991:
  cmpl   $0x7479625f,0x88(%rsp)
  jne    L821
  cmpw   $0x65,0x8c(%rsp)
  jne    L821
L1545:
  movslq 0x10(%rsp),%r8
  mov    %r8,%rdi
  mov    %r8d,0x5c(%rsp)
  mov    %r8,0x28(%rsp)
  call   <malloc@plt>
  mov    0x20(%rsp),%rdx
  mov    %rbp,%rdi
  mov    %r14,%rcx
  mov    %rax,%rsi
  mov    %rax,%r12
  xor    %eax,%eax
  call   <dskbr_@plt>
  mov    0x6c(%rsp),%edi
  test   %edi,%edi
  jne    L1011
  mov    0x28(%rsp),%r8
  mov    0x18(%rsp),%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  movl   $0x1,0x78(%rsp)
  mov    %r8,0x20(%rsp)
  call   <dskbwr_@plt>
  mov    0x20(%rsp),%r8
  lea    (%r8,%r8,1),%rdi
  mov    %r8,0x18(%rsp)
  call   <malloc@plt>
  mov    0x18(%rsp),%r8
  mov    %rax,%r13
  mov    0x8(%rsp),%rax
  mov    %r13,(%rax)
  mov    0x30(%rsp),%rax
  movl   $0x4,(%rax)
  jmp    L9
L652:
  lea    D472(%rip),%rdi
  call   <puts@plt>
  jmp    L753
L678:
  movl   $0x1,0x10(%rsp)
  jmp    L1027
L527:
  cmpl   $0x7479625f,0x88(%rsp)
  jne    L1012
  cmpw   $0x65,0x8c(%rsp)
  jne    L1012
  jmp    L1164
L1098:
  cmpb   $0x0,0x84(%rsp)
  je     L1545
  jmp    L1147
L319:
  cmpl   $0x6168635f,0x88(%rsp)
  jne    L609
  cmpw   $0x72,0x8c(%rsp)
  jne    L609
  jmp    L1545
L1487:
  cmpb   $0x0,0x84(%rsp)
  je     L1164
  jmp    L1224
L790:
  cmpl   $0x6168635f,0x88(%rsp)
  jne    L675
  cmpw   $0x72,0x8c(%rsp)
  jne    L675
  jmp    L1164
L365:
  cmpb   $0x0,0x84(%rsp)
  jne    L458
  jmp    L1545
L241:
  mov    0x10(%rsp),%r13d
  add    %r13d,%r13d
  test   %ebx,%ebx
  jne    L477
  movslq %r13d,%rdi
  mov    %r13d,0x5c(%rsp)
  call   <malloc@plt>
  mov    0x20(%rsp),%rdx
  mov    %r14,%rcx
  mov    %rbp,%rdi
  mov    %rax,%rsi
  mov    0x8(%rsp),%rax
  mov    %rsi,(%rax)
  mov    0x30(%rsp),%rax
  movl   $0x4,(%rax)
  xor    %eax,%eax
  call   <dskbr_@plt>
L373:
  cmpl   $0x0,0x6c(%rsp)
  jne    L1011
  mov    0x18(%rsp),%rsi
  xor    %eax,%eax
  mov    %rbp,%rdi
  movl   $0x1,0x78(%rsp)
  call   <dskbwr_@plt>
  xor    %eax,%eax
  call   <getbo@plt>
  cmp    0x40(%rsp),%eax
  je     L96
  test   %ebx,%ebx
  jne    L722
L1442:
  mov    0x8(%rsp),%rax
  mov    0x5c(%rsp),%esi
  xor    %edi,%edi
  mov    (%rax),%rdx
  xor    %eax,%eax
  call   <swpbyt@plt>
  jmp    L96
L1400:
  movslq 0x10(%rsp),%r13
  mov    %r13,%rdx
  mov    %r13,%r12
  shr    $0x3,%rdx
  sar    $0x3,%r12
  test   %ebx,%ebx
  jne    L297
  mov    %r12,%rdi
  mov    %edx,0x5c(%rsp)
  call   <malloc@plt>
  mov    0x20(%rsp),%rdx
  mov    %r14,%rcx
  mov    %rbp,%rdi
  mov    %rax,%r12
  mov    %rax,%rsi
  xor    %eax,%eax
  call   <dskbr_@plt>
L7:
  cmpl   $0x0,0x6c(%rsp)
  jne    L1011
  mov    0x18(%rsp),%rsi
  mov    %rbp,%rdi
  xor    %eax,%eax
  add    %r13,%r13
  movl   $0x1,0x78(%rsp)
  call   <dskbwr_@plt>
  mov    %r13,%rdi
  call   <malloc@plt>
  mov    %rax,%rdx
  mov    0x8(%rsp),%rax
  mov    %rdx,(%rax)
  mov    0x30(%rsp),%rax
  movl   $0x4,(%rax)
  mov    0x10(%rsp),%eax
  test   %eax,%eax
  jle    L1384
  sub    $0x1,%eax
  mov    %r12,%r9
  mov    $0x2,%edi
  mov    %eax,%r8d
  shr    $0x3,%r8d
  add    $0x1,%r8d
  add    %r12,%r8
L726:
  movzbl (%r9),%esi
  xor    %ecx,%ecx
  nopl   (%rax)
L1114:
  mov    %edi,%eax
  shl    %cl,%eax
  and    %esi,%eax
  mov    %ax,(%rdx,%rcx,2)
  add    $0x1,%rcx
  cmp    $0x8,%rcx
  jne    L1114
  add    $0x1,%r9
  add    $0x10,%rdx
  cmp    %r9,%r8
  jne    L726
  movl   $0x8,0x64(%rsp)
  jmp    L1384
L587:
  call   <__stack_chk_fail@plt>
L297:
  lea    D377(%rip),%r8
  mov    %rdx,0x28(%rsp)
  mov    %r8,%rdi
  call   <puts@plt>
  mov    0x28(%rsp),%rdx
  mov    %r12,%rdi
  mov    %edx,0x5c(%rsp)
  call   <malloc@plt>
  lea    D377(%rip),%r8
  mov    %r8,%rdi
  mov    %rax,%r12
  call   <puts@plt>
  mov    0x20(%rsp),%rdx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  mov    %r14,%rcx
  xor    %eax,%eax
  call   <dskbr_@plt>
  mov    0x6c(%rsp),%esi
  lea    D252(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L7
L477:
  lea    D346(%rip),%r12
  mov    %r12,%rdi
  call   <puts@plt>
  mov    %r12,%rdi
  mov    %r13d,0x5c(%rsp)
  call   <puts@plt>
  mov    0x5c(%rsp),%esi
  lea    D22(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  movslq 0x5c(%rsp),%rdi
  call   <malloc@plt>
  mov    0x20(%rsp),%rdx
  mov    %rbp,%rdi
  mov    %r14,%rcx
  mov    %rax,%rsi
  mov    0x8(%rsp),%rax
  mov    %rsi,(%rax)
  mov    0x30(%rsp),%rax
  movl   $0x4,(%rax)
  xor    %eax,%eax
  call   <dskbr_@plt>
  mov    0x6c(%rsp),%esi
  lea    D252(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L373
L722:
  lea    D395(%rip),%rdi
  call   <puts@plt>
  jmp    L1442
L1180:
  mov    0x10(%rsp),%r12d
  shl    $0x2,%r12d
  test   %ebx,%ebx
  jne    L985
  movslq %r12d,%rdi
  mov    %r12d,0x5c(%rsp)
  call   <malloc@plt>
  mov    %rax,%rsi
  mov    0x8(%rsp),%rax
  mov    %rsi,(%rax)
  mov    0x30(%rsp),%rax
  movl   $0x5,(%rax)
L488:
  mov    0x20(%rsp),%rdx
  mov    %r14,%rcx
  mov    %rbp,%rdi
  xor    %eax,%eax
  call   <dskbr_@plt>
L614:
  cmpl   $0x0,0x6c(%rsp)
  jne    L1011
  mov    0x18(%rsp),%rsi
  xor    %eax,%eax
  mov    %rbp,%rdi
  movl   $0x1,0x78(%rsp)
  call   <dskbwr_@plt>
  xor    %eax,%eax
  call   <getbo@plt>
  cmp    0x40(%rsp),%eax
  je     L96
  test   %ebx,%ebx
  jne    L565
L1078:
  mov    0x8(%rsp),%rax
  mov    0x5c(%rsp),%esi
  mov    $0x1,%edi
  mov    (%rax),%rdx
  xor    %eax,%eax
  call   <swpbyt@plt>
  jmp    L96
L352:
  mov    0x10(%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,0x10(%rsp)
  test   %eax,%eax
  je     L1474
  sub    $0x1,%eax
  movl   $0x0,0x3c(%rsp)
  sete   %al
  movzbl %al,%eax
  mov    %eax,0x10(%rsp)
L1474:
  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    L450
  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 0x18(%rsp),%rax
  mov    %rax,0x40(%rsp)
  movslq 0x10(%rsp),%rax
  mov    %rax,0x48(%rsp)
L1127:
  mov    %edx,0x64(%rsp)
  cmp    %edx,0x38(%rsp)
  jle    L413
  test   %ebx,%ebx
  jne    L815
  xor    %eax,%eax
  mov    %r14,%rcx
  mov    %r12,%rdx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <dskbr_@plt>
  cmpl   $0x0,0x6c(%rsp)
  jne    L450
L613:
  mov    0x40(%rsp),%rax
  lea    0x2920(%rsp),%r9
  mov    0x60(%rsp),%r11d
  mov    %r9,%rdx
  lea    0x0(%r13,%rax,1),%r8
  movslq 0x7c(%rsp),%rax
  mov    %r8,0x28(%rsp)
  lea    -0x2(%r13,%rax,1),%r10
  xor    %eax,%eax
  jmp    L1253
L346:
  movzbl (%r8),%r11d
  movzbl 0x1(%r8),%eax
  mov    %rdx,%rdi
  add    $0x2,%r8
  mov    %r11,%rcx
  rep stos %al,%es:(%rdi)
  mov    $0x1,%eax
  mov    %rdi,%rdx
L1253:
  cmp    %r8,%r10
  ja     L346
  test   %al,%al
  je     L689
  mov    %r11d,0x60(%rsp)
L689:
  test   %ebx,%ebx
  jne    L533
L1412:
  mov    0x8(%rsp),%rax
  mov    0x48(%rsp),%rcx
  movslq 0x3c(%rsp),%rdx
  mov    (%rax),%rax
  mov    %rax,0x20(%rsp)
  mov    0x18(%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    L931
L1546:
  movzbl (%rdx),%edi
  add    $0x1,%rdx
  mov    %dil,(%rsi,%rax,2)
  movzbl (%r9,%rax,1),%edi
  mov    %dil,(%rcx,%rax,2)
  add    $0x1,%rax
L931:
  cmp    0x28(%rsp),%rdx
  jb     L1546
  test   %ebx,%ebx
  jne    L971
L1097:
  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    L1127
L565:
  lea    D395(%rip),%rdi
  call   <puts@plt>
  jmp    L1078
L985:
  lea    D215(%rip),%rdi
  call   <puts@plt>
  lea    D410(%rip),%rdi
  mov    %r12d,0x5c(%rsp)
  call   <puts@plt>
  mov    0x5c(%rsp),%esi
  lea    D22(%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    0x30(%rsp),%rax
  movl   $0x5,(%rax)
L385:
  mov    0x20(%rsp),%rdx
  mov    %rbp,%rdi
  mov    %r14,%rcx
  xor    %eax,%eax
  call   <dskbr_@plt>
  mov    0x6c(%rsp),%esi
  lea    D252(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L614
L815:
  mov    0x7c(%rsp),%esi
  lea    D581(%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    L450
  mov    0x7c(%rsp),%esi
  sub    0x18(%rsp),%esi
  lea    D69(%rip),%rdi
  xor    %eax,%eax
  sub    $0x2,%esi
  call   <printf@plt>
  jmp    L613
L533:
  mov    %rdx,%rsi
  lea    D486(%rip),%rdi
  xor    %eax,%eax
  mov    %r9,0x20(%rsp)
  sub    %r9,%rsi
  call   <printf@plt>
  mov    0x20(%rsp),%r9
  jmp    L1412
L971:
  mov    0x64(%rsp),%esi
  lea    D122(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  lea    D612(%rip),%rdi
  call   <puts@plt>
  jmp    L1097
L413:
  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    L450
  movslq 0x18(%rsp),%rax
  lea    0x2920(%rsp),%r12
  mov    0x60(%rsp),%r9d
  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    L1105
L1530:
  movzbl (%r8),%r9d
  movzbl 0x1(%r8),%eax
  mov    %rdx,%rdi
  add    $0x2,%r8
  mov    %r9,%rcx
  rep stos %al,%es:(%rdi)
  mov    $0x1,%eax
  mov    %rdi,%rdx
L1105:
  cmp    %r8,%r10
  ja     L1530
  test   %al,%al
  je     L211
  mov    %r9d,0x60(%rsp)
L211:
  test   %ebx,%ebx
  jne    L1069
L1204:
  mov    0x8(%rsp),%rax
  movslq 0x3c(%rsp),%rcx
  movslq 0x10(%rsp),%rdx
  mov    (%rax),%rax
  mov    %rax,0x20(%rsp)
  mov    0x18(%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    L641
L1477:
  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
L641:
  cmp    %r11,%r13
  jb     L1477
  test   %ebx,%ebx
  jne    L276
L830:
  mov    (%r15),%rdx
  lea    D87(%rip),%rsi
  lea    D280(%rip),%rdi
  xor    %eax,%eax
  call   <puthd@plt>
  mov    0x30(%rsp),%rax
  movl   $0x4,(%rax)
  jmp    L96
L450:
  movl   $0xfffffffe,0x6c(%rsp)
  jmp    L96
L905:
  mov    0x10(%rsp),%r13d
  shl    $0x3,%r13d
  test   %ebx,%ebx
  jne    L59
  movslq %r13d,%rdi
  mov    %r13d,0x5c(%rsp)
  call   <malloc@plt>
  mov    %rax,%rsi
  mov    0x8(%rsp),%rax
  mov    %rsi,(%rax)
  mov    0x30(%rsp),%rax
  movl   $0x9,(%rax)
  jmp    L488
L330:
  mov    0x10(%rsp),%r13d
  shl    $0x2,%r13d
  test   %ebx,%ebx
  jne    L530
  movslq %r13d,%rdi
  mov    %r13d,0x5c(%rsp)
  call   <malloc@plt>
  mov    %rax,%rsi
  mov    0x8(%rsp),%rax
  mov    %rsi,(%rax)
  mov    0x30(%rsp),%rax
  movl   $0x7,(%rax)
  jmp    L488
L59:
  lea    D424(%rip),%r12
  mov    %r12,%rdi
  call   <puts@plt>
  mov    %r12,%rdi
  mov    %r13d,0x5c(%rsp)
  call   <puts@plt>
  mov    0x5c(%rsp),%esi
  lea    D22(%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    0x30(%rsp),%rax
  movl   $0x9,(%rax)
  jmp    L385
L530:
  lea    D349(%rip),%r12
  mov    %r12,%rdi
  call   <puts@plt>
  mov    %r12,%rdi
  mov    %r13d,0x5c(%rsp)
  call   <puts@plt>
  mov    0x5c(%rsp),%esi
  lea    D22(%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    0x30(%rsp),%rax
  movl   $0x7,(%rax)
  jmp    L385
L573:
  lea    D545(%rip),%rdi
  call   <puts@plt>
  jmp    L356
L47:
  test   %ebx,%ebx
  jne    L615
  movl   $0xfffffffc,0x6c(%rsp)
  jmp    L1297
L1069:
  mov    %rdx,%rsi
  lea    D486(%rip),%rdi
  xor    %eax,%eax
  mov    %r11,0x20(%rsp)
  sub    %r12,%rsi
  call   <printf@plt>
  mov    0x20(%rsp),%r11
  jmp    L1204
L615:
  lea    D548(%rip),%rdi
  call   <puts@plt>
  movl   $0xfffffffc,0x6c(%rsp)
  jmp    L1151
L276:
  mov    0x64(%rsp),%esi
  lea    D122(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  lea    D533(%rip),%rdi
  call   <puts@plt>
  jmp    L830
```

tool_calls: name: disassemble_data
arguments: data_tag: D665
type_guessed: string
name: disassemble_data
arguments: data_tag: D42
type_guessed: string
name: disassemble_data
arguments: data_tag: D646
type_guessed: string
name: disassemble_data
arguments: data_tag: D466
type_guessed: string
name: disassemble_data
arguments: data_tag: D20
type_guessed: string
name: disassemble_data
arguments: data_tag: D330
type_guessed: string
name: disassemble_data
arguments: data_tag: D252
type_guessed: string
name: disassemble_data
arguments: data_tag: D411
type_guessed: string
name: disassemble_data
arguments: data_tag: D270
type_guessed: string
name: disassemble_data
arguments: data_tag: D291
type_guessed: string
name: disassemble_data
arguments: data_tag: D582
type_guessed: string
name: disassemble_data
arguments: data_tag: D593
type_guessed: string
name: disassemble_data
arguments: data_tag: D603
type_guessed: string
name: disassemble_data
arguments: data_tag: D280
type_guessed: string
name: disassemble_data
arguments: data_tag: D504
type_guessed: string
name: disassemble_data
arguments: data_tag: D87
type_guessed: string
name: disassemble_data
arguments: data_tag: D511
type_guessed: string
name: disassemble_data
arguments: data_tag: D583
type_guessed: string
name: disassemble_data
arguments: data_tag: D151
type_guessed: string
name: disassemble_data
arguments: data_tag: D120
type_guessed: string
name: disassemble_data
arguments: data_tag: D651
type_guessed: string
name: disassemble_data
arguments: data_tag: D558
type_guessed: string
name: disassemble_data
arguments: data_tag: D67
type_guessed: string
name: disassemble_data
arguments: data_tag: D201
type_guessed: string
name: disassemble_data
arguments: data_tag: D157
type_guessed: string
name: disassemble_data
arguments: data_tag: D577
type_guessed: string
name: disassemble_data
arguments: data_tag: D617
type_guessed: string
name: disassemble_data
arguments: data_tag: D311
type_guessed: string
name: disassemble_data
arguments: data_tag: D553
type_guessed: string
name: disassemble_data
arguments: data_tag: D649
type_guessed: string
name: disassemble_data
arguments: data_tag: D282
type_guessed: string
name: disassemble_data
arguments: data_tag: D26
type_guessed: string
name: disassemble_data
arguments: data_tag: D111
type_guessed: string
name: disassemble_data
arguments: data_tag: D476
type_guessed: string
name: disassemble_data
arguments: data_tag: D109
type_guessed: string
name: disassemble_data
arguments: data_tag: D343
type_guessed: string
name: disassemble_data
arguments: data_tag: D59
type_guessed: string
name: disassemble_data
arguments: data_tag: D472
type_guessed: string
name: disassemble_data
arguments: data_tag: D377
type_guessed: string
name: disassemble_data
arguments: data_tag: D346
type_guessed: string
name: disassemble_data
arguments: data_tag: D22
type_guessed: string
name: disassemble_data
arguments: data_tag: D395
type_guessed: string
name: disassemble_data
arguments: data_tag: D215
type_guessed: string
name: disassemble_data
arguments: data_tag: D410
type_guessed: string
name: disassemble_data
arguments: data_tag: D581
type_guessed: string
name: disassemble_data
arguments: data_tag: D69
type_guessed: string
name: disassemble_data
arguments: data_tag: D486
type_guessed: string
name: disassemble_data
arguments: data_tag: D122
type_guessed: string
name: disassemble_data
arguments: data_tag: D612
type_guessed: string
name: disassemble_data
arguments: data_tag: D424
type_guessed: string
name: disassemble_data
arguments: data_tag: D349
type_guessed: string
name: disassemble_data
arguments: data_tag: D545
type_guessed: string
name: disassemble_data
arguments: data_tag: D548
type_guessed: string
name: disassemble_data
arguments: data_tag: D533
type_guessed: string

tool: D665: DIM

tool: D42: Error reading dimensions

tool: D646: Done reading file

tool: D466: RDSMV completion status %d


tool: D20: Opening file: %s


tool: D330: Reading header

tool: D252: Read Completion status : %d


tool: D411: %d

tool: D270: SIZE%d

tool: D291: Error reading %s


tool: D582: Header length : %d


tool: D593: Number of dimensions : %d


tool: D603: BYTE_ORDER

tool: D280: TYPE

tool: D504: mad

tool: D87: unsigned_short

tool: D511: long

tool: D583: long_integer

tool: D151: signed_long

tool: D120: float

tool: D651: ieee_float

tool: D558: complex

tool: D67: ieee_complex

tool: D201: swap_rlmsb

tool: D157: Type >%s<


tool: D577: Image size (%d)

tool: D617:  %d 

tool: D311: Number of elements : %d


tool: D553: Byte order : big_endian

tool: D649: char

tool: D282: Reading byte image

tool: D26: Allocating %d bytes for byte image


tool: D111: Reading unsigned byte image

tool: D476: Read Byte Completion status : %d


tool: D109: Allocating %d bytes for short image


tool: D343: Converting %d bytes to short image


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


tool: D472: Byte order : little_endian

tool: D377: Reading bit image

tool: D346: Reading unsigned short image

tool: D22: Allocating %d bytes


tool: D395: Swapping bytes

tool: D215: Reading long image

tool: D410: Reading signed long image

tool: D581: Reading %d bytes


tool: D69: Uncompressing %d bytes


tool: D486: Restored %d bytes in MSB


tool: D122: Done line %d


tool: D612: =================================

tool: D424: Reading complex image

tool: D349: Reading float image

tool: D545: Reading compressed image

tool: D548: Unsupported Filetype

tool: D533: ===================================

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;
}
```