user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xb8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0xa8(%rsp)
  xor    %eax,%eax
  lea    0x28(%rsp),%rax
  mov    %rax,0x10(%rsp)
  lea    0x24(%rsp),%rax
  mov    %rax,0x8(%rsp)
  lea    0x2c(%rsp),%rax
  mov    %rax,0x18(%rsp)
  jmp    L213
L127:
  mov    0x24(%rsp),%eax
  test   %eax,%eax
  je     L124
  nopl   0x0(%rax)
L31:
  mov    $0xa,%edi
  call   <putchar@plt>
L213:
  mov    0x10(%rsp),%rcx
  mov    0x8(%rsp),%rdx
  lea    D80(%rip),%rdi
  mov    0x18(%rsp),%rsi
  call   <scanf@plt>
  cmp    $0x3,%eax
  jne    L124
  mov    0x2c(%rsp),%edx
  mov    %edx,%eax
  or     0x28(%rsp),%eax
  je     L127
  test   %edx,%edx
  jle    L31
  lea    -0x1(%rdx),%eax
  cmp    $0x2,%eax
  jbe    L89
  movdqa D3(%rip),%xmm1
  mov    %edx,%eax
  shr    $0x2,%eax
  movups %xmm1,0x34(%rsp)
  cmp    $0x1,%eax
  je     L358
  movdqa D45(%rip),%xmm2
  movups %xmm2,0x44(%rsp)
  cmp    $0x2,%eax
  je     L358
  movdqa D76(%rip),%xmm3
  movups %xmm3,0x54(%rsp)
  cmp    $0x3,%eax
  je     L358
  movdqa D5(%rip),%xmm4
  movups %xmm4,0x64(%rsp)
  cmp    $0x4,%eax
  je     L358
  movdqa D15(%rip),%xmm0
  movups %xmm0,0x74(%rsp)
  cmp    $0x5,%eax
  je     L358
  movdqa D85(%rip),%xmm0
  movups %xmm0,0x84(%rsp)
  cmp    $0x6,%eax
  je     L358
  movdqa D63(%rip),%xmm0
  movups %xmm0,0x94(%rsp)
L358:
  mov    %edx,%ecx
  and    $0xfffffffc,%ecx
  lea    0x1(%rcx),%eax
  cmp    %ecx,%edx
  je     L72
L232:
  movslq %eax,%rcx
  mov    %eax,0x30(%rsp,%rcx,4)
  lea    0x1(%rax),%ecx
  cmp    %ecx,%edx
  jl     L72
  movslq %ecx,%rsi
  add    $0x2,%eax
  mov    %ecx,0x30(%rsp,%rsi,4)
  cmp    %eax,%edx
  jl     L72
  movslq %eax,%rcx
  mov    %eax,0x30(%rsp,%rcx,4)
L72:
  mov    %edx,%r15d
  mov    $0x1,%ebx
  xor    %r14d,%r14d
  mov    $0x1,%eax
  lea    0x30(%rsp),%r13
  jmp    L105
  nopl   0x0(%rax)
L162:
  add    $0x1,%rax
  cmp    %eax,%edx
  jl     L31
L105:
  cmpl   $0xffffffff,0x0(%r13,%rax,4)
  je     L162
  test   %r14d,%r14d
  jne    L181
L90:
  cmp    %ebx,%edx
  jl     L360
  mov    0x24(%rsp),%esi
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L278:
  movslq %ebx,%rcx
  cmpl   $0xffffffff,0x30(%rsp,%rcx,4)
  je     L331
  add    $0x1,%eax
L331:
  cmp    %eax,%esi
  je     L360
  cmp    %ebx,%edx
  je     L224
  add    $0x1,%ebx
  cmp    %ebx,%edx
  jge    L278
L360:
  movslq %r15d,%rbp
  mov    0x30(%rsp,%rbp,4),%r8d
  test   %r15d,%r15d
  jle    L139
L166:
  mov    0x28(%rsp),%esi
  xor    %eax,%eax
  jmp    L231
  nopl   0x0(%rax)
L26:
  sub    $0x1,%r15d
L377:
  movslq %r15d,%rbp
L231:
  mov    0x30(%rsp,%rbp,4),%r8d
  xor    %ecx,%ecx
  cmp    $0xffffffff,%r8d
  setne  %cl
  add    %ecx,%eax
  cmp    %eax,%esi
  je     L139
  cmp    $0x1,%r15d
  jne    L26
  test   %edx,%edx
  jle    L191
  mov    %edx,%r15d
  jmp    L377
  nopw   0x0(%rax,%rax,1)
L224:
  mov    $0x1,%ebx
  test   %edx,%edx
  jg     L278
  movslq %r15d,%rbp
  mov    0x30(%rsp,%rbp,4),%r8d
  test   %r15d,%r15d
  jg     L166
  xchg   %ax,%ax
L139:
  cmp    %ebx,%r15d
  je     L332
L94:
  movslq %ebx,%r12
  mov    %r8d,%edx
  lea    D75(%rip),%rdi
  xor    %eax,%eax
  mov    0x30(%rsp,%r12,4),%esi
  call   <printf@plt>
  movl   $0xffffffff,0x30(%rsp,%r12,4)
L204:
  mov    0x2c(%rsp),%edx
  movl   $0xffffffff,0x30(%rsp,%rbp,4)
  add    $0x1,%r14d
  test   %edx,%edx
  jle    L31
  mov    $0x1,%eax
  jmp    L105
  nopl   0x0(%rax)
L191:
  movslq %edx,%rbp
  mov    %edx,%r15d
  mov    0x30(%rsp,%rbp,4),%r8d
  cmp    %ebx,%r15d
  jne    L94
L332:
  mov    %r8d,%esi
  lea    D55(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  jmp    L204
  nopl   0x0(%rax,%rax,1)
L181:
  mov    $0x2c,%edi
  call   <putchar@plt>
  mov    0x2c(%rsp),%edx
  jmp    L90
L89:
  mov    $0x1,%eax
  jmp    L232
L124:
  mov    0xa8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L27
  add    $0xb8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L27:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_tag: D80
type: string
name: read_data
arguments: data_tag: D3
type: byte[16]
name: read_data
arguments: data_tag: D45
type: byte[16]
name: read_data
arguments: data_tag: D76
type: byte[16]
name: read_data
arguments: data_tag: D5
type: byte[16]
name: read_data
arguments: data_tag: D15
type: byte[16]
name: read_data
arguments: data_tag: D85
type: byte[16]
name: read_data
arguments: data_tag: D63
type: byte[16]
name: read_data
arguments: data_tag: D75
type: string
name: read_data
arguments: data_tag: D55
type: string

tool: D80: %d%d%d

tool: {"D3": [0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x04,0x00,0x00,0x00]}

tool: {"D45": [0x05,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x08,0x00,0x00,0x00]}

tool: {"D76": [0x09,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x0c,0x00,0x00,0x00]}

tool: {"D5": [0x0d,0x00,0x00,0x00,0x0e,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x10,0x00,0x00,0x00]}

tool: {"D15": [0x11,0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x13,0x00,0x00,0x00,0x14,0x00,0x00,0x00]}

tool: {"D85": [0x15,0x00,0x00,0x00,0x16,0x00,0x00,0x00,0x17,0x00,0x00,0x00,0x18,0x00,0x00,0x00]}

tool: {"D63": [0x19,0x00,0x00,0x00,0x1a,0x00,0x00,0x00,0x1b,0x00,0x00,0x00,0x1c,0x00,0x00,0x00]}

tool: D75: %3d%3d

tool: D55: %3d

assistant: ```c
main() {
  int a[30];
  int i, j, k, l, m, n, reg, reg1, reg2;
  int start, end, flag;
  while (scanf("%d%d%d", &n, &k, &m) == 3) {
    if (m == 0 && n == 0 && k == 0)
      break;
    start = 1;
    end = n;
    reg = 0, flag = 0;
    ;
    for (i = 1; i <= n; i++)
      a[i] = i;
    while (1) {
      for (i = 1; i <= n; i++)
        if (a[i] != -1) {
          flag = 1;
          break;
        }
      if (!flag)
        break;
      if (reg++ != 0)
        putchar(',');
      reg1 = 0;
      reg2 = 0;
      for (i = start; i <= n; i++) {
        if (a[i] != -1)
          reg1++;
        if (reg1 == k)
          break;
        else if (i == n)
          i = 0;
      }
      for (j = end; j >= 1; j--) {
        if (a[j] != -1)
          reg2++;
        if (reg2 == m)
          break;
        else if (j == 1)
          j = n + 1;
      }
      if (i == j) {
        printf("%3d", a[j]);
        start = i;
        end = j;
        a[j] = -1;
      } else {
        printf("%3d%3d", a[i], a[j]);
        start = i;
        end = j;
        a[i] = -1;
        a[j] = -1;
      }
      flag = 0;
    }
    putchar('\n');
  }
  return 0;
}
```