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

```asm
<calc_4pmk>:
  endbr64
  push   %r15
  push   %r14
  mov    %rcx,%r14
  push   %r13
  mov    %rdi,%r13
  push   %r12
  mov    %rsi,%r12
  mov    %r8,%rsi
  push   %rbp
  mov    %rdx,%rbp
  mov    $0x23,%edx
  push   %rbx
  sub    $0xdb8,%rsp
  mov    0xdf0(%rsp),%rax
  mov    %r9,0x38(%rsp)
  lea    0x80(%rsp),%rbx
  lea    0x1a0(%rsp),%r15
  mov    %rbx,%rdi
  mov    %rax,0x40(%rsp)
  mov    0xdf8(%rsp),%rax
  mov    %rax,0x48(%rsp)
  mov    0xe00(%rsp),%rax
  mov    %rax,0x50(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0xda8(%rsp)
  xor    %eax,%eax
  mov    %rbx,0x18(%rsp)
  call   <strncpy@plt>
  mov    %r13,%rsi
  mov    %r15,%rdi
  mov    $0x7f,%edx
  mov    %r15,0x30(%rsp)
  call   <strncpy@plt>
  lea    0x220(%rsp),%rax
  mov    %r12,%rsi
  mov    $0x7f,%edx
  mov    %rax,%rdi
  mov    %rax,0x28(%rsp)
  lea    0x3a0(%rsp),%r12
  call   <strncpy@plt>
  lea    0x2a0(%rsp),%rax
  mov    %rbp,%rsi
  mov    $0x7f,%edx
  mov    %rax,%rdi
  mov    %rax,0x20(%rsp)
  call   <strncpy@plt>
  lea    0x320(%rsp),%rax
  mov    %r14,%rsi
  mov    $0x7f,%edx
  mov    %rax,%rdi
  mov    %rax,0x10(%rsp)
  lea    0x4e0(%rsp),%r14
  call   <strncpy@plt>
  mov    %rbx,%rdi
  lea    0x4a0(%rsp),%rbx
  call   <strlen@plt>
  xor    %esi,%esi
  mov    $0x100,%edx
  mov    %r12,%rdi
  mov    %eax,%r13d
  lea    0x4(%rax),%eax
  mov    %eax,0xc(%rsp)
  call   <memset@plt>
  xor    %esi,%esi
  mov    $0x100,%edx
  mov    %rbx,%rdi
  call   <memset@plt>
  mov    %r15,%rdi
  call   <strlen@plt>
  mov    %r15,%rsi
  mov    %r12,%rdi
  mov    %eax,%edx
  xor    %eax,%eax
  call   <memcpy@plt>
  mov    %r15,%rdi
  call   <strlen@plt>
  mov    %r15,%rsi
  mov    %rbx,%rdi
  lea    0x3e0(%rsp),%r15
  mov    %eax,%edx
  xor    %eax,%eax
  call   <memcpy@plt>
  mov    0x28(%rsp),%rbp
  mov    %rbp,%rdi
  call   <strlen@plt>
  mov    %rbp,%rsi
  mov    %r15,%rdi
  mov    %eax,%edx
  xor    %eax,%eax
  call   <memcpy@plt>
  mov    %rbp,%rdi
  call   <strlen@plt>
  mov    %rbp,%rsi
  mov    %r14,%rdi
  mov    %eax,%edx
  xor    %eax,%eax
  call   <memcpy@plt>
  mov    0x20(%rsp),%rbp
  mov    %rbp,%rdi
  call   <strlen@plt>
  mov    %rbp,%rsi
  lea    0x420(%rsp),%rdi
  mov    %eax,%edx
  xor    %eax,%eax
  call   <memcpy@plt>
  mov    %rbp,%rdi
  call   <strlen@plt>
  mov    %rbp,%rsi
  lea    0x520(%rsp),%rdi
  mov    %eax,%edx
  xor    %eax,%eax
  call   <memcpy@plt>
  mov    0x10(%rsp),%rbp
  mov    %rbp,%rdi
  call   <strlen@plt>
  mov    %rbp,%rsi
  lea    0x460(%rsp),%rdi
  mov    %eax,%edx
  xor    %eax,%eax
  call   <memcpy@plt>
  mov    %rbp,%rdi
  call   <strlen@plt>
  mov    %rbp,%rsi
  lea    0x560(%rsp),%rdi
  lea    0x5a0(%rsp),%rbp
  mov    %eax,%edx
  xor    %eax,%eax
  call   <memcpy@plt>
  mov    %rbp,%rdx
  mov    %r12,%rax
  nopw   0x0(%rax,%rax,1)
L15:
  mov    (%rax),%ecx
  add    $0x4,%rax
  add    $0x10,%rdx
  xor    $0x36363636,%ecx
  mov    %ecx,-0x10(%rdx)
  mov    0x3c(%rax),%ecx
  xor    $0x36363636,%ecx
  mov    %ecx,-0xc(%rdx)
  mov    0x7c(%rax),%ecx
  xor    $0x36363636,%ecx
  mov    %ecx,-0x8(%rdx)
  mov    0xbc(%rax),%ecx
  xor    $0x36363636,%ecx
  mov    %ecx,-0x4(%rdx)
  cmp    %r15,%rax
  jne    L15
  lea    0xb0(%rsp),%r15
  lea    0x8a0(%rsp),%r12
  mov    %r15,%rdi
  call   <shasse2_init@plt>
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %r15,%rdi
  call   <shasse2_data@plt>
  mov    %rbp,%rax
  nopl   0x0(%rax,%rax,1)
L37:
  mov    (%rbx),%edx
  add    $0x4,%rbx
  add    $0x10,%rax
  xor    $0x5c5c5c5c,%edx
  mov    %edx,-0x10(%rax)
  mov    0x3c(%rbx),%edx
  xor    $0x5c5c5c5c,%edx
  mov    %edx,-0xc(%rax)
  mov    0x7c(%rbx),%edx
  xor    $0x5c5c5c5c,%edx
  mov    %edx,-0x8(%rax)
  mov    0xbc(%rbx),%edx
  xor    $0x5c5c5c5c,%edx
  mov    %edx,-0x4(%rax)
  cmp    %r14,%rbx
  jne    L37
  lea    0x100(%rsp),%r14
  add    $0x3,%r13d
  mov    %r14,%rdi
  call   <shasse2_init@plt>
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %r14,%rdi
  call   <shasse2_data@plt>
  mov    $0x100,%edx
  xor    %esi,%esi
  mov    %rbp,%rdi
  call   <memset@plt>
  mov    $0xffffa002,%edi
  mov    $0xffffa002,%ecx
  mov    $0xffffa002,%esi
  mov    %di,0x696(%rsp)
  mov    0x30(%rsp),%rdi
  movslq %r13d,%rax
  mov    $0xffffa002,%r8d
  mov    %cx,0x69e(%rsp)
  mov    %si,0x69a(%rsp)
  mov    %r8w,0x692(%rsp)
  movb   $0x80,0x5fc(%rsp)
  movb   $0x80,0x5f8(%rsp)
  movb   $0x80,0x5f4(%rsp)
  movb   $0x80,0x5f0(%rsp)
  mov    %rax,0x68(%rsp)
  movb   $0x1,0x80(%rsp,%rax,1)
  call   <strlen@plt>
  mov    %eax,%r13d
  xor    %eax,%eax
  call   <EVP_sha1@plt>
  mov    %r13d,%edx
  mov    %eax,%edi
  lea    0x6a0(%rsp),%rax
  sub    $0x8,%rsp
  mov    %rax,0x78(%rsp)
  mov    %rax,%r9
  push   $0x0
  mov    0x28(%rsp),%rbx
  mov    0x1c(%rsp),%r8d
  mov    0x40(%rsp),%rsi
  mov    %rbx,%rcx
  call   <HMAC@plt>
  mov    0x38(%rsp),%rdi
  call   <strlen@plt>
  mov    %eax,%r13d
  xor    %eax,%eax
  call   <EVP_sha1@plt>
  mov    0x1c(%rsp),%r8d
  mov    %rbx,%rcx
  mov    %r13d,%edx
  mov    0x38(%rsp),%rsi
  mov    %eax,%edi
  lea    0x730(%rsp),%rax
  movq   $0x0,(%rsp)
  mov    %rax,%r9
  mov    %rax,0x70(%rsp)
  call   <HMAC@plt>
  mov    0x30(%rsp),%rdi
  call   <strlen@plt>
  mov    %eax,%r13d
  xor    %eax,%eax
  call   <EVP_sha1@plt>
  mov    0x1c(%rsp),%r8d
  mov    %rbx,%rcx
  mov    %r13d,%edx
  mov    0x30(%rsp),%rsi
  mov    %eax,%edi
  lea    0x7b0(%rsp),%rax
  movq   $0x0,(%rsp)
  mov    %rax,%r9
  mov    %rax,0x68(%rsp)
  call   <HMAC@plt>
  mov    0x20(%rsp),%rdi
  call   <strlen@plt>
  mov    %eax,%r13d
  xor    %eax,%eax
  call   <EVP_sha1@plt>
  mov    0x1c(%rsp),%r8d
  mov    %rbx,%rcx
  mov    %r13d,%edx
  mov    0x20(%rsp),%rsi
  mov    %eax,%edi
  lea    0x830(%rsp),%rax
  movq   $0x0,(%rsp)
  mov    %rax,%r9
  mov    %rax,0x88(%rsp)
  mov    $0xfff,%r13d
  call   <HMAC@plt>
  mov    0x6b0(%rsp),%eax
  mov    %eax,0x5b0(%rsp)
  mov    0x730(%rsp),%eax
  mov    %eax,0x5b4(%rsp)
  mov    0x7b0(%rsp),%eax
  mov    %eax,0x5b8(%rsp)
  mov    0x830(%rsp),%eax
  mov    %eax,0x5bc(%rsp)
  mov    0x6b4(%rsp),%eax
  mov    %eax,0x5c0(%rsp)
  mov    0x734(%rsp),%eax
  mov    %eax,0x5c4(%rsp)
  mov    0x7b4(%rsp),%eax
  mov    %eax,0x5c8(%rsp)
  mov    0x834(%rsp),%eax
  mov    %eax,0x5cc(%rsp)
  mov    0x6b8(%rsp),%eax
  mov    %eax,0x5d0(%rsp)
  mov    0x738(%rsp),%eax
  mov    %eax,0x5d4(%rsp)
  mov    0x7b8(%rsp),%eax
  mov    %eax,0x5d8(%rsp)
  mov    0x838(%rsp),%eax
  mov    %eax,0x5dc(%rsp)
  mov    0x6bc(%rsp),%eax
  mov    %eax,0x5e0(%rsp)
  mov    0x73c(%rsp),%eax
  mov    %eax,0x5e4(%rsp)
  mov    0x7bc(%rsp),%eax
  mov    %eax,0x5e8(%rsp)
  mov    0x83c(%rsp),%eax
  mov    %eax,0x5ec(%rsp)
  mov    0x6c0(%rsp),%eax
  mov    %eax,0x5f0(%rsp)
  mov    0x740(%rsp),%eax
  mov    %eax,0x5f4(%rsp)
  mov    0x7c0(%rsp),%eax
  mov    %eax,0x5f8(%rsp)
  mov    0x840(%rsp),%eax
  mov    %eax,0x5fc(%rsp)
  pop    %r9
  pop    %r10
  lea    0x150(%rsp),%rbx
  nopw   0x0(%rax,%rax,1)
L29:
  mov    $0x50,%edx
  mov    %r15,%rsi
  mov    %rbx,%rdi
  xor    %eax,%eax
  call   <memcpy@plt>
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <shasse2_data@plt>
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <shasse2_ends@plt>
  mov    $0x50,%edx
  mov    %r14,%rsi
  mov    %rbx,%rdi
  xor    %eax,%eax
  call   <memcpy@plt>
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <shasse2_data@plt>
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <shasse2_ends@plt>
  mov    0x5a0(%rsp),%eax
  xor    %eax,0x6a0(%rsp)
  mov    0x5a4(%rsp),%eax
  xor    %eax,0x720(%rsp)
  mov    0x5a8(%rsp),%eax
  xor    %eax,0x7a0(%rsp)
  mov    0x5ac(%rsp),%eax
  xor    %eax,0x820(%rsp)
  mov    0x5b0(%rsp),%eax
  xor    %eax,0x6a4(%rsp)
  mov    0x5b4(%rsp),%eax
  xor    %eax,0x724(%rsp)
  mov    0x5b8(%rsp),%eax
  xor    %eax,0x7a4(%rsp)
  mov    0x5bc(%rsp),%eax
  xor    %eax,0x824(%rsp)
  mov    0x5c0(%rsp),%eax
  xor    %eax,0x6a8(%rsp)
  mov    0x5c4(%rsp),%eax
  xor    %eax,0x728(%rsp)
  mov    0x5c8(%rsp),%eax
  xor    %eax,0x7a8(%rsp)
  mov    0x5cc(%rsp),%eax
  xor    %eax,0x828(%rsp)
  mov    0x5d0(%rsp),%eax
  xor    %eax,0x6ac(%rsp)
  mov    0x5d4(%rsp),%eax
  xor    %eax,0x72c(%rsp)
  mov    0x5d8(%rsp),%eax
  xor    %eax,0x7ac(%rsp)
  mov    0x5dc(%rsp),%eax
  xor    %eax,0x82c(%rsp)
  mov    0x5e0(%rsp),%eax
  xor    %eax,0x6b0(%rsp)
  mov    0x5e4(%rsp),%eax
  xor    %eax,0x730(%rsp)
  mov    0x5e8(%rsp),%eax
  xor    %eax,0x7b0(%rsp)
  mov    0x5ec(%rsp),%eax
  xor    %eax,0x830(%rsp)
  sub    $0x1,%r13d
  jne    L29
  mov    0x30(%rsp),%rdi
  mov    0x68(%rsp),%rax
  movb   $0x2,0x80(%rsp,%rax,1)
  call   <strlen@plt>
  mov    %eax,%r13d
  xor    %eax,%eax
  call   <EVP_sha1@plt>
  sub    $0x8,%rsp
  mov    %r13d,%edx
  push   $0x0
  mov    0x1c(%rsp),%r8d
  mov    %eax,%edi
  mov    0x28(%rsp),%rcx
  mov    0x40(%rsp),%rsi
  lea    0x6c4(%rsp),%r9
  call   <HMAC@plt>
  mov    0x38(%rsp),%rdi
  call   <strlen@plt>
  mov    %eax,%r13d
  xor    %eax,%eax
  call   <EVP_sha1@plt>
  mov    0x1c(%rsp),%r8d
  mov    %r13d,%edx
  mov    0x28(%rsp),%rcx
  mov    0x38(%rsp),%rsi
  lea    0x744(%rsp),%r9
  mov    %eax,%edi
  movq   $0x0,(%rsp)
  call   <HMAC@plt>
  mov    0x30(%rsp),%rdi
  call   <strlen@plt>
  mov    %eax,%r13d
  xor    %eax,%eax
  call   <EVP_sha1@plt>
  mov    0x1c(%rsp),%r8d
  mov    %r13d,%edx
  mov    0x28(%rsp),%rcx
  mov    0x30(%rsp),%rsi
  lea    0x7c4(%rsp),%r9
  mov    %eax,%edi
  movq   $0x0,(%rsp)
  call   <HMAC@plt>
  mov    0x20(%rsp),%rdi
  call   <strlen@plt>
  mov    %eax,%r13d
  xor    %eax,%eax
  call   <EVP_sha1@plt>
  mov    0x1c(%rsp),%r8d
  mov    0x28(%rsp),%rcx
  mov    %r13d,%edx
  mov    0x20(%rsp),%rsi
  mov    %eax,%edi
  lea    0x844(%rsp),%r9
  movq   $0x0,(%rsp)
  mov    $0xfff,%r13d
  call   <HMAC@plt>
  mov    0x6c4(%rsp),%eax
  mov    %eax,0x5b0(%rsp)
  mov    0x744(%rsp),%eax
  mov    %eax,0x5b4(%rsp)
  mov    0x7c4(%rsp),%eax
  mov    %eax,0x5b8(%rsp)
  mov    0x844(%rsp),%eax
  mov    %eax,0x5bc(%rsp)
  mov    0x6c8(%rsp),%eax
  mov    %eax,0x5c0(%rsp)
  mov    0x748(%rsp),%eax
  mov    %eax,0x5c4(%rsp)
  mov    0x7c8(%rsp),%eax
  mov    %eax,0x5c8(%rsp)
  mov    0x848(%rsp),%eax
  mov    %eax,0x5cc(%rsp)
  mov    0x6cc(%rsp),%eax
  mov    %eax,0x5d0(%rsp)
  mov    0x74c(%rsp),%eax
  mov    %eax,0x5d4(%rsp)
  mov    0x7cc(%rsp),%eax
  mov    %eax,0x5d8(%rsp)
  mov    0x84c(%rsp),%eax
  mov    %eax,0x5dc(%rsp)
  mov    0x6d0(%rsp),%eax
  mov    %eax,0x5e0(%rsp)
  mov    0x750(%rsp),%eax
  mov    %eax,0x5e4(%rsp)
  mov    0x7d0(%rsp),%eax
  mov    %eax,0x5e8(%rsp)
  mov    0x850(%rsp),%eax
  mov    %eax,0x5ec(%rsp)
  mov    0x6d4(%rsp),%eax
  mov    %eax,0x5f0(%rsp)
  mov    0x754(%rsp),%eax
  mov    %eax,0x5f4(%rsp)
  mov    0x7d4(%rsp),%eax
  mov    %eax,0x5f8(%rsp)
  mov    0x854(%rsp),%eax
  mov    %eax,0x5fc(%rsp)
  pop    %rax
  pop    %rdx
  nop
L34:
  mov    $0x50,%edx
  mov    %r15,%rsi
  mov    %rbx,%rdi
  xor    %eax,%eax
  call   <memcpy@plt>
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <shasse2_data@plt>
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <shasse2_ends@plt>
  mov    $0x50,%edx
  mov    %r14,%rsi
  mov    %rbx,%rdi
  xor    %eax,%eax
  call   <memcpy@plt>
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <shasse2_data@plt>
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <shasse2_ends@plt>
  mov    0x5a0(%rsp),%eax
  xor    %eax,0x6b4(%rsp)
  mov    0x5a4(%rsp),%eax
  xor    %eax,0x734(%rsp)
  mov    0x5a8(%rsp),%eax
  xor    %eax,0x7b4(%rsp)
  mov    0x5ac(%rsp),%eax
  xor    %eax,0x834(%rsp)
  mov    0x5b0(%rsp),%eax
  xor    %eax,0x6b8(%rsp)
  mov    0x5b4(%rsp),%eax
  xor    %eax,0x738(%rsp)
  mov    0x5b8(%rsp),%eax
  xor    %eax,0x7b8(%rsp)
  mov    0x5bc(%rsp),%eax
  xor    %eax,0x838(%rsp)
  mov    0x5c0(%rsp),%eax
  xor    %eax,0x6bc(%rsp)
  mov    0x5c4(%rsp),%eax
  xor    %eax,0x73c(%rsp)
  mov    0x5c8(%rsp),%eax
  xor    %eax,0x7bc(%rsp)
  mov    0x5cc(%rsp),%eax
  xor    %eax,0x83c(%rsp)
  sub    $0x1,%r13d
  jne    L34
  mov    0x58(%rsp),%rsi
  mov    0x48(%rsp),%rdi
  mov    $0x20,%edx
  xor    %eax,%eax
  call   <memcpy@plt>
  mov    0x78(%rsp),%rsi
  mov    0x50(%rsp),%rdi
  xor    %eax,%eax
  mov    $0x20,%edx
  call   <memcpy@plt>
  mov    0x70(%rsp),%rsi
  mov    0x38(%rsp),%rdi
  xor    %eax,%eax
  mov    $0x20,%edx
  call   <memcpy@plt>
  mov    0x60(%rsp),%rsi
  mov    0x40(%rsp),%rdi
  xor    %eax,%eax
  mov    $0x20,%edx
  call   <memcpy@plt>
  mov    0xda8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L43
  add    $0xdb8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L43:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void calc_4pmk(char *_key1, char *_key2, char *_key3, char *_key4, char *_essid, unsigned char *_pmk1, unsigned char *_pmk2, unsigned char *_pmk3, unsigned char *_pmk4) {
  int slen;
  char essid[36] __attribute__((aligned(16)));
  char key1[128] __attribute__((aligned(16)));
  char key2[128] __attribute__((aligned(16)));
  char key3[128] __attribute__((aligned(16)));
  char key4[128] __attribute__((aligned(16)));
  unsigned char pmks[128 * 4] __attribute__((aligned(16)));
  unsigned char k_ipad[256] __attribute__((aligned(16)));
  unsigned char ctx_ipad[80] __attribute__((aligned(16)));
  unsigned char k_opad[256] __attribute__((aligned(16)));
  unsigned char ctx_opad[80] __attribute__((aligned(16)));
  unsigned char buffer[256] __attribute__((aligned(16)));
  unsigned char sha1_ctx[80] __attribute__((aligned(16)));
  unsigned char wrkbuf[1280] __attribute__((aligned(16)));
  uint i, *u, *v, *w, *u3, *v4;
  unsigned char *pmk1, *pmk2, *pmk3, *pmk4;
  pmk1 = pmks;
  pmk2 = pmks + 128;
  pmk3 = pmks + 128 * 2;
  pmk4 = pmks + 128 * 3;
  strncpy(essid, _essid, 35);
  strncpy(key1, _key1, 127);
  strncpy(key2, _key2, 127);
  strncpy(key3, _key3, 127);
  strncpy(key4, _key4, 127);
  slen = strlen(essid) + 4;
  memset(k_ipad, 0, sizeof(k_ipad));
  memset(k_opad, 0, sizeof(k_opad));
  memcpy(k_ipad, key1, strlen(key1));
  memcpy(k_opad, key1, strlen(key1));
  memcpy(k_ipad + 64, key2, strlen(key2));
  memcpy(k_opad + 64, key2, strlen(key2));
  memcpy(k_ipad + 128, key3, strlen(key3));
  memcpy(k_opad + 128, key3, strlen(key3));
  memcpy(k_ipad + 192, key4, strlen(key4));
  memcpy(k_opad + 192, key4, strlen(key4));
  u = (uint *)(k_ipad);
  v = (uint *)(k_ipad + 64);
  u3 = (uint *)(k_ipad + 128);
  v4 = (uint *)(k_ipad + 192);
  w = (uint *)buffer;
  for (i = 0; i < 16; i++) {
    *w++ = *u++ ^ 0x36363636;
    *w++ = *v++ ^ 0x36363636;
    *w++ = *u3++ ^ 0x36363636;
    *w++ = *v4++ ^ 0x36363636;
  }
  shasse2_init(ctx_ipad);
  shasse2_data(ctx_ipad, buffer, wrkbuf);
  u = (uint *)(k_opad);
  v = (uint *)(k_opad + 64);
  u3 = (uint *)(k_opad + 128);
  v4 = (uint *)(k_opad + 192);
  w = (uint *)buffer;
  for (i = 0; i < 16; i++) {
    *w++ = *u++ ^ 0x5C5C5C5C;
    *w++ = *v++ ^ 0x5C5C5C5C;
    *w++ = *u3++ ^ 0x5C5C5C5C;
    *w++ = *v4++ ^ 0x5C5C5C5C;
  }
  shasse2_init(ctx_opad);
  shasse2_data(ctx_opad, buffer, wrkbuf);
  memset(buffer, 0, sizeof(buffer));
  buffer[80] = buffer[84] = buffer[88] = buffer[92] = 0x80;
  buffer[242] = buffer[246] = buffer[250] = buffer[254] = 0x02;
  buffer[243] = buffer[247] = buffer[251] = buffer[255] = 0xA0;
  essid[slen - 1] = '\1';
  HMAC(EVP_sha1(), (unsigned char *)key1, strlen(key1), (unsigned char *)essid, slen, pmk1, NULL);
  HMAC(EVP_sha1(), (unsigned char *)key2, strlen(key2), (unsigned char *)essid, slen, pmk2, NULL);
  HMAC(EVP_sha1(), (unsigned char *)key3, strlen(key3), (unsigned char *)essid, slen, pmk3, NULL);
  HMAC(EVP_sha1(), (unsigned char *)key4, strlen(key4), (unsigned char *)essid, slen, pmk4, NULL);
  u = (uint *)pmk1;
  v = (uint *)pmk2;
  u3 = (uint *)pmk3;
  v4 = (uint *)pmk4;
  w = (uint *)buffer;
  *w++ = *u++;
  *w++ = *v++;
  *w++ = *u3++;
  *w++ = *v4++;
  *w++ = *u++;
  *w++ = *v++;
  *w++ = *u3++;
  *w++ = *v4++;
  *w++ = *u++;
  *w++ = *v++;
  *w++ = *u3++;
  *w++ = *v4++;
  *w++ = *u++;
  *w++ = *v++;
  *w++ = *u3++;
  *w++ = *v4++;
  *w++ = *u++;
  *w++ = *v++;
  *w++ = *u3++;
  *w++ = *v4++;
  for (i = 1; i < 4096; i++) {
    memcpy(sha1_ctx, ctx_ipad, 80);
    shasse2_data(sha1_ctx, buffer, wrkbuf);
    shasse2_ends(sha1_ctx, buffer);
    memcpy(sha1_ctx, ctx_opad, 80);
    shasse2_data(sha1_ctx, buffer, wrkbuf);
    shasse2_ends(sha1_ctx, buffer);
    u = (uint *)pmk1;
    v = (uint *)pmk2;
    u3 = (uint *)pmk3;
    v4 = (uint *)pmk4;
    w = (uint *)buffer;
    *u++ ^= *w++;
    *v++ ^= *w++;
    *u3++ ^= *w++;
    *v4++ ^= *w++;
    *u++ ^= *w++;
    *v++ ^= *w++;
    *u3++ ^= *w++;
    *v4++ ^= *w++;
    *u++ ^= *w++;
    *v++ ^= *w++;
    *u3++ ^= *w++;
    *v4++ ^= *w++;
    *u++ ^= *w++;
    *v++ ^= *w++;
    *u3++ ^= *w++;
    *v4++ ^= *w++;
    *u++ ^= *w++;
    *v++ ^= *w++;
    *u3++ ^= *w++;
    *v4++ ^= *w++;
  }
  essid[slen - 1] = '\2';
  HMAC(EVP_sha1(), (unsigned char *)key1, strlen(key1), (unsigned char *)essid, slen, pmk1 + 20, NULL);
  HMAC(EVP_sha1(), (unsigned char *)key2, strlen(key2), (unsigned char *)essid, slen, pmk2 + 20, NULL);
  HMAC(EVP_sha1(), (unsigned char *)key3, strlen(key3), (unsigned char *)essid, slen, pmk3 + 20, NULL);
  HMAC(EVP_sha1(), (unsigned char *)key4, strlen(key4), (unsigned char *)essid, slen, pmk4 + 20, NULL);
  u = (uint *)(pmk1 + 20);
  v = (uint *)(pmk2 + 20);
  u3 = (uint *)(pmk3 + 20);
  v4 = (uint *)(pmk4 + 20);
  w = (uint *)buffer;
  *w++ = *u++;
  *w++ = *v++;
  *w++ = *u3++;
  *w++ = *v4++;
  *w++ = *u++;
  *w++ = *v++;
  *w++ = *u3++;
  *w++ = *v4++;
  *w++ = *u++;
  *w++ = *v++;
  *w++ = *u3++;
  *w++ = *v4++;
  *w++ = *u++;
  *w++ = *v++;
  *w++ = *u3++;
  *w++ = *v4++;
  *w++ = *u++;
  *w++ = *v++;
  *w++ = *u3++;
  *w++ = *v4++;
  for (i = 1; i < 4096; i++) {
    memcpy(sha1_ctx, ctx_ipad, 80);
    shasse2_data(sha1_ctx, buffer, wrkbuf);
    shasse2_ends(sha1_ctx, buffer);
    memcpy(sha1_ctx, ctx_opad, 80);
    shasse2_data(sha1_ctx, buffer, wrkbuf);
    shasse2_ends(sha1_ctx, buffer);
    u = (uint *)(pmk1 + 20);
    v = (uint *)(pmk2 + 20);
    u3 = (uint *)(pmk3 + 20);
    v4 = (uint *)(pmk4 + 20);
    w = (uint *)buffer;
    *u++ ^= *w++;
    *v++ ^= *w++;
    *u3++ ^= *w++;
    *v4++ ^= *w++;
    *u++ ^= *w++;
    *v++ ^= *w++;
    *u3++ ^= *w++;
    *v4++ ^= *w++;
    *u++ ^= *w++;
    *v++ ^= *w++;
    *u3++ ^= *w++;
    *v4++ ^= *w++;
  }
  memcpy(_pmk3, pmk3, 32);
  memcpy(_pmk4, pmk4, 32);
  memcpy(_pmk1, pmk1, 32);
  memcpy(_pmk2, pmk2, 32);
}
```