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

```asm
<is_prime_mr>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  and    $0x1,%edi
  jne    L264
  cmp    $0x2,%rbp
  jne    L369
L264:
  cmp    $0x1,%rbp
  je     L369
  movabs $0xaaaaaaaaaaaaaaab,%rax
  movabs $0x5555555555555555,%rdx
  imul   %rbp,%rax
  cmp    %rdx,%rax
  ja     L367
  cmp    $0x3,%rbp
  jne    L369
L367:
  mov    $0x1,%eax
  cmp    $0x3,%rbp
  jbe    L45
  mov    %rbp,%r12
  shr    %r12
  mov    %r12,%r13
  and    $0x1,%r13d
  jne    L234
  mov    $0x1,%r13d
L385:
  shr    %r12
  add    $0x1,%r13
  test   $0x1,%r12b
  je     L385
L234:
  cmp    $0x14f5d4,%rbp
  jbe    L280
  cmp    $0x8a8d7e,%rbp
  jbe    L14
  movabs $0x11baa74c4,%rax
  cmp    %rax,%rbp
  jbe    L102
  movabs $0x1053cb094c0,%rax
  cmp    %rax,%rbp
  jbe    L6
  movabs $0x1f51f3fee3a,%rax
  cmp    %rax,%rbp
  jbe    L378
  mov    $0x2,%ecx
  mov    %r12,%rdx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  movabs $0x32907381cde,%rax
  cmp    %rax,%rbp
  jbe    L75
  call   <witness@plt>
  test   %rax,%rax
  jne    L319
  nopl   0x0(%rax,%rax,1)
L369:
  xor    %eax,%eax
L45:
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax,%rax,1)
L280:
  mov    $0x2,%ecx
  mov    %r12,%rdx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <witness@plt>
  mov    $0x3,%ecx
  test   %rax,%rax
  je     L369
  jmp    L412
  nop
L14:
  mov    $0x1f,%ecx
  mov    %r12,%rdx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <witness@plt>
  mov    $0x49,%ecx
  test   %rax,%rax
  je     L369
L412:
  mov    %r12,%rdx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <witness@plt>
  test   %rax,%rax
  setne  %al
  movzbl %al,%eax
  jmp    L45
L319:
  mov    $0x3,%ecx
  mov    %r12,%rdx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <witness@plt>
  test   %rax,%rax
  je     L369
  mov    $0x5,%ecx
  mov    %r12,%rdx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <witness@plt>
  test   %rax,%rax
  je     L369
  mov    $0x7,%ecx
  mov    %r12,%rdx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <witness@plt>
  test   %rax,%rax
  je     L369
  mov    $0xb,%ecx
  mov    %r12,%rdx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <witness@plt>
  test   %rax,%rax
  je     L369
  mov    $0xd,%ecx
  mov    %r12,%rdx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <witness@plt>
  test   %rax,%rax
  je     L369
  mov    $0x11,%ecx
  jmp    L412
  nopl   0x0(%rax,%rax,1)
L102:
  mov    $0x2,%ecx
  mov    %r12,%rdx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <witness@plt>
  test   %rax,%rax
  je     L369
  mov    $0x7,%ecx
  mov    %r12,%rdx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <witness@plt>
  mov    $0x3d,%ecx
  test   %rax,%rax
  je     L369
  jmp    L412
  nopw   0x0(%rax,%rax,1)
L75:
  call   <witness@plt>
  test   %rax,%rax
  je     L369
  mov    $0x3,%ecx
  mov    %r12,%rdx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <witness@plt>
  test   %rax,%rax
  je     L369
  mov    $0x5,%ecx
  mov    %r12,%rdx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <witness@plt>
  test   %rax,%rax
  je     L369
  mov    $0x7,%ecx
  mov    %r12,%rdx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <witness@plt>
  test   %rax,%rax
  je     L369
  mov    $0xb,%ecx
  mov    %r12,%rdx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <witness@plt>
  mov    $0xd,%ecx
  test   %rax,%rax
  je     L369
  jmp    L412
L6:
  mov    $0x2,%ecx
  mov    %r12,%rdx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <witness@plt>
  test   %rax,%rax
  je     L369
  mov    $0xd,%ecx
  mov    %r12,%rdx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <witness@plt>
  test   %rax,%rax
  je     L369
  mov    $0x17,%ecx
  mov    %r12,%rdx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <witness@plt>
  mov    $0x195f53,%ecx
  test   %rax,%rax
  je     L369
  jmp    L412
  xchg   %ax,%ax
L378:
  mov    $0x2,%ecx
  mov    %r12,%rdx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <witness@plt>
  test   %rax,%rax
  je     L369
  mov    $0x3,%ecx
  mov    %r12,%rdx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <witness@plt>
  test   %rax,%rax
  je     L369
  mov    $0x5,%ecx
  mov    %r12,%rdx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <witness@plt>
  test   %rax,%rax
  je     L369
  mov    $0x7,%ecx
  mov    %r12,%rdx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <witness@plt>
  mov    $0xb,%ecx
  test   %rax,%rax
  je     L369
  jmp    L412
```

assistant: ```c
bool is_prime_mr(size_t n) {
  if (((!(n & 1)) && n != 2) || (n < 2) || (n % 3 == 0 && n != 3))
    return false;
  if (n <= 3)
    return true;
  size_t d = n / 2;
  size_t s = 1;
  while (!(d & 1)) {
    d /= 2;
    ++s;
  }
  if (n < 1373653)
    return witness(n, s, d, 2) && witness(n, s, d, 3);
  if (n < 9080191)
    return witness(n, s, d, 31) && witness(n, s, d, 73);
  if (n < 4759123141)
    return witness(n, s, d, 2) && witness(n, s, d, 7) && witness(n, s, d, 61);
  if (n < 1122004669633)
    return witness(n, s, d, 2) && witness(n, s, d, 13) && witness(n, s, d, 23) && witness(n, s, d, 1662803);
  if (n < 2152302898747)
    return witness(n, s, d, 2) && witness(n, s, d, 3) && witness(n, s, d, 5) && witness(n, s, d, 7) && witness(n, s, d, 11);
  if (n < 3474749660383)
    return witness(n, s, d, 2) && witness(n, s, d, 3) && witness(n, s, d, 5) && witness(n, s, d, 7) && witness(n, s, d, 11) && witness(n, s, d, 13);
  return witness(n, s, d, 2) && witness(n, s, d, 3) && witness(n, s, d, 5) && witness(n, s, d, 7) && witness(n, s, d, 11) && witness(n, s, d, 13) && witness(n, s, d, 17);
}
```