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

```asm
<mc_test_row>:
  endbr64
  push   %r15
  xor    %eax,%eax
  mov    $0x1,%r15d
  push   %r14
  push   %r13
  mov    %rsi,%r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  mov    %rdx,%rbp
  mov    %rsi,%rdx
  mov    %rdi,%rsi
  push   %rbx
  lea    D8(%rip),%rdi
  sub    $0x18,%rsp
  call   <printf@plt>
  mov    %rbp,%rax
  lea    -0x1(%r15),%r8d
  and    $0x40,%eax
  mov    %rax,0x8(%rsp)
  cmp    $0x3,%r8d
  je     L3
L305:
  jg     L160
  cmp    $0x1,%r8d
  je     L213
  cmp    $0x2,%r8d
  jne    L227
  test   $0x4,%bpl
  jne    L239
L210:
  add    $0x1,%r15d
L90:
  lea    -0x1(%r15),%r8d
  cmp    $0x3,%r8d
  jne    L305
L3:
  test   $0x8,%bpl
  je     L210
L239:
  mov    $0x1,%r14d
  lea    -0x1(%r14),%ebx
  mov    %ebx,(%rsp)
  cmp    $0x1,%ebx
  je     L191
L64:
  cmp    $0x2,%ebx
  je     L47
  test   $0x100,%ebp
  jne    L158
L313:
  cmp    $0x3,%r14d
  je     L97
L205:
  add    $0x1,%r14d
  lea    -0x1(%r14),%ebx
  mov    %ebx,(%rsp)
  cmp    $0x1,%ebx
  jne    L64
L191:
  test   $0x200,%ebp
  je     L205
L37:
  lea    -0x1(%rbx),%eax
  cmp    $0x2,%ebx
  je     L207
L7:
  cmp    $0x2,%eax
  je     L121
  test   $0x20,%bpl
  je     L102
  mov    (%rsp),%esi
  mov    %r8d,%edi
  mov    %r13,%rcx
  mov    %r12,%rdx
  xor    %eax,%eax
  mov    %r8d,0x4(%rsp)
  call   <mc_test_row_8@plt>
  mov    0x4(%rsp),%r8d
L45:
  test   %eax,%eax
  jne    L92
L12:
  mov    %r13,%rsi
  mov    %r12,%rdi
  xor    %eax,%eax
  mov    %r8d,0x4(%rsp)
  call   <mc_clear_row@plt>
  mov    0x4(%rsp),%r8d
L102:
  cmp    $0x3,%ebx
  je     L313
L211:
  add    $0x1,%ebx
  lea    -0x1(%rbx),%eax
  cmp    $0x2,%ebx
  jne    L7
L207:
  cmpq   $0x0,0x8(%rsp)
  je     L211
  mov    (%rsp),%esi
  mov    %r8d,%edi
  mov    %r13,%rcx
  mov    %r12,%rdx
  xor    %eax,%eax
  mov    %r8d,0x4(%rsp)
  call   <mc_test_row_16@plt>
  mov    0x4(%rsp),%r8d
  test   %eax,%eax
  je     L12
L92:
  add    $0x18,%rsp
  cltq
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L160:
  cmp    $0x4,%r8d
  jne    L227
  test   $0x10,%bpl
  jne    L239
L124:
  add    $0x18,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L227:
  test   $0x1,%bpl
  jne    L239
L97:
  cmp    $0x5,%r15d
  je     L124
  add    $0x1,%r15d
  jmp    L90
  nopl   0x0(%rax)
L121:
  test   $0x80,%bpl
  je     L313
  mov    (%rsp),%esi
  mov    %r8d,%edi
  mov    %r13,%rcx
  mov    %r12,%rdx
  xor    %eax,%eax
  mov    %r8d,0x4(%rsp)
  call   <mc_test_row_32@plt>
  mov    0x4(%rsp),%r8d
  jmp    L45
  nopl   0x0(%rax)
L47:
  test   $0x400,%ebp
  je     L97
L158:
  mov    $0x1,%ebx
  jmp    L37
  nopw   0x0(%rax,%rax,1)
L213:
  test   $0x2,%bpl
  jne    L239
  add    $0x1,%r15d
  jmp    L90
```

tool_calls: name: retrieve_data
arguments: data_label: D8
type: string

tool: D8: 
mc_test_row(0x%08lX, 0x%08lX)


assistant: ```c
unsigned long mc_test_row(unsigned long nFrom, unsigned long nTo, unsigned long flags) {
  int nRun, nSize, nSeq;
  int ret = 0;
  printf("\nmc_test_row(0x%08lX, 0x%08lX)\n", nFrom, nTo);
  for (nRun = 0; nRun < 5; nRun++) {
    switch (nRun) {
    case 0:
      if ((flags & 0x00000001LU) != 0x00000001LU)
        continue;
      break;
    case 1:
      if ((flags & 0x00000002LU) != 0x00000002LU)
        continue;
      break;
    case 2:
      if ((flags & 0x00000004LU) != 0x00000004LU)
        continue;
      break;
    case 3:
      if ((flags & 0x00000008LU) != 0x00000008LU)
        continue;
      break;
    case 4:
      if ((flags & 0x00000010LU) != 0x00000010LU)
        continue;
    }
    for (nSeq = 0; nSeq < 3; nSeq++) {
      switch (nSeq) {
      case 0:
        if ((flags & 0x00000100LU) != 0x00000100LU)
          continue;
        break;
      case 1:
        if ((flags & 0x00000200LU) != 0x00000200LU)
          continue;
        break;
      case 2:
        if ((flags & 0x00000400LU) != 0x00000400LU)
          continue;
      }
      for (nSize = 0; nSize < 3; nSize++) {
        switch (nSize) {
        case 0:
          if ((flags & 0x00000020LU) != 0x00000020LU)
            continue;
          ret = mc_test_row_8(nRun, nSeq, nFrom, nTo);
          break;
        case 1:
          if ((flags & 0x00000040LU) != 0x00000040LU)
            continue;
          ret = mc_test_row_16(nRun, nSeq, nFrom, nTo);
          break;
        case 2:
          if ((flags & 0x00000080LU) != 0x00000080LU)
            continue;
          ret = mc_test_row_32(nRun, nSeq, nFrom, nTo);
        }
        if (ret)
          return ret;
        mc_clear_row(nFrom, nTo);
      }
    }
  }
  return 0;
}
```