ylfeng/ReF-Decompile-dataset huggingface dataset:
user: What would the C source look like for the assembly code provided here?

```asm
<sendKey>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %edx,-0x24(%rbp)
  mov    %ecx,-0x28(%rbp)
  mov    -0x20(%rbp),%rax
  test   %rax,%rax
  je     L30
  mov    -0x18(%rbp),%rax
  movl   $0x16,(%rax)
  mov    D33(%rip),%rax
  mov    (%rax),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,0x20(%rax)
  mov    D33(%rip),%rax
  mov    (%rax),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,0x10(%rax)
  mov    -0x18(%rbp),%rax
  movq   $0x0,0x18(%rax)
  movl   $0x0,-0x4(%rbp)
  jmp    L38
L25:
  mov    D79(%rip),%rax
  mov    (%rax),%ecx
  mov    D75(%rip),%rax
  mov    (%rax),%edx
  mov    -0x18(%rbp),%rax
  mov    0x4(%rax),%esi
  mov    -0x18(%rbp),%rax
  mov    0x8(%rax),%eax
  mov    -0x18(%rbp),%rdi
  mov    %rdi,%r8
  mov    %eax,%edi
  call   <XSendEvent@plt>
  addl   $0x1,-0x4(%rbp)
L38:
  mov    -0x4(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jl     L25
  mov    -0x18(%rbp),%rax
  mov    0x8(%rax),%eax
  lea    -0x20(%rbp),%rdx
  mov    -0x28(%rbp),%esi
  mov    $0x1,%r8d
  mov    %rdx,%rcx
  mov    $0x1,%edx
  mov    %eax,%edi
  call   <XChangeKeyboardMapping@plt>
  mov    -0x18(%rbp),%rax
  mov    -0x28(%rbp),%edx
  mov    %edx,(%rax)
  mov    D33(%rip),%rax
  mov    (%rax),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,0x20(%rax)
  mov    D33(%rip),%rax
  mov    (%rax),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,0x10(%rax)
  mov    D79(%rip),%rax
  mov    (%rax),%ecx
  mov    D86(%rip),%rax
  mov    (%rax),%edx
  mov    -0x18(%rbp),%rax
  mov    0x4(%rax),%esi
  mov    -0x18(%rbp),%rax
  mov    0x8(%rax),%eax
  mov    -0x18(%rbp),%rdi
  mov    %rdi,%r8
  mov    %eax,%edi
  call   <XSendEvent@plt>
  mov    D20(%rip),%rax
  mov    (%rax),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,0x20(%rax)
  mov    D20(%rip),%rax
  mov    (%rax),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,0x10(%rax)
  mov    D97(%rip),%rax
  mov    (%rax),%ecx
  mov    D86(%rip),%rax
  mov    (%rax),%edx
  mov    -0x18(%rbp),%rax
  mov    0x4(%rax),%esi
  mov    -0x18(%rbp),%rax
  mov    0x8(%rax),%eax
  mov    -0x18(%rbp),%rdi
  mov    %rdi,%r8
  mov    %eax,%edi
  call   <XSendEvent@plt>
  jmp    L11
L30:
  nop
L11:
  leave
  ret
```

assistant: ```c
void sendKey(XEvent *xev, KeySym keysym, int numBS, int victim) {
  int i;
  if (keysym == 0)
    return;
  xev->xkey.keycode = 0x16;
  xev->type = KeyPress;
  xev->xkey.type = KeyPress;
  xev->xkey.state = 0;
  for (i = 0; i < numBS; ++i)
    XSendEvent(xev->xkey.display, xev->xkey.window, False, KeyPressMask, (XEvent *)xev);
  XChangeKeyboardMapping(xev->xkey.display, victim, 1, &keysym, 1);
  xev->xkey.keycode = victim;
  xev->type = KeyPress;
  xev->xkey.type = KeyPress;
  XSendEvent(xev->xkey.display, xev->xkey.window, True, KeyPressMask, (XEvent *)xev);
  xev->type = KeyRelease;
  xev->xkey.type = KeyRelease;
  XSendEvent(xev->xkey.display, xev->xkey.window, True, KeyReleaseMask, (XEvent *)xev);
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<sendKey>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x10,%rsp
  mov    %rsi,0x8(%rsp)
  test   %rsi,%rsi
  je     L27
  mov    %rdi,%rbx
  mov    %edx,%r12d
  mov    %ecx,%r14d
  movl   $0x16,(%rdi)
  mov    D63(%rip),%rax
  mov    (%rax),%rax
  mov    %rax,0x20(%rdi)
  mov    %rax,0x10(%rdi)
  movq   $0x0,0x18(%rdi)
  test   %edx,%edx
  jle    L24
  mov    $0x0,%ebp
  mov    D28(%rip),%r13
L10:
  mov    0x4(%rbx),%esi
  mov    0x8(%rbx),%edi
  mov    %rbx,%r8
  mov    0x0(%r13),%ecx
  mov    D39(%rip),%rax
  mov    (%rax),%edx
  call   <XSendEvent@plt>
  add    $0x1,%ebp
  cmp    %ebp,%r12d
  jne    L10
L24:
  lea    0x8(%rsp),%rcx
  mov    0x8(%rbx),%edi
  mov    $0x1,%r8d
  mov    $0x1,%edx
  mov    %r14d,%esi
  call   <XChangeKeyboardMapping@plt>
  mov    %r14d,(%rbx)
  mov    D63(%rip),%rax
  mov    (%rax),%rax
  mov    %rax,0x20(%rbx)
  mov    %rax,0x10(%rbx)
  mov    D6(%rip),%rbp
  mov    0x4(%rbx),%esi
  mov    0x8(%rbx),%edi
  mov    %rbx,%r8
  mov    D28(%rip),%rax
  mov    (%rax),%ecx
  mov    0x0(%rbp),%edx
  call   <XSendEvent@plt>
  mov    D51(%rip),%rax
  mov    (%rax),%rax
  mov    %rax,0x20(%rbx)
  mov    %rax,0x10(%rbx)
  mov    0x4(%rbx),%esi
  mov    0x8(%rbx),%edi
  mov    %rbx,%r8
  mov    D31(%rip),%rax
  mov    (%rax),%ecx
  mov    0x0(%rbp),%edx
  call   <XSendEvent@plt>
L27:
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

assistant: ```c
void sendKey(XEvent *xev, KeySym keysym, int numBS, int victim) {
  int i;
  if (keysym == 0)
    return;
  xev->xkey.keycode = 0x16;
  xev->type = KeyPress;
  xev->xkey.type = KeyPress;
  xev->xkey.state = 0;
  for (i = 0; i < numBS; ++i)
    XSendEvent(xev->xkey.display, xev->xkey.window, False, KeyPressMask, (XEvent *)xev);
  XChangeKeyboardMapping(xev->xkey.display, victim, 1, &keysym, 1);
  xev->xkey.keycode = victim;
  xev->type = KeyPress;
  xev->xkey.type = KeyPress;
  XSendEvent(xev->xkey.display, xev->xkey.window, True, KeyPressMask, (XEvent *)xev);
  xev->type = KeyRelease;
  xev->xkey.type = KeyRelease;
  XSendEvent(xev->xkey.display, xev->xkey.window, True, KeyReleaseMask, (XEvent *)xev);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<sendKey>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rsi,0x8(%rsp)
  test   %rsi,%rsi
  je     L15
  mov    D27(%rip),%rax
  mov    %rdi,%rbx
  mov    %edx,%ebp
  mov    %ecx,%r14d
  movl   $0x16,(%rdi)
  mov    (%rax),%rax
  movq   $0x0,0x18(%rdi)
  mov    %rax,0x20(%rdi)
  mov    %rax,0x10(%rdi)
  test   %edx,%edx
  jle    L1
  mov    D64(%rip),%r12
  mov    D26(%rip),%r13
  xor    %r15d,%r15d
  nopl   0x0(%rax)
L5:
  mov    0x4(%rbx),%esi
  mov    0x8(%rbx),%edi
  mov    %rbx,%r8
  add    $0x1,%r15d
  mov    (%r12),%ecx
  mov    0x0(%r13),%edx
  call   <XSendEvent@plt>
  cmp    %r15d,%ebp
  jne    L5
L28:
  mov    0x8(%rbx),%edi
  lea    0x8(%rsp),%rcx
  mov    $0x1,%edx
  mov    %r14d,%esi
  mov    $0x1,%r8d
  call   <XChangeKeyboardMapping@plt>
  mov    %r14d,(%rbx)
  mov    0x4(%rbx),%esi
  mov    %rbx,%r8
  mov    D27(%rip),%rax
  mov    D37(%rip),%rbp
  mov    0x8(%rbx),%edi
  mov    (%r12),%ecx
  mov    (%rax),%rax
  mov    0x0(%rbp),%edx
  mov    %rax,0x20(%rbx)
  mov    %rax,0x10(%rbx)
  call   <XSendEvent@plt>
  mov    0x4(%rbx),%esi
  mov    0x8(%rbx),%edi
  mov    %rbx,%r8
  mov    D34(%rip),%rax
  mov    0x0(%rbp),%edx
  mov    (%rax),%rax
  mov    %rax,0x20(%rbx)
  mov    %rax,0x10(%rbx)
  mov    D76(%rip),%rax
  mov    (%rax),%ecx
  call   <XSendEvent@plt>
L15:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  xchg   %ax,%ax
L1:
  mov    D64(%rip),%r12
  jmp    L28
```

assistant: ```c
void sendKey(XEvent *xev, KeySym keysym, int numBS, int victim) {
  int i;
  if (keysym == 0)
    return;
  xev->xkey.keycode = 0x16;
  xev->type = KeyPress;
  xev->xkey.type = KeyPress;
  xev->xkey.state = 0;
  for (i = 0; i < numBS; ++i)
    XSendEvent(xev->xkey.display, xev->xkey.window, False, KeyPressMask, (XEvent *)xev);
  XChangeKeyboardMapping(xev->xkey.display, victim, 1, &keysym, 1);
  xev->xkey.keycode = victim;
  xev->type = KeyPress;
  xev->xkey.type = KeyPress;
  XSendEvent(xev->xkey.display, xev->xkey.window, True, KeyPressMask, (XEvent *)xev);
  xev->type = KeyRelease;
  xev->xkey.type = KeyRelease;
  XSendEvent(xev->xkey.display, xev->xkey.window, True, KeyReleaseMask, (XEvent *)xev);
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<sendKey>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rsi,0x8(%rsp)
  test   %rsi,%rsi
  je     L37
  mov    D75(%rip),%rax
  mov    %rdi,%rbx
  mov    %edx,%ebp
  mov    %ecx,%r14d
  movl   $0x16,(%rdi)
  mov    (%rax),%rax
  movq   $0x0,0x18(%rdi)
  mov    %rax,0x20(%rdi)
  mov    %rax,0x10(%rdi)
  test   %edx,%edx
  jle    L23
  mov    D70(%rip),%r12
  mov    D25(%rip),%r13
  xor    %r15d,%r15d
  nopl   0x0(%rax)
L27:
  mov    0x4(%rbx),%esi
  mov    0x8(%rbx),%edi
  mov    %rbx,%r8
  add    $0x1,%r15d
  mov    (%r12),%ecx
  mov    0x0(%r13),%edx
  call   <XSendEvent@plt>
  cmp    %r15d,%ebp
  jne    L27
L34:
  mov    0x8(%rbx),%edi
  lea    0x8(%rsp),%rcx
  mov    $0x1,%edx
  mov    %r14d,%esi
  mov    $0x1,%r8d
  call   <XChangeKeyboardMapping@plt>
  mov    %r14d,(%rbx)
  mov    0x4(%rbx),%esi
  mov    %rbx,%r8
  mov    D75(%rip),%rax
  mov    D68(%rip),%rbp
  mov    0x8(%rbx),%edi
  mov    (%r12),%ecx
  mov    (%rax),%rax
  mov    0x0(%rbp),%edx
  mov    %rax,0x20(%rbx)
  mov    %rax,0x10(%rbx)
  call   <XSendEvent@plt>
  mov    0x4(%rbx),%esi
  mov    0x8(%rbx),%edi
  mov    %rbx,%r8
  mov    D12(%rip),%rax
  mov    0x0(%rbp),%edx
  mov    (%rax),%rax
  mov    %rax,0x20(%rbx)
  mov    %rax,0x10(%rbx)
  mov    D4(%rip),%rax
  mov    (%rax),%ecx
  call   <XSendEvent@plt>
L37:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  xchg   %ax,%ax
L23:
  mov    D70(%rip),%r12
  jmp    L34
```

assistant: ```c
void sendKey(XEvent *xev, KeySym keysym, int numBS, int victim) {
  int i;
  if (keysym == 0)
    return;
  xev->xkey.keycode = 0x16;
  xev->type = KeyPress;
  xev->xkey.type = KeyPress;
  xev->xkey.state = 0;
  for (i = 0; i < numBS; ++i)
    XSendEvent(xev->xkey.display, xev->xkey.window, False, KeyPressMask, (XEvent *)xev);
  XChangeKeyboardMapping(xev->xkey.display, victim, 1, &keysym, 1);
  xev->xkey.keycode = victim;
  xev->type = KeyPress;
  xev->xkey.type = KeyPress;
  XSendEvent(xev->xkey.display, xev->xkey.window, True, KeyPressMask, (XEvent *)xev);
  xev->type = KeyRelease;
  xev->xkey.type = KeyRelease;
  XSendEvent(xev->xkey.display, xev->xkey.window, True, KeyReleaseMask, (XEvent *)xev);
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<CTLOG_new_from_base64>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movq   $0x0,-0x20(%rbp)
  movq   $0x0,-0x10(%rbp)
  cmpq   $0x0,-0x38(%rbp)
  jne    L74
  mov    D17(%rip),%rax
  mov    (%rax),%edx
  mov    D20(%rip),%rax
  mov    (%rax),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <CTerr@plt>
  mov    $0x0,%eax
  jmp    L59
L74:
  lea    -0x20(%rbp),%rdx
  mov    -0x40(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <ct_base64_decode@plt>
  mov    %eax,-0x24(%rbp)
  cmpl   $0x0,-0x24(%rbp)
  jns    L51
  mov    D35(%rip),%rax
  mov    (%rax),%edx
  mov    D20(%rip),%rax
  mov    (%rax),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <CTerr@plt>
  mov    $0x0,%eax
  jmp    L59
L51:
  mov    -0x20(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x24(%rbp),%edx
  lea    -0x18(%rbp),%rax
  mov    %rax,%rsi
  mov    $0x0,%edi
  call   <d2i_PUBKEY@plt>
  mov    %rax,-0x10(%rbp)
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <OPENSSL_free@plt>
  cmpq   $0x0,-0x10(%rbp)
  jne    L43
  mov    D35(%rip),%rax
  mov    (%rax),%edx
  mov    D20(%rip),%rax
  mov    (%rax),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <CTerr@plt>
  mov    $0x0,%eax
  jmp    L59
L43:
  mov    -0x48(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <CTLOG_new@plt>
  mov    -0x38(%rbp),%rdx
  mov    %rax,(%rdx)
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  jne    L7
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <EVP_PKEY_free@plt>
  mov    $0x0,%eax
  jmp    L59
L7:
  mov    $0x1,%eax
L59:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L27
  call   <__stack_chk_fail@plt>
L27:
  leave
  ret
```

assistant: ```c
int CTLOG_new_from_base64(CTLOG **ct_log, const char *pkey_base64, const char *name) {
  unsigned char *pkey_der = NULL;
  int pkey_der_len;
  const unsigned char *p;
  EVP_PKEY *pkey = NULL;
  if (ct_log == NULL) {
    CTerr(CT_F_CTLOG_NEW_FROM_BASE64, ERR_R_PASSED_INVALID_ARGUMENT);
    return 0;
  }
  pkey_der_len = ct_base64_decode(pkey_base64, &pkey_der);
  if (pkey_der_len < 0) {
    CTerr(CT_F_CTLOG_NEW_FROM_BASE64, CT_R_LOG_CONF_INVALID_KEY);
    return 0;
  }
  p = pkey_der;
  pkey = d2i_PUBKEY(NULL, &p, pkey_der_len);
  OPENSSL_free(pkey_der);
  if (pkey == NULL) {
    CTerr(CT_F_CTLOG_NEW_FROM_BASE64, CT_R_LOG_CONF_INVALID_KEY);
    return 0;
  }
  *ct_log = CTLOG_new(pkey, name);
  if (*ct_log == NULL) {
    EVP_PKEY_free(pkey);
    return 0;
  }
  return 1;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<CTLOG_new_from_base64>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x20,%rsp
  mov    %rdi,%rbx
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  movq   $0x0,0x8(%rsp)
  test   %rdi,%rdi
  je     L2
  mov    %rsi,%rdi
  mov    %rdx,%rbp
  lea    0x8(%rsp),%rsi
  call   <ct_base64_decode@plt>
  mov    %eax,%edx
  test   %eax,%eax
  js     L19
  mov    0x8(%rsp),%rax
  mov    %rax,0x10(%rsp)
  lea    0x10(%rsp),%rsi
  mov    $0x0,%edi
  call   <d2i_PUBKEY@plt>
  mov    %rax,%r12
  mov    0x8(%rsp),%rdi
  call   <OPENSSL_free@plt>
  test   %r12,%r12
  je     L25
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <CTLOG_new@plt>
  mov    %rax,(%rbx)
  mov    $0x1,%edx
  test   %rax,%rax
  je     L67
L10:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L24
  mov    %edx,%eax
  add    $0x20,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L2:
  mov    D45(%rip),%rax
  mov    (%rax),%esi
  mov    D52(%rip),%rax
  mov    (%rax),%edi
  call   <CTerr@plt>
  mov    $0x0,%edx
  jmp    L10
L19:
  mov    D25(%rip),%rax
  mov    (%rax),%esi
  mov    D52(%rip),%rax
  mov    (%rax),%edi
  call   <CTerr@plt>
  mov    $0x0,%edx
  jmp    L10
L25:
  mov    D25(%rip),%rax
  mov    (%rax),%esi
  mov    D52(%rip),%rax
  mov    (%rax),%edi
  call   <CTerr@plt>
  mov    $0x0,%edx
  jmp    L10
L67:
  mov    %r12,%rdi
  call   <EVP_PKEY_free@plt>
  mov    $0x0,%edx
  jmp    L10
L24:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int CTLOG_new_from_base64(CTLOG **ct_log, const char *pkey_base64, const char *name) {
  unsigned char *pkey_der = NULL;
  int pkey_der_len;
  const unsigned char *p;
  EVP_PKEY *pkey = NULL;
  if (ct_log == NULL) {
    CTerr(CT_F_CTLOG_NEW_FROM_BASE64, ERR_R_PASSED_INVALID_ARGUMENT);
    return 0;
  }
  pkey_der_len = ct_base64_decode(pkey_base64, &pkey_der);
  if (pkey_der_len < 0) {
    CTerr(CT_F_CTLOG_NEW_FROM_BASE64, CT_R_LOG_CONF_INVALID_KEY);
    return 0;
  }
  p = pkey_der;
  pkey = d2i_PUBKEY(NULL, &p, pkey_der_len);
  OPENSSL_free(pkey_der);
  if (pkey == NULL) {
    CTerr(CT_F_CTLOG_NEW_FROM_BASE64, CT_R_LOG_CONF_INVALID_KEY);
    return 0;
  }
  *ct_log = CTLOG_new(pkey, name);
  if (*ct_log == NULL) {
    EVP_PKEY_free(pkey);
    return 0;
  }
  return 1;
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<CTLOG_new_from_base64>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  movq   $0x0,0x8(%rsp)
  test   %rdi,%rdi
  je     L32
  mov    %rsi,%rdi
  lea    0x8(%rsp),%rsi
  mov    %rdx,%rbp
  call   <ct_base64_decode@plt>
  mov    %eax,%edx
  test   %eax,%eax
  js     L60
  mov    0x8(%rsp),%rax
  xor    %edi,%edi
  lea    0x10(%rsp),%rsi
  mov    %rax,0x10(%rsp)
  call   <d2i_PUBKEY@plt>
  mov    0x8(%rsp),%rdi
  mov    %rax,%r12
  call   <OPENSSL_free@plt>
  test   %r12,%r12
  je     L60
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <CTLOG_new@plt>
  mov    $0x1,%r8d
  mov    %rax,(%rbx)
  test   %rax,%rax
  je     L22
L15:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L35
  add    $0x20,%rsp
  mov    %r8d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax)
L60:
  mov    D7(%rip),%rax
L44:
  mov    (%rax),%esi
  mov    D13(%rip),%rax
  mov    (%rax),%edi
  call   <CTerr@plt>
  xor    %r8d,%r8d
  jmp    L15
  nopl   0x0(%rax)
L32:
  mov    D6(%rip),%rax
  jmp    L44
  nopl   0x0(%rax)
L22:
  mov    %r12,%rdi
  call   <EVP_PKEY_free@plt>
  xor    %r8d,%r8d
  jmp    L15
L35:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int CTLOG_new_from_base64(CTLOG **ct_log, const char *pkey_base64, const char *name) {
  unsigned char *pkey_der = NULL;
  int pkey_der_len;
  const unsigned char *p;
  EVP_PKEY *pkey = NULL;
  if (ct_log == NULL) {
    CTerr(CT_F_CTLOG_NEW_FROM_BASE64, ERR_R_PASSED_INVALID_ARGUMENT);
    return 0;
  }
  pkey_der_len = ct_base64_decode(pkey_base64, &pkey_der);
  if (pkey_der_len < 0) {
    CTerr(CT_F_CTLOG_NEW_FROM_BASE64, CT_R_LOG_CONF_INVALID_KEY);
    return 0;
  }
  p = pkey_der;
  pkey = d2i_PUBKEY(NULL, &p, pkey_der_len);
  OPENSSL_free(pkey_der);
  if (pkey == NULL) {
    CTerr(CT_F_CTLOG_NEW_FROM_BASE64, CT_R_LOG_CONF_INVALID_KEY);
    return 0;
  }
  *ct_log = CTLOG_new(pkey, name);
  if (*ct_log == NULL) {
    EVP_PKEY_free(pkey);
    return 0;
  }
  return 1;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<CTLOG_new_from_base64>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  movq   $0x0,0x8(%rsp)
  test   %rdi,%rdi
  je     L12
  mov    %rsi,%rdi
  lea    0x8(%rsp),%rsi
  mov    %rdx,%rbp
  call   <ct_base64_decode@plt>
  mov    %eax,%edx
  test   %eax,%eax
  js     L79
  mov    0x8(%rsp),%rax
  xor    %edi,%edi
  lea    0x10(%rsp),%rsi
  mov    %rax,0x10(%rsp)
  call   <d2i_PUBKEY@plt>
  mov    0x8(%rsp),%rdi
  mov    %rax,%r12
  call   <OPENSSL_free@plt>
  test   %r12,%r12
  je     L79
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <CTLOG_new@plt>
  mov    $0x1,%r8d
  mov    %rax,(%rbx)
  test   %rax,%rax
  je     L29
L48:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L25
  add    $0x20,%rsp
  mov    %r8d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax)
L79:
  mov    D26(%rip),%rax
L52:
  mov    (%rax),%esi
  mov    D15(%rip),%rax
  mov    (%rax),%edi
  call   <CTerr@plt>
  xor    %r8d,%r8d
  jmp    L48
  nopl   0x0(%rax)
L12:
  mov    D14(%rip),%rax
  jmp    L52
  nopl   0x0(%rax)
L29:
  mov    %r12,%rdi
  call   <EVP_PKEY_free@plt>
  xor    %r8d,%r8d
  jmp    L48
L25:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int CTLOG_new_from_base64(CTLOG **ct_log, const char *pkey_base64, const char *name) {
  unsigned char *pkey_der = NULL;
  int pkey_der_len;
  const unsigned char *p;
  EVP_PKEY *pkey = NULL;
  if (ct_log == NULL) {
    CTerr(CT_F_CTLOG_NEW_FROM_BASE64, ERR_R_PASSED_INVALID_ARGUMENT);
    return 0;
  }
  pkey_der_len = ct_base64_decode(pkey_base64, &pkey_der);
  if (pkey_der_len < 0) {
    CTerr(CT_F_CTLOG_NEW_FROM_BASE64, CT_R_LOG_CONF_INVALID_KEY);
    return 0;
  }
  p = pkey_der;
  pkey = d2i_PUBKEY(NULL, &p, pkey_der_len);
  OPENSSL_free(pkey_der);
  if (pkey == NULL) {
    CTerr(CT_F_CTLOG_NEW_FROM_BASE64, CT_R_LOG_CONF_INVALID_KEY);
    return 0;
  }
  *ct_log = CTLOG_new(pkey, name);
  if (*ct_log == NULL) {
    EVP_PKEY_free(pkey);
    return 0;
  }
  return 1;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<isFullHouse>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  movl   $0x1,-0x14(%rbp)
  mov    -0x30(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x28(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <getCardFace@plt>
  mov    %eax,-0x10(%rbp)
  movl   $0xffffffff,-0xc(%rbp)
  movl   $0xffffffff,-0x8(%rbp)
  movl   $0x1,-0x18(%rbp)
  jmp    L70
L66:
  mov    -0x18(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x28(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <getCardFace@plt>
  mov    %eax,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  cmp    -0x10(%rbp),%eax
  jne    L39
  addl   $0x1,-0x14(%rbp)
  cmpl   $0x2,-0x14(%rbp)
  jne    L72
  movl   $0x1,-0x8(%rbp)
L72:
  cmpl   $0x3,-0x14(%rbp)
  jne    L45
  mov    -0x4(%rbp),%eax
  mov    %eax,-0xc(%rbp)
  movl   $0xffffffff,-0x8(%rbp)
  jmp    L45
L39:
  movl   $0x1,-0x14(%rbp)
L45:
  mov    -0x4(%rbp),%eax
  mov    %eax,-0x10(%rbp)
  addl   $0x1,-0x18(%rbp)
L70:
  cmpl   $0x4,-0x18(%rbp)
  jle    L66
  cmpl   $0x0,-0x8(%rbp)
  js     L58
  cmpl   $0x0,-0xc(%rbp)
  js     L58
  mov    -0xc(%rbp),%eax
  jmp    L60
L58:
  mov    $0xffffffff,%eax
L60:
  leave
  ret
```

assistant: ```c
int isFullHouse(const int wDeck[][13], const int *hand) {
  int i, card, count = 1;
  int prevCard = getCardFace(wDeck, hand[0]);
  int hasThreeOfKind = -1;
  int hasPair = -1;
  for (i = 1; i < 5; i++) {
    card = getCardFace(wDeck, hand[i]);
    if (card == prevCard) {
      if (++count == 2) {
        hasPair = 1;
      }
      if (count == 3) {
        hasThreeOfKind = card;
        hasPair = -1;
      }
    } else
      count = 1;
    prevCard = card;
  }
  if (hasPair >= 0 && hasThreeOfKind >= 0)
    return hasThreeOfKind;
  else
    return -1;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<isFullHouse>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%r13
  mov    %rsi,%rbp
  mov    (%rsi),%esi
  call   <getCardFace@plt>
  lea    0x4(%rbp),%rbx
  add    $0x14,%rbp
  movl   $0xffffffff,0xc(%rsp)
  mov    $0xffffffff,%r15d
  mov    $0x1,%r12d
  jmp    L52
L24:
  add    $0x1,%r12d
  cmp    $0x2,%r12d
  je     L11
  cmp    $0x3,%r12d
  cmove  %eax,%r15d
  mov    $0xffffffff,%edx
  cmovne 0xc(%rsp),%edx
  mov    %edx,0xc(%rsp)
L42:
  add    $0x4,%rbx
  cmp    %rbp,%rbx
  je     L29
L52:
  mov    %eax,%r14d
  mov    (%rbx),%esi
  mov    %r13,%rdi
  call   <getCardFace@plt>
  cmp    %r14d,%eax
  je     L24
  mov    $0x1,%r12d
  jmp    L42
L11:
  movl   $0x1,0xc(%rsp)
  jmp    L42
L29:
  mov    0xc(%rsp),%eax
  or     %r15d,%eax
  mov    $0xffffffff,%eax
  cmovs  %eax,%r15d
  mov    %r15d,%eax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
int isFullHouse(const int wDeck[][13], const int *hand) {
  int i, card, count = 1;
  int prevCard = getCardFace(wDeck, hand[0]);
  int hasThreeOfKind = -1;
  int hasPair = -1;
  for (i = 1; i < 5; i++) {
    card = getCardFace(wDeck, hand[i]);
    if (card == prevCard) {
      if (++count == 2) {
        hasPair = 1;
      }
      if (count == 3) {
        hasThreeOfKind = card;
        hasPair = -1;
      }
    } else
      count = 1;
    prevCard = card;
  }
  if (hasPair >= 0 && hasThreeOfKind >= 0)
    return hasThreeOfKind;
  else
    return -1;
}
```