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

```asm
<bump_memlock_rlimit>:
  endbr64
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    D3(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,(%rsp)
  mov    %eax,0x4(%rsp)
  mov    %rsp,%rsi
  mov    D12(%rip),%rax
  mov    (%rax),%edi
  call   <setrlimit@plt>
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L8
  add    $0x18,%rsp
  ret
L8:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int bump_memlock_rlimit(void) {
  struct rlimit rlim_new = {
      .rlim_cur = RLIM_INFINITY,
      .rlim_max = RLIM_INFINITY,
  };
  return setrlimit(RLIMIT_MEMLOCK, &rlim_new);
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<bump_memlock_rlimit>:
  endbr64
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  mov    D16(%rip),%rax
  mov    %rsp,%rsi
  mov    (%rax),%eax
  mov    %eax,(%rsp)
  mov    %eax,0x4(%rsp)
  mov    D10(%rip),%rax
  mov    (%rax),%edi
  call   <setrlimit@plt>
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L0
  add    $0x18,%rsp
  ret
L0:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int bump_memlock_rlimit(void) {
  struct rlimit rlim_new = {
      .rlim_cur = RLIM_INFINITY,
      .rlim_max = RLIM_INFINITY,
  };
  return setrlimit(RLIMIT_MEMLOCK, &rlim_new);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<bump_memlock_rlimit>:
  endbr64
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  mov    D9(%rip),%rax
  mov    %rsp,%rsi
  movd   (%rax),%xmm0
  mov    D5(%rip),%rax
  mov    (%rax),%edi
  pshufd $0xe0,%xmm0,%xmm0
  movq   %xmm0,(%rsp)
  call   <setrlimit@plt>
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L9
  add    $0x18,%rsp
  ret
L9:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int bump_memlock_rlimit(void) {
  struct rlimit rlim_new = {
      .rlim_cur = RLIM_INFINITY,
      .rlim_max = RLIM_INFINITY,
  };
  return setrlimit(RLIMIT_MEMLOCK, &rlim_new);
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<alexa_strdup>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0xc(%rbp)
  mov    -0xc(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,%edi
  call   <alexa_malloc@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  je     L0
  mov    -0x18(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
L0:
  mov    -0x8(%rbp),%rax
  leave
  ret
```

assistant: ```c
char *alexa_strdup(const char *str) {
  int len = strlen(str);
  char *actual_str = (char *)alexa_malloc(len + 1);
  if (actual_str) {
    strcpy(actual_str, str);
  }
  return actual_str;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<alexa_strdup>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbp
  call   <strlen@plt>
  lea    0x1(%rax),%edi
  call   <alexa_malloc@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  jne    L2
L11:
  mov    %rbx,%rax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
L2:
  mov    %rbp,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  jmp    L11
```

assistant: ```c
char *alexa_strdup(const char *str) {
  int len = strlen(str);
  char *actual_str = (char *)alexa_malloc(len + 1);
  if (actual_str) {
    strcpy(actual_str, str);
  }
  return actual_str;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<alexa_strdup>:
  endbr64
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  sub    $0x8,%rsp
  call   <strlen@plt>
  lea    0x1(%rax),%edi
  call   <alexa_malloc@plt>
  mov    %rax,%r12
  test   %rax,%rax
  jne    L6
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  ret
  xchg   %ax,%ax
L6:
  mov    %rbp,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
char *alexa_strdup(const char *str) {
  int len = strlen(str);
  char *actual_str = (char *)alexa_malloc(len + 1);
  if (actual_str) {
    strcpy(actual_str, str);
  }
  return actual_str;
}
```
user: What is the c source code of the assembly code below:

```asm
<alexa_strdup>:
  endbr64
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  sub    $0x8,%rsp
  call   <strlen@plt>
  lea    0x1(%rax),%edi
  call   <alexa_malloc@plt>
  mov    %rax,%r12
  test   %rax,%rax
  jne    L0
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  ret
  xchg   %ax,%ax
L0:
  mov    %rbp,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
char *alexa_strdup(const char *str) {
  int len = strlen(str);
  char *actual_str = (char *)alexa_malloc(len + 1);
  if (actual_str) {
    strcpy(actual_str, str);
  }
  return actual_str;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<gwGetTimezone>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x90,%rsp
  mov    %rdi,-0x88(%rbp)
  mov    %rsi,-0x90(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x88(%rbp),%rax
  movb   $0x0,(%rax)
  mov    -0x90(%rbp),%rax
  movb   $0x0,(%rax)
  lea    D33(%rip),%rax
  mov    %rax,%rsi
  lea    D21(%rip),%rax
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x70(%rbp)
  cmpq   $0x0,-0x70(%rbp)
  je     L39
  jmp    L17
L72:
  lea    -0x60(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0x74(%rbp)
  cmpl   $0x1,-0x74(%rbp)
  jle    L86
  mov    -0x74(%rbp),%eax
  sub    $0x1,%eax
  cltq
  movzbl -0x60(%rbp,%rax,1),%eax
  cmp    $0xa,%al
  jne    L40
  mov    -0x74(%rbp),%eax
  sub    $0x1,%eax
  cltq
  movb   $0x0,-0x60(%rbp,%rax,1)
L40:
  subl   $0x1,-0x74(%rbp)
L86:
  lea    -0x60(%rbp),%rax
  lea    D32(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  mov    %rax,-0x68(%rbp)
  cmpq   $0x0,-0x68(%rbp)
  je     L13
  mov    -0x68(%rbp),%rax
  add    $0x8,%rax
  mov    %rax,%rdi
  call   <skipWhite@plt>
  mov    %eax,%edx
  mov    -0x88(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <strcpy@plt>
L13:
  lea    -0x60(%rbp),%rax
  lea    D12(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strstr@plt>
  mov    %rax,-0x68(%rbp)
  cmpq   $0x0,-0x68(%rbp)
  je     L17
  mov    -0x68(%rbp),%rax
  add    $0x8,%rax
  mov    %rax,%rdi
  call   <skipWhite@plt>
  mov    %eax,%edx
  mov    -0x90(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <strcpy@plt>
L17:
  mov    -0x70(%rbp),%rdx
  lea    -0x60(%rbp),%rax
  mov    $0x50,%esi
  mov    %rax,%rdi
  call   <fgets@plt>
  test   %rax,%rax
  jne    L72
  mov    -0x70(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    $0x1,%eax
  jmp    L27
L39:
  mov    $0x0,%eax
L27:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L6
  call   <__stack_chk_fail@plt>
L6:
  leave
  ret
```

tool_calls: name: unpack_data
arguments: label: D33
type: string
name: unpack_data
arguments: label: D21
type: string
name: unpack_data
arguments: label: D32
type: string
name: unpack_data
arguments: label: D12
type: string

tool: D33: r

tool: D21: /etc/config/system

tool: D32: timezone

tool: D12: zonename

assistant: ```c
int gwGetTimezone(char *tz, char *zn) {
  FILE *fp;
  char line[80];
  char *s;
  tz[0] = '\0';
  zn[0] = '\0';
  if ((fp = fopen("/etc/config/system", "r")) != NULL) {
    while (fgets(line, 80, fp) != NULL) {
      int len = strlen(line);
      if (len > 1) {
        if (line[len - 1] == '\n')
          line[len - 1] = '\0';
        len--;
      }
      if ((s = strstr(line, "timezone")) != NULL) {
        strcpy(tz, skipWhite(s + 8));
      }
      if ((s = strstr(line, "zonename")) != NULL) {
        strcpy(zn, skipWhite(s + 8));
      }
    }
    fclose(fp);
    return 1;
  }
  return 0;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<gwGetTimezone>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x68,%rsp
  mov    %rdi,%r14
  mov    %rsi,%r15
  mov    %fs:0x28,%rax
  mov    %rax,0x58(%rsp)
  xor    %eax,%eax
  movb   $0x0,(%rdi)
  movb   $0x0,(%rsi)
  lea    D15(%rip),%rsi
  lea    D21(%rip),%rdi
  call   <fopen@plt>
  mov    %rax,%rbp
  mov    %rsp,%rbx
  lea    D11(%rip),%r13
  lea    D32(%rip),%r12
  test   %rax,%rax
  jne    L46
  mov    $0x0,%eax
  jmp    L82
L9:
  mov    %r13,%rsi
  mov    %rbx,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L94
  lea    0x8(%rax),%rdi
  call   <skipWhite@plt>
  mov    %eax,%esi
  mov    %r14,%rdi
  call   <strcpy@plt>
L94:
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  jne    L26
L46:
  mov    %rbp,%rdx
  mov    $0x50,%esi
  mov    %rbx,%rdi
  call   <fgets@plt>
  test   %rax,%rax
  je     L11
  mov    %rbx,%rdi
  call   <strlen@plt>
  cmp    $0x1,%eax
  jle    L9
  sub    $0x1,%eax
  movslq %eax,%rdx
  cmpb   $0xa,(%rsp,%rdx,1)
  jne    L9
  movb   $0x0,(%rsp,%rdx,1)
  jmp    L9
L26:
  lea    0x8(%rax),%rdi
  call   <skipWhite@plt>
  mov    %eax,%esi
  mov    %r15,%rdi
  call   <strcpy@plt>
  jmp    L46
L11:
  mov    %rbp,%rdi
  call   <fclose@plt>
  mov    $0x1,%eax
L82:
  mov    0x58(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L0
  add    $0x68,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L0:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D15
type_infered: string
name: extract_symbolic_data
arguments: data_label: D21
type_infered: string
name: extract_symbolic_data
arguments: data_label: D11
type_infered: string
name: extract_symbolic_data
arguments: data_label: D32
type_infered: string

tool: D15: r

tool: D21: /etc/config/system

tool: D11: timezone

tool: D32: zonename

assistant: ```c
int gwGetTimezone(char *tz, char *zn) {
  FILE *fp;
  char line[80];
  char *s;
  tz[0] = '\0';
  zn[0] = '\0';
  if ((fp = fopen("/etc/config/system", "r")) != NULL) {
    while (fgets(line, 80, fp) != NULL) {
      int len = strlen(line);
      if (len > 1) {
        if (line[len - 1] == '\n')
          line[len - 1] = '\0';
        len--;
      }
      if ((s = strstr(line, "timezone")) != NULL) {
        strcpy(tz, skipWhite(s + 8));
      }
      if ((s = strstr(line, "zonename")) != NULL) {
        strcpy(zn, skipWhite(s + 8));
      }
    }
    fclose(fp);
    return 1;
  }
  return 0;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<gwGetTimezone>:
  endbr64
  push   %r15
  mov    %rsi,%r15
  push   %r14
  mov    %rdi,%r14
  push   %r13
  lea    D11(%rip),%r13
  push   %r12
  lea    D29(%rip),%r12
  push   %rbp
  push   %rbx
  sub    $0x68,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x58(%rsp)
  xor    %eax,%eax
  movb   $0x0,(%rdi)
  lea    D14(%rip),%rdi
  mov    %rsp,%rbx
  movb   $0x0,(%rsi)
  lea    D18(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  jne    L59
  jmp    L45
  nop
L52:
  mov    %rbx,%rdi
  call   <strlen@plt>
  cmp    $0x1,%eax
  jle    L11
  sub    $0x1,%eax
  cltq
  cmpb   $0xa,(%rsp,%rax,1)
  jne    L11
  movb   $0x0,(%rsp,%rax,1)
L11:
  mov    %r13,%rsi
  mov    %rbx,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L71
  lea    0x8(%rax),%rdi
  call   <skipWhite@plt>
  mov    %r14,%rdi
  mov    %eax,%esi
  call   <strcpy@plt>
L71:
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  jne    L73
L59:
  mov    %rbp,%rdx
  mov    $0x50,%esi
  mov    %rbx,%rdi
  call   <fgets@plt>
  test   %rax,%rax
  jne    L52
  mov    %rbp,%rdi
  call   <fclose@plt>
  mov    $0x1,%eax
L35:
  mov    0x58(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L19
  add    $0x68,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L73:
  lea    0x8(%rax),%rdi
  call   <skipWhite@plt>
  mov    %r15,%rdi
  mov    %eax,%esi
  call   <strcpy@plt>
  jmp    L59
  nopl   (%rax)
L45:
  xor    %eax,%eax
  jmp    L35
L19:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: label: D11
type_guessed: string
name: unpack_data
arguments: label: D29
type_guessed: string
name: unpack_data
arguments: label: D14
type_guessed: string
name: unpack_data
arguments: label: D18
type_guessed: string

tool: D11: timezone

tool: D29: zonename

tool: D14: /etc/config/system

tool: D18: r

assistant: ```c
int gwGetTimezone(char *tz, char *zn) {
  FILE *fp;
  char line[80];
  char *s;
  tz[0] = '\0';
  zn[0] = '\0';
  if ((fp = fopen("/etc/config/system", "r")) != NULL) {
    while (fgets(line, 80, fp) != NULL) {
      int len = strlen(line);
      if (len > 1) {
        if (line[len - 1] == '\n')
          line[len - 1] = '\0';
        len--;
      }
      if ((s = strstr(line, "timezone")) != NULL) {
        strcpy(tz, skipWhite(s + 8));
      }
      if ((s = strstr(line, "zonename")) != NULL) {
        strcpy(zn, skipWhite(s + 8));
      }
    }
    fclose(fp);
    return 1;
  }
  return 0;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<gwGetTimezone>:
  endbr64
  push   %r15
  mov    %rsi,%r15
  push   %r14
  mov    %rdi,%r14
  push   %r13
  lea    D36(%rip),%r13
  push   %r12
  lea    D27(%rip),%r12
  push   %rbp
  push   %rbx
  sub    $0x68,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x58(%rsp)
  xor    %eax,%eax
  movb   $0x0,(%rdi)
  lea    D0(%rip),%rdi
  mov    %rsp,%rbx
  movb   $0x0,(%rsi)
  lea    D26(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  jne    L22
  jmp    L58
  nop
L18:
  mov    %rbx,%rdi
  call   <strlen@plt>
  cmp    $0x1,%eax
  jle    L88
  sub    $0x1,%eax
  cltq
  cmpb   $0xa,(%rsp,%rax,1)
  jne    L88
  movb   $0x0,(%rsp,%rax,1)
L88:
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  je     L40
  lea    0x8(%rax),%rdi
  call   <skipWhite@plt>
  mov    %r14,%rdi
  mov    %eax,%esi
  call   <strcpy@plt>
L40:
  mov    %r13,%rsi
  mov    %rbx,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  jne    L93
L22:
  mov    %rbp,%rdx
  mov    $0x50,%esi
  mov    %rbx,%rdi
  call   <fgets@plt>
  test   %rax,%rax
  jne    L18
  mov    %rbp,%rdi
  call   <fclose@plt>
  mov    $0x1,%eax
L59:
  mov    0x58(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L41
  add    $0x68,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L93:
  lea    0x8(%rax),%rdi
  call   <skipWhite@plt>
  mov    %r15,%rdi
  mov    %eax,%esi
  call   <strcpy@plt>
  jmp    L22
  nopl   (%rax)
L58:
  xor    %eax,%eax
  jmp    L59
L41:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_tag: D36
type_infered: string
name: retrieve_data
arguments: data_tag: D27
type_infered: string
name: retrieve_data
arguments: data_tag: D0
type_infered: string
name: retrieve_data
arguments: data_tag: D26
type_infered: string

tool: D36: zonename

tool: D27: timezone

tool: D0: /etc/config/system

tool: D26: r

assistant: ```c
int gwGetTimezone(char *tz, char *zn) {
  FILE *fp;
  char line[80];
  char *s;
  tz[0] = '\0';
  zn[0] = '\0';
  if ((fp = fopen("/etc/config/system", "r")) != NULL) {
    while (fgets(line, 80, fp) != NULL) {
      int len = strlen(line);
      if (len > 1) {
        if (line[len - 1] == '\n')
          line[len - 1] = '\0';
        len--;
      }
      if ((s = strstr(line, "timezone")) != NULL) {
        strcpy(tz, skipWhite(s + 8));
      }
      if ((s = strstr(line, "zonename")) != NULL) {
        strcpy(zn, skipWhite(s + 8));
      }
    }
    fclose(fp);
    return 1;
  }
  return 0;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<decode_bch_codeword>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    -0x24(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  movl   $0x0,-0x20(%rbp)
  movl   $0x0,-0x18(%rbp)
  jmp    L66
L32:
  mov    -0x24(%rbp),%eax
  and    $0x80d,%eax
  mov    $0xf,%esi
  mov    %eax,%edi
  call   <parity@plt>
  mov    %eax,-0x10(%rbp)
  mov    -0x24(%rbp),%eax
  and    $0x2203,%eax
  mov    $0xf,%esi
  mov    %eax,%edi
  call   <parity@plt>
  mov    %eax,-0xc(%rbp)
  mov    -0x24(%rbp),%eax
  and    $0x5101,%eax
  mov    $0xf,%esi
  mov    %eax,%edi
  call   <parity@plt>
  mov    %eax,-0x8(%rbp)
  mov    -0x24(%rbp),%eax
  and    $0xd1,%eax
  mov    $0xf,%esi
  mov    %eax,%edi
  call   <parity@plt>
  mov    %eax,-0x4(%rbp)
  mov    -0x10(%rbp),%edx
  mov    -0xc(%rbp),%eax
  add    %eax,%edx
  mov    -0x8(%rbp),%eax
  add    %eax,%edx
  mov    -0x4(%rbp),%eax
  add    %edx,%eax
  cmp    $0x2,%eax
  jle    L42
  mov    -0x24(%rbp),%eax
  and    $0x1,%eax
  test   %eax,%eax
  sete   %al
  movzbl %al,%eax
  mov    %eax,-0x1c(%rbp)
  jmp    L59
L42:
  mov    -0x24(%rbp),%eax
  and    $0x1,%eax
  mov    %eax,-0x1c(%rbp)
L59:
  shrl   -0x24(%rbp)
  cmpl   $0x0,-0x1c(%rbp)
  je     L27
  mov    $0x4000,%eax
  jmp    L25
L27:
  mov    $0x0,%eax
L25:
  or     %eax,-0x24(%rbp)
  shrl   -0x18(%rbp)
  cmpl   $0x0,-0x1c(%rbp)
  je     L13
  mov    $0x4000,%eax
  jmp    L48
L13:
  mov    $0x0,%eax
L48:
  or     %eax,-0x18(%rbp)
  addl   $0x1,-0x20(%rbp)
L66:
  cmpl   $0xe,-0x20(%rbp)
  jle    L32
  mov    -0x24(%rbp),%eax
  xor    -0x14(%rbp),%eax
  mov    %eax,%edx
  mov    -0x30(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0x18(%rbp),%eax
  and    $0x7f,%eax
  leave
  ret
```

assistant: ```c
unsigned char decode_bch_codeword(unsigned int code, unsigned int *error) {
  int i, bit;
  int a1, a2, a3, a4;
  unsigned int input, output;
  input = code;
  for (i = 0, output = 0; i < 15; i++) {
    a1 = parity(0x080D & code, 15);
    a2 = parity(0x2203 & code, 15);
    a3 = parity(0x5101 & code, 15);
    a4 = parity(0x00D1 & code, 15);
    if ((a1 + a2 + a3 + a4) >= 3) {
      bit = (code ^ 1) & 1;
    } else {
      bit = (code ^ 0) & 1;
    }
    code >>= 1;
    code |= bit ? 0x4000 : 0;
    output >>= 1;
    output |= bit ? 0x4000 : 0;
  }
  *error = code ^ input;
  return (unsigned char)(output & 0x7F);
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<decode_bch_codeword>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %edi,%ebx
  mov    %edi,0x4(%rsp)
  mov    %rsi,0x8(%rsp)
  mov    $0xf,%r15d
  mov    $0x0,%r12d
L7:
  mov    %ebx,%edi
  and    $0x80d,%edi
  mov    $0xf,%esi
  call   <parity@plt>
  mov    %eax,%ebp
  mov    %ebx,%edi
  and    $0x2203,%edi
  mov    $0xf,%esi
  call   <parity@plt>
  mov    %eax,%r14d
  mov    %ebx,%edi
  and    $0x5101,%edi
  mov    $0xf,%esi
  call   <parity@plt>
  mov    %eax,%r13d
  mov    %ebx,%edi
  and    $0xd1,%edi
  mov    $0xf,%esi
  call   <parity@plt>
  add    %r14d,%ebp
  add    %r13d,%ebp
  add    %eax,%ebp
  mov    %ebx,%eax
  xor    $0x1,%eax
  and    $0x1,%eax
  mov    %ebx,%edx
  and    $0x1,%edx
  cmp    $0x3,%ebp
  cmovge %eax,%edx
  shr    %ebx
  shl    $0xe,%edx
  or     %edx,%ebx
  shr    %r12d
  or     %edx,%r12d
  sub    $0x1,%r15d
  jne    L7
  mov    0x4(%rsp),%eax
  xor    %ebx,%eax
  mov    0x8(%rsp),%rcx
  mov    %eax,(%rcx)
  mov    %r12d,%eax
  and    $0x7f,%eax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
unsigned char decode_bch_codeword(unsigned int code, unsigned int *error) {
  int i, bit;
  int a1, a2, a3, a4;
  unsigned int input, output;
  input = code;
  for (i = 0, output = 0; i < 15; i++) {
    a1 = parity(0x080D & code, 15);
    a2 = parity(0x2203 & code, 15);
    a3 = parity(0x5101 & code, 15);
    a4 = parity(0x00D1 & code, 15);
    if ((a1 + a2 + a3 + a4) >= 3) {
      bit = (code ^ 1) & 1;
    } else {
      bit = (code ^ 0) & 1;
    }
    code >>= 1;
    code |= bit ? 0x4000 : 0;
    output >>= 1;
    output |= bit ? 0x4000 : 0;
  }
  *error = code ^ input;
  return (unsigned char)(output & 0x7F);
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<decode_bch_codeword>:
  endbr64
  push   %r15
  mov    $0xf,%r15d
  push   %r14
  push   %r13
  push   %r12
  xor    %r12d,%r12d
  push   %rbp
  push   %rbx
  mov    %edi,%ebx
  sub    $0x18,%rsp
  mov    %edi,0x4(%rsp)
  mov    %rsi,0x8(%rsp)
  cs nopw 0x0(%rax,%rax,1)
L6:
  mov    %ebx,%edi
  mov    $0xf,%esi
  and    $0x80d,%edi
  call   <parity@plt>
  mov    %ebx,%edi
  mov    $0xf,%esi
  and    $0x2203,%edi
  mov    %eax,%ebp
  call   <parity@plt>
  mov    %ebx,%edi
  mov    $0xf,%esi
  and    $0x5101,%edi
  mov    %eax,%r14d
  call   <parity@plt>
  mov    %ebx,%edi
  add    %r14d,%ebp
  mov    $0xf,%esi
  mov    %eax,%r13d
  and    $0xd1,%edi
  call   <parity@plt>
  add    %r13d,%ebp
  mov    %ebx,%edx
  add    %eax,%ebp
  mov    %ebx,%eax
  and    $0x1,%edx
  not    %eax
  and    $0x1,%eax
  cmp    $0x3,%ebp
  cmovge %eax,%edx
  shr    %ebx
  shr    %r12d
  shl    $0xe,%edx
  or     %edx,%ebx
  or     %edx,%r12d
  sub    $0x1,%r15d
  jne    L6
  mov    0x4(%rsp),%eax
  mov    0x8(%rsp),%rcx
  xor    %ebx,%eax
  mov    %eax,(%rcx)
  add    $0x18,%rsp
  mov    %r12d,%eax
  pop    %rbx
  and    $0x7f,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
unsigned char decode_bch_codeword(unsigned int code, unsigned int *error) {
  int i, bit;
  int a1, a2, a3, a4;
  unsigned int input, output;
  input = code;
  for (i = 0, output = 0; i < 15; i++) {
    a1 = parity(0x080D & code, 15);
    a2 = parity(0x2203 & code, 15);
    a3 = parity(0x5101 & code, 15);
    a4 = parity(0x00D1 & code, 15);
    if ((a1 + a2 + a3 + a4) >= 3) {
      bit = (code ^ 1) & 1;
    } else {
      bit = (code ^ 0) & 1;
    }
    code >>= 1;
    code |= bit ? 0x4000 : 0;
    output >>= 1;
    output |= bit ? 0x4000 : 0;
  }
  *error = code ^ input;
  return (unsigned char)(output & 0x7F);
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<decode_bch_codeword>:
  endbr64
  push   %r15
  mov    $0xf,%r15d
  push   %r14
  push   %r13
  push   %r12
  xor    %r12d,%r12d
  push   %rbp
  push   %rbx
  mov    %edi,%ebx
  sub    $0x18,%rsp
  mov    %edi,0x4(%rsp)
  mov    %rsi,0x8(%rsp)
  cs nopw 0x0(%rax,%rax,1)
L1:
  mov    %ebx,%edi
  mov    $0xf,%esi
  and    $0x80d,%edi
  call   <parity@plt>
  mov    %ebx,%edi
  mov    $0xf,%esi
  and    $0x2203,%edi
  mov    %eax,%ebp
  call   <parity@plt>
  mov    %ebx,%edi
  mov    $0xf,%esi
  and    $0x5101,%edi
  mov    %eax,%r14d
  call   <parity@plt>
  mov    %ebx,%edi
  add    %r14d,%ebp
  mov    $0xf,%esi
  mov    %eax,%r13d
  and    $0xd1,%edi
  call   <parity@plt>
  add    %r13d,%ebp
  mov    %ebx,%edx
  add    %eax,%ebp
  mov    %ebx,%eax
  and    $0x1,%edx
  not    %eax
  and    $0x1,%eax
  cmp    $0x3,%ebp
  cmovge %eax,%edx
  shr    %ebx
  shr    %r12d
  shl    $0xe,%edx
  or     %edx,%ebx
  or     %edx,%r12d
  sub    $0x1,%r15d
  jne    L1
  mov    0x4(%rsp),%eax
  mov    0x8(%rsp),%rcx
  xor    %ebx,%eax
  mov    %eax,(%rcx)
  add    $0x18,%rsp
  mov    %r12d,%eax
  pop    %rbx
  and    $0x7f,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
unsigned char decode_bch_codeword(unsigned int code, unsigned int *error) {
  int i, bit;
  int a1, a2, a3, a4;
  unsigned int input, output;
  input = code;
  for (i = 0, output = 0; i < 15; i++) {
    a1 = parity(0x080D & code, 15);
    a2 = parity(0x2203 & code, 15);
    a3 = parity(0x5101 & code, 15);
    a4 = parity(0x00D1 & code, 15);
    if ((a1 + a2 + a3 + a4) >= 3) {
      bit = (code ^ 1) & 1;
    } else {
      bit = (code ^ 0) & 1;
    }
    code >>= 1;
    code |= bit ? 0x4000 : 0;
    output >>= 1;
    output |= bit ? 0x4000 : 0;
  }
  *error = code ^ input;
  return (unsigned char)(output & 0x7F);
}
```