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

```asm
<jam_jtag_irscan>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %esi,%r14d
  mov    %rdx,%r15
  mov    %rcx,%r12
  cmp    $0x1,%edi
  je     L88
  cmp    $0x2,%edi
  je     L81
  mov    $0x0,%eax
  test   %edi,%edi
  jne    L20
  mov    $0x0,%edx
  mov    $0x0,%esi
  mov    $0x1,%edi
  call   <jam_jtag_io@plt>
  mov    $0x0,%edx
  mov    $0x0,%esi
  mov    $0x1,%edi
  call   <jam_jtag_io@plt>
  mov    $0x0,%edx
  mov    $0x0,%esi
  mov    $0x0,%edi
  call   <jam_jtag_io@plt>
  mov    $0x0,%edx
  mov    $0x0,%esi
  mov    $0x0,%edi
  call   <jam_jtag_io@plt>
L50:
  mov    $0x0,%ebx
  test   %r14d,%r14d
  jg     L44
L1:
  mov    $0x0,%edx
  mov    $0x0,%esi
  mov    $0x0,%edi
  call   <jam_jtag_io@plt>
  mov    $0x1,%eax
L20:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L88:
  mov    $0x0,%edx
  mov    $0x0,%esi
  mov    $0x1,%edi
  call   <jam_jtag_io@plt>
  mov    $0x0,%edx
  mov    $0x0,%esi
  mov    $0x1,%edi
  call   <jam_jtag_io@plt>
  mov    $0x0,%edx
  mov    $0x0,%esi
  mov    $0x1,%edi
  call   <jam_jtag_io@plt>
  mov    $0x0,%edx
  mov    $0x0,%esi
  mov    $0x1,%edi
  call   <jam_jtag_io@plt>
  mov    $0x0,%edx
  mov    $0x0,%esi
  mov    $0x0,%edi
  call   <jam_jtag_io@plt>
  mov    $0x0,%edx
  mov    $0x0,%esi
  mov    $0x0,%edi
  call   <jam_jtag_io@plt>
  jmp    L50
L81:
  mov    $0x0,%edx
  mov    $0x0,%esi
  mov    $0x1,%edi
  call   <jam_jtag_io@plt>
  mov    $0x0,%edx
  mov    $0x0,%esi
  mov    $0x0,%edi
  call   <jam_jtag_io@plt>
  jmp    L50
L6:
  not    %r13d
  and    %r13b,(%r12,%rbp,1)
L53:
  add    $0x1,%ebx
  cmp    %ebx,%r14d
  je     L1
L44:
  mov    %ebx,%ebp
  sar    $0x3,%ebp
  movslq %ebp,%rbp
  mov    %ebx,%ecx
  and    $0x7,%ecx
  mov    $0x1,%r13d
  shl    %cl,%r13d
  test   %r12,%r12
  setne  %dl
  movzbl %dl,%edx
  mov    %r13d,%esi
  and    (%r15,%rbp,1),%sil
  movsbl %sil,%esi
  lea    -0x1(%r14),%eax
  cmp    %ebx,%eax
  sete   %dil
  movzbl %dil,%edi
  call   <jam_jtag_io@plt>
  test   %r12,%r12
  je     L53
  test   %eax,%eax
  je     L6
  or     %r13b,(%r12,%rbp,1)
  jmp    L53
```

assistant: ```c
int jam_jtag_irscan(int start_state, int count, char *tdi, char *tdo) {
  int i = 0;
  int tdo_bit = 0;
  int status = 1;
  switch (start_state) {
  case 0:
    jam_jtag_io(1, 0, 0);
    jam_jtag_io(1, 0, 0);
    jam_jtag_io(0, 0, 0);
    jam_jtag_io(0, 0, 0);
    break;
  case 1:
    jam_jtag_io(1, 0, 0);
    jam_jtag_io(1, 0, 0);
    jam_jtag_io(1, 0, 0);
    jam_jtag_io(1, 0, 0);
    jam_jtag_io(0, 0, 0);
    jam_jtag_io(0, 0, 0);
    break;
  case 2:
    jam_jtag_io(1, 0, 0);
    jam_jtag_io(0, 0, 0);
    break;
  default:
    status = 0;
  }
  if (status) {
    for (i = 0; i < count; i++) {
      tdo_bit = jam_jtag_io((i == count - 1), tdi[i >> 3] & (1 << (i & 7)), (tdo != (0)));
      if (tdo != (0)) {
        if (tdo_bit) {
          tdo[i >> 3] |= (1 << (i & 7));
        } else {
          tdo[i >> 3] &= ~(unsigned int)(1 << (i & 7));
        }
      }
    }
    jam_jtag_io(0, 0, 0);
  }
  return (status);
}
```