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

```asm
<useage>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  lea    D89(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    D48(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    D70(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    D27(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    D48(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    D32(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    D36(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    D134(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    D48(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    D12(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    D112(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    D13(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    D92(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  lea    D48(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  nop
  pop    %rbp
  ret
```

tool_calls: name: read_data
arguments: data_tag: D89
type_guessed: string
name: read_data
arguments: data_tag: D48
type_guessed: string
name: read_data
arguments: data_tag: D70
type_guessed: string
name: read_data
arguments: data_tag: D27
type_guessed: string
name: read_data
arguments: data_tag: D32
type_guessed: string
name: read_data
arguments: data_tag: D36
type_guessed: string
name: read_data
arguments: data_tag: D134
type_guessed: string
name: read_data
arguments: data_tag: D12
type_guessed: string
name: read_data
arguments: data_tag: D112
type_guessed: string
name: read_data
arguments: data_tag: D13
type_guessed: string
name: read_data
arguments: data_tag: D92
type_guessed: string

tool: D89: 
rule, a constrained cellular automaton visualizer


tool: D48: 


tool: D70: USEAGE:


tool: D27:  rule <rule number> [<initial condition>]


tool: D32: EXAMPLES:


tool: D36:  rule 30


tool: D134:  rule 110 0xFAFF


tool: D12: NOTES:


tool: D112:  There are 16 cells on a torus. Arguments can be hex or decimal.


tool: D13:  If no initial condition is supplied, default is 1. For more


tool: D92:  information read 'elementary cellular automaton' on wikipedia


assistant: ```c
void useage() {
  printf("\nrule, a constrained cellular automaton visualizer\n");
  printf("\n");
  printf("USEAGE:\n");
  printf(" rule <rule number> [<initial condition>]\n");
  printf("\n");
  printf("EXAMPLES:\n");
  printf(" rule 30\n");
  printf(" rule 110 0xFAFF\n");
  printf("\n");
  printf("NOTES:\n");
  printf(" There are 16 cells on a torus. Arguments can be hex or decimal.\n");
  printf(" If no initial condition is supplied, default is 1. For more\n");
  printf(" information read 'elementary cellular automaton' on wikipedia\n");
  printf("\n");
  return;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<useage>:
  endbr64
  push   %rbx
  lea    D103(%rip),%rdi
  call   <printf@plt>
  lea    D19(%rip),%rbx
  mov    %rbx,%rdi
  call   <printf@plt>
  lea    D66(%rip),%rdi
  call   <printf@plt>
  lea    D76(%rip),%rdi
  call   <printf@plt>
  mov    %rbx,%rdi
  call   <printf@plt>
  lea    D46(%rip),%rdi
  call   <printf@plt>
  lea    D98(%rip),%rdi
  call   <printf@plt>
  lea    D57(%rip),%rdi
  call   <printf@plt>
  mov    %rbx,%rdi
  call   <printf@plt>
  lea    D62(%rip),%rdi
  call   <printf@plt>
  lea    D8(%rip),%rdi
  call   <printf@plt>
  lea    D17(%rip),%rdi
  call   <printf@plt>
  lea    D101(%rip),%rdi
  call   <printf@plt>
  mov    %rbx,%rdi
  call   <printf@plt>
  pop    %rbx
  ret
```

tool_calls: name: disassemble_data
arguments: data_label: D103
type_infered: string
name: disassemble_data
arguments: data_label: D19
type_infered: string
name: disassemble_data
arguments: data_label: D66
type_infered: string
name: disassemble_data
arguments: data_label: D76
type_infered: string
name: disassemble_data
arguments: data_label: D46
type_infered: string
name: disassemble_data
arguments: data_label: D98
type_infered: string
name: disassemble_data
arguments: data_label: D57
type_infered: string
name: disassemble_data
arguments: data_label: D62
type_infered: string
name: disassemble_data
arguments: data_label: D8
type_infered: string
name: disassemble_data
arguments: data_label: D17
type_infered: string
name: disassemble_data
arguments: data_label: D101
type_infered: string

tool: D103: 
rule, a constrained cellular automaton visualizer


tool: D19: 


tool: D66: USEAGE:


tool: D76:  rule <rule number> [<initial condition>]


tool: D46: EXAMPLES:


tool: D98:  rule 30


tool: D57:  rule 110 0xFAFF


tool: D62: NOTES:


tool: D8:  There are 16 cells on a torus. Arguments can be hex or decimal.


tool: D17:  If no initial condition is supplied, default is 1. For more


tool: D101:  information read 'elementary cellular automaton' on wikipedia


assistant: ```c
void useage() {
  printf("\nrule, a constrained cellular automaton visualizer\n");
  printf("\n");
  printf("USEAGE:\n");
  printf(" rule <rule number> [<initial condition>]\n");
  printf("\n");
  printf("EXAMPLES:\n");
  printf(" rule 30\n");
  printf(" rule 110 0xFAFF\n");
  printf("\n");
  printf("NOTES:\n");
  printf(" There are 16 cells on a torus. Arguments can be hex or decimal.\n");
  printf(" If no initial condition is supplied, default is 1. For more\n");
  printf(" information read 'elementary cellular automaton' on wikipedia\n");
  printf("\n");
  return;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<useage>:
  endbr64
  push   %rbp
  lea    D23(%rip),%rdi
  lea    D48(%rip),%rbp
  call   <printf@plt>
  mov    %rbp,%rdi
  call   <printf@plt>
  lea    D81(%rip),%rdi
  call   <printf@plt>
  lea    D72(%rip),%rdi
  call   <printf@plt>
  mov    %rbp,%rdi
  call   <printf@plt>
  lea    D22(%rip),%rdi
  call   <printf@plt>
  lea    D14(%rip),%rdi
  call   <printf@plt>
  lea    D24(%rip),%rdi
  call   <printf@plt>
  mov    %rbp,%rdi
  call   <printf@plt>
  lea    D79(%rip),%rdi
  call   <printf@plt>
  lea    D9(%rip),%rdi
  call   <printf@plt>
  lea    D80(%rip),%rdi
  call   <printf@plt>
  lea    D99(%rip),%rdi
  call   <printf@plt>
  mov    %rbp,%rdi
  pop    %rbp
  jmp    1050 <printf@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D23
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D48
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D81
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D72
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D22
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D14
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D24
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D79
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D9
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D80
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D99
type_infered: string

tool: D23: 
rule, a constrained cellular automaton visualizer


tool: D48: 


tool: D81: USEAGE:


tool: D72:  rule <rule number> [<initial condition>]


tool: D22: EXAMPLES:


tool: D14:  rule 30


tool: D24:  rule 110 0xFAFF


tool: D79: NOTES:


tool: D9:  There are 16 cells on a torus. Arguments can be hex or decimal.


tool: D80:  If no initial condition is supplied, default is 1. For more


tool: D99:  information read 'elementary cellular automaton' on wikipedia


assistant: ```c
void useage() {
  printf("\nrule, a constrained cellular automaton visualizer\n");
  printf("\n");
  printf("USEAGE:\n");
  printf(" rule <rule number> [<initial condition>]\n");
  printf("\n");
  printf("EXAMPLES:\n");
  printf(" rule 30\n");
  printf(" rule 110 0xFAFF\n");
  printf("\n");
  printf("NOTES:\n");
  printf(" There are 16 cells on a torus. Arguments can be hex or decimal.\n");
  printf(" If no initial condition is supplied, default is 1. For more\n");
  printf(" information read 'elementary cellular automaton' on wikipedia\n");
  printf("\n");
  return;
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<useage>:
  endbr64
  push   %rbp
  lea    D79(%rip),%rdi
  lea    D72(%rip),%rbp
  call   <printf@plt>
  mov    %rbp,%rdi
  call   <printf@plt>
  lea    D51(%rip),%rdi
  call   <printf@plt>
  lea    D94(%rip),%rdi
  call   <printf@plt>
  mov    %rbp,%rdi
  call   <printf@plt>
  lea    D88(%rip),%rdi
  call   <printf@plt>
  lea    D18(%rip),%rdi
  call   <printf@plt>
  lea    D71(%rip),%rdi
  call   <printf@plt>
  mov    %rbp,%rdi
  call   <printf@plt>
  lea    D13(%rip),%rdi
  call   <printf@plt>
  lea    D105(%rip),%rdi
  call   <printf@plt>
  lea    D1(%rip),%rdi
  call   <printf@plt>
  lea    D84(%rip),%rdi
  call   <printf@plt>
  mov    %rbp,%rdi
  pop    %rbp
  jmp    1050 <printf@plt>
```

tool_calls: name: extract_symbolic_data
arguments: tag: D79
type_infered: string
name: extract_symbolic_data
arguments: tag: D72
type_infered: string
name: extract_symbolic_data
arguments: tag: D51
type_infered: string
name: extract_symbolic_data
arguments: tag: D94
type_infered: string
name: extract_symbolic_data
arguments: tag: D88
type_infered: string
name: extract_symbolic_data
arguments: tag: D18
type_infered: string
name: extract_symbolic_data
arguments: tag: D71
type_infered: string
name: extract_symbolic_data
arguments: tag: D13
type_infered: string
name: extract_symbolic_data
arguments: tag: D105
type_infered: string
name: extract_symbolic_data
arguments: tag: D1
type_infered: string
name: extract_symbolic_data
arguments: tag: D84
type_infered: string

tool: D79: 
rule, a constrained cellular automaton visualizer


tool: D72: 


tool: D51: USEAGE:


tool: D94:  rule <rule number> [<initial condition>]


tool: D88: EXAMPLES:


tool: D18:  rule 30


tool: D71:  rule 110 0xFAFF


tool: D13: NOTES:


tool: D105:  There are 16 cells on a torus. Arguments can be hex or decimal.


tool: D1:  If no initial condition is supplied, default is 1. For more


tool: D84:  information read 'elementary cellular automaton' on wikipedia


assistant: ```c
void useage() {
  printf("\nrule, a constrained cellular automaton visualizer\n");
  printf("\n");
  printf("USEAGE:\n");
  printf(" rule <rule number> [<initial condition>]\n");
  printf("\n");
  printf("EXAMPLES:\n");
  printf(" rule 30\n");
  printf(" rule 110 0xFAFF\n");
  printf("\n");
  printf("NOTES:\n");
  printf(" There are 16 cells on a torus. Arguments can be hex or decimal.\n");
  printf(" If no initial condition is supplied, default is 1. For more\n");
  printf(" information read 'elementary cellular automaton' on wikipedia\n");
  printf("\n");
  return;
}
```
user: What is the c source code of the assembly code below?

```asm
<get_region_name_MC>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x4(%rbp)
  cmpl   $0x3,-0x4(%rbp)
  je     L1
  cmpl   $0x3,-0x4(%rbp)
  jg     L52
  cmpl   $0x1,-0x4(%rbp)
  je     L75
  cmpl   $0x2,-0x4(%rbp)
  je     L73
  jmp    L52
L75:
  lea    D19(%rip),%rax
  jmp    L57
L73:
  lea    D22(%rip),%rax
  jmp    L57
L1:
  lea    D28(%rip),%rax
  jmp    L57
L52:
  mov    $0x0,%eax
L57:
  pop    %rbp
  ret
```

tool_calls: name: retrieve_data
arguments: data_label: D19
type: string
name: retrieve_data
arguments: data_label: D22
type: string
name: retrieve_data
arguments: data_label: D28
type: string

tool: D19: La Condamine

tool: D22: Monaco

tool: D28: Monte-Carlo

assistant: ```c
const char *get_region_name_MC(int region_code) {
  switch (region_code) {
  case 1:
    return "La Condamine";
  case 2:
    return "Monaco";
  case 3:
    return "Monte-Carlo";
  default:
    return NULL;
  }
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<get_region_name_MC>:
  endbr64
  lea    D4(%rip),%rax
  cmp    $0x2,%edi
  je     L12
  lea    D10(%rip),%rax
  cmp    $0x3,%edi
  je     L12
  cmp    $0x1,%edi
  lea    D16(%rip),%rax
  mov    $0x0,%edx
  cmovne %rdx,%rax
L12:
  ret
```

tool_calls: name: read_data
arguments: data_tag: D4
type_infered: string
name: read_data
arguments: data_tag: D10
type_infered: string
name: read_data
arguments: data_tag: D16
type_infered: string

tool: D4: Monaco

tool: D10: Monte-Carlo

tool: D16: La Condamine

assistant: ```c
const char *get_region_name_MC(int region_code) {
  switch (region_code) {
  case 1:
    return "La Condamine";
  case 2:
    return "Monaco";
  case 3:
    return "Monte-Carlo";
  default:
    return NULL;
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<get_region_name_MC>:
  endbr64
  lea    D28(%rip),%rax
  cmp    $0x2,%edi
  je     L11
  lea    D0(%rip),%rax
  cmp    $0x3,%edi
  je     L11
  cmp    $0x1,%edi
  lea    D2(%rip),%rax
  mov    $0x0,%edx
  cmovne %rdx,%rax
L11:
  ret
```

tool_calls: name: parse_data
arguments: data_label: D28
type_guessed: string
name: parse_data
arguments: data_label: D0
type_guessed: string
name: parse_data
arguments: data_label: D2
type_guessed: string

tool: D28: Monaco

tool: D0: Monte-Carlo

tool: D2: La Condamine

assistant: ```c
const char *get_region_name_MC(int region_code) {
  switch (region_code) {
  case 1:
    return "La Condamine";
  case 2:
    return "Monaco";
  case 3:
    return "Monte-Carlo";
  default:
    return NULL;
  }
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<get_region_name_MC>:
  endbr64
  lea    D29(%rip),%rax
  cmp    $0x2,%edi
  je     L15
  lea    D2(%rip),%rax
  cmp    $0x3,%edi
  je     L15
  cmp    $0x1,%edi
  lea    D21(%rip),%rax
  mov    $0x0,%edx
  cmovne %rdx,%rax
L15:
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D29
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D2
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D21
type_infered: string

tool: D29: Monaco

tool: D2: Monte-Carlo

tool: D21: La Condamine

assistant: ```c
const char *get_region_name_MC(int region_code) {
  switch (region_code) {
  case 1:
    return "La Condamine";
  case 2:
    return "Monaco";
  case 3:
    return "Monte-Carlo";
  default:
    return NULL;
  }
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<partname>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbx
  mov    %esi,%r13d
  mov    %edx,%r12d
  call   <strlen@plt>
  mov    %rax,%r15
  mov    %eax,%r14d
  movslq %eax,%rdx
  movsbl -0x1(%rbx,%rdx,1),%eax
  sub    $0x30,%eax
  cmp    $0x9,%eax
  lea    D18(%rip),%rbp
  lea    D79(%rip),%rax
  cmovbe %rax,%rbp
  lea    -0x4(%rbx,%rdx,1),%rdi
  lea    D122(%rip),%rsi
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L18
  lea    -0x4(%r15),%r14d
  lea    D46(%rip),%rbp
L18:
  mov    $0xf,%edx
  lea    D115(%rip),%rsi
  mov    %rbx,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  je     L35
  mov    $0x11,%edx
  lea    D128(%rip),%rsi
  mov    %rbx,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  lea    D62(%rip),%rax
  cmove  %rax,%rbp
L29:
  mov    %rbp,%rdi
  call   <strlen@plt>
  test   %r12d,%r12d
  je     L39
  sub    %eax,%r12d
  lea    -0x2(%r12),%ecx
  push   %r13
  push   %rbp
  mov    %rbx,%r9
  mov    %r14d,%r8d
  lea    D35(%rip),%rdx
  mov    $0x50,%esi
  lea    D1(%rip),%rdi
  mov    $0x0,%eax
  call   <snprintf@plt>
  add    $0x10,%rsp
L42:
  lea    D1(%rip),%rax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L35:
  lea    D62(%rip),%rbp
  jmp    L29
L39:
  sub    $0x8,%rsp
  push   %r13
  mov    %rbp,%r9
  mov    %rbx,%r8
  mov    %r14d,%ecx
  lea    D117(%rip),%rdx
  mov    $0x50,%esi
  lea    D1(%rip),%rdi
  mov    $0x0,%eax
  call   <snprintf@plt>
  add    $0x10,%rsp
  jmp    L42
```

tool_calls: name: disassemble_data
arguments: label: D18
datatype: string
name: disassemble_data
arguments: label: D79
datatype: string
name: disassemble_data
arguments: label: D122
datatype: string
name: disassemble_data
arguments: label: D46
datatype: string
name: disassemble_data
arguments: label: D115
datatype: string
name: disassemble_data
arguments: label: D128
datatype: string
name: disassemble_data
arguments: label: D62
datatype: string
name: disassemble_data
arguments: label: D35
datatype: string
name: disassemble_data
arguments: label: D117
datatype: string

tool: 

tool: D79: p

tool: D122: disc

tool: D46: part

tool: D115: /dev/disk/by-id

tool: D128: /dev/disk/by-path

tool: D62: -part

tool: D35: %*.*s%s%-2u

tool: D117: %.*s%s%-2u

assistant: ```c
char *partname(char *dev, int pno, int lth) {
  static char bufp[80];
  char *p;
  int w, wp;
  w = strlen(dev);
  p = "";
  if (isdigit(dev[w - 1]))
    p = "p";
  if (strcmp(dev + w - 4, "disc") == 0) {
    w -= 4;
    p = "part";
  }
  if ((strncmp(dev, "/dev/disk/by-id", strlen("/dev/disk/by-id")) == 0) || strncmp(dev, "/dev/disk/by-path", strlen("/dev/disk/by-path")) == 0) {
    p = "-part";
  }
  wp = strlen(p);
  if (lth) {
    snprintf(bufp, sizeof(bufp), "%*.*s%s%-2u", lth - wp - 2, w, dev, p, pno);
  } else {
    snprintf(bufp, sizeof(bufp), "%.*s%s%-2u", w, dev, p, pno);
  }
  return bufp;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<partname>:
  endbr64
  push   %r15
  push   %r14
  mov    %esi,%r14d
  push   %r13
  push   %r12
  lea    D41(%rip),%r12
  push   %rbp
  mov    %edx,%ebp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x8,%rsp
  call   <strlen@plt>
  lea    D6(%rip),%rsi
  movslq %eax,%rdx
  mov    %rax,%r13
  mov    %eax,%r15d
  movsbl -0x1(%rbx,%rdx,1),%eax
  lea    -0x4(%rbx,%rdx,1),%rdi
  sub    $0x30,%eax
  cmp    $0x9,%eax
  lea    D12(%rip),%rax
  cmovbe %rax,%r12
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L22
  lea    -0x4(%r13),%r15d
  lea    D100(%rip),%r12
L22:
  mov    $0xf,%edx
  lea    D54(%rip),%rsi
  mov    %rbx,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  je     L12
  mov    $0x11,%edx
  lea    D104(%rip),%rsi
  mov    %rbx,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  jne    L18
L12:
  mov    $0x5,%eax
  lea    D37(%rip),%r12
L47:
  test   %ebp,%ebp
  je     L39
  push   %r14
  sub    %eax,%ebp
  mov    $0x50,%esi
  mov    %rbx,%r9
  push   %r12
  lea    D49(%rip),%r12
  lea    -0x2(%rbp),%ecx
  mov    %r15d,%r8d
  lea    D81(%rip),%rdx
  mov    %r12,%rdi
  xor    %eax,%eax
  call   <snprintf@plt>
  pop    %rcx
  pop    %rsi
L0:
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L39:
  sub    $0x8,%rsp
  mov    %r12,%r9
  lea    D49(%rip),%r12
  xor    %eax,%eax
  push   %r14
  lea    D75(%rip),%rdx
  mov    %rbx,%r8
  mov    %r15d,%ecx
  mov    $0x50,%esi
  mov    %r12,%rdi
  call   <snprintf@plt>
  pop    %rax
  pop    %rdx
  jmp    L0
L18:
  mov    %r12,%rdi
  call   <strlen@plt>
  jmp    L47
```

tool_calls: name: retrieve_data
arguments: data_tag: D41
type_guessed: string
name: retrieve_data
arguments: data_tag: D6
type_guessed: string
name: retrieve_data
arguments: data_tag: D12
type_guessed: string
name: retrieve_data
arguments: data_tag: D100
type_guessed: string
name: retrieve_data
arguments: data_tag: D54
type_guessed: string
name: retrieve_data
arguments: data_tag: D104
type_guessed: string
name: retrieve_data
arguments: data_tag: D37
type_guessed: string
name: retrieve_data
arguments: data_tag: D81
type_guessed: string
name: retrieve_data
arguments: data_tag: D75
type_guessed: string

tool: 

tool: D6: disc

tool: D12: p

tool: D100: part

tool: D54: /dev/disk/by-id

tool: D104: /dev/disk/by-path

tool: D37: -part

tool: D81: %*.*s%s%-2u

tool: D75: %.*s%s%-2u

assistant: ```c
char *partname(char *dev, int pno, int lth) {
  static char bufp[80];
  char *p;
  int w, wp;
  w = strlen(dev);
  p = "";
  if (isdigit(dev[w - 1]))
    p = "p";
  if (strcmp(dev + w - 4, "disc") == 0) {
    w -= 4;
    p = "part";
  }
  if ((strncmp(dev, "/dev/disk/by-id", strlen("/dev/disk/by-id")) == 0) || strncmp(dev, "/dev/disk/by-path", strlen("/dev/disk/by-path")) == 0) {
    p = "-part";
  }
  wp = strlen(p);
  if (lth) {
    snprintf(bufp, sizeof(bufp), "%*.*s%s%-2u", lth - wp - 2, w, dev, p, pno);
  } else {
    snprintf(bufp, sizeof(bufp), "%.*s%s%-2u", w, dev, p, pno);
  }
  return bufp;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<partname>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %esi,%r13d
  push   %r12
  lea    D102(%rip),%r12
  push   %rbp
  mov    %edx,%ebp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x18,%rsp
  call   <strlen@plt>
  lea    D1(%rip),%rsi
  movslq %eax,%rcx
  mov    %rax,0x8(%rsp)
  mov    %eax,%r15d
  movsbl -0x1(%rbx,%rcx,1),%eax
  lea    -0x4(%rbx,%rcx,1),%rdi
  sub    $0x30,%eax
  cmp    $0xa,%eax
  setb   %r14b
  cmp    $0x9,%eax
  lea    D27(%rip),%rax
  cmovbe %rax,%r12
  movzbl %r14b,%r14d
  call   <strcmp@plt>
  test   %eax,%eax
  jne    L2
  mov    0x8(%rsp),%rdx
  mov    $0x4,%r14d
  lea    D69(%rip),%r12
  lea    -0x4(%rdx),%r15d
L2:
  mov    $0xf,%edx
  lea    D114(%rip),%rsi
  mov    %rbx,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  je     L23
  mov    $0x11,%edx
  lea    D84(%rip),%rsi
  mov    %rbx,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  mov    $0x5,%eax
  cmove  %eax,%r14d
  lea    D93(%rip),%rax
  cmove  %rax,%r12
  test   %ebp,%ebp
  je     L27
L43:
  push   %r13
  sub    %r14d,%ebp
  mov    $0x50,%esi
  mov    %rbx,%r9
  push   %r12
  lea    D74(%rip),%r12
  lea    -0x2(%rbp),%ecx
  mov    %r15d,%r8d
  lea    D89(%rip),%rdx
  mov    %r12,%rdi
  xor    %eax,%eax
  call   <snprintf@plt>
  pop    %rcx
  pop    %rsi
L40:
  add    $0x18,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L23:
  mov    $0x5,%r14d
  lea    D93(%rip),%r12
  test   %ebp,%ebp
  jne    L43
L27:
  sub    $0x8,%rsp
  mov    %r12,%r9
  lea    D74(%rip),%r12
  xor    %eax,%eax
  push   %r13
  lea    D55(%rip),%rdx
  mov    %rbx,%r8
  mov    %r15d,%ecx
  mov    $0x50,%esi
  mov    %r12,%rdi
  call   <snprintf@plt>
  pop    %rax
  pop    %rdx
  jmp    L40
```

tool_calls: name: unpack_data
arguments: tag: D102
type_guessed: string
name: unpack_data
arguments: tag: D1
type_guessed: string
name: unpack_data
arguments: tag: D27
type_guessed: string
name: unpack_data
arguments: tag: D69
type_guessed: string
name: unpack_data
arguments: tag: D114
type_guessed: string
name: unpack_data
arguments: tag: D84
type_guessed: string
name: unpack_data
arguments: tag: D93
type_guessed: string
name: unpack_data
arguments: tag: D89
type_guessed: string
name: unpack_data
arguments: tag: D55
type_guessed: string

tool: 

tool: D1: disc

tool: D27: p

tool: D69: part

tool: D114: /dev/disk/by-id

tool: D84: /dev/disk/by-path

tool: D93: -part

tool: D89: %*.*s%s%-2u

tool: D55: %.*s%s%-2u

assistant: ```c
char *partname(char *dev, int pno, int lth) {
  static char bufp[80];
  char *p;
  int w, wp;
  w = strlen(dev);
  p = "";
  if (isdigit(dev[w - 1]))
    p = "p";
  if (strcmp(dev + w - 4, "disc") == 0) {
    w -= 4;
    p = "part";
  }
  if ((strncmp(dev, "/dev/disk/by-id", strlen("/dev/disk/by-id")) == 0) || strncmp(dev, "/dev/disk/by-path", strlen("/dev/disk/by-path")) == 0) {
    p = "-part";
  }
  wp = strlen(p);
  if (lth) {
    snprintf(bufp, sizeof(bufp), "%*.*s%s%-2u", lth - wp - 2, w, dev, p, pno);
  } else {
    snprintf(bufp, sizeof(bufp), "%.*s%s%-2u", w, dev, p, pno);
  }
  return bufp;
}
```