ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请从给定的汇编指令推导出C源代码:

```asm
<check_prime>:
  endbr64
  lea    -0x1(%rdi),%eax
  cmp    $0x1,%eax
  jbe    L44
L61:
  mov    $0x2,%esi
  mov    $0x2,%ecx
  cmp    $0x2,%edi
  jle    L40
L48:
  mov    %edi,%eax
  cltd
  idiv   %ecx
  cmp    $0x1,%edx
  sbb    $0xffffffff,%esi
  add    $0x1,%ecx
  cmp    %ecx,%edi
  jne    L48
L40:
  cmp    %esi,%edi
  jne    L6
  test   %edi,%edi
  je     L61
L59:
  mov    %edi,%eax
  ret
L6:
  add    $0x1,%edi
  jmp    L61
L44:
  mov    $0x2,%edi
  jmp    L59
```

assistant: ```c
int check_prime(int num) {
  int i, p = 0;
  if (num == 1 || num == 2) {
    return 2;
  } else {
    while (p == 0) {
      int c = 2;
      for (i = 2; i <= num - 1; i++) {
        if ((num % i) != 0) {
          c++;
        }
      }
      if (c == num) {
        p = num;
      } else {
        num++;
      }
    }
    return p;
  }
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<check_prime>:
  endbr64
  lea    -0x1(%rdi),%eax
  mov    %edi,%r8d
  cmp    $0x1,%eax
  jbe    L37
L22:
  mov    $0x2,%esi
  mov    $0x2,%ecx
  jmp    L32
  nopl   0x0(%rax,%rax,1)
L48:
  mov    %r8d,%eax
  cltd
  idiv   %ecx
  cmp    $0x1,%edx
  sbb    $0xffffffff,%esi
  add    $0x1,%ecx
L32:
  cmp    %r8d,%ecx
  jl     L48
  cmp    %r8d,%esi
  jne    L23
  mov    %r8d,%eax
  ret
L23:
  add    $0x1,%r8d
  jmp    L22
L37:
  mov    $0x2,%r8d
  mov    %r8d,%eax
  ret
```

assistant: ```c
int check_prime(int num) {
  int i, p = 0;
  if (num == 1 || num == 2) {
    return 2;
  } else {
    while (p == 0) {
      int c = 2;
      for (i = 2; i <= num - 1; i++) {
        if ((num % i) != 0) {
          c++;
        }
      }
      if (c == num) {
        p = num;
      } else {
        num++;
      }
    }
    return p;
  }
}
```
user: Translate the below assembly code into C programming language:

```asm
<check_prime>:
  endbr64
  lea    -0x1(%rdi),%eax
  mov    %edi,%r8d
  cmp    $0x1,%eax
  jbe    L4
L21:
  mov    $0x2,%esi
  mov    $0x2,%ecx
  cmp    $0x2,%r8d
  jle    L10
  nop
L2:
  mov    %r8d,%eax
  cltd
  idiv   %ecx
  cmp    $0x1,%edx
  sbb    $0xffffffff,%esi
  add    $0x1,%ecx
  cmp    %ecx,%r8d
  jne    L2
L10:
  cmp    %esi,%r8d
  jne    L0
  mov    %r8d,%eax
  ret
L0:
  add    $0x1,%r8d
  jmp    L21
L4:
  mov    $0x2,%r8d
  mov    %r8d,%eax
  ret
```

assistant: ```c
int check_prime(int num) {
  int i, p = 0;
  if (num == 1 || num == 2) {
    return 2;
  } else {
    while (p == 0) {
      int c = 2;
      for (i = 2; i <= num - 1; i++) {
        if ((num % i) != 0) {
          c++;
        }
      }
      if (c == num) {
        p = num;
      } else {
        num++;
      }
    }
    return p;
  }
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<FwdLockGlue_CreateDirectories>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  movl   $0x1,-0x1c(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L85
  movl   $0x0,-0x1c(%rbp)
  jmp    L63
L85:
  movq   $0x0,-0x18(%rbp)
  jmp    L71
L20:
  mov    -0x28(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jne    L40
  cmpq   $0x0,-0x18(%rbp)
  je     L40
  mov    -0x8(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x2c(%rbp),%edx
  mov    -0x8(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <mkdir@plt>
  test   %rax,%rax
  je     L40
  mov    D11(%rip),%rax
  mov    (%rax),%rdx
  mov    D12(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  je     L40
  movl   $0x0,-0x1c(%rbp)
  jmp    L44
L40:
  mov    -0x28(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    -0x8(%rbp),%rcx
  mov    -0x18(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  addq   $0x1,-0x18(%rbp)
L71:
  mov    -0x18(%rbp),%rax
  cmp    -0x10(%rbp),%rax
  jb     L20
L44:
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
L63:
  mov    -0x1c(%rbp),%eax
  leave
  ret
```

assistant: ```c
int FwdLockGlue_CreateDirectories(const char *path, mode_t mode) {
  int result = 1;
  size_t partialPathLength = strlen(path);
  char *partialPath = malloc(partialPathLength + 1);
  if (partialPath == NULL) {
    result = 0;
  } else {
    size_t i;
    for (i = 0; i < partialPathLength; ++i) {
      if (path[i] == '/' && i > 0) {
        partialPath[i] = '\0';
        if (mkdir(partialPath, mode) != 0 && errno != EEXIST) {
          result = 0;
          break;
        }
      }
      partialPath[i] = path[i];
    }
    free(partialPath);
  }
  return result;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<FwdLockGlue_CreateDirectories>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbp
  mov    %esi,%r14d
  call   <strlen@plt>
  mov    %rax,%r13
  lea    0x1(%rax),%rdi
  call   <malloc@plt>
  test   %rax,%rax
  je     L57
  mov    %rax,%r12
  mov    $0x0,%ebx
  test   %r13,%r13
  je     L44
L68:
  movzbl 0x0(%rbp,%rbx,1),%eax
  mov    %al,(%r12,%rbx,1)
  add    $0x1,%rbx
  cmp    %rbx,%r13
  je     L28
  cmpb   $0x2f,0x0(%rbp,%rbx,1)
  jne    L68
  test   %rbx,%rbx
  je     L68
  movb   $0x0,(%r12,%rbx,1)
  mov    %r14d,%esi
  mov    %r12,%rdi
  call   <mkdir@plt>
  test   %rax,%rax
  je     L68
  mov    D4(%rip),%rdx
  mov    D14(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,(%rdx)
  je     L68
  mov    $0x0,%ebx
  jmp    L31
L44:
  mov    $0x1,%ebx
  jmp    L31
L28:
  mov    $0x1,%ebx
L31:
  mov    %r12,%rdi
  call   <free@plt>
L17:
  mov    %ebx,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L57:
  mov    $0x0,%ebx
  jmp    L17
```

assistant: ```c
int FwdLockGlue_CreateDirectories(const char *path, mode_t mode) {
  int result = 1;
  size_t partialPathLength = strlen(path);
  char *partialPath = malloc(partialPathLength + 1);
  if (partialPath == NULL) {
    result = 0;
  } else {
    size_t i;
    for (i = 0; i < partialPathLength; ++i) {
      if (path[i] == '/' && i > 0) {
        partialPath[i] = '\0';
        if (mkdir(partialPath, mode) != 0 && errno != EEXIST) {
          result = 0;
          break;
        }
      }
      partialPath[i] = path[i];
    }
    free(partialPath);
  }
  return result;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<FwdLockGlue_CreateDirectories>:
  endbr64
  push   %r14
  push   %r13
  mov    %esi,%r13d
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  call   <strlen@plt>
  lea    0x1(%rax),%rdi
  mov    %rax,%r14
  call   <malloc@plt>
  test   %rax,%rax
  je     L22
  mov    %rax,%r12
  xor    %ebx,%ebx
  test   %r14,%r14
  je     L44
  nopw   0x0(%rax,%rax,1)
L33:
  movzbl 0x0(%rbp,%rbx,1),%eax
  mov    %al,(%r12,%rbx,1)
  add    $0x1,%rbx
  cmp    %rbx,%r14
  je     L44
  cmpb   $0x2f,0x0(%rbp,%rbx,1)
  jne    L33
  movb   $0x0,(%r12,%rbx,1)
  mov    %r13d,%esi
  mov    %r12,%rdi
  call   <mkdir@plt>
  test   %rax,%rax
  je     L33
  mov    D18(%rip),%rax
  mov    D17(%rip),%rdx
  mov    (%rax),%rax
  cmp    %rax,(%rdx)
  je     L33
  xor    %r13d,%r13d
  jmp    L12
  nopl   0x0(%rax)
L44:
  mov    $0x1,%r13d
L12:
  mov    %r12,%rdi
  call   <free@plt>
L14:
  pop    %rbx
  mov    %r13d,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L22:
  xor    %r13d,%r13d
  jmp    L14
```

assistant: ```c
int FwdLockGlue_CreateDirectories(const char *path, mode_t mode) {
  int result = 1;
  size_t partialPathLength = strlen(path);
  char *partialPath = malloc(partialPathLength + 1);
  if (partialPath == NULL) {
    result = 0;
  } else {
    size_t i;
    for (i = 0; i < partialPathLength; ++i) {
      if (path[i] == '/' && i > 0) {
        partialPath[i] = '\0';
        if (mkdir(partialPath, mode) != 0 && errno != EEXIST) {
          result = 0;
          break;
        }
      }
      partialPath[i] = path[i];
    }
    free(partialPath);
  }
  return result;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<FwdLockGlue_CreateDirectories>:
  endbr64
  push   %r14
  push   %r13
  mov    %esi,%r13d
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  call   <strlen@plt>
  lea    0x1(%rax),%rdi
  mov    %rax,%r14
  call   <malloc@plt>
  test   %rax,%rax
  je     L41
  mov    %rax,%r12
  xor    %ebx,%ebx
  test   %r14,%r14
  je     L44
  nopw   0x0(%rax,%rax,1)
L58:
  movzbl 0x0(%rbp,%rbx,1),%eax
  mov    %al,(%r12,%rbx,1)
  add    $0x1,%rbx
  cmp    %rbx,%r14
  je     L44
  cmpb   $0x2f,0x0(%rbp,%rbx,1)
  jne    L58
  movb   $0x0,(%r12,%rbx,1)
  mov    %r13d,%esi
  mov    %r12,%rdi
  call   <mkdir@plt>
  test   %rax,%rax
  je     L58
  mov    D19(%rip),%rax
  mov    D14(%rip),%rdx
  mov    (%rax),%rax
  cmp    %rax,(%rdx)
  je     L58
  xor    %r13d,%r13d
  jmp    L53
  nopl   0x0(%rax)
L44:
  mov    $0x1,%r13d
L53:
  mov    %r12,%rdi
  call   <free@plt>
L11:
  pop    %rbx
  mov    %r13d,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L41:
  xor    %r13d,%r13d
  jmp    L11
```

assistant: ```c
int FwdLockGlue_CreateDirectories(const char *path, mode_t mode) {
  int result = 1;
  size_t partialPathLength = strlen(path);
  char *partialPath = malloc(partialPathLength + 1);
  if (partialPath == NULL) {
    result = 0;
  } else {
    size_t i;
    for (i = 0; i < partialPathLength; ++i) {
      if (path[i] == '/' && i > 0) {
        partialPath[i] = '\0';
        if (mkdir(partialPath, mode) != 0 && errno != EEXIST) {
          result = 0;
          break;
        }
      }
      partialPath[i] = path[i];
    }
    free(partialPath);
  }
  return result;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<realmode_start>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    $0x0,%eax
  call   <test_null@plt>
  mov    $0x0,%eax
  call   <test_shld@plt>
  mov    $0x0,%eax
  call   <test_push_pop@plt>
  mov    $0x0,%eax
  call   <test_mov_imm@plt>
  mov    $0x0,%eax
  call   <test_cmp_imm@plt>
  mov    $0x0,%eax
  call   <test_add_imm@plt>
  mov    $0x0,%eax
  call   <test_io@plt>
  mov    $0x0,%eax
  call   <test_eflags_insn@plt>
  mov    $0x0,%eax
  call   <test_jcc_short@plt>
  mov    $0x0,%eax
  call   <test_jcc_near@plt>
  mov    $0x0,%eax
  call   <test_call@plt>
  mov    $0x0,%eax
  call   <test_long_jmp@plt>
  mov    $0x0,%edi
  call   <exit@plt>
  nop
  pop    %rbp
  ret
```

assistant: ```c
void realmode_start(void) {
  test_null();
  test_shld();
  test_push_pop();
  test_mov_imm();
  test_cmp_imm();
  test_add_imm();
  test_io();
  test_eflags_insn();
  test_jcc_short();
  test_jcc_near();
  test_call();
  test_long_jmp();
  exit(0);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<realmode_start>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x0,%eax
  call   <test_null@plt>
  mov    $0x0,%eax
  call   <test_shld@plt>
  mov    $0x0,%eax
  call   <test_push_pop@plt>
  mov    $0x0,%eax
  call   <test_mov_imm@plt>
  mov    $0x0,%eax
  call   <test_cmp_imm@plt>
  mov    $0x0,%eax
  call   <test_add_imm@plt>
  mov    $0x0,%eax
  call   <test_io@plt>
  mov    $0x0,%eax
  call   <test_eflags_insn@plt>
  mov    $0x0,%eax
  call   <test_jcc_short@plt>
  mov    $0x0,%eax
  call   <test_jcc_near@plt>
  mov    $0x0,%eax
  call   <test_call@plt>
  mov    $0x0,%eax
  call   <test_long_jmp@plt>
  mov    $0x0,%edi
  call   <exit@plt>
  add    $0x8,%rsp
  ret
```

assistant: ```c
void realmode_start(void) {
  test_null();
  test_shld();
  test_push_pop();
  test_mov_imm();
  test_cmp_imm();
  test_add_imm();
  test_io();
  test_eflags_insn();
  test_jcc_short();
  test_jcc_near();
  test_call();
  test_long_jmp();
  exit(0);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<realmode_start>:
  endbr64
  sub    $0x8,%rsp
  xor    %eax,%eax
  call   <test_null@plt>
  xor    %eax,%eax
  call   <test_shld@plt>
  xor    %eax,%eax
  call   <test_push_pop@plt>
  xor    %eax,%eax
  call   <test_mov_imm@plt>
  xor    %eax,%eax
  call   <test_cmp_imm@plt>
  xor    %eax,%eax
  call   <test_add_imm@plt>
  xor    %eax,%eax
  call   <test_io@plt>
  xor    %eax,%eax
  call   <test_eflags_insn@plt>
  xor    %eax,%eax
  call   <test_jcc_short@plt>
  xor    %eax,%eax
  call   <test_jcc_near@plt>
  xor    %eax,%eax
  call   <test_call@plt>
  xor    %eax,%eax
  call   <test_long_jmp@plt>
  xor    %edi,%edi
  add    $0x8,%rsp
  jmp    11c0 <exit@plt>
```

assistant: ```c
void realmode_start(void) {
  test_null();
  test_shld();
  test_push_pop();
  test_mov_imm();
  test_cmp_imm();
  test_add_imm();
  test_io();
  test_eflags_insn();
  test_jcc_short();
  test_jcc_near();
  test_call();
  test_long_jmp();
  exit(0);
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<realmode_start>:
  endbr64
  sub    $0x8,%rsp
  xor    %eax,%eax
  call   <test_null@plt>
  xor    %eax,%eax
  call   <test_shld@plt>
  xor    %eax,%eax
  call   <test_push_pop@plt>
  xor    %eax,%eax
  call   <test_mov_imm@plt>
  xor    %eax,%eax
  call   <test_cmp_imm@plt>
  xor    %eax,%eax
  call   <test_add_imm@plt>
  xor    %eax,%eax
  call   <test_io@plt>
  xor    %eax,%eax
  call   <test_eflags_insn@plt>
  xor    %eax,%eax
  call   <test_jcc_short@plt>
  xor    %eax,%eax
  call   <test_jcc_near@plt>
  xor    %eax,%eax
  call   <test_call@plt>
  xor    %eax,%eax
  call   <test_long_jmp@plt>
  xor    %edi,%edi
  add    $0x8,%rsp
  jmp    11c0 <exit@plt>
```

assistant: ```c
void realmode_start(void) {
  test_null();
  test_shld();
  test_push_pop();
  test_mov_imm();
  test_cmp_imm();
  test_add_imm();
  test_io();
  test_eflags_insn();
  test_jcc_short();
  test_jcc_near();
  test_call();
  test_long_jmp();
  exit(0);
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<string_equal_igcase>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %edx,-0x34(%rbp)
  movl   $0x0,-0x14(%rbp)
L55:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L83
  mov    -0x30(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L14
L83:
  cmpl   $0x0,-0x34(%rbp)
  jns    L62
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%edx
  mov    -0x30(%rbp),%rax
  movzbl (%rax),%eax
  cmp    %al,%dl
  je     L109
  mov    $0x0,%eax
  jmp    L22
L62:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L6
  mov    -0x14(%rbp),%eax
  cmp    -0x34(%rbp),%eax
  je     L109
L6:
  mov    $0x0,%eax
  jmp    L22
L14:
  mov    -0x28(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <tol@plt>
  mov    %rax,%rbx
  mov    -0x30(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <tol@plt>
  cmp    %rax,%rbx
  je     L80
  mov    $0x0,%eax
  jmp    L22
L80:
  addq   $0x1,-0x28(%rbp)
  addq   $0x1,-0x30(%rbp)
  addl   $0x1,-0x14(%rbp)
  jmp    L55
L109:
  nop
  mov    $0x1,%eax
L22:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
bool string_equal_igcase(const char *sl, const char *r, int len) {
  int iter = 0;
  for (;;) {
    if (sl[0] == '\0' || r[0] == '\0') {
      if (len < 0) {
        if (sl[0] != r[0]) {
          return false;
        }
      } else {
        if (sl[0] != '\0' || iter != len) {
          return false;
        }
      }
      break;
    }
    if (tol(sl[0]) != tol(r[0])) {
      return false;
    }
    ++sl, ++r;
    ++iter;
  }
  return true;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<string_equal_igcase>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbp
  mov    %rsi,%rbx
  mov    %edx,%r13d
  movzbl (%rdi),%edi
  test   %dil,%dil
  je     L65
  mov    $0x0,%r12d
L72:
  cmpb   $0x0,(%rbx)
  je     L22
  movsbl %dil,%edi
  call   <tol@plt>
  mov    %rax,%r14
  movsbl (%rbx),%edi
  call   <tol@plt>
  cmp    %rax,%r14
  jne    L0
  add    $0x1,%rbp
  add    $0x1,%rbx
  add    $0x1,%r12d
  movzbl 0x0(%rbp),%edi
  test   %dil,%dil
  jne    L72
L22:
  test   %r13d,%r13d
  js     L23
  cmp    %r12d,%r13d
  setne  %al
  test   %dil,%dil
  setne  %dl
  or     %edx,%eax
  xor    $0x1,%eax
  movzbl %al,%eax
L19:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L65:
  mov    $0x0,%r12d
  jmp    L22
L23:
  cmp    %dil,(%rbx)
  sete   %al
  movzbl %al,%eax
  jmp    L19
L0:
  mov    $0x0,%eax
  jmp    L19
```

assistant: ```c
bool string_equal_igcase(const char *sl, const char *r, int len) {
  int iter = 0;
  for (;;) {
    if (sl[0] == '\0' || r[0] == '\0') {
      if (len < 0) {
        if (sl[0] != r[0]) {
          return false;
        }
      } else {
        if (sl[0] != '\0' || iter != len) {
          return false;
        }
      }
      break;
    }
    if (tol(sl[0]) != tol(r[0])) {
      return false;
    }
    ++sl, ++r;
    ++iter;
  }
  return true;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<string_equal_igcase>:
  endbr64
  push   %r14
  push   %r13
  mov    %edx,%r13d
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  movsbl (%rdi),%edi
  mov    %rsi,%rbx
  test   %dil,%dil
  je     L8
  mov    $0x1,%r14d
  jmp    L51
  nopl   (%rax)
L17:
  call   <tol@plt>
  movsbl (%rbx),%edi
  mov    %rax,%rbp
  call   <tol@plt>
  cmp    %rax,%rbp
  jne    L21
  mov    %r14d,%eax
  add    $0x1,%r14
  add    $0x1,%rbx
  movsbl -0x1(%r12,%r14,1),%edi
  test   %dil,%dil
  je     L7
L51:
  movzbl (%rbx),%eax
  test   %al,%al
  jne    L17
  test   %r13d,%r13d
  jns    L21
L52:
  cmp    %dil,%al
  pop    %rbx
  pop    %rbp
  sete   %al
  pop    %r12
  pop    %r13
  movzbl %al,%eax
  pop    %r14
  ret
  nopl   0x0(%rax)
L21:
  pop    %rbx
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L8:
  xor    %eax,%eax
  nopl   (%rax)
L7:
  test   %r13d,%r13d
  js     L57
  cmp    %eax,%r13d
  pop    %rbx
  pop    %rbp
  sete   %al
  pop    %r12
  pop    %r13
  movzbl %al,%eax
  pop    %r14
  ret
L57:
  movzbl (%rbx),%eax
  xor    %edi,%edi
  jmp    L52
```

assistant: ```c
bool string_equal_igcase(const char *sl, const char *r, int len) {
  int iter = 0;
  for (;;) {
    if (sl[0] == '\0' || r[0] == '\0') {
      if (len < 0) {
        if (sl[0] != r[0]) {
          return false;
        }
      } else {
        if (sl[0] != '\0' || iter != len) {
          return false;
        }
      }
      break;
    }
    if (tol(sl[0]) != tol(r[0])) {
      return false;
    }
    ++sl, ++r;
    ++iter;
  }
  return true;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<string_equal_igcase>:
  endbr64
  push   %r14
  push   %r13
  mov    %edx,%r13d
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  movsbl (%rdi),%edi
  mov    %rsi,%rbx
  test   %dil,%dil
  je     L43
  mov    $0x1,%r14d
  jmp    L25
  nopl   (%rax)
L57:
  call   <tol@plt>
  movsbl (%rbx),%edi
  mov    %rax,%rbp
  call   <tol@plt>
  cmp    %rax,%rbp
  jne    L23
  mov    %r14d,%eax
  add    $0x1,%r14
  add    $0x1,%rbx
  movsbl -0x1(%r12,%r14,1),%edi
  test   %dil,%dil
  je     L46
L25:
  movzbl (%rbx),%eax
  test   %al,%al
  jne    L57
  test   %r13d,%r13d
  jns    L23
L6:
  cmp    %al,%dil
  pop    %rbx
  pop    %rbp
  sete   %al
  pop    %r12
  pop    %r13
  movzbl %al,%eax
  pop    %r14
  ret
  nopl   0x0(%rax)
L23:
  pop    %rbx
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L43:
  xor    %eax,%eax
  nopl   (%rax)
L46:
  test   %r13d,%r13d
  js     L29
  cmp    %eax,%r13d
  pop    %rbx
  pop    %rbp
  sete   %al
  pop    %r12
  pop    %r13
  movzbl %al,%eax
  pop    %r14
  ret
L29:
  movzbl (%rbx),%eax
  xor    %edi,%edi
  jmp    L6
```

assistant: ```c
bool string_equal_igcase(const char *sl, const char *r, int len) {
  int iter = 0;
  for (;;) {
    if (sl[0] == '\0' || r[0] == '\0') {
      if (len < 0) {
        if (sl[0] != r[0]) {
          return false;
        }
      } else {
        if (sl[0] != '\0' || iter != len) {
          return false;
        }
      }
      break;
    }
    if (tol(sl[0]) != tol(r[0])) {
      return false;
    }
    ++sl, ++r;
    ++iter;
  }
  return true;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<ig_poc_lut_table_set>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %edi,-0x4(%rbp)
  mov    %esi,-0x8(%rbp)
  mov    %rdx,-0x10(%rbp)
  cmpl   $0x2f,-0x8(%rbp)
  jbe    L5
  mov    $0xffffffff,%eax
  jmp    L17
L5:
  mov    -0x10(%rbp),%rcx
  mov    -0x8(%rbp),%edx
  mov    -0x4(%rbp),%eax
  mov    %rcx,%r8
  mov    $0x4,%ecx
  mov    $0x4,%esi
  mov    %eax,%edi
  call   <ig_indirect_table_set@plt>
L17:
  leave
  ret
```

assistant: ```c
int ig_poc_lut_table_set(unsigned int dev_id, unsigned int index, unsigned int *pentry) {
  if ((index < 0) || (index > 47)) {
    return -1;
  }
  return ig_indirect_table_set(dev_id, 4, index, 4, pentry);
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<ig_poc_lut_table_set>:
  endbr64
  cmp    $0x2f,%esi
  ja     L3
  sub    $0x8,%rsp
  mov    %rdx,%r8
  mov    $0x4,%ecx
  mov    %esi,%edx
  mov    $0x4,%esi
  call   <ig_indirect_table_set@plt>
  add    $0x8,%rsp
  ret
L3:
  mov    $0xffffffff,%eax
  ret
```

assistant: ```c
int ig_poc_lut_table_set(unsigned int dev_id, unsigned int index, unsigned int *pentry) {
  if ((index < 0) || (index > 47)) {
    return -1;
  }
  return ig_indirect_table_set(dev_id, 4, index, 4, pentry);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<ig_poc_lut_table_set>:
  endbr64
  mov    %rdx,%r8
  cmp    $0x2f,%esi
  ja     L7
  mov    %esi,%edx
  mov    $0x4,%ecx
  mov    $0x4,%esi
  jmp    1050 <ig_indirect_table_set@plt>
  nopl   (%rax)
L7:
  mov    $0xffffffff,%eax
  ret
```

assistant: ```c
int ig_poc_lut_table_set(unsigned int dev_id, unsigned int index, unsigned int *pentry) {
  if ((index < 0) || (index > 47)) {
    return -1;
  }
  return ig_indirect_table_set(dev_id, 4, index, 4, pentry);
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<ig_poc_lut_table_set>:
  endbr64
  mov    %rdx,%r8
  cmp    $0x2f,%esi
  ja     L7
  mov    %esi,%edx
  mov    $0x4,%ecx
  mov    $0x4,%esi
  jmp    1050 <ig_indirect_table_set@plt>
  nopl   (%rax)
L7:
  mov    $0xffffffff,%eax
  ret
```

assistant: ```c
int ig_poc_lut_table_set(unsigned int dev_id, unsigned int index, unsigned int *pentry) {
  if ((index < 0) || (index > 47)) {
    return -1;
  }
  return ig_indirect_table_set(dev_id, 4, index, 4, pentry);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<Message_can_read_delimited_from>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  mov    %edx,-0x30(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  cmpl   $0x0,-0x30(%rbp)
  jne    L35
  mov    $0x0,%eax
  jmp    L5
L35:
  mov    -0x30(%rbp),%edx
  mov    -0x2c(%rbp),%ecx
  mov    -0x28(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <can_read_raw_varint32@plt>
  test   %eax,%eax
  jne    L37
  mov    $0x0,%eax
  jmp    L5
L37:
  mov    -0x2c(%rbp),%edx
  mov    -0x28(%rbp),%rcx
  lea    -0x10(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <read_raw_varint32@plt>
  mov    %eax,-0x14(%rbp)
  mov    -0x14(%rbp),%eax
  sub    -0x2c(%rbp),%eax
  sub    %eax,-0x30(%rbp)
  mov    -0x30(%rbp),%edx
  mov    -0x10(%rbp),%rax
  cmp    %rax,%rdx
  setae  %al
  movzbl %al,%eax
L5:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L9
  call   <__stack_chk_fail@plt>
L9:
  leave
  ret
```

assistant: ```c
int Message_can_read_delimited_from(void *_buffer, int offset, unsigned int length) {
  unsigned long size;
  int payload_offset;
  if (length <= 0)
    return 0;
  if (!can_read_raw_varint32(_buffer, offset, length)) {
    return 0;
  }
  payload_offset = read_raw_varint32(&size, _buffer, offset);
  length = length - (payload_offset - offset);
  return (length >= size) ? 1 : 0;
}
```