user: Translate the below assembly code into C programming language:

```asm
<xsvfGotoTapState>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,%eax
  mov    %al,-0x1c(%rbp)
  movl   $0x0,-0x4(%rbp)
  cmpb   $0x0,-0x1c(%rbp)
  jne    L350
  mov    $0x1,%edi
  call   <xsvfTmsTransition@plt>
  movl   $0x0,-0x8(%rbp)
  jmp    L437
L147:
  mov    $0x0,%esi
  mov    $0x0,%edi
  call   <setPort@plt>
  mov    $0x1,%esi
  mov    $0x0,%edi
  call   <setPort@plt>
  addl   $0x1,-0x8(%rbp)
L437:
  cmpl   $0x4,-0x8(%rbp)
  jle    L147
  mov    -0x18(%rbp),%rax
  movb   $0x0,(%rax)
  jmp    L450
L350:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    %al,-0x1c(%rbp)
  je     L155
  cmpb   $0x7,-0x1c(%rbp)
  jne    L461
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x6,%al
  jne    L352
L461:
  cmpb   $0xe,-0x1c(%rbp)
  jne    L155
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0xd,%al
  je     L155
L352:
  movl   $0x5,-0x4(%rbp)
  jmp    L450
L155:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    %al,-0x1c(%rbp)
  jne    L273
  cmpb   $0x6,-0x1c(%rbp)
  jne    L326
  mov    $0x1,%edi
  call   <xsvfTmsTransition@plt>
  mov    -0x18(%rbp),%rax
  movb   $0x7,(%rax)
  jmp    L273
L326:
  cmpb   $0xd,-0x1c(%rbp)
  jne    L273
  mov    $0x1,%edi
  call   <xsvfTmsTransition@plt>
  mov    -0x18(%rbp),%rax
  movb   $0xe,(%rax)
  jmp    L273
L420:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  cmp    $0xf,%eax
  ja     L495
  mov    %eax,%eax
  lea    0x0(,%rax,4),%rdx
  lea    D13(%rip),%rax
  mov    (%rdx,%rax,1),%eax
  cltq
  lea    D13(%rip),%rdx
  add    %rdx,%rax
  notrack jmp *%rax
  mov    $0x0,%edi
  call   <xsvfTmsTransition@plt>
  mov    -0x18(%rbp),%rax
  movb   $0x1,(%rax)
  jmp    L273
  mov    $0x1,%edi
  call   <xsvfTmsTransition@plt>
  mov    -0x18(%rbp),%rax
  movb   $0x2,(%rax)
  jmp    L273
  cmpb   $0x8,-0x1c(%rbp)
  jbe    L363
  mov    $0x1,%edi
  call   <xsvfTmsTransition@plt>
  mov    -0x18(%rbp),%rax
  movb   $0x9,(%rax)
  jmp    L273
L363:
  mov    $0x0,%edi
  call   <xsvfTmsTransition@plt>
  mov    -0x18(%rbp),%rax
  movb   $0x3,(%rax)
  jmp    L273
  cmpb   $0x4,-0x1c(%rbp)
  jne    L96
  mov    $0x0,%edi
  call   <xsvfTmsTransition@plt>
  mov    -0x18(%rbp),%rax
  movb   $0x4,(%rax)
  jmp    L273
L96:
  mov    $0x1,%edi
  call   <xsvfTmsTransition@plt>
  mov    -0x18(%rbp),%rax
  movb   $0x5,(%rax)
  jmp    L273
  mov    $0x1,%edi
  call   <xsvfTmsTransition@plt>
  mov    -0x18(%rbp),%rax
  movb   $0x5,(%rax)
  jmp    L273
  cmpb   $0x6,-0x1c(%rbp)
  jne    L55
  mov    $0x0,%edi
  call   <xsvfTmsTransition@plt>
  mov    -0x18(%rbp),%rax
  movb   $0x6,(%rax)
  jmp    L273
L55:
  mov    $0x1,%edi
  call   <xsvfTmsTransition@plt>
  mov    -0x18(%rbp),%rax
  movb   $0x8,(%rax)
  jmp    L273
  mov    $0x1,%edi
  call   <xsvfTmsTransition@plt>
  mov    -0x18(%rbp),%rax
  movb   $0x7,(%rax)
  jmp    L273
  cmpb   $0x4,-0x1c(%rbp)
  jne    L167
  mov    $0x0,%edi
  call   <xsvfTmsTransition@plt>
  mov    -0x18(%rbp),%rax
  movb   $0x4,(%rax)
  jmp    L273
L167:
  mov    $0x1,%edi
  call   <xsvfTmsTransition@plt>
  mov    -0x18(%rbp),%rax
  movb   $0x8,(%rax)
  jmp    L273
  cmpb   $0x1,-0x1c(%rbp)
  jne    L449
  mov    $0x0,%edi
  call   <xsvfTmsTransition@plt>
  mov    -0x18(%rbp),%rax
  movb   $0x1,(%rax)
  jmp    L273
L449:
  mov    $0x1,%edi
  call   <xsvfTmsTransition@plt>
  mov    -0x18(%rbp),%rax
  movb   $0x2,(%rax)
  jmp    L273
  mov    $0x0,%edi
  call   <xsvfTmsTransition@plt>
  mov    -0x18(%rbp),%rax
  movb   $0xa,(%rax)
  jmp    L273
  cmpb   $0xb,-0x1c(%rbp)
  jne    L202
  mov    $0x0,%edi
  call   <xsvfTmsTransition@plt>
  mov    -0x18(%rbp),%rax
  movb   $0xb,(%rax)
  jmp    L273
L202:
  mov    $0x1,%edi
  call   <xsvfTmsTransition@plt>
  mov    -0x18(%rbp),%rax
  movb   $0xc,(%rax)
  jmp    L273
  mov    $0x1,%edi
  call   <xsvfTmsTransition@plt>
  mov    -0x18(%rbp),%rax
  movb   $0xc,(%rax)
  jmp    L273
  cmpb   $0xd,-0x1c(%rbp)
  jne    L405
  mov    $0x0,%edi
  call   <xsvfTmsTransition@plt>
  mov    -0x18(%rbp),%rax
  movb   $0xd,(%rax)
  jmp    L273
L405:
  mov    $0x1,%edi
  call   <xsvfTmsTransition@plt>
  mov    -0x18(%rbp),%rax
  movb   $0xf,(%rax)
  jmp    L273
  mov    $0x1,%edi
  call   <xsvfTmsTransition@plt>
  mov    -0x18(%rbp),%rax
  movb   $0xe,(%rax)
  jmp    L273
  cmpb   $0xb,-0x1c(%rbp)
  jne    L127
  mov    $0x0,%edi
  call   <xsvfTmsTransition@plt>
  mov    -0x18(%rbp),%rax
  movb   $0xb,(%rax)
  jmp    L273
L127:
  mov    $0x1,%edi
  call   <xsvfTmsTransition@plt>
  mov    -0x18(%rbp),%rax
  movb   $0xf,(%rax)
  jmp    L273
  cmpb   $0x1,-0x1c(%rbp)
  jne    L409
  mov    $0x0,%edi
  call   <xsvfTmsTransition@plt>
  mov    -0x18(%rbp),%rax
  movb   $0x1,(%rax)
  jmp    L273
L409:
  mov    $0x1,%edi
  call   <xsvfTmsTransition@plt>
  mov    -0x18(%rbp),%rax
  movb   $0x2,(%rax)
  jmp    L273
L495:
  movl   $0x5,-0x4(%rbp)
  mov    -0x18(%rbp),%rax
  movzbl -0x1c(%rbp),%edx
  mov    %dl,(%rax)
  nop
L273:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    %al,-0x1c(%rbp)
  jne    L420
L450:
  mov    -0x4(%rbp),%eax
  leave
  ret
```

assistant: ```c
int xsvfGotoTapState(unsigned char *pucTapState, unsigned char ucTargetState) {
  int i;
  int iErrorCode;
  iErrorCode = 0;
  if (ucTargetState == 0x00) {
    xsvfTmsTransition(1);
    for (i = 0; i < 5; ++i) {
      setPort((short)0, 0);
      setPort((short)0, 1);
    }
    *pucTapState = 0x00;
    ;

    ;
  } else if ((ucTargetState != *pucTapState) && (((ucTargetState == 0x07) && (*pucTapState != 0x06)) || ((ucTargetState == 0x0E) && (*pucTapState != 0x0D)))) {
    iErrorCode = 5;
  } else {
    if (ucTargetState == *pucTapState) {
      if (ucTargetState == 0x06) {
        xsvfTmsTransition(1);
        *pucTapState = 0x07;

        ;
      } else if (ucTargetState == 0x0D) {
        xsvfTmsTransition(1);
        *pucTapState = 0x0E;

        ;
      }
    }
    while (ucTargetState != *pucTapState) {
      switch (*pucTapState) {
      case 0x00:
        xsvfTmsTransition(0);
        *pucTapState = 0x01;
        break;
      case 0x01:
        xsvfTmsTransition(1);
        *pucTapState = 0x02;
        break;
      case 0x02:
        if (ucTargetState >= 0x09) {
          xsvfTmsTransition(1);
          *pucTapState = 0x09;
        } else {
          xsvfTmsTransition(0);
          *pucTapState = 0x03;
        }
        break;
      case 0x03:
        if (ucTargetState == 0x04) {
          xsvfTmsTransition(0);
          *pucTapState = 0x04;
        } else {
          xsvfTmsTransition(1);
          *pucTapState = 0x05;
        }
        break;
      case 0x04:
        xsvfTmsTransition(1);
        *pucTapState = 0x05;
        break;
      case 0x05:
        if (ucTargetState == 0x06) {
          xsvfTmsTransition(0);
          *pucTapState = 0x06;
        } else {
          xsvfTmsTransition(1);
          *pucTapState = 0x08;
        }
        break;
      case 0x06:
        xsvfTmsTransition(1);
        *pucTapState = 0x07;
        break;
      case 0x07:
        if (ucTargetState == 0x04) {
          xsvfTmsTransition(0);
          *pucTapState = 0x04;
        } else {
          xsvfTmsTransition(1);
          *pucTapState = 0x08;
        }
        break;
      case 0x08:
        if (ucTargetState == 0x01) {
          xsvfTmsTransition(0);
          *pucTapState = 0x01;
        } else {
          xsvfTmsTransition(1);
          *pucTapState = 0x02;
        }
        break;
      case 0x09:
        xsvfTmsTransition(0);
        *pucTapState = 0x0A;
        break;
      case 0x0A:
        if (ucTargetState == 0x0B) {
          xsvfTmsTransition(0);
          *pucTapState = 0x0B;
        } else {
          xsvfTmsTransition(1);
          *pucTapState = 0x0C;
        }
        break;
      case 0x0B:
        xsvfTmsTransition(1);
        *pucTapState = 0x0C;
        break;
      case 0x0C:
        if (ucTargetState == 0x0D) {
          xsvfTmsTransition(0);
          *pucTapState = 0x0D;
        } else {
          xsvfTmsTransition(1);
          *pucTapState = 0x0F;
        }
        break;
      case 0x0D:
        xsvfTmsTransition(1);
        *pucTapState = 0x0E;
        break;
      case 0x0E:
        if (ucTargetState == 0x0B) {
          xsvfTmsTransition(0);
          *pucTapState = 0x0B;
        } else {
          xsvfTmsTransition(1);
          *pucTapState = 0x0F;
        }
        break;
      case 0x0F:
        if (ucTargetState == 0x01) {
          xsvfTmsTransition(0);
          *pucTapState = 0x01;
        } else {
          xsvfTmsTransition(1);
          *pucTapState = 0x02;
        }
        break;
      default:
        iErrorCode = 5;
        *pucTapState = ucTargetState;
        break;
      }

      ;
    }
  }
  return (iErrorCode);
}
```