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

```asm
<change_state>:
  endbr64
  mov    D27(%rip),%rax
  mov    (%rax),%eax
  test   %eax,%eax
  jne    L52
  cmp    $0x22,%edi
  je     L0
  cmp    $0x23,%esi
  jne    L37
  cmp    $0x64,%edi
  jne    L37
  mov    D27(%rip),%rax
  movl   $0x2,(%rax)
  jmp    L118
L0:
  mov    D27(%rip),%rax
  movl   $0x1,(%rax)
L118:
  mov    D27(%rip),%rax
  mov    (%rax),%eax
  ret
L37:
  cmp    $0x2f,%esi
  jne    L118
  cmp    $0x2a,%edi
  jne    L118
  mov    D27(%rip),%rax
  movl   $0x3,(%rax)
  jmp    L118
L52:
  cmp    $0x1,%eax
  je     L93
  cmp    $0x2,%eax
  je     L69
  cmp    $0x3,%eax
  jne    L118
  cmp    $0x2a,%esi
  jne    L118
  cmp    $0x2f,%edi
  jne    L118
  mov    D27(%rip),%rax
  movl   $0x0,(%rax)
  jmp    L118
L93:
  cmp    $0x22,%edi
  jne    L118
  mov    D27(%rip),%rax
  movl   $0x0,(%rax)
  jmp    L118
L69:
  cmp    $0xa,%edi
  jne    L118
  mov    D27(%rip),%rax
  movl   $0x0,(%rax)
  jmp    L118
```

assistant: ```c
int change_state(int cur_char, int last_char) {
  extern int state;
  if (state == 0) {
    if (cur_char == '"') {
      state = 1;
    } else if (last_char == '#' && cur_char == 'd') {
      state = 2;
    } else if (last_char == '/' && cur_char == '*') {
      state = 3;
    } else {
      state = 0;
    }
  } else if (state == 1) {
    if (cur_char == '"') {
      state = 0;
    } else {
      state = 1;
    }
  } else if (state == 2) {
    if (cur_char == '\n') {
      state = 0;
    } else {
      state = 2;
    }
  } else if (state == 3) {
    if (last_char == '*' && cur_char == '/') {
      state = 0;
    } else {
      state = 3;
    }
  } else {
  }
  return state;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<change_state>:
  endbr64
  mov    D7(%rip),%rdx
  mov    (%rdx),%eax
  test   %eax,%eax
  jne    L105
  cmp    $0x22,%edi
  je     L58
  cmp    $0x23,%esi
  jne    L124
  cmp    $0x64,%edi
  jne    L124
  movl   $0x2,(%rdx)
  mov    $0x2,%eax
  ret
  nopl   0x0(%rax)
L105:
  cmp    $0x1,%eax
  je     L43
  cmp    $0x2,%eax
  je     L104
  cmp    $0x3,%eax
  je     L33
L0:
  ret
L58:
  movl   $0x1,(%rdx)
  mov    $0x1,%eax
  ret
  nopl   0x0(%rax)
L124:
  cmp    $0x2f,%esi
  jne    L0
  cmp    $0x2a,%edi
  jne    L0
  movl   $0x3,(%rdx)
  mov    $0x3,%eax
  ret
  cs nopw 0x0(%rax,%rax,1)
L33:
  cmp    $0x2a,%esi
  jne    L0
  cmp    $0x2f,%edi
  jne    L0
L17:
  movl   $0x0,(%rdx)
  xor    %eax,%eax
  ret
  nopl   0x0(%rax,%rax,1)
L43:
  cmp    $0x22,%edi
  je     L17
  ret
  xchg   %ax,%ax
L104:
  cmp    $0xa,%edi
  je     L17
  ret
```

assistant: ```c
int change_state(int cur_char, int last_char) {
  extern int state;
  if (state == 0) {
    if (cur_char == '"') {
      state = 1;
    } else if (last_char == '#' && cur_char == 'd') {
      state = 2;
    } else if (last_char == '/' && cur_char == '*') {
      state = 3;
    } else {
      state = 0;
    }
  } else if (state == 1) {
    if (cur_char == '"') {
      state = 0;
    } else {
      state = 1;
    }
  } else if (state == 2) {
    if (cur_char == '\n') {
      state = 0;
    } else {
      state = 2;
    }
  } else if (state == 3) {
    if (last_char == '*' && cur_char == '/') {
      state = 0;
    } else {
      state = 3;
    }
  } else {
  }
  return state;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<change_state>:
  endbr64
  mov    D0(%rip),%rdx
  mov    (%rdx),%eax
  test   %eax,%eax
  jne    L12
  cmp    $0x22,%edi
  je     L49
  cmp    $0x23,%esi
  jne    L31
  cmp    $0x64,%edi
  jne    L31
  movl   $0x2,(%rdx)
  mov    $0x2,%eax
  ret
  nopl   0x0(%rax)
L12:
  cmp    $0x1,%eax
  je     L117
  cmp    $0x2,%eax
  je     L68
  cmp    $0x3,%eax
  je     L19
L60:
  ret
L49:
  movl   $0x1,(%rdx)
  mov    $0x1,%eax
  ret
  nopl   0x0(%rax)
L31:
  cmp    $0x2f,%esi
  jne    L60
  cmp    $0x2a,%edi
  jne    L60
  movl   $0x3,(%rdx)
  mov    $0x3,%eax
  ret
  cs nopw 0x0(%rax,%rax,1)
L19:
  cmp    $0x2a,%esi
  jne    L60
  cmp    $0x2f,%edi
  jne    L60
L15:
  movl   $0x0,(%rdx)
  xor    %eax,%eax
  ret
  nopl   0x0(%rax,%rax,1)
L117:
  cmp    $0x22,%edi
  je     L15
  ret
  xchg   %ax,%ax
L68:
  cmp    $0xa,%edi
  je     L15
  ret
```

assistant: ```c
int change_state(int cur_char, int last_char) {
  extern int state;
  if (state == 0) {
    if (cur_char == '"') {
      state = 1;
    } else if (last_char == '#' && cur_char == 'd') {
      state = 2;
    } else if (last_char == '/' && cur_char == '*') {
      state = 3;
    } else {
      state = 0;
    }
  } else if (state == 1) {
    if (cur_char == '"') {
      state = 0;
    } else {
      state = 1;
    }
  } else if (state == 2) {
    if (cur_char == '\n') {
      state = 0;
    } else {
      state = 2;
    }
  } else if (state == 3) {
    if (last_char == '*' && cur_char == '/') {
      state = 0;
    } else {
      state = 3;
    }
  } else {
  }
  return state;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<var>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x10(%rbp)
  mov    -0x2c(%rbp),%edx
  mov    -0x28(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <mean@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x8(%rbp)
  movl   $0x0,-0x14(%rbp)
  jmp    L3
L12:
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  movapd %xmm0,%xmm1
  subsd  -0x8(%rbp),%xmm1
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  subsd  -0x8(%rbp),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  -0x10(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x10(%rbp)
  addl   $0x1,-0x14(%rbp)
L3:
  mov    -0x14(%rbp),%eax
  cmp    -0x2c(%rbp),%eax
  jl     L12
  pxor   %xmm1,%xmm1
  cvtsi2sdl -0x2c(%rbp),%xmm1
  movsd  -0x10(%rbp),%xmm0
  divsd  %xmm1,%xmm0
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  leave
  ret
```

assistant: ```c
double var(int *array, int len) {
  int i;
  double sum = 0;
  double m = mean(array, len);
  for (i = 0; i < len; i++)
    sum += (array[i] - m) * (array[i] - m);
  return sum / len;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<var>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbp
  mov    %esi,%ebx
  call   <mean@plt>
  test   %ebx,%ebx
  jle    L20
  movapd %xmm0,%xmm2
  mov    %rbp,%rax
  lea    -0x1(%rbx),%edx
  lea    0x4(%rbp,%rdx,4),%rdx
  pxor   %xmm0,%xmm0
L23:
  pxor   %xmm1,%xmm1
  cvtsi2sdl (%rax),%xmm1
  subsd  %xmm2,%xmm1
  mulsd  %xmm1,%xmm1
  addsd  %xmm1,%xmm0
  add    $0x4,%rax
  cmp    %rdx,%rax
  jne    L23
L14:
  pxor   %xmm1,%xmm1
  cvtsi2sd %ebx,%xmm1
  divsd  %xmm1,%xmm0
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
L20:
  pxor   %xmm0,%xmm0
  jmp    L14
```

assistant: ```c
double var(int *array, int len) {
  int i;
  double sum = 0;
  double m = mean(array, len);
  for (i = 0; i < len; i++)
    sum += (array[i] - m) * (array[i] - m);
  return sum / len;
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<var>:
  endbr64
  push   %rbp
  mov    %esi,%ebp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x8,%rsp
  call   <mean@plt>
  test   %ebp,%ebp
  jle    L7
  lea    -0x1(%rbp),%eax
  movapd %xmm0,%xmm2
  pxor   %xmm0,%xmm0
  mov    %rbx,%rdi
  lea    0x4(%rbx,%rax,4),%rax
  nopl   0x0(%rax,%rax,1)
L1:
  pxor   %xmm1,%xmm1
  add    $0x4,%rdi
  cvtsi2sdl -0x4(%rdi),%xmm1
  subsd  %xmm2,%xmm1
  mulsd  %xmm1,%xmm1
  addsd  %xmm1,%xmm0
  cmp    %rdi,%rax
  jne    L1
  pxor   %xmm1,%xmm1
  add    $0x8,%rsp
  cvtsi2sd %ebp,%xmm1
  pop    %rbx
  pop    %rbp
  divsd  %xmm1,%xmm0
  ret
  nopl   0x0(%rax)
L7:
  pxor   %xmm1,%xmm1
  add    $0x8,%rsp
  pxor   %xmm0,%xmm0
  cvtsi2sd %ebp,%xmm1
  pop    %rbx
  pop    %rbp
  divsd  %xmm1,%xmm0
  ret
```

assistant: ```c
double var(int *array, int len) {
  int i;
  double sum = 0;
  double m = mean(array, len);
  for (i = 0; i < len; i++)
    sum += (array[i] - m) * (array[i] - m);
  return sum / len;
}
```
user: What is the c source code of the assembly code below?

```asm
<var>:
  endbr64
  push   %rbp
  mov    %esi,%ebp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x8,%rsp
  call   <mean@plt>
  test   %ebp,%ebp
  jle    L9
  lea    -0x1(%rbp),%eax
  movapd %xmm0,%xmm2
  pxor   %xmm0,%xmm0
  mov    %rbx,%rdi
  lea    0x4(%rbx,%rax,4),%rax
  nopl   0x0(%rax,%rax,1)
L0:
  pxor   %xmm1,%xmm1
  add    $0x4,%rdi
  cvtsi2sdl -0x4(%rdi),%xmm1
  subsd  %xmm2,%xmm1
  mulsd  %xmm1,%xmm1
  addsd  %xmm1,%xmm0
  cmp    %rdi,%rax
  jne    L0
  pxor   %xmm1,%xmm1
  add    $0x8,%rsp
  cvtsi2sd %ebp,%xmm1
  pop    %rbx
  pop    %rbp
  divsd  %xmm1,%xmm0
  ret
  nopl   0x0(%rax)
L9:
  pxor   %xmm1,%xmm1
  add    $0x8,%rsp
  pxor   %xmm0,%xmm0
  cvtsi2sd %ebp,%xmm1
  pop    %rbx
  pop    %rbp
  divsd  %xmm1,%xmm0
  ret
```

assistant: ```c
double var(int *array, int len) {
  int i;
  double sum = 0;
  double m = mean(array, len);
  for (i = 0; i < len; i++)
    sum += (array[i] - m) * (array[i] - m);
  return sum / len;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<itoa>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %edi,-0x34(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %edx,-0x38(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movabs $0x3736353433323130,%rax
  movabs $0x4645444342413938,%rdx
  mov    %rax,-0x20(%rbp)
  mov    %rdx,-0x18(%rbp)
  movb   $0x0,-0x10(%rbp)
  movl   $0x1,-0x28(%rbp)
  movl   $0x0,-0x24(%rbp)
  cmpl   $0x0,-0x34(%rbp)
  jns    L40
  movl   $0xffffffff,-0x28(%rbp)
L40:
  mov    -0x34(%rbp),%eax
  cltd
  idivl  -0x38(%rbp)
  mov    %edx,%ecx
  mov    -0x24(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x24(%rbp)
  movslq %eax,%rdx
  mov    -0x40(%rbp),%rax
  add    %rax,%rdx
  movslq %ecx,%rax
  movzbl -0x20(%rbp,%rax,1),%eax
  mov    %al,(%rdx)
  mov    -0x34(%rbp),%eax
  cltd
  idivl  -0x38(%rbp)
  mov    %eax,-0x34(%rbp)
  cmpl   $0x0,-0x34(%rbp)
  jg     L40
  cmpl   $0xa,-0x38(%rbp)
  jne    L7
  cmpl   $0x0,-0x28(%rbp)
  jns    L7
  mov    -0x24(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x24(%rbp)
  movslq %eax,%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movb   $0x2d,(%rax)
L7:
  mov    -0x24(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x40(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x40(%rbp),%rax
  mov    %rax,%rdi
  call   <strrev@plt>
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L36
  call   <__stack_chk_fail@plt>
L36:
  leave
  ret
```

assistant: ```c
char *itoa(int value, char *string, int radix) {
  char map[] = "0123456789ABCDEF";
  int sign = 1, i = 0;
  if (value < 0)
    sign = -1;
  do {
    string[i++] = map[value % radix];
  } while ((value /= radix) > 0);
  if (radix == 10 && sign < 0)
    string[i++] = '-';
  string[i] = '\0';
  return strrev(string);
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<itoa>:
  endbr64
  sub    $0x28,%rsp
  mov    %rsi,%r10
  mov    %edx,%r8d
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  movabs $0x3736353433323130,%rax
  movabs $0x4645444342413938,%rdx
  mov    %rax,(%rsp)
  mov    %rdx,0x8(%rsp)
  movb   $0x0,0x10(%rsp)
  mov    %edi,%r11d
  sar    $0x1f,%r11d
  or     $0x1,%r11d
  mov    $0x0,%ecx
L24:
  mov    %ecx,%r9d
  add    $0x1,%ecx
  mov    %edi,%eax
  cltd
  idiv   %r8d
  movslq %edx,%rdx
  movzbl (%rsp,%rdx,1),%edx
  mov    %dl,(%rsi)
  mov    %eax,%edi
  add    $0x1,%rsi
  test   %eax,%eax
  jg     L24
  cmp    $0xa,%r8d
  jne    L18
  test   %r11d,%r11d
  jns    L18
  movslq %ecx,%rcx
  movb   $0x2d,(%r10,%rcx,1)
  lea    0x2(%r9),%ecx
L18:
  movslq %ecx,%rcx
  movb   $0x0,(%r10,%rcx,1)
  mov    %r10,%rdi
  call   <strrev@plt>
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L30
  add    $0x28,%rsp
  ret
L30:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
char *itoa(int value, char *string, int radix) {
  char map[] = "0123456789ABCDEF";
  int sign = 1, i = 0;
  if (value < 0)
    sign = -1;
  do {
    string[i++] = map[value % radix];
  } while ((value /= radix) > 0);
  if (radix == 10 && sign < 0)
    string[i++] = '-';
  string[i] = '\0';
  return strrev(string);
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<itoa>:
  endbr64
  sub    $0x28,%rsp
  mov    %edi,%eax
  mov    %edx,%edi
  mov    %rsi,%r9
  mov    %fs:0x28,%rdx
  mov    %rdx,0x18(%rsp)
  xor    %edx,%edx
  movdqa D4(%rip),%xmm0
  cmp    $0xa,%edi
  movb   $0x0,0x10(%rsp)
  sete   %r10b
  movaps %xmm0,(%rsp)
  test   %eax,%eax
  js     L6
  xor    %r10d,%r10d
L6:
  mov    %r9,%rsi
  xor    %ecx,%ecx
  nopl   0x0(%rax,%rax,1)
L29:
  cltd
  mov    %ecx,%r8d
  add    $0x1,%rsi
  add    $0x1,%ecx
  idiv   %edi
  movslq %edx,%rdx
  movzbl (%rsp,%rdx,1),%edx
  mov    %dl,-0x1(%rsi)
  test   %eax,%eax
  jg     L29
  test   %r10b,%r10b
  je     L20
  movslq %ecx,%rcx
  movb   $0x2d,(%r9,%rcx,1)
  lea    0x2(%r8),%ecx
L20:
  movslq %ecx,%rcx
  movb   $0x0,(%r9,%rcx,1)
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L21
  mov    %r9,%rdi
  add    $0x28,%rsp
  jmp    1070 <strrev@plt>
L21:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_label: D4
type_infered: byte[16]

tool: {"D4": [0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46]}

assistant: ```c
char *itoa(int value, char *string, int radix) {
  char map[] = "0123456789ABCDEF";
  int sign = 1, i = 0;
  if (value < 0)
    sign = -1;
  do {
    string[i++] = map[value % radix];
  } while ((value /= radix) > 0);
  if (radix == 10 && sign < 0)
    string[i++] = '-';
  string[i] = '\0';
  return strrev(string);
}
```
user: What is the c source code of the assembly code below:

```asm
<itoa>:
  endbr64
  sub    $0x28,%rsp
  mov    %edi,%eax
  mov    %edx,%edi
  mov    %rsi,%r9
  mov    %fs:0x28,%rdx
  mov    %rdx,0x18(%rsp)
  xor    %edx,%edx
  movdqa D4(%rip),%xmm0
  cmp    $0xa,%edi
  movb   $0x0,0x10(%rsp)
  sete   %r10b
  movaps %xmm0,(%rsp)
  test   %eax,%eax
  js     L10
  xor    %r10d,%r10d
L10:
  mov    %r9,%rsi
  xor    %ecx,%ecx
  nopl   0x0(%rax,%rax,1)
L30:
  cltd
  mov    %ecx,%r8d
  add    $0x1,%rsi
  add    $0x1,%ecx
  idiv   %edi
  movslq %edx,%rdx
  movzbl (%rsp,%rdx,1),%edx
  mov    %dl,-0x1(%rsi)
  test   %eax,%eax
  jg     L30
  test   %r10b,%r10b
  je     L14
  movslq %ecx,%rcx
  movb   $0x2d,(%r9,%rcx,1)
  lea    0x2(%r8),%ecx
L14:
  movslq %ecx,%rcx
  movb   $0x0,(%r9,%rcx,1)
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L26
  mov    %r9,%rdi
  add    $0x28,%rsp
  jmp    1070 <strrev@plt>
L26:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D4
type_infered: byte[16]

tool: {"D4": [0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44,0x45,0x46]}

assistant: ```c
char *itoa(int value, char *string, int radix) {
  char map[] = "0123456789ABCDEF";
  int sign = 1, i = 0;
  if (value < 0)
    sign = -1;
  do {
    string[i++] = map[value % radix];
  } while ((value /= radix) > 0);
  if (radix == 10 && sign < 0)
    string[i++] = '-';
  string[i] = '\0';
  return strrev(string);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<TrimSpace>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    %ecx,-0x20(%rbp)
  movl   $0x0,-0x4(%rbp)
  movl   $0x0,-0xc(%rbp)
  mov    -0x1c(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x8(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  je     L154
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L219
L154:
  mov    $0x0,%eax
  jmp    L72
L219:
  cmpl   $0x0,-0x1c(%rbp)
  jg     L47
  mov    $0x0,%eax
  jmp    L72
L47:
  cmpq   $0x0,-0x28(%rbp)
  jne    L50
  mov    $0x0,%eax
  jmp    L72
L50:
  cmpl   $0x0,-0x20(%rbp)
  jg     L116
  mov    $0x0,%eax
  jmp    L72
L116:
  movl   $0x0,-0xc(%rbp)
  jmp    L34
L198:
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0xe(%rbp)
  cmpb   $0x20,-0xe(%rbp)
  je     L109
  cmpb   $0x9,-0xe(%rbp)
  je     L109
  cmpb   $0xb,-0xe(%rbp)
  jne    L1
L109:
  addl   $0x1,-0xc(%rbp)
L34:
  mov    -0xc(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jl     L198
  jmp    L135
L1:
  nop
L135:
  mov    -0x1c(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x8(%rbp)
  jmp    L75
L76:
  mov    -0x8(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0xd(%rbp)
  cmpb   $0x20,-0xd(%rbp)
  je     L98
  cmpb   $0x9,-0xd(%rbp)
  je     L98
  cmpb   $0xb,-0xd(%rbp)
  jne    L85
L98:
  subl   $0x1,-0x8(%rbp)
L75:
  mov    -0x8(%rbp),%eax
  cmp    -0xc(%rbp),%eax
  jg     L76
  jmp    L31
L85:
  nop
L31:
  mov    -0x8(%rbp),%eax
  sub    -0xc(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  cmp    -0x20(%rbp),%eax
  jl     L0
  mov    $0x0,%eax
  jmp    L72
L0:
  mov    -0x20(%rbp),%edx
  mov    -0x28(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x4(%rbp),%edx
  mov    -0x28(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x28(%rbp),%rax
L72:
  leave
  ret
```

assistant: ```c
const char *TrimSpace(const char *str, int len, char *buf, int bufSize) {
  int size = 0;
  int start = 0;
  int end = len - 1;
  if ((str == NULL) || (*str == 0)) {
    return NULL;
  }
  if (len < 1) {
    return NULL;
  }
  if (buf == NULL) {
    return NULL;
  }
  if (bufSize < 1) {
    return NULL;
  }
  for (start = 0; start < len; ++start) {
    char c = str[start];
    if ((c != ' ') && (c != '\t') && (c != '\v')) {
      break;
    }
  }
  for (end = len - 1; end > start; --end) {
    char c = str[end];
    if ((c != ' ') && (c != '\t') && (c != '\v')) {
      break;
    }
  }
  size = end - start + 1;
  if (size >= bufSize) {
    return NULL;
  }
  memset(buf, 0, sizeof(char) * bufSize);
  memcpy(buf, str + start, sizeof(char) * size);
  return buf;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<TrimSpace>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%r12
  test   %rdi,%rdi
  je     L127
  mov    %esi,%eax
  mov    %rdx,%r13
  mov    %ecx,%edi
  test   %rdx,%rdx
  sete   %dl
  test   %ecx,%ecx
  setle  %cl
  or     %ecx,%edx
  test   %esi,%esi
  setle  %cl
  or     %cl,%dl
  jne    L71
  cmpb   $0x0,(%r12)
  je     L71
  mov    %r12,%rdx
  mov    $0x0,%ebp
  jmp    L99
L145:
  add    $0x1,%ebp
  add    $0x1,%rdx
  cmp    %ebp,%eax
  jle    L70
L99:
  movzbl (%rdx),%ecx
  mov    %ecx,%esi
  and    $0xfffffffd,%esi
  cmp    $0x9,%sil
  je     L145
  cmp    $0x20,%cl
  je     L145
L70:
  sub    $0x1,%eax
  movslq %eax,%rdx
  add    %r12,%rdx
  cmp    %ebp,%eax
  jg     L159
  jmp    L87
L118:
  sub    $0x1,%eax
  sub    $0x1,%rdx
  cmp    %ebp,%eax
  je     L113
L159:
  movzbl (%rdx),%ecx
  mov    %ecx,%esi
  and    $0xfffffffd,%esi
  cmp    $0x9,%sil
  je     L118
  cmp    $0x20,%cl
  je     L118
  jmp    L87
L113:
  mov    %ebp,%eax
L87:
  sub    %ebp,%eax
  lea    0x1(%rax),%ebx
  mov    $0x0,%eax
  cmp    %ebx,%edi
  jle    L134
  mov    %edi,%edx
  mov    $0x0,%esi
  mov    %r13,%rdi
  call   <memset@plt>
  movslq %ebp,%rsi
  add    %r12,%rsi
  mov    %ebx,%edx
  mov    %r13,%rdi
  call   <memcpy@plt>
  mov    %r13,%rax
  jmp    L134
L127:
  mov    %rdi,%rax
  jmp    L134
L71:
  mov    $0x0,%eax
L134:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
const char *TrimSpace(const char *str, int len, char *buf, int bufSize) {
  int size = 0;
  int start = 0;
  int end = len - 1;
  if ((str == NULL) || (*str == 0)) {
    return NULL;
  }
  if (len < 1) {
    return NULL;
  }
  if (buf == NULL) {
    return NULL;
  }
  if (bufSize < 1) {
    return NULL;
  }
  for (start = 0; start < len; ++start) {
    char c = str[start];
    if ((c != ' ') && (c != '\t') && (c != '\v')) {
      break;
    }
  }
  for (end = len - 1; end > start; --end) {
    char c = str[end];
    if ((c != ' ') && (c != '\t') && (c != '\v')) {
      break;
    }
  }
  size = end - start + 1;
  if (size >= bufSize) {
    return NULL;
  }
  memset(buf, 0, sizeof(char) * bufSize);
  memcpy(buf, str + start, sizeof(char) * size);
  return buf;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<TrimSpace>:
  endbr64
  test   %rdi,%rdi
  je     L45
  push   %r13
  mov    %ecx,%r8d
  mov    %rdx,%r13
  mov    %esi,%eax
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x8,%rsp
  test   %rdx,%rdx
  movzbl (%rdi),%ecx
  sete   %dl
  test   %r8d,%r8d
  setle  %sil
  or     %esi,%edx
  test   %eax,%eax
  setle  %sil
  or     %sil,%dl
  jne    L61
  test   %cl,%cl
  je     L61
  lea    0x1(%rdi),%rdx
  xor    %ebx,%ebx
  jmp    L73
  nopl   0x0(%rax,%rax,1)
L39:
  movzbl (%rdx),%ecx
  add    $0x1,%rdx
L73:
  mov    %ecx,%esi
  and    $0xfffffffd,%esi
  cmp    $0x9,%sil
  je     L98
  cmp    $0x20,%cl
  jne    L16
L98:
  add    $0x1,%ebx
  cmp    %ebx,%eax
  jg     L39
L16:
  sub    $0x1,%eax
  movslq %eax,%rdx
  add    %rbp,%rdx
  cmp    %eax,%ebx
  jge    L68
  nopl   0x0(%rax,%rax,1)
L62:
  movzbl (%rdx),%ecx
  mov    %ecx,%esi
  and    $0xfffffffd,%esi
  cmp    $0x9,%sil
  je     L119
  cmp    $0x20,%cl
  jne    L68
L119:
  sub    $0x1,%eax
  sub    $0x1,%rdx
  cmp    %eax,%ebx
  jne    L62
L68:
  sub    %ebx,%eax
  lea    0x1(%rax),%r12d
  xor    %eax,%eax
  cmp    %r12d,%r8d
  jle    L27
  mov    %r8d,%edx
  xor    %esi,%esi
  mov    %r13,%rdi
  movslq %ebx,%rbx
  call   <memset@plt>
  lea    0x0(%rbp,%rbx,1),%rsi
  mov    %r12d,%edx
  mov    %r13,%rdi
  call   <memcpy@plt>
  mov    %r13,%rax
L27:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L61:
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   (%rax)
L45:
  xor    %eax,%eax
  ret
```

assistant: ```c
const char *TrimSpace(const char *str, int len, char *buf, int bufSize) {
  int size = 0;
  int start = 0;
  int end = len - 1;
  if ((str == NULL) || (*str == 0)) {
    return NULL;
  }
  if (len < 1) {
    return NULL;
  }
  if (buf == NULL) {
    return NULL;
  }
  if (bufSize < 1) {
    return NULL;
  }
  for (start = 0; start < len; ++start) {
    char c = str[start];
    if ((c != ' ') && (c != '\t') && (c != '\v')) {
      break;
    }
  }
  for (end = len - 1; end > start; --end) {
    char c = str[end];
    if ((c != ' ') && (c != '\t') && (c != '\v')) {
      break;
    }
  }
  size = end - start + 1;
  if (size >= bufSize) {
    return NULL;
  }
  memset(buf, 0, sizeof(char) * bufSize);
  memcpy(buf, str + start, sizeof(char) * size);
  return buf;
}
```