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

```asm
<__libdw_get_sleb128>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %edi,%r13d
  mov    %rdx,%rbp
  cmp    $0x8,%esi
  ja     L28
  lea    0x0(,%rsi,8),%ebx
  sub    %esi,%ebx
  mov    %edi,%r12d
L34:
  mov    0x0(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,0x0(%rbp)
  movzbl (%rax),%edi
  mov    %edi,%eax
  and    $0x7f,%eax
  mov    %ebx,%ecx
  shl    %cl,%eax
  or     %eax,%r12d
  movsbl %dil,%edi
  not    %edi
  shr    $0x1f,%edi
  call   <likely@plt>
  test   %rax,%rax
  jne    L30
  add    $0x7,%ebx
  cmp    $0x3f,%ebx
  jne    L34
L28:
  mov    0x0(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,0x0(%rbp)
  movsbl (%rax),%edi
  not    %edi
  shr    $0x1f,%edi
  call   <likely@plt>
  mov    %rax,%rdx
  mov    %r13d,%eax
  test   %rdx,%rdx
  jne    L20
  mov    D2(%rip),%rax
  mov    (%rax),%eax
  jmp    L20
L30:
  mov    $0x39,%ecx
  sub    %ebx,%ecx
  shl    %cl,%r12d
  mov    %r12d,%eax
  shr    %cl,%eax
L20:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
int64_t __attribute__((unused)) __libdw_get_sleb128(int64_t acc, unsigned int i, const unsigned char **addrp) {
  unsigned char __b;
  int64_t _v = acc;
  do {
    for (; i < 9; ++i) {
      __b = *(*addrp)++;
      _v |= (uint64_t)(__b & 0x7f) << (i * 7);
      if (likely((__b & 0x80) == 0)) {
        acc = (_v << (64 - (i * 7) - 7)) >> (64 - (i * 7) - 7);
        return acc;
      } else
        do {
        } while (0);
    }
    __b = *(*addrp)++;
    if (likely((__b & 0x80) == 0))
      return acc | ((uint64_t)__b << 63);
    else
      return INT64_MAX;
  } while (0);
}
```
user: What is the c source code of the assembly code below?

```asm
<__libdw_get_sleb128>:
  endbr64
  push   %r13
  mov    %rdx,%r13
  push   %r12
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  sub    $0x8,%rsp
  cmp    $0x8,%esi
  ja     L42
  lea    0x0(,%rsi,8),%r12d
  mov    %edi,%ebx
  sub    %esi,%r12d
  jmp    L4
  nopw   0x0(%rax,%rax,1)
L19:
  add    $0x7,%r12d
  cmp    $0x3f,%r12d
  je     L42
L4:
  mov    0x0(%r13),%rax
  mov    %r12d,%ecx
  lea    0x1(%rax),%rdx
  mov    %rdx,0x0(%r13)
  movsbl (%rax),%edi
  mov    %edi,%eax
  not    %edi
  and    $0x7f,%eax
  shr    $0x1f,%edi
  shl    %cl,%eax
  or     %eax,%ebx
  call   <likely@plt>
  test   %rax,%rax
  je     L19
  mov    $0x39,%ecx
  sub    %r12d,%ecx
  shl    %cl,%ebx
  mov    %ebx,%eax
  shr    %cl,%eax
L17:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   (%rax)
L42:
  mov    0x0(%r13),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,0x0(%r13)
  movsbl (%rax),%edi
  not    %edi
  shr    $0x1f,%edi
  call   <likely@plt>
  mov    %rax,%r8
  mov    %ebp,%eax
  test   %r8,%r8
  jne    L17
  mov    D1(%rip),%rax
  mov    (%rax),%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
int64_t __attribute__((unused)) __libdw_get_sleb128(int64_t acc, unsigned int i, const unsigned char **addrp) {
  unsigned char __b;
  int64_t _v = acc;
  do {
    for (; i < 9; ++i) {
      __b = *(*addrp)++;
      _v |= (uint64_t)(__b & 0x7f) << (i * 7);
      if (likely((__b & 0x80) == 0)) {
        acc = (_v << (64 - (i * 7) - 7)) >> (64 - (i * 7) - 7);
        return acc;
      } else
        do {
        } while (0);
    }
    __b = *(*addrp)++;
    if (likely((__b & 0x80) == 0))
      return acc | ((uint64_t)__b << 63);
    else
      return INT64_MAX;
  } while (0);
}
```
user: Translate the below assembly code into C programming language:

```asm
<__libdw_get_sleb128>:
  endbr64
  push   %r13
  mov    %rdx,%r13
  push   %r12
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  sub    $0x8,%rsp
  cmp    $0x8,%esi
  ja     L19
  lea    0x0(,%rsi,8),%r12d
  mov    %edi,%ebx
  sub    %esi,%r12d
  jmp    L29
  nopw   0x0(%rax,%rax,1)
L9:
  add    $0x7,%r12d
  cmp    $0x3f,%r12d
  je     L19
L29:
  mov    0x0(%r13),%rax
  mov    %r12d,%ecx
  lea    0x1(%rax),%rdx
  mov    %rdx,0x0(%r13)
  movsbl (%rax),%edi
  mov    %edi,%eax
  not    %edi
  and    $0x7f,%eax
  shr    $0x1f,%edi
  shl    %cl,%eax
  or     %eax,%ebx
  call   <likely@plt>
  test   %rax,%rax
  je     L9
  mov    $0x39,%ecx
  sub    %r12d,%ecx
  shl    %cl,%ebx
  mov    %ebx,%eax
  shr    %cl,%eax
L37:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   (%rax)
L19:
  mov    0x0(%r13),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,0x0(%r13)
  movsbl (%rax),%edi
  not    %edi
  shr    $0x1f,%edi
  call   <likely@plt>
  mov    %rax,%r8
  mov    %ebp,%eax
  test   %r8,%r8
  jne    L37
  mov    D8(%rip),%rax
  mov    (%rax),%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
int64_t __attribute__((unused)) __libdw_get_sleb128(int64_t acc, unsigned int i, const unsigned char **addrp) {
  unsigned char __b;
  int64_t _v = acc;
  do {
    for (; i < 9; ++i) {
      __b = *(*addrp)++;
      _v |= (uint64_t)(__b & 0x7f) << (i * 7);
      if (likely((__b & 0x80) == 0)) {
        acc = (_v << (64 - (i * 7) - 7)) >> (64 - (i * 7) - 7);
        return acc;
      } else
        do {
        } while (0);
    }
    __b = *(*addrp)++;
    if (likely((__b & 0x80) == 0))
      return acc | ((uint64_t)__b << 63);
    else
      return INT64_MAX;
  } while (0);
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<get_state_space_name>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    -0x18(%rbp),%rax
  mov    $0x2f,%esi
  mov    %rax,%rdi
  call   <strrchr@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L13
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x8(%rbp)
L13:
  addq   $0x1,-0x8(%rbp)
  jmp    L40
L29:
  mov    -0x8(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x20(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x20(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
L40:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L56
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isalpha@plt>
  test   %rax,%rax
  jne    L29
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L29
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x5f,%al
  je     L29
L56:
  mov    -0x20(%rbp),%rax
  movb   $0x0,(%rax)
  nop
  leave
  ret
```

assistant: ```c
void get_state_space_name(const char *in, char *out) {
  const char *str = strrchr(in, '/');
  if (*str == 0)
    str = in;
  str++;
  while (*str && (isalpha(*str) || isdigit(*str) || *str == '_')) {
    *out++ = *str++;
  }
  *out = 0;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<get_state_space_name>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbx
  mov    %rsi,%rbp
  mov    $0x2f,%esi
  call   <strrchr@plt>
  cmpb   $0x0,(%rax)
  cmove  %rbx,%rax
  lea    0x1(%rax),%rbx
  movzbl 0x1(%rax),%edi
  test   %dil,%dil
  jne    L45
  jmp    L18
L11:
  add    $0x1,%rbx
  add    $0x1,%rbp
  movzbl -0x1(%rbx),%eax
  mov    %al,-0x1(%rbp)
  movzbl (%rbx),%edi
  test   %dil,%dil
  je     L18
L45:
  movsbl %dil,%edi
  call   <isalpha@plt>
  test   %rax,%rax
  jne    L11
  movsbl (%rbx),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L11
  cmpb   $0x5f,(%rbx)
  je     L11
L18:
  movb   $0x0,0x0(%rbp)
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
void get_state_space_name(const char *in, char *out) {
  const char *str = strrchr(in, '/');
  if (*str == 0)
    str = in;
  str++;
  while (*str && (isalpha(*str) || isdigit(*str) || *str == '_')) {
    *out++ = *str++;
  }
  *out = 0;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<get_state_space_name>:
  endbr64
  push   %rbp
  mov    %rsi,%rbp
  mov    $0x2f,%esi
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x8,%rsp
  call   <strrchr@plt>
  cmpb   $0x0,(%rax)
  cmove  %rbx,%rax
  movsbl 0x1(%rax),%edi
  lea    0x1(%rax),%rbx
  test   %dil,%dil
  jne    L39
  jmp    L5
L49:
  movzbl (%rbx),%eax
L30:
  add    $0x1,%rbx
  mov    %al,0x0(%rbp)
  add    $0x1,%rbp
  movsbl (%rbx),%edi
  test   %dil,%dil
  je     L5
L39:
  call   <isalpha@plt>
  test   %rax,%rax
  jne    L49
  movsbl (%rbx),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L49
  movzbl (%rbx),%eax
  cmp    $0x5f,%al
  je     L30
L5:
  movb   $0x0,0x0(%rbp)
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
void get_state_space_name(const char *in, char *out) {
  const char *str = strrchr(in, '/');
  if (*str == 0)
    str = in;
  str++;
  while (*str && (isalpha(*str) || isdigit(*str) || *str == '_')) {
    *out++ = *str++;
  }
  *out = 0;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<get_state_space_name>:
  endbr64
  push   %rbp
  mov    %rsi,%rbp
  mov    $0x2f,%esi
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x8,%rsp
  call   <strrchr@plt>
  cmpb   $0x0,(%rax)
  cmove  %rbx,%rax
  movsbl 0x1(%rax),%edi
  lea    0x1(%rax),%rbx
  test   %dil,%dil
  jne    L26
  jmp    L40
L41:
  movzbl (%rbx),%eax
L39:
  add    $0x1,%rbx
  mov    %al,0x0(%rbp)
  add    $0x1,%rbp
  movsbl (%rbx),%edi
  test   %dil,%dil
  je     L40
L26:
  call   <isalpha@plt>
  test   %rax,%rax
  jne    L41
  movsbl (%rbx),%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L41
  movzbl (%rbx),%eax
  cmp    $0x5f,%al
  je     L39
L40:
  movb   $0x0,0x0(%rbp)
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
void get_state_space_name(const char *in, char *out) {
  const char *str = strrchr(in, '/');
  if (*str == 0)
    str = in;
  str++;
  while (*str && (isalpha(*str) || isdigit(*str) || *str == '_')) {
    *out++ = *str++;
  }
  *out = 0;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<charikar_hash64>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x150,%rsp
  mov    %rdi,-0x148(%rbp)
  mov    %rsi,-0x150(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x148(%rbp),%rdx
  mov    -0x150(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x118(%rbp)
  lea    -0x110(%rbp),%rax
  mov    $0x100,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  movl   $0x0,-0x138(%rbp)
  jmp    L24
L28:
  mov    -0x120(%rbp),%rax
  cmp    $0x3,%rax
  jbe    L24
  mov    -0x120(%rbp),%rdx
  mov    -0x128(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <get_hashed_token@plt>
  mov    %eax,-0x12c(%rbp)
  mov    -0x12c(%rbp),%edx
  lea    -0x110(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <update_hist@plt>
  addl   $0x1,-0x138(%rbp)
L24:
  lea    -0x120(%rbp),%rcx
  lea    -0x128(%rbp),%rdx
  mov    -0x118(%rbp),%rsi
  lea    -0x148(%rbp),%rax
  mov    %rax,%rdi
  call   <get_next_token@plt>
  test   %rax,%rax
  jne    L28
  mov    -0x138(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,-0x138(%rbp)
  movl   $0x0,-0x134(%rbp)
  movl   $0x0,-0x130(%rbp)
  jmp    L47
L17:
  mov    -0x130(%rbp),%eax
  cltq
  mov    -0x110(%rbp,%rax,4),%eax
  sub    -0x138(%rbp),%eax
  not    %eax
  shr    $0x1f,%eax
  movzbl %al,%edx
  mov    -0x130(%rbp),%eax
  mov    %eax,%ecx
  shl    %cl,%edx
  mov    %edx,%eax
  or     %eax,-0x134(%rbp)
  addl   $0x1,-0x130(%rbp)
L47:
  cmpl   $0x3f,-0x130(%rbp)
  jle    L17
  mov    -0x134(%rbp),%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L1
  call   <__stack_chk_fail@plt>
L1:
  leave
  ret
```

assistant: ```c
uint64_t charikar_hash64(const char *data, long data_length) {
  const char *data_end = data + data_length;
  int hist[64];
  memset(hist, 0, sizeof(hist));
  const char *token_start;
  size_t token_length;
  int tokens = 0;
  while ((get_next_token(&data, data_end, &token_start, &token_length))) {
    if (token_length > 3) {
      uint64_t token = get_hashed_token(token_start, token_length);
      ;
      update_hist(hist, token);
      tokens++;
    }
  }
  tokens /= 2;
  uint64_t simhash = 0;
  for (int c = 0; c < 64; c++)
    simhash |= (uint64_t)((hist[c] - tokens) >= 0) << c;
  return simhash;
}
```
user: What is the c source code of the assembly code below?

```asm
<charikar_hash64>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x130,%rsp
  mov    %rdi,0x8(%rsp)
  mov    %fs:0x28,%rdx
  mov    %rdx,0x128(%rsp)
  xor    %edx,%edx
  lea    (%rsi,%rdi,1),%rbx
  lea    0x20(%rsp),%rdi
  mov    $0x100,%edx
  mov    $0x0,%esi
  call   <memset@plt>
  mov    $0x0,%ebp
  lea    0x18(%rsp),%r12
L28:
  lea    0x10(%rsp),%rdx
  lea    0x8(%rsp),%rdi
  mov    %r12,%rcx
  mov    %rbx,%rsi
  call   <get_next_token@plt>
  test   %rax,%rax
  je     L39
  mov    0x18(%rsp),%rsi
  cmp    $0x3,%rsi
  jbe    L28
  mov    0x10(%rsp),%rdi
  call   <get_hashed_token@plt>
  mov    %eax,%esi
  lea    0x20(%rsp),%rdi
  call   <update_hist@plt>
  add    $0x1,%ebp
  jmp    L28
L39:
  mov    %ebp,%esi
  shr    $0x1f,%esi
  add    %ebp,%esi
  sar    %esi
  mov    $0x0,%ecx
  mov    $0x0,%edx
  lea    0x20(%rsp),%rdi
L29:
  cmp    %esi,(%rdi,%rcx,4)
  setge  %al
  movzbl %al,%eax
  shl    %cl,%eax
  or     %eax,%edx
  add    $0x1,%rcx
  cmp    $0x40,%rcx
  jne    L29
  mov    0x128(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L27
  mov    %edx,%eax
  add    $0x130,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L27:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
uint64_t charikar_hash64(const char *data, long data_length) {
  const char *data_end = data + data_length;
  int hist[64];
  memset(hist, 0, sizeof(hist));
  const char *token_start;
  size_t token_length;
  int tokens = 0;
  while ((get_next_token(&data, data_end, &token_start, &token_length))) {
    if (token_length > 3) {
      uint64_t token = get_hashed_token(token_start, token_length);
      ;
      update_hist(hist, token);
      tokens++;
    }
  }
  tokens /= 2;
  uint64_t simhash = 0;
  for (int c = 0; c < 64; c++)
    simhash |= (uint64_t)((hist[c] - tokens) >= 0) << c;
  return simhash;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<charikar_hash64>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  lea    (%rsi,%rdi,1),%r12
  xor    %esi,%esi
  push   %rbp
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x138,%rsp
  mov    %rdi,0x8(%rsp)
  lea    0x20(%rsp),%rbp
  lea    0x18(%rsp),%r15
  mov    %rbp,%rdi
  lea    0x10(%rsp),%r14
  lea    0x8(%rsp),%r13
  mov    %fs:0x28,%rdx
  mov    %rdx,0x128(%rsp)
  xor    %edx,%edx
  mov    $0x100,%edx
  call   <memset@plt>
  jmp    L23
  nopl   0x0(%rax,%rax,1)
L11:
  mov    0x18(%rsp),%rsi
  cmp    $0x3,%rsi
  ja     L27
L23:
  mov    %r15,%rcx
  mov    %r14,%rdx
  mov    %r12,%rsi
  mov    %r13,%rdi
  call   <get_next_token@plt>
  test   %rax,%rax
  jne    L11
  sar    %ebx
  xor    %ecx,%ecx
  xor    %r8d,%r8d
  mov    %ebx,%edx
  nopw   0x0(%rax,%rax,1)
L3:
  xor    %eax,%eax
  cmp    %edx,0x0(%rbp,%rcx,4)
  setge  %al
  shl    %cl,%eax
  add    $0x1,%rcx
  or     %eax,%r8d
  cmp    $0x40,%rcx
  jne    L3
  mov    0x128(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L1
  add    $0x138,%rsp
  mov    %r8d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L27:
  mov    0x10(%rsp),%rdi
  add    $0x1,%ebx
  call   <get_hashed_token@plt>
  mov    %rbp,%rdi
  mov    %eax,%esi
  call   <update_hist@plt>
  jmp    L23
L1:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
uint64_t charikar_hash64(const char *data, long data_length) {
  const char *data_end = data + data_length;
  int hist[64];
  memset(hist, 0, sizeof(hist));
  const char *token_start;
  size_t token_length;
  int tokens = 0;
  while ((get_next_token(&data, data_end, &token_start, &token_length))) {
    if (token_length > 3) {
      uint64_t token = get_hashed_token(token_start, token_length);
      ;
      update_hist(hist, token);
      tokens++;
    }
  }
  tokens /= 2;
  uint64_t simhash = 0;
  for (int c = 0; c < 64; c++)
    simhash |= (uint64_t)((hist[c] - tokens) >= 0) << c;
  return simhash;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<charikar_hash64>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  lea    (%rsi,%rdi,1),%r12
  xor    %esi,%esi
  push   %rbp
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x138,%rsp
  mov    %rdi,0x8(%rsp)
  lea    0x20(%rsp),%rbp
  lea    0x18(%rsp),%r15
  mov    %rbp,%rdi
  lea    0x10(%rsp),%r14
  lea    0x8(%rsp),%r13
  mov    %fs:0x28,%rdx
  mov    %rdx,0x128(%rsp)
  xor    %edx,%edx
  mov    $0x100,%edx
  call   <memset@plt>
  jmp    L46
  nopl   0x0(%rax,%rax,1)
L45:
  mov    0x18(%rsp),%rsi
  cmp    $0x3,%rsi
  ja     L20
L46:
  mov    %r15,%rcx
  mov    %r14,%rdx
  mov    %r12,%rsi
  mov    %r13,%rdi
  call   <get_next_token@plt>
  test   %rax,%rax
  jne    L45
  sar    %ebx
  xor    %ecx,%ecx
  xor    %r8d,%r8d
  mov    %ebx,%edx
  nopw   0x0(%rax,%rax,1)
L4:
  xor    %eax,%eax
  cmp    %edx,0x0(%rbp,%rcx,4)
  setge  %al
  shl    %cl,%eax
  add    $0x1,%rcx
  or     %eax,%r8d
  cmp    $0x40,%rcx
  jne    L4
  mov    0x128(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L55
  add    $0x138,%rsp
  mov    %r8d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L20:
  mov    0x10(%rsp),%rdi
  add    $0x1,%ebx
  call   <get_hashed_token@plt>
  mov    %rbp,%rdi
  mov    %eax,%esi
  call   <update_hist@plt>
  jmp    L46
L55:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
uint64_t charikar_hash64(const char *data, long data_length) {
  const char *data_end = data + data_length;
  int hist[64];
  memset(hist, 0, sizeof(hist));
  const char *token_start;
  size_t token_length;
  int tokens = 0;
  while ((get_next_token(&data, data_end, &token_start, &token_length))) {
    if (token_length > 3) {
      uint64_t token = get_hashed_token(token_start, token_length);
      ;
      update_hist(hist, token);
      tokens++;
    }
  }
  tokens /= 2;
  uint64_t simhash = 0;
  for (int c = 0; c < 64; c++)
    simhash |= (uint64_t)((hist[c] - tokens) >= 0) << c;
  return simhash;
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<isqrti>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x14(%rbp)
  movl   $0x0,-0x8(%rbp)
  movl   $0x40000000,-0x4(%rbp)
  jmp    L7
L8:
  sarl   $0x2,-0x4(%rbp)
L7:
  mov    -0x4(%rbp),%eax
  cmp    -0x14(%rbp),%eax
  jg     L8
  jmp    L9
L26:
  mov    -0x8(%rbp),%edx
  mov    -0x4(%rbp),%eax
  add    %edx,%eax
  cmp    %eax,-0x14(%rbp)
  jl     L20
  mov    -0x8(%rbp),%edx
  mov    -0x4(%rbp),%eax
  add    %edx,%eax
  sub    %eax,-0x14(%rbp)
  mov    -0x8(%rbp),%eax
  sar    %eax
  mov    %eax,%edx
  mov    -0x4(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x8(%rbp)
  jmp    L11
L20:
  sarl   -0x8(%rbp)
L11:
  sarl   $0x2,-0x4(%rbp)
L9:
  cmpl   $0x0,-0x4(%rbp)
  jne    L26
  mov    -0x8(%rbp),%eax
  pop    %rbp
  ret
```

assistant: ```c
int isqrti(int num) {
  int res = 0;
  int bit = 1 << 30;
  while (bit > num)
    bit >>= 2;
  while (bit != 0) {
    if (num >= res + bit) {
      num -= res + bit;
      res = (res >> 1) + bit;
    } else
      res >>= 1;
    bit >>= 2;
  }
  return res;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<isqrti>:
  endbr64
  cmp    $0x3fffffff,%edi
  jg     L72
  mov    $0x40000000,%edx
L64:
  sar    $0x2,%edx
  cmp    %edx,%edi
  jl     L64
  test   %edx,%edx
  je     L2
L47:
  mov    $0x0,%eax
  jmp    L59
L72:
  mov    $0x40000000,%edx
  jmp    L47
L79:
  sar    %eax
L6:
  sar    $0x2,%edx
  je     L58
L59:
  lea    (%rax,%rdx,1),%ecx
  cmp    %edi,%ecx
  jg     L79
  sub    %ecx,%edi
  sar    %eax
  add    %edx,%eax
  jmp    L6
L58:
  ret
L2:
  mov    %edx,%eax
  ret
```

assistant: ```c
int isqrti(int num) {
  int res = 0;
  int bit = 1 << 30;
  while (bit > num)
    bit >>= 2;
  while (bit != 0) {
    if (num >= res + bit) {
      num -= res + bit;
      res = (res >> 1) + bit;
    } else
      res >>= 1;
    bit >>= 2;
  }
  return res;
}
```
user: What is the c source code of the assembly code below:

```asm
<isqrti>:
  endbr64
  mov    $0x40000000,%eax
  cmp    $0x3fffffff,%edi
  jg     L30
  nopl   0x0(%rax)
L21:
  sar    $0x2,%eax
  cmp    %eax,%edi
  jl     L21
  test   %eax,%eax
  je     L43
L30:
  xor    %r8d,%r8d
  cs nopw 0x0(%rax,%rax,1)
L36:
  lea    (%r8,%rax,1),%edx
  sar    %r8d
  cmp    %edi,%edx
  jg     L33
  sub    %edx,%edi
  add    %eax,%r8d
L33:
  sar    $0x2,%eax
  jne    L36
  mov    %r8d,%eax
  ret
  nopl   0x0(%rax)
L43:
  xor    %r8d,%r8d
  mov    %r8d,%eax
  ret
```

assistant: ```c
int isqrti(int num) {
  int res = 0;
  int bit = 1 << 30;
  while (bit > num)
    bit >>= 2;
  while (bit != 0) {
    if (num >= res + bit) {
      num -= res + bit;
      res = (res >> 1) + bit;
    } else
      res >>= 1;
    bit >>= 2;
  }
  return res;
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<isqrti>:
  endbr64
  mov    $0x40000000,%eax
  cmp    $0x3fffffff,%edi
  jg     L17
  nopl   0x0(%rax)
L24:
  sar    $0x2,%eax
  cmp    %eax,%edi
  jl     L24
  test   %eax,%eax
  je     L9
L17:
  xor    %r8d,%r8d
  cs nopw 0x0(%rax,%rax,1)
L47:
  lea    (%r8,%rax,1),%edx
  sar    %r8d
  cmp    %edi,%edx
  jg     L10
  sub    %edx,%edi
  add    %eax,%r8d
L10:
  sar    $0x2,%eax
  jne    L47
  mov    %r8d,%eax
  ret
  nopl   0x0(%rax)
L9:
  xor    %r8d,%r8d
  mov    %r8d,%eax
  ret
```

assistant: ```c
int isqrti(int num) {
  int res = 0;
  int bit = 1 << 30;
  while (bit > num)
    bit >>= 2;
  while (bit != 0) {
    if (num >= res + bit) {
      num -= res + bit;
      res = (res >> 1) + bit;
    } else
      res >>= 1;
    bit >>= 2;
  }
  return res;
}
```
user: What is the c source code of the assembly code below:

```asm
<getdec>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x70,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x60(%rbp),%rax
  mov    $0x50,%esi
  mov    %rax,%rdi
  call   <safe_gets@plt>
  movl   $0x0,-0x64(%rbp)
  lea    -0x64(%rbp),%rsi
  lea    -0x60(%rbp),%rax
  mov    $0x1,%r8d
  mov    $0x50,%ecx
  mov    $0xa,%edx
  mov    %rax,%rdi
  call   <_scanf_getl@plt>
  mov    -0x64(%rbp),%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L4
  call   <__stack_chk_fail@plt>
L4:
  leave
  ret
```

assistant: ```c
int getdec() {
  char buf[80];
  safe_gets(buf, 80);
  int i = 0;
  _scanf_getl(buf, &i, 10, 80, 1);
  return i;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<getdec>:
  endbr64
  push   %rbx
  sub    $0x70,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x68(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%rbx
  mov    $0x50,%esi
  mov    %rbx,%rdi
  call   <safe_gets@plt>
  movl   $0x0,0xc(%rsp)
  lea    0xc(%rsp),%rsi
  mov    $0x1,%r8d
  mov    $0x50,%ecx
  mov    $0xa,%edx
  mov    %rbx,%rdi
  call   <_scanf_getl@plt>
  mov    0xc(%rsp),%eax
  mov    0x68(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L7
  add    $0x70,%rsp
  pop    %rbx
  ret
L7:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int getdec() {
  char buf[80];
  safe_gets(buf, 80);
  int i = 0;
  _scanf_getl(buf, &i, 10, 80, 1);
  return i;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<getdec>:
  endbr64
  push   %rbp
  mov    $0x50,%esi
  sub    $0x70,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x68(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%rbp
  mov    %rbp,%rdi
  call   <safe_gets@plt>
  lea    0xc(%rsp),%rsi
  mov    $0x1,%r8d
  mov    %rbp,%rdi
  mov    $0x50,%ecx
  mov    $0xa,%edx
  movl   $0x0,0xc(%rsp)
  call   <_scanf_getl@plt>
  mov    0xc(%rsp),%eax
  mov    0x68(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L8
  add    $0x70,%rsp
  pop    %rbp
  ret
L8:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int getdec() {
  char buf[80];
  safe_gets(buf, 80);
  int i = 0;
  _scanf_getl(buf, &i, 10, 80, 1);
  return i;
}
```