user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<BUSView>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    $0x3,%esi
  mov    $0x0,%edi
  mov    $0x0,%eax
  call   <iGetPortConfig@plt>
  mov    %al,-0x24(%rbp)
  mov    $0x3,%esi
  mov    $0x1,%edi
  mov    $0x0,%eax
  call   <iGetPortConfig@plt>
  mov    %al,-0x23(%rbp)
  mov    $0x3,%esi
  mov    $0x2,%edi
  mov    $0x0,%eax
  call   <iGetPortConfig@plt>
  mov    %al,-0x22(%rbp)
  mov    $0x3,%esi
  mov    $0x3,%edi
  mov    $0x0,%eax
  call   <iGetPortConfig@plt>
  mov    %al,-0x21(%rbp)
  mov    $0x2,%esi
  mov    $0x0,%edi
  mov    $0x0,%eax
  call   <iGetPortConfig@plt>
  mov    %al,-0x20(%rbp)
  mov    $0x2,%esi
  mov    $0x1,%edi
  mov    $0x0,%eax
  call   <iGetPortConfig@plt>
  mov    %al,-0x1f(%rbp)
  mov    $0x2,%esi
  mov    $0x2,%edi
  mov    $0x0,%eax
  call   <iGetPortConfig@plt>
  mov    %al,-0x1e(%rbp)
  mov    $0x2,%esi
  mov    $0x3,%edi
  mov    $0x0,%eax
  call   <iGetPortConfig@plt>
  mov    %al,-0x1d(%rbp)
  mov    $0x1,%esi
  mov    $0x0,%edi
  mov    $0x0,%eax
  call   <iGetPortConfig@plt>
  mov    %al,-0x1c(%rbp)
  mov    $0x1,%esi
  mov    $0x1,%edi
  mov    $0x0,%eax
  call   <iGetPortConfig@plt>
  mov    %al,-0x1b(%rbp)
  mov    $0x1,%esi
  mov    $0x2,%edi
  mov    $0x0,%eax
  call   <iGetPortConfig@plt>
  mov    %al,-0x1a(%rbp)
  mov    $0x1,%esi
  mov    $0x3,%edi
  mov    $0x0,%eax
  call   <iGetPortConfig@plt>
  mov    %al,-0x19(%rbp)
  mov    $0x0,%edi
  mov    $0x0,%eax
  call   <bReadPort@plt>
  mov    %al,-0x18(%rbp)
  mov    $0x1,%edi
  mov    $0x0,%eax
  call   <bReadPort@plt>
  mov    %al,-0x17(%rbp)
  mov    $0x2,%edi
  mov    $0x0,%eax
  call   <bReadPort@plt>
  mov    %al,-0x16(%rbp)
  mov    $0x3,%edi
  mov    $0x0,%eax
  call   <bReadPort@plt>
  mov    %al,-0x15(%rbp)
  lea    D163(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <system@plt>
  lea    D240(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  lea    D239(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  lea    D240(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    $0x21,%edx
  mov    $0x20,%esi
  lea    D274(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D240(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  lea    D353(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  lea    D240(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  movl   $0x1,-0x4(%rbp)
  jmp    L589
L644:
  movb   $0x0,-0x14(%rbp)
  cmpl   $0x0,-0x4(%rbp)
  jle    L615
  cmpl   $0x20,-0x4(%rbp)
  jg     L615
  mov    -0x4(%rbp),%eax
  sub    $0x1,%eax
  and    $0x7,%eax
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  mov    %eax,%edx
  movzbl -0x14(%rbp),%eax
  or     %edx,%eax
  mov    %al,-0x14(%rbp)
  movzbl -0x14(%rbp),%eax
  mov    %al,-0x34(%rbp)
  jmp    L412
L615:
  movb   $0xf6,-0x34(%rbp)
L412:
  movzbl -0x34(%rbp),%eax
  and    -0x24(%rbp),%al
  test   %al,%al
  je     L6
  lea    D27(%rip),%rax
  jmp    L227
L6:
  lea    D101(%rip),%rax
L227:
  mov    %rax,%rsi
  lea    D497(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movb   $0x0,-0x13(%rbp)
  cmpl   $0x0,-0x4(%rbp)
  jle    L663
  cmpl   $0x20,-0x4(%rbp)
  jg     L663
  mov    -0x4(%rbp),%eax
  sub    $0x1,%eax
  and    $0x7,%eax
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  mov    %eax,%edx
  movzbl -0x13(%rbp),%eax
  or     %edx,%eax
  mov    %al,-0x13(%rbp)
  movzbl -0x13(%rbp),%eax
  mov    %al,-0x33(%rbp)
  jmp    L338
L663:
  movb   $0xf6,-0x33(%rbp)
L338:
  movzbl -0x33(%rbp),%eax
  and    -0x20(%rbp),%al
  test   %al,%al
  je     L255
  lea    D261(%rip),%rax
  jmp    L560
L255:
  lea    D203(%rip),%rax
L560:
  mov    %rax,%rsi
  lea    D386(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movb   $0x0,-0x12(%rbp)
  cmpl   $0x0,-0x4(%rbp)
  jle    L171
  cmpl   $0x20,-0x4(%rbp)
  jg     L171
  mov    -0x4(%rbp),%eax
  sub    $0x1,%eax
  and    $0x7,%eax
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  mov    %eax,%edx
  movzbl -0x12(%rbp),%eax
  or     %edx,%eax
  mov    %al,-0x12(%rbp)
  movzbl -0x12(%rbp),%eax
  mov    %al,-0x32(%rbp)
  jmp    L463
L171:
  movb   $0xf6,-0x32(%rbp)
L463:
  movzbl -0x32(%rbp),%eax
  and    -0x1c(%rbp),%al
  test   %al,%al
  je     L398
  lea    D151(%rip),%rax
  jmp    L323
L398:
  lea    D221(%rip),%rax
L323:
  mov    %rax,%rsi
  lea    D115(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movb   $0x0,-0x11(%rbp)
  cmpl   $0x0,-0x4(%rbp)
  jle    L662
  cmpl   $0x20,-0x4(%rbp)
  jg     L662
  mov    -0x4(%rbp),%eax
  sub    $0x1,%eax
  and    $0x7,%eax
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  mov    %eax,%edx
  movzbl -0x11(%rbp),%eax
  or     %edx,%eax
  mov    %al,-0x11(%rbp)
  movzbl -0x11(%rbp),%eax
  mov    %al,-0x31(%rbp)
  jmp    L473
L662:
  movb   $0xf6,-0x31(%rbp)
L473:
  movzbl -0x31(%rbp),%eax
  and    -0x18(%rbp),%al
  test   %al,%al
  setne  %al
  movzbl %al,%eax
  mov    %eax,%esi
  lea    D306(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    -0x4(%rbp),%eax
  lea    0x8(%rax),%edx
  mov    -0x4(%rbp),%eax
  mov    %eax,%esi
  lea    D484(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movb   $0x0,-0x10(%rbp)
  cmpl   $0xfffffff9,-0x4(%rbp)
  jl     L27
  cmpl   $0x18,-0x4(%rbp)
  jg     L27
  mov    -0x4(%rbp),%eax
  add    $0x7,%eax
  and    $0x7,%eax
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  mov    %eax,%edx
  movzbl -0x10(%rbp),%eax
  or     %edx,%eax
  mov    %al,-0x10(%rbp)
  movzbl -0x10(%rbp),%eax
  mov    %al,-0x30(%rbp)
  jmp    L121
L27:
  movb   $0xf6,-0x30(%rbp)
L121:
  movzbl -0x30(%rbp),%eax
  and    -0x17(%rbp),%al
  test   %al,%al
  setne  %al
  movzbl %al,%eax
  mov    %eax,%esi
  lea    D306(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movb   $0x0,-0xf(%rbp)
  cmpl   $0xfffffff9,-0x4(%rbp)
  jl     L311
  cmpl   $0x18,-0x4(%rbp)
  jg     L311
  mov    -0x4(%rbp),%eax
  add    $0x7,%eax
  and    $0x7,%eax
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  mov    %eax,%edx
  movzbl -0xf(%rbp),%eax
  or     %edx,%eax
  mov    %al,-0xf(%rbp)
  movzbl -0xf(%rbp),%eax
  mov    %al,-0x2f(%rbp)
  jmp    L200
L311:
  movb   $0xf6,-0x2f(%rbp)
L200:
  movzbl -0x2f(%rbp),%eax
  and    -0x1b(%rbp),%al
  test   %al,%al
  je     L444
  lea    D151(%rip),%rax
  jmp    L232
L444:
  lea    D221(%rip),%rax
L232:
  mov    %rax,%rsi
  lea    D115(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movb   $0x0,-0xe(%rbp)
  cmpl   $0xfffffff9,-0x4(%rbp)
  jl     L410
  cmpl   $0x18,-0x4(%rbp)
  jg     L410
  mov    -0x4(%rbp),%eax
  add    $0x7,%eax
  and    $0x7,%eax
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  mov    %eax,%edx
  movzbl -0xe(%rbp),%eax
  or     %edx,%eax
  mov    %al,-0xe(%rbp)
  movzbl -0xe(%rbp),%eax
  mov    %al,-0x2e(%rbp)
  jmp    L706
L410:
  movb   $0xf6,-0x2e(%rbp)
L706:
  movzbl -0x2e(%rbp),%eax
  and    -0x1f(%rbp),%al
  test   %al,%al
  je     L511
  lea    D261(%rip),%rax
  jmp    L722
L511:
  lea    D203(%rip),%rax
L722:
  mov    %rax,%rsi
  lea    D386(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movb   $0x0,-0xd(%rbp)
  cmpl   $0xfffffff9,-0x4(%rbp)
  jl     L327
  cmpl   $0x18,-0x4(%rbp)
  jg     L327
  mov    -0x4(%rbp),%eax
  add    $0x7,%eax
  and    $0x7,%eax
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  mov    %eax,%edx
  movzbl -0xd(%rbp),%eax
  or     %edx,%eax
  mov    %al,-0xd(%rbp)
  movzbl -0xd(%rbp),%eax
  mov    %al,-0x2d(%rbp)
  jmp    L66
L327:
  movb   $0xf6,-0x2d(%rbp)
L66:
  movzbl -0x2d(%rbp),%eax
  and    -0x23(%rbp),%al
  test   %al,%al
  je     L168
  lea    D27(%rip),%rax
  jmp    L335
L168:
  lea    D101(%rip),%rax
L335:
  mov    %rax,%rsi
  lea    D497(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D316(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movb   $0x0,-0xc(%rbp)
  cmpl   $0xfffffff1,-0x4(%rbp)
  jl     L147
  cmpl   $0x10,-0x4(%rbp)
  jg     L147
  mov    -0x4(%rbp),%eax
  add    $0xf,%eax
  and    $0x7,%eax
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  mov    %eax,%edx
  movzbl -0xc(%rbp),%eax
  or     %edx,%eax
  mov    %al,-0xc(%rbp)
  movzbl -0xc(%rbp),%eax
  mov    %al,-0x2c(%rbp)
  jmp    L732
L147:
  movb   $0xf6,-0x2c(%rbp)
L732:
  movzbl -0x2c(%rbp),%eax
  and    -0x22(%rbp),%al
  test   %al,%al
  je     L577
  lea    D27(%rip),%rax
  jmp    L652
L577:
  lea    D101(%rip),%rax
L652:
  mov    %rax,%rsi
  lea    D497(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movb   $0x0,-0xb(%rbp)
  cmpl   $0xfffffff1,-0x4(%rbp)
  jl     L339
  cmpl   $0x10,-0x4(%rbp)
  jg     L339
  mov    -0x4(%rbp),%eax
  add    $0xf,%eax
  and    $0x7,%eax
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  mov    %eax,%edx
  movzbl -0xb(%rbp),%eax
  or     %edx,%eax
  mov    %al,-0xb(%rbp)
  movzbl -0xb(%rbp),%eax
  mov    %al,-0x2b(%rbp)
  jmp    L125
L339:
  movb   $0xf6,-0x2b(%rbp)
L125:
  movzbl -0x2b(%rbp),%eax
  and    -0x1e(%rbp),%al
  test   %al,%al
  je     L31
  lea    D261(%rip),%rax
  jmp    L246
L31:
  lea    D203(%rip),%rax
L246:
  mov    %rax,%rsi
  lea    D386(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movb   $0x0,-0xa(%rbp)
  cmpl   $0xfffffff1,-0x4(%rbp)
  jl     L734
  cmpl   $0x10,-0x4(%rbp)
  jg     L734
  mov    -0x4(%rbp),%eax
  add    $0xf,%eax
  and    $0x7,%eax
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  mov    %eax,%edx
  movzbl -0xa(%rbp),%eax
  or     %edx,%eax
  mov    %al,-0xa(%rbp)
  movzbl -0xa(%rbp),%eax
  mov    %al,-0x2a(%rbp)
  jmp    L401
L734:
  movb   $0xf6,-0x2a(%rbp)
L401:
  movzbl -0x2a(%rbp),%eax
  and    -0x1a(%rbp),%al
  test   %al,%al
  je     L527
  lea    D151(%rip),%rax
  jmp    L133
L527:
  lea    D221(%rip),%rax
L133:
  mov    %rax,%rsi
  lea    D115(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movb   $0x0,-0x9(%rbp)
  cmpl   $0xfffffff1,-0x4(%rbp)
  jl     L347
  cmpl   $0x10,-0x4(%rbp)
  jg     L347
  mov    -0x4(%rbp),%eax
  add    $0xf,%eax
  and    $0x7,%eax
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  mov    %eax,%edx
  movzbl -0x9(%rbp),%eax
  or     %edx,%eax
  mov    %al,-0x9(%rbp)
  movzbl -0x9(%rbp),%eax
  mov    %al,-0x29(%rbp)
  jmp    L251
L347:
  movb   $0xf6,-0x29(%rbp)
L251:
  movzbl -0x29(%rbp),%eax
  and    -0x16(%rbp),%al
  test   %al,%al
  setne  %al
  movzbl %al,%eax
  mov    %eax,%esi
  lea    D306(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    -0x4(%rbp),%eax
  lea    0x8(%rax),%edx
  mov    -0x4(%rbp),%eax
  mov    %eax,%esi
  lea    D484(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movb   $0x0,-0x8(%rbp)
  cmpl   $0xffffffe9,-0x4(%rbp)
  jl     L364
  cmpl   $0x8,-0x4(%rbp)
  jg     L364
  mov    -0x4(%rbp),%eax
  add    $0x17,%eax
  and    $0x7,%eax
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  mov    %eax,%edx
  movzbl -0x8(%rbp),%eax
  or     %edx,%eax
  mov    %al,-0x8(%rbp)
  movzbl -0x8(%rbp),%eax
  mov    %al,-0x28(%rbp)
  jmp    L366
L364:
  movb   $0xf6,-0x28(%rbp)
L366:
  movzbl -0x28(%rbp),%eax
  and    -0x15(%rbp),%al
  test   %al,%al
  setne  %al
  movzbl %al,%eax
  mov    %eax,%esi
  lea    D306(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movb   $0x0,-0x7(%rbp)
  cmpl   $0xffffffe9,-0x4(%rbp)
  jl     L4
  cmpl   $0x8,-0x4(%rbp)
  jg     L4
  mov    -0x4(%rbp),%eax
  add    $0x17,%eax
  and    $0x7,%eax
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  mov    %eax,%edx
  movzbl -0x7(%rbp),%eax
  or     %edx,%eax
  mov    %al,-0x7(%rbp)
  movzbl -0x7(%rbp),%eax
  mov    %al,-0x27(%rbp)
  jmp    L374
L4:
  movb   $0xf6,-0x27(%rbp)
L374:
  movzbl -0x27(%rbp),%eax
  and    -0x19(%rbp),%al
  test   %al,%al
  je     L329
  lea    D151(%rip),%rax
  jmp    L32
L329:
  lea    D221(%rip),%rax
L32:
  mov    %rax,%rsi
  lea    D115(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movb   $0x0,-0x6(%rbp)
  cmpl   $0xffffffe9,-0x4(%rbp)
  jl     L262
  cmpl   $0x8,-0x4(%rbp)
  jg     L262
  mov    -0x4(%rbp),%eax
  add    $0x17,%eax
  and    $0x7,%eax
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  mov    %eax,%edx
  movzbl -0x6(%rbp),%eax
  or     %edx,%eax
  mov    %al,-0x6(%rbp)
  movzbl -0x6(%rbp),%eax
  mov    %al,-0x26(%rbp)
  jmp    L360
L262:
  movb   $0xf6,-0x26(%rbp)
L360:
  movzbl -0x26(%rbp),%eax
  and    -0x1d(%rbp),%al
  test   %al,%al
  je     L131
  lea    D261(%rip),%rax
  jmp    L549
L131:
  lea    D203(%rip),%rax
L549:
  mov    %rax,%rsi
  lea    D386(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movb   $0x0,-0x5(%rbp)
  cmpl   $0xffffffe9,-0x4(%rbp)
  jl     L75
  cmpl   $0x8,-0x4(%rbp)
  jg     L75
  mov    -0x4(%rbp),%eax
  add    $0x17,%eax
  and    $0x7,%eax
  mov    $0x1,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  mov    %eax,%edx
  movzbl -0x5(%rbp),%eax
  or     %edx,%eax
  mov    %al,-0x5(%rbp)
  movzbl -0x5(%rbp),%eax
  mov    %al,-0x25(%rbp)
  jmp    L132
L75:
  movb   $0xf6,-0x25(%rbp)
L132:
  movzbl -0x25(%rbp),%eax
  and    -0x21(%rbp),%al
  test   %al,%al
  je     L77
  lea    D27(%rip),%rax
  jmp    L319
L77:
  lea    D101(%rip),%rax
L319:
  mov    %rax,%rsi
  lea    D39(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  addl   $0x1,-0x4(%rbp)
L589:
  cmpl   $0x8,-0x4(%rbp)
  jle    L644
  lea    D240(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  lea    D502(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  nop
  leave
  ret
```

tool_calls: name: read_data
arguments: data_tag: D163
data_type: string
name: read_data
arguments: data_tag: D240
data_type: string
name: read_data
arguments: data_tag: D239
data_type: string
name: read_data
arguments: data_tag: D274
data_type: string
name: read_data
arguments: data_tag: D353
data_type: string
name: read_data
arguments: data_tag: D27
data_type: string
name: read_data
arguments: data_tag: D101
data_type: string
name: read_data
arguments: data_tag: D497
data_type: string
name: read_data
arguments: data_tag: D261
data_type: string
name: read_data
arguments: data_tag: D203
data_type: string
name: read_data
arguments: data_tag: D386
data_type: string
name: read_data
arguments: data_tag: D151
data_type: string
name: read_data
arguments: data_tag: D221
data_type: string
name: read_data
arguments: data_tag: D115
data_type: string
name: read_data
arguments: data_tag: D306
data_type: string
name: read_data
arguments: data_tag: D484
data_type: string
name: read_data
arguments: data_tag: D316
data_type: string
name: read_data
arguments: data_tag: D39
data_type: string
name: read_data
arguments: data_tag: D502
data_type: string

tool: D163: clear

tool: D240:  +------+------+-----+-----+-----+-----+-----+-----+------+------+-------+------+------+-----+-----+-----+-----+-----+-----+------+------+

tool: D239:  |                                                             BUS Information                                                           |

tool: D274:  |                          BUS 1 [0x%02x]                         |       |                         BUS 2 [0x%02x]                          |


tool: D353:  |  POL |  PUL | DIR | VAL |    PIN    | VAL | DIR |  PUL |  POL |       |  POL |  PUL | DIR | VAL |    PIN    | VAL | DIR |  PUL |  POL |

tool: D27: INV

tool: D101: NOR

tool: D497:  | %4s 

tool: D261: UP

tool: D203: DOWN

tool: D386: | %4s 

tool: D151: IN

tool: D221: OUT

tool: D115: | %3s

tool: D306:  |  %d  

tool: D484: |  %d  - %2d 

tool: D316: |      

tool: D39:  | %4s |


tool: D502: 
Press 'ctrl+c' to escape...

assistant: ```c
void BUSView() {
  unsigned char p0_pol = iGetPortConfig(0, 3);
  unsigned char p1_pol = iGetPortConfig(1, 3);
  unsigned char p2_pol = iGetPortConfig(2, 3);
  unsigned char p3_pol = iGetPortConfig(3, 3);
  unsigned char p0_pul = iGetPortConfig(0, 2);
  unsigned char p1_pul = iGetPortConfig(1, 2);
  unsigned char p2_pul = iGetPortConfig(2, 2);
  unsigned char p3_pul = iGetPortConfig(3, 2);
  unsigned char p0_dir = iGetPortConfig(0, 1);
  unsigned char p1_dir = iGetPortConfig(1, 1);
  unsigned char p2_dir = iGetPortConfig(2, 1);
  unsigned char p3_dir = iGetPortConfig(3, 1);
  unsigned char p0_data = bReadPort(0);
  unsigned char p1_data = bReadPort(1);
  unsigned char p2_data = bReadPort(2);
  unsigned char p3_data = bReadPort(3);
  system("clear");
  printf(" +------+------+-----+-----+-----+-----+-----+-----+------+------+-------+------+------+-----+-----+-----+-----+-----+-----+------+------+\n");
  printf(" |                                                             BUS Information                                                           |\n");
  printf(" +------+------+-----+-----+-----+-----+-----+-----+------+------+-------+------+------+-----+-----+-----+-----+-----+-----+------+------+\n");
  printf(" |                          BUS 1 [0x%02x]                         |       |                         BUS 2 [0x%02x]                          |\n", 0x20, 0x21);
  printf(" +------+------+-----+-----+-----+-----+-----+-----+------+------+-------+------+------+-----+-----+-----+-----+-----+-----+------+------+\n");
  printf(" |  POL |  PUL | DIR | VAL |    PIN    | VAL | DIR |  PUL |  POL |       |  POL |  PUL | DIR | VAL |    PIN    | VAL | DIR |  PUL |  POL |\n");
  printf(" +------+------+-----+-----+-----+-----+-----+-----+------+------+-------+------+------+-----+-----+-----+-----+-----+-----+------+------+\n");
  int pin = 1;
  for (pin; pin <= 8; pin++) {
    printf(" | %4s ", ((((p0_pol) & (({
                           unsigned char r;
                           unsigned char x = 0x00;
                           if (pin >= 1 && pin <= 32) {
                             r = (x |= 1 << ((pin - 1) % 8));
                           } else {
                             r = -10;
                           }
                           r;
                         }))) != 0))
                          ? "INV"
                          : "NOR");
    ;
    printf("| %4s ", ((((p0_pul) & (({
                          unsigned char r;
                          unsigned char x = 0x00;
                          if (pin >= 1 && pin <= 32) {
                            r = (x |= 1 << ((pin - 1) % 8));
                          } else {
                            r = -10;
                          }
                          r;
                        }))) != 0))
                         ? "UP"
                         : "DOWN");
    ;
    printf("| %3s", ((((p0_dir) & (({
                         unsigned char r;
                         unsigned char x = 0x00;
                         if (pin >= 1 && pin <= 32) {
                           r = (x |= 1 << ((pin - 1) % 8));
                         } else {
                           r = -10;
                         }
                         r;
                       }))) != 0))
                        ? "IN"
                        : "OUT");
    ;
    printf(" |  %d  ", ((((p0_data) & (({
                            unsigned char r;
                            unsigned char x = 0x00;
                            if (pin >= 1 && pin <= 32) {
                              r = (x |= 1 << ((pin - 1) % 8));
                            } else {
                              r = -10;
                            }
                            r;
                          }))) != 0))
                           ? 1
                           : 0);
    ;
    printf("|  %d  - %2d ", pin, (pin + 8));
    ;
    printf(" |  %d  ", ((((p1_data) & (({
                            unsigned char r;
                            unsigned char x = 0x00;
                            if ((pin + (8 * 1)) >= 1 && (pin + (8 * 1)) <= 32) {
                              r = (x |= 1 << (((pin + (8 * 1)) - 1) % 8));
                            } else {
                              r = -10;
                            }
                            r;
                          }))) != 0))
                           ? 1
                           : 0);
    ;
    printf("| %3s", ((((p1_dir) & (({
                         unsigned char r;
                         unsigned char x = 0x00;
                         if ((pin + (8 * 1)) >= 1 && (pin + (8 * 1)) <= 32) {
                           r = (x |= 1 << (((pin + (8 * 1)) - 1) % 8));
                         } else {
                           r = -10;
                         }
                         r;
                       }))) != 0))
                        ? "IN"
                        : "OUT");
    ;
    printf("| %4s ", ((((p1_pul) & (({
                          unsigned char r;
                          unsigned char x = 0x00;
                          if ((pin + (8 * 1)) >= 1 && (pin + (8 * 1)) <= 32) {
                            r = (x |= 1 << (((pin + (8 * 1)) - 1) % 8));
                          } else {
                            r = -10;
                          }
                          r;
                        }))) != 0))
                         ? "UP"
                         : "DOWN");
    ;
    printf(" | %4s ", ((((p1_pol) & (({
                           unsigned char r;
                           unsigned char x = 0x00;
                           if ((pin + (8 * 1)) >= 1 && (pin + (8 * 1)) <= 32) {
                             r = (x |= 1 << (((pin + (8 * 1)) - 1) % 8));
                           } else {
                             r = -10;
                           }
                           r;
                         }))) != 0))
                          ? "INV"
                          : "NOR");
    ;
    printf("|      ");
    ;
    printf(" | %4s ", ((((p2_pol) & (({
                           unsigned char r;
                           unsigned char x = 0x00;
                           if ((pin + (8 * 2)) >= 1 && (pin + (8 * 2)) <= 32) {
                             r = (x |= 1 << (((pin + (8 * 2)) - 1) % 8));
                           } else {
                             r = -10;
                           }
                           r;
                         }))) != 0))
                          ? "INV"
                          : "NOR");
    ;
    printf("| %4s ", ((((p2_pul) & (({
                          unsigned char r;
                          unsigned char x = 0x00;
                          if ((pin + (8 * 2)) >= 1 && (pin + (8 * 2)) <= 32) {
                            r = (x |= 1 << (((pin + (8 * 2)) - 1) % 8));
                          } else {
                            r = -10;
                          }
                          r;
                        }))) != 0))
                         ? "UP"
                         : "DOWN");
    ;
    printf("| %3s", ((((p2_dir) & (({
                         unsigned char r;
                         unsigned char x = 0x00;
                         if ((pin + (8 * 2)) >= 1 && (pin + (8 * 2)) <= 32) {
                           r = (x |= 1 << (((pin + (8 * 2)) - 1) % 8));
                         } else {
                           r = -10;
                         }
                         r;
                       }))) != 0))
                        ? "IN"
                        : "OUT");
    ;
    printf(" |  %d  ", ((((p2_data) & (({
                            unsigned char r;
                            unsigned char x = 0x00;
                            if ((pin + (8 * 2)) >= 1 && (pin + (8 * 2)) <= 32) {
                              r = (x |= 1 << (((pin + (8 * 2)) - 1) % 8));
                            } else {
                              r = -10;
                            }
                            r;
                          }))) != 0))
                           ? 1
                           : 0);
    ;
    printf("|  %d  - %2d ", pin, (pin + 8));
    ;
    printf(" |  %d  ", ((((p3_data) & (({
                            unsigned char r;
                            unsigned char x = 0x00;
                            if ((pin + (8 * 3)) >= 1 && (pin + (8 * 3)) <= 32) {
                              r = (x |= 1 << (((pin + (8 * 3)) - 1) % 8));
                            } else {
                              r = -10;
                            }
                            r;
                          }))) != 0))
                           ? 1
                           : 0);
    ;
    printf("| %3s", ((((p3_dir) & (({
                         unsigned char r;
                         unsigned char x = 0x00;
                         if ((pin + (8 * 3)) >= 1 && (pin + (8 * 3)) <= 32) {
                           r = (x |= 1 << (((pin + (8 * 3)) - 1) % 8));
                         } else {
                           r = -10;
                         }
                         r;
                       }))) != 0))
                        ? "IN"
                        : "OUT");
    ;
    printf("| %4s ", ((((p3_pul) & (({
                          unsigned char r;
                          unsigned char x = 0x00;
                          if ((pin + (8 * 3)) >= 1 && (pin + (8 * 3)) <= 32) {
                            r = (x |= 1 << (((pin + (8 * 3)) - 1) % 8));
                          } else {
                            r = -10;
                          }
                          r;
                        }))) != 0))
                         ? "UP"
                         : "DOWN");
    ;
    printf(" | %4s |\n", ((((p3_pol) & (({
                              unsigned char r;
                              unsigned char x = 0x00;
                              if (pin + (8 * 3) >= 1 && pin + (8 * 3) <= 32) {
                                r = (x |= 1 << ((pin + (8 * 3) - 1) % 8));
                              } else {
                                r = -10;
                              }
                              r;
                            }))) != 0))
                             ? "INV"
                             : "NOR");
    ;
  }
  printf(" +------+------+-----+-----+-----+-----+-----+-----+------+------+-------+------+------+-----+-----+-----+-----+-----+-----+------+------+\n");
  printf("\nPress 'ctrl+c' to escape...\n");
}
```