user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<get_downleftleft_pred>:
  endbr64
  push   %rbx
  sub    $0x310,%rsp
  mov    %edx,%eax
  mov    %fs:0x28,%rdx
  mov    %rdx,0x308(%rsp)
  xor    %edx,%edx
  test   %eax,%eax
  jle    L165
  test   %r8d,%r8d
  jle    L127
  movslq %ecx,%r10
  shl    $0x2,%r10
  imul   %ecx,%esi
  movslq %esi,%rdx
  cltq
  add    %rdx,%rax
  lea    (%rdi,%rax,4),%rdx
  mov    %rsp,%rax
  lea    -0x1(%r8),%ecx
  lea    0x4(%rsp,%rcx,4),%rsi
L126:
  mov    -0x4(%rdx),%ecx
  mov    %ecx,(%rax)
  add    %r10,%rdx
  add    $0x4,%rax
  cmp    %rsi,%rax
  jne    L126
L127:
  mov    (%rsp),%eax
  lea    (%rax,%rax,2),%eax
  add    0x4(%rsp),%eax
  add    $0x2,%eax
  sar    $0x2,%eax
  mov    %eax,0x100(%rsp)
  lea    -0x1(%r8),%edi
  cmp    $0x1,%edi
  jle    L112
  mov    %rsp,%rdx
  lea    0x104(%rsp),%rcx
  lea    -0x3(%r8),%eax
  lea    0x4(%rsp,%rax,4),%r10
L92:
  mov    0x4(%rdx),%esi
  mov    (%rdx),%eax
  lea    (%rax,%rsi,2),%eax
  add    0x8(%rdx),%eax
  add    $0x2,%eax
  sar    $0x2,%eax
  mov    %eax,(%rcx)
  add    $0x4,%rdx
  add    $0x4,%rcx
  cmp    %r10,%rdx
  jne    L92
L112:
  movslq %edi,%rdx
  mov    (%rsp,%rdx,4),%ecx
  lea    -0x2(%r8),%eax
  cltq
  mov    (%rsp,%rax,4),%eax
  lea    (%rax,%rcx,2),%eax
  lea    0x2(%rcx,%rax,1),%eax
  sar    $0x2,%eax
  mov    %eax,0x100(%rsp,%rdx,4)
  lea    (%r8,%r8,1),%edx
  lea    -0x1(%rdx),%eax
  cmp    %eax,%r8d
  jge    L22
  movslq %r8d,%rcx
  lea    0x100(%rsp,%rcx,4),%rax
  sub    %r8d,%edx
  lea    -0x2(%rdx),%edx
  add    %rcx,%rdx
  lea    0x104(%rsp,%rdx,4),%rsi
  movslq %edi,%rcx
L73:
  mov    0x100(%rsp,%rcx,4),%edx
  mov    %edx,(%rax)
  add    $0x4,%rax
  cmp    %rsi,%rax
  jne    L73
L22:
  test   %r8d,%r8d
  jle    L26
  mov    %r8d,%ecx
  lea    -0x2(%r8),%r10d
  lea    (%r8,%r8,2),%r8d
  mov    $0x0,%edi
  mov    $0x0,%esi
  jmp    L28
L165:
  test   %r8d,%r8d
  jle    L127
  mov    %rsp,%rax
  lea    -0x1(%r8),%edx
  lea    0x4(%rsp,%rdx,4),%rdx
L76:
  movl   $0x80,(%rax)
  add    $0x4,%rax
  cmp    %rdx,%rax
  jne    L76
  jmp    L127
L98:
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %eax,%edx
  sar    %edx
  lea    (%rsi,%rax,1),%r11d
  movslq %r11d,%r11
  lea    0x1(%rdx),%ebx
  movslq %ebx,%rbx
  movslq %edx,%rdx
  mov    0x100(%rsp,%rdx,4),%edx
  add    0x100(%rsp,%rbx,4),%edx
  sar    %edx
  mov    %edx,(%r9,%r11,4)
L122:
  add    $0x1,%eax
  cmp    %eax,%ecx
  je     L16
L140:
  test   $0x1,%al
  je     L98
  lea    (%rsi,%rax,1),%r11d
  movslq %r11d,%r11
  lea    0x1(%rax),%ebx
  mov    %ebx,%edx
  shr    $0x1f,%edx
  add    %ebx,%edx
  sar    %edx
  movslq %edx,%rdx
  mov    0x100(%rsp,%rdx,4),%edx
  mov    %edx,(%r9,%r11,4)
  jmp    L122
L16:
  add    $0x2,%ecx
  add    %r10d,%esi
  add    $0x2,%edi
  cmp    %r8d,%ecx
  je     L26
L28:
  mov    %edi,%eax
  jmp    L140
L26:
  mov    0x308(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L169
  add    $0x310,%rsp
  pop    %rbx
  ret
L169:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void get_downleftleft_pred(uint8_t *rec, int ypos, int xpos, int stride, int size, uint8_t *pblock) {
  int i, j, diag;
  uint16_t hor[64];
  uint8_t horF[2 * 64];
  if (xpos > 0) {
    for (i = 0; i < size; i++) {
      hor[i] = rec[(ypos + i) * stride + xpos - 1];
    }
  } else {
    for (i = 0; i < size; i++) {
      hor[i] = 128;
    }
  }
  horF[0] = (uint8_t)((hor[0] + 2 * hor[0] + hor[1] + 2) >> 2);
  for (j = 1; j < size - 1; j++) {
    horF[j] = (uint8_t)((hor[j - 1] + 2 * hor[j] + hor[j + 1] + 2) >> 2);
  }
  horF[size - 1] = (uint8_t)((hor[size - 2] + 2 * hor[size - 1] + hor[size - 1] + 2) >> 2);
  for (j = size; j < 2 * size - 1; j++) {
    horF[j] = horF[size - 1];
  }
  for (i = 0; i < size; i++) {
    for (j = 0; j < size; j++) {
      diag = 2 * i + j;
      if (diag & 1)
        pblock[i * size + j] = horF[(diag + 1) / 2];
      else
        pblock[i * size + j] = (horF[diag / 2] + horF[diag / 2 + 1]) >> 1;
    }
  }
}
```