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

```asm
<prims>:
  endbr64
  push   %r15
  lea    -0x1(%rsi),%eax
  mov    %rdi,%r15
  push   %r14
  lea    0x0(,%rsi,4),%r14d
  push   %r13
  mov    %r14d,%edi
  push   %r12
  push   %rbp
  mov    %esi,%ebp
  push   %rbx
  sub    $0x38,%rsp
  mov    %eax,0x18(%rsp)
  mov    %eax,0x28(%rsp)
  call   <malloc@plt>
  lea    0x0(,%rbp,8),%edi
  mov    %rax,(%rsp)
  call   <malloc@plt>
  mov    %rax,0x8(%rsp)
  test   %ebp,%ebp
  jle    L237
  mov    %ebp,%esi
  mov    %ebx,0x2c(%rsp)
  mov    %rax,%r12
  mov    %rax,%rbx
  mov    %rsi,0x20(%rsp)
  lea    (%rax,%rsi,8),%rsi
  mov    %rsi,0x10(%rsp)
  mov    %rsi,%r13
  nopl   0x0(%rax)
L204:
  mov    %r14d,%edi
  add    $0x8,%rbx
  call   <malloc@plt>
  mov    %rax,-0x8(%rbx)
  cmp    %r13,%rbx
  jne    L204
  mov    0x2c(%rsp),%ebx
  mov    0x20(%rsp),%r13
  mov    %ebx,0x20(%rsp)
  mov    %r12,%rbx
  mov    0x10(%rsp),%r12
  shl    $0x2,%r13
  xchg   %ax,%ax
L38:
  mov    (%rbx),%rdi
  mov    %r13,%rdx
  xor    %esi,%esi
  add    $0x8,%rbx
  call   <memset@plt>
  cmp    %r12,%rbx
  jne    L38
  mov    $0x1,%esi
  mov    %ebp,%edi
  mov    0x20(%rsp),%ebx
  call   <calloc@plt>
  mov    %r14d,%edi
  mov    %rax,%r12
  call   <malloc@plt>
  movl   $0x0,(%rax)
  mov    %rax,%r14
  cmp    $0x1,%ebp
  jle    L37
  lea    -0x2(%rbp),%eax
  cmp    $0x2,%eax
  jbe    L45
  mov    0x18(%rsp),%edx
  movdqa D13(%rip),%xmm0
  lea    0x4(%r14),%rax
  shr    $0x2,%edx
  sub    $0x1,%edx
  shl    $0x4,%rdx
  lea    0x14(%r14,%rdx,1),%rdx
  xchg   %ax,%ax
L149:
  movups %xmm0,(%rax)
  add    $0x10,%rax
  cmp    %rdx,%rax
  jne    L149
  mov    0x18(%rsp),%esi
  mov    %esi,%edx
  and    $0xfffffffc,%edx
  lea    0x1(%rdx),%eax
  cmp    %edx,%esi
  je     L37
L14:
  movslq %eax,%rdx
  movl   $0x7fffffff,(%r14,%rdx,4)
  lea    0x0(,%rdx,4),%rcx
  lea    0x1(%rax),%edx
  cmp    %edx,%ebp
  jle    L37
  movl   $0x7fffffff,0x4(%r14,%rcx,1)
  add    $0x2,%eax
  cmp    %ebp,%eax
  jge    L37
  movl   $0x7fffffff,0x8(%r14,%rcx,1)
L37:
  mov    (%rsp),%rax
  movb   $0x1,(%r12)
  xor    %r11d,%r11d
  movslq %ebp,%r10
  sub    %r14,%rax
  mov    %rax,0x10(%rsp)
  mov    0x18(%rsp),%eax
  test   %eax,%eax
  jle    L218
  mov    %r14,0x18(%rsp)
  mov    0x28(%rsp),%r14d
  nopl   0x0(%rax)
L179:
  test   %ebp,%ebp
  jle    L167
  movslq %r11d,%rax
  mov    0x18(%rsp),%rdx
  mov    $0x7fffffff,%r13d
  mov    (%r15,%rax,8),%r9
  xor    %eax,%eax
  nopl   0x0(%rax,%rax,1)
L57:
  mov    (%r9,%rax,4),%esi
  lea    (%r12,%rax,1),%rcx
  mov    %eax,%r8d
  movzbl (%rcx),%edi
  test   %esi,%esi
  je     L143
  test   %dil,%dil
  jne    L192
  mov    (%rdx),%edi
  cmp    %edi,%esi
  jge    L208
  mov    %esi,(%rdx)
  mov    0x10(%rsp),%rsi
  mov    %r11d,(%rsi,%rdx,1)
  nopl   0x0(%rax,%rax,1)
L143:
  cmpb   $0x0,(%rcx)
  jne    L192
  mov    (%rdx),%edi
L208:
  cmp    %edi,%r13d
  jle    L192
  mov    %r8d,%ebx
  mov    %edi,%r13d
L192:
  add    $0x1,%rax
  add    $0x4,%rdx
  cmp    %rax,%r10
  jne    L57
L167:
  mov    (%rsp),%rsi
  movslq %ebx,%rax
  movb   $0x1,(%r12,%rax,1)
  movslq (%rsi,%rax,4),%rdx
  mov    0x8(%rsp),%rsi
  mov    (%r15,%rdx,8),%rcx
  mov    (%rsi,%rdx,8),%rdx
  mov    (%rcx,%rax,4),%ecx
  mov    %ecx,(%rdx,%rax,4)
  sub    $0x1,%r14d
  je     L218
  mov    %ebx,%r11d
  jmp    L179
L218:
  test   %ebp,%ebp
  jle    L108
  mov    0x8(%rsp),%r13
  xor    %r15d,%r15d
  movslq %ebp,%r14
  lea    D2(%rip),%r12
  cs nopw 0x0(%rax,%rax,1)
L171:
  xor    %ebx,%ebx
  jmp    L170
  nopl   0x0(%rax)
L28:
  add    $0x1,%rbx
  cmp    %r14,%rbx
  je     L71
L170:
  mov    0x0(%r13),%rax
  mov    %ebx,%edx
  mov    (%rax,%rbx,4),%ecx
  test   %ecx,%ecx
  je     L28
  mov    %r15d,%esi
  mov    %r12,%rdi
  add    $0x1,%rbx
  call   <printf@plt>
  cmp    %r14,%rbx
  jne    L170
L71:
  add    $0x1,%r15d
  add    $0x8,%r13
  cmp    %r15d,%ebp
  jne    L171
L108:
  add    $0x38,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L237:
  mov    $0x1,%esi
  mov    %ebp,%edi
  call   <calloc@plt>
  mov    %r14d,%edi
  mov    %rax,%r12
  call   <malloc@plt>
  movl   $0x0,(%rax)
  mov    %rax,%r14
  jmp    L37
L45:
  mov    $0x1,%eax
  jmp    L14
```

tool_calls: name: parse_data
arguments: data_tag: D13
data_type: byte[16]
name: parse_data
arguments: data_tag: D2
data_type: string

tool: {"D13": [0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0x7f]}

tool: D2: 
Muchia %d - %d, cost: %d

assistant: ```c
int **prims(int **ingraph, int n) {
  int i, j, lastNode = 0, min = (1 << 31) - 1, nextNode, nodesLeft;
  nodesLeft = n - 1;
  int *parent = (int *)malloc(sizeof(int) * n);
  int **outree = (int **)malloc(sizeof(int *) * n);
  for (i = 0; i < n; i++) {
    outree[i] = (int *)malloc(sizeof(int) * n);
  }
  for (i = 0; i < n; i++)
    for (j = 0; j < n; j++) {
      outree[i][j] = 0;
    }
  char *visit = (char *)calloc(n, sizeof(char));
  int *key = (int *)malloc(sizeof(int) * n);
  key[0] = 0;
  for (i = 1; i < n; i++)
    key[i] = (1 << 31) - 1;
  visit[0] = 1;
  while (nodesLeft > 0) {
    min = (1 << 31) - 1;
    for (i = 0; i < n; i++) {
      if (ingraph[lastNode][i] && !visit[i] && ingraph[lastNode][i] < key[i]) {
        key[i] = ingraph[lastNode][i];
        parent[i] = lastNode;
      }
      if (!visit[i] && key[i] < min) {
        min = key[i];
        nextNode = i;
      }
    }
    visit[nextNode] = 1;
    outree[parent[nextNode]][nextNode] = ingraph[parent[nextNode]][nextNode];
    lastNode = nextNode;
    nodesLeft--;
  }
  for (i = 0; i < n; i++)
    for (j = 0; j < n; j++)
      if (outree[i][j] != 0)
        printf("\nMuchia %d - %d, cost: %d", i, j, outree[i][j]);
  return 0;
}
```