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    $0x48,%rsp
  mov    0x8(%rsi),%rdi
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  test   %rdi,%rdi
  je     L250
  xor    %r14d,%r14d
  mov    $0x64,%r15d
  mov    $0x1f4,%edx
  mov    $0x1f4,%eax
  mov    %r14d,0x18(%rsp)
  lea    0x8(%rsi),%rbx
  lea    0x34(%rsp),%r12
  mov    %edx,%r14d
  mov    %r15d,0x20(%rsp)
  lea    0x33(%rsp),%rbp
  mov    %eax,%r15d
  lea    D23(%rip),%r13
  movl   $0x21,0x28(%rsp)
  movl   $0x0,0x10(%rsp)
  movl   $0x3e8,0x8(%rsp)
  movl   $0x0,0x2c(%rsp)
  jmp    L64
  nopl   0x0(%rax)
L19:
  mov    0x34(%rsp),%eax
  test   %eax,%eax
  jle    L8
  movzbl 0x33(%rsp),%edx
  cmp    $0x72,%dl
  je     L122
  jg     L3
  cmp    $0x4c,%dl
  je     L135
  cmp    $0x6c,%dl
  cmove  %eax,%r15d
  nopl   0x0(%rax)
L112:
  mov    0x8(%rbx),%rdi
  add    $0x8,%rbx
  test   %rdi,%rdi
  je     L228
L64:
  mov    %r12,%rcx
  mov    %rbp,%rdx
  mov    %r13,%rsi
  call   <sscanf@plt>
  cmp    $0x2,%eax
  je     L19
L8:
  mov    (%rbx),%rdi
  mov    %r12,%rcx
  mov    %rbp,%rdx
  lea    D24(%rip),%rsi
  call   <sscanf@plt>
  cmp    $0x2,%eax
  jne    L237
  mov    0x34(%rsp),%eax
  test   %eax,%eax
  js     L237
  movzbl 0x33(%rsp),%edx
  cmp    $0x70,%dl
  je     L52
  jg     L75
  cmp    $0x69,%dl
  je     L215
  cmp    $0x6d,%dl
  cmovne 0x10(%rsp),%eax
  mov    0x8(%rbx),%rdi
  add    $0x8,%rbx
  mov    %eax,0x10(%rsp)
  test   %rdi,%rdi
  jne    L64
L228:
  mov    %r14d,%ebx
  mov    0x18(%rsp),%r14d
  mov    %r15d,0x14(%rsp)
  mov    %r15d,%edi
  mov    0x20(%rsp),%r15d
  test   %r14d,%r14d
  je     L29
  call   <read_labels@plt>
  mov    %rax,0x20(%rsp)
L273:
  mov    0x28(%rsp),%esi
  mov    %r15d,%edi
  lea    D5(%rip),%r13
  call   <genrights@plt>
  mov    0x8(%rsp),%esi
  mov    0x2c(%rsp),%ecx
  mov    %ebx,%edx
  mov    0x14(%rsp),%edi
  mov    %rax,%r12
  call   <make_the_rules@plt>
  lea    -0x1(%rbx),%edx
  lea    0x4(%rax),%rsi
  lea    (%rsi,%rdx,4),%rdx
  mov    %rsi,0x8(%rsp)
  mov    %rdx,0x18(%rsp)
  cs nopw 0x0(%rax,%rax,1)
L103:
  mov    (%rax),%eax
  mov    0x20(%rsp),%rbx
  xor    %r14d,%r14d
  cltd
  mov    %eax,0x34(%rsp)
  idivl  0x14(%rsp)
  movslq %edx,%rdx
  cltq
  lea    (%rbx,%rdx,8),%rbp
  lea    (%rbx,%rax,8),%rbx
L113:
  mov    %r15d,%edi
  add    $0x1,%r14d
  call   <alea@plt>
  mov    0x0(%rbp),%rdx
  mov    (%rbx),%rsi
  mov    %r13,%rdi
  mov    (%r12,%rax,8),%rcx
  call   <printf@plt>
  cmp    0x10(%rsp),%r14d
  jle    L113
  mov    0x8(%rsp),%rsi
  mov    %rsi,%rax
  cmp    %rsi,0x18(%rsp)
  je     L67
  lea    0x4(%rsi),%rdx
  mov    %rdx,0x8(%rsp)
  jmp    L103
L237:
  xor    %eax,%eax
  call   <usage@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L112
  cs nopw 0x0(%rax,%rax,1)
L3:
  cmp    $0x75,%dl
  cmove  %eax,%r14d
  jmp    L112
L75:
  cmp    $0x73,%dl
  jne    L112
  test   %eax,%eax
  setne  %al
  movzbl %al,%eax
  mov    %eax,0x2c(%rsp)
  jmp    L112
  cs nopw 0x0(%rax,%rax,1)
L135:
  mov    %eax,0x8(%rsp)
  jmp    L112
  nopl   0x0(%rax)
L67:
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L192
  add    $0x48,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L215:
  mov    %eax,0x18(%rsp)
  jmp    L112
L250:
  movl   $0x21,0x28(%rsp)
  mov    $0x64,%r15d
  mov    $0x1f4,%ebx
  movl   $0x0,0x10(%rsp)
  movl   $0x0,0x2c(%rsp)
  movl   $0x1f4,0x14(%rsp)
  movl   $0x3e8,0x8(%rsp)
L29:
  mov    0x14(%rsp),%edi
  mov    $0x18,%edx
  mov    $0x4,%esi
  call   <gen_labels@plt>
  mov    %rax,0x20(%rsp)
  jmp    L273
L122:
  mov    %eax,0x20(%rsp)
  jmp    L112
L52:
  mov    %eax,0x28(%rsp)
  jmp    L112
L192:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_tag: D23
data_type: string
name: unpack_data
arguments: data_tag: D24
data_type: string
name: unpack_data
arguments: data_tag: D5
data_type: string

tool: D23: %1[lLru]=%d

tool: D24: %1[misp]=%d

tool: D5: %s %s %s


assistant: ```c
int main(int argc, char **argv) {
  int shuffle = 0;
  int lab_cnt = 500;
  int rig_cnt = 100;
  int rul_cnt = 500;
  int lab_max = rul_cnt * 2;
  int mer_cnt = 0;
  int lab_stdin = 0;
  int permodif = 33;
  char **labels;
  char **rights, c;
  int n, r, m, sub, obj;
  int *rules;
  while (*++argv) {
    if (sscanf(*argv, "%1[lLru]=%d", &c, &n) == 2 && n > 0) {
      switch (c) {
      case 'l':
        lab_cnt = n;
        break;
      case 'r':
        rig_cnt = n;
        break;
      case 'u':
        rul_cnt = n;
        break;
      case 'L':
        lab_max = n;
        break;
      }
    } else if (sscanf(*argv, "%1[misp]=%d", &c, &n) == 2 && n >= 0) {
      switch (c) {
      case 'm':
        mer_cnt = n;
        break;
      case 'i':
        lab_stdin = n;
        break;
      case 's':
        shuffle = !!n;
        break;
      case 'p':
        permodif = n;
        break;
      }
    } else {
      usage();
      exit(1);
    }
  }
  if (lab_stdin)
    labels = read_labels(lab_cnt);
  else
    labels = gen_labels(lab_cnt, 4, 24);
  rights = genrights(rig_cnt, permodif);
  rules = make_the_rules(lab_cnt, lab_max, rul_cnt, shuffle);
  for (r = 0; r < rul_cnt; r++) {
    n = rules[r];
    sub = n / lab_cnt;
    obj = n % lab_cnt;
    for (m = 0; m <= mer_cnt; m++)
      printf("%s %s %s\n", labels[sub], labels[obj], rights[alea(rig_cnt)]);
  }
  return 0;
}
```