user: Please show me the C implementation that matches the assembly code listed below:

```asm
<findK>:
  endbr64
  mov    %esi,%eax
  mov    %rdx,%rsi
  test   %eax,%eax
  je     L0
  mov    %ecx,%edx
  movslq %eax,%rcx
  mov    -0x4(%rdi,%rcx,4),%ecx
  cmp    %ecx,(%rsi)
  jge    L72
  push   %rbx
  nopl   0x0(%rax,%rax,1)
L8:
  mov    %rsi,%r9
  mov    (%rdi),%ecx
  mov    %rdi,%rsi
  mov    %r9,%rdi
  mov    %edx,%r9d
  mov    %eax,%edx
  mov    %r9d,%eax
L179:
  movslq %eax,%r9
  cmp    %ecx,-0x4(%rdi,%r9,4)
  jle    L196
  cmp    $0x1,%edx
  je     L170
  cmp    $0x1,%eax
  je     L186
  mov    %eax,%ecx
  mov    %edx,%r9d
  shr    $0x1f,%ecx
  shr    $0x1f,%r9d
  add    %eax,%ecx
  add    %edx,%r9d
  sar    %ecx
  sar    %r9d
  movslq %ecx,%r10
  movslq %r9d,%r11
  lea    (%rdi,%r10,4),%r10
  mov    (%r10),%ebx
  cmp    %ebx,(%rsi,%r11,4)
  jl     L1
  lea    (%r9,%rcx,1),%r11d
  cmp    %r8d,%r11d
  jge    L192
  sub    %ecx,%r8d
  test   $0x1,%al
  je     L6
  lea    0x1(%rcx),%eax
  mov    %r10,%rdi
  nopw   0x0(%rax,%rax,1)
L1:
  test   %eax,%eax
  je     L288
  movslq %eax,%rcx
  mov    -0x4(%rdi,%rcx,4),%ecx
  cmp    %ecx,(%rsi)
  jl     L8
  cmp    %eax,%r8d
  jle    L56
L138:
  sub    %eax,%r8d
  pxor   %xmm0,%xmm0
  pop    %rbx
  movslq %r8d,%r8
  cvtsi2sdl -0x4(%rsi,%r8,4),%xmm0
  ret
  nopl   0x0(%rax,%rax,1)
L170:
  mov    %eax,%r9d
  shr    $0x1f,%r9d
  add    %eax,%r9d
  sar    %r9d
  movslq %r9d,%r10
  lea    (%rdi,%r10,4),%r11
  mov    (%r11),%r10d
  cmp    %ecx,%r10d
  jle    L75
  lea    0x1(%r9),%ecx
  cmp    %r8d,%ecx
  jge    L60
  sub    %r9d,%r8d
  test   $0x1,%al
  je     L50
  mov    %ecx,%eax
  mov    %r11,%rdi
  jmp    L1
  nopl   0x0(%rax,%rax,1)
L186:
  mov    %edx,%eax
  mov    %rsi,%rdx
  mov    %ecx,%r10d
  mov    %rdi,%rsi
  mov    (%rdi),%ecx
  mov    %rdx,%rdi
L100:
  mov    $0x1,%edx
  cmp    %ecx,%r10d
  jl     L179
  mov    %rdi,%rax
  mov    %rsi,%rdi
  mov    %rax,%rsi
  mov    $0x1,%eax
  cmp    %eax,%r8d
  jle    L56
  jmp    L138
  cs nopw 0x0(%rax,%rax,1)
L75:
  cmp    %r8d,%r9d
  jge    L56
  sub    %r9d,%r8d
  test   $0x1,%al
  je     L254
  lea    0x1(%r9),%eax
  mov    %r11,%rdi
  jmp    L100
  nopl   (%rax)
L192:
  mov    %rdi,%rcx
  mov    %eax,%edx
  mov    %rsi,%rdi
  mov    %r9d,%eax
  mov    %rcx,%rsi
  jmp    L1
  nopl   0x0(%rax,%rax,1)
L60:
  mov    %r9d,%eax
  jmp    L1
  nopl   0x0(%rax,%rax,1)
L196:
  cmp    %r8d,%eax
  jl     L138
L56:
  movslq %r8d,%r8
  pxor   %xmm0,%xmm0
  pop    %rbx
  cvtsi2sdl -0x4(%rdi,%r8,4),%xmm0
  ret
  nopl   0x0(%rax)
L6:
  mov    %ecx,%eax
  mov    %r10,%rdi
  jmp    L1
  nopw   0x0(%rax,%rax,1)
L254:
  mov    %r9d,%eax
  mov    %r11,%rdi
  jmp    L100
  nopl   0x0(%rax,%rax,1)
L50:
  mov    %r9d,%eax
  mov    %r11,%rdi
  jmp    L1
L288:
  mov    %rsi,%rdi
  jmp    L56
L0:
  movslq %r8d,%r8
  pxor   %xmm0,%xmm0
  cvtsi2sdl -0x4(%rdx,%r8,4),%xmm0
  ret
L72:
  cmp    %eax,%r8d
  jle    L279
  sub    %eax,%r8d
  pxor   %xmm0,%xmm0
  movslq %r8d,%r8
  cvtsi2sdl -0x4(%rsi,%r8,4),%xmm0
  ret
L279:
  movslq %r8d,%r8
  pxor   %xmm0,%xmm0
  cvtsi2sdl -0x4(%rdi,%r8,4),%xmm0
  ret
```

assistant: ```c
double findK(int *n1, int s1, int *n2, int s2, int k) {
  if (s1 == 0)
    return n2[k - 1];
  if (n1[s1 - 1] <= n2[0])
    return (double)(k > s1 ? n2[k - s1 - 1] : n1[k - 1]);
  if (n2[s2 - 1] <= n1[0])
    return (double)(k > s2 ? n1[k - s2 - 1] : n2[k - 1]);
  if (s1 == 1) {
    if (n1[0] < n2[s2 / 2]) {
      if (k <= s2 / 2 + 1)
        return findK(n2, s2 / 2, n1, s1, k);
      else
        return findK(&(n2[s2 / 2]), (s2 % 2 ? s2 / 2 + 1 : s2 / 2), n1, s1, k - s2 / 2);
    } else {
      if (k <= s2 / 2)
        return findK(n1, 0, n2, s2 / 2, k);
      else
        return findK(n1, s1, &(n2[s2 / 2]), (s2 % 2 ? s2 / 2 + 1 : s2 / 2), k - s2 / 2);
    }
  }
  if (s2 == 1) {
    return findK(n2, s2, n1, s1, k);
  }
  if (n1[s1 / 2] >= n2[s2 / 2]) {
    if (k <= s1 / 2 + s2 / 2)
      return findK(n1, s1 / 2, n2, s2, k);
    else
      return findK(&(n2[s2 / 2]), (s2 % 2 ? s2 / 2 + 1 : s2 / 2), n1, s1, k - s2 / 2);
  } else
    return findK(n2, s2, n1, s1, k);
}
```