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

```asm
<ll_type_n2a>:
  endbr64
  push   %rbx
  lea    D10(%rip),%r9
  mov    %rsi,%rbx
  xor    %r10d,%r10d
  mov    %edx,%esi
  xor    %r8d,%r8d
  jmp    L22
  nopl   0x0(%rax)
L29:
  add    $0x1,%r8d
  cmp    $0x36,%r8d
  je     L28
  mov    (%r9),%r10d
  add    $0x10,%r9
L22:
  cmp    %edi,%r10d
  jne    L29
  movslq %r8d,%r8
  lea    D16(%rip),%rax
  pop    %rbx
  shl    $0x4,%r8
  mov    0x8(%rax,%r8,1),%rax
  ret
  nopl   0x0(%rax,%rax,1)
L28:
  mov    %edi,%ecx
  lea    D6(%rip),%rdx
  mov    %rbx,%rdi
  call   <snprintf@plt>
  mov    %rbx,%rax
  pop    %rbx
  ret
```

tool_calls: name: unpack_data
arguments: label: D6
type_infered: string

tool: D6: [%d]

assistant: ```c
const char *ll_type_n2a(int type, char *buf, int len) {
  static struct {
    int type;
    const char *name;
  } arphrd_names[] = {
      {0, "generic"}, {ARPHRD_ETHER, "ether"}, {ARPHRD_EETHER, "eether"}, {ARPHRD_AX25, "ax25"}, {ARPHRD_PRONET, "pronet"}, {ARPHRD_CHAOS, "chaos"}, {ARPHRD_IEEE802, "tr"}, {ARPHRD_ARCNET, "arcnet"}, {ARPHRD_APPLETLK, "atalk"}, {ARPHRD_DLCI, "dlci"}, {ARPHRD_METRICOM, "metricom"}, {ARPHRD_SLIP, "slip"}, {ARPHRD_CSLIP, "cslip"}, {ARPHRD_SLIP6, "slip6"}, {ARPHRD_CSLIP6, "cslip6"}, {ARPHRD_RSRVD, "rsrvd"}, {ARPHRD_ADAPT, "adapt"}, {ARPHRD_ROSE, "rose"}, {ARPHRD_X25, "x25"}, {ARPHRD_PPP, "ppp"}, {ARPHRD_HDLC, "hdlc"}, {ARPHRD_LAPB, "lapb"}, {ARPHRD_TUNNEL, "ipip"}, {ARPHRD_TUNNEL6, "tunnel6"}, {ARPHRD_FRAD, "frad"}, {ARPHRD_SKIP, "skip"}, {ARPHRD_LOOPBACK, "loopback"}, {ARPHRD_LOCALTLK, "ltalk"}, {ARPHRD_FDDI, "fddi"}, {ARPHRD_BIF, "bif"}, {ARPHRD_SIT, "sit"}, {ARPHRD_IPDDP, "ip/ddp"}, {ARPHRD_IPGRE, "gre"}, {ARPHRD_PIMREG, "pimreg"}, {ARPHRD_HIPPI, "hippi"}, {ARPHRD_ASH, "ash"}, {ARPHRD_ECONET, "econet"}, {ARPHRD_IRDA, "irda"}, {ARPHRD_FCPP, "fcpp"}, {ARPHRD_FCAL, "fcal"}, {ARPHRD_FCPL, "fcpl"}, {ARPHRD_FCFABRIC, "fcfb0"}, {ARPHRD_FCFABRIC + 1, "fcfb1"}, {ARPHRD_FCFABRIC + 2, "fcfb2"}, {ARPHRD_FCFABRIC + 3, "fcfb3"}, {ARPHRD_FCFABRIC + 4, "fcfb4"}, {ARPHRD_FCFABRIC + 5, "fcfb5"}, {ARPHRD_FCFABRIC + 6, "fcfb6"}, {ARPHRD_FCFABRIC + 7, "fcfb7"}, {ARPHRD_FCFABRIC + 8, "fcfb8"}, {ARPHRD_FCFABRIC + 9, "fcfb9"}, {ARPHRD_FCFABRIC + 10, "fcfb10"}, {ARPHRD_FCFABRIC + 11, "fcfb11"}, {ARPHRD_FCFABRIC + 12, "fcfb12"},
  };
  int i;
  for (i = 0; i < sizeof(arphrd_names) / sizeof(arphrd_names[0]); i++) {
    if (arphrd_names[i].type == type)
      return arphrd_names[i].name;
  }
  snprintf(buf, len, "[%d]", type);
  return buf;
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<ll_type_n2a>:
  endbr64
  lea    D14(%rip),%rax
  push   %rbx
  xor    %r8d,%r8d
  mov    %rsi,%rbx
  mov    %rax,%r9
  mov    %edx,%esi
  jmp    L25
  nopl   0x0(%rax)
L23:
  add    $0x1,%r8d
  add    $0x10,%r9
  cmp    $0x36,%r8d
  je     L3
L25:
  cmp    %edi,(%r9)
  jne    L23
  movslq %r8d,%r8
  pop    %rbx
  shl    $0x4,%r8
  mov    0x8(%rax,%r8,1),%rax
  ret
  nopl   0x0(%rax)
L3:
  mov    %edi,%ecx
  lea    D3(%rip),%rdx
  mov    %rbx,%rdi
  call   <snprintf@plt>
  mov    %rbx,%rax
  pop    %rbx
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D3
type_infered: string

tool: D3: [%d]

assistant: ```c
const char *ll_type_n2a(int type, char *buf, int len) {
  static struct {
    int type;
    const char *name;
  } arphrd_names[] = {
      {0, "generic"}, {ARPHRD_ETHER, "ether"}, {ARPHRD_EETHER, "eether"}, {ARPHRD_AX25, "ax25"}, {ARPHRD_PRONET, "pronet"}, {ARPHRD_CHAOS, "chaos"}, {ARPHRD_IEEE802, "tr"}, {ARPHRD_ARCNET, "arcnet"}, {ARPHRD_APPLETLK, "atalk"}, {ARPHRD_DLCI, "dlci"}, {ARPHRD_METRICOM, "metricom"}, {ARPHRD_SLIP, "slip"}, {ARPHRD_CSLIP, "cslip"}, {ARPHRD_SLIP6, "slip6"}, {ARPHRD_CSLIP6, "cslip6"}, {ARPHRD_RSRVD, "rsrvd"}, {ARPHRD_ADAPT, "adapt"}, {ARPHRD_ROSE, "rose"}, {ARPHRD_X25, "x25"}, {ARPHRD_PPP, "ppp"}, {ARPHRD_HDLC, "hdlc"}, {ARPHRD_LAPB, "lapb"}, {ARPHRD_TUNNEL, "ipip"}, {ARPHRD_TUNNEL6, "tunnel6"}, {ARPHRD_FRAD, "frad"}, {ARPHRD_SKIP, "skip"}, {ARPHRD_LOOPBACK, "loopback"}, {ARPHRD_LOCALTLK, "ltalk"}, {ARPHRD_FDDI, "fddi"}, {ARPHRD_BIF, "bif"}, {ARPHRD_SIT, "sit"}, {ARPHRD_IPDDP, "ip/ddp"}, {ARPHRD_IPGRE, "gre"}, {ARPHRD_PIMREG, "pimreg"}, {ARPHRD_HIPPI, "hippi"}, {ARPHRD_ASH, "ash"}, {ARPHRD_ECONET, "econet"}, {ARPHRD_IRDA, "irda"}, {ARPHRD_FCPP, "fcpp"}, {ARPHRD_FCAL, "fcal"}, {ARPHRD_FCPL, "fcpl"}, {ARPHRD_FCFABRIC, "fcfb0"}, {ARPHRD_FCFABRIC + 1, "fcfb1"}, {ARPHRD_FCFABRIC + 2, "fcfb2"}, {ARPHRD_FCFABRIC + 3, "fcfb3"}, {ARPHRD_FCFABRIC + 4, "fcfb4"}, {ARPHRD_FCFABRIC + 5, "fcfb5"}, {ARPHRD_FCFABRIC + 6, "fcfb6"}, {ARPHRD_FCFABRIC + 7, "fcfb7"}, {ARPHRD_FCFABRIC + 8, "fcfb8"}, {ARPHRD_FCFABRIC + 9, "fcfb9"}, {ARPHRD_FCFABRIC + 10, "fcfb10"}, {ARPHRD_FCFABRIC + 11, "fcfb11"}, {ARPHRD_FCFABRIC + 12, "fcfb12"},
  };
  int i;
  for (i = 0; i < sizeof(arphrd_names) / sizeof(arphrd_names[0]); i++) {
    if (arphrd_names[i].type == type)
      return arphrd_names[i].name;
  }
  snprintf(buf, len, "[%d]", type);
  return buf;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<strcmp>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x8(%rbp)
  mov    %rsi,-0x10(%rbp)
  jmp    L21
L23:
  addq   $0x1,-0x8(%rbp)
  addq   $0x1,-0x10(%rbp)
L21:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L16
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%edx
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  cmp    %al,%dl
  je     L23
L16:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%edx
  mov    -0x10(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  pop    %rbp
  ret
```

assistant: ```c
int strcmp(const char *a, const char *b) {
  while (*a && (*a == *b))
    ++a, ++b;
  return *a - *b;
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<strcmp>:
  endbr64
  movzbl (%rdi),%eax
  test   %al,%al
  je     L26
L1:
  cmp    %al,(%rsi)
  jne    L26
  add    $0x1,%rdi
  add    $0x1,%rsi
  movzbl (%rdi),%eax
  test   %al,%al
  jne    L1
L26:
  movsbl %al,%eax
  movsbl (%rsi),%edx
  sub    %edx,%eax
  ret
```

assistant: ```c
int strcmp(const char *a, const char *b) {
  while (*a && (*a == *b))
    ++a, ++b;
  return *a - *b;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<strcmp>:
  endbr64
  movsbl (%rdi),%eax
  test   %al,%al
  jne    L0
  jmp    L16
  nopl   (%rax)
L17:
  movsbl 0x1(%rdi),%eax
  add    $0x1,%rdi
  lea    0x1(%rsi),%rdx
  test   %al,%al
  je     L48
  mov    %rdx,%rsi
L0:
  movsbl (%rsi),%edx
  cmp    %al,%dl
  je     L17
L49:
  sub    %edx,%eax
  ret
  nopl   (%rax)
L48:
  movsbl 0x1(%rsi),%edx
  xor    %eax,%eax
  sub    %edx,%eax
  ret
L16:
  movsbl (%rsi),%edx
  xor    %eax,%eax
  jmp    L49
```

assistant: ```c
int strcmp(const char *a, const char *b) {
  while (*a && (*a == *b))
    ++a, ++b;
  return *a - *b;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<strcmp>:
  endbr64
  movsbl (%rdi),%eax
  test   %al,%al
  jne    L11
  jmp    L17
  nopl   (%rax)
L25:
  movsbl 0x1(%rdi),%eax
  add    $0x1,%rdi
  lea    0x1(%rsi),%rdx
  test   %al,%al
  je     L4
  mov    %rdx,%rsi
L11:
  movsbl (%rsi),%edx
  cmp    %al,%dl
  je     L25
L48:
  sub    %edx,%eax
  ret
  nopl   (%rax)
L4:
  movsbl 0x1(%rsi),%edx
  xor    %eax,%eax
  sub    %edx,%eax
  ret
L17:
  movsbl (%rsi),%edx
  xor    %eax,%eax
  jmp    L48
```

assistant: ```c
int strcmp(const char *a, const char *b) {
  while (*a && (*a == *b))
    ++a, ++b;
  return *a - *b;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<mp_unexp_sub>:
  endbr64
  push   %rbx
  mov    %esi,%r10d
  mov    %rcx,%r11
  cmp    %edi,%edx
  cmovg  %edi,%edx
  lea    -0x1(%rdi),%ecx
  cmp    %ecx,%edx
  jg     L119
  movslq %ecx,%rcx
  movslq %edx,%rax
  neg    %rax
  lea    (%r8,%rax,2),%rbx
  mov    $0x0,%esi
L28:
  movswl (%r11,%rcx,2),%eax
  movswl (%rbx,%rcx,2),%r8d
  sub    %r8d,%eax
  add    %esi,%eax
  mov    %eax,%esi
  sar    $0x1f,%esi
  mov    %r10d,%r8d
  and    %esi,%r8d
  add    %r8d,%eax
  mov    %ax,(%r9,%rcx,2)
  sub    $0x1,%rcx
  cmp    %ecx,%edx
  jle    L28
L149:
  sub    $0x1,%edx
  js     L22
  movslq %edx,%rax
L114:
  movswl (%r11,%rax,2),%edx
  add    %esi,%edx
  mov    %edx,%esi
  sar    $0x1f,%esi
  mov    %r10d,%ecx
  and    %esi,%ecx
  add    %ecx,%edx
  mov    %dx,(%r9,%rax,2)
  sub    $0x1,%rax
  test   %eax,%eax
  jns    L114
L22:
  test   %edi,%edi
  jle    L48
  mov    %r9,%rdx
  mov    $0x0,%eax
L87:
  cmpw   $0x0,(%rdx)
  jne    L104
  add    $0x1,%eax
  add    $0x2,%rdx
  cmp    %eax,%edi
  jne    L87
  mov    %edi,%eax
L47:
  pop    %rbx
  ret
L119:
  mov    $0x0,%esi
  jmp    L149
L104:
  test   %eax,%eax
  jle    L47
  cmp    %eax,%edi
  jle    L47
  mov    %edi,%r10d
  sub    %eax,%r10d
  movslq %eax,%rsi
  lea    (%r9,%rsi,2),%rdx
  lea    0x2(%r9),%r11
  lea    -0x1(%r10),%ecx
  add    %rsi,%rcx
  lea    (%r11,%rcx,2),%r8
  neg    %rsi
  add    %rsi,%rsi
L21:
  movzwl (%rdx),%ecx
  mov    %cx,(%rdx,%rsi,1)
  add    $0x2,%rdx
  cmp    %r8,%rdx
  jne    L21
  cmp    %r10d,%edi
  jle    L47
  movslq %r10d,%rcx
  lea    (%r9,%rcx,2),%rdx
  sub    $0x1,%edi
  sub    %r10d,%edi
  add    %rdi,%rcx
  lea    (%r11,%rcx,2),%rcx
L85:
  movw   $0x0,(%rdx)
  add    $0x2,%rdx
  cmp    %rcx,%rdx
  jne    L85
  jmp    L47
L48:
  mov    $0x0,%eax
  jmp    L47
```

assistant: ```c
int mp_unexp_sub(int n, int radix, int expdif, short int in1[], short int in2[], short int out[]) {
  int j, x, borrow, ncancel;
  if (expdif > n) {
    expdif = n;
  }
  borrow = 0;
  for (j = n - 1; j >= expdif; j--) {
    x = in1[j] - in2[j - expdif] + borrow;
    borrow = x < 0 ? -1 : 0;
    out[j] = (short int)(x + (radix & borrow));
  }
  for (j = expdif - 1; j >= 0; j--) {
    x = in1[j] + borrow;
    borrow = x < 0 ? -1 : 0;
    out[j] = (short int)(x + (radix & borrow));
  }
  ncancel = 0;
  for (j = 0; j < n && out[j] == 0; j++) {
    ncancel = j + 1;
  }
  if (ncancel > 0 && ncancel < n) {
    for (j = 0; j < n - ncancel; j++) {
      out[j] = out[j + ncancel];
    }
    for (j = n - ncancel; j < n; j++) {
      out[j] = 0;
    }
  }
  return ncancel;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<mp_unexp_sub>:
  endbr64
  cmp    %edi,%edx
  lea    -0x1(%rdi),%r11d
  push   %r12
  mov    %rcx,%r10
  cmovg  %edi,%edx
  push   %rbp
  push   %rbx
  mov    %edx,%r12d
  cmp    %r11d,%edx
  jg     L31
  movslq %edx,%rax
  mov    %esi,%ebp
  movslq %r11d,%rcx
  xor    %edx,%edx
  neg    %rax
  lea    (%r8,%rax,2),%rbx
  nopl   0x0(%rax)
L123:
  movswl (%rbx,%rcx,2),%r8d
  movswl (%r10,%rcx,2),%eax
  sub    %r8d,%eax
  mov    %ebp,%r8d
  add    %edx,%eax
  cltd
  and    %edx,%r8d
  add    %r8d,%eax
  mov    %ax,(%r9,%rcx,2)
  sub    $0x1,%rcx
  cmp    %ecx,%r12d
  jle    L123
L69:
  sub    $0x1,%r12d
  mov    %esi,%r8d
  movslq %r12d,%rax
  js     L71
  nopl   0x0(%rax,%rax,1)
L45:
  movswl (%r10,%rax,2),%ecx
  mov    %r8d,%esi
  add    %edx,%ecx
  mov    %ecx,%edx
  sar    $0x1f,%edx
  and    %edx,%esi
  add    %esi,%ecx
  mov    %cx,(%r9,%rax,2)
  sub    $0x1,%rax
  test   %eax,%eax
  jns    L45
L71:
  test   %edi,%edi
  jle    L26
  mov    %r9,%rax
  xor    %r12d,%r12d
  jmp    L84
L42:
  add    $0x1,%r12d
  add    $0x2,%rax
  cmp    %r12d,%edi
  je     L130
L84:
  cmpw   $0x0,(%rax)
  je     L42
  test   %r12d,%r12d
  jle    L130
  cmp    %r12d,%edi
  jle    L130
  mov    %edi,%r8d
  sub    %r12d,%r8d
  test   %r8d,%r8d
  jle    L19
  movslq %r12d,%rsi
  lea    -0x1(%r8),%edx
  lea    (%rsi,%rsi,1),%rcx
  add    %rsi,%rdx
  lea    (%r9,%rcx,1),%rax
  lea    0x2(%r9,%rdx,2),%rsi
  neg    %rcx
  nopw   0x0(%rax,%rax,1)
L23:
  movzwl (%rax),%edx
  add    $0x2,%rax
  mov    %dx,-0x2(%rax,%rcx,1)
  cmp    %rsi,%rax
  jne    L23
  cmp    %r8d,%edi
  jle    L130
L19:
  sub    %r8d,%r11d
  movslq %r8d,%r8
  xor    %esi,%esi
  lea    0x2(%r11,%r11,1),%rdx
  lea    (%r9,%r8,2),%rdi
  call   <memset@plt>
L130:
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax)
L31:
  xor    %edx,%edx
  jmp    L69
L26:
  xor    %r12d,%r12d
  jmp    L130
```

assistant: ```c
int mp_unexp_sub(int n, int radix, int expdif, short int in1[], short int in2[], short int out[]) {
  int j, x, borrow, ncancel;
  if (expdif > n) {
    expdif = n;
  }
  borrow = 0;
  for (j = n - 1; j >= expdif; j--) {
    x = in1[j] - in2[j - expdif] + borrow;
    borrow = x < 0 ? -1 : 0;
    out[j] = (short int)(x + (radix & borrow));
  }
  for (j = expdif - 1; j >= 0; j--) {
    x = in1[j] + borrow;
    borrow = x < 0 ? -1 : 0;
    out[j] = (short int)(x + (radix & borrow));
  }
  ncancel = 0;
  for (j = 0; j < n && out[j] == 0; j++) {
    ncancel = j + 1;
  }
  if (ncancel > 0 && ncancel < n) {
    for (j = 0; j < n - ncancel; j++) {
      out[j] = out[j + ncancel];
    }
    for (j = n - ncancel; j < n; j++) {
      out[j] = 0;
    }
  }
  return ncancel;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<lspcon_i2c_spi_read>:
  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)
  movl   $0x0,-0x8(%rbp)
  mov    -0x24(%rbp),%eax
  movzbl %al,%eax
  test   %eax,%eax
  je     L44
  mov    -0x28(%rbp),%ecx
  mov    -0x24(%rbp),%edx
  mov    -0x20(%rbp),%rsi
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <default_spi_read@plt>
  jmp    L51
L44:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <get_fd_from_context@plt>
  mov    %eax,-0x4(%rbp)
  cmpl   $0x0,-0x4(%rbp)
  jns    L14
  mov    $0xffffffff,%eax
  jmp    L51
L14:
  movl   $0x0,-0xc(%rbp)
  jmp    L42
L39:
  mov    -0x24(%rbp),%edx
  mov    -0xc(%rbp),%eax
  add    %eax,%edx
  mov    -0x4(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <lspcon_i2c_spi_map_page@plt>
  or     %eax,-0x8(%rbp)
  mov    -0x28(%rbp),%eax
  sub    -0xc(%rbp),%eax
  mov    $0x100,%esi
  mov    %eax,%edi
  call   <min@plt>
  mov    %eax,%ecx
  mov    -0xc(%rbp),%eax
  lea    0x0(,%rax,4),%rdx
  mov    -0x20(%rbp),%rax
  add    %rax,%rdx
  mov    -0x4(%rbp),%eax
  mov    $0x4f,%esi
  mov    %eax,%edi
  call   <lspcon_i2c_spi_read_data@plt>
  or     %eax,-0x8(%rbp)
  addl   $0x100,-0xc(%rbp)
L42:
  mov    -0xc(%rbp),%eax
  cmp    -0x28(%rbp),%eax
  jb     L39
  mov    -0x8(%rbp),%eax
L51:
  leave
  ret
```

assistant: ```c
int lspcon_i2c_spi_read(struct flashrom_flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len) {
  unsigned int i;
  int ret = 0;
  if (start & 0xff)
    return default_spi_read(flash, buf, start, len);
  int fd = get_fd_from_context(flash);
  if (fd < 0)
    return -1;
  for (i = 0; i < len; i += 256) {
    ret |= lspcon_i2c_spi_map_page(fd, start + i);
    ret |= lspcon_i2c_spi_read_data(fd, (0x9e >> 1), buf + i, min(len - i, 256));
  }
  return ret;
}
```
user: Translate the below assembly code into C programming language:

```asm
<lspcon_i2c_spi_read>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rsi,%r15
  mov    %edx,%r14d
  mov    %ecx,%ebp
  mov    %edx,%ebx
  and    $0xff,%ebx
  jne    L19
  call   <get_fd_from_context@plt>
  mov    %eax,%r13d
  test   %eax,%eax
  js     L46
  test   %ebp,%ebp
  je     L7
  mov    $0x0,%r12d
L13:
  lea    (%r14,%rbx,1),%esi
  mov    %r13d,%edi
  call   <lspcon_i2c_spi_map_page@plt>
  mov    %eax,0xc(%rsp)
  mov    %ebp,%edi
  sub    %ebx,%edi
  mov    $0x100,%esi
  call   <min@plt>
  mov    %eax,%ecx
  mov    %ebx,%eax
  lea    (%r15,%rax,4),%rdx
  mov    $0x4f,%esi
  mov    %r13d,%edi
  call   <lspcon_i2c_spi_read_data@plt>
  or     0xc(%rsp),%eax
  or     %eax,%r12d
  add    $0x100,%ebx
  cmp    %ebx,%ebp
  ja     L13
L48:
  mov    %r12d,%eax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L19:
  call   <default_spi_read@plt>
  mov    %eax,%r12d
  jmp    L48
L46:
  mov    $0xffffffff,%r12d
  jmp    L48
L7:
  mov    $0x0,%r12d
  jmp    L48
```

assistant: ```c
int lspcon_i2c_spi_read(struct flashrom_flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len) {
  unsigned int i;
  int ret = 0;
  if (start & 0xff)
    return default_spi_read(flash, buf, start, len);
  int fd = get_fd_from_context(flash);
  if (fd < 0)
    return -1;
  for (i = 0; i < len; i += 256) {
    ret |= lspcon_i2c_spi_map_page(fd, start + i);
    ret |= lspcon_i2c_spi_read_data(fd, (0x9e >> 1), buf + i, min(len - i, 256));
  }
  return ret;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<lspcon_i2c_spi_read>:
  endbr64
  push   %r15
  mov    %edx,%r15d
  push   %r14
  push   %r13
  push   %r12
  mov    %ecx,%r12d
  push   %rbp
  push   %rbx
  mov    %edx,%ebx
  sub    $0x18,%rsp
  mov    %rsi,0x8(%rsp)
  and    $0xff,%ebx
  jne    L35
  call   <get_fd_from_context@plt>
  mov    %eax,%r13d
  test   %eax,%eax
  js     L34
  xor    %r14d,%r14d
  test   %r12d,%r12d
  je     L46
  nop
L20:
  lea    (%r15,%rbx,1),%esi
  mov    %r13d,%edi
  call   <lspcon_i2c_spi_map_page@plt>
  mov    %r12d,%edi
  mov    $0x100,%esi
  sub    %ebx,%edi
  mov    %eax,%ebp
  call   <min@plt>
  mov    0x8(%rsp),%rdx
  mov    $0x4f,%esi
  mov    %r13d,%edi
  mov    %eax,%ecx
  mov    %ebx,%eax
  add    $0x100,%ebx
  lea    (%rdx,%rax,4),%rdx
  call   <lspcon_i2c_spi_read_data@plt>
  or     %eax,%ebp
  or     %ebp,%r14d
  cmp    %ebx,%r12d
  ja     L20
L46:
  add    $0x18,%rsp
  mov    %r14d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L35:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    10a0 <default_spi_read@plt>
L34:
  mov    $0xffffffff,%r14d
  jmp    L46
```

assistant: ```c
int lspcon_i2c_spi_read(struct flashrom_flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len) {
  unsigned int i;
  int ret = 0;
  if (start & 0xff)
    return default_spi_read(flash, buf, start, len);
  int fd = get_fd_from_context(flash);
  if (fd < 0)
    return -1;
  for (i = 0; i < len; i += 256) {
    ret |= lspcon_i2c_spi_map_page(fd, start + i);
    ret |= lspcon_i2c_spi_read_data(fd, (0x9e >> 1), buf + i, min(len - i, 256));
  }
  return ret;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<lspcon_i2c_spi_read>:
  endbr64
  push   %r15
  mov    %edx,%r15d
  push   %r14
  push   %r13
  push   %r12
  mov    %ecx,%r12d
  push   %rbp
  push   %rbx
  mov    %edx,%ebx
  sub    $0x18,%rsp
  mov    %rsi,0x8(%rsp)
  and    $0xff,%ebx
  jne    L7
  call   <get_fd_from_context@plt>
  mov    %eax,%r13d
  test   %eax,%eax
  js     L25
  xor    %r14d,%r14d
  test   %r12d,%r12d
  je     L2
  nop
L19:
  lea    (%r15,%rbx,1),%esi
  mov    %r13d,%edi
  call   <lspcon_i2c_spi_map_page@plt>
  mov    %r12d,%edi
  mov    $0x100,%esi
  sub    %ebx,%edi
  mov    %eax,%ebp
  call   <min@plt>
  mov    0x8(%rsp),%rdx
  mov    $0x4f,%esi
  mov    %r13d,%edi
  mov    %eax,%ecx
  mov    %ebx,%eax
  add    $0x100,%ebx
  lea    (%rdx,%rax,4),%rdx
  call   <lspcon_i2c_spi_read_data@plt>
  or     %eax,%ebp
  or     %ebp,%r14d
  cmp    %ebx,%r12d
  ja     L19
L2:
  add    $0x18,%rsp
  mov    %r14d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L7:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    10a0 <default_spi_read@plt>
L25:
  mov    $0xffffffff,%r14d
  jmp    L2
```

assistant: ```c
int lspcon_i2c_spi_read(struct flashrom_flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len) {
  unsigned int i;
  int ret = 0;
  if (start & 0xff)
    return default_spi_read(flash, buf, start, len);
  int fd = get_fd_from_context(flash);
  if (fd < 0)
    return -1;
  for (i = 0; i < len; i += 256) {
    ret |= lspcon_i2c_spi_map_page(fd, start + i);
    ret |= lspcon_i2c_spi_read_data(fd, (0x9e >> 1), buf + i, min(len - i, 256));
  }
  return ret;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<map_rebuild_action>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    %esi,-0xc(%rbp)
  mov    %edx,-0x10(%rbp)
  cmpl   $0x83,-0xc(%rbp)
  je     L32
  cmpl   $0x83,-0xc(%rbp)
  jg     L93
  cmpl   $0x82,-0xc(%rbp)
  je     L80
  cmpl   $0x82,-0xc(%rbp)
  jg     L93
  cmpl   $0x80,-0xc(%rbp)
  je     L72
  cmpl   $0x81,-0xc(%rbp)
  je     L58
  jmp    L93
L58:
  mov    D22(%rip),%eax
  lea    0x1(%rax),%edx
  mov    %edx,D17(%rip)
  mov    -0x8(%rbp),%rdx
  mov    (%rdx),%rdx
  mov    %eax,%esi
  mov    %rdx,%rdi
  call   <map_rebuild@plt>
  jmp    L93
L80:
  mov    D17(%rip),%eax
  lea    0x1(%rax),%edx
  mov    %edx,D17(%rip)
  mov    -0x8(%rbp),%rdx
  mov    (%rdx),%rdx
  mov    %eax,%esi
  mov    %rdx,%rdi
  call   <map_rebuild@plt>
  jmp    L93
L32:
  nop
  jmp    L93
L72:
  nop
L93:
  nop
  leave
  ret
```

assistant: ```c
void map_rebuild_action(const void *nodep, const VISIT which, const int depth) {
  static int map_idx;
  switch (which) {
  case preorder:
    break;
  case postorder:
    map_rebuild(*(struct map_rec **)nodep, map_idx++);
    break;
  case endorder:
    break;
  case leaf:
    map_rebuild(*(struct map_rec **)nodep, map_idx++);
    break;
  }
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<map_rebuild_action>:
  endbr64
  sub    $0x8,%rsp
  cmp    $0x81,%esi
  je     L15
  cmp    $0x82,%esi
  je     L8
L33:
  add    $0x8,%rsp
  ret
L15:
  mov    D16(%rip),%esi
  lea    0x1(%rsi),%eax
  mov    %eax,D36(%rip)
  mov    (%rdi),%rdi
  call   <map_rebuild@plt>
  jmp    L33
L8:
  mov    D36(%rip),%esi
  lea    0x1(%rsi),%eax
  mov    %eax,D36(%rip)
  mov    (%rdi),%rdi
  call   <map_rebuild@plt>
  jmp    L33
```

assistant: ```c
void map_rebuild_action(const void *nodep, const VISIT which, const int depth) {
  static int map_idx;
  switch (which) {
  case preorder:
    break;
  case postorder:
    map_rebuild(*(struct map_rec **)nodep, map_idx++);
    break;
  case endorder:
    break;
  case leaf:
    map_rebuild(*(struct map_rec **)nodep, map_idx++);
    break;
  }
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<map_rebuild_action>:
  endbr64
  sub    $0x81,%esi
  cmp    $0x1,%esi
  ja     L8
  mov    D17(%rip),%esi
  mov    (%rdi),%rdi
  lea    0x1(%rsi),%eax
  mov    %eax,D19(%rip)
  jmp    1050 <map_rebuild@plt>
  cs nopw 0x0(%rax,%rax,1)
L8:
  ret
```

assistant: ```c
void map_rebuild_action(const void *nodep, const VISIT which, const int depth) {
  static int map_idx;
  switch (which) {
  case preorder:
    break;
  case postorder:
    map_rebuild(*(struct map_rec **)nodep, map_idx++);
    break;
  case endorder:
    break;
  case leaf:
    map_rebuild(*(struct map_rec **)nodep, map_idx++);
    break;
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<map_rebuild_action>:
  endbr64
  sub    $0x81,%esi
  cmp    $0x1,%esi
  ja     L2
  mov    D12(%rip),%esi
  mov    (%rdi),%rdi
  lea    0x1(%rsi),%eax
  mov    %eax,D9(%rip)
  jmp    1050 <map_rebuild@plt>
  cs nopw 0x0(%rax,%rax,1)
L2:
  ret
```

assistant: ```c
void map_rebuild_action(const void *nodep, const VISIT which, const int depth) {
  static int map_idx;
  switch (which) {
  case preorder:
    break;
  case postorder:
    map_rebuild(*(struct map_rec **)nodep, map_idx++);
    break;
  case endorder:
    break;
  case leaf:
    map_rebuild(*(struct map_rec **)nodep, map_idx++);
    break;
  }
}
```