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

```asm
<main>:
  endbr64
  push   %r15
  lea    D19(%rip),%rdi
  lea    D49(%rip),%r15
  push   %r14
  lea    D44(%rip),%r14
  push   %r13
  push   %r12
  lea    D29(%rip),%r12
  push   %rbp
  push   %rbx
  sub    $0x418,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x408(%rsp)
  xor    %eax,%eax
  lea    0x4(%rsp),%rsi
  lea    0x8(%rsp),%r13
  lea    0x10(%rsp),%rbx
  call   <scanf@plt>
  mov    0x4(%rsp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,0x4(%rsp)
  test   %eax,%eax
  je     L92
  nopl   0x0(%rax,%rax,1)
L111:
  xor    %eax,%eax
  mov    %r13,%rdx
  mov    %rbx,%rsi
  mov    %r12,%rdi
  call   <scanf@plt>
  cmpq   $0x0,0x8(%rsp)
  je     L86
  mov    %rbx,%rdi
  call   <strlen@plt>
  sub    $0x1,%eax
  cltq
  movsbl 0x10(%rsp,%rax,1),%edi
  mov    %edi,%eax
  sub    $0x30,%edi
  cmp    $0x1,%edi
  jbe    L82
  cmp    $0x5,%edi
  je     L82
  sub    $0x32,%eax
  cmp    $0x7,%al
  ja     L19
  movzbl %al,%eax
  movslq (%r15,%rax,4),%rax
  add    %r15,%rax
  notrack jmp *%rax
  nopl   (%rax)
  mov    0x8(%rsp),%rax
  cqto
  shr    $0x3e,%rdx
  lea    (%rax,%rdx,1),%rsi
  and    $0x3,%esi
  sub    %rdx,%rsi
  add    $0x4,%esi
L74:
  call   <pow@plt>
  movslq %eax,%rsi
  mov    %rsi,%rbp
L10:
  imul   $0x66666667,%rsi,%rsi
  mov    %ebp,%eax
  sar    $0x1f,%eax
  sar    $0x22,%rsi
  sub    %eax,%esi
  lea    (%rsi,%rsi,4),%eax
  mov    %ebp,%esi
  add    %eax,%eax
  sub    %eax,%esi
L65:
  mov    %r14,%rdi
  xor    %eax,%eax
  call   <printf@plt>
L39:
  mov    0x4(%rsp),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,0x4(%rsp)
  test   %eax,%eax
  jne    L111
L92:
  mov    0x408(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L37
  add    $0x418,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  cs nopw 0x0(%rax,%rax,1)
  mov    0x8(%rsp),%rax
  mov    %rax,%rdx
  shr    $0x3f,%rdx
  lea    (%rax,%rdx,1),%rsi
  and    $0x1,%esi
  sub    %rdx,%rsi
  add    $0x2,%esi
  jmp    L74
  xchg   %ax,%ax
L19:
  movslq %ebp,%rsi
  jmp    L10
  nopl   0x0(%rax,%rax,1)
L82:
  movslq %edi,%rsi
  mov    %edi,%eax
  mov    %edi,%ebp
  imul   $0x66666667,%rsi,%rsi
  sar    $0x1f,%eax
  sar    $0x22,%rsi
  sub    %eax,%esi
  lea    (%rsi,%rsi,4),%eax
  mov    %edi,%esi
  add    %eax,%eax
  sub    %eax,%esi
  jmp    L65
  nopl   (%rax)
L86:
  lea    D43(%rip),%rdi
  call   <puts@plt>
  jmp    L39
  mov    $0x6,%esi
  mov    $0x6,%ebp
  jmp    L65
L37:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: label: D19
type_infered: string
name: read_data
arguments: label: D44
type_infered: string
name: read_data
arguments: label: D29
type_infered: string
name: read_data
arguments: label: D43
type_infered: string

tool: D19: %d

tool: D44: %d


tool: D29: %s %lld

tool: D43: 1

assistant: ```c
int main() {
  int i, j, c, len, num, temp, t, res;
  long long int b;
  char a[1001];
  scanf("%d", &t);
  while (t--) {
    scanf("%s %lld", &a, &b);
    if (b == 0) {
      printf("1\n");
      continue;
    }
    c = a[strlen(a) - 1] - '0';
    if (c == 0 || c == 1 || c == 5 || c == 6)
      res = c;
    else if (c == 2 || c == 3 || c == 7 || c == 8)
      res = pow(c, 4 + (b % 4));
    else if (c == 4 || c == 9)
      res = pow(c, 2 + (b % 2));
    printf("%d\n", res % 10);
  }
  return 0;
}
```