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

```asm
<dio>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  lea    -0x7a000(%rsp),%r11
L165:
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  cmp    %r11,%rsp
  jne    L165
  sub    $0x988,%rsp
  mov    %rdi,0x10(%rsp)
  mov    %esi,0x4(%rsp)
  mov    %edx,0x18(%rsp)
  mov    %r8,0x68(%rsp)
  mov    %r9,0x58(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x7a978(%rsp)
  xor    %eax,%eax
  test   %esi,%esi
  je     L214
  test   %edx,%edx
  je     L214
  mov    %esi,%eax
  mov    %rcx,%r12
  add    %edx,%eax
  mov    %eax,0x40(%rsp)
  test   %esi,%esi
  jle    L108
  cmp    %eax,%esi
  jge    L27
  mov    0x10(%rsp),%rdi
  movslq %esi,%rcx
  lea    0x3d8e0(%rsp),%r13
  mov    %r12,0x48(%rsp)
  mov    %rcx,%rax
  lea    0x0(,%rcx,4),%rsi
  mov    %r13,0x8(%rsp)
  lea    0x850(%rsp),%r15
  lea    0x4(%rdi),%rdx
  sub    $0x1,%eax
  mov    %rdi,%rbx
  add    %rsi,%rdi
  mov    %eax,0x44(%rsp)
  lea    (%rdx,%rax,4),%rax
  mov    %rax,0x38(%rsp)
  mov    0x18(%rsp),%eax
  mov    %rsi,0x28(%rsp)
  sub    $0x1,%eax
  mov    %rdi,0x30(%rsp)
  add    %rcx,%rax
  lea    (%rdx,%rax,4),%rax
  mov    %rax,0x20(%rsp)
  nopw   0x0(%rax,%rax,1)
L462:
  mov    0x28(%rsp),%r12
  mov    0x30(%rsp),%r14
  nopw   0x0(%rax,%rax,1)
L129:
  mov    (%r14),%ebp
  mov    (%rbx),%r13d
  add    $0x4,%r14
  mov    %ebp,%esi
  mov    %r13d,%edi
  call   <lcm@plt>
  mov    0x8(%rsp),%rsi
  cltd
  mov    %eax,%ecx
  idiv   %r13d
  mov    %eax,(%r15,%r12,1)
  mov    %ecx,%eax
  cltd
  idiv   %ebp
  mov    %eax,(%rsi,%r12,1)
  add    $0x4,%r12
  cmp    0x20(%rsp),%r14
  jne    L129
  addq   $0x3e8,0x28(%rsp)
  add    $0x4,%rbx
  cmp    0x38(%rsp),%rbx
  jne    L462
  mov    0x48(%rsp),%r12
  mov    %rsi,%r13
L302:
  cmpl   $0x2,0x44(%rsp)
  jbe    L68
  mov    0x4(%rsp),%edx
  mov    0x10(%rsp),%rcx
  pxor   %xmm2,%xmm2
  shr    $0x2,%edx
  mov    %rcx,%rax
  sub    $0x1,%edx
  shl    $0x4,%rdx
  lea    0x10(%rcx,%rdx,1),%rdx
  nopl   (%rax)
L359:
  movdqu (%rax),%xmm0
  add    $0x10,%rax
  movdqa %xmm0,%xmm1
  pcmpgtd %xmm2,%xmm1
  pand   %xmm1,%xmm0
  pandn  %xmm2,%xmm1
  movdqa %xmm1,%xmm2
  por    %xmm0,%xmm2
  cmp    %rdx,%rax
  jne    L359
  movdqa %xmm2,%xmm1
  mov    0x4(%rsp),%ecx
  psrldq $0x8,%xmm1
  movdqa %xmm1,%xmm0
  mov    %ecx,%eax
  pcmpgtd %xmm2,%xmm0
  and    $0xfffffffc,%eax
  and    $0x3,%ecx
  pand   %xmm0,%xmm1
  pandn  %xmm2,%xmm0
  por    %xmm1,%xmm0
  movdqa %xmm0,%xmm2
  psrldq $0x4,%xmm2
  movdqa %xmm2,%xmm1
  pcmpgtd %xmm0,%xmm1
  pand   %xmm1,%xmm2
  pandn  %xmm0,%xmm1
  por    %xmm2,%xmm1
  movd   %xmm1,0x60(%rsp)
  je     L160
L14:
  mov    0x10(%rsp),%rsi
  movslq %eax,%rdx
  mov    0x60(%rsp),%ebx
  lea    0x0(,%rdx,4),%rcx
  mov    (%rsi,%rdx,4),%edx
  cmp    %edx,%ebx
  mov    %edx,%edi
  lea    0x1(%rax),%edx
  cmovge %ebx,%edi
  mov    0x4(%rsp),%ebx
  mov    %edi,0x60(%rsp)
  cmp    %edx,%ebx
  jle    L160
  mov    0x4(%rsi,%rcx,1),%edx
  cmp    %edx,%edi
  cmovge %edi,%edx
  add    $0x2,%eax
  mov    %edx,0x60(%rsp)
  cmp    %ebx,%eax
  jge    L160
  mov    0x8(%rsi,%rcx,1),%eax
  cmp    %eax,%edx
  cmovge %edx,%eax
  mov    %eax,0x60(%rsp)
L160:
  mov    0x4(%rsp),%edi
  mov    0x40(%rsp),%eax
  cmp    %eax,%edi
  jge    L9
  mov    0x18(%rsp),%ecx
  lea    -0x1(%rcx),%eax
  cmp    $0x2,%eax
  jbe    L100
  movslq %edi,%rax
  mov    0x10(%rsp),%rdi
  pxor   %xmm2,%xmm2
  lea    (%rdi,%rax,4),%rdx
  mov    %ecx,%eax
  shr    $0x2,%eax
  lea    -0x1(%rax),%ecx
  lea    0x10(%rdx),%rax
  shl    $0x4,%rcx
  add    %rax,%rcx
  jmp    L104
  cs nopw 0x0(%rax,%rax,1)
L388:
  add    $0x10,%rax
L104:
  movdqu (%rdx),%xmm0
  mov    %rax,%rdx
  movdqa %xmm0,%xmm1
  pcmpgtd %xmm2,%xmm1
  pand   %xmm1,%xmm0
  pandn  %xmm2,%xmm1
  movdqa %xmm1,%xmm2
  por    %xmm0,%xmm2
  cmp    %rcx,%rax
  jne    L388
  movdqa %xmm2,%xmm1
  mov    0x18(%rsp),%edi
  mov    0x4(%rsp),%eax
  psrldq $0x8,%xmm1
  movdqa %xmm1,%xmm0
  mov    %edi,%edx
  pcmpgtd %xmm2,%xmm0
  and    $0xfffffffc,%edx
  add    %edx,%eax
  pand   %xmm0,%xmm1
  pandn  %xmm2,%xmm0
  por    %xmm1,%xmm0
  movdqa %xmm0,%xmm2
  psrldq $0x4,%xmm2
  movdqa %xmm2,%xmm1
  pcmpgtd %xmm0,%xmm1
  pand   %xmm1,%xmm2
  pandn  %xmm0,%xmm1
  por    %xmm2,%xmm1
  movd   %xmm1,0x64(%rsp)
  cmp    %edx,%edi
  je     L140
L20:
  mov    0x10(%rsp),%rdi
  movslq %eax,%rdx
  mov    0x64(%rsp),%ebx
  lea    0x0(,%rdx,4),%rcx
  mov    (%rdi,%rdx,4),%edx
  cmp    %edx,%ebx
  mov    %edx,%esi
  lea    0x1(%rax),%edx
  cmovge %ebx,%esi
  mov    0x40(%rsp),%ebx
  mov    %esi,0x64(%rsp)
  cmp    %ebx,%edx
  jge    L140
  mov    0x4(%rdi,%rcx,1),%edx
  cmp    %edx,%esi
  cmovge %esi,%edx
  add    $0x2,%eax
  mov    %edx,0x64(%rsp)
  cmp    %ebx,%eax
  jge    L140
  mov    0x8(%rdi,%rcx,1),%eax
  cmp    %eax,%edx
  cmovge %edx,%eax
  mov    %eax,0x64(%rsp)
L140:
  mov    0x40(%rsp),%esi
  test   %esi,%esi
  jle    L26
  movslq 0x40(%rsp),%rdx
  lea    0x70(%rsp),%rbx
  xor    %esi,%esi
  mov    %rbx,%rdi
  shl    $0x2,%rdx
  call   <memset@plt>
L353:
  mov    0x58(%rsp),%rax
  mov    0x44(%rsp),%ebp
  mov    %r15,0x48(%rsp)
  movl   $0x0,0x30(%rsp)
  movl   $0x0,(%rax)
  lea    0x460(%rsp),%rax
  mov    %rax,0x28(%rsp)
  mov    0x40(%rsp),%eax
  mov    %r13,0x50(%rsp)
  mov    %rbx,%r13
  sub    $0x1,%eax
  mov    %eax,0x38(%rsp)
  nopl   0x0(%rax)
L295:
  mov    0x10(%rsp),%rdi
  movslq %ebp,%r14
  mov    0x30(%rsp),%ebx
  mov    %r13,%rsi
  addl   $0x1,0x70(%rsp,%r14,4)
  lea    (%rdi,%r14,4),%r15
  add    (%r15),%ebx
  mov    %ebx,0x30(%rsp)
  push   %r12
  push   %rbx
  mov    0x74(%rsp),%eax
  push   %rax
  mov    0x78(%rsp),%eax
  push   %rax
  push   %rbp
  mov    0x40(%rsp),%eax
  push   %rax
  mov    0x34(%rsp),%r9d
  mov    0x80(%rsp),%r8
  mov    0x78(%rsp),%rcx
  mov    0x58(%rsp),%rdx
  call   <a_in_bounds@plt>
  add    $0x30,%rsp
  test   %rax,%rax
  jne    L322
  mov    0x70(%rsp,%r14,4),%eax
  mov    (%r15),%edx
  movl   $0x0,0x70(%rsp,%r14,4)
  sub    $0x1,%ebp
  js     L430
  imul   %edx,%eax
  sub    %eax,0x30(%rsp)
  jmp    L295
  nopl   0x0(%rax,%rax,1)
L430:
  mov    0x40(%rsp),%eax
  mov    %r13,%rbx
  mov    0x48(%rsp),%r15
  mov    0x50(%rsp),%r13
  test   %eax,%eax
  jle    L316
  movslq 0x40(%rsp),%rdx
  xor    %esi,%esi
  mov    %rbx,%rdi
  shl    $0x2,%rdx
  call   <memset@plt>
L316:
  movslq 0x4(%rsp),%rax
  test   %eax,%eax
  jle    L300
  mov    %rax,0x20(%rsp)
  shl    $0x2,%rax
  mov    %rbx,%rbp
  mov    %rax,0x18(%rsp)
  mov    0x44(%rsp),%eax
  mov    %r15,0x8(%rsp)
  lea    0x74(%rsp,%rax,4),%rax
  mov    %r13,0x10(%rsp)
  mov    %rax,0x28(%rsp)
  mov    0x40(%rsp),%eax
  lea    -0x1(%rax),%r14d
  cs nopw 0x0(%rax,%rax,1)
L358:
  mov    0x18(%rsp),%r15
  mov    0x20(%rsp),%r13
  mov    0x40(%rsp),%esi
  cmp    %esi,0x4(%rsp)
  jge    L425
  mov    %rbx,%rax
  mov    %r15,%rbx
  mov    %rax,%r15
  jmp    L312
  nopl   0x0(%rax,%rax,1)
L74:
  movl   $0x0,0x0(%rbp)
  add    $0x4,%rbx
  movl   $0x0,(%r15,%r13,4)
  add    $0x1,%r13
  cmp    %r13d,0x40(%rsp)
  jle    L147
L312:
  mov    0x8(%rsp),%rax
  xor    %edx,%edx
  mov    %r14d,%ecx
  mov    %r15,%rsi
  mov    %r12,%rdi
  mov    (%rax,%rbx,1),%eax
  mov    %eax,0x0(%rbp)
  mov    0x10(%rsp),%rax
  mov    (%rax,%rbx,1),%eax
  mov    %eax,(%r15,%r13,4)
  call   <var_check_1@plt>
  test   %rax,%rax
  je     L74
  xor    %edx,%edx
  mov    %r14d,%ecx
  mov    %r15,%rsi
  mov    %r12,%rdi
  call   <var_check_2@plt>
  test   %rax,%rax
  je     L74
  mov    0x68(%rsp),%rcx
  mov    0x58(%rsp),%rdx
  mov    %r15,%rdi
  mov    0x40(%rsp),%esi
  call   <add_solution@plt>
  test   %rax,%rax
  jne    L74
L406:
  mov    $0xffffffff,%eax
L352:
  mov    0x7a978(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L159
  add    $0x7a988,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L147:
  mov    %r15,%rbx
L425:
  addq   $0x3e8,0x18(%rsp)
  add    $0x4,%rbp
  cmp    0x28(%rsp),%rbp
  jne    L358
L300:
  mov    $0x1,%eax
  jmp    L352
  nopw   0x0(%rax,%rax,1)
L322:
  mov    %r13,%rax
  mov    0x38(%rsp),%r14d
  mov    %r12,%r13
  xor    %r15d,%r15d
  mov    %ebx,%r8d
  mov    %rax,%r12
  nopl   0x0(%rax)
L127:
  mov    0x10(%rsp),%rax
  movslq %r14d,%rbp
  mov    %r14d,%ecx
  mov    %r13,%rdx
  addl   $0x1,0x70(%rsp,%rbp,4)
  mov    %r12,%rdi
  lea    (%rax,%rbp,4),%rbx
  mov    0x18(%rsp),%eax
  add    (%rbx),%r15d
  mov    %r15d,0x20(%rsp)
  mov    %r15d,%r9d
  push   %rax
  mov    0xc(%rsp),%eax
  push   %rax
  mov    0x38(%rsp),%rsi
  mov    %r8d,0x18(%rsp)
  call   <b_in_bounds@plt>
  pop    %rdx
  pop    %rcx
  test   %rax,%rax
  mov    0x8(%rsp),%r8d
  je     L85
  cmp    %r15d,%r8d
  je     L381
  mov    0x38(%rsp),%r14d
  jmp    L127
  xchg   %ax,%ax
L381:
  mov    0x68(%rsp),%rcx
  mov    0x58(%rsp),%rdx
  mov    %r12,%rdi
  mov    %r8d,0x8(%rsp)
  mov    0x40(%rsp),%esi
  call   <add_solution@plt>
  mov    0x8(%rsp),%r8d
  test   %rax,%rax
  je     L406
  nopl   0x0(%rax)
L85:
  mov    0x70(%rsp,%rbp,4),%eax
  mov    (%rbx),%edx
  sub    $0x1,%r14d
  movl   $0x0,0x70(%rsp,%rbp,4)
  cmp    %r14d,0x4(%rsp)
  jle    L225
  mov    %r12,%rax
  mov    0x44(%rsp),%ebp
  mov    %r13,%r12
  mov    %rax,%r13
  jmp    L295
  nopl   0x0(%rax,%rax,1)
L225:
  imul   %edx,%eax
  mov    0x20(%rsp),%r15d
  sub    %eax,%r15d
  jmp    L127
L214:
  mov    0x58(%rsp),%rax
  movl   $0x0,(%rax)
  mov    $0x1,%eax
  jmp    L352
L108:
  mov    %esi,%eax
  movl   $0x0,0x60(%rsp)
  lea    0x850(%rsp),%r15
  lea    0x3d8e0(%rsp),%r13
  sub    $0x1,%eax
  mov    %eax,0x44(%rsp)
  jmp    L160
L9:
  movl   $0x0,0x64(%rsp)
  jmp    L140
L26:
  lea    0x70(%rsp),%rbx
  jmp    L353
L27:
  mov    %esi,%eax
  lea    0x850(%rsp),%r15
  lea    0x3d8e0(%rsp),%r13
  sub    $0x1,%eax
  mov    %eax,0x44(%rsp)
  jmp    L302
L100:
  movl   $0x0,0x64(%rsp)
  mov    %edi,%eax
  jmp    L20
L68:
  movl   $0x0,0x60(%rsp)
  xor    %eax,%eax
  jmp    L14
L159:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int dio(int ab[250], int m, int n, int constraints[250], int basis[100][250], int *num_basis) {
  int xy[250], max_y[250];
  int d[250][250], e[250][250];
  int xypos, max_a, max_b, suma, sumb;
  int i, j, a, b, t, go_a, go_b, backup;
  if (m == 0 || n == 0) {
    *num_basis = 0;
    return 1;
  }
  max_a = 0;
  max_b = 0;
  for (i = 0; i < m; i++)
    for (j = m; j < m + n; j++) {
      a = ab[i];
      b = ab[j];
      t = lcm(a, b);
      d[i][j] = t / a;
      e[i][j] = t / b;
    }
  for (i = 0; i < m; i++)
    if (ab[i] > max_a)
      max_a = ab[i];
  for (i = m; i < m + n; i++)
    if (ab[i] > max_b)
      max_b = ab[i];
  for (i = 0; i < m + n; i++)
    xy[i] = 0;
  xypos = m - 1;
  go_a = 1;
  suma = 0;
  *num_basis = 0;
  while (go_a) {
    xy[xypos]++;
    suma = suma + ab[xypos];
    if (a_in_bounds(ab, xy, max_y, d, e, m, n, xypos, max_a, max_b, suma, constraints)) {
      sumb = 0;
      xypos = m + n - 1;
      go_b = 1;
      while (go_b) {
        xy[xypos]++;
        sumb = sumb + ab[xypos];
        if (b_in_bounds(xy, max_y, constraints, xypos, suma, sumb, m, n)) {
          if (suma == sumb) {
            if (add_solution(xy, m + n, num_basis, basis))
              backup = 1;
            else
              return -1;
          } else
            backup = 0;
        } else
          backup = 1;
        if (backup) {
          sumb = sumb - xy[xypos] * ab[xypos];
          xy[xypos] = 0;
          xypos--;
          if (xypos < m)
            go_b = 0;
        } else
          xypos = m + n - 1;
      }
      xypos = m - 1;
    } else {
      suma = suma - xy[xypos] * ab[xypos];
      xy[xypos] = 0;
      xypos--;
      if (xypos < 0)
        go_a = 0;
    }
  }
  for (i = 0; i < m + n; i++)
    xy[i] = 0;
  for (i = 0; i < m; i++)
    for (j = m; j < m + n; j++) {
      xy[i] = d[i][j];
      xy[j] = e[i][j];
      if (var_check_1(constraints, xy, 0, m + n - 1) && var_check_2(constraints, xy, 0, m + n - 1))
        if (!add_solution(xy, m + n, num_basis, basis))
          return -1;
      xy[i] = 0;
      xy[j] = 0;
    }
  return 1;
}
```