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

```asm
<main>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%r12
  lea    0x30(%rsp),%r13
  mov    %r12,%rbx
L56:
  mov    $0x3e800000,%edi
  call   <malloc@plt>
  mov    %rax,(%rbx)
  test   %rax,%rax
  je     L60
  add    $0x8,%rbx
  cmp    %rbx,%r13
  jne    L56
  lea    0xc(%rsp),%rbx
  mov    %rbx,%rdi
  call   <CPU_ZERO@plt>
  mov    %rbx,%rsi
  mov    $0x3,%edi
  call   <CPU_SET@plt>
  mov    $0x0,%eax
  call   <getpid@plt>
  mov    %eax,%edi
  mov    %rbx,%rdx
  mov    $0x4,%esi
  call   <sched_setaffinity@plt>
  test   %rax,%rax
  jne    L118
  mov    $0x0,%eax
  call   <getpid@plt>
  mov    %eax,%esi
  lea    D37(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    $0x0,%edi
  call   <time@plt>
  mov    %eax,%edi
  call   <srand@plt>
  mov    %r12,%rdx
  mov    $0x0,%ebx
L126:
  mov    (%rdx),%rcx
  mov    %ebx,%eax
  lea    0x7d000(%rbx),%esi
L97:
  mov    %eax,%edi
  add    $0x1,%eax
  mov    %edi,(%rcx)
  add    $0x800,%rcx
  cmp    %esi,%eax
  jne    L97
  add    $0x7d000,%ebx
  add    $0x8,%rdx
  cmp    $0x1f4000,%ebx
  jne    L126
  lea    D29(%rip),%rdi
  call   <puts@plt>
L113:
  mov    %r12,%rbp
  jmp    L39
L60:
  lea    D8(%rip),%rdi
  call   <perror@plt>
  jmp    L109
L118:
  lea    D3(%rip),%rdi
  call   <perror@plt>
L109:
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L79
  mov    $0xffffffff,%eax
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L49:
  cmp    $0x3e800000,%rdi
  je     L28
L123:
  mov    %rdi,%rax
  shr    $0x2,%rax
  cltq
  add    $0xa00000,%rdi
  mov    %rdi,%rcx
  shr    $0x2,%rcx
  cmp    %rcx,%rax
  jae    L49
  mov    0x0(%rbp),%rsi
L42:
  mov    %ebx,%edx
  add    $0x1,%ebx
  mov    %edx,(%rsi,%rax,4)
  add    $0x200,%rax
  cmp    %rax,%rcx
  ja     L42
  jmp    L49
L28:
  mov    $0x1,%edi
  call   <sleep@plt>
  add    $0x8,%rbp
  cmp    %r13,%rbp
  je     L113
L39:
  mov    $0x0,%edi
  jmp    L123
L79:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: label: D37
data_type: string
name: unpack_data
arguments: label: D29
data_type: string
name: unpack_data
arguments: label: D8
data_type: string
name: unpack_data
arguments: label: D3
data_type: string

tool: D37: mem_bomb: pid %d


tool: D29: memory saturated

tool: D8: malloc error


tool: D3: error

assistant: ```c
int main() {
  size_t size = 1000 * (1024 * 1024);
  int *buf[4];
  int n, count, part;
  int i, j, k;
  int start, end;
  for (i = 0; i < 4; i++) {
    buf[i] = malloc(size);
    if (buf[i] == NULL) {
      perror("malloc error\n");
      return -1;
    }
  }
  int cpuid = 3;
  cpu_set_t cpus;
  CPU_ZERO(&cpus);
  CPU_SET(cpuid, &cpus);
  if (sched_setaffinity(getpid(), sizeof(cpus), &cpus) != 0) {
    perror("error");
    return -1;
  }
  printf("mem_bomb: pid %d\n", getpid());
  count = 0;
  srand(time(NULL));
  n = 0;
  part = 0;
  for (i = 0; i < 4; i++) {
    start = 0;
    end = 1000;
    for (j = start * (1024 * 1024) / sizeof(int); j < end * (1024 * 1024) / sizeof(int); j += 512) {
      buf[i][j] = count++;
    }
  }
  printf("memory saturated\n");
  while (1) {
    for (i = 0; i < 4; i++) {
      int step = 10;
      start = end = 0;
      for (k = 0; k < 1000; k += step) {
        start = k;
        end = start + step;
        for (j = start * (1024 * 1024) / sizeof(int); j < end * (1024 * 1024) / sizeof(int); j += 512) {
          buf[i][j] = count++;
        }
      }
      sleep(1);
    }
  }
  return 0;
}
```