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
  mov    %rsi,%rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  cmp    $0x4,%edi
  je     L10
  xor    %edi,%edi
  call   <usage@plt>
L10:
  lea    D20(%rip),%rbp
  mov    0x8(%rbx),%rdi
  lea    0x14(%rsp),%rdx
  mov    %rbp,%rsi
  call   <sscanf@plt>
  test   %rax,%rax
  je     L89
  mov    0x14(%rsp),%r9d
  test   %r9d,%r9d
  jle    L89
L25:
  mov    0x10(%rbx),%rdi
  lea    0x1c(%rsp),%rdx
  mov    %rbp,%rsi
  call   <sscanf@plt>
  test   %rax,%rax
  je     L27
  mov    0x1c(%rsp),%r8d
  test   %r8d,%r8d
  jle    L27
L239:
  mov    0x18(%rbx),%rdi
  lea    0x18(%rsp),%rdx
  mov    %rbp,%rsi
  call   <sscanf@plt>
  test   %rax,%rax
  je     L31
  mov    0x18(%rsp),%edx
  lea    -0x8(%rdx),%eax
  and    $0xfffffff7,%eax
  je     L42
  cmp    $0x20,%edx
  jne    L31
L42:
  mov    0x14(%rsp),%edi
  mov    0x1c(%rsp),%esi
  cmp    $0x10,%edx
  jg     L74
  mov    $0x1,%eax
  mov    %edx,%ecx
  lea    (%rdi,%rsi,1),%r8d
  shl    %cl,%eax
  cmp    %eax,%r8d
  jg     L29
L74:
  call   <reed_sol_vandermonde_coding_matrix@plt>
  lea    D12(%rip),%rdi
  xor    %r12d,%r12d
  lea    0x20(%rsp),%rbp
  mov    %rax,%r15
  call   <puts@plt>
  mov    0x18(%rsp),%ecx
  mov    0x14(%rsp),%edx
  mov    %r15,%rdi
  mov    0x1c(%rsp),%esi
  call   <jerasure_print_matrix@plt>
  mov    $0xa,%edi
  call   <putchar@plt>
  xor    %edi,%edi
  call   <srand48@plt>
  mov    0x14(%rsp),%eax
  lea    0x0(,%rax,8),%edi
  call   <malloc@plt>
  mov    0x14(%rsp),%edi
  mov    %rax,%r13
  mov    %rax,%rbx
  test   %edi,%edi
  jle    L212
  nopl   0x0(%rax)
L189:
  mov    $0x8,%edi
  add    $0x1,%r12d
  add    $0x8,%rbx
  call   <malloc@plt>
  mov    %rax,-0x8(%rbx)
  xor    %eax,%eax
  call   <lrand48@plt>
  mov    -0x8(%rbx),%rdi
  mov    $0x8,%edx
  mov    %rbp,%rsi
  cltq
  mov    %rax,0x20(%rsp)
  call   <memcpy@plt>
  cmp    %r12d,0x14(%rsp)
  jg     L189
L212:
  mov    0x1c(%rsp),%eax
  xor    %ebx,%ebx
  lea    0x0(,%rax,8),%edi
  call   <malloc@plt>
  mov    0x1c(%rsp),%esi
  mov    %rax,%r14
  mov    %rax,%rbp
  test   %esi,%esi
  jle    L40
  nopl   0x0(%rax)
L65:
  mov    $0x8,%edi
  add    $0x1,%ebx
  add    $0x8,%rbp
  call   <malloc@plt>
  mov    0x1c(%rsp),%esi
  mov    %rax,-0x8(%rbp)
  cmp    %ebx,%esi
  jg     L65
L40:
  sub    $0x8,%rsp
  mov    %r14,%r9
  mov    %r13,%r8
  mov    %r15,%rcx
  push   $0x8
  mov    0x28(%rsp),%edx
  mov    0x24(%rsp),%edi
  call   <jerasure_matrix_encode@plt>
  lea    D2(%rip),%rdi
  call   <puts@plt>
  mov    0x28(%rsp),%edx
  mov    0x2c(%rsp),%esi
  mov    %r14,%r9
  mov    0x24(%rsp),%edi
  mov    $0x8,%ecx
  mov    %r13,%r8
  call   <print_data_and_coding@plt>
  mov    0x2c(%rsp),%eax
  lea    0x4(,%rax,4),%edi
  call   <malloc@plt>
  mov    0x2c(%rsp),%edi
  add    0x24(%rsp),%edi
  shl    $0x2,%edi
  mov    %rax,0x10(%rsp)
  call   <malloc@plt>
  mov    0x24(%rsp),%edx
  mov    %rax,%r12
  mov    0x2c(%rsp),%eax
  pop    %rcx
  pop    %rsi
  add    %eax,%edx
  test   %edx,%edx
  jle    L198
  mov    %r12,%rcx
  xor    %edx,%edx
  xchg   %ax,%ax
L48:
  movl   $0x0,(%rcx)
  mov    0x1c(%rsp),%eax
  add    $0x1,%edx
  add    $0x4,%rcx
  mov    0x14(%rsp),%esi
  add    %eax,%esi
  cmp    %edx,%esi
  jg     L48
L198:
  lea    0x20(%rsp),%rdi
  mov    (%rsp),%rbx
  xor    %ebp,%ebp
  movq   $0x0,0x20(%rsp)
  mov    %rdi,0x8(%rsp)
  jmp    L9
  cs nopw 0x0(%rax,%rax,1)
L190:
  xor    %eax,%eax
  call   <lrand48@plt>
  mov    0x1c(%rsp),%ecx
  add    0x14(%rsp),%ecx
  cltd
  idiv   %ecx
  mov    %edx,(%rbx)
  movslq %edx,%rdx
  lea    (%r12,%rdx,4),%rax
  mov    (%rax),%edx
  test   %edx,%edx
  je     L199
  mov    0x1c(%rsp),%eax
L9:
  cmp    %eax,%ebp
  jl     L190
  movl   $0xffffffff,(%rbx)
  mov    0x1c(%rsp),%esi
  lea    D34(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0x18(%rsp),%edx
  mov    0x1c(%rsp),%esi
  mov    %r14,%r9
  mov    0x14(%rsp),%edi
  mov    %r13,%r8
  mov    $0x8,%ecx
  call   <print_data_and_coding@plt>
  sub    $0x8,%rsp
  mov    $0x1,%r8d
  mov    %r15,%rcx
  push   $0x8
  push   %r14
  push   %r13
  mov    0x20(%rsp),%r9
  mov    0x38(%rsp),%edx
  mov    0x3c(%rsp),%esi
  mov    0x34(%rsp),%edi
  call   <jerasure_matrix_decode@plt>
  add    $0x20,%rsp
  lea    D27(%rip),%rdi
  call   <puts@plt>
  mov    0x18(%rsp),%edx
  mov    0x1c(%rsp),%esi
  mov    %r14,%r9
  mov    0x14(%rsp),%edi
  mov    %r13,%r8
  mov    $0x8,%ecx
  call   <print_data_and_coding@plt>
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L166
  add    $0x38,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L27:
  lea    D19(%rip),%rdi
  call   <usage@plt>
  jmp    L239
L89:
  lea    D45(%rip),%rdi
  call   <usage@plt>
  jmp    L25
  nopl   (%rax)
L199:
  movl   $0x1,(%rax)
  movslq (%rbx),%rax
  mov    0x14(%rsp),%edx
  cmp    %edx,%eax
  jl     L245
  sub    %edx,%eax
  cltq
  mov    (%r14,%rax,8),%rdi
L62:
  mov    0x8(%rsp),%rsi
  mov    $0x8,%edx
  add    $0x1,%ebp
  add    $0x4,%rbx
  call   <memcpy@plt>
  mov    0x1c(%rsp),%eax
  jmp    L9
L31:
  lea    D65(%rip),%rdi
  call   <usage@plt>
  mov    0x18(%rsp),%edx
  jmp    L42
L245:
  mov    0x0(%r13,%rax,8),%rdi
  jmp    L62
L29:
  lea    D53(%rip),%rdi
  call   <usage@plt>
  mov    0x18(%rsp),%edx
  mov    0x14(%rsp),%edi
  mov    0x1c(%rsp),%esi
  jmp    L74
L166:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D20
type_infered: string
name: extract_symbolic_data
arguments: data_label: D12
type_infered: string
name: extract_symbolic_data
arguments: data_label: D2
type_infered: string
name: extract_symbolic_data
arguments: data_label: D34
type_infered: string
name: extract_symbolic_data
arguments: data_label: D27
type_infered: string
name: extract_symbolic_data
arguments: data_label: D19
type_infered: string
name: extract_symbolic_data
arguments: data_label: D45
type_infered: string
name: extract_symbolic_data
arguments: data_label: D65
type_infered: string
name: extract_symbolic_data
arguments: data_label: D53
type_infered: string

tool: D20: %d

tool: D12: Last m rows of the Distribution Matrix:


tool: D2: Encoding Complete:


tool: D34: Erased %d random devices:



tool: D27: State of the system after decoding:


tool: D19: Bad m

tool: D45: Bad k

tool: D65: Bad w

tool: D53: k + m is too big

assistant: ```c
int main(int argc, char **argv) {
  long l;
  int k, w, i, j, m;
  int *matrix;
  char **data, **coding;
  int *erasures, *erased;
  int *decoding_matrix, *dm_ids;
  if (argc != 4)
    usage(NULL);
  if (sscanf(argv[1], "%d", &k) == 0 || k <= 0)
    usage("Bad k");
  if (sscanf(argv[2], "%d", &m) == 0 || m <= 0)
    usage("Bad m");
  if (sscanf(argv[3], "%d", &w) == 0 || (w != 8 && w != 16 && w != 32))
    usage("Bad w");
  if (w <= 16 && k + m > (1 << w))
    usage("k + m is too big");
  matrix = reed_sol_vandermonde_coding_matrix(k, m, w);
  printf("Last m rows of the Distribution Matrix:\n\n");
  jerasure_print_matrix(matrix, m, k, w);
  printf("\n");
  srand48(0);
  data = (char **)malloc(sizeof(char *) * (k));
  for (i = 0; i < k; i++) {
    data[i] = (char *)malloc(sizeof(char) * (sizeof(long)));
    l = lrand48();
    memcpy(data[i], &l, sizeof(long));
  }
  coding = (char **)malloc(sizeof(char *) * (m));
  for (i = 0; i < m; i++) {
    coding[i] = (char *)malloc(sizeof(char) * (sizeof(long)));
  }
  jerasure_matrix_encode(k, m, w, matrix, data, coding, sizeof(long));
  printf("Encoding Complete:\n\n");
  print_data_and_coding(k, m, w, sizeof(long), data, coding);
  erasures = (int *)malloc(sizeof(int) * ((m + 1)));
  erased = (int *)malloc(sizeof(int) * ((k + m)));
  for (i = 0; i < m + k; i++)
    erased[i] = 0;
  l = 0;
  for (i = 0; i < m;) {
    erasures[i] = lrand48() % (k + m);
    if (erased[erasures[i]] == 0) {
      erased[erasures[i]] = 1;
      memcpy((erasures[i] < k) ? data[erasures[i]] : coding[erasures[i] - k], &l, sizeof(long));
      i++;
    }
  }
  erasures[i] = -1;
  printf("Erased %d random devices:\n\n", m);
  print_data_and_coding(k, m, w, sizeof(long), data, coding);
  i = jerasure_matrix_decode(k, m, w, matrix, 1, erasures, data, coding, sizeof(long));
  printf("State of the system after decoding:\n\n");
  print_data_and_coding(k, m, w, sizeof(long), data, coding);
  return 0;
}
```