ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<cfrac>:
  endbr64
  movsd  D51(%rip),%xmm5
  movsd  D31(%rip),%xmm7
  movapd %xmm0,%xmm6
  mov    $0x1,%eax
  movq   D22(%rip),%xmm3
  movsd  D9(%rip),%xmm9
  addsd  %xmm5,%xmm1
  movapd %xmm5,%xmm10
  movsd  D29(%rip),%xmm4
  movsd  D32(%rip),%xmm8
  movapd %xmm9,%xmm2
  subsd  %xmm0,%xmm1
  divsd  %xmm1,%xmm10
  movapd %xmm10,%xmm12
  jmp    L20
  nopl   (%rax)
L42:
  movapd %xmm5,%xmm10
  cmpnltsd %xmm4,%xmm0
  divsd  %xmm11,%xmm10
  andpd  %xmm0,%xmm2
  andnpd %xmm4,%xmm0
  orpd   %xmm0,%xmm2
L43:
  movapd %xmm2,%xmm0
  mulsd  %xmm10,%xmm0
  mulsd  %xmm0,%xmm12
  subsd  %xmm5,%xmm0
  andpd  %xmm3,%xmm0
  comisd %xmm0,%xmm8
  ja     L14
  add    $0x1,%eax
  cmp    $0x400,%eax
  je     L14
L20:
  pxor   %xmm11,%xmm11
  movapd %xmm6,%xmm0
  addsd  %xmm7,%xmm1
  cvtsi2sd %eax,%xmm11
  subsd  %xmm11,%xmm0
  mulsd  %xmm11,%xmm0
  mulsd  %xmm0,%xmm10
  divsd  %xmm2,%xmm0
  movapd %xmm10,%xmm11
  addsd  %xmm1,%xmm11
  movapd %xmm11,%xmm10
  andpd  %xmm3,%xmm10
  comisd %xmm10,%xmm4
  movapd %xmm0,%xmm2
  addsd  %xmm1,%xmm2
  movapd %xmm2,%xmm0
  andpd  %xmm3,%xmm0
  jbe    L42
  comisd %xmm0,%xmm4
  ja     L14
  movapd %xmm9,%xmm10
  jmp    L43
  cs nopw 0x0(%rax,%rax,1)
L14:
  movapd %xmm12,%xmm0
  ret
```

tool_calls: name: parse_data
arguments: data_label: D51
type: byte[8]
name: parse_data
arguments: data_label: D31
type: byte[8]
name: parse_data
arguments: data_label: D22
type: qword
name: parse_data
arguments: data_label: D9
type: byte[8]
name: parse_data
arguments: data_label: D29
type: byte[8]
name: parse_data
arguments: data_label: D32
type: byte[8]

tool: {"D51": [0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x3f]}

tool: {"D31": [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40]}

tool: D22: 9223372036854775807

tool: {"D9": [0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x49]}

tool: {"D29": [0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x36]}

tool: {"D32": [0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x3c]}

assistant: ```c
double cfrac(double n, double x) {
  int i;
  double a, b, c, d, e, f;
  b = x + 1 - n;
  c = 1 / (2.2204460492503131e-16 * 2.2204460492503131e-16 * 2.2204460492503131e-16);
  f = d = 1 / b;
  for (i = 1; i < 1024; i++) {
    a = i * (n - i);
    d = a * d + (b += 2);
    if (fabs(d) < (2.2204460492503131e-16 * 2.2204460492503131e-16 * 2.2204460492503131e-16))
      d = (2.2204460492503131e-16 * 2.2204460492503131e-16 * 2.2204460492503131e-16);
    c = b + a / c;
    if (fabs(c) < (2.2204460492503131e-16 * 2.2204460492503131e-16 * 2.2204460492503131e-16))
      c = (2.2204460492503131e-16 * 2.2204460492503131e-16 * 2.2204460492503131e-16);
    d = 1 / d;
    f *= e = d * c;
    if (fabs(e - 1) < 2.2204460492503131e-16)
      break;
  }
  return f;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<json_emit_unquoted_str>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    %ecx,-0x20(%rbp)
  cmpl   $0x0,-0x1c(%rbp)
  jle    L1
  cmpl   $0x0,-0x20(%rbp)
  jle    L1
  mov    -0x1c(%rbp),%edx
  mov    -0x20(%rbp),%eax
  cmp    %eax,%edx
  cmovle %edx,%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x4(%rbp),%edx
  mov    -0x28(%rbp),%rcx
  mov    -0x18(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x4(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jge    L1
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
L1:
  mov    -0x20(%rbp),%eax
  leave
  ret
```

assistant: ```c
int json_emit_unquoted_str(char *buf, int buf_len, const char *str, int len) {
  if (buf_len > 0 && len > 0) {
    int n = len < buf_len ? len : buf_len;
    memcpy(buf, str, n);
    if (n < buf_len) {
      buf[n] = '\0';
    }
  }
  return len;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<json_emit_unquoted_str>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %esi,%ebp
  mov    %ecx,%ebx
  test   %esi,%esi
  jle    L22
  mov    %rdi,%r12
  mov    %rdx,%rsi
  test   %ecx,%ecx
  jg     L16
L22:
  mov    %ebx,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L16:
  cmp    %ecx,%ebp
  mov    %ecx,%r13d
  cmovle %ebp,%r13d
  mov    %r13d,%edx
  call   <memcpy@plt>
  cmp    %r13d,%ebp
  jle    L22
  movslq %r13d,%r13
  movb   $0x0,(%r12,%r13,1)
  jmp    L22
```

assistant: ```c
int json_emit_unquoted_str(char *buf, int buf_len, const char *str, int len) {
  if (buf_len > 0 && len > 0) {
    int n = len < buf_len ? len : buf_len;
    memcpy(buf, str, n);
    if (n < buf_len) {
      buf[n] = '\0';
    }
  }
  return len;
}
```
user: What is the c source code of the assembly code below:

```asm
<json_emit_unquoted_str>:
  endbr64
  push   %r13
  push   %r12
  mov    %ecx,%r12d
  push   %rbp
  push   %rbx
  movslq %esi,%rbx
  sub    $0x8,%rsp
  test   %ebx,%ebx
  jle    L21
  test   %ecx,%ecx
  jg     L16
L21:
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopw   0x0(%rax,%rax,1)
L16:
  cmp    %ecx,%ebx
  movslq %ecx,%r13
  mov    %rdx,%rsi
  mov    %rdi,%rbp
  cmovle %rbx,%r13
  mov    %r13d,%edx
  call   <memcpy@plt>
  cmp    %r13d,%ebx
  jle    L21
  movb   $0x0,0x0(%rbp,%r13,1)
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
int json_emit_unquoted_str(char *buf, int buf_len, const char *str, int len) {
  if (buf_len > 0 && len > 0) {
    int n = len < buf_len ? len : buf_len;
    memcpy(buf, str, n);
    if (n < buf_len) {
      buf[n] = '\0';
    }
  }
  return len;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<json_emit_unquoted_str>:
  endbr64
  push   %r13
  push   %r12
  mov    %ecx,%r12d
  push   %rbp
  push   %rbx
  movslq %esi,%rbx
  sub    $0x8,%rsp
  test   %ebx,%ebx
  jle    L9
  test   %ecx,%ecx
  jg     L13
L9:
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopw   0x0(%rax,%rax,1)
L13:
  cmp    %ecx,%ebx
  movslq %ecx,%r13
  mov    %rdx,%rsi
  mov    %rdi,%rbp
  cmovle %rbx,%r13
  mov    %r13d,%edx
  call   <memcpy@plt>
  cmp    %r13d,%ebx
  jle    L9
  movb   $0x0,0x0(%rbp,%r13,1)
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
int json_emit_unquoted_str(char *buf, int buf_len, const char *str, int len) {
  if (buf_len > 0 && len > 0) {
    int n = len < buf_len ? len : buf_len;
    memcpy(buf, str, n);
    if (n < buf_len) {
      buf[n] = '\0';
    }
  }
  return len;
}
```
user: What is the c source code of the assembly code below:

```asm
<int_crb_dispatch>:
  endbr64
  mov    %rdi,%rax
  cmp    $0x30,%rdi
  ja     L101
  sub    $0x8,%rsp
  mov    %rsi,%rdi
  mov    %rdx,%rsi
  mov    %rcx,%rdx
  lea    D6(%rip),%rcx
  movslq (%rcx,%rax,4),%rax
  add    %rcx,%rax
  notrack jmp *%rax
  call   <crb_getc@plt>
  jmp    L65
  call   <crb_puts@plt>
  jmp    L65
  call   <crb_reset_term@plt>
  jmp    L65
  call   <crb_set_term_int@plt>
  jmp    L65
  call   <crb_set_term_ctl@plt>
  jmp    L65
  call   <crb_process_keycode@plt>
  jmp    L65
  call   <crb_open@plt>
  jmp    L65
  call   <crb_close@plt>
  jmp    L65
  call   <crb_ioctl@plt>
  jmp    L65
  mov    %r8,%rcx
  call   <crb_read@plt>
  jmp    L65
  mov    %r8,%rcx
  call   <crb_write@plt>
  jmp    L65
  call   <crb_set_env@plt>
  jmp    L65
  call   <crb_reset_env@plt>
  jmp    L65
  call   <crb_get_env@plt>
  jmp    L65
  mov    $0x0,%eax
  call   <crb_save_env@plt>
  jmp    L65
  call   <crb_pswitch@plt>
  jmp    L65
  movabs $0x8000000000000000,%rax
L65:
  add    $0x8,%rsp
  ret
L101:
  movabs $0x8000000000000000,%rax
  ret
```

assistant: ```c
unsigned long __attribute__((used)) int_crb_dispatch(long select, long a1, long a2, long a3, long a4) {
  switch (select) {
  case 0x01:
    return crb_getc(a1);
  case 0x02:
    return crb_puts(a1, (const char *)a2, a3);
  case 0x03:
    return crb_reset_term(a1);
  case 0x04:
    return crb_set_term_int(a1, a2);
  case 0x05:
    return crb_set_term_ctl(a1, a2);
  case 0x06:
    return crb_process_keycode(a1, a2, a3);
  case 0x10:
    return crb_open((const char *)a1, a2);
  case 0x11:
    return crb_close(a1);
  case 0x12:
    return crb_ioctl(a1);
  case 0x13:
    return crb_read(a1, a2, (char *)a3, a4);
  case 0x14:
    return crb_write(a1, a2, (const char *)a3, a4);
  case 0x20:
    return crb_set_env(a1, (const char *)a2, a3);
  case 0x21:
    return crb_reset_env(a1, (char *)a2, a3);
  case 0x22:
    return crb_get_env(a1, (char *)a2, a3);
  case 0x23:
    return crb_save_env();
  case 0x30:
    return crb_pswitch(a1, a2);
  }
  return 0x8000000000000000ul;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<int_crb_dispatch>:
  endbr64
  mov    %rdi,%rax
  mov    %rsi,%rdi
  mov    %rdx,%rsi
  mov    %rcx,%rdx
  cmp    $0x30,%rax
  ja     L0
  lea    D9(%rip),%rcx
  movslq (%rcx,%rax,4),%rax
  add    %rcx,%rax
  notrack jmp *%rax
  nopw   0x0(%rax,%rax,1)
L0:
  movabs $0x8000000000000000,%rax
  ret
  nopl   0x0(%rax,%rax,1)
  jmp    11a0 <crb_getc@plt>
  nopl   (%rax)
  jmp    11d0 <crb_puts@plt>
  nopl   (%rax)
  jmp    1190 <crb_reset_term@plt>
  nopl   (%rax)
  jmp    11b0 <crb_set_term_int@plt>
  nopl   (%rax)
  jmp    1180 <crb_set_term_ctl@plt>
  nopl   (%rax)
  jmp    1230 <crb_process_keycode@plt>
  nopl   (%rax)
  jmp    11f0 <crb_open@plt>
  nopl   (%rax)
  jmp    11c0 <crb_close@plt>
  nopl   (%rax)
  jmp    1150 <crb_ioctl@plt>
  nopl   (%rax)
  mov    %r8,%rcx
  jmp    11e0 <crb_read@plt>
  mov    %r8,%rcx
  jmp    1210 <crb_write@plt>
  nopl   0x0(%rax,%rax,1)
  jmp    1220 <crb_set_env@plt>
  nopl   (%rax)
  jmp    1140 <crb_reset_env@plt>
  nopl   (%rax)
  jmp    1160 <crb_get_env@plt>
  nopl   (%rax)
  xor    %eax,%eax
  jmp    1170 <crb_save_env@plt>
  nop
  jmp    1200 <crb_pswitch@plt>
```

assistant: ```c
unsigned long __attribute__((used)) int_crb_dispatch(long select, long a1, long a2, long a3, long a4) {
  switch (select) {
  case 0x01:
    return crb_getc(a1);
  case 0x02:
    return crb_puts(a1, (const char *)a2, a3);
  case 0x03:
    return crb_reset_term(a1);
  case 0x04:
    return crb_set_term_int(a1, a2);
  case 0x05:
    return crb_set_term_ctl(a1, a2);
  case 0x06:
    return crb_process_keycode(a1, a2, a3);
  case 0x10:
    return crb_open((const char *)a1, a2);
  case 0x11:
    return crb_close(a1);
  case 0x12:
    return crb_ioctl(a1);
  case 0x13:
    return crb_read(a1, a2, (char *)a3, a4);
  case 0x14:
    return crb_write(a1, a2, (const char *)a3, a4);
  case 0x20:
    return crb_set_env(a1, (const char *)a2, a3);
  case 0x21:
    return crb_reset_env(a1, (char *)a2, a3);
  case 0x22:
    return crb_get_env(a1, (char *)a2, a3);
  case 0x23:
    return crb_save_env();
  case 0x30:
    return crb_pswitch(a1, a2);
  }
  return 0x8000000000000000ul;
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<int_crb_dispatch>:
  endbr64
  mov    %rdi,%rax
  mov    %rsi,%rdi
  mov    %rdx,%rsi
  mov    %rcx,%rdx
  cmp    $0x30,%rax
  ja     L5
  lea    D4(%rip),%rcx
  movslq (%rcx,%rax,4),%rax
  add    %rcx,%rax
  notrack jmp *%rax
  nopw   0x0(%rax,%rax,1)
L5:
  movabs $0x8000000000000000,%rax
  ret
  nopl   0x0(%rax,%rax,1)
  jmp    11a0 <crb_getc@plt>
  nopl   (%rax)
  jmp    11d0 <crb_puts@plt>
  nopl   (%rax)
  jmp    1190 <crb_reset_term@plt>
  nopl   (%rax)
  jmp    11b0 <crb_set_term_int@plt>
  nopl   (%rax)
  jmp    1180 <crb_set_term_ctl@plt>
  nopl   (%rax)
  jmp    1230 <crb_process_keycode@plt>
  nopl   (%rax)
  jmp    11f0 <crb_open@plt>
  nopl   (%rax)
  jmp    11c0 <crb_close@plt>
  nopl   (%rax)
  jmp    1150 <crb_ioctl@plt>
  nopl   (%rax)
  mov    %r8,%rcx
  jmp    11e0 <crb_read@plt>
  mov    %r8,%rcx
  jmp    1210 <crb_write@plt>
  nopl   0x0(%rax,%rax,1)
  jmp    1220 <crb_set_env@plt>
  nopl   (%rax)
  jmp    1140 <crb_reset_env@plt>
  nopl   (%rax)
  jmp    1160 <crb_get_env@plt>
  nopl   (%rax)
  xor    %eax,%eax
  jmp    1170 <crb_save_env@plt>
  nop
  jmp    1200 <crb_pswitch@plt>
```

assistant: ```c
unsigned long __attribute__((used)) int_crb_dispatch(long select, long a1, long a2, long a3, long a4) {
  switch (select) {
  case 0x01:
    return crb_getc(a1);
  case 0x02:
    return crb_puts(a1, (const char *)a2, a3);
  case 0x03:
    return crb_reset_term(a1);
  case 0x04:
    return crb_set_term_int(a1, a2);
  case 0x05:
    return crb_set_term_ctl(a1, a2);
  case 0x06:
    return crb_process_keycode(a1, a2, a3);
  case 0x10:
    return crb_open((const char *)a1, a2);
  case 0x11:
    return crb_close(a1);
  case 0x12:
    return crb_ioctl(a1);
  case 0x13:
    return crb_read(a1, a2, (char *)a3, a4);
  case 0x14:
    return crb_write(a1, a2, (const char *)a3, a4);
  case 0x20:
    return crb_set_env(a1, (const char *)a2, a3);
  case 0x21:
    return crb_reset_env(a1, (char *)a2, a3);
  case 0x22:
    return crb_get_env(a1, (char *)a2, a3);
  case 0x23:
    return crb_save_env();
  case 0x30:
    return crb_pswitch(a1, a2);
  }
  return 0x8000000000000000ul;
}
```
user: Translate the below assembly code into C programming language:

```asm
<clo1>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x8(%rbp)
  movsd  %xmm0,-0x10(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  je     L4
  mov    -0x8(%rbp),%rax
  movsd  (%rax),%xmm1
  movsd  -0x10(%rbp),%xmm0
  addsd  %xmm0,%xmm0
  addsd  %xmm1,%xmm0
  jmp    L10
L4:
  movsd  -0x10(%rbp),%xmm0
  addsd  %xmm0,%xmm0
L10:
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  pop    %rbp
  ret
```

assistant: ```c
double clo1(void *context, double a) {
  if (context)
    return *((double *)context) + a * 2;
  return a * 2;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<clo1>:
  endbr64
  test   %rdi,%rdi
  je     L6
  addsd  %xmm0,%xmm0
  addsd  (%rdi),%xmm0
  ret
L6:
  addsd  %xmm0,%xmm0
  ret
```

assistant: ```c
double clo1(void *context, double a) {
  if (context)
    return *((double *)context) + a * 2;
  return a * 2;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<clo1>:
  endbr64
  addsd  %xmm0,%xmm0
  test   %rdi,%rdi
  je     L2
  addsd  (%rdi),%xmm0
L2:
  ret
```

assistant: ```c
double clo1(void *context, double a) {
  if (context)
    return *((double *)context) + a * 2;
  return a * 2;
}
```
user: What is the c source code of the assembly code below:

```asm
<clo1>:
  endbr64
  addsd  %xmm0,%xmm0
  test   %rdi,%rdi
  je     L6
  addsd  (%rdi),%xmm0
L6:
  ret
```

assistant: ```c
double clo1(void *context, double a) {
  if (context)
    return *((double *)context) + a * 2;
  return a * 2;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<p_matpow_by_squaring>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %rdi,-0x48(%rbp)
  mov    %rsi,-0x50(%rbp)
  mov    %edx,-0x54(%rbp)
  mov    %rcx,-0x60(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x50(%rbp),%rdx
  mov    -0x60(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <p_mateye@plt>
  cmpl   $0x0,-0x54(%rbp)
  je     L76
  cmpl   $0x1,-0x54(%rbp)
  jne    L49
  mov    -0x50(%rbp),%rcx
  mov    -0x60(%rbp),%rdx
  mov    -0x50(%rbp),%rsi
  mov    -0x48(%rbp),%rax
  mov    %rax,%rdi
  call   <p_matcopy@plt>
  jmp    L71
L49:
  lea    -0x20(%rbp),%rdx
  lea    -0x28(%rbp),%rcx
  mov    -0x50(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <pdims_@plt>
  mov    -0x28(%rbp),%eax
  mov    %eax,-0x38(%rbp)
  mov    -0x24(%rbp),%eax
  mov    %eax,-0x34(%rbp)
  mov    -0x38(%rbp),%eax
  imul   -0x34(%rbp),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x30(%rbp)
  jmp    L40
L58:
  mov    -0x54(%rbp),%eax
  and    $0x1,%eax
  test   %eax,%eax
  je     L75
  mov    -0x50(%rbp),%r8
  mov    -0x30(%rbp),%rdi
  mov    -0x50(%rbp),%rcx
  mov    -0x48(%rbp),%rdx
  mov    -0x50(%rbp),%rsi
  mov    -0x60(%rbp),%rax
  mov    %r8,%r9
  mov    %rdi,%r8
  mov    %rax,%rdi
  call   <p_matprod@plt>
  mov    -0x50(%rbp),%rcx
  mov    -0x60(%rbp),%rdx
  mov    -0x50(%rbp),%rsi
  mov    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <p_matcopy@plt>
L75:
  sarl   -0x54(%rbp)
  mov    -0x50(%rbp),%r8
  mov    -0x30(%rbp),%rdi
  mov    -0x50(%rbp),%rcx
  mov    -0x48(%rbp),%rdx
  mov    -0x50(%rbp),%rsi
  mov    -0x48(%rbp),%rax
  mov    %r8,%r9
  mov    %rdi,%r8
  mov    %rax,%rdi
  call   <p_matprod@plt>
  mov    -0x50(%rbp),%rcx
  mov    -0x48(%rbp),%rdx
  mov    -0x50(%rbp),%rsi
  mov    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <p_matcopy@plt>
L40:
  cmpl   $0x0,-0x54(%rbp)
  jne    L58
  mov    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  jmp    L71
L76:
  nop
L71:
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L8
  call   <__stack_chk_fail@plt>
L8:
  leave
  ret
```

assistant: ```c
void p_matpow_by_squaring(double *A, int *desca, int b, double *P) {
  int n, m;
  int ldm[2];
  int blacs[5];
  double *TMP;
  p_mateye(P, desca);
  if (b == 0)
    return;
  if (b == 1) {
    p_matcopy(A, desca, P, desca);
    return;
  }
  pdims_(desca, ldm, blacs);
  m = ldm[0];
  n = ldm[1];
  TMP = malloc(m * n * sizeof(double));
  while (b) {
    if (b & 1) {
      p_matprod(P, desca, A, desca, TMP, desca);
      p_matcopy(TMP, desca, P, desca);
    }
    b >>= 1;
    p_matprod(A, desca, A, desca, TMP, desca);
    p_matcopy(TMP, desca, A, desca);
  }
  free(TMP);
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<p_matpow_by_squaring>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x30,%rsp
  mov    %rdi,%r12
  mov    %rsi,%rbx
  mov    %edx,%ebp
  mov    %rcx,%r14
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  mov    %rcx,%rdi
  call   <p_mateye@plt>
  test   %ebp,%ebp
  je     L77
  cmp    $0x1,%ebp
  je     L46
  lea    0x10(%rsp),%rdx
  lea    0x8(%rsp),%rsi
  mov    %rbx,%rdi
  call   <pdims_@plt>
  mov    0x8(%rsp),%edi
  imul   0xc(%rsp),%edi
  shl    $0x3,%edi
  call   <malloc@plt>
  mov    %rax,%r13
  jmp    L54
L46:
  mov    %rbx,%rcx
  mov    %r14,%rdx
  mov    %rbx,%rsi
  mov    %r12,%rdi
  call   <p_matcopy@plt>
  jmp    L77
L26:
  sar    %ebp
  mov    %rbx,%r9
  mov    %r13,%r8
  mov    %rbx,%rcx
  mov    %r12,%rdx
  mov    %rbx,%rsi
  mov    %r12,%rdi
  call   <p_matprod@plt>
  mov    %rbx,%rcx
  mov    %r12,%rdx
  mov    %rbx,%rsi
  mov    %r13,%rdi
  call   <p_matcopy@plt>
  test   %ebp,%ebp
  je     L72
L54:
  test   $0x1,%bpl
  je     L26
  mov    %rbx,%r9
  mov    %r13,%r8
  mov    %rbx,%rcx
  mov    %r12,%rdx
  mov    %rbx,%rsi
  mov    %r14,%rdi
  call   <p_matprod@plt>
  mov    %rbx,%rcx
  mov    %r14,%rdx
  mov    %rbx,%rsi
  mov    %r13,%rdi
  call   <p_matcopy@plt>
  jmp    L26
L72:
  mov    %r13,%rdi
  call   <free@plt>
L77:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L70
  add    $0x30,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L70:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void p_matpow_by_squaring(double *A, int *desca, int b, double *P) {
  int n, m;
  int ldm[2];
  int blacs[5];
  double *TMP;
  p_mateye(P, desca);
  if (b == 0)
    return;
  if (b == 1) {
    p_matcopy(A, desca, P, desca);
    return;
  }
  pdims_(desca, ldm, blacs);
  m = ldm[0];
  n = ldm[1];
  TMP = malloc(m * n * sizeof(double));
  while (b) {
    if (b & 1) {
      p_matprod(P, desca, A, desca, TMP, desca);
      p_matcopy(TMP, desca, P, desca);
    }
    b >>= 1;
    p_matprod(A, desca, A, desca, TMP, desca);
    p_matcopy(TMP, desca, A, desca);
  }
  free(TMP);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<p_matpow_by_squaring>:
  endbr64
  push   %r14
  mov    %rcx,%r14
  push   %r13
  push   %r12
  mov    %rdi,%r12
  mov    %rcx,%rdi
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %edx,%ebx
  sub    $0x30,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  call   <p_mateye@plt>
  test   %ebx,%ebx
  je     L40
  cmp    $0x1,%ebx
  je     L50
  lea    0x10(%rsp),%rdx
  lea    0x8(%rsp),%rsi
  mov    %rbp,%rdi
  call   <pdims_@plt>
  mov    0x8(%rsp),%edi
  imul   0xc(%rsp),%edi
  shl    $0x3,%edi
  call   <malloc@plt>
  mov    %rax,%r13
  jmp    L15
  nopl   0x0(%rax)
L41:
  mov    %rbp,%rcx
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %r12,%rdi
  mov    %rbp,%r9
  mov    %r13,%r8
  sar    %ebx
  call   <p_matprod@plt>
  mov    %rbp,%rcx
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %r13,%rdi
  call   <p_matcopy@plt>
  test   %ebx,%ebx
  je     L1
L15:
  test   $0x1,%bl
  je     L41
  mov    %rbp,%rcx
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %r14,%rdi
  mov    %rbp,%r9
  mov    %r13,%r8
  call   <p_matprod@plt>
  mov    %rbp,%rcx
  mov    %r14,%rdx
  mov    %rbp,%rsi
  mov    %r13,%rdi
  call   <p_matcopy@plt>
  jmp    L41
  nopl   (%rax)
L1:
  mov    %r13,%rdi
  call   <free@plt>
L40:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L53
  add    $0x30,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   (%rax)
L50:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L53
  add    $0x30,%rsp
  mov    %rbp,%rcx
  mov    %r14,%rdx
  mov    %rbp,%rsi
  pop    %rbx
  mov    %r12,%rdi
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  jmp    1110 <p_matcopy@plt>
L53:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void p_matpow_by_squaring(double *A, int *desca, int b, double *P) {
  int n, m;
  int ldm[2];
  int blacs[5];
  double *TMP;
  p_mateye(P, desca);
  if (b == 0)
    return;
  if (b == 1) {
    p_matcopy(A, desca, P, desca);
    return;
  }
  pdims_(desca, ldm, blacs);
  m = ldm[0];
  n = ldm[1];
  TMP = malloc(m * n * sizeof(double));
  while (b) {
    if (b & 1) {
      p_matprod(P, desca, A, desca, TMP, desca);
      p_matcopy(TMP, desca, P, desca);
    }
    b >>= 1;
    p_matprod(A, desca, A, desca, TMP, desca);
    p_matcopy(TMP, desca, A, desca);
  }
  free(TMP);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<p_matpow_by_squaring>:
  endbr64
  push   %r14
  mov    %rcx,%r14
  push   %r13
  push   %r12
  mov    %rdi,%r12
  mov    %rcx,%rdi
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %edx,%ebx
  sub    $0x30,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  call   <p_mateye@plt>
  test   %ebx,%ebx
  je     L67
  cmp    $0x1,%ebx
  je     L43
  lea    0x10(%rsp),%rdx
  lea    0x8(%rsp),%rsi
  mov    %rbp,%rdi
  call   <pdims_@plt>
  mov    0x8(%rsp),%edi
  imul   0xc(%rsp),%edi
  shl    $0x3,%edi
  call   <malloc@plt>
  mov    %rax,%r13
  jmp    L21
  nopl   0x0(%rax)
L10:
  mov    %rbp,%rcx
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %r12,%rdi
  mov    %rbp,%r9
  mov    %r13,%r8
  sar    %ebx
  call   <p_matprod@plt>
  mov    %rbp,%rcx
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %r13,%rdi
  call   <p_matcopy@plt>
  test   %ebx,%ebx
  je     L32
L21:
  test   $0x1,%bl
  je     L10
  mov    %rbp,%rcx
  mov    %r12,%rdx
  mov    %rbp,%rsi
  mov    %r14,%rdi
  mov    %rbp,%r9
  mov    %r13,%r8
  call   <p_matprod@plt>
  mov    %rbp,%rcx
  mov    %r14,%rdx
  mov    %rbp,%rsi
  mov    %r13,%rdi
  call   <p_matcopy@plt>
  jmp    L10
  nopl   (%rax)
L32:
  mov    %r13,%rdi
  call   <free@plt>
L67:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L5
  add    $0x30,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   (%rax)
L43:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L5
  add    $0x30,%rsp
  mov    %rbp,%rcx
  mov    %r14,%rdx
  mov    %rbp,%rsi
  pop    %rbx
  mov    %r12,%rdi
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  jmp    1110 <p_matcopy@plt>
L5:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void p_matpow_by_squaring(double *A, int *desca, int b, double *P) {
  int n, m;
  int ldm[2];
  int blacs[5];
  double *TMP;
  p_mateye(P, desca);
  if (b == 0)
    return;
  if (b == 1) {
    p_matcopy(A, desca, P, desca);
    return;
  }
  pdims_(desca, ldm, blacs);
  m = ldm[0];
  n = ldm[1];
  TMP = malloc(m * n * sizeof(double));
  while (b) {
    if (b & 1) {
      p_matprod(P, desca, A, desca, TMP, desca);
      p_matcopy(TMP, desca, P, desca);
    }
    b >>= 1;
    p_matprod(A, desca, A, desca, TMP, desca);
    p_matcopy(TMP, desca, A, desca);
  }
  free(TMP);
}
```