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

```asm
<bit_rot_left>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %edx,0x8(%rsp)
  test   %esi,%esi
  jle    L23
  test   %edx,%edx
  jle    L23
  lea    -0x1(%rsi),%eax
  mov    %rdi,%rbp
  xor    %r13d,%r13d
  mov    %eax,0xc(%rsp)
  sar    $0x3,%eax
  cltq
  lea    0x1(%rdi,%rax,1),%rbx
  nopl   (%rax)
L49:
  xor    %esi,%esi
  mov    %rbp,%rdi
  mov    %rbp,%r15
  call   <bit_get@plt>
  mov    %eax,%r12d
  jmp    L6
  nopw   0x0(%rax,%rax,1)
L14:
  xor    %esi,%esi
  mov    %r15,%rdi
  call   <bit_get@plt>
  mov    $0x7,%esi
  mov    %r14,%rdi
  mov    %eax,%edx
  call   <bit_set@plt>
L6:
  mov    %r15,%r14
  shlb   (%r15)
  add    $0x1,%r15
  cmp    %r15,%rbx
  jne    L14
  mov    0xc(%rsp),%esi
  mov    %r12d,%edx
  mov    %rbp,%rdi
  add    $0x1,%r13d
  call   <bit_set@plt>
  cmp    %r13d,0x8(%rsp)
  jne    L49
L23:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void bit_rot_left(unsigned char *bits, int size, int count) {
  int fbit = 0, lbit, i, j;
  if (size > 0) {
    for (j = 0; j < count; j++) {
      for (i = 0; i <= ((size - 1) / 8); i++) {
        lbit = bit_get(&bits[i], 0);
        if (i == 0) {
          fbit = lbit;
        } else {
          bit_set(&bits[i - 1], 7, lbit);
        }
        bits[i] = bits[i] << 1;
      }
      bit_set(bits, size - 1, fbit);
    }
  }
  return;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<bit_rot_left>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %edx,0x8(%rsp)
  test   %esi,%esi
  jle    L46
  test   %edx,%edx
  jle    L46
  lea    -0x1(%rsi),%r14d
  mov    %rdi,%rbp
  xor    %r13d,%r13d
  mov    %r14d,%eax
  sar    $0x3,%eax
  mov    %eax,0xc(%rsp)
  sub    $0x1,%eax
  lea    0x2(%rdi,%rax,1),%rbx
  xchg   %ax,%ax
L38:
  xor    %esi,%esi
  mov    %rbp,%rdi
  lea    0x1(%rbp),%r15
  call   <bit_get@plt>
  shlb   0x0(%rbp)
  mov    %eax,%r12d
  mov    0xc(%rsp),%eax
  test   %eax,%eax
  je     L32
  nopl   0x0(%rax)
L28:
  mov    %r15,%rdi
  xor    %esi,%esi
  call   <bit_get@plt>
  lea    -0x1(%r15),%rdi
  mov    $0x7,%esi
  mov    %eax,%edx
  call   <bit_set@plt>
  shlb   (%r15)
  add    $0x1,%r15
  cmp    %rbx,%r15
  jne    L28
L32:
  mov    %r12d,%edx
  mov    %r14d,%esi
  mov    %rbp,%rdi
  add    $0x1,%r13d
  call   <bit_set@plt>
  cmp    %r13d,0x8(%rsp)
  jne    L38
L46:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void bit_rot_left(unsigned char *bits, int size, int count) {
  int fbit = 0, lbit, i, j;
  if (size > 0) {
    for (j = 0; j < count; j++) {
      for (i = 0; i <= ((size - 1) / 8); i++) {
        lbit = bit_get(&bits[i], 0);
        if (i == 0) {
          fbit = lbit;
        } else {
          bit_set(&bits[i - 1], 7, lbit);
        }
        bits[i] = bits[i] << 1;
      }
      bit_set(bits, size - 1, fbit);
    }
  }
  return;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<stringLength>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  movq   $0x0,-0x8(%rbp)
  jmp    L17
L5:
  addq   $0x1,-0x8(%rbp)
L17:
  mov    -0x18(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jg     L5
  mov    -0x8(%rbp),%rax
  pop    %rbp
  ret
```

assistant: ```c
uint16_t stringLength(char *string) {
  uint8_t i = 0;
  while (string[i] > 0)
    i++;
  return i;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<stringLength>:
  endbr64
  cmpb   $0x0,(%rdi)
  jle    L4
  mov    $0x0,%eax
L19:
  add    $0x1,%rax
  cmpb   $0x0,(%rdi,%rax,1)
  jg     L19
  ret
L4:
  mov    $0x0,%eax
  ret
```

assistant: ```c
uint16_t stringLength(char *string) {
  uint8_t i = 0;
  while (string[i] > 0)
    i++;
  return i;
}
```
user: What is the c source code of the assembly code below?

```asm
<stringLength>:
  endbr64
  xor    %eax,%eax
  cmpb   $0x0,(%rdi)
  jle    L0
  nopl   0x0(%rax,%rax,1)
L19:
  add    $0x1,%rax
  cmpb   $0x0,(%rdi,%rax,1)
  jg     L19
  ret
  nopl   0x0(%rax,%rax,1)
L0:
  ret
```

assistant: ```c
uint16_t stringLength(char *string) {
  uint8_t i = 0;
  while (string[i] > 0)
    i++;
  return i;
}
```
user: Translate the below assembly code into C programming language:

```asm
<stringLength>:
  endbr64
  xor    %eax,%eax
  cmpb   $0x0,(%rdi)
  jle    L17
  nopl   0x0(%rax,%rax,1)
L9:
  add    $0x1,%rax
  cmpb   $0x0,(%rdi,%rax,1)
  jg     L9
  ret
  nopl   0x0(%rax,%rax,1)
L17:
  ret
```

assistant: ```c
uint16_t stringLength(char *string) {
  uint8_t i = 0;
  while (string[i] > 0)
    i++;
  return i;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<xorshift1024star>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    -0x30(%rbp),%rax
  mov    (%rax),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x30(%rbp),%rax
  mov    (%rax),%eax
  add    $0x1,%eax
  and    $0xf,%eax
  mov    %eax,%edx
  mov    -0x30(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0x30(%rbp),%rax
  mov    (%rax),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x14(%rbp),%eax
  shl    $0x1f,%eax
  xor    %eax,-0x14(%rbp)
  mov    -0x14(%rbp),%eax
  xor    -0x18(%rbp),%eax
  mov    %eax,%edx
  mov    -0x14(%rbp),%eax
  sar    $0xb,%eax
  mov    %edx,%ecx
  xor    %eax,%ecx
  mov    -0x18(%rbp),%eax
  sar    $0x1e,%eax
  mov    %eax,%edx
  mov    -0x30(%rbp),%rax
  mov    (%rax),%eax
  cltq
  lea    0x0(,%rax,4),%rsi
  mov    -0x28(%rbp),%rax
  add    %rsi,%rax
  xor    %ecx,%edx
  mov    %edx,(%rax)
  mov    -0x30(%rbp),%rax
  mov    (%rax),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%ebx
  mov    $0x5497fdb5,%edi
  call   <UINT64_C@plt>
  imul   %ebx,%eax
  sar    $0x10,%eax
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
uint32_t xorshift1024star(uint64_t *s, int *p) {
  const uint64_t s0 = s[*p];
  uint64_t s1 = s[ *p = (*p + 1) & 15];
  s1 ^= s1 << 31;
  s[*p] = s1 ^ s0 ^ (s1 >> 11) ^ (s0 >> 30);
  return (s[*p] * UINT64_C(1181783497276652981)) >> 16;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<xorshift1024star>:
  endbr64
  push   %rbx
  mov    %rdi,%rcx
  mov    (%rsi),%eax
  movslq %eax,%rdx
  mov    (%rdi,%rdx,4),%r8d
  add    $0x1,%eax
  and    $0xf,%eax
  mov    %eax,(%rsi)
  cltq
  lea    (%rdi,%rax,4),%rdi
  mov    (%rdi),%eax
  mov    %eax,%edx
  shl    $0x1f,%edx
  xor    %eax,%edx
  mov    %r8d,%eax
  sar    $0x1e,%eax
  xor    %r8d,%eax
  xor    %edx,%eax
  sar    $0xb,%edx
  xor    %edx,%eax
  mov    %eax,(%rdi)
  movslq (%rsi),%rax
  mov    (%rcx,%rax,4),%ebx
  mov    $0x5497fdb5,%edi
  call   <UINT64_C@plt>
  imul   %ebx,%eax
  sar    $0x10,%eax
  pop    %rbx
  ret
```

assistant: ```c
uint32_t xorshift1024star(uint64_t *s, int *p) {
  const uint64_t s0 = s[*p];
  uint64_t s1 = s[ *p = (*p + 1) & 15];
  s1 ^= s1 << 31;
  s[*p] = s1 ^ s0 ^ (s1 >> 11) ^ (s0 >> 30);
  return (s[*p] * UINT64_C(1181783497276652981)) >> 16;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<xorshift1024star>:
  endbr64
  movslq (%rsi),%rdx
  push   %rbx
  mov    %rdi,%rcx
  mov    %rdx,%rax
  mov    (%rdi,%rdx,4),%r8d
  add    $0x1,%eax
  and    $0xf,%eax
  mov    %eax,(%rsi)
  cltq
  lea    (%rdi,%rax,4),%rdi
  mov    (%rdi),%eax
  mov    %eax,%edx
  shl    $0x1f,%edx
  xor    %eax,%edx
  mov    %r8d,%eax
  sar    $0x1e,%eax
  xor    %r8d,%eax
  xor    %edx,%eax
  sar    $0xb,%edx
  xor    %edx,%eax
  mov    %eax,(%rdi)
  movslq (%rsi),%rax
  mov    $0x5497fdb5,%edi
  mov    (%rcx,%rax,4),%ebx
  call   <UINT64_C@plt>
  imul   %ebx,%eax
  pop    %rbx
  sar    $0x10,%eax
  ret
```

assistant: ```c
uint32_t xorshift1024star(uint64_t *s, int *p) {
  const uint64_t s0 = s[*p];
  uint64_t s1 = s[ *p = (*p + 1) & 15];
  s1 ^= s1 << 31;
  s[*p] = s1 ^ s0 ^ (s1 >> 11) ^ (s0 >> 30);
  return (s[*p] * UINT64_C(1181783497276652981)) >> 16;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<xorshift1024star>:
  endbr64
  movslq (%rsi),%rdx
  push   %rbx
  mov    %rdi,%rcx
  mov    %rdx,%rax
  mov    (%rdi,%rdx,4),%r8d
  add    $0x1,%eax
  and    $0xf,%eax
  mov    %eax,(%rsi)
  cltq
  lea    (%rdi,%rax,4),%rdi
  mov    (%rdi),%eax
  mov    %eax,%edx
  shl    $0x1f,%edx
  xor    %eax,%edx
  mov    %r8d,%eax
  sar    $0x1e,%eax
  xor    %r8d,%eax
  xor    %edx,%eax
  sar    $0xb,%edx
  xor    %edx,%eax
  mov    %eax,(%rdi)
  movslq (%rsi),%rax
  mov    $0x5497fdb5,%edi
  mov    (%rcx,%rax,4),%ebx
  call   <UINT64_C@plt>
  imul   %ebx,%eax
  pop    %rbx
  sar    $0x10,%eax
  ret
```

assistant: ```c
uint32_t xorshift1024star(uint64_t *s, int *p) {
  const uint64_t s0 = s[*p];
  uint64_t s1 = s[ *p = (*p + 1) & 15];
  s1 ^= s1 << 31;
  s[*p] = s1 ^ s0 ^ (s1 >> 11) ^ (s0 >> 30);
  return (s[*p] * UINT64_C(1181783497276652981)) >> 16;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<eFreeIndirect>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  je     L3
  mov    -0x8(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  je     L3
  mov    -0x8(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <eFree@plt>
  mov    -0x8(%rbp),%rax
  movq   $0x0,(%rax)
L3:
  nop
  leave
  ret
```

assistant: ```c
extern void eFreeIndirect(void **ptr) {
  if (ptr && *ptr) {
    eFree(*ptr);
    *ptr = NULL;
  }
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<eFreeIndirect>:
  endbr64
  test   %rdi,%rdi
  je     L3
  push   %rbx
  mov    %rdi,%rbx
  mov    (%rdi),%rdi
  test   %rdi,%rdi
  je     L6
  call   <eFree@plt>
  movq   $0x0,(%rbx)
L6:
  pop    %rbx
  ret
L3:
  ret
```

assistant: ```c
extern void eFreeIndirect(void **ptr) {
  if (ptr && *ptr) {
    eFree(*ptr);
    *ptr = NULL;
  }
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<eFreeIndirect>:
  endbr64
  test   %rdi,%rdi
  je     L15
  push   %rbx
  mov    %rdi,%rbx
  mov    (%rdi),%rdi
  test   %rdi,%rdi
  je     L6
  call   <eFree@plt>
  movq   $0x0,(%rbx)
L6:
  pop    %rbx
  ret
  nopl   0x0(%rax,%rax,1)
L15:
  ret
```

assistant: ```c
extern void eFreeIndirect(void **ptr) {
  if (ptr && *ptr) {
    eFree(*ptr);
    *ptr = NULL;
  }
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<eFreeIndirect>:
  endbr64
  test   %rdi,%rdi
  je     L15
  push   %rbx
  mov    %rdi,%rbx
  mov    (%rdi),%rdi
  test   %rdi,%rdi
  je     L0
  call   <eFree@plt>
  movq   $0x0,(%rbx)
L0:
  pop    %rbx
  ret
  nopl   0x0(%rax,%rax,1)
L15:
  ret
```

assistant: ```c
extern void eFreeIndirect(void **ptr) {
  if (ptr && *ptr) {
    eFree(*ptr);
    *ptr = NULL;
  }
}
```
user: Translate the below assembly code into C programming language:

```asm
<gdb_read_bin_data>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    %ecx,-0x30(%rbp)
  movl   $0x0,-0x1c(%rbp)
  movl   $0x0,-0x18(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  jmp    L28
L18:
  mov    -0x18(%rbp),%eax
  add    $0x1,%eax
  cmp    %eax,-0x30(%rbp)
  jle    L16
  mov    -0x8(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <util_bin_to_byte@plt>
  mov    %eax,-0x14(%rbp)
  mov    -0x14(%rbp),%eax
  cltq
  add    %rax,-0x10(%rbp)
  addq   $0x1,-0x8(%rbp)
  addl   $0x1,-0x18(%rbp)
  addl   $0x1,-0x1c(%rbp)
L28:
  mov    -0x1c(%rbp),%eax
  cmp    -0x2c(%rbp),%eax
  jl     L18
  jmp    L37
L16:
  nop
L37:
  mov    -0x18(%rbp),%eax
  leave
  ret
```

assistant: ```c
int gdb_read_bin_data(uint8_t *bindata, int count, uint8_t *outdata, int max) {
  int j = 0;
  int i = 0;
  int cnt;
  unsigned char *src = (unsigned char *)bindata;
  unsigned char *dst = (unsigned char *)outdata;
  while (j < count) {
    if (i + 2 > max)
      break;
    cnt = util_bin_to_byte(src, dst);
    src += cnt;
    dst++;
    i++;
    j++;
  }
  return i;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<gdb_read_bin_data>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  test   %esi,%esi
  jle    L36
  mov    %rdi,%rbp
  cmp    $0x1,%ecx
  jle    L49
  mov    %esi,%esi
  lea    (%rdx,%rsi,1),%r12
  lea    -0x1(%rcx),%r14d
  add    %rdx,%r14
  mov    %rdx,%rbx
  mov    $0x1,%r13d
  sub    %edx,%r13d
L6:
  lea    0x0(%r13,%rbx,1),%r15d
  mov    %rbx,%rsi
  mov    %rbp,%rdi
  call   <util_bin_to_byte@plt>
  cltq
  add    %rax,%rbp
  add    $0x1,%rbx
  cmp    %r12,%rbx
  je     L0
  cmp    %r14,%rbx
  jne    L6
L0:
  mov    %r15d,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L36:
  mov    $0x0,%r15d
  jmp    L0
L49:
  mov    $0x0,%r15d
  jmp    L0
```

assistant: ```c
int gdb_read_bin_data(uint8_t *bindata, int count, uint8_t *outdata, int max) {
  int j = 0;
  int i = 0;
  int cnt;
  unsigned char *src = (unsigned char *)bindata;
  unsigned char *dst = (unsigned char *)outdata;
  while (j < count) {
    if (i + 2 > max)
      break;
    cnt = util_bin_to_byte(src, dst);
    src += cnt;
    dst++;
    i++;
    j++;
  }
  return i;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<gdb_read_bin_data>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  test   %esi,%esi
  jle    L35
  cmp    $0x1,%ecx
  jle    L35
  movslq %esi,%rsi
  lea    -0x1(%rcx),%r13d
  mov    $0x1,%r12d
  mov    %rdi,%r15
  mov    %rdx,%rbx
  lea    (%rdx,%rsi,1),%rbp
  add    %rdx,%r13
  sub    %edx,%r12d
  jmp    L8
  nopw   0x0(%rax,%rax,1)
L14:
  cmp    %r13,%rbx
  je     L53
L8:
  mov    %rbx,%rsi
  mov    %r15,%rdi
  lea    (%r12,%rbx,1),%r14d
  add    $0x1,%rbx
  call   <util_bin_to_byte@plt>
  cltq
  add    %rax,%r15
  cmp    %rbp,%rbx
  jne    L14
L53:
  add    $0x8,%rsp
  mov    %r14d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L35:
  xor    %r14d,%r14d
  jmp    L53
```

assistant: ```c
int gdb_read_bin_data(uint8_t *bindata, int count, uint8_t *outdata, int max) {
  int j = 0;
  int i = 0;
  int cnt;
  unsigned char *src = (unsigned char *)bindata;
  unsigned char *dst = (unsigned char *)outdata;
  while (j < count) {
    if (i + 2 > max)
      break;
    cnt = util_bin_to_byte(src, dst);
    src += cnt;
    dst++;
    i++;
    j++;
  }
  return i;
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<gdb_read_bin_data>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  test   %esi,%esi
  jle    L46
  cmp    $0x1,%ecx
  jle    L46
  movslq %esi,%rsi
  lea    -0x1(%rcx),%r13d
  mov    $0x1,%r12d
  mov    %rdi,%r15
  mov    %rdx,%rbx
  lea    (%rdx,%rsi,1),%rbp
  add    %rdx,%r13
  sub    %edx,%r12d
  jmp    L11
  nopw   0x0(%rax,%rax,1)
L41:
  cmp    %r13,%rbx
  je     L53
L11:
  mov    %rbx,%rsi
  mov    %r15,%rdi
  lea    (%r12,%rbx,1),%r14d
  add    $0x1,%rbx
  call   <util_bin_to_byte@plt>
  cltq
  add    %rax,%r15
  cmp    %rbp,%rbx
  jne    L41
L53:
  add    $0x8,%rsp
  mov    %r14d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L46:
  xor    %r14d,%r14d
  jmp    L53
```

assistant: ```c
int gdb_read_bin_data(uint8_t *bindata, int count, uint8_t *outdata, int max) {
  int j = 0;
  int i = 0;
  int cnt;
  unsigned char *src = (unsigned char *)bindata;
  unsigned char *dst = (unsigned char *)outdata;
  while (j < count) {
    if (i + 2 > max)
      break;
    cnt = util_bin_to_byte(src, dst);
    src += cnt;
    dst++;
    i++;
    j++;
  }
  return i;
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<weapon_bit_name>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %edi,-0x4(%rbp)
  movb   $0x0,D87(%rip)
  mov    -0x4(%rbp),%eax
  and    $0x1,%eax
  test   %eax,%eax
  je     L9
  lea    D60(%rip),%rax
  mov    %rax,%rsi
  lea    D87(%rip),%rax
  mov    %rax,%rdi
  call   <strcat@plt>
L9:
  mov    -0x4(%rbp),%eax
  and    $0x2,%eax
  test   %eax,%eax
  je     L2
  lea    D15(%rip),%rax
  mov    %rax,%rsi
  lea    D87(%rip),%rax
  mov    %rax,%rdi
  call   <strcat@plt>
L2:
  mov    -0x4(%rbp),%eax
  and    $0x4,%eax
  test   %eax,%eax
  je     L51
  lea    D71(%rip),%rax
  mov    %rax,%rsi
  lea    D87(%rip),%rax
  mov    %rax,%rdi
  call   <strcat@plt>
L51:
  mov    -0x4(%rbp),%eax
  and    $0x8,%eax
  test   %eax,%eax
  je     L47
  lea    D89(%rip),%rax
  mov    %rax,%rsi
  lea    D87(%rip),%rax
  mov    %rax,%rdi
  call   <strcat@plt>
L47:
  mov    -0x4(%rbp),%eax
  and    $0x10,%eax
  test   %eax,%eax
  je     L46
  lea    D144(%rip),%rax
  mov    %rax,%rsi
  lea    D87(%rip),%rax
  mov    %rax,%rdi
  call   <strcat@plt>
L46:
  mov    -0x4(%rbp),%eax
  and    $0x20,%eax
  test   %eax,%eax
  je     L75
  lea    D28(%rip),%rax
  mov    %rax,%rsi
  lea    D87(%rip),%rax
  mov    %rax,%rdi
  call   <strcat@plt>
L75:
  mov    -0x4(%rbp),%eax
  and    $0x40,%eax
  test   %eax,%eax
  je     L63
  lea    D75(%rip),%rax
  mov    %rax,%rsi
  lea    D87(%rip),%rax
  mov    %rax,%rdi
  call   <strcat@plt>
L63:
  mov    -0x4(%rbp),%eax
  and    $0x80,%eax
  test   %eax,%eax
  je     L68
  lea    D99(%rip),%rax
  mov    %rax,%rsi
  lea    D87(%rip),%rax
  mov    %rax,%rdi
  call   <strcat@plt>
L68:
  movzbl D87(%rip),%eax
  test   %al,%al
  je     L13
  lea    D14(%rip),%rax
  jmp    L30
L13:
  lea    D40(%rip),%rax
L30:
  leave
  ret
```

tool_calls: name: parse_data
arguments: data_tag: D60
data_type: string
name: parse_data
arguments: data_tag: D15
data_type: string
name: parse_data
arguments: data_tag: D71
data_type: string
name: parse_data
arguments: data_tag: D89
data_type: string
name: parse_data
arguments: data_tag: D144
data_type: string
name: parse_data
arguments: data_tag: D28
data_type: string
name: parse_data
arguments: data_tag: D75
data_type: string
name: parse_data
arguments: data_tag: D99
data_type: string
name: parse_data
arguments: data_tag: D40
data_type: string

tool: D60:  flaming

tool: D15:  frost

tool: D71:  vampiric

tool: D89:  sharp

tool: D144:  vorpal

tool: D28:  two-handed

tool: D75:  shocking

tool: D99:  poison

tool: D40: none

assistant: ```c
char *weapon_bit_name(int weapon_flags) {
  static char buf[512];
  buf[0] = '\0';
  if (weapon_flags & (1))
    strcat(buf, " flaming");
  if (weapon_flags & (2))
    strcat(buf, " frost");
  if (weapon_flags & (4))
    strcat(buf, " vampiric");
  if (weapon_flags & (8))
    strcat(buf, " sharp");
  if (weapon_flags & (16))
    strcat(buf, " vorpal");
  if (weapon_flags & (32))
    strcat(buf, " two-handed");
  if (weapon_flags & (64))
    strcat(buf, " shocking");
  if (weapon_flags & (128))
    strcat(buf, " poison");
  return (buf[0] != '\0') ? buf + 1 : "none";
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<weapon_bit_name>:
  endbr64
  push   %rbx
  mov    %edi,%ebx
  movb   $0x0,D151(%rip)
  test   $0x1,%dil
  jne    L6
L77:
  test   $0x2,%bl
  jne    L36
L141:
  test   $0x4,%bl
  jne    L138
L16:
  test   $0x8,%bl
  jne    L96
L121:
  test   $0x10,%bl
  jne    L74
L15:
  test   $0x20,%bl
  jne    L14
L59:
  test   $0x40,%bl
  jne    L127
L100:
  test   $0x80,%bl
  jne    L2
L48:
  cmpb   $0x0,D151(%rip)
  lea    D156(%rip),%rax
  lea    D33(%rip),%rdx
  cmove  %rdx,%rax
  pop    %rbx
  ret
L6:
  lea    D57(%rip),%rsi
  lea    D151(%rip),%rdi
  call   <strcat@plt>
  jmp    L77
L36:
  lea    D56(%rip),%rsi
  lea    D151(%rip),%rdi
  call   <strcat@plt>
  jmp    L141
L138:
  lea    D81(%rip),%rsi
  lea    D151(%rip),%rdi
  call   <strcat@plt>
  jmp    L16
L96:
  lea    D134(%rip),%rsi
  lea    D151(%rip),%rdi
  call   <strcat@plt>
  jmp    L121
L74:
  lea    D179(%rip),%rsi
  lea    D151(%rip),%rdi
  call   <strcat@plt>
  jmp    L15
L14:
  lea    D62(%rip),%rsi
  lea    D151(%rip),%rdi
  call   <strcat@plt>
  jmp    L59
L127:
  lea    D141(%rip),%rsi
  lea    D151(%rip),%rdi
  call   <strcat@plt>
  jmp    L100
L2:
  lea    D148(%rip),%rsi
  lea    D151(%rip),%rdi
  call   <strcat@plt>
  jmp    L48
```

tool_calls: name: unpack_data
arguments: tag: D33
type_infered: string
name: unpack_data
arguments: tag: D57
type_infered: string
name: unpack_data
arguments: tag: D56
type_infered: string
name: unpack_data
arguments: tag: D81
type_infered: string
name: unpack_data
arguments: tag: D134
type_infered: string
name: unpack_data
arguments: tag: D179
type_infered: string
name: unpack_data
arguments: tag: D62
type_infered: string
name: unpack_data
arguments: tag: D141
type_infered: string
name: unpack_data
arguments: tag: D148
type_infered: string

tool: D33: none

tool: D57:  flaming

tool: D56:  frost

tool: D81:  vampiric

tool: D134:  sharp

tool: D179:  vorpal

tool: D62:  two-handed

tool: D141:  shocking

tool: D148:  poison

assistant: ```c
char *weapon_bit_name(int weapon_flags) {
  static char buf[512];
  buf[0] = '\0';
  if (weapon_flags & (1))
    strcat(buf, " flaming");
  if (weapon_flags & (2))
    strcat(buf, " frost");
  if (weapon_flags & (4))
    strcat(buf, " vampiric");
  if (weapon_flags & (8))
    strcat(buf, " sharp");
  if (weapon_flags & (16))
    strcat(buf, " vorpal");
  if (weapon_flags & (32))
    strcat(buf, " two-handed");
  if (weapon_flags & (64))
    strcat(buf, " shocking");
  if (weapon_flags & (128))
    strcat(buf, " poison");
  return (buf[0] != '\0') ? buf + 1 : "none";
}
```