user: Translate the below assembly code into C programming language:

```asm
<dwt_encode_1>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    %edx,-0x20(%rbp)
  mov    %ecx,-0x24(%rbp)
  cmpl   $0x0,-0x24(%rbp)
  jne    L157
  cmpl   $0x0,-0x1c(%rbp)
  jg     L182
  cmpl   $0x1,-0x20(%rbp)
  jle    L320
L182:
  movl   $0x0,-0x4(%rbp)
  jmp    L342
L204:
  mov    -0x4(%rbp),%eax
  add    %eax,%eax
  add    $0x1,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%ecx
  cmpl   $0x0,-0x4(%rbp)
  jns    L18
  mov    -0x18(%rbp),%rax
  mov    (%rax),%edx
  jmp    L282
L18:
  mov    -0x4(%rbp),%eax
  cmp    -0x20(%rbp),%eax
  jl     L387
  mov    -0x20(%rbp),%eax
  sub    $0x1,%eax
  add    %eax,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  jmp    L282
L387:
  mov    -0x4(%rbp),%eax
  add    %eax,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
L282:
  cmpl   $0xffffffff,-0x4(%rbp)
  jge    L116
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  jmp    L225
L116:
  mov    -0x4(%rbp),%eax
  add    $0x1,%eax
  cmp    %eax,-0x20(%rbp)
  jg     L377
  mov    -0x20(%rbp),%eax
  sub    $0x1,%eax
  add    %eax,%eax
  cltq
  lea    0x0(,%rax,4),%rsi
  mov    -0x18(%rbp),%rax
  add    %rsi,%rax
  mov    (%rax),%eax
  jmp    L225
L377:
  mov    -0x4(%rbp),%eax
  add    $0x1,%eax
  add    %eax,%eax
  cltq
  lea    0x0(,%rax,4),%rsi
  mov    -0x18(%rbp),%rax
  add    %rsi,%rax
  mov    (%rax),%eax
L225:
  add    %edx,%eax
  sar    %eax
  mov    %eax,%esi
  mov    -0x4(%rbp),%eax
  add    %eax,%eax
  add    $0x1,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  sub    %esi,%ecx
  mov    %ecx,%edx
  mov    %edx,(%rax)
  addl   $0x1,-0x4(%rbp)
L342:
  mov    -0x4(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jl     L204
  movl   $0x0,-0x4(%rbp)
  jmp    L208
L295:
  mov    -0x4(%rbp),%eax
  add    %eax,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%ecx
  cmpl   $0x0,-0x4(%rbp)
  jg     L117
  mov    -0x18(%rbp),%rax
  mov    0x4(%rax),%edx
  jmp    L248
L117:
  mov    -0x4(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jle    L315
  mov    -0x1c(%rbp),%eax
  sub    $0x1,%eax
  add    %eax,%eax
  add    $0x1,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  jmp    L248
L315:
  mov    -0x4(%rbp),%eax
  sub    $0x1,%eax
  add    %eax,%eax
  add    $0x1,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
L248:
  cmpl   $0x0,-0x4(%rbp)
  jns    L442
  mov    -0x18(%rbp),%rax
  mov    0x4(%rax),%eax
  jmp    L280
L442:
  mov    -0x4(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jl     L81
  mov    -0x1c(%rbp),%eax
  sub    $0x1,%eax
  add    %eax,%eax
  add    $0x1,%eax
  cltq
  lea    0x0(,%rax,4),%rsi
  mov    -0x18(%rbp),%rax
  add    %rsi,%rax
  mov    (%rax),%eax
  jmp    L280
L81:
  mov    -0x4(%rbp),%eax
  add    %eax,%eax
  add    $0x1,%eax
  cltq
  lea    0x0(,%rax,4),%rsi
  mov    -0x18(%rbp),%rax
  add    %rsi,%rax
  mov    (%rax),%eax
L280:
  add    %edx,%eax
  add    $0x2,%eax
  sar    $0x2,%eax
  mov    %eax,%edx
  mov    -0x4(%rbp),%eax
  add    %eax,%eax
  cltq
  lea    0x0(,%rax,4),%rsi
  mov    -0x18(%rbp),%rax
  add    %rsi,%rax
  add    %ecx,%edx
  mov    %edx,(%rax)
  addl   $0x1,-0x4(%rbp)
L208:
  mov    -0x4(%rbp),%eax
  cmp    -0x20(%rbp),%eax
  jl     L295
  jmp    L320
L157:
  cmpl   $0x0,-0x20(%rbp)
  jne    L247
  cmpl   $0x1,-0x1c(%rbp)
  jne    L247
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  lea    (%rax,%rax,1),%edx
  mov    -0x18(%rbp),%rax
  mov    %edx,(%rax)
  jmp    L320
L247:
  movl   $0x0,-0x4(%rbp)
  jmp    L128
L100:
  mov    -0x4(%rbp),%eax
  add    %eax,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%ecx
  cmpl   $0x0,-0x4(%rbp)
  jns    L468
  mov    -0x18(%rbp),%rax
  mov    0x4(%rax),%edx
  jmp    L296
L468:
  mov    -0x4(%rbp),%eax
  cmp    -0x20(%rbp),%eax
  jl     L351
  mov    -0x20(%rbp),%eax
  sub    $0x1,%eax
  add    %eax,%eax
  add    $0x1,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  jmp    L296
L351:
  mov    -0x4(%rbp),%eax
  add    %eax,%eax
  add    $0x1,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
L296:
  cmpl   $0x0,-0x4(%rbp)
  jg     L4
  mov    -0x18(%rbp),%rax
  mov    0x4(%rax),%eax
  jmp    L63
L4:
  mov    -0x4(%rbp),%eax
  cmp    -0x20(%rbp),%eax
  jle    L358
  mov    -0x20(%rbp),%eax
  sub    $0x1,%eax
  add    %eax,%eax
  add    $0x1,%eax
  cltq
  lea    0x0(,%rax,4),%rsi
  mov    -0x18(%rbp),%rax
  add    %rsi,%rax
  mov    (%rax),%eax
  jmp    L63
L358:
  mov    -0x4(%rbp),%eax
  sub    $0x1,%eax
  add    %eax,%eax
  add    $0x1,%eax
  cltq
  lea    0x0(,%rax,4),%rsi
  mov    -0x18(%rbp),%rax
  add    %rsi,%rax
  mov    (%rax),%eax
L63:
  add    %edx,%eax
  sar    %eax
  mov    %eax,%esi
  mov    -0x4(%rbp),%eax
  add    %eax,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  sub    %esi,%ecx
  mov    %ecx,%edx
  mov    %edx,(%rax)
  addl   $0x1,-0x4(%rbp)
L128:
  mov    -0x4(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jl     L100
  movl   $0x0,-0x4(%rbp)
  jmp    L428
L114:
  mov    -0x4(%rbp),%eax
  add    %eax,%eax
  add    $0x1,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%ecx
  cmpl   $0x0,-0x4(%rbp)
  jns    L92
  mov    -0x18(%rbp),%rax
  mov    (%rax),%edx
  jmp    L77
L92:
  mov    -0x4(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jl     L436
  mov    -0x1c(%rbp),%eax
  sub    $0x1,%eax
  add    %eax,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  jmp    L77
L436:
  mov    -0x4(%rbp),%eax
  add    %eax,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
L77:
  cmpl   $0xffffffff,-0x4(%rbp)
  jge    L30
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  jmp    L172
L30:
  mov    -0x4(%rbp),%eax
  add    $0x1,%eax
  cmp    %eax,-0x1c(%rbp)
  jg     L209
  mov    -0x1c(%rbp),%eax
  sub    $0x1,%eax
  add    %eax,%eax
  cltq
  lea    0x0(,%rax,4),%rsi
  mov    -0x18(%rbp),%rax
  add    %rsi,%rax
  mov    (%rax),%eax
  jmp    L172
L209:
  mov    -0x4(%rbp),%eax
  add    $0x1,%eax
  add    %eax,%eax
  cltq
  lea    0x0(,%rax,4),%rsi
  mov    -0x18(%rbp),%rax
  add    %rsi,%rax
  mov    (%rax),%eax
L172:
  add    %edx,%eax
  add    $0x2,%eax
  sar    $0x2,%eax
  mov    %eax,%edx
  mov    -0x4(%rbp),%eax
  add    %eax,%eax
  add    $0x1,%eax
  cltq
  lea    0x0(,%rax,4),%rsi
  mov    -0x18(%rbp),%rax
  add    %rsi,%rax
  add    %ecx,%edx
  mov    %edx,(%rax)
  addl   $0x1,-0x4(%rbp)
L428:
  mov    -0x4(%rbp),%eax
  cmp    -0x20(%rbp),%eax
  jl     L114
L320:
  nop
  pop    %rbp
  ret
```

assistant: ```c
void dwt_encode_1(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)] -= (((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;
      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;
    }
  } else {
    if (!sn && dn == 1)
      a[(0) * 2] *= 2;
    else {
      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;
      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;
    }
  }
}
```