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

```asm
<xfrm_fill_key>:
  endbr64
  push   %r13
  mov    %rcx,%r13
  push   %r12
  mov    %rsi,%r12
  lea    D237(%rip),%rsi
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %rdx,%rbx
  mov    $0x40,%edx
  sub    $0x8,%rsp
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L48
L318:
  movl   $0x0,0x0(%r13)
  xor    %esi,%esi
L297:
  mov    %r12,%rdi
  call   <randomize_buffer@plt>
  xor    %eax,%eax
L363:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nop
L48:
  mov    $0x40,%edx
  lea    D183(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L318
  mov    $0x40,%edx
  lea    D66(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L309
  movl   $0x40,0x0(%r13)
  mov    $0x40,%eax
  mov    $0x40,%esi
L115:
  cmp    %rax,%rbx
  jae    L297
  xor    %eax,%eax
  call   <getpid@plt>
  mov    $0x33d,%edx
  lea    D203(%rip),%rdi
  mov    %eax,%esi
  call   <ksft_print_msg@plt>
  mov    $0xffffffff,%eax
  jmp    L363
  nopw   0x0(%rax,%rax,1)
L309:
  mov    $0x40,%edx
  lea    D113(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L410
L172:
  movl   $0x80,0x0(%r13)
  mov    $0x80,%eax
  mov    $0x80,%esi
  jmp    L115
  nopl   (%rax)
L410:
  mov    $0x40,%edx
  lea    D50(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L172
  mov    $0x40,%edx
  lea    D32(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L172
  mov    $0x40,%edx
  lea    D182(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L172
  mov    $0x40,%edx
  lea    D147(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L172
  mov    $0x40,%edx
  lea    D264(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L296
L233:
  movl   $0xa0,0x0(%r13)
  mov    $0xa0,%eax
  mov    $0xa0,%esi
  jmp    L115
L296:
  mov    $0x40,%edx
  lea    D177(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L233
  mov    $0x40,%edx
  lea    D283(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L167
  movl   $0xc0,0x0(%r13)
  mov    $0xc0,%eax
  mov    $0xc0,%esi
  jmp    L115
L167:
  mov    $0x40,%edx
  lea    D274(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L293
L349:
  movl   $0x100,0x0(%r13)
  mov    $0x100,%eax
  mov    $0x100,%esi
  jmp    L115
L293:
  mov    $0x40,%edx
  lea    D246(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L349
  mov    $0x40,%edx
  lea    D134(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L349
  mov    $0x40,%edx
  lea    D249(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L349
  mov    $0x40,%edx
  lea    D248(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L79
L316:
  movl   $0x120,0x0(%r13)
  mov    $0x120,%eax
  mov    $0x120,%esi
  jmp    L115
L79:
  mov    $0x40,%edx
  lea    D189(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L143
  movl   $0x180,0x0(%r13)
  mov    $0x180,%eax
  mov    $0x180,%esi
  jmp    L115
L143:
  mov    $0x40,%edx
  lea    D102(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L406
  movl   $0x1c0,0x0(%r13)
  mov    $0x1c0,%eax
  mov    $0x1c0,%esi
  jmp    L115
L406:
  mov    $0x40,%edx
  lea    D40(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L231
  movl   $0x200,0x0(%r13)
  mov    $0x200,%eax
  mov    $0x200,%esi
  jmp    L115
L231:
  mov    $0x40,%edx
  lea    D83(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L233
  mov    $0x40,%edx
  lea    D34(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L233
  mov    $0x40,%edx
  lea    D42(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L140
  movl   $0x98,0x0(%r13)
  mov    $0x98,%eax
  mov    $0x98,%esi
  jmp    L115
L140:
  mov    $0x40,%edx
  lea    D136(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L332
L376:
  movl   $0xe0,0x0(%r13)
  mov    $0xe0,%eax
  mov    $0xe0,%esi
  jmp    L115
L332:
  mov    $0x40,%edx
  lea    D234(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L376
  mov    $0x40,%edx
  lea    D255(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L168
  movl   $0xd8,0x0(%r13)
  mov    $0xd8,%eax
  mov    $0xd8,%esi
  jmp    L115
L168:
  mov    $0x40,%edx
  lea    D295(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L316
  mov    $0x40,%edx
  lea    D105(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L316
  mov    $0x40,%edx
  lea    D61(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  jne    L157
  movl   $0x118,0x0(%r13)
  mov    $0x118,%eax
  mov    $0x118,%esi
  jmp    L115
L157:
  mov    $0x40,%edx
  lea    D158(%rip),%rsi
  mov    %rbp,%rdi
  call   <strncmp@plt>
  test   %rax,%rax
  je     L318
  mov    0x0(%r13),%eax
  mov    %rax,%rsi
  jmp    L115
```

tool_calls: name: unpack_data
arguments: label: D237
datatype: string
name: unpack_data
arguments: label: D183
datatype: string
name: unpack_data
arguments: label: D66
datatype: string
name: unpack_data
arguments: label: D203
datatype: string
name: unpack_data
arguments: label: D113
datatype: string
name: unpack_data
arguments: label: D50
datatype: string
name: unpack_data
arguments: label: D32
datatype: string
name: unpack_data
arguments: label: D182
datatype: string
name: unpack_data
arguments: label: D147
datatype: string
name: unpack_data
arguments: label: D264
datatype: string
name: unpack_data
arguments: label: D177
datatype: string
name: unpack_data
arguments: label: D283
datatype: string
name: unpack_data
arguments: label: D274
datatype: string
name: unpack_data
arguments: label: D246
datatype: string
name: unpack_data
arguments: label: D134
datatype: string
name: unpack_data
arguments: label: D249
datatype: string
name: unpack_data
arguments: label: D248
datatype: string
name: unpack_data
arguments: label: D189
datatype: string
name: unpack_data
arguments: label: D102
datatype: string
name: unpack_data
arguments: label: D40
datatype: string
name: unpack_data
arguments: label: D83
datatype: string
name: unpack_data
arguments: label: D34
datatype: string
name: unpack_data
arguments: label: D42
datatype: string
name: unpack_data
arguments: label: D136
datatype: string
name: unpack_data
arguments: label: D234
datatype: string
name: unpack_data
arguments: label: D255
datatype: string
name: unpack_data
arguments: label: D295
datatype: string
name: unpack_data
arguments: label: D105
datatype: string
name: unpack_data
arguments: label: D61
datatype: string
name: unpack_data
arguments: label: D158
datatype: string

tool: D237: digest_null

tool: D183: ecb(cipher_null)

tool: D66: cbc(des)

tool: D203: %d[%u] Can't pack a key - too big for buffer


tool: D113: hmac(md5)

tool: D50: cmac(aes)

tool: D32: xcbc(aes)

tool: D182: cbc(cast5)

tool: D147: cbc(serpent)

tool: D264: hmac(sha1)

tool: D177: hmac(rmd160)

tool: D283: cbc(des3_ede)

tool: D274: hmac(sha256)

tool: D246: cbc(aes)

tool: D134: cbc(camellia)

tool: D249: cbc(twofish)

tool: D248: rfc3686(ctr(aes))

tool: D189: hmac(sha384)

tool: D102: cbc(blowfish)

tool: D40: hmac(sha512)

tool: D83: rfc4106(gcm(aes))-128

tool: D34: rfc4543(gcm(aes))-128

tool: D42: rfc4309(ccm(aes))-128

tool: D136: rfc4106(gcm(aes))-192

tool: D234: rfc4543(gcm(aes))-192

tool: D255: rfc4309(ccm(aes))-192

tool: D295: rfc4106(gcm(aes))-256

tool: D105: rfc4543(gcm(aes))-256

tool: D61: rfc4309(ccm(aes))-256

tool: D158: rfc7539(chacha20,poly1305)-128

assistant: ```c
int xfrm_fill_key(char *name, char *buf, size_t buf_len, unsigned int *key_len) {
  if (strncmp(name, "digest_null", 64) == 0)
    *key_len = 0;
  else if (strncmp(name, "ecb(cipher_null)", 64) == 0)
    *key_len = 0;
  else if (strncmp(name, "cbc(des)", 64) == 0)
    *key_len = 64;
  else if (strncmp(name, "hmac(md5)", 64) == 0)
    *key_len = 128;
  else if (strncmp(name, "cmac(aes)", 64) == 0)
    *key_len = 128;
  else if (strncmp(name, "xcbc(aes)", 64) == 0)
    *key_len = 128;
  else if (strncmp(name, "cbc(cast5)", 64) == 0)
    *key_len = 128;
  else if (strncmp(name, "cbc(serpent)", 64) == 0)
    *key_len = 128;
  else if (strncmp(name, "hmac(sha1)", 64) == 0)
    *key_len = 160;
  else if (strncmp(name, "hmac(rmd160)", 64) == 0)
    *key_len = 160;
  else if (strncmp(name, "cbc(des3_ede)", 64) == 0)
    *key_len = 192;
  else if (strncmp(name, "hmac(sha256)", 64) == 0)
    *key_len = 256;
  else if (strncmp(name, "cbc(aes)", 64) == 0)
    *key_len = 256;
  else if (strncmp(name, "cbc(camellia)", 64) == 0)
    *key_len = 256;
  else if (strncmp(name, "cbc(twofish)", 64) == 0)
    *key_len = 256;
  else if (strncmp(name, "rfc3686(ctr(aes))", 64) == 0)
    *key_len = 288;
  else if (strncmp(name, "hmac(sha384)", 64) == 0)
    *key_len = 384;
  else if (strncmp(name, "cbc(blowfish)", 64) == 0)
    *key_len = 448;
  else if (strncmp(name, "hmac(sha512)", 64) == 0)
    *key_len = 512;
  else if (strncmp(name, "rfc4106(gcm(aes))-128", 64) == 0)
    *key_len = 160;
  else if (strncmp(name, "rfc4543(gcm(aes))-128", 64) == 0)
    *key_len = 160;
  else if (strncmp(name, "rfc4309(ccm(aes))-128", 64) == 0)
    *key_len = 152;
  else if (strncmp(name, "rfc4106(gcm(aes))-192", 64) == 0)
    *key_len = 224;
  else if (strncmp(name, "rfc4543(gcm(aes))-192", 64) == 0)
    *key_len = 224;
  else if (strncmp(name, "rfc4309(ccm(aes))-192", 64) == 0)
    *key_len = 216;
  else if (strncmp(name, "rfc4106(gcm(aes))-256", 64) == 0)
    *key_len = 288;
  else if (strncmp(name, "rfc4543(gcm(aes))-256", 64) == 0)
    *key_len = 288;
  else if (strncmp(name, "rfc4309(ccm(aes))-256", 64) == 0)
    *key_len = 280;
  else if (strncmp(name, "rfc7539(chacha20,poly1305)-128", 64) == 0)
    *key_len = 0;
  if (*key_len > buf_len) {
    ksft_print_msg("%d[%u] "
                   "Can't pack a key - too big for buffer"
                   "\n",
                   getpid(), 829);
    return -1;
  }
  randomize_buffer(buf, *key_len);
  return 0;
}
```