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

```asm
<kernel_dgemv_n_1_lib4>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x58,%rsp
  mov    %edi,0x30(%rsp)
  mov    %rdx,0x28(%rsp)
  mov    %rcx,0x40(%rsp)
  mov    %r8,0x38(%rsp)
  mov    %r9d,0x34(%rsp)
  test   %edi,%edi
  jle    L103
  mov    %edi,%r12d
  mov    %rsi,%r15
  mov    %rdx,%rbx
  mov    $0x0,%eax
  call   <_mm_setzero_pd@plt>
  mov    %eax,0x4(%rsp)
  mov    $0x0,%eax
  call   <_mm_setzero_pd@plt>
  mov    %eax,%ebp
  mov    $0x0,%eax
  call   <_mm_setzero_pd@plt>
  mov    %eax,%r14d
  mov    $0x0,%eax
  call   <_mm_setzero_pd@plt>
  mov    %eax,%r13d
  cmp    $0x3,%r12d
  jle    L71
  lea    -0x4(%r12),%eax
  shr    $0x2,%eax
  add    $0x1,%eax
  mov    %eax,%eax
  mov    %rax,0x48(%rsp)
  shl    $0x7,%rax
  lea    (%r15,%rax,1),%r12
  mov    %ebp,%ecx
  mov    %r12,%rbp
  mov    %r13d,%eax
  mov    %r14d,%r13d
  mov    %eax,%r14d
  mov    %ecx,%r12d
L20:
  mov    %rbx,%rdi
  call   <_mm_load_sd@plt>
  mov    %eax,0x8(%rsp)
  lea    0x8(%rbx),%rdi
  call   <_mm_load_sd@plt>
  mov    %eax,0xc(%rsp)
  mov    %r15,%rdi
  call   <_mm_load_sd@plt>
  mov    %eax,0x10(%rsp)
  lea    0x20(%r15),%rdi
  call   <_mm_load_sd@plt>
  mov    %eax,0x14(%rsp)
  lea    0x10(%rbx),%rdi
  call   <_mm_load_sd@plt>
  mov    %eax,0x18(%rsp)
  lea    0x18(%rbx),%rdi
  call   <_mm_load_sd@plt>
  mov    %eax,0x1c(%rsp)
  lea    0x40(%r15),%rdi
  call   <_mm_load_sd@plt>
  mov    %eax,0x20(%rsp)
  lea    0x60(%r15),%rdi
  call   <_mm_load_sd@plt>
  mov    %eax,0x24(%rsp)
  mov    0x8(%rsp),%esi
  mov    0x10(%rsp),%edi
  call   <_mm_mul_sd@plt>
  mov    %eax,%esi
  mov    0x4(%rsp),%edi
  call   <_mm_add_sd@plt>
  mov    %eax,0x4(%rsp)
  mov    0xc(%rsp),%esi
  mov    0x14(%rsp),%edi
  call   <_mm_mul_sd@plt>
  mov    %eax,%esi
  mov    %r12d,%edi
  call   <_mm_add_sd@plt>
  mov    %eax,%r12d
  mov    0x18(%rsp),%esi
  mov    0x20(%rsp),%edi
  call   <_mm_mul_sd@plt>
  mov    %eax,%esi
  mov    %r13d,%edi
  call   <_mm_add_sd@plt>
  mov    %eax,%r13d
  mov    0x1c(%rsp),%esi
  mov    0x24(%rsp),%edi
  call   <_mm_mul_sd@plt>
  mov    %eax,%esi
  mov    %r14d,%edi
  call   <_mm_add_sd@plt>
  mov    %eax,%r14d
  sub    $0xffffffffffffff80,%r15
  add    $0x20,%rbx
  cmp    %rbp,%r15
  jne    L20
  mov    %r12d,%ecx
  mov    %rbp,%r12
  mov    %r13d,%r14d
  mov    %eax,%r13d
  mov    %ecx,%ebp
  mov    0x48(%rsp),%rax
  shl    $0x5,%rax
  add    %rax,0x28(%rsp)
L30:
  mov    %r14d,%esi
  mov    0x4(%rsp),%edi
  call   <_mm_add_pd@plt>
  mov    %eax,%ebx
  mov    %r13d,%esi
  mov    %ebp,%edi
  call   <_mm_add_pd@plt>
  mov    %eax,%ebp
  mov    0x30(%rsp),%eax
  mov    %eax,%edx
  sar    $0x1f,%edx
  shr    $0x1e,%edx
  add    %edx,%eax
  and    $0x3,%eax
  sub    %edx,%eax
  cmp    $0x1,%eax
  jg     L105
L64:
  mov    %ebp,%esi
  mov    %ebx,%edi
  call   <_mm_add_pd@plt>
  mov    %eax,%ebx
  mov    0x30(%rsp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  and    $0x1,%eax
  sub    %edx,%eax
  cmp    $0x1,%eax
  je     L99
L85:
  cmpl   $0x0,0x34(%rsp)
  je     L106
  cmpl   $0x1,0x34(%rsp)
  je     L110
  mov    0x40(%rsp),%rdi
  call   <_mm_load_sd@plt>
  mov    %eax,%edi
  mov    %ebx,%esi
  call   <_mm_sub_sd@plt>
  mov    %eax,%esi
  mov    0x38(%rsp),%rdi
  call   <_mm_store_sd@plt>
L103:
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L71:
  mov    %r15,%r12
  jmp    L30
L105:
  mov    0x28(%rsp),%r14
  mov    %r14,%rdi
  call   <_mm_load_sd@plt>
  mov    %eax,%r15d
  mov    %r14,0x28(%rsp)
  lea    0x8(%r14),%rdi
  call   <_mm_load_sd@plt>
  mov    %eax,%r13d
  mov    %r12,%rdi
  call   <_mm_load_sd@plt>
  mov    %eax,%r14d
  lea    0x20(%r12),%rdi
  call   <_mm_load_sd@plt>
  mov    %eax,0x4(%rsp)
  mov    %r15d,%esi
  mov    %r14d,%edi
  call   <_mm_mul_sd@plt>
  mov    %eax,%esi
  mov    %ebx,%edi
  call   <_mm_add_sd@plt>
  mov    %eax,%ebx
  mov    %r13d,%esi
  mov    0x4(%rsp),%edi
  call   <_mm_mul_sd@plt>
  mov    %eax,%esi
  mov    %ebp,%edi
  call   <_mm_add_sd@plt>
  mov    %eax,%ebp
  add    $0x40,%r12
  addq   $0x10,0x28(%rsp)
  jmp    L64
L99:
  mov    0x28(%rsp),%rdi
  call   <_mm_load_sd@plt>
  mov    %eax,%ebp
  mov    %r12,%rdi
  call   <_mm_load_sd@plt>
  mov    %eax,%edi
  mov    %ebp,%esi
  call   <_mm_mul_sd@plt>
  mov    %eax,%esi
  mov    %ebx,%edi
  call   <_mm_add_sd@plt>
  mov    %eax,%ebx
  jmp    L85
L106:
  mov    %ebx,%esi
  mov    0x38(%rsp),%rdi
  call   <_mm_store_sd@plt>
  jmp    L103
L110:
  mov    0x40(%rsp),%rdi
  call   <_mm_load_sd@plt>
  mov    %eax,%edi
  mov    %ebx,%esi
  call   <_mm_add_sd@plt>
  mov    %eax,%esi
  mov    0x38(%rsp),%rdi
  call   <_mm_store_sd@plt>
  jmp    L103
```

assistant: ```c
void kernel_dgemv_n_1_lib4(int kmax, double *A, double *x, double *y, double *z, int alg) {
  if (kmax <= 0)
    return;
  const int lda = 4;
  int k;
  __m128d ax_temp, a_00, a_01, a_02, a_03, x_0, x_1, x_2, x_3, y_0, y_0_b, y_0_c, y_0_d, z_0;
  y_0 = _mm_setzero_pd();
  y_0_b = _mm_setzero_pd();
  y_0_c = _mm_setzero_pd();
  y_0_d = _mm_setzero_pd();
  k = 0;
  for (; k < kmax - 3; k += 4) {
    x_0 = _mm_load_sd(&x[0]);
    x_1 = _mm_load_sd(&x[1]);
    a_00 = _mm_load_sd(&A[0 + lda * 0]);
    a_01 = _mm_load_sd(&A[0 + lda * 1]);
    x_2 = _mm_load_sd(&x[2]);
    x_3 = _mm_load_sd(&x[3]);
    a_02 = _mm_load_sd(&A[0 + lda * 2]);
    a_03 = _mm_load_sd(&A[0 + lda * 3]);
    ax_temp = _mm_mul_sd(a_00, x_0);
    y_0 = _mm_add_sd(y_0, ax_temp);
    ax_temp = _mm_mul_sd(a_01, x_1);
    y_0_b = _mm_add_sd(y_0_b, ax_temp);
    ax_temp = _mm_mul_sd(a_02, x_2);
    y_0_c = _mm_add_sd(y_0_c, ax_temp);
    ax_temp = _mm_mul_sd(a_03, x_3);
    y_0_d = _mm_add_sd(y_0_d, ax_temp);
    A += 4 * lda;
    x += 4;
  }
  y_0 = _mm_add_pd(y_0, y_0_c);
  y_0_b = _mm_add_pd(y_0_b, y_0_d);
  if (kmax % 4 >= 2) {
    x_0 = _mm_load_sd(&x[0]);
    x_1 = _mm_load_sd(&x[1]);
    a_00 = _mm_load_sd(&A[0 + lda * 0]);
    a_01 = _mm_load_sd(&A[0 + lda * 1]);
    ax_temp = _mm_mul_sd(a_00, x_0);
    y_0 = _mm_add_sd(y_0, ax_temp);
    ax_temp = _mm_mul_sd(a_01, x_1);
    y_0_b = _mm_add_sd(y_0_b, ax_temp);
    A += 2 * lda;
    x += 2;
  }
  y_0 = _mm_add_pd(y_0, y_0_b);
  if (kmax % 2 == 1) {
    x_0 = _mm_load_sd(&x[0]);
    a_00 = _mm_load_sd(&A[0 + lda * 0]);
    ax_temp = _mm_mul_sd(a_00, x_0);
    y_0 = _mm_add_sd(y_0, ax_temp);
  }
  if (alg == 0) {
    _mm_store_sd(&z[0], y_0);
  } else if (alg == 1) {
    z_0 = _mm_load_sd(&y[0]);
    z_0 = _mm_add_sd(z_0, y_0);
    _mm_store_sd(&z[0], z_0);
  } else {
    z_0 = _mm_load_sd(&y[0]);
    z_0 = _mm_sub_sd(z_0, y_0);
    _mm_store_sd(&z[0], z_0);
  }
}
```