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

```asm
<repeated_random>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %edi,%ebx
  sub    $0x4e8,%rsp
  mov    %edi,0xc(%rsp)
  mov    $0x190,%edi
  mov    %fs:0x28,%rax
  mov    %rax,0x4d8(%rsp)
  xor    %eax,%eax
  call   <malloc@plt>
  mov    %rax,0x18(%rsp)
  test   %ebx,%ebx
  jle    L153
  lea    0x340(%rsp),%rdi
  movl   $0xffffffff,0x4(%rsp)
  xor    %r14d,%r14d
  lea    0x20(%rsp),%r13
  mov    %rdi,0x10(%rsp)
  lea    0x1b0(%rsp),%rbp
  lea    0x190(%rax),%r12
L118:
  mov    %r13,%rbx
  mov    %r13,%r15
  nopw   0x0(%rax,%rax,1)
L98:
  xor    %eax,%eax
  add    $0x4,%r15
  call   <rand@plt>
  mov    %eax,-0x4(%r15)
  cmp    %rbp,%r15
  jne    L98
  mov    %r13,%r15
  nopw   0x0(%rax,%rax,1)
L109:
  xor    %eax,%eax
  call   <rand@plt>
  test   $0x1,%al
  jne    L45
  negl   (%r15)
L45:
  add    $0x4,%r15
  cmp    %rbp,%r15
  jne    L109
  xor    %esi,%esi
  xor    %r8d,%r8d
  jmp    L148
  xchg   %ax,%ax
L104:
  movslq %r8d,%rdx
  add    $0x4,%rbx
  add    $0x1,%r8d
  mov    %eax,0x1b0(%rsp,%rdx,4)
  cmp    %rbp,%rbx
  je     L136
L148:
  mov    (%rbx),%eax
  test   %eax,%eax
  jns    L104
  movslq %esi,%rdx
  add    $0x4,%rbx
  add    $0x1,%esi
  mov    %eax,0x340(%rsp,%rdx,4)
  cmp    %rbp,%rbx
  jne    L148
L136:
  mov    0x10(%rsp),%rdi
  mov    %r8d,0x8(%rsp)
  call   <sum_subset@plt>
  mov    0x8(%rsp),%esi
  mov    %rbp,%rdi
  mov    %eax,%ebx
  call   <sum_subset@plt>
  cmpl   $0xffffffff,0x4(%rsp)
  je     L163
  add    %eax,%ebx
  mov    %ebx,%esi
  neg    %esi
  cmovs  %ebx,%esi
  cmp    0x4(%rsp),%esi
  jl     L150
L126:
  add    $0x1,%r14d
  cmp    %r14d,0xc(%rsp)
  jne    L118
L16:
  mov    0x4(%rsp),%esi
  lea    D1(%rip),%rdi
  call   <printf@plt>
  mov    0x4d8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L156
  mov    0x18(%rsp),%rax
  add    $0x4e8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L150:
  mov    0x18(%rsp),%rdi
  mov    %r13,%rcx
  mov    %rdi,%rax
  sub    %rdi,%rcx
  nopl   (%rax)
L29:
  mov    (%rcx,%rax,1),%edx
  add    $0x4,%rax
  mov    %edx,-0x4(%rax)
  cmp    %r12,%rax
  jne    L29
  mov    %esi,0x4(%rsp)
  jmp    L126
L163:
  add    %ebx,%eax
  mov    0x18(%rsp),%rdi
  mov    %r13,%rcx
  mov    %eax,%r15d
  neg    %r15d
  cmovns %r15d,%eax
  sub    %rdi,%rcx
  mov    %eax,0x4(%rsp)
  mov    %rdi,%rax
  nopl   0x0(%rax,%rax,1)
L162:
  mov    (%rcx,%rax,1),%edx
  add    $0x4,%rax
  mov    %edx,-0x4(%rax)
  cmp    %rax,%r12
  jne    L162
  jmp    L126
L153:
  movl   $0xffffffff,0x4(%rsp)
  jmp    L16
L156:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: tag: D1
data_type: string

tool: D1: repeated random residue = %d


assistant: ```c
int *repeated_random(int loop_cnt) {
  int set_A[100];
  int pos_A[100];
  int neg_A[100];
  int size_pos;
  int size_neg;
  int sum_pos;
  int sum_neg;
  int residue;
  int sub_residue;
  int i, j;
  int *ret_int = (int *)malloc(sizeof(int) * 100);
  int k;
  residue = -1;
  for (i = 0; i < loop_cnt; i++) {
    for (j = 0; j < 100; j++)
      set_A[j] = rand();
    for (j = 0; j < 100; j++) {
      if ((rand() % 2) == 0)
        set_A[j] = set_A[j] * -1;
    }
    size_pos = size_neg = 0;
    for (j = 0; j < 100; j++) {
      if (set_A[j] < 0) {
        neg_A[size_neg] = set_A[j];
        size_neg++;
      } else {
        pos_A[size_pos] = set_A[j];
        size_pos++;
      }
    }
    sum_neg = sum_subset(neg_A, size_neg);
    sum_pos = sum_subset(pos_A, size_pos);
    if (residue == -1) {
      residue = abs(sum_neg + sum_pos);
      for (k = 0; k < 100; k++)
        ret_int[k] = set_A[k];
    } else {
      sub_residue = abs(sum_neg + sum_pos);
      if (sub_residue < residue) {
        residue = sub_residue;
        for (k = 0; k < 100; k++)
          ret_int[k] = set_A[k];
      }
    }
  }
  printf("repeated random residue = %d\n", residue);
  return ret_int;
}
```