ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请将以下的汇编代码转换成C语言代码:

```asm
<main>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x120,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x118(%rsp)
  xor    %eax,%eax
  mov    $0x0,%r8d
  mov    $0x0,%edi
  mov    $0x2,%esi
  jmp    L93
L69:
  mov    $0x2,%ecx
  jmp    L47
L4:
  mov    $0x2,%ecx
  jmp    L47
L26:
  mov    %eax,%edi
L15:
  add    $0x1,%esi
  cmp    $0x12d,%esi
  je     L14
L93:
  cmp    $0x1,%esi
  jle    L69
  test   $0x1,%sil
  je     L4
  mov    $0x2,%ecx
L137:
  add    $0x1,%ecx
  cmp    %esi,%ecx
  jg     L15
  mov    %esi,%eax
  cltd
  idiv   %ecx
  test   %edx,%edx
  jne    L137
L47:
  cmp    %ecx,%esi
  jne    L15
  movslq %edi,%rax
  mov    %esi,0x50(%rsp,%rax,4)
  lea    0x1(%rdi),%eax
  cmp    $0x12,%r8d
  jg     L14
  cmp    $0x1,%eax
  jle    L26
  sub    $0x1,%edi
  movslq %edi,%rdi
  mov    0x50(%rsp,%rdi,4),%edx
  mov    %esi,%ecx
  sub    %edx,%ecx
  mov    %eax,%edi
  cmp    $0x2,%ecx
  jne    L15
  movslq %r8d,%rcx
  mov    %edx,(%rsp,%rcx,4)
  lea    0x1(%r8),%edx
  movslq %edx,%rdx
  mov    %esi,(%rsp,%rdx,4)
  add    $0x2,%r8d
  jmp    L15
L14:
  test   %r8d,%r8d
  jle    L80
  mov    %rsp,%rbx
  lea    -0x1(%r8),%eax
  shr    %eax
  mov    %eax,%eax
  lea    0x8(%rsp,%rax,8),%r12
  lea    D7(%rip),%rbp
L71:
  mov    0x4(%rbx),%edx
  mov    (%rbx),%esi
  mov    %rbp,%rdi
  call   <printf@plt>
  add    $0x8,%rbx
  cmp    %r12,%rbx
  jne    L71
L80:
  mov    0x118(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L77
  mov    $0x0,%eax
  add    $0x120,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L77:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: label: D7
type_guessed: string

tool: D7: (%d, %d)


assistant: ```c
int main() {
  int num, twinPrimes[20], br, simplNum[50], i = 0, a = 0;
  for (num = 2; num <= 300; num = num + 1) {
    for (br = 2; br <= num; br = br + 1) {
      if (num % br == 0) {
        break;
      }
    }
    if (br == num) {
      simplNum[i] = num;
      i = i + 1;
      if (a > 18) {
        break;
      }
      if (i > 1 && simplNum[i - 1] - simplNum[i - 2] == 2) {
        twinPrimes[a] = simplNum[i - 2];
        twinPrimes[a + 1] = simplNum[i - 1];
        a = a + 2;
      }
    }
  }
  for (br = 0; br < a; br = br + 2) {
    printf("(%d, %d)\n", twinPrimes[br], twinPrimes[br + 1]);
  }
  return 0;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  push   %r12
  mov    $0x3,%edi
  xor    %r9d,%r9d
  xor    %r8d,%r8d
  push   %rbp
  mov    $0x2,%esi
  push   %rbx
  sub    $0x120,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x118(%rsp)
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L33:
  mov    $0x2,%ecx
  nopl   (%rax)
L130:
  mov    %esi,%eax
  cltd
  idiv   %ecx
  test   %edx,%edx
  je     L89
  add    $0x1,%ecx
  cmp    %edi,%ecx
  jne    L130
L60:
  add    $0x1,%esi
  add    $0x1,%edi
  cmp    $0x12d,%esi
  jne    L33
L78:
  test   %r9d,%r9d
  je     L108
L57:
  lea    -0x1(%r9),%eax
  mov    %rsp,%rbx
  lea    D6(%rip),%rbp
  shr    %eax
  lea    0x8(%rsp,%rax,8),%r12
  nopl   0x0(%rax,%rax,1)
L59:
  mov    0x4(%rbx),%edx
  mov    (%rbx),%esi
  mov    %rbp,%rdi
  add    $0x8,%rbx
  call   <printf@plt>
  cmp    %rbx,%r12
  jne    L59
L108:
  mov    0x118(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L36
  add    $0x120,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L89:
  cmp    %ecx,%esi
  jne    L60
  movslq %r8d,%rax
  mov    %esi,0x50(%rsp,%rax,4)
  lea    0x1(%r8),%eax
  cmp    $0x12,%r9d
  jg     L57
  cmp    $0x1,%eax
  je     L129
  sub    $0x1,%r8d
  mov    %esi,%ecx
  movslq %r8d,%r8
  mov    0x50(%rsp,%r8,4),%edx
  mov    %eax,%r8d
  sub    %edx,%ecx
  cmp    $0x2,%ecx
  jne    L60
  movslq %r9d,%rax
  add    $0x1,%edi
  mov    %edx,(%rsp,%rax,4)
  lea    0x1(%r9),%eax
  add    $0x2,%r9d
  cltq
  mov    %esi,(%rsp,%rax,4)
  add    $0x1,%esi
  cmp    $0x12d,%esi
  jne    L33
  jmp    L78
L129:
  add    $0x1,%esi
  mov    $0x1,%r8d
  add    $0x1,%edi
  cmp    $0x12d,%esi
  jne    L33
  jmp    L78
L36:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_tag: D6
data_type: string

tool: D6: (%d, %d)


assistant: ```c
int main() {
  int num, twinPrimes[20], br, simplNum[50], i = 0, a = 0;
  for (num = 2; num <= 300; num = num + 1) {
    for (br = 2; br <= num; br = br + 1) {
      if (num % br == 0) {
        break;
      }
    }
    if (br == num) {
      simplNum[i] = num;
      i = i + 1;
      if (a > 18) {
        break;
      }
      if (i > 1 && simplNum[i - 1] - simplNum[i - 2] == 2) {
        twinPrimes[a] = simplNum[i - 2];
        twinPrimes[a + 1] = simplNum[i - 1];
        a = a + 2;
      }
    }
  }
  for (br = 0; br < a; br = br + 2) {
    printf("(%d, %d)\n", twinPrimes[br], twinPrimes[br + 1]);
  }
  return 0;
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<main>:
  endbr64
  push   %r12
  mov    $0x3,%edi
  xor    %r9d,%r9d
  xor    %r8d,%r8d
  push   %rbp
  mov    $0x2,%esi
  push   %rbx
  sub    $0x120,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x118(%rsp)
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L118:
  mov    $0x2,%ecx
  nopl   (%rax)
L125:
  mov    %esi,%eax
  cltd
  idiv   %ecx
  test   %edx,%edx
  je     L72
  add    $0x1,%ecx
  cmp    %ecx,%edi
  jne    L125
L5:
  add    $0x1,%esi
  add    $0x1,%edi
  cmp    $0x12d,%esi
  jne    L118
L70:
  test   %r9d,%r9d
  je     L55
L25:
  lea    -0x1(%r9),%eax
  mov    %rsp,%rbx
  lea    D5(%rip),%rbp
  shr    %eax
  lea    0x8(%rsp,%rax,8),%r12
  nopl   0x0(%rax,%rax,1)
L38:
  mov    0x4(%rbx),%edx
  mov    (%rbx),%esi
  mov    %rbp,%rdi
  add    $0x8,%rbx
  call   <printf@plt>
  cmp    %r12,%rbx
  jne    L38
L55:
  mov    0x118(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L134
  add    $0x120,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L72:
  cmp    %ecx,%esi
  jne    L5
  movslq %r8d,%rax
  mov    %esi,0x50(%rsp,%rax,4)
  lea    0x1(%r8),%eax
  cmp    $0x12,%r9d
  jg     L25
  cmp    $0x1,%eax
  je     L43
  sub    $0x1,%r8d
  mov    %esi,%ecx
  movd   %esi,%xmm1
  movslq %r8d,%r8
  mov    0x50(%rsp,%r8,4),%edx
  mov    %eax,%r8d
  movd   %edx,%xmm0
  sub    %edx,%ecx
  punpckldq %xmm1,%xmm0
  cmp    $0x2,%ecx
  jne    L5
  movslq %r9d,%rax
  add    $0x1,%esi
  add    $0x2,%r9d
  add    $0x1,%edi
  movq   %xmm0,(%rsp,%rax,4)
  cmp    $0x12d,%esi
  jne    L118
  jmp    L70
  nopl   (%rax)
L43:
  add    $0x1,%esi
  mov    $0x1,%r8d
  add    $0x1,%edi
  cmp    $0x12d,%esi
  jne    L118
  jmp    L70
L134:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: tag: D5
type_guessed: string

tool: D5: (%d, %d)


assistant: ```c
int main() {
  int num, twinPrimes[20], br, simplNum[50], i = 0, a = 0;
  for (num = 2; num <= 300; num = num + 1) {
    for (br = 2; br <= num; br = br + 1) {
      if (num % br == 0) {
        break;
      }
    }
    if (br == num) {
      simplNum[i] = num;
      i = i + 1;
      if (a > 18) {
        break;
      }
      if (i > 1 && simplNum[i - 1] - simplNum[i - 2] == 2) {
        twinPrimes[a] = simplNum[i - 2];
        twinPrimes[a + 1] = simplNum[i - 1];
        a = a + 2;
      }
    }
  }
  for (br = 0; br < a; br = br + 2) {
    printf("(%d, %d)\n", twinPrimes[br], twinPrimes[br + 1]);
  }
  return 0;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<get_str_len>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    %esi,-0xc(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  jns    L0
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  jmp    L16
L0:
  mov    -0xc(%rbp),%eax
  cltq
L16:
  leave
  ret
```

assistant: ```c
size_t get_str_len(const char *str, int len) {
  if (len < 0)
    return strlen(str);
  else
    return len;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<get_str_len>:
  endbr64
  movslq %esi,%rax
  test   %esi,%esi
  js     L4
  ret
L4:
  sub    $0x8,%rsp
  call   <strlen@plt>
  add    $0x8,%rsp
  ret
```

assistant: ```c
size_t get_str_len(const char *str, int len) {
  if (len < 0)
    return strlen(str);
  else
    return len;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<get_str_len>:
  endbr64
  test   %esi,%esi
  js     L7
  movslq %esi,%rax
  ret
  nopl   0x0(%rax)
L7:
  jmp    1050 <strlen@plt>
```

assistant: ```c
size_t get_str_len(const char *str, int len) {
  if (len < 0)
    return strlen(str);
  else
    return len;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<get_str_len>:
  endbr64
  test   %esi,%esi
  js     L6
  movslq %esi,%rax
  ret
  nopl   0x0(%rax)
L6:
  jmp    1050 <strlen@plt>
```

assistant: ```c
size_t get_str_len(const char *str, int len) {
  if (len < 0)
    return strlen(str);
  else
    return len;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<Arith_mod>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x4(%rbp)
  mov    %esi,-0x8(%rbp)
  mov    -0x4(%rbp),%eax
  xor    -0x8(%rbp),%eax
  test   %eax,%eax
  jns    L7
  mov    -0x4(%rbp),%eax
  cltd
  idivl  -0x8(%rbp)
  mov    %edx,%eax
  test   %eax,%eax
  je     L7
  mov    -0x4(%rbp),%eax
  cltd
  idivl  -0x8(%rbp)
  mov    -0x8(%rbp),%eax
  add    %edx,%eax
  jmp    L3
L7:
  mov    -0x4(%rbp),%eax
  cltd
  idivl  -0x8(%rbp)
  mov    %edx,%eax
L3:
  pop    %rbp
  ret
```

assistant: ```c
int Arith_mod(int x, int y) {
  if (-13 / 5 == -2 && (x < 0) != (y < 0) && x % y != 0)
    return x % y + y;
  else
    return x % y;
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<Arith_mod>:
  endbr64
  mov    %edi,%eax
  xor    %esi,%eax
  jns    L3
  mov    %edi,%eax
  cltd
  idiv   %esi
  test   %edx,%edx
  je     L3
  add    %esi,%edx
  jmp    L28
L3:
  mov    %edi,%eax
  cltd
  idiv   %esi
L28:
  mov    %edx,%eax
  ret
```

assistant: ```c
int Arith_mod(int x, int y) {
  if (-13 / 5 == -2 && (x < 0) != (y < 0) && x % y != 0)
    return x % y + y;
  else
    return x % y;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<Arith_mod>:
  endbr64
  mov    %edi,%eax
  cltd
  idiv   %esi
  xor    %esi,%edi
  jns    L1
  add    %edx,%esi
  test   %edx,%edx
  cmovne %esi,%edx
L1:
  mov    %edx,%eax
  ret
```

assistant: ```c
int Arith_mod(int x, int y) {
  if (-13 / 5 == -2 && (x < 0) != (y < 0) && x % y != 0)
    return x % y + y;
  else
    return x % y;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<Arith_mod>:
  endbr64
  mov    %edi,%eax
  cltd
  idiv   %esi
  xor    %esi,%edi
  jns    L3
  add    %edx,%esi
  test   %edx,%edx
  cmovne %esi,%edx
L3:
  mov    %edx,%eax
  ret
```

assistant: ```c
int Arith_mod(int x, int y) {
  if (-13 / 5 == -2 && (x < 0) != (y < 0) && x % y != 0)
    return x % y + y;
  else
    return x % y;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<__ultoa>:
  endbr64
  push   %rbx
  mov    %edi,%eax
  mov    %rsi,%rbx
  cmp    $0xa,%edx
  je     L103
  cmp    $0x10,%edx
  je     L89
  cmp    $0x8,%edx
  je     L99
  mov    $0x0,%eax
  call   <abort@plt>
  mov    %rbx,%rsi
  jmp    L152
L103:
  cmp    $0x9,%edi
  jle    L42
  mov    D0(%rip),%rdx
  cmp    %edi,(%rdx)
  jge    L154
  lea    -0x1(%rsi),%rsi
  movslq %edi,%rdx
  imul   $0x66666667,%rdx,%rdx
  sar    $0x22,%rdx
  mov    %edi,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%edx
  lea    (%rdx,%rdx,4),%ecx
  add    %ecx,%ecx
  sub    %ecx,%eax
  add    $0x30,%eax
  mov    %al,-0x1(%rbx)
  movslq %edx,%rcx
L108:
  movabs $0x6666666666666667,%r8
L54:
  sub    $0x1,%rsi
  mov    %rcx,%rax
  imul   %r8
  sar    $0x2,%rdx
  mov    %rcx,%rax
  sar    $0x3f,%rax
  sub    %rax,%rdx
  lea    (%rdx,%rdx,4),%rdi
  add    %rdi,%rdi
  mov    %rcx,%rax
  sub    %rdi,%rax
  add    $0x30,%eax
  mov    %al,(%rsi)
  mov    %rdx,%rcx
  test   %rdx,%rdx
  jne    L54
  jmp    L152
L42:
  lea    -0x1(%rsi),%rsi
  add    $0x30,%eax
  mov    %al,-0x1(%rbx)
  jmp    L152
L154:
  movslq %edi,%rcx
  jmp    L108
L99:
  mov    %rbx,%rsi
  sub    $0x1,%rbx
  mov    %eax,%edx
  and    $0x7,%edx
  add    $0x30,%edx
  mov    %dl,(%rbx)
  sar    $0x3,%eax
  jne    L99
  cmp    $0x30,%dl
  je     L125
  test   %ecx,%ecx
  jne    L159
L125:
  mov    %rbx,%rsi
  jmp    L152
L159:
  sub    $0x2,%rsi
  movb   $0x30,-0x1(%rbx)
  jmp    L152
L89:
  sub    $0x1,%rbx
  mov    %eax,%edx
  and    $0xf,%edx
  movzbl (%r8,%rdx,1),%edx
  mov    %dl,(%rbx)
  sar    $0x4,%eax
  jne    L89
  mov    %rbx,%rsi
L152:
  mov    %rsi,%rax
  pop    %rbx
  ret
```

assistant: ```c
char *__ultoa(u_long val, char *endp, int base, int octzero, const char *xdigs) {
  char *cp = endp;
  long sval;
  switch (base) {
  case 10:
    if (val < 10) {
      *--cp = ((val) + '0');
      return (cp);
    }
    if (val > LONG_MAX) {
      *--cp = ((val % 10) + '0');
      sval = val / 10;
    } else
      sval = val;
    do {
      *--cp = ((sval % 10) + '0');
      sval /= 10;
    } while (sval != 0);
    break;
  case 8:
    do {
      *--cp = ((val & 7) + '0');
      val >>= 3;
    } while (val);
    if (octzero && *cp != '0')
      *--cp = '0';
    break;
  case 16:
    do {
      *--cp = xdigs[val & 15];
      val >>= 4;
    } while (val);
    break;
  default:
    abort();
  }
  return (cp);
}
```
user: Translate the below assembly code into C programming language:

```asm
<__ultoa>:
  endbr64
  push   %rbx
  mov    %edi,%eax
  mov    %rsi,%rbx
  cmp    $0xa,%edx
  je     L51
  cmp    $0x10,%edx
  je     L112
  cmp    $0x8,%edx
  je     L114
  xor    %eax,%eax
  call   <abort@plt>
  mov    %rbx,%r8
L24:
  mov    %r8,%rax
  pop    %rbx
  ret
  nopl   0x0(%rax,%rax,1)
L112:
  mov    %eax,%edx
  sub    $0x1,%rbx
  and    $0xf,%edx
  sar    $0x4,%eax
  movzbl (%r8,%rdx,1),%edx
  mov    %dl,(%rbx)
  jne    L112
L10:
  mov    %rbx,%r8
  pop    %rbx
  mov    %r8,%rax
  ret
  nopl   (%rax)
L114:
  mov    %eax,%edx
  mov    %rbx,%r8
  sub    $0x1,%rbx
  and    $0x7,%edx
  add    $0x30,%edx
  sar    $0x3,%eax
  mov    %dl,(%rbx)
  jne    L114
  cmp    $0x30,%dl
  je     L10
  test   %ecx,%ecx
  je     L10
  movb   $0x30,-0x1(%rbx)
  sub    $0x2,%r8
  jmp    L24
  nopl   0x0(%rax)
L51:
  lea    -0x1(%rsi),%r8
  cmp    $0x9,%edi
  jle    L39
  mov    D5(%rip),%rdx
  cmp    %edi,(%rdx)
  jge    L59
  movslq %edi,%rdx
  mov    %edi,%ecx
  imul   $0x66666667,%rdx,%rdx
  sar    $0x1f,%ecx
  sar    $0x22,%rdx
  sub    %ecx,%edx
  lea    (%rdx,%rdx,4),%ecx
  add    %ecx,%ecx
  sub    %ecx,%eax
  movslq %edx,%rcx
  add    $0x30,%eax
  mov    %al,-0x1(%rsi)
L15:
  movabs $0xcccccccccccccccd,%rdi
  nopl   0x0(%rax,%rax,1)
L75:
  mov    %rcx,%rax
  sub    $0x1,%r8
  mul    %rdi
  mov    %rcx,%rax
  shr    $0x3,%rdx
  lea    (%rdx,%rdx,4),%rsi
  mov    %rdx,%rcx
  add    %rsi,%rsi
  sub    %rsi,%rax
  add    $0x30,%eax
  mov    %al,(%r8)
  test   %rdx,%rdx
  jne    L75
  mov    %r8,%rax
  pop    %rbx
  ret
  cs nopw 0x0(%rax,%rax,1)
L39:
  add    $0x30,%eax
  mov    %al,-0x1(%rsi)
  jmp    L24
  nopl   0x0(%rax,%rax,1)
L59:
  movslq %edi,%rcx
  mov    %rsi,%r8
  jmp    L15
```

assistant: ```c
char *__ultoa(u_long val, char *endp, int base, int octzero, const char *xdigs) {
  char *cp = endp;
  long sval;
  switch (base) {
  case 10:
    if (val < 10) {
      *--cp = ((val) + '0');
      return (cp);
    }
    if (val > LONG_MAX) {
      *--cp = ((val % 10) + '0');
      sval = val / 10;
    } else
      sval = val;
    do {
      *--cp = ((sval % 10) + '0');
      sval /= 10;
    } while (sval != 0);
    break;
  case 8:
    do {
      *--cp = ((val & 7) + '0');
      val >>= 3;
    } while (val);
    if (octzero && *cp != '0')
      *--cp = '0';
    break;
  case 16:
    do {
      *--cp = xdigs[val & 15];
      val >>= 4;
    } while (val);
    break;
  default:
    abort();
  }
  return (cp);
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<__ultoa>:
  endbr64
  push   %rbx
  mov    %edi,%eax
  mov    %rsi,%rbx
  cmp    $0xa,%edx
  je     L68
  cmp    $0x10,%edx
  je     L120
  cmp    $0x8,%edx
  je     L33
  xor    %eax,%eax
  call   <abort@plt>
  mov    %rbx,%r8
L99:
  mov    %r8,%rax
  pop    %rbx
  ret
  nopl   0x0(%rax,%rax,1)
L120:
  mov    %eax,%edx
  sub    $0x1,%rbx
  and    $0xf,%edx
  sar    $0x4,%eax
  movzbl (%r8,%rdx,1),%edx
  mov    %dl,(%rbx)
  jne    L120
L52:
  mov    %rbx,%r8
  pop    %rbx
  mov    %r8,%rax
  ret
  nopl   (%rax)
L33:
  mov    %eax,%edx
  mov    %rbx,%r8
  sub    $0x1,%rbx
  and    $0x7,%edx
  add    $0x30,%edx
  sar    $0x3,%eax
  mov    %dl,(%rbx)
  jne    L33
  cmp    $0x30,%dl
  je     L52
  test   %ecx,%ecx
  je     L52
  movb   $0x30,-0x1(%rbx)
  sub    $0x2,%r8
  jmp    L99
  nopl   0x0(%rax)
L68:
  lea    -0x1(%rsi),%r8
  cmp    $0x9,%edi
  jle    L14
  mov    D1(%rip),%rdx
  cmp    %edi,(%rdx)
  jge    L104
  movslq %edi,%rdx
  mov    %edi,%ecx
  imul   $0x66666667,%rdx,%rdx
  sar    $0x1f,%ecx
  sar    $0x22,%rdx
  sub    %ecx,%edx
  lea    (%rdx,%rdx,4),%ecx
  add    %ecx,%ecx
  sub    %ecx,%eax
  movslq %edx,%rcx
  add    $0x30,%eax
  mov    %al,-0x1(%rsi)
L54:
  movabs $0xcccccccccccccccd,%rdi
  nopl   0x0(%rax,%rax,1)
L107:
  mov    %rcx,%rax
  sub    $0x1,%r8
  mul    %rdi
  mov    %rcx,%rax
  shr    $0x3,%rdx
  lea    (%rdx,%rdx,4),%rsi
  mov    %rdx,%rcx
  add    %rsi,%rsi
  sub    %rsi,%rax
  add    $0x30,%eax
  mov    %al,(%r8)
  test   %rdx,%rdx
  jne    L107
  mov    %r8,%rax
  pop    %rbx
  ret
  cs nopw 0x0(%rax,%rax,1)
L14:
  add    $0x30,%eax
  mov    %al,-0x1(%rsi)
  jmp    L99
  nopl   0x0(%rax,%rax,1)
L104:
  movslq %edi,%rcx
  mov    %rsi,%r8
  jmp    L54
```

assistant: ```c
char *__ultoa(u_long val, char *endp, int base, int octzero, const char *xdigs) {
  char *cp = endp;
  long sval;
  switch (base) {
  case 10:
    if (val < 10) {
      *--cp = ((val) + '0');
      return (cp);
    }
    if (val > LONG_MAX) {
      *--cp = ((val % 10) + '0');
      sval = val / 10;
    } else
      sval = val;
    do {
      *--cp = ((sval % 10) + '0');
      sval /= 10;
    } while (sval != 0);
    break;
  case 8:
    do {
      *--cp = ((val & 7) + '0');
      val >>= 3;
    } while (val);
    if (octzero && *cp != '0')
      *--cp = '0';
    break;
  case 16:
    do {
      *--cp = xdigs[val & 15];
      val >>= 4;
    } while (val);
    break;
  default:
    abort();
  }
  return (cp);
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<StripCRLF>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  je     L48
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  jmp    L28
L48:
  mov    $0x0,%eax
L28:
  mov    %eax,-0x4(%rbp)
  cmpl   $0x0,-0x4(%rbp)
  jle    L46
  mov    -0x4(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x8(%rbp)
  jmp    L32
L76:
  mov    -0x8(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0xd,%al
  je     L8
  mov    -0x8(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0xa,%al
  jne    L42
L8:
  mov    -0x8(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  subl   $0x1,-0x8(%rbp)
L32:
  cmpl   $0x0,-0x8(%rbp)
  jns    L76
  jmp    L42
L46:
  nop
L42:
  leave
  ret
```

assistant: ```c
void StripCRLF(char *Line) {
  int len, count;
  len = (Line ? strlen(Line) : 0);
  if (len < 1)
    return;
  for (count = len - 1; (count > -1); count--) {
    if ((Line[count] == '\r') || (Line[count] == '\n'))
      Line[count] = 0;
    else
      break;
  }
}
```
user: Translate the below assembly code into C programming language:

```asm
<StripCRLF>:
  endbr64
  test   %rdi,%rdi
  je     L23
  push   %rbx
  mov    %rdi,%rbx
  call   <strlen@plt>
  test   %eax,%eax
  jle    L15
  lea    -0x1(%rax),%ecx
  movslq %ecx,%rdx
  add    %rbx,%rdx
  cltq
  lea    -0x2(%rbx,%rax,1),%rsi
  mov    %ecx,%ecx
  sub    %rcx,%rsi
  jmp    L4
L49:
  movb   $0x0,(%rcx)
  sub    $0x1,%rdx
  cmp    %rsi,%rdx
  je     L15
L4:
  mov    %rdx,%rcx
  movzbl (%rdx),%eax
  cmp    $0xd,%al
  je     L49
  cmp    $0xa,%al
  je     L49
L15:
  pop    %rbx
  ret
L23:
  ret
```

assistant: ```c
void StripCRLF(char *Line) {
  int len, count;
  len = (Line ? strlen(Line) : 0);
  if (len < 1)
    return;
  for (count = len - 1; (count > -1); count--) {
    if ((Line[count] == '\r') || (Line[count] == '\n'))
      Line[count] = 0;
    else
      break;
  }
}
```
user: What is the c source code of the assembly code below:

```asm
<StripCRLF>:
  endbr64
  test   %rdi,%rdi
  je     L7
  push   %rbx
  mov    %rdi,%rbx
  call   <strlen@plt>
  test   %eax,%eax
  jle    L16
  lea    -0x1(%rax),%esi
  cltq
  movslq %esi,%rdx
  lea    -0x2(%rbx,%rax,1),%rcx
  mov    %esi,%esi
  add    %rbx,%rdx
  sub    %rsi,%rcx
  nopl   0x0(%rax,%rax,1)
L27:
  movzbl (%rdx),%eax
  cmp    $0xd,%al
  je     L45
  cmp    $0xa,%al
  jne    L16
L45:
  movb   $0x0,(%rdx)
  sub    $0x1,%rdx
  cmp    %rcx,%rdx
  jne    L27
L16:
  pop    %rbx
  ret
  nopl   0x0(%rax)
L7:
  ret
```

assistant: ```c
void StripCRLF(char *Line) {
  int len, count;
  len = (Line ? strlen(Line) : 0);
  if (len < 1)
    return;
  for (count = len - 1; (count > -1); count--) {
    if ((Line[count] == '\r') || (Line[count] == '\n'))
      Line[count] = 0;
    else
      break;
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<StripCRLF>:
  endbr64
  test   %rdi,%rdi
  je     L17
  push   %rbx
  mov    %rdi,%rbx
  call   <strlen@plt>
  test   %eax,%eax
  jle    L48
  lea    -0x1(%rax),%esi
  cltq
  movslq %esi,%rdx
  lea    -0x2(%rbx,%rax,1),%rcx
  mov    %esi,%esi
  add    %rbx,%rdx
  sub    %rsi,%rcx
  nopl   0x0(%rax,%rax,1)
L46:
  movzbl (%rdx),%eax
  cmp    $0xd,%al
  je     L7
  cmp    $0xa,%al
  jne    L48
L7:
  movb   $0x0,(%rdx)
  sub    $0x1,%rdx
  cmp    %rcx,%rdx
  jne    L46
L48:
  pop    %rbx
  ret
  nopl   0x0(%rax)
L17:
  ret
```

assistant: ```c
void StripCRLF(char *Line) {
  int len, count;
  len = (Line ? strlen(Line) : 0);
  if (len < 1)
    return;
  for (count = len - 1; (count > -1); count--) {
    if ((Line[count] == '\r') || (Line[count] == '\n'))
      Line[count] = 0;
    else
      break;
  }
}
```