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

```asm
<dwt_encode_97>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%rbx
  mov    %esi,%r12d
  mov    %edx,%ebp
  test   %ecx,%ecx
  jne    L115
  test   %esi,%esi
  jg     L21
  cmp    $0x1,%edx
  jg     L21
L247:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L21:
  test   %r12d,%r12d
  jle    L774
  lea    -0x2(%rbp,%rbp,1),%eax
  cltq
  lea    (%rbx,%rax,4),%r15
  mov    $0x1,%r14d
  mov    $0x1,%r13d
  jmp    L298
L64:
  mov    (%rbx),%eax
  cmp    $0xffffffff,%edx
  jge    L713
  lea    (%rax,%rax,1),%edi
  mov    $0x32c1,%esi
  mov    $0x0,%eax
  call   <fix_mul@plt>
  mov    %eax,%edx
  movslq %r14d,%rax
  sub    %edx,(%rbx,%rax,4)
  jmp    L321
L740:
  lea    -0x1(%r14),%eax
  cltq
  mov    (%rbx,%rax,4),%eax
  jmp    L713
L432:
  lea    0x0(%r13,%r13,1),%edx
  movslq %edx,%rdx
  mov    (%rbx,%rdx,4),%edi
L106:
  add    %eax,%edi
  mov    $0x32c1,%esi
  mov    $0x0,%eax
  call   <fix_mul@plt>
  mov    %eax,%edx
  movslq %r14d,%rax
  sub    %edx,(%rbx,%rax,4)
  cmp    0xc(%rsp),%r12d
  jle    L774
L321:
  add    $0x1,%r13d
  add    $0x2,%r14d
L298:
  mov    %r13d,%edx
  sub    $0x1,%edx
  js     L64
  cmp    %edx,%ebp
  jg     L740
  mov    (%r15),%eax
L713:
  mov    %r13d,0xc(%rsp)
  cmp    %r13d,%ebp
  jg     L432
  mov    (%r15),%edi
  jmp    L106
L774:
  test   %ebp,%ebp
  jle    L305
  lea    -0x1(%r12,%r12,1),%eax
  cltq
  lea    (%rbx,%rax,4),%r15
  mov    $0x0,%r14d
  mov    $0x0,%r13d
  jmp    L884
L882:
  mov    0x4(%rbx),%edi
  jns    L440
  add    %edi,%edi
  mov    $0x1b2,%esi
  mov    $0x0,%eax
  call   <fix_mul@plt>
  mov    %eax,%edx
  movslq %r14d,%rax
  sub    %edx,(%rbx,%rax,4)
  jmp    L754
L232:
  lea    -0x1(%r14),%eax
  cltq
  mov    (%rbx,%rax,4),%edi
L440:
  cmp    %edx,%r12d
  jle    L874
  lea    0x1(%r14),%eax
  cltq
  mov    (%rbx,%rax,4),%eax
L283:
  add    %eax,%edi
  mov    $0x1b2,%esi
  mov    $0x0,%eax
  call   <fix_mul@plt>
  mov    %eax,%edx
  movslq %r14d,%rax
  sub    %edx,(%rbx,%rax,4)
  lea    0x1(%r13),%eax
  cmp    %eax,%ebp
  jle    L212
L754:
  add    $0x1,%r13d
  add    $0x2,%r14d
L884:
  mov    %r13d,%edx
  test   %r13d,%r13d
  jle    L882
  cmp    %r13d,%r12d
  jge    L232
  mov    (%r15),%edi
L874:
  mov    (%r15),%eax
  jmp    L283
L305:
  test   %r12d,%r12d
  jg     L323
L969:
  test   %ebp,%ebp
  jle    L938
L98:
  lea    -0x1(%r12,%r12,1),%eax
  cltq
  lea    (%rbx,%rax,4),%r15
  mov    $0x0,%r14d
  mov    $0x0,%r13d
  jmp    L543
L710:
  mov    (%rbx),%eax
  cmp    $0xffffffff,%edx
  jge    L909
  lea    (%rax,%rax,1),%edi
  mov    $0x1c41,%esi
  mov    $0x0,%eax
  call   <fix_mul@plt>
  mov    %eax,%edx
  movslq %r14d,%rax
  add    %edx,(%rbx,%rax,4)
  jmp    L295
L474:
  lea    -0x1(%r14),%eax
  cltq
  mov    (%rbx,%rax,4),%eax
  jmp    L909
L579:
  lea    0x0(%r13,%r13,1),%edx
  movslq %edx,%rdx
  mov    (%rbx,%rdx,4),%edi
L582:
  add    %eax,%edi
  mov    $0x1c41,%esi
  mov    $0x0,%eax
  call   <fix_mul@plt>
  mov    %eax,%edx
  movslq %r14d,%rax
  add    %edx,(%rbx,%rax,4)
  cmp    0xc(%rsp),%r12d
  jle    L969
L295:
  add    $0x1,%r13d
  add    $0x2,%r14d
L337:
  mov    %r13d,%edx
  sub    $0x1,%edx
  js     L710
  cmp    %edx,%ebp
  jg     L474
  mov    (%r15),%eax
L909:
  mov    %r13d,0xc(%rsp)
  cmp    %r13d,%ebp
  jg     L579
  mov    (%r15),%edi
  jmp    L582
L497:
  mov    0x4(%rbx),%edi
  jns    L589
  add    %edi,%edi
  mov    $0xe31,%esi
  mov    $0x0,%eax
  call   <fix_mul@plt>
  mov    %eax,%edx
  movslq %r14d,%rax
  add    %edx,(%rbx,%rax,4)
  jmp    L325
L784:
  lea    -0x1(%r14),%eax
  cltq
  mov    (%rbx,%rax,4),%edi
L589:
  cmp    %edx,%r12d
  jle    L37
  lea    0x1(%r14),%eax
  cltq
  mov    (%rbx,%rax,4),%eax
L403:
  add    %eax,%edi
  mov    $0xe31,%esi
  mov    $0x0,%eax
  call   <fix_mul@plt>
  mov    %eax,%edx
  movslq %r14d,%rax
  add    %edx,(%rbx,%rax,4)
  lea    0x1(%r13),%eax
  cmp    %eax,%ebp
  jle    L867
L325:
  add    $0x1,%r13d
  add    $0x2,%r14d
L543:
  mov    %r13d,%edx
  test   %r13d,%r13d
  jle    L497
  cmp    %r13d,%r12d
  jge    L784
  mov    (%r15),%edi
L37:
  mov    (%r15),%eax
  jmp    L403
L115:
  test   %edx,%edx
  jg     L95
  cmp    $0x1,%esi
  jle    L247
L95:
  test   %r12d,%r12d
  jle    L526
  lea    -0x1(%rbp,%rbp,1),%eax
  cltq
  lea    (%rbx,%rax,4),%r15
  mov    %r12d,%r14d
  mov    $0x0,%r13d
  jmp    L555
L584:
  mov    0x4(%rbx),%edx
L468:
  mov    0x4(%rbx),%edi
  jmp    L658
L914:
  lea    0x1(%r13,%r13,1),%edx
  movslq %edx,%rdx
  mov    (%rbx,%rdx,4),%edx
  jmp    L451
L130:
  lea    -0x1(%r13,%r13,1),%eax
  cltq
  mov    (%rbx,%rax,4),%edi
L658:
  add    %edx,%edi
  mov    $0x32c1,%esi
  mov    $0x0,%eax
  call   <fix_mul@plt>
  sub    %eax,(%rbx,%r13,8)
  add    $0x1,%r13
  cmp    %r14,%r13
  je     L919
L555:
  mov    %r13d,%eax
  test   %r13d,%r13d
  js     L584
  cmp    %r13d,%ebp
  jg     L914
  mov    (%r15),%edx
L451:
  test   %eax,%eax
  je     L468
  cmp    %eax,%ebp
  jge    L130
  mov    (%r15),%edi
  jmp    L658
L906:
  mov    (%rbx),%eax
  cmp    $0xffffffff,%edx
  jge    L494
  lea    (%rax,%rax,1),%edi
  mov    $0x1b2,%esi
  mov    $0x0,%eax
  call   <fix_mul@plt>
  mov    %eax,%edx
  movslq %r14d,%rax
  sub    %edx,(%rbx,%rax,4)
  jmp    L864
L248:
  lea    -0x1(%r14),%eax
  cltq
  mov    (%rbx,%rax,4),%eax
  jmp    L494
L401:
  lea    0x0(%r13,%r13,1),%edx
  movslq %edx,%rdx
  mov    (%rbx,%rdx,4),%edi
L507:
  add    %eax,%edi
  mov    $0x1b2,%esi
  mov    $0x0,%eax
  call   <fix_mul@plt>
  mov    %eax,%edx
  movslq %r14d,%rax
  sub    %edx,(%rbx,%rax,4)
  cmp    0xc(%rsp),%ebp
  jle    L513
L864:
  add    $0x1,%r13d
  add    $0x2,%r14d
L753:
  mov    %r13d,%edx
  sub    $0x1,%edx
  js     L906
  cmp    %edx,%r12d
  jg     L248
  mov    (%r15),%eax
L494:
  mov    %r13d,0xc(%rsp)
  cmp    %r13d,%r12d
  jg     L401
  mov    (%r15),%edi
  jmp    L507
L513:
  test   %r12d,%r12d
  jle    L117
L447:
  lea    -0x1(%rbp,%rbp,1),%eax
  cltq
  lea    (%rbx,%rax,4),%r15
  mov    %r12d,%r14d
  mov    $0x0,%r13d
  jmp    L418
L705:
  mov    0x4(%rbx),%edx
L46:
  mov    0x4(%rbx),%edi
  jmp    L456
L488:
  lea    0x1(%r13,%r13,1),%edx
  movslq %edx,%rdx
  mov    (%rbx,%rdx,4),%edx
  jmp    L802
L940:
  lea    -0x1(%r13,%r13,1),%eax
  cltq
  mov    (%rbx,%rax,4),%edi
L456:
  add    %edx,%edi
  mov    $0x1c41,%esi
  mov    $0x0,%eax
  call   <fix_mul@plt>
  add    %eax,(%rbx,%r13,8)
  add    $0x1,%r13
  cmp    %r14,%r13
  je     L117
L418:
  mov    %r13d,%eax
  test   %r13d,%r13d
  js     L705
  cmp    %r13d,%ebp
  jg     L488
  mov    (%r15),%edx
L802:
  test   %eax,%eax
  je     L46
  cmp    %eax,%ebp
  jge    L940
  mov    (%r15),%edi
  jmp    L456
L313:
  mov    (%rbx),%eax
  cmp    $0xffffffff,%edx
  jge    L585
  lea    (%rax,%rax,1),%edi
  mov    $0xe31,%esi
  mov    $0x0,%eax
  call   <fix_mul@plt>
  mov    %eax,%edx
  movslq %r14d,%rax
  add    %edx,(%rbx,%rax,4)
  jmp    L233
L726:
  lea    -0x1(%r14),%eax
  cltq
  mov    (%rbx,%rax,4),%eax
  jmp    L585
L90:
  lea    0x0(%r13,%r13,1),%edx
  movslq %edx,%rdx
  mov    (%rbx,%rdx,4),%edi
L280:
  add    %eax,%edi
  mov    $0xe31,%esi
  mov    $0x0,%eax
  call   <fix_mul@plt>
  mov    %eax,%edx
  movslq %r14d,%rax
  add    %edx,(%rbx,%rax,4)
  cmp    0xc(%rsp),%ebp
  jle    L629
L233:
  add    $0x1,%r13d
  add    $0x2,%r14d
L799:
  mov    %r13d,%edx
  sub    $0x1,%edx
  js     L313
  cmp    %edx,%r12d
  jg     L726
  mov    (%r15),%eax
L585:
  mov    %r13d,0xc(%rsp)
  cmp    %r13d,%r12d
  jg     L90
  mov    (%r15),%edi
  jmp    L280
L304:
  test   %r12d,%r12d
  jg     L768
  jmp    L247
L629:
  test   %r12d,%r12d
  jle    L554
L768:
  mov    $0x0,%r13d
L253:
  mov    (%rbx,%r13,8),%edi
  mov    $0x13ae,%esi
  mov    $0x0,%eax
  call   <fix_mul@plt>
  mov    %eax,(%rbx,%r13,8)
  add    $0x1,%r13
  cmp    %r13d,%r12d
  jg     L253
  test   %ebp,%ebp
  jle    L247
L554:
  mov    $0x0,%r12d
L530:
  mov    0x4(%rbx,%r12,8),%edi
  mov    $0x1a03,%esi
  mov    $0x0,%eax
  call   <fix_mul@plt>
  mov    %eax,0x4(%rbx,%r12,8)
  add    $0x1,%r12
  cmp    %r12d,%ebp
  jg     L530
  jmp    L247
L938:
  test   %r12d,%r12d
  jg     L659
  jmp    L247
L867:
  test   %r12d,%r12d
  jle    L109
L659:
  lea    0x4(%rbx),%r13
  lea    -0x1(%r12),%eax
  lea    0xc(%rbx,%rax,8),%r12
L516:
  mov    $0x13ae,%esi
  mov    0x0(%r13),%edi
  mov    $0x0,%eax
  call   <fix_mul@plt>
  mov    %eax,0x0(%r13)
  add    $0x8,%r13
  cmp    %r12,%r13
  jne    L516
  test   %ebp,%ebp
  jle    L247
L109:
  mov    %rbx,%r12
  lea    -0x1(%rbp),%eax
  lea    0x8(%rbx,%rax,8),%rbx
L677:
  mov    $0x1a03,%esi
  mov    (%r12),%edi
  mov    $0x0,%eax
  call   <fix_mul@plt>
  mov    %eax,(%r12)
  add    $0x8,%r12
  cmp    %rbx,%r12
  jne    L677
  jmp    L247
L212:
  test   %r12d,%r12d
  jle    L98
L323:
  lea    -0x2(%rbp,%rbp,1),%eax
  cltq
  lea    (%rbx,%rax,4),%r15
  mov    $0x1,%r14d
  mov    $0x1,%r13d
  jmp    L337
L526:
  test   %ebp,%ebp
  jg     L952
L117:
  test   %ebp,%ebp
  jle    L304
  lea    -0x2(%r12,%r12,1),%eax
  cltq
  lea    (%rbx,%rax,4),%r15
  mov    $0x1,%r14d
  mov    $0x1,%r13d
  jmp    L799
L919:
  test   %ebp,%ebp
  jle    L447
L952:
  lea    -0x2(%r12,%r12,1),%eax
  cltq
  lea    (%rbx,%rax,4),%r15
  mov    $0x1,%r14d
  mov    $0x1,%r13d
  jmp    L753
```

assistant: ```c
void dwt_encode_97(int *a, int dn, int sn, int cas) {
  int i;
  if (!cas) {
    if ((dn > 0) || (sn > 1)) {
      for (i = 0; i < dn; i++) {
        a[(1 + (i)*2)] -= fix_mul(((i) < 0 ? a[(0) * 2] : ((i) >= sn ? a[(sn - 1) * 2] : a[(i)*2])) + ((i + 1) < 0 ? a[(0) * 2] : ((i + 1) >= sn ? a[(sn - 1) * 2] : a[(i + 1) * 2])), 12993);
      }
      for (i = 0; i < sn; i++) {
        a[(i)*2] -= fix_mul(((i - 1) < 0 ? a[(1 + (0) * 2)] : ((i - 1) >= dn ? a[(1 + (dn - 1) * 2)] : a[(1 + (i - 1) * 2)])) + ((i) < 0 ? a[(1 + (0) * 2)] : ((i) >= dn ? a[(1 + (dn - 1) * 2)] : a[(1 + (i)*2)])), 434);
      }
      for (i = 0; i < dn; i++) {
        a[(1 + (i)*2)] += fix_mul(((i) < 0 ? a[(0) * 2] : ((i) >= sn ? a[(sn - 1) * 2] : a[(i)*2])) + ((i + 1) < 0 ? a[(0) * 2] : ((i + 1) >= sn ? a[(sn - 1) * 2] : a[(i + 1) * 2])), 7233);
      }
      for (i = 0; i < sn; i++) {
        a[(i)*2] += fix_mul(((i - 1) < 0 ? a[(1 + (0) * 2)] : ((i - 1) >= dn ? a[(1 + (dn - 1) * 2)] : a[(1 + (i - 1) * 2)])) + ((i) < 0 ? a[(1 + (0) * 2)] : ((i) >= dn ? a[(1 + (dn - 1) * 2)] : a[(1 + (i)*2)])), 3633);
      }
      for (i = 0; i < dn; i++) {
        a[(1 + (i)*2)] = fix_mul(a[(1 + (i)*2)], 5038);
      }
      for (i = 0; i < sn; i++) {
        a[(i)*2] = fix_mul(a[(i)*2], 6659);
      }
    }
  } else {
    if ((sn > 0) || (dn > 1)) {
      for (i = 0; i < dn; i++) {
        a[(i)*2] -= fix_mul(((i) < 0 ? a[(1 + (0) * 2)] : ((i) >= sn ? a[(1 + (sn - 1) * 2)] : a[(1 + (i)*2)])) + ((i - 1) < 0 ? a[(1 + (0) * 2)] : ((i - 1) >= sn ? a[(1 + (sn - 1) * 2)] : a[(1 + (i - 1) * 2)])), 12993);
      }
      for (i = 0; i < sn; i++) {
        a[(1 + (i)*2)] -= fix_mul(((i) < 0 ? a[(0) * 2] : ((i) >= dn ? a[(dn - 1) * 2] : a[(i)*2])) + ((i + 1) < 0 ? a[(0) * 2] : ((i + 1) >= dn ? a[(dn - 1) * 2] : a[(i + 1) * 2])), 434);
      }
      for (i = 0; i < dn; i++) {
        a[(i)*2] += fix_mul(((i) < 0 ? a[(1 + (0) * 2)] : ((i) >= sn ? a[(1 + (sn - 1) * 2)] : a[(1 + (i)*2)])) + ((i - 1) < 0 ? a[(1 + (0) * 2)] : ((i - 1) >= sn ? a[(1 + (sn - 1) * 2)] : a[(1 + (i - 1) * 2)])), 7233);
      }
      for (i = 0; i < sn; i++) {
        a[(1 + (i)*2)] += fix_mul(((i) < 0 ? a[(0) * 2] : ((i) >= dn ? a[(dn - 1) * 2] : a[(i)*2])) + ((i + 1) < 0 ? a[(0) * 2] : ((i + 1) >= dn ? a[(dn - 1) * 2] : a[(i + 1) * 2])), 3633);
      }
      for (i = 0; i < dn; i++) {
        a[(i)*2] = fix_mul(a[(i)*2], 5038);
      }
      for (i = 0; i < sn; i++) {
        a[(1 + (i)*2)] = fix_mul(a[(1 + (i)*2)], 6659);
      }
    }
  }
}
```