ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<MPI_Send>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    %esi,-0xc(%rbp)
  mov    %edx,-0x10(%rbp)
  mov    %ecx,-0x14(%rbp)
  mov    %r8d,-0x18(%rbp)
  mov    %r9d,-0x1c(%rbp)
  lea    D6(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x0,%eax
  leave
  ret
```

tool_calls: name: parse_data
arguments: data_tag: D6
type_guessed: string

tool: D6: MPI Stub WARNING: Should not send message to self


assistant: ```c
int MPI_Send(const void *buf, int count, int datatype, int dest, int tag, int comm) {
  printf("MPI Stub WARNING: Should not send message to self\n");
  return 0;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

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

tool_calls: name: read_data
arguments: tag: D8
type_infered: string

tool: D8: MPI Stub WARNING: Should not send message to self


assistant: ```c
int MPI_Send(const void *buf, int count, int datatype, int dest, int tag, int comm) {
  printf("MPI Stub WARNING: Should not send message to self\n");
  return 0;
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

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

tool_calls: name: extract_symbolic_data
arguments: label: D4
datatype: string

tool: D4: MPI Stub WARNING: Should not send message to self


assistant: ```c
int MPI_Send(const void *buf, int count, int datatype, int dest, int tag, int comm) {
  printf("MPI Stub WARNING: Should not send message to self\n");
  return 0;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

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

tool_calls: name: extract_symbolic_data
arguments: tag: D7
data_type: string

tool: D7: MPI Stub WARNING: Should not send message to self


assistant: ```c
int MPI_Send(const void *buf, int count, int datatype, int dest, int tag, int comm) {
  printf("MPI Stub WARNING: Should not send message to self\n");
  return 0;
}
```
user: What is the c source code of the assembly code below?

```asm
<us_bits_get_doublet_bitfield>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    %edx,-0x20(%rbp)
  mov    %ecx,-0x24(%rbp)
  mov    -0x1c(%rbp),%edx
  mov    -0x18(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <us_bits_get_doublet@plt>
  mov    %eax,-0x8(%rbp)
  mov    -0x24(%rbp),%eax
  sub    -0x20(%rbp),%eax
  mov    %eax,%edx
  mov    $0xf,%eax
  sub    %edx,%eax
  mov    $0xffff,%edx
  mov    %eax,%ecx
  sar    %cl,%edx
  mov    $0xf,%eax
  sub    -0x24(%rbp),%eax
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  and    -0x8(%rbp),%eax
  mov    %eax,%edx
  mov    $0xf,%eax
  sub    -0x24(%rbp),%eax
  mov    %eax,%ecx
  sar    %cl,%edx
  mov    %edx,%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  leave
  ret
```

assistant: ```c
uint16_t us_bits_get_doublet_bitfield(const void *base, uint16_t offset, uint16_t msb, uint16_t lsb) {
  uint32_t v = us_bits_get_doublet(base, offset);
  uint32_t r = ((((v)) & (((0xffff) >> (16 - ((lsb) - (msb) + 1))) << (15 - ((lsb))))) >> (15 - ((lsb))));
  return r;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<us_bits_get_doublet_bitfield>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %edx,%ebp
  mov    %ecx,%ebx
  call   <us_bits_get_doublet@plt>
  mov    %eax,%esi
  mov    $0xf,%ecx
  mov    %ecx,%eax
  sub    %ebx,%eax
  sub    %ebp,%ebx
  sub    %ebx,%ecx
  mov    $0xffff,%edx
  sar    %cl,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  and    %esi,%edx
  sar    %cl,%edx
  mov    %edx,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
uint16_t us_bits_get_doublet_bitfield(const void *base, uint16_t offset, uint16_t msb, uint16_t lsb) {
  uint32_t v = us_bits_get_doublet(base, offset);
  uint32_t r = ((((v)) & (((0xffff) >> (16 - ((lsb) - (msb) + 1))) << (15 - ((lsb))))) >> (15 - ((lsb))));
  return r;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<us_bits_get_doublet_bitfield>:
  endbr64
  push   %rbp
  mov    %edx,%ebp
  push   %rbx
  mov    %ecx,%ebx
  sub    $0x8,%rsp
  call   <us_bits_get_doublet@plt>
  mov    $0xf,%ecx
  mov    $0xffff,%edx
  add    $0x8,%rsp
  mov    %eax,%r8d
  mov    %ecx,%eax
  sub    %ebx,%eax
  sub    %ebp,%ebx
  sub    %ebx,%ecx
  pop    %rbx
  pop    %rbp
  sar    %cl,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  and    %r8d,%edx
  sar    %cl,%edx
  mov    %edx,%eax
  ret
```

assistant: ```c
uint16_t us_bits_get_doublet_bitfield(const void *base, uint16_t offset, uint16_t msb, uint16_t lsb) {
  uint32_t v = us_bits_get_doublet(base, offset);
  uint32_t r = ((((v)) & (((0xffff) >> (16 - ((lsb) - (msb) + 1))) << (15 - ((lsb))))) >> (15 - ((lsb))));
  return r;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<us_bits_get_doublet_bitfield>:
  endbr64
  push   %rbp
  mov    %edx,%ebp
  push   %rbx
  mov    %ecx,%ebx
  sub    $0x8,%rsp
  call   <us_bits_get_doublet@plt>
  mov    $0xf,%ecx
  mov    $0xffff,%edx
  add    $0x8,%rsp
  mov    %eax,%r8d
  mov    %ecx,%eax
  sub    %ebx,%eax
  sub    %ebp,%ebx
  sub    %ebx,%ecx
  pop    %rbx
  pop    %rbp
  sar    %cl,%edx
  mov    %eax,%ecx
  shl    %cl,%edx
  and    %r8d,%edx
  sar    %cl,%edx
  mov    %edx,%eax
  ret
```

assistant: ```c
uint16_t us_bits_get_doublet_bitfield(const void *base, uint16_t offset, uint16_t msb, uint16_t lsb) {
  uint32_t v = us_bits_get_doublet(base, offset);
  uint32_t r = ((((v)) & (((0xffff) >> (16 - ((lsb) - (msb) + 1))) << (15 - ((lsb))))) >> (15 - ((lsb))));
  return r;
}
```
user: Translate the below assembly code into C programming language:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    $0x1,%edi
  call   <assert@plt>
  mov    $0x0,%eax
  pop    %rbp
  ret
```

assistant: ```c
int main() {
  assert(3 > 2);
  return 0;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x1,%edi
  call   <assert@plt>
  mov    $0x0,%eax
  add    $0x8,%rsp
  ret
```

assistant: ```c
int main() {
  assert(3 > 2);
  return 0;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x1,%edi
  call   <assert@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  ret
```

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

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x1,%edi
  call   <assert@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  ret
```

assistant: ```c
int main() {
  assert(3 > 2);
  return 0;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<fdasd_usage>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  lea    D0(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  nop
  pop    %rbp
  ret
```

tool_calls: name: parse_data
arguments: label: D0
data_type: string

tool: D0: 
Usage: fdasd [OPTIONS] [DEVICE]

Partition a DASD device either in interactive mode or automatically.
DEVICE is the node of the device (e.g. '/dev/dasda')

-h, --help               Print this help, then exit
-v, --version            Print version information, then exit
-s, --silent             Suppress messages
-r, --verbose            Provide more verbose output
-a, --auto               Automatically create a partition using the entire disk
-k, --keep_volser        Keep current volume serial when performing automatic
                         partitioning
-l, --label VOLSER       Set the volume serial to VOLSER when performing
                         automatic partitioning
-c, --config CONFIGFILE  Automatically create partition(s) using information
                         found in CONFIGFILE
-i, --volser             Print volume serial
-p, --table              Print partition table
-f, --force              Force fdasd to work on non DASD devices


assistant: ```c
void fdasd_usage(void) {
  printf("\nUsage: fdasd [OPTIONS] [DEVICE]\n"
         "\n"
         "Partition a DASD device either in interactive mode or "
         "automatically.\n"
         "DEVICE is the node of the device (e.g. '/dev/dasda')\n"
         "\n"
         "-h, --help               Print this help, then exit\n"
         "-v, --version            Print version information, "
         "then exit\n"
         "-s, --silent             Suppress messages\n"
         "-r, --verbose            Provide more verbose output\n"
         "-a, --auto               Automatically create a partition "
         "using the entire disk\n"
         "-k, --keep_volser        Keep current volume serial when "
         "performing automatic\n"
         "                         partitioning\n"
         "-l, --label VOLSER       Set the volume serial to VOLSER "
         "when performing\n"
         "                         automatic partitioning\n"
         "-c, --config CONFIGFILE  Automatically create partition(s) "
         "using information\n"
         "                         found in CONFIGFILE\n"
         "-i, --volser             Print volume serial\n"
         "-p, --table              Print partition table\n"
         "-f, --force              Force fdasd to work on non DASD devices\n");
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<fdasd_usage>:
  endbr64
  sub    $0x8,%rsp
  lea    D0(%rip),%rdi
  call   <printf@plt>
  add    $0x8,%rsp
  ret
```

tool_calls: name: unpack_data
arguments: tag: D0
data_type: string

tool: D0: 
Usage: fdasd [OPTIONS] [DEVICE]

Partition a DASD device either in interactive mode or automatically.
DEVICE is the node of the device (e.g. '/dev/dasda')

-h, --help               Print this help, then exit
-v, --version            Print version information, then exit
-s, --silent             Suppress messages
-r, --verbose            Provide more verbose output
-a, --auto               Automatically create a partition using the entire disk
-k, --keep_volser        Keep current volume serial when performing automatic
                         partitioning
-l, --label VOLSER       Set the volume serial to VOLSER when performing
                         automatic partitioning
-c, --config CONFIGFILE  Automatically create partition(s) using information
                         found in CONFIGFILE
-i, --volser             Print volume serial
-p, --table              Print partition table
-f, --force              Force fdasd to work on non DASD devices


assistant: ```c
void fdasd_usage(void) {
  printf("\nUsage: fdasd [OPTIONS] [DEVICE]\n"
         "\n"
         "Partition a DASD device either in interactive mode or "
         "automatically.\n"
         "DEVICE is the node of the device (e.g. '/dev/dasda')\n"
         "\n"
         "-h, --help               Print this help, then exit\n"
         "-v, --version            Print version information, "
         "then exit\n"
         "-s, --silent             Suppress messages\n"
         "-r, --verbose            Provide more verbose output\n"
         "-a, --auto               Automatically create a partition "
         "using the entire disk\n"
         "-k, --keep_volser        Keep current volume serial when "
         "performing automatic\n"
         "                         partitioning\n"
         "-l, --label VOLSER       Set the volume serial to VOLSER "
         "when performing\n"
         "                         automatic partitioning\n"
         "-c, --config CONFIGFILE  Automatically create partition(s) "
         "using information\n"
         "                         found in CONFIGFILE\n"
         "-i, --volser             Print volume serial\n"
         "-p, --table              Print partition table\n"
         "-f, --force              Force fdasd to work on non DASD devices\n");
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<fdasd_usage>:
  endbr64
  lea    D8(%rip),%rdi
  jmp    1050 <printf@plt>
```

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

tool: D8: 
Usage: fdasd [OPTIONS] [DEVICE]

Partition a DASD device either in interactive mode or automatically.
DEVICE is the node of the device (e.g. '/dev/dasda')

-h, --help               Print this help, then exit
-v, --version            Print version information, then exit
-s, --silent             Suppress messages
-r, --verbose            Provide more verbose output
-a, --auto               Automatically create a partition using the entire disk
-k, --keep_volser        Keep current volume serial when performing automatic
                         partitioning
-l, --label VOLSER       Set the volume serial to VOLSER when performing
                         automatic partitioning
-c, --config CONFIGFILE  Automatically create partition(s) using information
                         found in CONFIGFILE
-i, --volser             Print volume serial
-p, --table              Print partition table
-f, --force              Force fdasd to work on non DASD devices


assistant: ```c
void fdasd_usage(void) {
  printf("\nUsage: fdasd [OPTIONS] [DEVICE]\n"
         "\n"
         "Partition a DASD device either in interactive mode or "
         "automatically.\n"
         "DEVICE is the node of the device (e.g. '/dev/dasda')\n"
         "\n"
         "-h, --help               Print this help, then exit\n"
         "-v, --version            Print version information, "
         "then exit\n"
         "-s, --silent             Suppress messages\n"
         "-r, --verbose            Provide more verbose output\n"
         "-a, --auto               Automatically create a partition "
         "using the entire disk\n"
         "-k, --keep_volser        Keep current volume serial when "
         "performing automatic\n"
         "                         partitioning\n"
         "-l, --label VOLSER       Set the volume serial to VOLSER "
         "when performing\n"
         "                         automatic partitioning\n"
         "-c, --config CONFIGFILE  Automatically create partition(s) "
         "using information\n"
         "                         found in CONFIGFILE\n"
         "-i, --volser             Print volume serial\n"
         "-p, --table              Print partition table\n"
         "-f, --force              Force fdasd to work on non DASD devices\n");
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<fdasd_usage>:
  endbr64
  lea    D3(%rip),%rdi
  jmp    1050 <printf@plt>
```

tool_calls: name: disassemble_data
arguments: data_label: D3
type: string

tool: D3: 
Usage: fdasd [OPTIONS] [DEVICE]

Partition a DASD device either in interactive mode or automatically.
DEVICE is the node of the device (e.g. '/dev/dasda')

-h, --help               Print this help, then exit
-v, --version            Print version information, then exit
-s, --silent             Suppress messages
-r, --verbose            Provide more verbose output
-a, --auto               Automatically create a partition using the entire disk
-k, --keep_volser        Keep current volume serial when performing automatic
                         partitioning
-l, --label VOLSER       Set the volume serial to VOLSER when performing
                         automatic partitioning
-c, --config CONFIGFILE  Automatically create partition(s) using information
                         found in CONFIGFILE
-i, --volser             Print volume serial
-p, --table              Print partition table
-f, --force              Force fdasd to work on non DASD devices


assistant: ```c
void fdasd_usage(void) {
  printf("\nUsage: fdasd [OPTIONS] [DEVICE]\n"
         "\n"
         "Partition a DASD device either in interactive mode or "
         "automatically.\n"
         "DEVICE is the node of the device (e.g. '/dev/dasda')\n"
         "\n"
         "-h, --help               Print this help, then exit\n"
         "-v, --version            Print version information, "
         "then exit\n"
         "-s, --silent             Suppress messages\n"
         "-r, --verbose            Provide more verbose output\n"
         "-a, --auto               Automatically create a partition "
         "using the entire disk\n"
         "-k, --keep_volser        Keep current volume serial when "
         "performing automatic\n"
         "                         partitioning\n"
         "-l, --label VOLSER       Set the volume serial to VOLSER "
         "when performing\n"
         "                         automatic partitioning\n"
         "-c, --config CONFIGFILE  Automatically create partition(s) "
         "using information\n"
         "                         found in CONFIGFILE\n"
         "-i, --volser             Print volume serial\n"
         "-p, --table              Print partition table\n"
         "-f, --force              Force fdasd to work on non DASD devices\n");
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<insert_li>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x8(%rbp)
  mov    %rsi,-0x10(%rbp)
  mov    %rdx,-0x18(%rbp)
  mov    -0x10(%rbp),%rax
  and    $0x3fffffc,%eax
  or     -0x8(%rbp),%rax
  pop    %rbp
  ret
```

assistant: ```c
unsigned long insert_li(insn, value, errmsg)
unsigned long insn;
long value;
const char **errmsg;
{ return insn | (value & 0x3fffffc); }
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<insert_li>:
  endbr64
  mov    %rsi,%rax
  and    $0x3fffffc,%eax
  or     %rdi,%rax
  ret
```

assistant: ```c
unsigned long insert_li(insn, value, errmsg)
unsigned long insn;
long value;
const char **errmsg;
{ return insn | (value & 0x3fffffc); }
```
user: What would the C source look like for the assembly code provided here:

```asm
<insert_li>:
  endbr64
  mov    %rsi,%rax
  and    $0x3fffffc,%eax
  or     %rdi,%rax
  ret
```

assistant: ```c
unsigned long insert_li(insn, value, errmsg)
unsigned long insn;
long value;
const char **errmsg;
{ return insn | (value & 0x3fffffc); }
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<insert_li>:
  endbr64
  mov    %rsi,%rax
  and    $0x3fffffc,%eax
  or     %rdi,%rax
  ret
```

assistant: ```c
unsigned long insert_li(insn, value, errmsg)
unsigned long insn;
long value;
const char **errmsg;
{ return insn | (value & 0x3fffffc); }
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<strndup>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x20(%rbp),%rdx
  mov    -0x18(%rbp),%rcx
  mov    -0x8(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  mov    -0x8(%rbp),%rax
  leave
  ret
```

assistant: ```c
char *strndup(const char *str, size_t n) {
  char *ret = (char *)malloc(n);
  strncpy(ret, str, n);
  return ret;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<strndup>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%r12
  mov    %rsi,%rbp
  mov    %rsi,%rdi
  call   <malloc@plt>
  mov    %rax,%rbx
  mov    %rbp,%rdx
  mov    %r12,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  mov    %rbx,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
char *strndup(const char *str, size_t n) {
  char *ret = (char *)malloc(n);
  strncpy(ret, str, n);
  return ret;
}
```
user: What is the c source code of the assembly code below:

```asm
<strndup>:
  endbr64
  push   %r13
  mov    %rsi,%r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  mov    %rsi,%rdi
  call   <malloc@plt>
  mov    %r13,%rdx
  mov    %rbp,%rsi
  mov    %rax,%r12
  mov    %rax,%rdi
  call   <strncpy@plt>
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
char *strndup(const char *str, size_t n) {
  char *ret = (char *)malloc(n);
  strncpy(ret, str, n);
  return ret;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<strndup>:
  endbr64
  push   %r13
  mov    %rsi,%r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  mov    %rsi,%rdi
  call   <malloc@plt>
  mov    %r13,%rdx
  mov    %rbp,%rsi
  mov    %rax,%r12
  mov    %rax,%rdi
  call   <strncpy@plt>
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
char *strndup(const char *str, size_t n) {
  char *ret = (char *)malloc(n);
  strncpy(ret, str, n);
  return ret;
}
```
user: What is the c source code of the assembly code below:

```asm
<get_pkgname>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    $0x200,%edi
  call   <malloc@plt>
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  mov    $0x200,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  cmpq   $0x0,-0x28(%rbp)
  jne    L31
  mov    $0x0,%esi
  mov    $0x0,%edi
  call   <getcwd@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    $0x2f,%esi
  mov    %rax,%rdi
  call   <strrchr@plt>
  mov    %rax,-0x28(%rbp)
  addq   $0x1,-0x28(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
L31:
  movl   $0x0,-0x14(%rbp)
  jmp    L11
L36:
  mov    -0x14(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2d,%al
  je     L39
  mov    -0x14(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  je     L39
  mov    -0x14(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    -0x14(%rbp),%edx
  movslq %edx,%rcx
  mov    -0x10(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  addl   $0x1,-0x14(%rbp)
L11:
  cmpl   $0x1ff,-0x14(%rbp)
  jle    L36
L39:
  mov    -0x10(%rbp),%rax
  leave
  ret
```

assistant: ```c
char *get_pkgname(char *pkgname) {
  int i;
  char *name = malloc(sizeof(char) * 512);
  memset(name, 0, 512);
  if (!pkgname) {
    char *cwd = getcwd(NULL, 0);
    pkgname = strrchr(cwd, '/');
    pkgname++;
    free(cwd);
  }
  for (i = 0; i < 512; ++i) {
    if (pkgname[i] == '-' || pkgname[i] == '.')
      break;
    else
      name[i] = pkgname[i];
  }
  return name;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<get_pkgname>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  mov    $0x200,%edi
  call   <malloc@plt>
  mov    %rax,%rbp
  mov    $0x200,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  test   %rbx,%rbx
  je     L35
L6:
  mov    $0x0,%eax
L5:
  movzbl (%rbx,%rax,1),%edx
  lea    -0x2d(%rdx),%ecx
  cmp    $0x1,%cl
  jbe    L31
  mov    %dl,0x0(%rbp,%rax,1)
  add    $0x1,%rax
  cmp    $0x200,%rax
  jne    L5
L31:
  mov    %rbp,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L35:
  mov    $0x0,%esi
  mov    $0x0,%edi
  call   <getcwd@plt>
  mov    %rax,%r12
  mov    $0x2f,%esi
  mov    %rax,%rdi
  call   <strrchr@plt>
  lea    0x1(%rax),%rbx
  mov    %r12,%rdi
  call   <free@plt>
  jmp    L6
```

assistant: ```c
char *get_pkgname(char *pkgname) {
  int i;
  char *name = malloc(sizeof(char) * 512);
  memset(name, 0, 512);
  if (!pkgname) {
    char *cwd = getcwd(NULL, 0);
    pkgname = strrchr(cwd, '/');
    pkgname++;
    free(cwd);
  }
  for (i = 0; i < 512; ++i) {
    if (pkgname[i] == '-' || pkgname[i] == '.')
      break;
    else
      name[i] = pkgname[i];
  }
  return name;
}
```