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

```asm
<des_encrypt>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movb   $0x0,-0x1e(%rbp)
  cmpq   $0x0,-0x38(%rbp)
  jne    L127
  mov    -0x2c(%rbp),%eax
  jmp    L46
L127:
  mov    -0x2c(%rbp),%eax
  sub    $0x1,%eax
  cltd
  shr    $0x1d,%edx
  add    %edx,%eax
  and    $0x7,%eax
  sub    %edx,%eax
  mov    %eax,%edx
  mov    $0x8,%eax
  sub    %edx,%eax
  cltd
  shr    $0x1d,%edx
  add    %edx,%eax
  and    $0x7,%eax
  sub    %edx,%eax
  mov    %al,-0x1c(%rbp)
  movzbl -0x1c(%rbp),%edx
  mov    -0x2c(%rbp),%eax
  add    %edx,%eax
  cmp    $0x106,%eax
  jle    L47
  mov    $0xffffffff,%eax
  jmp    L46
L47:
  movzbl -0x1c(%rbp),%edx
  lea    -0x17(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <des_random_get@plt>
  movw   $0x0,-0x1a(%rbp)
  jmp    L0
L3:
  movswl -0x1a(%rbp),%ecx
  mov    -0x2c(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x2c(%rbp)
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rax,%rdx
  movslq %ecx,%rax
  movzbl -0x17(%rbp,%rax,1),%eax
  mov    %al,(%rdx)
  movzwl -0x1a(%rbp),%eax
  add    $0x1,%eax
  mov    %ax,-0x1a(%rbp)
L0:
  movswl -0x1a(%rbp),%edx
  movzbl -0x1c(%rbp),%eax
  cmp    %eax,%edx
  jl     L3
  movw   $0x2,-0x1a(%rbp)
  jmp    L89
L109:
  movswq -0x1a(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  xor    %al,-0x1e(%rbp)
  movzwl -0x1a(%rbp),%eax
  add    $0x1,%eax
  mov    %ax,-0x1a(%rbp)
L89:
  movswl -0x1a(%rbp),%eax
  cmp    %eax,-0x2c(%rbp)
  jg     L109
  mov    -0x2c(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x2c(%rbp)
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rax,%rdx
  movzbl -0x1e(%rbp),%eax
  mov    %al,(%rdx)
  lea    -0x10(%rbp),%rax
  mov    $0x8,%esi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <des_random_get@plt>
  mov    -0x2c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rax,%rdx
  mov    -0x10(%rbp),%rax
  mov    %rax,(%rdx)
  movw   $0x2,-0x1a(%rbp)
  jmp    L98
L31:
  movb   $0x3,-0x1b(%rbp)
  movb   $0x0,-0x1d(%rbp)
  jmp    L118
L39:
  movswl -0x1a(%rbp),%edx
  movzbl -0x1d(%rbp),%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %eax,%edx
  movzbl -0x1d(%rbp),%eax
  cltq
  movzbl -0x10(%rbp,%rax,1),%eax
  mov    %edx,%ecx
  xor    %eax,%ecx
  movswl -0x1a(%rbp),%edx
  movzbl -0x1d(%rbp),%eax
  add    %edx,%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    %ecx,%edx
  mov    %dl,(%rax)
  movzbl -0x1d(%rbp),%eax
  add    $0x1,%eax
  mov    %al,-0x1d(%rbp)
L118:
  cmpb   $0x7,-0x1d(%rbp)
  jbe    L39
  movswq -0x1a(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  movzbl -0x1b(%rbp),%edx
  mov    -0x38(%rbp),%rax
  lea    0x8(%rax),%rsi
  mov    -0x38(%rbp),%rax
  mov    %rcx,%r8
  mov    $0x1,%ecx
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <EuroDes@plt>
  movswq -0x1a(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    %rax,-0x10(%rbp)
  movzwl -0x1a(%rbp),%eax
  add    $0x8,%eax
  mov    %ax,-0x1a(%rbp)
L98:
  movswl -0x1a(%rbp),%eax
  cmp    %eax,-0x2c(%rbp)
  jg     L31
  addl   $0x8,-0x2c(%rbp)
  mov    -0x2c(%rbp),%eax
L46:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L105
  call   <__stack_chk_fail@plt>
L105:
  leave
  ret
```

assistant: ```c
int des_encrypt(unsigned char *buffer, int len, unsigned char *deskey) {
  unsigned char checksum = 0;
  unsigned char noPadBytes;
  unsigned char padBytes[7];
  char ivec[8];
  short i;
  if (!deskey)
    return len;
  noPadBytes = (8 - ((len - 1) % 8)) % 8;
  if (len + noPadBytes + 1 >= 272 - 8)
    return -1;
  des_random_get(padBytes, noPadBytes);
  for (i = 0; i < noPadBytes; i++)
    buffer[len++] = padBytes[i];
  for (i = 2; i < len; i++)
    checksum ^= buffer[i];
  buffer[len++] = checksum;
  des_random_get((unsigned char *)ivec, 8);
  memcpy(buffer + len, ivec, 8);
  for (i = 2; i < len; i += 8) {
    unsigned char j;
    const unsigned char flags = (1 << 0) | (1 << 1);
    for (j = 0; j < 8; j++)
      buffer[i + j] ^= ivec[j];
    EuroDes(deskey, deskey + 8, flags, 1, buffer + i);
    memcpy(ivec, buffer + i, 8);
  }
  len += 8;
  return len;
}
```