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

```asm
<permut_allelesizes_among_2pop_alleles>:
  endbr64
  push   %r15
  mov    %rdx,%rax
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xfd8,%rsp
  mov    %edi,0xc(%rsp)
  mov    0x1010(%rsp),%r14
  mov    %r9,0x18(%rsp)
  mov    0x1018(%rsp),%r12
  mov    %fs:0x28,%rdx
  mov    %rdx,0xfc8(%rsp)
  xor    %edx,%edx
  test   %edi,%edi
  jle    L121
  movslq %ecx,%rcx
  movslq %r8d,%r8
  mov    %rsi,%rbx
  add    $0x8,%r14
  lea    (%rax,%rcx,8),%r13
  lea    (%rax,%r8,8),%r15
  pxor   %xmm0,%xmm0
  add    $0x4,%rbx
  lea    0x20(%rsp),%rax
  mov    $0x1,%ebp
  mov    %rax,0x10(%rsp)
  nopl   0x0(%rax,%rax,1)
L48:
  mov    (%rbx),%eax
  test   %eax,%eax
  jle    L32
  mov    0x18(%rsp),%rax
  mov    (%r14),%rsi
  lea    0x0(,%rbp,8),%r11
  mov    (%rax,%rbp,8),%rcx
  mov    $0x1,%eax
  nopl   0x0(%rax,%rax,1)
L175:
  mov    (%rcx,%rax,4),%edx
  mov    %edx,(%rsi,%rax,4)
  mov    (%rbx),%edx
  add    $0x1,%rax
  cmp    %eax,%edx
  jge    L175
  test   %edx,%edx
  jle    L32
  mov    0x0(%r13),%rax
  lea    0x1(%rdx),%edi
  xor    %edx,%edx
  shl    $0x2,%rdi
  mov    (%rax,%r11,1),%r10
  mov    $0x4,%eax
  cs nopw 0x0(%rax,%rax,1)
L147:
  ucomiss (%r10,%rax,1),%xmm0
  jp     L56
  jne    L56
  mov    (%r15),%rsi
  mov    (%rsi,%r11,1),%rsi
  ucomiss (%rsi,%rax,1),%xmm0
  jp     L56
  je     L57
L56:
  mov    (%rcx,%rax,1),%r8d
  add    $0x1,%edx
  movslq %edx,%rsi
  mov    %r8d,0x20(%rsp,%rsi,4)
L57:
  add    $0x4,%rax
  cmp    %rdi,%rax
  jne    L147
L72:
  mov    0x10(%rsp),%rdi
  mov    $0x1,%esi
  mov    %r12,%rcx
  call   <resample_shuffle@plt>
  mov    (%rbx),%esi
  pxor   %xmm0,%xmm0
  test   %esi,%esi
  jle    L178
  mov    0x0(%r13),%rax
  lea    0x0(,%rbp,8),%r10
  xor    %edx,%edx
  mov    (%rax,%rbp,8),%rdi
  mov    $0x1,%eax
  nopl   0x0(%rax,%rax,1)
L134:
  ucomiss (%rdi,%rax,4),%xmm0
  lea    0x0(,%rax,4),%rcx
  jp     L28
  jne    L28
  mov    (%r15),%r8
  mov    (%r8,%r10,1),%r8
  ucomiss (%r8,%rcx,1),%xmm0
  jp     L28
  je     L74
L28:
  add    $0x1,%edx
  movslq %edx,%rsi
  mov    0x20(%rsp,%rsi,4),%r8d
  mov    (%r14),%rsi
  mov    %r8d,(%rsi,%rcx,1)
  mov    (%rbx),%esi
L74:
  add    $0x1,%rax
  cmp    %eax,%esi
  jge    L134
L178:
  add    $0x1,%rbp
  add    $0x4,%rbx
  add    $0x8,%r14
  cmp    %ebp,0xc(%rsp)
  jge    L48
L121:
  mov    0xfc8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L16
  add    $0xfd8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nop
L32:
  xor    %edx,%edx
  jmp    L72
L16:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void permut_allelesizes_among_2pop_alleles(int m, int *Nallelel, float ***Ppla, int pop1, int pop2, int **allelesizela, int **allelesizelamix, long *seed) {
  int a, l, twopopa, size2popa[1000];
  for (l = 1; l <= m; l++) {
    for (a = 1; a <= Nallelel[l]; a++)
      allelesizelamix[l][a] = allelesizela[l][a];
    twopopa = 0;
    for (a = 1; a <= Nallelel[l]; a++)
      if (Ppla[pop1][l][a] || Ppla[pop2][l][a]) {
        twopopa++;
        size2popa[twopopa] = allelesizela[l][a];
      }
    resample_shuffle(size2popa, 1, twopopa, seed);
    twopopa = 0;
    for (a = 1; a <= Nallelel[l]; a++)
      if (Ppla[pop1][l][a] || Ppla[pop2][l][a]) {
        twopopa++;
        allelesizelamix[l][a] = size2popa[twopopa];
      }
  }
}
```