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

```asm
<security>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %esi,-0x28(%rbp)
  mov    %rdx,-0x30(%rbp)
  mov    %rcx,-0x38(%rbp)
  mov    %r8,-0x40(%rbp)
  movq   $0x0,-0x10(%rbp)
  movq   $0x0,-0x8(%rbp)
  movl   $0x0,-0x20(%rbp)
  movl   $0x0,-0x1c(%rbp)
  movl   $0x0,-0x18(%rbp)
  movl   $0x0,-0x14(%rbp)
  mov    -0x28(%rbp),%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  jne    L83
  lea    D45(%rip),%rax
  mov    %rax,%rdi
  call   <perror@plt>
  mov    $0x1,%edi
  call   <exit@plt>
L83:
  mov    -0x24(%rbp),%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L39
  lea    D45(%rip),%rax
  mov    %rax,%rdi
  call   <perror@plt>
  mov    $0x1,%edi
  call   <exit@plt>
L39:
  movl   $0x0,-0x20(%rbp)
  jmp    L136
L133:
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    -0x20(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x10(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  addl   $0x1,-0x20(%rbp)
L136:
  mov    -0x20(%rbp),%eax
  cmp    -0x28(%rbp),%eax
  jl     L133
  movl   $0x0,-0x20(%rbp)
  jmp    L125
L25:
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movl   $0x0,(%rax)
  addl   $0x1,-0x20(%rbp)
L125:
  mov    -0x20(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jl     L25
  lea    D24(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  movl   $0x0,-0x20(%rbp)
  jmp    L73
L139:
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  test   %eax,%eax
  jne    L41
  movl   $0x0,-0x1c(%rbp)
  jmp    L88
L61:
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x1c(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x1c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x10(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jg     L215
  addl   $0x1,-0x14(%rbp)
  addl   $0x1,-0x1c(%rbp)
L88:
  mov    -0x1c(%rbp),%eax
  cmp    -0x28(%rbp),%eax
  jl     L61
  jmp    L77
L215:
  nop
L77:
  mov    -0x14(%rbp),%eax
  cmp    -0x28(%rbp),%eax
  jne    L103
  movl   $0x0,-0x14(%rbp)
  mov    -0x20(%rbp),%eax
  mov    %eax,%esi
  lea    D9(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movl   $0x0,-0x18(%rbp)
  jmp    L143
L38:
  mov    -0x18(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%ecx
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x18(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x18(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rsi
  mov    -0x10(%rbp),%rax
  add    %rsi,%rax
  add    %ecx,%edx
  mov    %edx,(%rax)
  mov    -0x18(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,%esi
  lea    D4(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  addl   $0x1,-0x18(%rbp)
L143:
  mov    -0x18(%rbp),%eax
  cmp    -0x28(%rbp),%eax
  jl     L38
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movl   $0x1,(%rax)
  movl   $0xffffffff,-0x20(%rbp)
  jmp    L98
L41:
  nop
  jmp    L98
L103:
  nop
L98:
  addl   $0x1,-0x20(%rbp)
L73:
  mov    -0x20(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jl     L139
  movl   $0x0,-0x20(%rbp)
  jmp    L185
L219:
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    $0x1,%eax
  je     L21
  mov    $0x0,%eax
  jmp    L96
L21:
  addl   $0x1,-0x20(%rbp)
L185:
  mov    -0x20(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jl     L219
  mov    $0x1,%eax
L96:
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: tag: D45
type_guessed: string
name: extract_symbolic_data
arguments: tag: D24
type_guessed: string
name: extract_symbolic_data
arguments: tag: D9
type_guessed: string
name: extract_symbolic_data
arguments: tag: D4
type_guessed: string

tool: D45: malloc all error

tool: D24: sequence:

tool: D9: p%d: 

tool: D4: %d 

assistant: ```c
int security(int n, int m, int *available, int **need, int **allocation) {
  int *work = NULL;
  int *finish = NULL;
  int i = 0;
  int j = 0;
  int k = 0;
  int num = 0;
  if ((work = (int *)malloc(m * sizeof(int))) == NULL) {
    perror("malloc all error");
    exit(1);
  }
  if ((finish = (int *)malloc(n * sizeof(int))) == NULL) {
    perror("malloc all error");
    exit(1);
  }
  for (i = 0; i < m; i++) {
    work[i] = available[i];
  }
  for (i = 0; i < n; i++) {
    finish[i] = 0;
  }
  printf("sequence:\n");
  for (i = 0; i < n; i++) {
    if (finish[i] == 0) {
      for (j = 0; j < m; j++) {
        if (need[i][j] <= work[j]) {
          num++;
        } else {
          break;
        }
      }
      if (num == m) {
        num = 0;
        printf("p%d: ", i);
        for (k = 0; k < m; k++) {
          work[k] = work[k] + allocation[i][k];
          printf("%d ", work[k]);
        }
        printf("\n");
        finish[i] = 1;
        i = -1;
      } else {
        continue;
      }
    } else {
      continue;
    }
  }
  for (i = 0; i < n; i++) {
    if (finish[i] != 1) {
      return 0;
    }
  }
  return 1;
}
```