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

```asm
<dwt_decode_53>:
  endbr64
  mov    %rdi,%rax
  mov    %edx,%edi
  test   %ecx,%ecx
  jne    L356
  test   %esi,%esi
  jg     L151
  cmp    $0x1,%edx
  jg     L151
  ret
  nop
L356:
  test   %edx,%edx
  jne    L183
  cmp    $0x1,%esi
  jne    L183
  mov    (%rax),%ecx
  mov    %ecx,%edx
  shr    $0x1f,%edx
  add    %ecx,%edx
  sar    %edx
  mov    %edx,(%rax)
  ret
  nopw   0x0(%rax,%rax,1)
L183:
  test   %edi,%edi
  jle    L189
  lea    -0x2(%rsi,%rsi,1),%edx
  lea    0x4(%rax),%rcx
  movslq %edx,%rdx
  lea    (%rax,%rdx,4),%r11
  xor    %edx,%edx
  jmp    L249
  nopl   0x0(%rax,%rax,1)
L343:
  add    $0x1,%edx
  mov    (%r11),%r10d
  cmp    %esi,%edx
  jl     L101
L78:
  mov    (%r11),%r9d
L265:
  lea    0x2(%r10,%r9,1),%r9d
  add    $0x8,%rcx
  sar    $0x2,%r9d
  sub    %r9d,%r8d
  mov    %r8d,-0x8(%rcx)
  cmp    %edi,%edx
  je     L189
L249:
  mov    (%rcx),%r8d
  cmp    %edx,%esi
  jle    L343
  add    $0x1,%edx
  mov    -0x4(%rcx),%r10d
  cmp    %esi,%edx
  jge    L78
L101:
  lea    (%rdx,%rdx,1),%r9d
  movslq %r9d,%r9
  mov    (%rax,%r9,4),%r9d
  jmp    L265
  nopl   0x0(%rax,%rax,1)
L151:
  push   %rbp
  push   %rbx
  test   %edi,%edi
  jle    L253
  lea    -0x1(%rsi,%rsi,1),%edx
  movslq %edi,%rbx
  mov    $0x1,%r10d
  movslq %edx,%rdx
  lea    (%rax,%rdx,4),%rbp
  xor    %edx,%edx
  jmp    L173
  xchg   %ax,%ax
L255:
  cmp    %edx,%esi
  jge    L128
  mov    0x0(%rbp),%r9d
  mov    %r9d,%r11d
L64:
  lea    0x2(%r9,%r11,1),%r9d
  add    $0x2,%r10d
  sar    $0x2,%r9d
  sub    %r9d,%r8d
  mov    %r8d,(%rax,%rdx,8)
  add    $0x1,%rdx
  cmp    %rdx,%rbx
  je     L253
L173:
  mov    (%rax,%rdx,8),%r8d
  mov    %edx,%r9d
  test   %rdx,%rdx
  jne    L255
  mov    0x4(%rax),%r11d
  cmp    %r9d,%esi
  jle    L350
L239:
  mov    %r10d,%r9d
  mov    (%rax,%r9,4),%r9d
  jmp    L64
  cs nopw 0x0(%rax,%rax,1)
L128:
  mov    -0x4(%rax,%rdx,8),%r11d
  cmp    %r9d,%esi
  jg     L239
L350:
  mov    0x0(%rbp),%r9d
  jmp    L64
L253:
  test   %esi,%esi
  jle    L20
  lea    -0x2(%rdi,%rdi,1),%edx
  lea    0x4(%rax),%r8
  movslq %edx,%rdx
  lea    (%rax,%rdx,4),%r11
  jmp    L73
  nopl   (%rax)
L338:
  add    $0x1,%ecx
  mov    (%r11),%edx
  cmp    %edi,%ecx
  jl     L26
L45:
  mov    (%r11),%r10d
L174:
  add    %r10d,%edx
  add    $0x8,%r8
  sar    %edx
  add    %r9d,%edx
  mov    %edx,-0x8(%r8)
  cmp    %esi,%ecx
  je     L20
L73:
  mov    (%r8),%r9d
  cmp    %ecx,%edi
  jle    L338
  add    $0x1,%ecx
  mov    -0x4(%r8),%edx
  cmp    %edi,%ecx
  jge    L45
L26:
  lea    (%rcx,%rcx,1),%r10d
  movslq %r10d,%r10
  mov    (%rax,%r10,4),%r10d
  jmp    L174
  nopl   0x0(%rax,%rax,1)
L20:
  pop    %rbx
  pop    %rbp
  ret
  nopl   0x0(%rax,%rax,1)
L189:
  test   %esi,%esi
  jle    L238
  lea    -0x1(%rdi,%rdi,1),%edx
  movslq %esi,%rsi
  mov    $0x1,%r8d
  movslq %edx,%rdx
  lea    (%rax,%rdx,4),%r11
  xor    %edx,%edx
  jmp    L108
  nopl   0x0(%rax)
L35:
  mov    (%r11),%r9d
  test   %edx,%edx
  je     L28
  cmp    %edx,%edi
  jge    L56
  mov    %r9d,%ecx
L188:
  add    %r9d,%ecx
  add    $0x2,%r8d
  sar    %ecx
  add    %r10d,%ecx
  mov    %ecx,(%rax,%rdx,8)
  add    $0x1,%rdx
  cmp    %rdx,%rsi
  je     L346
L108:
  mov    (%rax,%rdx,8),%r10d
  cmp    %edx,%edi
  jle    L35
  mov    %r8d,%ecx
  mov    (%rax,%rcx,4),%r9d
  test   %edx,%edx
  je     L28
L56:
  mov    -0x4(%rax,%rdx,8),%ecx
  jmp    L188
  nopw   0x0(%rax,%rax,1)
L28:
  mov    0x4(%rax),%ecx
  jmp    L188
  nopl   (%rax)
L346:
  ret
  nopl   0x0(%rax)
L238:
  ret
```

assistant: ```c
void dwt_decode_53(int *a, int dn, int sn, int cas) {
  int i;
  if (!cas) {
    if ((dn > 0) || (sn > 1)) {
      for (i = 0; i < sn; i++)
        a[(i)*2] -= (((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)])) + 2) >> 2;
      for (i = 0; i < dn; i++)
        a[(1 + (i)*2)] += (((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]))) >> 1;
    }
  } else {
    if (!sn && dn == 1)
      a[(0) * 2] /= 2;
    else {
      for (i = 0; i < sn; i++)
        a[(1 + (i)*2)] -= (((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])) + 2) >> 2;
      for (i = 0; i < dn; i++)
        a[(i)*2] += (((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)]))) >> 1;
    }
  }
}
```