ylfeng/ReF-Decompile-dataset huggingface dataset:
user: Demonstrate the C code that generates the assembly output below:

```asm
<extract>:
  endbr64
  push   %r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  mov    %rdx,%rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x8,%rsp
  movsbl (%rdi),%edi
  cmp    $0x22,%dil
  jne    L6
  movsbl 0x1(%rbx),%edi
  add    $0x1,%rbx
L6:
  call   <isdigit@plt>
  test   %rax,%rax
  je     L111
L78:
  xor    %r13d,%r13d
  jmp    L104
  nopl   0x0(%rax,%rax,1)
L107:
  movsbl -0x1(%rdx),%eax
  lea    0x0(%r13,%r13,4),%rcx
  mov    %rdx,%rbx
  sub    $0x30,%eax
  cltq
  lea    (%rax,%rcx,2),%r13
L104:
  movsbl (%rbx),%edi
  call   <isdigit@plt>
  lea    0x1(%rbx),%rdx
  test   %rax,%rax
  jne    L107
  mov    %r13,(%r12)
  movzbl (%rbx),%eax
  cmp    $0x22,%al
  jne    L89
  movzbl 0x1(%rbx),%eax
  mov    %rdx,%rbx
L89:
  test   %al,%al
  je     L40
L75:
  movsbl 0x1(%rbx),%edi
  lea    0x1(%rbx),%r12
  cmp    $0x22,%dil
  jne    L25
  movsbl 0x2(%rbx),%edi
  lea    0x2(%rbx),%r12
L25:
  call   <isdigit@plt>
  test   %rax,%rax
  je     L63
L105:
  xor    %ebx,%ebx
  jmp    L76
L113:
  movsbl (%r12),%eax
  lea    (%rbx,%rbx,4),%ebx
  add    $0x1,%r12
  lea    -0x30(%rax,%rbx,2),%ebx
L76:
  movsbl (%r12),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L113
  mov    %bx,0x0(%rbp)
  add    $0x8,%rsp
  movswl %bx,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L63:
  mov    $0x6,%esi
  lea    D16(%rip),%rdi
  call   <die@plt>
  jmp    L105
  nopl   0x0(%rax,%rax,1)
L40:
  mov    $0x5,%esi
  lea    D4(%rip),%rdi
  call   <die@plt>
  jmp    L75
  cs nopw 0x0(%rax,%rax,1)
L111:
  mov    $0x4,%esi
  lea    D12(%rip),%rdi
  call   <die@plt>
  jmp    L78
```

tool_calls: name: retrieve_data
arguments: label: D16
datatype: string
name: retrieve_data
arguments: label: D4
datatype: string
name: retrieve_data
arguments: label: D12
datatype: string

tool: D16: expected number for location index

tool: D4: expected comma after ip address

tool: D12: expected number for ip address

assistant: ```c
int extract(char *buf, long *addr, short *ndx) {
  if ('"' == *buf)
    buf++;
  if (!isdigit(*buf))
    die("expected number for ip address", 4);
  long ip = 0;
  while (isdigit(*buf)) {
    ip *= 10;
    ip += (*buf++) - '0';
  }
  *addr = ip;
  if ('"' == *buf)
    buf++;
  if (!',' == *buf++)
    die("expected comma after ip address", 5);
  if ('"' == *buf)
    buf++;
  if (!isdigit(*buf))
    die("expected number for location index", 6);
  short nub = 0;
  while (isdigit(*buf)) {
    nub *= 10;
    nub += (*buf++) - '0';
  }
  return *ndx = nub;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  lea    D6(%rip),%rax
  mov    %rax,%rdi
  call   <chdir@plt>
  mov    $0x0,%eax
  pop    %rbp
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D6
datatype: string

tool: D6: .

assistant: ```c
int main() {
  chdir(".");
  return 0;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  lea    D8(%rip),%rdi
  call   <chdir@plt>
  mov    $0x0,%eax
  add    $0x8,%rsp
  ret
```

tool_calls: name: disassemble_data
arguments: label: D8
type_infered: string

tool: D8: .

assistant: ```c
int main() {
  chdir(".");
  return 0;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  lea    D8(%rip),%rdi
  call   <chdir@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  ret
```

tool_calls: name: retrieve_data
arguments: label: D8
type_infered: string

tool: D8: .

assistant: ```c
int main() {
  chdir(".");
  return 0;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  lea    D5(%rip),%rdi
  call   <chdir@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  ret
```

tool_calls: name: extract_symbolic_data
arguments: tag: D5
datatype: string

tool: D5: .

assistant: ```c
int main() {
  chdir(".");
  return 0;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<find_bl_verify_shsh>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <get_os_version@plt>
  mov    %eax,-0x4(%rbp)
  cmpl   $0x4,-0x4(%rbp)
  jle    L21
  cmpl   $0x7,-0x4(%rbp)
  jg     L21
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <find_bl_verify_shsh_5_6_7@plt>
  jmp    L2
L21:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <find_bl_verify_shsh_generic@plt>
L2:
  leave
  ret
```

assistant: ```c
void *find_bl_verify_shsh(struct iboot_img *iboot_in) {
  int os_vers = get_os_version(iboot_in);
  if (os_vers >= 5 && os_vers <= 7) {
    return find_bl_verify_shsh_5_6_7(iboot_in);
  }
  return find_bl_verify_shsh_generic(iboot_in);
}
```
user: Translate the below assembly code into C programming language:

```asm
<find_bl_verify_shsh>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  call   <get_os_version@plt>
  sub    $0x5,%eax
  cmp    $0x2,%eax
  jbe    L9
  mov    %rbx,%rdi
  call   <find_bl_verify_shsh_generic@plt>
L8:
  pop    %rbx
  ret
L9:
  mov    %rbx,%rdi
  call   <find_bl_verify_shsh_5_6_7@plt>
  jmp    L8
```

assistant: ```c
void *find_bl_verify_shsh(struct iboot_img *iboot_in) {
  int os_vers = get_os_version(iboot_in);
  if (os_vers >= 5 && os_vers <= 7) {
    return find_bl_verify_shsh_5_6_7(iboot_in);
  }
  return find_bl_verify_shsh_generic(iboot_in);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<find_bl_verify_shsh>:
  endbr64
  push   %rbp
  mov    %rdi,%rbp
  call   <get_os_version@plt>
  mov    %rbp,%rdi
  sub    $0x5,%eax
  cmp    $0x2,%eax
  jbe    L1
  pop    %rbp
  jmp    1090 <find_bl_verify_shsh_generic@plt>
  xchg   %ax,%ax
L1:
  pop    %rbp
  jmp    1070 <find_bl_verify_shsh_5_6_7@plt>
```

assistant: ```c
void *find_bl_verify_shsh(struct iboot_img *iboot_in) {
  int os_vers = get_os_version(iboot_in);
  if (os_vers >= 5 && os_vers <= 7) {
    return find_bl_verify_shsh_5_6_7(iboot_in);
  }
  return find_bl_verify_shsh_generic(iboot_in);
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<find_bl_verify_shsh>:
  endbr64
  push   %rbp
  mov    %rdi,%rbp
  call   <get_os_version@plt>
  mov    %rbp,%rdi
  sub    $0x5,%eax
  cmp    $0x2,%eax
  jbe    L3
  pop    %rbp
  jmp    1090 <find_bl_verify_shsh_generic@plt>
  xchg   %ax,%ax
L3:
  pop    %rbp
  jmp    1070 <find_bl_verify_shsh_5_6_7@plt>
```

assistant: ```c
void *find_bl_verify_shsh(struct iboot_img *iboot_in) {
  int os_vers = get_os_version(iboot_in);
  if (os_vers >= 5 && os_vers <= 7) {
    return find_bl_verify_shsh_5_6_7(iboot_in);
  }
  return find_bl_verify_shsh_generic(iboot_in);
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<base64_encode>:
  endbr64
  mov    %rdi,%r10
  mov    %edx,%ecx
  test   %edx,%edx
  je     L35
  mov    %rdi,%rdx
  mov    $0x13,%r8d
  lea    D3(%rip),%rdi
  jmp    L72
L81:
  mov    %eax,%esi
  shr    $0x12,%esi
  and    $0x3f,%esi
  movzbl (%rdi,%rsi,1),%esi
  mov    %sil,(%rdx)
  mov    %eax,%esi
  shr    $0xc,%esi
  and    $0x3f,%esi
  movzbl (%rdi,%rsi,1),%esi
  mov    %sil,0x1(%rdx)
  cmp    $0x2,%ecx
  je     L37
  movb   $0x3d,0x2(%rdx)
L34:
  movb   $0x3d,0x3(%rdx)
  lea    0x4(%rdx),%rdx
L92:
  movb   $0xa,(%rdx)
  movb   $0x0,0x1(%rdx)
  sub    %r10d,%edx
  lea    0x1(%rdx),%eax
  ret
L37:
  mov    %r11,%rsi
  jmp    L78
L104:
  movb   $0xa,0x4(%rdx)
  lea    0x5(%rdx),%rdx
  mov    $0x13,%r8d
L25:
  sub    $0x3,%ecx
  je     L92
L72:
  movsbl (%rsi),%eax
  shl    $0x10,%eax
  lea    0x1(%rsi),%r11
  cmp    $0x1,%ecx
  jbe    L81
  lea    0x2(%rsi),%r11
  movsbl 0x1(%rsi),%r9d
  shl    $0x8,%r9d
  or     %r9d,%eax
  cmp    $0x2,%ecx
  jbe    L81
  movsbl 0x2(%rsi),%r9d
  or     %r9d,%eax
  mov    %eax,%r9d
  shr    $0x12,%r9d
  and    $0x3f,%r9d
  movzbl (%rdi,%r9,1),%r9d
  mov    %r9b,(%rdx)
  mov    %eax,%r9d
  shr    $0xc,%r9d
  and    $0x3f,%r9d
  movzbl (%rdi,%r9,1),%r9d
  mov    %r9b,0x1(%rdx)
  lea    0x3(%rsi),%rsi
L78:
  mov    %eax,%r9d
  shr    $0x6,%r9d
  and    $0x3f,%r9d
  movzbl (%rdi,%r9,1),%r9d
  mov    %r9b,0x2(%rdx)
  cmp    $0x2,%ecx
  jbe    L34
  and    $0x3f,%eax
  movzbl (%rdi,%rax,1),%eax
  mov    %al,0x3(%rdx)
  sub    $0x1,%r8d
  je     L104
  add    $0x4,%rdx
  jmp    L25
L35:
  mov    %rdi,%rdx
  jmp    L92
```

tool_calls: name: retrieve_data
arguments: label: D3
type: string

tool: D3: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/

assistant: ```c
unsigned base64_encode(char *dst, const char *src, unsigned srclen) {
  static const char alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  char *start = dst;
  int nline = 19;
  for (; srclen; srclen -= 3) {
    unsigned int buf = *(src++) << 16;
    if (srclen > 1)
      buf |= *(src++) << 8;
    if (srclen > 2)
      buf |= *(src++);
    *(dst++) = alphabet[(buf >> 18) & 0x3f];
    *(dst++) = alphabet[(buf >> 12) & 0x3f];
    *(dst++) = (srclen > 1) ? alphabet[(buf >> 6) & 0x3f] : '=';
    *(dst++) = (srclen > 2) ? alphabet[buf & 0x3f] : '=';
    if (srclen < 3)
      break;
    if (!--nline) {
      *(dst++) = '\n';
      nline = 19;
    }
  }
  *(dst++) = '\n';
  *(dst++) = '\0';
  return (dst - start - 1);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<base64_encode>:
  endbr64
  mov    %edx,%r8d
  mov    %rdi,%rdx
  test   %r8d,%r8d
  je     L45
  mov    $0x13,%r10d
  lea    D4(%rip),%r9
  jmp    L7
  nopw   0x0(%rax,%rax,1)
L2:
  movb   $0xa,0x4(%rdx)
  mov    $0x13,%r10d
  add    $0x5,%rdx
  sub    $0x3,%r8d
  je     L45
L78:
  mov    %r11,%rsi
L7:
  movsbl (%rsi),%ecx
  shl    $0x10,%ecx
  cmp    $0x1,%r8d
  je     L50
  movsbl 0x1(%rsi),%eax
  shl    $0x8,%eax
  or     %ecx,%eax
  cmp    $0x2,%r8d
  je     L36
  movsbl 0x2(%rsi),%ecx
  lea    0x3(%rsi),%r11
  or     %ecx,%eax
  mov    %eax,%ecx
  shr    $0x12,%ecx
  and    $0x3f,%ecx
  movzbl (%r9,%rcx,1),%ecx
  mov    %cl,(%rdx)
  mov    %eax,%ecx
  shr    $0xc,%ecx
  and    $0x3f,%ecx
  movzbl (%r9,%rcx,1),%ecx
  mov    %cl,0x1(%rdx)
  mov    %eax,%ecx
  and    $0x3f,%eax
  shr    $0x6,%ecx
  movzbl (%r9,%rax,1),%eax
  and    $0x3f,%ecx
  movzbl (%r9,%rcx,1),%ecx
  mov    %al,0x3(%rdx)
  mov    %cl,0x2(%rdx)
  sub    $0x1,%r10d
  je     L2
  add    $0x4,%rdx
  sub    $0x3,%r8d
  jne    L78
L45:
  mov    $0xa,%eax
  mov    %ax,(%rdx)
  sub    %edi,%edx
  lea    0x1(%rdx),%eax
  ret
L50:
  mov    %ecx,%eax
  shr    $0xc,%ecx
  movb   $0x3d,0x2(%rdx)
  shr    $0x12,%eax
  and    $0x30,%ecx
  and    $0x3f,%eax
  movzbl (%r9,%rax,1),%eax
  mov    %al,(%rdx)
  movzbl (%r9,%rcx,1),%eax
  mov    %al,0x1(%rdx)
L52:
  movb   $0x3d,0x3(%rdx)
  mov    $0xa,%eax
  add    $0x4,%rdx
  mov    %ax,(%rdx)
  sub    %edi,%edx
  lea    0x1(%rdx),%eax
  ret
  nopw   0x0(%rax,%rax,1)
L36:
  mov    %eax,%ecx
  shr    $0x12,%ecx
  and    $0x3f,%ecx
  movzbl (%r9,%rcx,1),%ecx
  mov    %cl,(%rdx)
  mov    %eax,%ecx
  shr    $0x6,%eax
  shr    $0xc,%ecx
  and    $0x3c,%eax
  and    $0x3f,%ecx
  movzbl (%r9,%rax,1),%eax
  movzbl (%r9,%rcx,1),%ecx
  mov    %al,0x2(%rdx)
  mov    %cl,0x1(%rdx)
  jmp    L52
```

tool_calls: name: parse_data
arguments: data_label: D4
datatype: string

tool: D4: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/

assistant: ```c
unsigned base64_encode(char *dst, const char *src, unsigned srclen) {
  static const char alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  char *start = dst;
  int nline = 19;
  for (; srclen; srclen -= 3) {
    unsigned int buf = *(src++) << 16;
    if (srclen > 1)
      buf |= *(src++) << 8;
    if (srclen > 2)
      buf |= *(src++);
    *(dst++) = alphabet[(buf >> 18) & 0x3f];
    *(dst++) = alphabet[(buf >> 12) & 0x3f];
    *(dst++) = (srclen > 1) ? alphabet[(buf >> 6) & 0x3f] : '=';
    *(dst++) = (srclen > 2) ? alphabet[buf & 0x3f] : '=';
    if (srclen < 3)
      break;
    if (!--nline) {
      *(dst++) = '\n';
      nline = 19;
    }
  }
  *(dst++) = '\n';
  *(dst++) = '\0';
  return (dst - start - 1);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<base64_encode>:
  endbr64
  mov    %edx,%r8d
  test   %edx,%edx
  je     L77
  mov    %rdi,%rdx
  mov    $0x13,%r10d
  lea    D4(%rip),%r9
  jmp    L59
  nopl   0x0(%rax)
L68:
  movb   $0xa,0x4(%rdx)
  lea    0x5(%rdx),%rax
  sub    $0x3,%r8d
  je     L9
  mov    $0x13,%r10d
L73:
  mov    %r11,%rsi
  mov    %rax,%rdx
L59:
  movsbl (%rsi),%ecx
  shl    $0x10,%ecx
  cmp    $0x1,%r8d
  je     L89
  movsbl 0x1(%rsi),%eax
  shl    $0x8,%eax
  or     %ecx,%eax
  cmp    $0x2,%r8d
  je     L81
  movsbl 0x2(%rsi),%ecx
  lea    0x3(%rsi),%r11
  or     %ecx,%eax
  mov    %eax,%ecx
  shr    $0x12,%ecx
  and    $0x3f,%ecx
  movzbl (%r9,%rcx,1),%ecx
  mov    %cl,(%rdx)
  mov    %eax,%ecx
  shr    $0xc,%ecx
  and    $0x3f,%ecx
  movzbl (%r9,%rcx,1),%ecx
  mov    %cl,0x1(%rdx)
  mov    %eax,%ecx
  and    $0x3f,%eax
  shr    $0x6,%ecx
  movzbl (%r9,%rax,1),%eax
  and    $0x3f,%ecx
  movzbl (%r9,%rcx,1),%ecx
  mov    %al,0x3(%rdx)
  mov    %cl,0x2(%rdx)
  sub    $0x1,%r10d
  je     L68
  lea    0x4(%rdx),%rax
  sub    $0x3,%r8d
  jne    L73
L9:
  mov    $0xa,%edx
  mov    %dx,(%rax)
  sub    %edi,%eax
  add    $0x1,%eax
  ret
  nopl   0x0(%rax,%rax,1)
L89:
  mov    %ecx,%eax
  shr    $0xc,%ecx
  movb   $0x3d,0x2(%rdx)
  shr    $0x12,%eax
  and    $0x30,%ecx
  and    $0x3f,%eax
  movzbl (%r9,%rax,1),%eax
  mov    %al,(%rdx)
  movzbl (%r9,%rcx,1),%eax
  mov    %al,0x1(%rdx)
L44:
  movb   $0x3d,0x3(%rdx)
  lea    0x4(%rdx),%rax
  mov    $0xa,%edx
  mov    %dx,(%rax)
  sub    %edi,%eax
  add    $0x1,%eax
  ret
  nopw   0x0(%rax,%rax,1)
L81:
  mov    %eax,%ecx
  shr    $0x12,%ecx
  and    $0x3f,%ecx
  movzbl (%r9,%rcx,1),%ecx
  mov    %cl,(%rdx)
  mov    %eax,%ecx
  shr    $0x6,%eax
  shr    $0xc,%ecx
  and    $0x3c,%eax
  and    $0x3f,%ecx
  movzbl (%r9,%rax,1),%eax
  movzbl (%r9,%rcx,1),%ecx
  mov    %al,0x2(%rdx)
  mov    %cl,0x1(%rdx)
  jmp    L44
L77:
  mov    %rdi,%rax
  jmp    L9
```

tool_calls: name: read_data
arguments: label: D4
data_type: string

tool: D4: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/

assistant: ```c
unsigned base64_encode(char *dst, const char *src, unsigned srclen) {
  static const char alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  char *start = dst;
  int nline = 19;
  for (; srclen; srclen -= 3) {
    unsigned int buf = *(src++) << 16;
    if (srclen > 1)
      buf |= *(src++) << 8;
    if (srclen > 2)
      buf |= *(src++);
    *(dst++) = alphabet[(buf >> 18) & 0x3f];
    *(dst++) = alphabet[(buf >> 12) & 0x3f];
    *(dst++) = (srclen > 1) ? alphabet[(buf >> 6) & 0x3f] : '=';
    *(dst++) = (srclen > 2) ? alphabet[buf & 0x3f] : '=';
    if (srclen < 3)
      break;
    if (!--nline) {
      *(dst++) = '\n';
      nline = 19;
    }
  }
  *(dst++) = '\n';
  *(dst++) = '\0';
  return (dst - start - 1);
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<calc_mine_amount>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  mov    %edx,-0x30(%rbp)
  mov    %ecx,-0x34(%rbp)
  mov    %r8d,-0x38(%rbp)
  movl   $0x0,-0x14(%rbp)
  mov    -0x34(%rbp),%eax
  lea    -0x1(%rax),%esi
  mov    -0x30(%rbp),%edi
  mov    -0x2c(%rbp),%ecx
  mov    -0x38(%rbp),%edx
  mov    -0x28(%rbp),%rax
  mov    %edi,%r8d
  mov    %rax,%rdi
  call   <check@plt>
  mov    %eax,%ebx
  mov    -0x34(%rbp),%eax
  lea    0x1(%rax),%esi
  mov    -0x30(%rbp),%edi
  mov    -0x2c(%rbp),%ecx
  mov    -0x38(%rbp),%edx
  mov    -0x28(%rbp),%rax
  mov    %edi,%r8d
  mov    %rax,%rdi
  call   <check@plt>
  add    %eax,%ebx
  mov    -0x38(%rbp),%eax
  lea    -0x1(%rax),%edi
  mov    -0x30(%rbp),%ecx
  mov    -0x2c(%rbp),%edx
  mov    -0x34(%rbp),%esi
  mov    -0x28(%rbp),%rax
  mov    %ecx,%r8d
  mov    %edx,%ecx
  mov    %edi,%edx
  mov    %rax,%rdi
  call   <check@plt>
  add    %eax,%ebx
  mov    -0x38(%rbp),%eax
  lea    0x1(%rax),%edi
  mov    -0x30(%rbp),%ecx
  mov    -0x2c(%rbp),%edx
  mov    -0x34(%rbp),%esi
  mov    -0x28(%rbp),%rax
  mov    %ecx,%r8d
  mov    %edx,%ecx
  mov    %edi,%edx
  mov    %rax,%rdi
  call   <check@plt>
  add    %eax,%ebx
  mov    -0x38(%rbp),%eax
  lea    -0x1(%rax),%edi
  mov    -0x34(%rbp),%eax
  lea    -0x1(%rax),%esi
  mov    -0x30(%rbp),%ecx
  mov    -0x2c(%rbp),%edx
  mov    -0x28(%rbp),%rax
  mov    %ecx,%r8d
  mov    %edx,%ecx
  mov    %edi,%edx
  mov    %rax,%rdi
  call   <check@plt>
  add    %eax,%ebx
  mov    -0x38(%rbp),%eax
  lea    -0x1(%rax),%edi
  mov    -0x34(%rbp),%eax
  lea    0x1(%rax),%esi
  mov    -0x30(%rbp),%ecx
  mov    -0x2c(%rbp),%edx
  mov    -0x28(%rbp),%rax
  mov    %ecx,%r8d
  mov    %edx,%ecx
  mov    %edi,%edx
  mov    %rax,%rdi
  call   <check@plt>
  add    %eax,%ebx
  mov    -0x38(%rbp),%eax
  lea    0x1(%rax),%edi
  mov    -0x34(%rbp),%eax
  lea    -0x1(%rax),%esi
  mov    -0x30(%rbp),%ecx
  mov    -0x2c(%rbp),%edx
  mov    -0x28(%rbp),%rax
  mov    %ecx,%r8d
  mov    %edx,%ecx
  mov    %edi,%edx
  mov    %rax,%rdi
  call   <check@plt>
  add    %eax,%ebx
  mov    -0x38(%rbp),%eax
  lea    0x1(%rax),%edi
  mov    -0x34(%rbp),%eax
  lea    0x1(%rax),%esi
  mov    -0x30(%rbp),%ecx
  mov    -0x2c(%rbp),%edx
  mov    -0x28(%rbp),%rax
  mov    %ecx,%r8d
  mov    %edx,%ecx
  mov    %edi,%edx
  mov    %rax,%rdi
  call   <check@plt>
  add    %ebx,%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x14(%rbp),%eax
  add    $0x30,%eax
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
int calc_mine_amount(char **mine, int x, int y, int i, int j) {
  int ret = 0;
  ret = check(mine, i - 1, j, x, y) + check(mine, i + 1, j, x, y) + check(mine, i, j - 1, x, y) + check(mine, i, j + 1, x, y) + check(mine, i - 1, j - 1, x, y) + check(mine, i + 1, j - 1, x, y) + check(mine, i - 1, j + 1, x, y) + check(mine, i + 1, j + 1, x, y);
  return ret + '0';
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<calc_mine_amount>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%rbx
  mov    %esi,%ebp
  mov    %edx,%r12d
  mov    %ecx,%r13d
  mov    %r8d,%r14d
  lea    -0x1(%rcx),%eax
  mov    %edx,%r8d
  mov    %esi,%ecx
  mov    %r14d,%edx
  mov    %eax,0x4(%rsp)
  mov    %eax,%esi
  call   <check@plt>
  mov    %eax,%r15d
  lea    0x1(%r13),%edx
  mov    %edx,%edi
  mov    %r12d,%r8d
  mov    %ebp,%ecx
  mov    %r14d,%edx
  mov    %edi,0x8(%rsp)
  mov    %edi,%esi
  mov    %rbx,%rdi
  call   <check@plt>
  lea    (%r15,%rax,1),%edx
  mov    %edx,0xc(%rsp)
  lea    -0x1(%r14),%r15d
  mov    %r12d,%r8d
  mov    %ebp,%ecx
  mov    %r15d,%edx
  mov    %r13d,%esi
  mov    %rbx,%rdi
  call   <check@plt>
  mov    %eax,%ecx
  add    0xc(%rsp),%ecx
  mov    %ecx,0xc(%rsp)
  add    $0x1,%r14d
  mov    %r12d,%r8d
  mov    %ebp,%ecx
  mov    %r14d,%edx
  mov    %r13d,%esi
  mov    %rbx,%rdi
  call   <check@plt>
  mov    0xc(%rsp),%ecx
  lea    (%rcx,%rax,1),%r13d
  mov    %r12d,%r8d
  mov    %ebp,%ecx
  mov    %r15d,%edx
  mov    0x4(%rsp),%esi
  mov    %rbx,%rdi
  call   <check@plt>
  add    %eax,%r13d
  mov    %r12d,%r8d
  mov    %ebp,%ecx
  mov    %r15d,%edx
  mov    0x8(%rsp),%r15d
  mov    %r15d,%esi
  mov    %rbx,%rdi
  call   <check@plt>
  add    %eax,%r13d
  mov    %r12d,%r8d
  mov    %ebp,%ecx
  mov    %r14d,%edx
  mov    0x4(%rsp),%esi
  mov    %rbx,%rdi
  call   <check@plt>
  add    %eax,%r13d
  mov    %r12d,%r8d
  mov    %ebp,%ecx
  mov    %r14d,%edx
  mov    %r15d,%esi
  mov    %rbx,%rdi
  call   <check@plt>
  lea    0x30(%r13,%rax,1),%eax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
int calc_mine_amount(char **mine, int x, int y, int i, int j) {
  int ret = 0;
  ret = check(mine, i - 1, j, x, y) + check(mine, i + 1, j, x, y) + check(mine, i, j - 1, x, y) + check(mine, i, j + 1, x, y) + check(mine, i - 1, j - 1, x, y) + check(mine, i + 1, j - 1, x, y) + check(mine, i - 1, j + 1, x, y) + check(mine, i + 1, j + 1, x, y);
  return ret + '0';
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<calc_mine_amount>:
  endbr64
  push   %r15
  lea    -0x1(%rcx),%r9d
  mov    %rdi,%r15
  push   %r14
  push   %r13
  mov    %ecx,%r13d
  mov    %esi,%ecx
  push   %r12
  lea    0x1(%r13),%r14d
  mov    %esi,%r12d
  mov    %r9d,%esi
  push   %rbp
  mov    %edx,%ebp
  push   %rbx
  mov    %r8d,%ebx
  mov    %edx,%r8d
  mov    %ebx,%edx
  sub    $0x18,%rsp
  mov    %r9d,0xc(%rsp)
  call   <check@plt>
  mov    %ebp,%r8d
  mov    %r12d,%ecx
  mov    %ebx,%edx
  mov    %r14d,%esi
  mov    %r15,%rdi
  mov    %eax,0x4(%rsp)
  call   <check@plt>
  lea    -0x1(%rbx),%r10d
  add    0x4(%rsp),%eax
  add    $0x1,%ebx
  mov    %r10d,%edx
  mov    %ebp,%r8d
  mov    %r12d,%ecx
  mov    %r13d,%esi
  mov    %r15,%rdi
  mov    %r10d,0x8(%rsp)
  mov    %eax,0x4(%rsp)
  call   <check@plt>
  mov    %ebp,%r8d
  add    0x4(%rsp),%eax
  mov    %r12d,%ecx
  mov    %ebx,%edx
  mov    %r13d,%esi
  mov    %r15,%rdi
  mov    %eax,0x4(%rsp)
  call   <check@plt>
  mov    0x4(%rsp),%edx
  mov    %ebp,%r8d
  mov    %r12d,%ecx
  mov    0xc(%rsp),%r9d
  mov    %r15,%rdi
  lea    (%rdx,%rax,1),%r13d
  mov    0x8(%rsp),%edx
  mov    %r9d,%esi
  mov    %r9d,0x4(%rsp)
  call   <check@plt>
  mov    0x8(%rsp),%edx
  mov    %ebp,%r8d
  mov    %r12d,%ecx
  mov    %r14d,%esi
  mov    %r15,%rdi
  add    %eax,%r13d
  call   <check@plt>
  mov    0x4(%rsp),%esi
  mov    %ebp,%r8d
  mov    %r12d,%ecx
  mov    %ebx,%edx
  mov    %r15,%rdi
  add    %eax,%r13d
  call   <check@plt>
  mov    %ebp,%r8d
  mov    %r12d,%ecx
  mov    %ebx,%edx
  mov    %r14d,%esi
  mov    %r15,%rdi
  add    %eax,%r13d
  call   <check@plt>
  add    $0x18,%rsp
  pop    %rbx
  lea    0x30(%r13,%rax,1),%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
int calc_mine_amount(char **mine, int x, int y, int i, int j) {
  int ret = 0;
  ret = check(mine, i - 1, j, x, y) + check(mine, i + 1, j, x, y) + check(mine, i, j - 1, x, y) + check(mine, i, j + 1, x, y) + check(mine, i - 1, j - 1, x, y) + check(mine, i + 1, j - 1, x, y) + check(mine, i - 1, j + 1, x, y) + check(mine, i + 1, j + 1, x, y);
  return ret + '0';
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<calc_mine_amount>:
  endbr64
  push   %r15
  lea    -0x1(%rcx),%r9d
  mov    %rdi,%r15
  push   %r14
  push   %r13
  mov    %ecx,%r13d
  mov    %esi,%ecx
  push   %r12
  lea    0x1(%r13),%r14d
  mov    %esi,%r12d
  mov    %r9d,%esi
  push   %rbp
  mov    %edx,%ebp
  push   %rbx
  mov    %r8d,%ebx
  mov    %edx,%r8d
  mov    %ebx,%edx
  sub    $0x18,%rsp
  mov    %r9d,0xc(%rsp)
  call   <check@plt>
  mov    %ebp,%r8d
  mov    %r12d,%ecx
  mov    %ebx,%edx
  mov    %r14d,%esi
  mov    %r15,%rdi
  mov    %eax,0x4(%rsp)
  call   <check@plt>
  lea    -0x1(%rbx),%r10d
  add    0x4(%rsp),%eax
  add    $0x1,%ebx
  mov    %r10d,%edx
  mov    %ebp,%r8d
  mov    %r12d,%ecx
  mov    %r13d,%esi
  mov    %r15,%rdi
  mov    %r10d,0x8(%rsp)
  mov    %eax,0x4(%rsp)
  call   <check@plt>
  mov    %ebp,%r8d
  add    0x4(%rsp),%eax
  mov    %r12d,%ecx
  mov    %ebx,%edx
  mov    %r13d,%esi
  mov    %r15,%rdi
  mov    %eax,0x4(%rsp)
  call   <check@plt>
  mov    0x4(%rsp),%edx
  mov    %ebp,%r8d
  mov    %r12d,%ecx
  mov    0xc(%rsp),%r9d
  mov    %r15,%rdi
  lea    (%rdx,%rax,1),%r13d
  mov    0x8(%rsp),%edx
  mov    %r9d,%esi
  mov    %r9d,0x4(%rsp)
  call   <check@plt>
  mov    0x8(%rsp),%edx
  mov    %ebp,%r8d
  mov    %r12d,%ecx
  mov    %r14d,%esi
  mov    %r15,%rdi
  add    %eax,%r13d
  call   <check@plt>
  mov    0x4(%rsp),%esi
  mov    %ebp,%r8d
  mov    %r12d,%ecx
  mov    %ebx,%edx
  mov    %r15,%rdi
  add    %eax,%r13d
  call   <check@plt>
  mov    %ebp,%r8d
  mov    %r12d,%ecx
  mov    %ebx,%edx
  mov    %r14d,%esi
  mov    %r15,%rdi
  add    %eax,%r13d
  call   <check@plt>
  add    $0x18,%rsp
  pop    %rbx
  lea    0x30(%r13,%rax,1),%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
int calc_mine_amount(char **mine, int x, int y, int i, int j) {
  int ret = 0;
  ret = check(mine, i - 1, j, x, y) + check(mine, i + 1, j, x, y) + check(mine, i, j - 1, x, y) + check(mine, i, j + 1, x, y) + check(mine, i - 1, j - 1, x, y) + check(mine, i + 1, j - 1, x, y) + check(mine, i - 1, j + 1, x, y) + check(mine, i + 1, j + 1, x, y);
  return ret + '0';
}
```