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),%rbp
  lea    0x30(%rsp),%r12
  mov    %rbp,%rbx
L9:
  mov    $0x3e800000,%edi
  call   <malloc@plt>
  mov    %rax,(%rbx)
  test   %rax,%rax
  je     L12
  add    $0x8,%rbx
  cmp    %r12,%rbx
  jne    L9
  lea    0xc(%rsp),%r13
  mov    %r13,%rdi
  call   <CPU_ZERO@plt>
  mov    %r13,%rsi
  mov    $0x3,%edi
  call   <CPU_SET@plt>
  xor    %eax,%eax
  call   <getpid@plt>
  mov    %r13,%rdx
  mov    $0x4,%esi
  mov    %eax,%edi
  call   <sched_setaffinity@plt>
  test   %rax,%rax
  jne    L66
  xor    %eax,%eax
  xor    %ebx,%ebx
  call   <getpid@plt>
  lea    D1(%rip),%rdi
  mov    %eax,%esi
  xor    %eax,%eax
  call   <printf@plt>
  xor    %edi,%edi
  call   <time@plt>
  mov    %eax,%edi
  call   <srand@plt>
  mov    %rbp,%rax
L88:
  mov    (%rax),%rdx
  lea    0x7d000(%rbx),%ecx
L93:
  mov    %ebx,%esi
  add    $0x1,%ebx
  add    $0x800,%rdx
  mov    %esi,-0x800(%rdx)
  cmp    %ecx,%ebx
  jne    L93
  add    $0x8,%rax
  cmp    $0x1f4000,%ebx
  jne    L88
  lea    D3(%rip),%rdi
  call   <puts@plt>
L52:
  mov    %rbp,%r13
L106:
  xor    %edi,%edi
  nopl   0x0(%rax)
L81:
  mov    %rdi,%rax
  add    $0xa00000,%rdi
  mov    %rdi,%rcx
  shr    $0x2,%rax
  shr    $0x2,%rcx
  cmp    %rcx,%rax
  jae    L33
  mov    0x0(%r13),%rsi
  xchg   %ax,%ax
L28:
  mov    %ebx,%edx
  add    $0x1,%ebx
  mov    %edx,(%rsi,%rax,4)
  add    $0x200,%rax
  cmp    %rcx,%rax
  jb     L28
L33:
  cmp    $0x3e800000,%rdi
  jne    L81
  mov    $0x1,%edi
  add    $0x8,%r13
  call   <sleep@plt>
  cmp    %r12,%r13
  jne    L106
  jmp    L52
L66:
  lea    D28(%rip),%rdi
  call   <perror@plt>
L0:
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L10
  add    $0x48,%rsp
  or     $0xffffffff,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L12:
  lea    D39(%rip),%rdi
  call   <perror@plt>
  jmp    L0
L10:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_tag: D1
datatype: string
name: parse_data
arguments: data_tag: D3
datatype: string
name: parse_data
arguments: data_tag: D28
datatype: string
name: parse_data
arguments: data_tag: D39
datatype: string

tool: D1: mem_bomb: pid %d


tool: D3: memory saturated

tool: D28: error

tool: D39: malloc 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;
}
```