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

```asm
<_glp_bigdiv>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %edi,%r12d
  mov    %esi,%ebx
  mov    %rdx,%r13
  mov    %rcx,%rbp
  test   %edi,%edi
  js     L40
L55:
  test   %ebx,%ebx
  jle    L375
  movslq %ebx,%rax
  lea    (%rax,%rax,1),%r15
  lea    -0x2(%rbp,%r15,1),%r14
  cmpw   $0x0,(%r14)
  je     L396
L150:
  cmp    $0x1,%ebx
  je     L154
L75:
  movzwl (%r14),%ecx
  add    $0x1,%ecx
  mov    $0x10000,%eax
  mov    $0x0,%edx
  div    %ecx
  mov    %eax,(%rsp)
  cmp    $0x1,%ax
  je     L337
  lea    (%r12,%rbx,1),%r8d
  mov    $0x0,%eax
  test   %r8d,%r8d
  jle    L125
  mov    %r13,%rcx
  lea    -0x1(%r8),%eax
  lea    0x2(%r13,%rax,2),%rdi
  mov    $0x0,%eax
  movzwl (%rsp),%esi
L105:
  movzwl (%rcx),%edx
  imul   %esi,%edx
  add    %edx,%eax
  mov    %ax,(%rcx)
  shr    $0x10,%eax
  add    $0x2,%rcx
  cmp    %rdi,%rcx
  jne    L105
L125:
  movslq %r8d,%r8
  mov    %ax,0x0(%r13,%r8,2)
  test   %ebx,%ebx
  jle    L331
  mov    %rbp,%rcx
  lea    -0x1(%rbx),%eax
  lea    0x2(%rbp,%rax,2),%rdi
  mov    $0x0,%eax
  movzwl (%rsp),%esi
L218:
  movzwl (%rcx),%edx
  imul   %esi,%edx
  add    %edx,%eax
  mov    %ax,(%rcx)
  shr    $0x10,%eax
  add    $0x2,%rcx
  cmp    %rdi,%rcx
  jne    L218
L331:
  test   %r12d,%r12d
  js     L160
L176:
  movslq %r12d,%rax
  movslq %ebx,%rdx
  add    %rax,%rdx
  lea    0x0(%r13,%rdx,2),%rdi
  lea    0x0(%r13,%rax,2),%rsi
  mov    %ebx,%r9d
  mov    %ebx,0x4(%rsp)
  mov    %r13,0x8(%rsp)
  jmp    L63
L40:
  mov    $0x87,%edx
  lea    D37(%rip),%rsi
  lea    D1(%rip),%rdi
  call   <glp_assert_@plt>
  jmp    L55
L375:
  mov    $0x88,%edx
  lea    D37(%rip),%rsi
  lea    D44(%rip),%rdi
  call   <glp_assert_@plt>
  movslq %ebx,%rax
  lea    (%rax,%rax,1),%r15
  lea    -0x2(%rbp,%r15,1),%r14
  cmpw   $0x0,(%r14)
  jne    L75
L396:
  mov    $0x89,%edx
  lea    D37(%rip),%rsi
  lea    D26(%rip),%rdi
  call   <glp_assert_@plt>
  jmp    L150
L154:
  test   %r12d,%r12d
  js     L345
  movslq %r12d,%rax
  add    %rax,%rax
  lea    0x0(%r13,%rax,1),%rsi
  lea    -0x2(%r13,%rax,1),%r8
  mov    %r12d,%r12d
  add    %r12,%r12
  sub    %r12,%r8
  mov    $0x0,%edx
L250:
  shl    $0x10,%edx
  movzwl (%rsi),%ecx
  add    %edx,%ecx
  movzwl 0x0(%rbp),%edi
  mov    %ecx,%eax
  mov    $0x0,%edx
  div    %edi
  mov    %ax,0x2(%rsi)
  movzwl 0x0(%rbp),%edi
  mov    %ecx,%eax
  mov    $0x0,%edx
  div    %edi
  sub    $0x2,%rsi
  cmp    %rsi,%r8
  jne    L250
L269:
  mov    %dx,0x0(%r13)
L18:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L345:
  mov    $0x0,%edx
  jmp    L269
L337:
  lea    (%r12,%rbx,1),%eax
  cltq
  movw   $0x0,0x0(%r13,%rax,2)
  test   %r12d,%r12d
  jns    L176
  jmp    L18
L81:
  movzwl -0x2(%rdi),%edx
  movzwl %cx,%eax
  movzwl %dx,%r8d
  add    %r8d,%eax
  cmp    $0xffff,%eax
  ja     L184
  add    %ecx,%edx
  mov    $0xffffffff,%r8d
L10:
  movzwl -0x4(%rbp,%r15,1),%r10d
  movzwl %cx,%r11d
L159:
  movzwl %r8w,%eax
  imul   %r10d,%eax
  mov    %eax,%r13d
  shr    $0x10,%r13d
  cmp    %dx,%r13w
  ja     L195
  jb     L89
  cmp    %ax,-0x4(%rbx)
  jb     L195
L89:
  test   %r8w,%r8w
  jne    L263
L247:
  mov    %r8w,(%rbx)
  sub    $0x2,%rdi
  sub    $0x2,%rsi
  sub    $0x1,%r12d
  js     L152
L63:
  mov    %rdi,%rbx
  movzwl (%rdi),%r10d
  movzwl (%r14),%ecx
  cmp    %cx,%r10w
  jae    L81
  shl    $0x10,%r10d
  movzwl -0x2(%rdi),%eax
  add    %eax,%r10d
  movzwl %cx,%r11d
  mov    %r10d,%eax
  mov    $0x0,%edx
  div    %r11d
  mov    %eax,%r8d
  test   %ax,%ax
  je     L247
  mov    %r10d,%eax
  mov    $0x0,%edx
  div    %r11d
  jmp    L10
L195:
  sub    $0x1,%r8d
  movzwl %dx,%eax
  add    %r11d,%eax
  add    %ecx,%edx
  cmp    $0xffff,%eax
  ja     L89
  jmp    L159
L184:
  mov    $0xffffffff,%r8d
L263:
  cmpl   $0x0,0x4(%rsp)
  jle    L247
  mov    $0x0,%edx
  mov    $0x0,%eax
  movzwl %r8w,%r13d
L383:
  movzwl 0x0(%rbp,%rdx,2),%ecx
  imul   %r13d,%ecx
  add    %ecx,%eax
  mov    %rsi,%r11
  movzwl (%rsi,%rdx,2),%ecx
  lea    0x10000(%rax),%r10d
  cmp    %ax,%cx
  cmovb  %r10d,%eax
  sub    %eax,%ecx
  mov    %cx,(%rsi,%rdx,2)
  shr    $0x10,%eax
  add    $0x1,%rdx
  cmp    %r9,%rdx
  jne    L383
  cmp    %ax,(%rbx)
  jae    L247
  sub    $0x1,%r8d
  mov    $0x0,%ecx
  mov    $0x0,%eax
L232:
  movzwl (%r11,%rcx,2),%edx
  movzwl 0x0(%rbp,%rcx,2),%r10d
  add    %r10d,%edx
  add    %edx,%eax
  mov    %ax,(%r11,%rcx,2)
  shr    $0x10,%eax
  add    $0x1,%rcx
  cmp    %r9,%rcx
  jne    L232
  jmp    L247
L152:
  mov    0x4(%rsp),%ebx
  mov    0x8(%rsp),%r13
L160:
  mov    (%rsp),%eax
  cmp    $0x1,%ax
  jbe    L18
  sub    $0x1,%ebx
  js     L18
  movslq %ebx,%rbx
  mov    %rbx,%rsi
  mov    $0x0,%edx
  movzwl %ax,%ecx
L109:
  shl    $0x10,%edx
  movzwl 0x0(%r13,%rsi,2),%eax
  add    %edx,%eax
  mov    $0x0,%edx
  div    %ecx
  mov    %ax,0x0(%r13,%rsi,2)
  sub    $0x1,%rsi
  test   %esi,%esi
  jns    L109
  mov    $0x0,%edx
L141:
  shl    $0x10,%edx
  movzwl 0x0(%rbp,%rbx,2),%eax
  add    %edx,%eax
  mov    $0x0,%edx
  div    %ecx
  mov    %ax,0x0(%rbp,%rbx,2)
  sub    $0x1,%rbx
  test   %ebx,%ebx
  jns    L141
  jmp    L18
```

tool_calls: name: unpack_data
arguments: data_label: D37
datatype: string
name: unpack_data
arguments: data_label: D1
datatype: string
name: unpack_data
arguments: data_label: D44
datatype: string
name: unpack_data
arguments: data_label: D26
datatype: string

tool: D37: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/MarhesLab/NeeleyThesisCode/refs/heads/master/lib/glpk-4.52/src/misc/bignum.c

tool: D1: n >= 0

tool: D44: m >= 1

tool: D26: y[m-1] != 0

assistant: ```c
void _glp_bigdiv(int n, int m, unsigned short x[], unsigned short y[]) {
  int i, j;
  unsigned int t;
  unsigned short d, q, r;
  ((void)((n >= 0) || (glp_assert_("n >= 0", "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/MarhesLab/NeeleyThesisCode/refs/heads/master/lib/glpk-4.52/src/misc/bignum.c", 135), 1)));
  ((void)((m >= 1) || (glp_assert_("m >= 1", "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/MarhesLab/NeeleyThesisCode/refs/heads/master/lib/glpk-4.52/src/misc/bignum.c", 136), 1)));
  ((void)((y[m - 1] != 0) || (glp_assert_("y[m-1] != 0", "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/MarhesLab/NeeleyThesisCode/refs/heads/master/lib/glpk-4.52/src/misc/bignum.c", 137), 1)));
  if (m == 1) {
    d = 0;
    for (i = n; i >= 0; i--) {
      t = ((unsigned int)d << 16) + (unsigned int)x[i];
      x[i + 1] = (unsigned short)(t / y[0]);
      d = (unsigned short)(t % y[0]);
    }
    x[0] = d;
    goto done;
  }
  d = (unsigned short)(0x10000 / ((unsigned int)y[m - 1] + 1));
  if (d == 1)
    x[n + m] = 0;
  else {
    t = 0;
    for (i = 0; i < n + m; i++) {
      t += (unsigned int)x[i] * (unsigned int)d;
      x[i] = (unsigned short)t;
      t >>= 16;
    }
    x[n + m] = (unsigned short)t;
    t = 0;
    for (j = 0; j < m; j++) {
      t += (unsigned int)y[j] * (unsigned int)d;
      y[j] = (unsigned short)t;
      t >>= 16;
    }
  }
  for (i = n; i >= 0; i--) {
    if (x[i + m] < y[m - 1]) {
      t = ((unsigned int)x[i + m] << 16) + (unsigned int)x[i + m - 1];
      q = (unsigned short)(t / (unsigned int)y[m - 1]);
      r = (unsigned short)(t % (unsigned int)y[m - 1]);
      if (q == 0)
        goto putq;
      else
        goto test;
    }
    q = 0;
    r = x[i + m - 1];
  decr:
    q--;
    t = (unsigned int)r + (unsigned int)y[m - 1];
    r = (unsigned short)t;
    if (t > 0xFFFF)
      goto msub;
  test:
    t = (unsigned int)y[m - 2] * (unsigned int)q;
    if ((unsigned short)(t >> 16) > r)
      goto decr;
    if ((unsigned short)(t >> 16) < r)
      goto msub;
    if ((unsigned short)t > x[i + m - 2])
      goto decr;
  msub:
    if (q == 0)
      goto putq;
    t = 0;
    for (j = 0; j < m; j++) {
      t += (unsigned int)y[j] * (unsigned int)q;
      if (x[i + j] < (unsigned short)t)
        t += 0x10000;
      x[i + j] -= (unsigned short)t;
      t >>= 16;
    }
    if (x[i + m] >= (unsigned short)t)
      goto putq;
    q--;
    t = 0;
    for (j = 0; j < m; j++) {
      t += (unsigned int)x[i + j] + (unsigned int)y[j];
      x[i + j] = (unsigned short)t;
      t >>= 16;
    }
  putq:
    x[i + m] = q;
  }
  if (d > 1) {
    t = 0;
    for (i = m - 1; i >= 0; i--) {
      t = (t << 16) + (unsigned int)x[i];
      x[i] = (unsigned short)(t / (unsigned int)d);
      t %= (unsigned int)d;
    }
    t = 0;
    for (j = m - 1; j >= 0; j--) {
      t = (t << 16) + (unsigned int)y[j];
      y[j] = (unsigned short)(t / (unsigned int)d);
      t %= (unsigned int)d;
    }
  }
done:
  return;
}
```