user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<rdmad>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  lea    -0x5000(%rsp),%r11
L865:
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  cmp    %r11,%rsp
  jne    L865
  sub    $0x138,%rsp
  mov    0x5170(%rsp),%rax
  mov    %rdx,0x10(%rsp)
  mov    %rdi,%r12
  mov    %rsi,%r13
  mov    %ecx,0x28(%rsp)
  mov    %r9,(%rsp)
  mov    %rax,0x8(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x5128(%rsp)
  xor    %eax,%eax
  movl   $0x1,0x74(%rsp)
  call   <filec_getdebug@plt>
  mov    %r12,%rdi
  mov    %eax,%ebx
  call   <strlen@plt>
  mov    %eax,0x64(%rsp)
  test   %ebx,%ebx
  jne    L304
  lea    0x68(%rsp),%r15
  lea    0x74(%rsp),%rbp
  mov    %r12,%rsi
  lea    0x64(%rsp),%rdx
  mov    %r15,%rcx
  mov    %rbp,%rdi
  call   <dskbor_@plt>
  mov    0x68(%rsp),%eax
  test   %eax,%eax
  jne    L868
  lea    0x78(%rsp),%r12
  mov    %rbp,%rdi
  movl   $0x1,0x78(%rsp)
  mov    %r12,%rsi
  call   <dskbwr_@plt>
  lea    0x5c(%rsp),%rax
  mov    %r15,%rcx
  mov    %r13,%rsi
  mov    %rax,%rdx
  mov    %rbp,%rdi
  mov    %rax,0x18(%rsp)
  movl   $0x200,0x5c(%rsp)
  call   <dskbr_@plt>
  mov    0x68(%rsp),%ecx
  test   %ecx,%ecx
  jne    L905
  lea    0x6c(%rsp),%rdi
  mov    %r13,%rsi
  call   <gethdl@plt>
  mov    0x6c(%rsp),%eax
  sub    $0x200,%eax
  mov    %eax,0x5c(%rsp)
  test   %eax,%eax
  jle    L667
  mov    0x18(%rsp),%rdx
  lea    0x200(%r13),%rsi
  mov    %r15,%rcx
  mov    %rbp,%rdi
  call   <dskbr_@plt>
  mov    0x68(%rsp),%edx
  test   %edx,%edx
  jne    L905
L667:
  mov    %r12,%rsi
  mov    %rbp,%rdi
  movl   $0x0,0x78(%rsp)
  lea    0x80(%rsp),%r14
  call   <dskbwr_@plt>
  lea    D315(%rip),%rax
  mov    %r13,%rdx
  mov    %r14,%rsi
  mov    %rax,%rdi
  mov    %rax,0x20(%rsp)
  call   <gethd@plt>
L164:
  lea    D141(%rip),%rsi
  mov    %r14,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L281
  lea    D67(%rip),%rsi
  mov    %r14,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L140
L281:
  lea    0xd0(%rsp),%rax
  mov    %r13,%rdx
  lea    D87(%rip),%rdi
  mov    %rax,%rsi
  mov    %rax,0x20(%rsp)
  call   <gethd@plt>
  mov    %r13,%rdx
  mov    %r14,%rsi
  lea    D90(%rip),%rdi
  call   <gethd@plt>
  cmpb   $0x0,0x80(%rsp)
  je     L803
  mov    (%rsp),%rdx
  lea    D265(%rip),%rsi
  mov    %r14,%rdi
  call   <sscanf@plt>
  cmp    $0x1,%eax
  je     L393
L803:
  test   %ebx,%ebx
  je     L474
L215:
  mov    0x68(%rsp),%ecx
L483:
  mov    0x8(%rsp),%rax
  lea    D63(%rip),%rdi
  mov    (%rax),%edx
  mov    (%rsp),%rax
  mov    (%rax),%esi
  xor    %eax,%eax
  call   <printf@plt>
L474:
  mov    0x68(%rsp),%esi
  test   %esi,%esi
  jne    L905
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <dskbcr_@plt>
  test   %ebx,%ebx
  jne    L817
L104:
  mov    0x68(%rsp),%eax
L868:
  mov    0x5128(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L931
  add    $0x5138,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L304:
  mov    %r12,%rsi
  lea    0x68(%rsp),%r15
  lea    0x74(%rsp),%rbp
  xor    %eax,%eax
  lea    D72(%rip),%rdi
  call   <printf@plt>
  lea    0x64(%rsp),%rdx
  mov    %r15,%rcx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <dskbor_@plt>
  mov    0x68(%rsp),%eax
  test   %eax,%eax
  jne    L868
  lea    D184(%rip),%rdi
  lea    0x78(%rsp),%r12
  movl   $0x1,0x78(%rsp)
  call   <puts@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <dskbwr_@plt>
  lea    0x5c(%rsp),%rax
  mov    %r15,%rcx
  mov    %r13,%rsi
  mov    %rax,%rdx
  mov    %rbp,%rdi
  mov    %rax,0x18(%rsp)
  movl   $0x200,0x5c(%rsp)
  call   <dskbr_@plt>
  mov    0x68(%rsp),%esi
  lea    D40(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x68(%rsp),%ecx
  test   %ecx,%ecx
  jne    L483
  lea    0x6c(%rsp),%rdi
  mov    %r13,%rsi
  call   <gethdl@plt>
  mov    0x6c(%rsp),%esi
  lea    D34(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x6c(%rsp),%eax
  sub    $0x200,%eax
  mov    %eax,0x5c(%rsp)
  test   %eax,%eax
  jle    L935
  mov    0x18(%rsp),%rdx
  lea    0x200(%r13),%rsi
  mov    %r15,%rcx
  mov    %rbp,%rdi
  call   <dskbr_@plt>
  mov    0x68(%rsp),%eax
  test   %eax,%eax
  jne    L215
L935:
  mov    %r12,%rsi
  mov    %rbp,%rdi
  lea    0x80(%rsp),%r14
  movl   $0x0,0x78(%rsp)
  call   <dskbwr_@plt>
  lea    D315(%rip),%rax
  mov    %r14,%rsi
  mov    %r13,%rdx
  mov    %rax,%rdi
  mov    %rax,0x20(%rsp)
  call   <gethd@plt>
  mov    %r14,%rsi
  lea    D91(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L164
  nopl   0x0(%rax)
L393:
  mov    %r13,%rdx
  mov    %r14,%rsi
  lea    D241(%rip),%rdi
  call   <gethd@plt>
  cmpb   $0x0,0x80(%rsp)
  je     L803
  mov    0x8(%rsp),%rdx
  lea    D265(%rip),%rsi
  mov    %r14,%rdi
  call   <sscanf@plt>
  cmp    $0x1,%eax
  jne    L803
  mov    %r13,%rdx
  mov    %r14,%rsi
  lea    D323(%rip),%rdi
  call   <gethd@plt>
  cmpb   $0x0,0x80(%rsp)
  je     L803
  lea    0x70(%rsp),%rdx
  lea    D265(%rip),%rsi
  mov    %r14,%rdi
  call   <sscanf@plt>
  mov    %eax,%r13d
  cmp    $0x1,%eax
  jne    L803
  mov    0x8(%rsp),%rax
  mov    (%rax),%edx
  mov    (%rsp),%rax
  mov    (%rax),%esi
  test   %ebx,%ebx
  jne    L268
  cmp    %esi,0x28(%rsp)
  je     L501
L341:
  mov    0x8(%rsp),%rcx
  add    %esi,%esi
  movl   $0x0,0x64(%rsp)
  mov    %esi,0x5c(%rsp)
  cmpl   $0x0,(%rcx)
  jle    L106
  mov    %r13d,0x48(%rsp)
  mov    0x18(%rsp),%r14
  xor    %eax,%eax
  mov    %ebx,0x2c(%rsp)
  mov    0x10(%rsp),%r13
  mov    %r12,0x18(%rsp)
  mov    0x28(%rsp),%ebx
  mov    %rcx,%r12
  jmp    L718
L93:
  mov    0x64(%rsp),%eax
  add    $0x1,%eax
  mov    %eax,0x64(%rsp)
  cmp    (%r12),%eax
  jge    L911
L718:
  imul   %ebx,%eax
  mov    %rbp,%rdi
  mov    %r15,%rcx
  mov    %r14,%rdx
  cltq
  lea    0x0(%r13,%rax,2),%rsi
  call   <dskbr_@plt>
  mov    0x68(%rsp),%edi
  test   %edi,%edi
  je     L93
  mov    0x2c(%rsp),%ebx
  nopl   0x0(%rax)
L626:
  test   %ebx,%ebx
  jne    L215
L905:
  lea    0x60(%rsp),%rsi
  mov    %rbp,%rdi
  call   <dskbcr_@plt>
  test   %ebx,%ebx
  je     L104
L817:
  mov    0x68(%rsp),%esi
  lea    D273(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L104
  nopl   0x0(%rax)
L140:
  lea    D86(%rip),%rsi
  mov    %r14,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L872
  mov    %r13,%rdx
  mov    %r14,%rsi
  lea    D90(%rip),%rdi
  call   <gethd@plt>
  cmpb   $0x0,0x80(%rsp)
  je     L803
  lea    D265(%rip),%r12
  mov    (%rsp),%rdx
  mov    %r14,%rdi
  mov    %r12,%rsi
  call   <sscanf@plt>
  cmp    $0x1,%eax
  jne    L803
  mov    %r13,%rdx
  mov    %r14,%rsi
  lea    D241(%rip),%rdi
  call   <gethd@plt>
  cmpb   $0x0,0x80(%rsp)
  je     L803
  mov    0x8(%rsp),%rdx
  mov    %r12,%rsi
  mov    %r14,%rdi
  call   <sscanf@plt>
  cmp    $0x1,%eax
  jne    L803
  mov    %r13,%rdx
  mov    %r14,%rsi
  lea    D323(%rip),%rdi
  call   <gethd@plt>
  cmpb   $0x0,0x80(%rsp)
  je     L803
  lea    0x70(%rsp),%rdx
  mov    %r12,%rsi
  mov    %r14,%rdi
  call   <sscanf@plt>
  mov    %eax,0x18(%rsp)
  sub    $0x1,%eax
  jne    L803
  xor    %eax,%eax
  call   <getbo@plt>
  mov    %eax,0x2c(%rsp)
  test   %eax,%eax
  je     L189
  sub    $0x1,%eax
  setne  %al
  movzbl %al,%eax
  mov    %eax,0x18(%rsp)
L189:
  lea    0x7c(%rsp),%r14
  lea    0x120(%rsp),%r12
  mov    %r15,%rcx
  mov    %rbp,%rdi
  mov    %r14,%rdx
  mov    %r12,%rsi
  movl   $0x2,0x7c(%rsp)
  call   <dskbr_@plt>
  mov    0x68(%rsp),%r8d
  test   %r8d,%r8d
  jne    L626
  mov    0x7c(%rsp),%eax
  mov    %r13,0x40(%rsp)
  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)
  movslq 0x2c(%rsp),%rax
  mov    %rax,0x30(%rsp)
  movslq 0x18(%rsp),%rax
  mov    %rax,0x38(%rsp)
L748:
  mov    0x8(%rsp),%rax
  mov    %r8d,0x64(%rsp)
  mov    (%rax),%eax
  mov    %eax,0x48(%rsp)
  sub    $0x1,%eax
  cmp    %r8d,%eax
  jle    L518
  test   %ebx,%ebx
  jne    L502
  mov    %r15,%rcx
  mov    %r14,%rdx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <dskbr_@plt>
  cmpl   $0x0,0x68(%rsp)
  jne    L905
  mov    (%rsp),%rax
  movslq (%rax),%rsi
  movslq 0x7c(%rsp),%rax
  mov    %rsi,%r13
  lea    -0x2(%r12,%rax,1),%r11
  add    %r12,%rsi
  cmp    %r11,%rsi
  jae    L292
L716:
  lea    0x2920(%rsp),%r9
  mov    %r9,%r8
  jmp    L4
L874:
  test   $0x4,%r10b
  jne    L89
  test   %r10d,%r10d
  je     L138
  mov    %al,(%r8)
  test   $0x2,%r10b
  jne    L516
L138:
  add    %rdx,%r8
L9:
  cmp    %rsi,%r11
  jbe    L91
L4:
  movzbl (%rsi),%r10d
  add    $0x2,%rsi
  movzbl -0x1(%rsi),%eax
  mov    %r10,%rdx
  test   %r10d,%r10d
  je     L9
  movabs $0x101010101010101,%rcx
  imul   %rcx,%rax
  cmp    $0x8,%r10d
  jb     L874
  lea    0x8(%r8),%rdi
  mov    %r8,%rcx
  mov    %rax,(%r8)
  and    $0xfffffffffffffff8,%rdi
  mov    %rax,-0x8(%r8,%r10,1)
  sub    %rdi,%rcx
  add    %r10d,%ecx
  shr    $0x3,%ecx
  rep stos %rax,%es:(%rdi)
  jmp    L138
  nopl   0x0(%rax)
L872:
  test   %ebx,%ebx
  jne    L795
L656:
  movl   $0xfffffffe,0x68(%rsp)
  jmp    L626
L795:
  lea    D5(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L656
L911:
  mov    0x48(%rsp),%r13d
  mov    0x2c(%rsp),%ebx
  mov    0x18(%rsp),%r12
L106:
  mov    %r12,%rsi
  mov    %rbp,%rdi
  movl   $0x1,0x78(%rsp)
  call   <dskbwr_@plt>
  cmpb   $0x0,0xd0(%rsp)
  je     L811
  mov    0x20(%rsp),%rdi
  lea    D336(%rip),%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L615
  xor    %r13d,%r13d
L811:
  xor    %eax,%eax
  call   <getbo@plt>
  cmp    %r13d,%eax
  je     L803
  test   %ebx,%ebx
  jne    L283
L318:
  mov    0x8(%rsp),%r14
  movl   $0x0,0x64(%rsp)
  cmpl   $0x0,(%r14)
  jle    L803
  mov    0x10(%rsp),%r12
  mov    (%rsp),%r13
  xor    %eax,%eax
L899:
  imul   0x28(%rsp),%eax
  xor    %edi,%edi
  cltq
  lea    (%r12,%rax,2),%rdx
  mov    0x0(%r13),%eax
  lea    (%rax,%rax,1),%esi
  call   <swpbyt@plt>
  mov    0x64(%rsp),%eax
  add    $0x1,%eax
  mov    %eax,0x64(%rsp)
  cmp    (%r14),%eax
  jl     L899
  jmp    L803
L91:
  mov    %r10d,0x60(%rsp)
  test   %ebx,%ebx
  je     L292
L835:
  mov    %r8,%rsi
  lea    D245(%rip),%rdi
  xor    %eax,%eax
  sub    %r9,%rsi
  call   <printf@plt>
  mov    (%rsp),%rax
  mov    (%rax),%r13d
L292:
  mov    0x64(%rsp),%r8d
  mov    0x28(%rsp),%eax
  mov    0x30(%rsp),%rcx
  imul   %r8d,%eax
  add    %eax,%eax
  cltq
  lea    (%rcx,%rax,1),%rdi
  mov    0x10(%rsp),%rcx
  add    0x38(%rsp),%rax
  add    %rcx,%rdi
  add    %rax,%rcx
  movslq %r13d,%rax
  add    %r12,%rax
  cmp    %rax,%r12
  jae    L773
  mov    (%rsp),%r10
  xor    %eax,%eax
  mov    %r12,%rdx
  lea    0x2920(%rsp),%r9
L500:
  movzbl (%rdx),%esi
  add    $0x1,%rdx
  mov    %sil,(%rdi,%rax,2)
  movzbl (%r9,%rax,1),%esi
  mov    %sil,(%rcx,%rax,2)
  movslq (%r10),%rsi
  add    $0x1,%rax
  add    %r12,%rsi
  cmp    %rsi,%rdx
  jb     L500
L773:
  test   %ebx,%ebx
  jne    L904
L744:
  mov    0x7c(%rsp),%eax
  add    $0x1,%r8d
  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)
  jmp    L748
L268:
  mov    0x70(%rsp),%ecx
  lea    D126(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    (%rsp),%rax
  mov    0x28(%rsp),%ecx
  cmp    (%rax),%ecx
  je     L77
  lea    D131(%rip),%rdi
  call   <puts@plt>
  mov    (%rsp),%rax
  mov    (%rax),%esi
  jmp    L341
L931:
  call   <__stack_chk_fail@plt>
L501:
  mov    0x28(%rsp),%eax
  mov    0x10(%rsp),%rsi
  mov    %r15,%rcx
  mov    %rbp,%rdi
  imul   %edx,%eax
  mov    0x18(%rsp),%rdx
  add    %eax,%eax
  mov    %eax,0x5c(%rsp)
  call   <dskbr_@plt>
  cmpl   $0x0,0x68(%rsp)
  je     L106
  jmp    L905
L904:
  mov    %r8d,%esi
  lea    D182(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  lea    D224(%rip),%rdi
  call   <puts@plt>
  mov    0x64(%rsp),%r8d
  jmp    L744
L89:
  mov    %eax,(%r8)
  mov    %eax,-0x4(%r8,%r10,1)
  jmp    L138
L77:
  lea    D180(%rip),%rdi
  call   <puts@plt>
  mov    0x8(%rsp),%rcx
  mov    (%rsp),%rax
  mov    %rbp,%rdi
  mov    0x18(%rsp),%rdx
  mov    0x10(%rsp),%rsi
  mov    (%rax),%eax
  imul   (%rcx),%eax
  mov    %r15,%rcx
  add    %eax,%eax
  mov    %eax,0x5c(%rsp)
  call   <dskbr_@plt>
  mov    0x68(%rsp),%esi
  lea    D40(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x68(%rsp),%ecx
  test   %ecx,%ecx
  je     L106
  jmp    L483
L502:
  mov    0x7c(%rsp),%esi
  lea    D78(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    %r15,%rcx
  mov    %r14,%rdx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <dskbr_@plt>
  cmpl   $0x0,0x68(%rsp)
  jne    L215
  mov    (%rsp),%r13
  mov    0x7c(%rsp),%esi
  lea    D16(%rip),%rdi
  xor    %eax,%eax
  sub    0x0(%r13),%esi
  sub    $0x2,%esi
  call   <printf@plt>
  movslq 0x0(%r13),%rsi
  movslq 0x7c(%rsp),%rax
  mov    %rsi,%r13
  lea    -0x2(%r12,%rax,1),%r11
  add    %r12,%rsi
  cmp    %rsi,%r11
  ja     L716
  lea    0x2920(%rsp),%r9
  mov    %r9,%r8
  jmp    L835
L283:
  lea    D75(%rip),%rdi
  call   <puts@plt>
  jmp    L318
L615:
  mov    0x20(%rsp),%rdi
  lea    D206(%rip),%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L811
  jmp    L656
L516:
  mov    %ax,-0x2(%r8,%r10,1)
  jmp    L138
L518:
  mov    %r15,%rcx
  mov    %r14,%rdx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  subl   $0x2,0x7c(%rsp)
  mov    0x40(%rsp),%r13
  call   <dskbr_@plt>
  cmpl   $0x0,0x68(%rsp)
  jne    L626
  mov    (%rsp),%rax
  lea    0x2920(%rsp),%r14
  mov    0x4c(%rsp),%r11d
  mov    %r14,%rdx
  movslq (%rax),%r8
  movslq 0x7c(%rsp),%rax
  mov    %r8,%rsi
  lea    (%r12,%rax,1),%r10
  add    %r12,%r8
  xor    %eax,%eax
  jmp    L362
L433:
  movzbl (%r8),%r11d
  add    $0x2,%r8
  movzbl -0x1(%r8),%eax
  test   %r11d,%r11d
  je     L709
  mov    %rdx,%rdi
  mov    %r11,%rcx
  rep stos %al,%es:(%rdi)
  mov    %rdi,%rdx
L709:
  mov    $0x1,%eax
L362:
  cmp    %r8,%r10
  ja     L433
  test   %al,%al
  je     L527
  mov    %r11d,0x60(%rsp)
L527:
  test   %ebx,%ebx
  jne    L124
L869:
  mov    0x28(%rsp),%ecx
  imul   0x64(%rsp),%ecx
  movslq 0x2c(%rsp),%rdx
  movslq 0x18(%rsp),%rax
  mov    0x10(%rsp),%rdi
  add    %ecx,%ecx
  movslq %ecx,%rcx
  add    %rcx,%rdx
  add    %rcx,%rax
  xor    %ecx,%ecx
  add    %rdi,%rdx
  add    %rdi,%rax
  mov    %r12,%rdi
  jmp    L370
L932:
  movzbl (%rdi),%esi
  add    $0x1,%rdi
  mov    %sil,(%rdx,%rcx,2)
  movzbl (%r14,%rcx,1),%esi
  mov    %sil,(%rax,%rcx,2)
  mov    (%rsp),%rsi
  add    $0x1,%rcx
  movslq (%rsi),%rsi
L370:
  add    %r12,%rsi
  cmp    %rsi,%rdi
  jb     L932
  test   %ebx,%ebx
  jne    L809
L612:
  mov    0x20(%rsp),%rdi
  mov    %r13,%rdx
  lea    D67(%rip),%rsi
  call   <puthd@plt>
  jmp    L803
L124:
  sub    %r14,%rdx
  lea    D245(%rip),%rdi
  xor    %eax,%eax
  mov    %rdx,%rsi
  call   <printf@plt>
  mov    (%rsp),%rax
  movslq (%rax),%rsi
  jmp    L869
L809:
  lea    D142(%rip),%rdi
  call   <puts@plt>
  jmp    L612
```

tool_calls: name: disassemble_data
arguments: label: D315
datatype: string
name: disassemble_data
arguments: label: D141
datatype: string
name: disassemble_data
arguments: label: D67
datatype: string
name: disassemble_data
arguments: label: D87
datatype: string
name: disassemble_data
arguments: label: D90
datatype: string
name: disassemble_data
arguments: label: D265
datatype: string
name: disassemble_data
arguments: label: D63
datatype: string
name: disassemble_data
arguments: label: D72
datatype: string
name: disassemble_data
arguments: label: D184
datatype: string
name: disassemble_data
arguments: label: D40
datatype: string
name: disassemble_data
arguments: label: D34
datatype: string
name: disassemble_data
arguments: label: D91
datatype: string
name: disassemble_data
arguments: label: D241
datatype: string
name: disassemble_data
arguments: label: D323
datatype: string
name: disassemble_data
arguments: label: D273
datatype: string
name: disassemble_data
arguments: label: D86
datatype: string
name: disassemble_data
arguments: label: D5
datatype: string
name: disassemble_data
arguments: label: D336
datatype: string
name: disassemble_data
arguments: label: D245
datatype: string
name: disassemble_data
arguments: label: D126
datatype: string
name: disassemble_data
arguments: label: D131
datatype: string
name: disassemble_data
arguments: label: D182
datatype: string
name: disassemble_data
arguments: label: D224
datatype: string
name: disassemble_data
arguments: label: D180
datatype: string
name: disassemble_data
arguments: label: D78
datatype: string
name: disassemble_data
arguments: label: D16
datatype: string
name: disassemble_data
arguments: label: D75
datatype: string
name: disassemble_data
arguments: label: D206
datatype: string
name: disassemble_data
arguments: label: D142
datatype: string

tool: D315: TYPE

tool: D141: mad

tool: D67: unsigned_short

tool: D87: BYTE_ORDER

tool: D90: SIZE1

tool: D265: %d

tool: D63: Done reading Image size %d %d (%d)


tool: D72: Opening file: %s


tool: D184: Reading header

tool: D40: Read Completion status : %d


tool: D34: Header length : %d


tool: D91: Type >%s<


tool: D241: SIZE2

tool: D323: DIM

tool: D273: RDFILE completion status %d


tool: D86: swap_rlmsb

tool: D5: Unsupported Filetype (%s)


tool: D336: little_endian

tool: D245: Restored %d bytes in MSB


tool: D126: Image size %d %d %d


tool: D131: Reading one line at a time

tool: D182: Done line %d


tool: D224: =================================

tool: D180: Reading in single chunk

tool: D78: Reading %d bytes


tool: D16: Uncompressing %d bytes


tool: D75: Swapping bytes

tool: D206: big_endian

tool: D142: ===================================

assistant: ```c
int rdmad(char *filename, char *head, short *array, int as1, int as2, int *is1, int *is2) {
  int readl, remain;
  int i, j, k;
  int istat, lhead, bo, dim;
  char s[80], byteo[80];
  int lun = 1;
  int lflag;
  unsigned char lsb[10 * 1024], msb[10 * 1024];
  unsigned char *lp, *mp, *alp, *amp;
  int lstart, mstart;
  int llen, n, val;
  int filec_debug = filec_getdebug();
  j = strlen(filename);
  if (filec_debug)
    printf("Opening file: %s\n", filename);
  dskbor_(&lun, filename, &j, &istat);
  if (istat != 0)
    return (istat);
  lflag = (1 == 1);
  if (filec_debug)
    printf("Reading header\n");
  dskbwr_(&lun, &lflag);
  readl = 512;
  dskbr_(&lun, head, &readl, &istat);
  if (filec_debug)
    printf("Read Completion status : %d\n", istat);
  if (istat != 0)
    goto close;
  gethdl(&lhead, head);
  if (filec_debug)
    printf("Header length : %d\n", lhead);
  readl = lhead - 512;
  if (readl > 0) {
    dskbr_(&lun, head + 512, &readl, &istat);
    if (istat != 0)
      goto close;
  }
  lflag = (1 == 0);
  dskbwr_(&lun, &lflag);
  gethd("TYPE", s, head);
  if (filec_debug)
    printf("Type >%s<\n", s);
  if (strcmp(s, "mad") == 0 || strcmp(s, "unsigned_short") == 0) {
    gethd("BYTE_ORDER", byteo, head);
    gethd("SIZE1", s, head);
    if (*s == 0 || sscanf(s, "%d", is1) != 1)
      goto close;
    gethd("SIZE2", s, head);
    if (*s == 0 || sscanf(s, "%d", is2) != 1)
      goto close;
    gethd("DIM", s, head);
    if (*s == 0 || sscanf(s, "%d", &dim) != 1)
      goto close;
    if (filec_debug)
      printf("Image size %d %d %d\n", *is1, *is2, dim);
    if (*is1 == as1) {
      if (filec_debug)
        printf("Reading in single chunk\n");
      readl = (*is1) * (*is2) * 2;
      dskbr_(&lun, (char *)array, &readl, &istat);
      if (filec_debug)
        printf("Read Completion status : %d\n", istat);
      if (istat != 0)
        goto close;
    } else {
      if (filec_debug)
        printf("Reading one line at a time\n");
      readl = *is1 * 2;
      for (j = 0; j < *is2; j++) {
        dskbr_(&lun, (char *)(array + j * as1), &readl, &istat);
        if (istat != 0)
          goto close;
      }
    }
    lflag = (1 == 1);
    dskbwr_(&lun, &lflag);
    if (*byteo) {
      if (strcmp(byteo, "little_endian") == 0)
        bo = 0;
      else if (strcmp(byteo, "big_endian") == 0)
        bo = 1;
      else {
        istat = -2;
        goto close;
      }
    }
    if (bo != getbo()) {
      if (filec_debug)
        printf("Swapping bytes\n");
      for (j = 0; j < *is2; j++)
        swpbyt(0, 2 * *is1, (char *)(array + j * as1));
    }
  } else if (strcmp(s, "swap_rlmsb") == 0) {
    gethd("SIZE1", s, head);
    if (*s == 0 || sscanf(s, "%d", is1) != 1)
      goto close;
    gethd("SIZE2", s, head);
    if (*s == 0 || sscanf(s, "%d", is2) != 1)
      goto close;
    gethd("DIM", s, head);
    if (*s == 0 || sscanf(s, "%d", &dim) != 1)
      goto close;
    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)
      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)
        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++;
        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 * as1 + lstart;
      amp = (unsigned char *)array + 2 * j * as1 + 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)
      goto close;
    for (lp = lsb + (*is1), mp = msb; lp < lsb + llen;) {
      n = *lp++;
      val = *lp++;
      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 * as1 + lstart;
    amp = (unsigned char *)array + 2 * j * as1 + mstart;
    for (lp = lsb, mp = msb; lp < lsb + (*is1); alp += 2, amp += 2) {
      *alp = *lp++;
      *amp = *mp++;
    }
    if (filec_debug)
      printf("===================================\n");
    puthd("TYPE", "unsigned_short", head);
  } else {
    if (filec_debug)
      printf("Unsupported Filetype (%s)\n");
    istat = -2;
    goto close;
  }
close:
  if (filec_debug)
    printf("Done reading Image size %d %d (%d)\n", *is1, *is2, istat);
  if (istat != 0)
    dskbcr_(&lun, &i);
  else
    dskbcr_(&lun, &istat);
  if (filec_debug)
    printf("RDFILE completion status %d\n", istat);
  return (istat);
}
```