user: Please show me the C implementation that matches the assembly code listed below:

```asm
<_shiftL>:
  endbr64
  push   %r12
  mov    %rdi,%r9
  xor    %r11d,%r11d
  mov    %rsi,%rdi
  push   %rbp
  push   %rbx
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %edx,%eax
  and    $0x7,%edx
  shr    $0x3,%al
  movzbl %al,%r10d
  test   %al,%al
  je     L123
  lea    -0x1(%r10),%esi
  mov    %r9,%rcx
  movzbl %al,%r11d
  xor    %ebp,%ebp
  sub    %rsi,%rcx
  add    $0x7,%rcx
  cmp    $0x8,%r11d
  jb     L85
  lea    0x8(%rcx),%r8
  movq   $0x0,(%rcx)
  movq   $0x0,-0x8(%rcx,%r11,1)
  and    $0xfffffffffffffff8,%r8
  sub    %r8,%rcx
  add    %r11d,%ecx
  and    $0xfffffff8,%ecx
  cmp    $0x8,%ecx
  jb     L141
  and    $0xfffffff8,%ecx
  xor    %esi,%esi
L3:
  mov    %esi,%ebx
  add    $0x8,%esi
  mov    %rbp,(%r8,%rbx,1)
  cmp    %ecx,%esi
  jb     L3
L141:
  cmp    $0x7,%al
  ja     L6
L123:
  mov    $0x7,%ecx
  mov    %r9,%r8
  xor    %eax,%eax
  sub    %r10d,%ecx
  sub    %r11,%r8
  not    %rcx
  cs nopw 0x0(%rax,%rax,1)
L66:
  movzbl 0x7(%rdi,%rax,1),%esi
  mov    %sil,0x7(%r8,%rax,1)
  sub    $0x1,%rax
  cmp    %rcx,%rax
  jne    L66
  mov    (%r9),%rax
  mov    %rax,(%rsp)
  test   %dl,%dl
  je     L6
  mov    $0x7,%ecx
  mov    $0x8,%ebx
  movzbl %dl,%edx
  mov    %r11,%rax
  sub    %r10d,%ecx
  mov    %ebx,%ebp
  mov    $0x7,%r12d
  movslq %ecx,%rcx
  sub    %edx,%ebp
  lea    (%rsp,%rcx,1),%r8
  jmp    L153
  nopl   0x0(%rax,%rax,1)
L155:
  mov    %ebx,%ecx
  movzbl (%r8),%edi
  mov    %rax,%r11
  sub    $0x1,%r8
  sub    %eax,%ecx
  neg    %r11
  add    $0x1,%rax
  movslq %ecx,%rcx
  movzbl (%rsp,%rcx,1),%esi
  mov    %ebp,%ecx
  sar    %cl,%esi
  mov    %edx,%ecx
  shl    %cl,%edi
  or     %edi,%esi
  mov    %sil,0x7(%r9,%r11,1)
  cmp    $0x7,%eax
  jg     L6
L153:
  cmp    %eax,%r10d
  jne    L155
  mov    %r12d,%esi
  mov    %edx,%ecx
  sub    $0x1,%r8
  sub    %eax,%esi
  add    $0x1,%rax
  movslq %esi,%rsi
  movzbl (%rsp,%rsi,1),%edi
  shl    %cl,%edi
  mov    %dil,(%r9,%rsi,1)
  cmp    $0x7,%eax
  jle    L153
  nopw   0x0(%rax,%rax,1)
L6:
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L75
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax)
L85:
  test   $0x4,%r11b
  jne    L133
  test   %r11d,%r11d
  je     L141
  movb   $0x0,(%rcx)
  test   $0x2,%r11b
  je     L141
  xor    %esi,%esi
  mov    %si,-0x2(%rcx,%r11,1)
  jmp    L141
L133:
  movl   $0x0,(%rcx)
  movl   $0x0,-0x4(%rcx,%r11,1)
  jmp    L141
L75:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void _shiftL(unsigned char ans[8], unsigned char x[8], unsigned char r) {
  int i;
  int shiftbytes = r / 8;
  int shiftbits = r % 8;
  unsigned char temp[8];
  for (i = 0; i < shiftbytes; i++) {
    ans[7 - i] = 0;
  }
  for (i = shiftbytes; i < 8; i++) {
    ans[7 - i] = x[7 - i + shiftbytes];
  }
  for (i = 0; i < 8; i++) {
    temp[i] = ans[i];
  }
  if (shiftbits > 0) {
    for (i = shiftbytes; i < 8; i++) {
      if (i == shiftbytes) {
        ans[7 - i] = (temp[7 - i] << shiftbits);
      } else {
        ans[7 - i] = (temp[7 - i] << shiftbits) | (temp[8 - i] >> (8 - shiftbits));
      }
    }
  }
}
```