ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 这段汇编代码用C语言表示是什么样的?

```asm
<sort>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  mov    %edx,%r12d
  lea    -0x1(%rdx),%eax
  cmp    %esi,%eax
  je     L43
  mov    %esi,%ebp
  movslq %esi,%rax
  mov    %esi,%edx
  cmp    %esi,%r12d
  jle    L1
L4:
  movslq %edx,%rcx
  mov    (%rbx,%rcx,4),%edi
  cmp    %edi,(%rbx,%rax,4)
  cmovl  %eax,%edx
  add    $0x1,%rax
  cmp    %eax,%r12d
  jg     L4
L1:
  mov    %ebp,%esi
  mov    %rbx,%rdi
  call   <swap@plt>
  lea    0x1(%rbp),%esi
  mov    %r12d,%edx
  mov    %rbx,%rdi
  call   <sort>
L33:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L43:
  test   %edx,%edx
  jle    L33
  mov    %rdi,%rbp
  lea    -0x1(%rdx),%eax
  lea    0x4(%rdi,%rax,4),%r12
  lea    D1(%rip),%rbx
L48:
  mov    0x0(%rbp),%esi
  mov    %rbx,%rdi
  call   <printf@plt>
  add    $0x4,%rbp
  cmp    %r12,%rbp
  jne    L48
  jmp    L33
```

tool_calls: name: retrieve_data
arguments: tag: D1
datatype: string

tool: D1: %d


assistant: ```c
void sort(int array[], int startpoint, int top) {
  int i, k;
  int index1;
  if (startpoint == top - 1) {
    for (k = 0; k < top; k++)
      printf("%d\n", array[k]);
  } else {
    index1 = startpoint;
    for (i = startpoint; i < top; i++)
      if (array[i] < array[index1])
        index1 = i;
    swap(array, startpoint, index1);
    sort(array, startpoint + 1, top);
  }
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<sort>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  mov    %edx,%r12d
  push   %rbp
  lea    -0x1(%rdx),%ebp
  push   %rbx
  mov    %rdi,%rbx
  cmp    %ebp,%esi
  je     L9
  mov    %esi,%r13d
  movslq %esi,%r14
  nop
L48:
  mov    %r14,%rax
  mov    %r13d,%edx
  cmp    %r13d,%r12d
  jle    L25
  nopl   0x0(%rax,%rax,1)
L12:
  movslq %edx,%rcx
  mov    (%rbx,%rcx,4),%esi
  cmp    %esi,(%rbx,%rax,4)
  cmovl  %eax,%edx
  add    $0x1,%rax
  cmp    %eax,%r12d
  jg     L12
L25:
  mov    %r13d,%esi
  mov    %rbx,%rdi
  add    $0x1,%r13d
  add    $0x1,%r14
  call   <swap@plt>
  cmp    %ebp,%r13d
  jne    L48
L9:
  test   %r12d,%r12d
  jle    L23
  lea    0x4(%rbx,%rbp,4),%r12
  lea    D4(%rip),%rbp
  xchg   %ax,%ax
L19:
  mov    (%rbx),%esi
  mov    %rbp,%rdi
  add    $0x4,%rbx
  call   <printf@plt>
  cmp    %rbx,%r12
  jne    L19
L23:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

tool_calls: name: read_data
arguments: data_tag: D4
datatype: string

tool: D4: %d


assistant: ```c
void sort(int array[], int startpoint, int top) {
  int i, k;
  int index1;
  if (startpoint == top - 1) {
    for (k = 0; k < top; k++)
      printf("%d\n", array[k]);
  } else {
    index1 = startpoint;
    for (i = startpoint; i < top; i++)
      if (array[i] < array[index1])
        index1 = i;
    swap(array, startpoint, index1);
    sort(array, startpoint + 1, top);
  }
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<sort>:
  endbr64
  push   %r13
  push   %r12
  mov    %edx,%r12d
  push   %rbp
  lea    -0x1(%rdx),%ebp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x8,%rsp
  cmp    %ebp,%esi
  je     L60
  movslq %esi,%r13
  xchg   %ax,%ax
L33:
  mov    %r13d,%esi
  mov    %r13d,%r8d
  cmp    %r13d,%r12d
  jle    L69
  mov    (%rbx,%r13,4),%ecx
  mov    %r13,%rax
  nopw   0x0(%rax,%rax,1)
L44:
  mov    (%rbx,%rax,4),%edx
  cmp    %ecx,%edx
  jge    L32
  mov    %edx,%ecx
  mov    %eax,%r8d
L32:
  add    $0x1,%rax
  cmp    %eax,%r12d
  jg     L44
L69:
  mov    %r8d,%edx
  mov    %rbx,%rdi
  add    $0x1,%r13
  call   <swap@plt>
  cmp    %r13d,%ebp
  jne    L33
L60:
  test   %r12d,%r12d
  jle    L17
  lea    0x4(%rbx,%rbp,4),%r12
  lea    D8(%rip),%rbp
  nopw   0x0(%rax,%rax,1)
L46:
  mov    (%rbx),%esi
  mov    %rbp,%rdi
  add    $0x4,%rbx
  call   <printf@plt>
  cmp    %rbx,%r12
  jne    L46
L17:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

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

tool: D8: %d


assistant: ```c
void sort(int array[], int startpoint, int top) {
  int i, k;
  int index1;
  if (startpoint == top - 1) {
    for (k = 0; k < top; k++)
      printf("%d\n", array[k]);
  } else {
    index1 = startpoint;
    for (i = startpoint; i < top; i++)
      if (array[i] < array[index1])
        index1 = i;
    swap(array, startpoint, index1);
    sort(array, startpoint + 1, top);
  }
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<print_value>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %edi,-0x4(%rbp)
  cmpl   $0x2,-0x4(%rbp)
  jne    L11
  lea    D0(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L10
L11:
  mov    $0x0,%eax
  call   <rand@plt>
  cltd
  shr    $0x16,%edx
  add    %edx,%eax
  and    $0x3ff,%eax
  sub    %edx,%eax
  mov    %eax,%esi
  lea    D10(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L10:
  nop
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: tag: D0
datatype: string
name: extract_symbolic_data
arguments: tag: D10
datatype: string

tool: D0: "blah"

tool: D10: %d

assistant: ```c
void print_value(int type) {
  if (type == 2) {
    printf("\"blah\"");
  } else {
    printf("%d", rand() % 1024);
  }
}
```
user: Translate the below assembly code into C programming language:

```asm
<print_value>:
  endbr64
  sub    $0x8,%rsp
  cmp    $0x2,%edi
  je     L13
  mov    $0x0,%eax
  call   <rand@plt>
  cltd
  shr    $0x16,%edx
  lea    (%rax,%rdx,1),%esi
  and    $0x3ff,%esi
  sub    %edx,%esi
  lea    D12(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L14:
  add    $0x8,%rsp
  ret
L13:
  lea    D19(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L14
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D12
data_type: string
name: extract_symbolic_data
arguments: data_label: D19
data_type: string

tool: D12: %d

tool: D19: "blah"

assistant: ```c
void print_value(int type) {
  if (type == 2) {
    printf("\"blah\"");
  } else {
    printf("%d", rand() % 1024);
  }
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<print_value>:
  endbr64
  cmp    $0x2,%edi
  je     L5
  sub    $0x8,%rsp
  xor    %eax,%eax
  call   <rand@plt>
  lea    D17(%rip),%rdi
  add    $0x8,%rsp
  cltd
  shr    $0x16,%edx
  lea    (%rax,%rdx,1),%esi
  xor    %eax,%eax
  and    $0x3ff,%esi
  sub    %edx,%esi
  jmp    1060 <printf@plt>
  nopl   (%rax)
L5:
  lea    D5(%rip),%rdi
  xor    %eax,%eax
  jmp    1060 <printf@plt>
```

tool_calls: name: read_data
arguments: data_label: D17
type: string
name: read_data
arguments: data_label: D5
type: string

tool: D17: %d

tool: D5: "blah"

assistant: ```c
void print_value(int type) {
  if (type == 2) {
    printf("\"blah\"");
  } else {
    printf("%d", rand() % 1024);
  }
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<print_value>:
  endbr64
  cmp    $0x2,%edi
  je     L2
  sub    $0x8,%rsp
  xor    %eax,%eax
  call   <rand@plt>
  lea    D8(%rip),%rdi
  add    $0x8,%rsp
  cltd
  shr    $0x16,%edx
  lea    (%rax,%rdx,1),%esi
  xor    %eax,%eax
  and    $0x3ff,%esi
  sub    %edx,%esi
  jmp    1060 <printf@plt>
  nopl   (%rax)
L2:
  lea    D0(%rip),%rdi
  xor    %eax,%eax
  jmp    1060 <printf@plt>
```

tool_calls: name: parse_data
arguments: data_tag: D8
data_type: string
name: parse_data
arguments: data_tag: D0
data_type: string

tool: D8: %d

tool: D0: "blah"

assistant: ```c
void print_value(int type) {
  if (type == 2) {
    printf("\"blah\"");
  } else {
    printf("%d", rand() % 1024);
  }
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x9,-0x34(%rbp)
  movl   $0x1,-0x30(%rbp)
  movl   $0x5,-0x2c(%rbp)
  movl   $0x2,-0x28(%rbp)
  movl   $0x7,-0x24(%rbp)
  movl   $0x3,-0x20(%rbp)
  movl   $0x4,-0x1c(%rbp)
  movl   $0x4,-0x18(%rbp)
  movl   $0x1,-0x14(%rbp)
  movl   $0x5,-0x10(%rbp)
  mov    -0x34(%rbp),%edx
  lea    -0x30(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <counting_sort@plt>
  lea    D9(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movl   $0x0,-0x38(%rbp)
  jmp    L18
L26:
  mov    -0x38(%rbp),%eax
  cltq
  mov    -0x30(%rbp,%rax,4),%eax
  mov    %eax,%esi
  lea    D6(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  addl   $0x1,-0x38(%rbp)
L18:
  mov    -0x38(%rbp),%eax
  cmp    -0x34(%rbp),%eax
  jl     L26
  mov    $0x0,%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L7
  call   <__stack_chk_fail@plt>
L7:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: data_label: D9
data_type: string
name: retrieve_data
arguments: data_label: D6
data_type: string

tool: D9: Sorted Array : 

tool: D6: %d 

assistant: ```c
int main() {
  int n = 9, i;
  int input[] = {1, 5, 2, 7, 3, 4, 4, 1, 5};
  counting_sort(input, n);
  printf("Sorted Array : ");
  for (i = 0; i < n; i++)
    printf("%d ", input[i]);
  return 0;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<main>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x30,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  movl   $0x1,(%rsp)
  movl   $0x5,0x4(%rsp)
  movl   $0x2,0x8(%rsp)
  movl   $0x7,0xc(%rsp)
  movl   $0x3,0x10(%rsp)
  movl   $0x4,0x14(%rsp)
  movl   $0x4,0x18(%rsp)
  movl   $0x1,0x1c(%rsp)
  movl   $0x5,0x20(%rsp)
  mov    %rsp,%rbx
  mov    $0x9,%esi
  mov    %rbx,%rdi
  call   <counting_sort@plt>
  lea    D10(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    0x24(%rsp),%r12
  lea    D4(%rip),%rbp
L4:
  mov    (%rbx),%esi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  add    $0x4,%rbx
  cmp    %r12,%rbx
  jne    L4
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L16
  mov    $0x0,%eax
  add    $0x30,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L16:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_tag: D10
type_infered: string
name: unpack_data
arguments: data_tag: D4
type_infered: string

tool: D10: Sorted Array : 

tool: D4: %d 

assistant: ```c
int main() {
  int n = 9, i;
  int input[] = {1, 5, 2, 7, 3, 4, 4, 1, 5};
  counting_sort(input, n);
  printf("Sorted Array : ");
  for (i = 0; i < n; i++)
    printf("%d ", input[i]);
  return 0;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<main>:
  endbr64
  push   %r12
  mov    $0x9,%esi
  push   %rbp
  lea    D18(%rip),%rbp
  push   %rbx
  sub    $0x30,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  movabs $0x500000001,%rax
  mov    %rsp,%rbx
  movl   $0x5,0x20(%rsp)
  lea    0x24(%rsp),%r12
  mov    %rbx,%rdi
  mov    %rax,(%rsp)
  movabs $0x700000002,%rax
  mov    %rax,0x8(%rsp)
  movabs $0x400000003,%rax
  mov    %rax,0x10(%rsp)
  movabs $0x100000004,%rax
  mov    %rax,0x18(%rsp)
  call   <counting_sort@plt>
  lea    D10(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  nopw   0x0(%rax,%rax,1)
L2:
  mov    (%rbx),%esi
  mov    %rbp,%rdi
  xor    %eax,%eax
  add    $0x4,%rbx
  call   <printf@plt>
  cmp    %r12,%rbx
  jne    L2
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L16
  add    $0x30,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L16:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_tag: D18
type_infered: string
name: parse_data
arguments: data_tag: D10
type_infered: string

tool: D18: %d 

tool: D10: Sorted Array : 

assistant: ```c
int main() {
  int n = 9, i;
  int input[] = {1, 5, 2, 7, 3, 4, 4, 1, 5};
  counting_sort(input, n);
  printf("Sorted Array : ");
  for (i = 0; i < n; i++)
    printf("%d ", input[i]);
  return 0;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  push   %r12
  mov    $0x9,%esi
  push   %rbp
  lea    D16(%rip),%rbp
  push   %rbx
  sub    $0x30,%rsp
  movdqa D24(%rip),%xmm0
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rbx
  movl   $0x5,0x20(%rsp)
  lea    0x24(%rsp),%r12
  movaps %xmm0,(%rsp)
  movdqa D7(%rip),%xmm0
  mov    %rbx,%rdi
  movaps %xmm0,0x10(%rsp)
  call   <counting_sort@plt>
  lea    D6(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  nopw   0x0(%rax,%rax,1)
L0:
  mov    (%rbx),%esi
  mov    %rbp,%rdi
  xor    %eax,%eax
  add    $0x4,%rbx
  call   <printf@plt>
  cmp    %rbx,%r12
  jne    L0
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L17
  add    $0x30,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L17:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: tag: D16
datatype: string
name: retrieve_data
arguments: tag: D24
datatype: byte[16]
name: retrieve_data
arguments: tag: D7
datatype: byte[16]
name: retrieve_data
arguments: tag: D6
datatype: string

tool: D16: %d 

tool: {"D24": [0x01,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x07,0x00,0x00,0x00]}

tool: {"D7": [0x03,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x01,0x00,0x00,0x00]}

tool: D6: Sorted Array : 

assistant: ```c
int main() {
  int n = 9, i;
  int input[] = {1, 5, 2, 7, 3, 4, 4, 1, 5};
  counting_sort(input, n);
  printf("Sorted Array : ");
  for (i = 0; i < n; i++)
    printf("%d ", input[i]);
  return 0;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<add_ind_action>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  add    $0xffffffffffffff80,%rsp
  mov    %edi,-0x74(%rbp)
  mov    %rsi,-0x80(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  cmpl   $0x0,-0x74(%rbp)
  jle    L9
  mov    -0x74(%rbp),%eax
  shl    $0x2,%eax
  mov    %eax,-0x68(%rbp)
  movl   $0x0,-0x64(%rbp)
  movb   $0x0,-0x60(%rbp)
  jmp    L54
L34:
  mov    -0x64(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x64(%rbp)
  cltq
  movb   $0x9,-0x60(%rbp,%rax,1)
  subl   $0x8,-0x68(%rbp)
L54:
  cmpl   $0x7,-0x68(%rbp)
  jg     L34
  jmp    L0
L45:
  mov    -0x64(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x64(%rbp)
  cltq
  movb   $0x20,-0x60(%rbp,%rax,1)
  subl   $0x1,-0x68(%rbp)
L0:
  cmpl   $0x0,-0x68(%rbp)
  jg     L45
  mov    -0x64(%rbp),%eax
  cltq
  movb   $0x0,-0x60(%rbp,%rax,1)
  lea    -0x60(%rbp),%rax
  mov    %rax,%rdi
  call   <add_action@plt>
L9:
  mov    -0x80(%rbp),%rax
  mov    %rax,%rdi
  call   <add_action@plt>
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L24
  call   <__stack_chk_fail@plt>
L24:
  leave
  ret
```

assistant: ```c
void add_ind_action(int level, const char *new_text) {
  char buffer[80];
  if (level > 0) {
    int cols = level * 4;
    int len = 0;
    buffer[0] = 0;
    while (cols >= 8) {
      buffer[len++] = '\t';
      cols -= 8;
    }
    while (cols > 0) {
      buffer[len++] = ' ';
      --cols;
    }
    buffer[len] = '\0';
    add_action(buffer);
  }
  add_action(new_text);
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<add_ind_action>:
  endbr64
  push   %rbx
  sub    $0x60,%rsp
  mov    %rsi,%rbx
  mov    %fs:0x28,%rax
  mov    %rax,0x58(%rsp)
  xor    %eax,%eax
  test   %edi,%edi
  jle    L8
  shl    $0x2,%edi
  movb   $0x0,(%rsp)
  cmp    $0x7,%edi
  jle    L65
  mov    %rsp,%rax
  lea    -0x8(%rdi),%ecx
  shr    $0x3,%ecx
  mov    %ecx,%edx
  lea    0x1(%rsp,%rdx,1),%rdx
L3:
  movb   $0x9,(%rax)
  add    $0x1,%rax
  cmp    %rdx,%rax
  jne    L3
  lea    0x1(%rcx),%esi
  neg    %ecx
  lea    -0x8(%rdi,%rcx,8),%edi
  test   %edi,%edi
  jle    L4
L11:
  movslq %esi,%rax
  lea    (%rsp,%rax,1),%rcx
  mov    %rcx,%rax
  add    %edi,%ecx
L36:
  movb   $0x20,(%rax)
  add    $0x1,%rax
  mov    %ecx,%edx
  sub    %eax,%edx
  test   %edx,%edx
  jg     L36
  test   %edi,%edi
  mov    $0x1,%eax
  cmovle %eax,%edi
  lea    (%rsi,%rdi,1),%esi
L4:
  movslq %esi,%rsi
  movb   $0x0,(%rsp,%rsi,1)
  mov    %rsp,%rdi
  call   <add_action@plt>
L8:
  mov    %rbx,%rdi
  call   <add_action@plt>
  mov    0x58(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L16
  add    $0x60,%rsp
  pop    %rbx
  ret
L65:
  mov    $0x0,%esi
  jmp    L11
L16:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void add_ind_action(int level, const char *new_text) {
  char buffer[80];
  if (level > 0) {
    int cols = level * 4;
    int len = 0;
    buffer[0] = 0;
    while (cols >= 8) {
      buffer[len++] = '\t';
      cols -= 8;
    }
    while (cols > 0) {
      buffer[len++] = ' ';
      --cols;
    }
    buffer[len] = '\0';
    add_action(buffer);
  }
  add_action(new_text);
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<add_ind_action>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  push   %rbx
  sub    $0x60,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x58(%rsp)
  xor    %eax,%eax
  test   %edi,%edi
  jle    L8
  lea    0x0(,%rdi,4),%ebx
  movb   $0x0,(%rsp)
  cmp    $0x7,%ebx
  jle    L27
  sub    $0x8,%ebx
  mov    %rsp,%r14
  mov    $0x9,%esi
  mov    %ebx,%r13d
  mov    %r14,%rdi
  shr    $0x3,%r13d
  lea    0x1(%r13),%edx
  neg    %r13d
  lea    (%rbx,%r13,8),%ebx
  mov    %rdx,%rbp
  call   <memset@plt>
  test   %ebx,%ebx
  je     L42
L49:
  movslq %ebp,%rdi
  movslq %ebx,%rdx
  mov    $0x20,%esi
  add    %ebx,%ebp
  add    %r14,%rdi
  call   <memset@plt>
L42:
  movslq %ebp,%rbp
  mov    %r14,%rdi
  movb   $0x0,(%rsp,%rbp,1)
  call   <add_action@plt>
L8:
  mov    %r12,%rdi
  call   <add_action@plt>
  mov    0x58(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L31
  add    $0x60,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax)
L27:
  xor    %ebp,%ebp
  mov    %rsp,%r14
  jmp    L49
L31:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void add_ind_action(int level, const char *new_text) {
  char buffer[80];
  if (level > 0) {
    int cols = level * 4;
    int len = 0;
    buffer[0] = 0;
    while (cols >= 8) {
      buffer[len++] = '\t';
      cols -= 8;
    }
    while (cols > 0) {
      buffer[len++] = ' ';
      --cols;
    }
    buffer[len] = '\0';
    add_action(buffer);
  }
  add_action(new_text);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<add_ind_action>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  push   %rbx
  sub    $0x60,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x58(%rsp)
  xor    %eax,%eax
  test   %edi,%edi
  jle    L17
  lea    0x0(,%rdi,4),%ebx
  movb   $0x0,(%rsp)
  cmp    $0x7,%ebx
  jle    L2
  sub    $0x8,%ebx
  mov    %rsp,%r14
  mov    $0x9,%esi
  mov    %ebx,%r13d
  mov    %r14,%rdi
  shr    $0x3,%r13d
  lea    0x1(%r13),%edx
  neg    %r13d
  lea    (%rbx,%r13,8),%ebx
  mov    %rdx,%rbp
  call   <memset@plt>
  test   %ebx,%ebx
  je     L36
L0:
  movslq %ebp,%rdi
  movslq %ebx,%rdx
  mov    $0x20,%esi
  add    %ebx,%ebp
  add    %r14,%rdi
  call   <memset@plt>
L36:
  movslq %ebp,%rbp
  mov    %r14,%rdi
  movb   $0x0,(%rsp,%rbp,1)
  call   <add_action@plt>
L17:
  mov    %r12,%rdi
  call   <add_action@plt>
  mov    0x58(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L4
  add    $0x60,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax)
L2:
  xor    %ebp,%ebp
  mov    %rsp,%r14
  jmp    L0
L4:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void add_ind_action(int level, const char *new_text) {
  char buffer[80];
  if (level > 0) {
    int cols = level * 4;
    int len = 0;
    buffer[0] = 0;
    while (cols >= 8) {
      buffer[len++] = '\t';
      cols -= 8;
    }
    while (cols > 0) {
      buffer[len++] = ' ';
      --cols;
    }
    buffer[len] = '\0';
    add_action(buffer);
  }
  add_action(new_text);
}
```
user: Translate the below assembly code into C programming language:

```asm
<prepend_srcdir>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    D87(%rip),%rax
  test   %rax,%rax
  jne    L5
  lea    D19(%rip),%rax
  mov    %rax,%rdi
  call   <getenv@plt>
  mov    %rax,D17(%rip)
  mov    D17(%rip),%rax
  test   %rax,%rax
  jne    L5
  lea    D17(%rip),%rax
  mov    %rax,D65(%rip)
L5:
  mov    D65(%rip),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  lea    0x1(%rax),%rbx
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    %rbx,%rax
  add    $0x1,%rax
  mov    %rax,%rdi
  call   <xmalloc@plt>
  mov    %rax,-0x18(%rbp)
  mov    D65(%rip),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  mov    -0x18(%rbp),%rax
  lea    D65(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  mov    -0x28(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  mov    -0x18(%rbp),%rax
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

tool_calls: name: read_data
arguments: tag: D19
type_guessed: string
name: read_data
arguments: tag: D17
type_guessed: string
name: read_data
arguments: tag: D65
type_guessed: string

tool: D19: srcdir

tool: D17: .

tool: D65: /

assistant: ```c
char *prepend_srcdir(const char *fname) {
  static const char *srcdir;
  char *result;
  if (!srcdir && !(srcdir = getenv("srcdir")))
    srcdir = ".";
  result = xmalloc(strlen(srcdir) + 1 + strlen(fname) + 1);
  strcpy(result, srcdir);
  strcat(result, "/");
  strcat(result, fname);
  return result;
}
```