user: What would the C source look like for the assembly code provided here:

```asm
<nxt_motor_get_count>:
  endbr64
  push   %r12
  push   %rbx
  sub    $0x8,%rsp
  cmp    $0x1,%edi
  je     L17
  cmp    $0x2,%edi
  je     L0
  test   %edi,%edi
  je     L52
L9:
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L17:
  xor    %eax,%eax
  call   <__startrek_read_W_speed@plt>
  movsbl %al,%ebx
  xor    %eax,%eax
  call   <__startrek_read_W_count@plt>
  mov    %eax,%r12d
  test   %bl,%bl
  je     L9
  xor    %eax,%eax
  add    %r12d,%ebx
  call   <__VERIFIER_nondet_U8@plt>
  movzbl %al,%eax
  mov    %eax,%r12d
  neg    %r12d
  test   %ebx,%ebx
  cmovg  %eax,%r12d
  mov    %r12d,%edi
  call   <__startrek_write_W_count@plt>
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %r12
  ret
  nopl   0x0(%rax)
L52:
  xor    %eax,%eax
  call   <__startrek_read_R_speed@plt>
  movsbl %al,%ebx
  xor    %eax,%eax
  call   <__startrek_read_R_count@plt>
  mov    %eax,%r12d
  test   %bl,%bl
  je     L9
  xor    %eax,%eax
  add    %r12d,%ebx
  call   <__VERIFIER_nondet_U8@plt>
  movzbl %al,%eax
  mov    %eax,%r12d
  neg    %r12d
  test   %ebx,%ebx
  cmovg  %eax,%r12d
  mov    %r12d,%edi
  call   <__startrek_write_R_count@plt>
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %r12
  ret
  nopl   0x0(%rax)
L0:
  xor    %eax,%eax
  call   <__startrek_read_T_speed@plt>
  movsbl %al,%ebx
  xor    %eax,%eax
  call   <__startrek_read_T_count@plt>
  mov    %eax,%r12d
  test   %bl,%bl
  je     L9
  xor    %eax,%eax
  add    %r12d,%ebx
  call   <__VERIFIER_nondet_U8@plt>
  movzbl %al,%eax
  mov    %eax,%r12d
  neg    %r12d
  test   %ebx,%ebx
  cmovg  %eax,%r12d
  mov    %r12d,%edi
  call   <__startrek_write_T_count@plt>
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %r12
  ret
```

assistant: ```c
int nxt_motor_get_count(unsigned int n) {
  unsigned char delta;
  int new_count;
  int count;
  char speed;
  char tmp;
  char tmp___0;
  char tmp___1;
  {
    count = 0;
    speed = 0;
    switch (n) {
    case 0:
      tmp = __startrek_read_R_speed();
      speed = tmp;
      count = __startrek_read_R_count();
      if ((int)speed == 0) {
        return (count);
      } else {
        delta = __VERIFIER_nondet_U8();
        if (count + (int)speed > 0) {
          new_count = delta;
        } else {
          new_count = -((int)delta);
        }
        __startrek_write_R_count(new_count);
      }
      break;
    case 1:
      tmp___0 = __startrek_read_W_speed();
      speed = tmp___0;
      count = __startrek_read_W_count();
      if ((int)speed == 0) {
        return (count);
      } else {
        delta = __VERIFIER_nondet_U8();
        if (count + (int)speed > 0) {
          new_count = delta;
        } else {
          new_count = -((int)delta);
        }
        __startrek_write_W_count(new_count);
      }
      break;
    case 2:
      tmp___1 = __startrek_read_T_speed();
      speed = tmp___1;
      count = __startrek_read_T_count();
      if ((int)speed == 0) {
        return (count);
      } else {
        delta = __VERIFIER_nondet_U8();
        if (count + (int)speed > 0) {
          new_count = delta;
        } else {
          new_count = -((int)delta);
        }
        __startrek_write_T_count(new_count);
      }
      break;
    default:;
    }
    return (new_count);
  }
}
```