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

```asm
<different_modes_test>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  lea    D29(%rip),%rdi
  call   <puts@plt>
  mov    $0x0,%eax
  call   <init_8n1@plt>
  mov    $0x1c2,%esi
  lea    D112(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x9c000002,%edi
  call   <getreg@plt>
  cmp    $0xc1,%eax
  jne    L106
L89:
  mov    $0x1c4,%esi
  lea    D112(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x1,%ebx
  lea    D112(%rip),%rbp
L46:
  mov    $0x80,%esi
  mov    $0x9c000003,%edi
  call   <setreg@plt>
  mov    %ebx,%esi
  sar    $0x8,%esi
  mov    $0x9c000001,%edi
  call   <setreg@plt>
  mov    %ebx,%esi
  mov    $0x9c000000,%edi
  call   <setreg@plt>
  mov    $0x3,%esi
  mov    $0x9c000003,%edi
  call   <setreg@plt>
  mov    $0x8,%edi
  call   <test_mode@plt>
  mov    $0x1cd,%esi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  add    $0x1,%ebx
  cmp    $0x5,%ebx
  jne    L46
  mov    $0x1cf,%esi
  lea    D112(%rip),%rbx
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x80,%esi
  mov    $0x9c000003,%edi
  call   <setreg@plt>
  mov    $0x0,%esi
  mov    $0x9c000001,%edi
  call   <setreg@plt>
  mov    $0x1,%esi
  mov    $0x9c000000,%edi
  call   <setreg@plt>
  mov    $0x1d4,%esi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x0,%r13d
  mov    %rbx,%r12
  jmp    L38
L106:
  mov    $0x1c3,%esi
  lea    D56(%rip),%rdi
  call   <fail@plt>
  jmp    L89
L105:
  add    $0x8,%r13d
  cmp    $0x40,%r13d
  je     L96
L38:
  mov    %r13d,%ebp
  mov    $0x0,%ebx
L54:
  mov    %ebp,%esi
  or     %ebx,%esi
  mov    $0x9c000003,%edi
  call   <setreg@plt>
  lea    0x5(%rbx),%edi
  call   <test_mode@plt>
  mov    $0x1db,%esi
  mov    %r12,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  add    $0x1,%ebx
  cmp    $0x4,%ebx
  jne    L54
  jmp    L105
L96:
  mov    $0x1dd,%esi
  lea    D112(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x0,%ebx
  lea    D112(%rip),%rbp
L92:
  mov    %ebx,%esi
  or     $0x4,%esi
  mov    $0x9c000003,%edi
  call   <setreg@plt>
  lea    0x5(%rbx),%edi
  call   <test_mode@plt>
  mov    $0x1e3,%esi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  add    $0x1,%ebx
  cmp    $0x4,%ebx
  jne    L92
  mov    $0x1e5,%esi
  lea    D112(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x54,%edi
  call   <send_char@plt>
L66:
  mov    $0x9c000005,%edi
  call   <getreg@plt>
  cmp    $0x60,%eax
  jne    L66
  mov    $0x80,%esi
  mov    $0x9c000003,%edi
  call   <setreg@plt>
  mov    $0x0,%esi
  mov    $0x9c000001,%edi
  call   <setreg@plt>
  mov    $0x2,%esi
  mov    $0x9c000000,%edi
  call   <setreg@plt>
  mov    $0x3,%esi
  mov    $0x9c000003,%edi
  call   <setreg@plt>
  mov    $0x1ee,%esi
  lea    D112(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L81:
  mov    $0x9c000005,%edi
  call   <getreg@plt>
  test   $0x1,%al
  je     L81
  mov    $0x9c000000,%edi
  call   <getreg@plt>
  mov    $0x1f1,%esi
  lea    D112(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x54,%edi
  call   <send_char@plt>
L25:
  mov    $0x9c000005,%edi
  call   <getreg@plt>
  cmp    $0x60,%eax
  jne    L25
  mov    $0x1f5,%esi
  lea    D112(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D111(%rip),%rdi
  call   <puts@plt>
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

tool_calls: name: disassemble_data
arguments: label: D29
type_infered: string
name: disassemble_data
arguments: label: D112
type_infered: string
name: disassemble_data
arguments: label: D56
type_infered: string
name: disassemble_data
arguments: label: D111
type_infered: string

tool: D29: different modes test

tool: D112: Passed line %i


tool: D56: ?

tool: D111: OK

assistant: ```c
void different_modes_test() {
  int speed, parity, length;
  printf("different modes test\n");
  init_8n1();
  printf("Passed line %i\n", 450);
  ((getreg(((0x9c000000) + 2)) == 0xc1) ? 1 : fail("?", 451));
  printf("Passed line %i\n", 452);
  for (speed = 1; speed < 5; speed++) {
    setreg(((0x9c000000) + 3), (0x80));
    setreg(((0x9c000000) + 1), speed >> 8);
    setreg(((0x9c000000) + 0), speed & 0xff);
    setreg(((0x9c000000) + 3), 0x03);
    test_mode(8);
    printf("Passed line %i\n", 461);
  }
  printf("Passed line %i\n", 463);
  setreg(((0x9c000000) + 3), (0x80));
  setreg(((0x9c000000) + 1), 1 >> 8);
  setreg(((0x9c000000) + 0), 1 & 0xff);
  printf("Passed line %i\n", 468);
  for (parity = 0; parity < 8; parity++)
    for (length = 0; length < 4; length++) {
      setreg(((0x9c000000) + 3), length | (0 << 2) | (parity << 3));
      test_mode(5 + length);
      printf("Passed line %i\n", 475);
    }
  printf("Passed line %i\n", 477);
  for (length = 0; length < 4; length++) {
    setreg(((0x9c000000) + 3), length | (1 << 2) | (0 << 3));
    test_mode(5 + length);
    printf("Passed line %i\n", 483);
  }
  printf("Passed line %i\n", 485);
  send_char('T');
  while (getreg(((0x9c000000) + 5)) != 0x60)
    ;
  setreg(((0x9c000000) + 3), (0x80));
  setreg(((0x9c000000) + 1), 2 >> 8);
  setreg(((0x9c000000) + 0), 2 & 0xff);
  setreg(((0x9c000000) + 3), 0x03);
  printf("Passed line %i\n", 494);
  while (!(getreg(((0x9c000000) + 5)) & 1))
    ;
  getreg(((0x9c000000) + 0));
  printf("Passed line %i\n", 497);
  send_char('T');
  while (getreg(((0x9c000000) + 5)) != 0x60)
    ;
  printf("Passed line %i\n", 501);
  printf("OK\n");
}
```