ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<get_min>:
  endbr64
  mov    (%rdi),%r8d
  cmp    $0x1,%esi
  jle    L15
  lea    -0x2(%rsi),%edx
  lea    0x4(%rdi),%rax
  lea    0x8(%rdi,%rdx,4),%rcx
  nopl   0x0(%rax,%rax,1)
L17:
  mov    (%rax),%edx
  cmp    %edx,%r8d
  cmovg  %edx,%r8d
  add    $0x4,%rax
  cmp    %rcx,%rax
  jne    L17
L15:
  mov    %r8d,%eax
  ret
```

assistant: ```c
int get_min(const int *str, int lenght) {
  int temp = str[0];
  int i;
  for (i = 1; i < lenght; i++) {
    if (temp > str[i]) {
      temp = str[i];
    }
  }
  return temp;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<get_min>:
  endbr64
  mov    (%rdi),%eax
  mov    %rdi,%rdx
  mov    %esi,%ecx
  cmp    $0x1,%esi
  jle    L52
  lea    -0x1(%rsi),%edi
  lea    -0x2(%rsi),%esi
  cmp    $0x2,%esi
  jbe    L29
  mov    %edi,%esi
  movd   %eax,%xmm4
  lea    0x4(%rdx),%rax
  shr    $0x2,%esi
  pshufd $0x0,%xmm4,%xmm0
  sub    $0x1,%esi
  shl    $0x4,%rsi
  lea    0x14(%rdx,%rsi,1),%rsi
  nopl   0x0(%rax)
L10:
  movdqu (%rax),%xmm1
  movdqu (%rax),%xmm3
  add    $0x10,%rax
  pcmpgtd %xmm0,%xmm1
  pand   %xmm1,%xmm0
  pandn  %xmm3,%xmm1
  por    %xmm1,%xmm0
  cmp    %rsi,%rax
  jne    L10
  movdqa %xmm0,%xmm2
  mov    %edi,%r8d
  psrldq $0x8,%xmm2
  and    $0xfffffffc,%r8d
  movdqa %xmm2,%xmm1
  lea    0x1(%r8),%esi
  pcmpgtd %xmm0,%xmm1
  pand   %xmm1,%xmm0
  pandn  %xmm2,%xmm1
  por    %xmm1,%xmm0
  movdqa %xmm0,%xmm2
  psrldq $0x4,%xmm2
  movdqa %xmm2,%xmm1
  pcmpgtd %xmm0,%xmm1
  pand   %xmm1,%xmm0
  pandn  %xmm2,%xmm1
  por    %xmm0,%xmm1
  movd   %xmm1,%eax
  cmp    %r8d,%edi
  je     L24
L3:
  movslq %esi,%rdi
  lea    0x0(,%rdi,4),%r8
  mov    (%rdx,%rdi,4),%edi
  cmp    %edi,%eax
  cmovg  %edi,%eax
  lea    0x1(%rsi),%edi
  cmp    %edi,%ecx
  jle    L52
  mov    0x4(%rdx,%r8,1),%edi
  cmp    %edi,%eax
  cmovg  %edi,%eax
  add    $0x2,%esi
  cmp    %esi,%ecx
  jle    L52
  mov    0x8(%rdx,%r8,1),%edx
  cmp    %edx,%eax
  cmovg  %edx,%eax
L52:
  ret
  nopl   (%rax)
L24:
  ret
L29:
  mov    $0x1,%esi
  jmp    L3
```

assistant: ```c
int get_min(const int *str, int lenght) {
  int temp = str[0];
  int i;
  for (i = 1; i < lenght; i++) {
    if (temp > str[i]) {
      temp = str[i];
    }
  }
  return temp;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<fd_read>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %edi,%r15d
  mov    %rsi,%r14
  mov    %rdx,%r13
  mov    %rdx,%rbp
  mov    %rsi,%rbx
  mov    $0x0,%eax
  mov    %rdx,0x8(%rsp)
L3:
  test   %eax,%eax
  mov    $0x0,%edx
  cmovs  %edx,%eax
  cltq
  add    %rax,%rbx
  mov    %rbx,%r12
  sub    %r14,%r12
  cmp    %r13,%r12
  je     L10
  sub    %rax,%rbp
  mov    %rbp,%rdx
  mov    %rbx,%rsi
  mov    %r15d,%edi
  call   <read@plt>
  test   %eax,%eax
  jne    L3
  mov    %r12,0x8(%rsp)
L10:
  mov    0x8(%rsp),%rax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
size_t fd_read(int fd, void *buf, size_t size) {
  void *p;
  size_t todo;
  int ret;
  p = buf;
  ret = 0;
  todo = size;
  do {
    if (ret < 0)
      ret = 0;
    p += ret;
    if ((size_t)(p - buf) == size)
      break;
    todo -= ret;
    ret = read(fd, p, todo);
  } while (ret || ((ret < 0) && (errno == EINTR || errno == EAGAIN)));
  if (ret < 0) {
    _pfatal(NULL, 0, "fd_read");
    ;
  }
  return (size_t)(p - buf);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<fd_read>:
  endbr64
  push   %r15
  xor    %eax,%eax
  push   %r14
  mov    %rdx,%r14
  push   %r13
  mov    %rsi,%r13
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x8,%rsp
  jmp    L21
  nopl   0x0(%rax)
L27:
  sub    %rax,%r14
  mov    %r13,%rsi
  mov    %ebp,%edi
  mov    %r14,%rdx
  call   <read@plt>
  test   %eax,%eax
  je     L23
L21:
  xor    %edx,%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  cltq
  add    %rax,%r13
  mov    %r13,%r15
  sub    %rbx,%r15
  cmp    %r12,%r15
  jne    L27
L23:
  add    $0x8,%rsp
  mov    %r15,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
size_t fd_read(int fd, void *buf, size_t size) {
  void *p;
  size_t todo;
  int ret;
  p = buf;
  ret = 0;
  todo = size;
  do {
    if (ret < 0)
      ret = 0;
    p += ret;
    if ((size_t)(p - buf) == size)
      break;
    todo -= ret;
    ret = read(fd, p, todo);
  } while (ret || ((ret < 0) && (errno == EINTR || errno == EAGAIN)));
  if (ret < 0) {
    _pfatal(NULL, 0, "fd_read");
    ;
  }
  return (size_t)(p - buf);
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<fd_read>:
  endbr64
  push   %r15
  xor    %eax,%eax
  push   %r14
  mov    %rdx,%r14
  push   %r13
  mov    %rsi,%r13
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x8,%rsp
  jmp    L15
  nopl   0x0(%rax)
L14:
  sub    %rax,%r14
  mov    %r13,%rsi
  mov    %ebp,%edi
  mov    %r14,%rdx
  call   <read@plt>
  test   %eax,%eax
  je     L19
L15:
  xor    %edx,%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  cltq
  add    %rax,%r13
  mov    %r13,%r15
  sub    %rbx,%r15
  cmp    %r12,%r15
  jne    L14
L19:
  add    $0x8,%rsp
  mov    %r15,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
size_t fd_read(int fd, void *buf, size_t size) {
  void *p;
  size_t todo;
  int ret;
  p = buf;
  ret = 0;
  todo = size;
  do {
    if (ret < 0)
      ret = 0;
    p += ret;
    if ((size_t)(p - buf) == size)
      break;
    todo -= ret;
    ret = read(fd, p, todo);
  } while (ret || ((ret < 0) && (errno == EINTR || errno == EAGAIN)));
  if (ret < 0) {
    _pfatal(NULL, 0, "fd_read");
    ;
  }
  return (size_t)(p - buf);
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<get_ssid_bssid>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  mov    $0x3a,%esi
  mov    %rax,%rdi
  call   <strrchr@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  je     L12
  mov    -0x10(%rbp),%rax
  movzbl 0x1(%rax),%eax
  mov    %al,-0x11(%rbp)
  mov    -0x10(%rbp),%rax
  add    $0x1,%rax
  movb   $0x0,(%rax)
  mov    -0x28(%rbp),%rax
  mov    $0x24,%esi
  mov    %rax,%rdi
  call   <strrchr@plt>
  add    $0x1,%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  movzbl -0x11(%rbp),%eax
  mov    %al,(%rdx)
  mov    -0x8(%rbp),%rax
  mov    $0x24,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  sub    -0x8(%rbp),%rax
  mov    %eax,%edx
  mov    -0x8(%rbp),%rcx
  mov    -0x30(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  mov    -0x10(%rbp),%rax
  sub    -0x8(%rbp),%rax
  mov    %rax,%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x28(%rbp),%rax
  mov    $0x24,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  add    $0x1,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x8(%rbp),%rax
  sub    -0x10(%rbp),%rax
  sub    $0x1,%eax
  mov    %eax,%edx
  mov    -0x10(%rbp),%rcx
  mov    -0x38(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <strncpy@plt>
  mov    -0x8(%rbp),%rax
  sub    -0x10(%rbp),%rax
  lea    -0x1(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    $0x0,%eax
  jmp    L8
L12:
  mov    $0xffffffff,%eax
L8:
  leave
  ret
```

assistant: ```c
int get_ssid_bssid(char *survey_line, char *bssidbuf, char *ssidbuf) {
  char *pos1 = survey_line, *pos2 = survey_line;
  char cachechar;
  if ((pos1 = strrchr(pos2, ':'))) {
    cachechar = pos1[1];
    pos1[1] = 0;
    pos2 = strrchr(survey_line, '$') + 1;
    pos1[1] = cachechar;
    pos1 = strchr(pos2, '$');
  } else {
    return -1;
  }
  strncpy(bssidbuf, pos2, pos1 - pos2);
  bssidbuf[pos1 - pos2] = 0;
  pos1 = strchr(survey_line, '$') + 1;
  strncpy(ssidbuf, pos1, pos2 - pos1 - 1);
  ssidbuf[pos2 - pos1 - 1] = 0;
  return 0;
}
```
user: What is the c source code of the assembly code below:

```asm
<get_ssid_bssid>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%rbp
  mov    %rsi,%r13
  mov    %rdx,%r12
  mov    $0x3a,%esi
  call   <strrchr@plt>
  test   %rax,%rax
  je     L18
  mov    %rax,%rbx
  movzbl 0x1(%rax),%r15d
  movb   $0x0,0x1(%rax)
  mov    $0x24,%esi
  mov    %rbp,%rdi
  call   <strrchr@plt>
  mov    %rax,0x8(%rsp)
  lea    0x1(%rax),%r14
  mov    %r15b,0x1(%rbx)
  mov    $0x24,%esi
  mov    %r14,%rdi
  call   <strchr@plt>
  mov    %rax,%rcx
  sub    %r14,%rcx
  mov    %rcx,%rbx
  mov    %ecx,%edx
  mov    %r14,%rsi
  mov    %r13,%rdi
  call   <strncpy@plt>
  movb   $0x0,0x0(%r13,%rbx,1)
  mov    $0x24,%esi
  mov    %rbp,%rdi
  call   <strchr@plt>
  mov    0x8(%rsp),%rbx
  sub    %rax,%rbx
  lea    -0x1(%rbx),%edx
  lea    0x1(%rax),%rsi
  mov    %r12,%rdi
  call   <strncpy@plt>
  movb   $0x0,-0x1(%r12,%rbx,1)
  mov    $0x0,%eax
L0:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L18:
  mov    $0xffffffff,%eax
  jmp    L0
```

assistant: ```c
int get_ssid_bssid(char *survey_line, char *bssidbuf, char *ssidbuf) {
  char *pos1 = survey_line, *pos2 = survey_line;
  char cachechar;
  if ((pos1 = strrchr(pos2, ':'))) {
    cachechar = pos1[1];
    pos1[1] = 0;
    pos2 = strrchr(survey_line, '$') + 1;
    pos1[1] = cachechar;
    pos1 = strchr(pos2, '$');
  } else {
    return -1;
  }
  strncpy(bssidbuf, pos2, pos1 - pos2);
  bssidbuf[pos1 - pos2] = 0;
  pos1 = strchr(survey_line, '$') + 1;
  strncpy(ssidbuf, pos1, pos2 - pos1 - 1);
  ssidbuf[pos2 - pos1 - 1] = 0;
  return 0;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<get_ssid_bssid>:
  endbr64
  push   %r15
  push   %r14
  mov    %rsi,%r14
  mov    $0x3a,%esi
  push   %r13
  mov    %rdi,%r13
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  call   <strrchr@plt>
  test   %rax,%rax
  je     L3
  movzbl 0x1(%rax),%edx
  movb   $0x0,0x1(%rax)
  mov    $0x24,%esi
  mov    %r13,%rdi
  mov    %rax,%rbp
  mov    %dl,0xf(%rsp)
  call   <strrchr@plt>
  movzbl 0xf(%rsp),%edx
  mov    $0x24,%esi
  lea    0x1(%rax),%r15
  mov    %rax,%rbx
  mov    %dl,0x1(%rbp)
  mov    %r15,%rdi
  call   <strchr@plt>
  mov    %r15,%rsi
  mov    %r14,%rdi
  sub    %r15,%rax
  mov    %eax,%edx
  mov    %rax,%rbp
  call   <strncpy@plt>
  movb   $0x0,(%r14,%rbp,1)
  mov    $0x24,%esi
  mov    %r13,%rdi
  call   <strchr@plt>
  mov    %r12,%rdi
  sub    %rax,%rbx
  lea    0x1(%rax),%rsi
  lea    -0x1(%rbx),%edx
  call   <strncpy@plt>
  movb   $0x0,-0x1(%r12,%rbx,1)
  xor    %eax,%eax
L13:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L3:
  mov    $0xffffffff,%eax
  jmp    L13
```

assistant: ```c
int get_ssid_bssid(char *survey_line, char *bssidbuf, char *ssidbuf) {
  char *pos1 = survey_line, *pos2 = survey_line;
  char cachechar;
  if ((pos1 = strrchr(pos2, ':'))) {
    cachechar = pos1[1];
    pos1[1] = 0;
    pos2 = strrchr(survey_line, '$') + 1;
    pos1[1] = cachechar;
    pos1 = strchr(pos2, '$');
  } else {
    return -1;
  }
  strncpy(bssidbuf, pos2, pos1 - pos2);
  bssidbuf[pos1 - pos2] = 0;
  pos1 = strchr(survey_line, '$') + 1;
  strncpy(ssidbuf, pos1, pos2 - pos1 - 1);
  ssidbuf[pos2 - pos1 - 1] = 0;
  return 0;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<get_ssid_bssid>:
  endbr64
  push   %r15
  push   %r14
  mov    %rsi,%r14
  mov    $0x3a,%esi
  push   %r13
  mov    %rdi,%r13
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  call   <strrchr@plt>
  test   %rax,%rax
  je     L4
  movzbl 0x1(%rax),%edx
  movb   $0x0,0x1(%rax)
  mov    $0x24,%esi
  mov    %r13,%rdi
  mov    %rax,%rbp
  mov    %dl,0xf(%rsp)
  call   <strrchr@plt>
  movzbl 0xf(%rsp),%edx
  mov    $0x24,%esi
  lea    0x1(%rax),%r15
  mov    %rax,%rbx
  mov    %dl,0x1(%rbp)
  mov    %r15,%rdi
  call   <strchr@plt>
  mov    %r15,%rsi
  mov    %r14,%rdi
  sub    %r15,%rax
  mov    %eax,%edx
  mov    %rax,%rbp
  call   <strncpy@plt>
  movb   $0x0,(%r14,%rbp,1)
  mov    $0x24,%esi
  mov    %r13,%rdi
  call   <strchr@plt>
  mov    %r12,%rdi
  sub    %rax,%rbx
  lea    0x1(%rax),%rsi
  lea    -0x1(%rbx),%edx
  call   <strncpy@plt>
  movb   $0x0,-0x1(%r12,%rbx,1)
  xor    %eax,%eax
L14:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L4:
  mov    $0xffffffff,%eax
  jmp    L14
```

assistant: ```c
int get_ssid_bssid(char *survey_line, char *bssidbuf, char *ssidbuf) {
  char *pos1 = survey_line, *pos2 = survey_line;
  char cachechar;
  if ((pos1 = strrchr(pos2, ':'))) {
    cachechar = pos1[1];
    pos1[1] = 0;
    pos2 = strrchr(survey_line, '$') + 1;
    pos1[1] = cachechar;
    pos1 = strchr(pos2, '$');
  } else {
    return -1;
  }
  strncpy(bssidbuf, pos2, pos1 - pos2);
  bssidbuf[pos1 - pos2] = 0;
  pos1 = strchr(survey_line, '$') + 1;
  strncpy(ssidbuf, pos1, pos2 - pos1 - 1);
  ssidbuf[pos2 - pos1 - 1] = 0;
  return 0;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<djb2_hash>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  movq   $0x1505,-0x8(%rbp)
  jmp    L19
L5:
  mov    -0x8(%rbp),%rax
  shl    $0x5,%rax
  mov    %rax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rax,%rdx
  mov    -0xc(%rbp),%eax
  cltq
  add    %rdx,%rax
  mov    %rax,-0x8(%rbp)
L19:
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movzbl (%rax),%eax
  movzbl %al,%eax
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  jne    L5
  mov    -0x8(%rbp),%rcx
  movabs $0x38f0764896d7bf4b,%rdx
  mov    %rcx,%rax
  mul    %rdx
  mov    %rdx,%rax
  shr    $0x13,%rax
  imul   $0x23f7d7,%rax,%rdx
  mov    %rcx,%rax
  sub    %rdx,%rax
  pop    %rbp
  ret
```

assistant: ```c
unsigned int djb2_hash(const char *str) {
  unsigned long hash = 5381;
  int c;
  while ((c = (unsigned char)*str++))
    hash = ((hash << 5) + hash) + c;
  return hash % 2357207;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<djb2_hash>:
  endbr64
  lea    0x1(%rdi),%rdx
  movzbl (%rdi),%eax
  test   %al,%al
  je     L13
  mov    $0x1505,%ecx
L1:
  mov    %rcx,%rsi
  shl    $0x5,%rsi
  add    %rsi,%rcx
  movzbl %al,%eax
  add    %rax,%rcx
  add    $0x1,%rdx
  movzbl -0x1(%rdx),%eax
  test   %al,%al
  jne    L1
L25:
  movabs $0x38f0764896d7bf4b,%rdx
  mov    %rcx,%rax
  mul    %rdx
  shr    $0x13,%rdx
  imul   $0x23f7d7,%rdx,%rdx
  mov    %ecx,%eax
  sub    %edx,%eax
  ret
L13:
  mov    $0x1505,%ecx
  jmp    L25
```

assistant: ```c
unsigned int djb2_hash(const char *str) {
  unsigned long hash = 5381;
  int c;
  while ((c = (unsigned char)*str++))
    hash = ((hash << 5) + hash) + c;
  return hash % 2357207;
}
```
user: Translate the below assembly code into C programming language:

```asm
<djb2_hash>:
  endbr64
  movzbl (%rdi),%eax
  lea    0x1(%rdi),%rdx
  test   %al,%al
  je     L0
  mov    $0x1505,%ecx
  nopl   0x0(%rax)
L8:
  mov    %rcx,%rsi
  add    $0x1,%rdx
  shl    $0x5,%rsi
  add    %rsi,%rcx
  add    %rax,%rcx
  movzbl -0x1(%rdx),%eax
  test   %al,%al
  jne    L8
  movabs $0x38f0764896d7bf4b,%rdx
  mov    %rcx,%rax
  mul    %rdx
  mov    %ecx,%eax
  shr    $0x13,%rdx
  imul   $0x23f7d7,%rdx,%rdx
  sub    %edx,%eax
  ret
  nopl   0x0(%rax)
L0:
  mov    $0x1505,%eax
  ret
```

assistant: ```c
unsigned int djb2_hash(const char *str) {
  unsigned long hash = 5381;
  int c;
  while ((c = (unsigned char)*str++))
    hash = ((hash << 5) + hash) + c;
  return hash % 2357207;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<djb2_hash>:
  endbr64
  movzbl (%rdi),%eax
  lea    0x1(%rdi),%rdx
  test   %al,%al
  je     L7
  mov    $0x1505,%ecx
  nopl   0x0(%rax)
L13:
  mov    %rcx,%rsi
  add    $0x1,%rdx
  shl    $0x5,%rsi
  add    %rsi,%rcx
  add    %rax,%rcx
  movzbl -0x1(%rdx),%eax
  test   %al,%al
  jne    L13
  movabs $0x38f0764896d7bf4b,%rdx
  mov    %rcx,%rax
  mul    %rdx
  mov    %ecx,%eax
  shr    $0x13,%rdx
  imul   $0x23f7d7,%rdx,%rdx
  sub    %edx,%eax
  ret
  nopl   0x0(%rax)
L7:
  mov    $0x1505,%eax
  ret
```

assistant: ```c
unsigned int djb2_hash(const char *str) {
  unsigned long hash = 5381;
  int c;
  while ((c = (unsigned char)*str++))
    hash = ((hash << 5) + hash) + c;
  return hash % 2357207;
}
```
user: What is the c source code of the assembly code below:

```asm
<executePipe>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x18(%rbp)
  jmp    L62
L55:
  lea    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <pipe@plt>
  call   <fork@plt>
  mov    %eax,-0x14(%rbp)
  cmpl   $0xffffffff,-0x14(%rbp)
  jne    L30
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L62
L30:
  cmpl   $0x0,-0x14(%rbp)
  jne    L17
  mov    -0x18(%rbp),%eax
  mov    $0x0,%esi
  mov    %eax,%edi
  call   <dup2@plt>
  mov    -0x28(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rax
  test   %rax,%rax
  je     L31
  mov    -0xc(%rbp),%eax
  mov    $0x1,%esi
  mov    %eax,%edi
  call   <dup2@plt>
L31:
  mov    -0x10(%rbp),%eax
  mov    %eax,%edi
  call   <close@plt>
  mov    -0x28(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x28(%rbp),%rax
  mov    (%rax),%rax
  mov    (%rax),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <execvp@plt>
  mov    $0x0,%edi
  call   <exit@plt>
  jmp    L62
L17:
  lea    -0x1c(%rbp),%rax
  mov    %rax,%rdi
  call   <wait@plt>
  mov    -0xc(%rbp),%eax
  mov    %eax,%edi
  call   <close@plt>
  mov    -0x10(%rbp),%eax
  mov    %eax,-0x18(%rbp)
  addq   $0x8,-0x28(%rbp)
L62:
  mov    -0x28(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  jne    L55
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L45
  call   <__stack_chk_fail@plt>
L45:
  leave
  ret
```

assistant: ```c
void executePipe(char ***cmd) {
  int p[2];
  pid_t pid;
  int fd_in = 0;
  int status;
  while (*cmd != NULL) {
    pipe(p);
    if ((pid = fork()) == -1) {
      exit(1);
    } else if (pid == 0) {
      dup2(fd_in, 0);
      if (*(cmd + 1) != NULL) {
        dup2(p[1], 1);
      }
      close(p[0]);
      execvp((*cmd)[0], *cmd);
      exit(0);
    } else {
      wait(&status);
      close(p[1]);
      fd_in = p[0];
      cmd++;
    }
  }
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<executePipe>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  cmpq   $0x0,(%rdi)
  je     L19
  mov    %rdi,%rbx
  mov    $0x0,%r12d
  lea    0x10(%rsp),%rbp
  jmp    L75
L50:
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L84
L7:
  mov    0x10(%rsp),%edi
  call   <close@plt>
  mov    (%rbx),%rax
  mov    %rax,%rsi
  mov    (%rax),%rdi
  call   <execvp@plt>
  mov    $0x0,%edi
  call   <exit@plt>
L84:
  cmpq   $0x0,(%rbx)
  je     L19
L75:
  mov    %rbp,%rdi
  call   <pipe@plt>
  call   <fork@plt>
  cmp    $0xffffffff,%eax
  je     L50
  test   %eax,%eax
  jne    L77
  mov    $0x0,%esi
  mov    %r12d,%edi
  call   <dup2@plt>
  cmpq   $0x0,0x8(%rbx)
  je     L7
  mov    $0x1,%esi
  mov    0x14(%rsp),%edi
  call   <dup2@plt>
  jmp    L7
L77:
  lea    0xc(%rsp),%rdi
  call   <wait@plt>
  mov    0x14(%rsp),%edi
  call   <close@plt>
  mov    0x10(%rsp),%r12d
  add    $0x8,%rbx
  jmp    L84
L19:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L45
  add    $0x20,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L45:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void executePipe(char ***cmd) {
  int p[2];
  pid_t pid;
  int fd_in = 0;
  int status;
  while (*cmd != NULL) {
    pipe(p);
    if ((pid = fork()) == -1) {
      exit(1);
    } else if (pid == 0) {
      dup2(fd_in, 0);
      if (*(cmd + 1) != NULL) {
        dup2(p[1], 1);
      }
      close(p[0]);
      execvp((*cmd)[0], *cmd);
      exit(0);
    } else {
      wait(&status);
      close(p[1]);
      fd_in = p[0];
      cmd++;
    }
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<executePipe>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  cmpq   $0x0,(%rdi)
  je     L64
  mov    %rdi,%rbx
  lea    0x10(%rsp),%rbp
  lea    0xc(%rsp),%r13
  xor    %r12d,%r12d
  jmp    L80
  nopw   0x0(%rax,%rax,1)
L17:
  xor    %esi,%esi
  mov    %r12d,%edi
  call   <dup2@plt>
  cmpq   $0x0,0x8(%rbx)
  je     L21
  mov    0x14(%rsp),%edi
  mov    $0x1,%esi
  call   <dup2@plt>
L21:
  mov    0x10(%rsp),%edi
  call   <close@plt>
  mov    (%rbx),%rax
  mov    (%rax),%rdi
  mov    %rax,%rsi
  call   <execvp@plt>
  xor    %edi,%edi
  call   <exit@plt>
L14:
  cmpq   $0x0,(%rbx)
  je     L64
L80:
  mov    %rbp,%rdi
  call   <pipe@plt>
  call   <fork@plt>
  cmp    $0xffffffff,%eax
  je     L85
  test   %eax,%eax
  je     L17
  mov    %r13,%rdi
  add    $0x8,%rbx
  call   <wait@plt>
  mov    0x14(%rsp),%edi
  call   <close@plt>
  cmpq   $0x0,(%rbx)
  mov    0x10(%rsp),%r12d
  jne    L80
L64:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L11
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L85:
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L14
L11:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void executePipe(char ***cmd) {
  int p[2];
  pid_t pid;
  int fd_in = 0;
  int status;
  while (*cmd != NULL) {
    pipe(p);
    if ((pid = fork()) == -1) {
      exit(1);
    } else if (pid == 0) {
      dup2(fd_in, 0);
      if (*(cmd + 1) != NULL) {
        dup2(p[1], 1);
      }
      close(p[0]);
      execvp((*cmd)[0], *cmd);
      exit(0);
    } else {
      wait(&status);
      close(p[1]);
      fd_in = p[0];
      cmd++;
    }
  }
}
```
user: What is the c source code of the assembly code below:

```asm
<executePipe>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  cmpq   $0x0,(%rdi)
  je     L36
  mov    %rdi,%rbx
  lea    0x10(%rsp),%rbp
  lea    0xc(%rsp),%r13
  xor    %r12d,%r12d
  jmp    L64
  nopw   0x0(%rax,%rax,1)
L30:
  xor    %esi,%esi
  mov    %r12d,%edi
  call   <dup2@plt>
  cmpq   $0x0,0x8(%rbx)
  je     L14
  mov    0x14(%rsp),%edi
  mov    $0x1,%esi
  call   <dup2@plt>
L14:
  mov    0x10(%rsp),%edi
  call   <close@plt>
  mov    (%rbx),%rax
  mov    (%rax),%rdi
  mov    %rax,%rsi
  call   <execvp@plt>
  xor    %edi,%edi
  call   <exit@plt>
L1:
  cmpq   $0x0,(%rbx)
  je     L36
L64:
  mov    %rbp,%rdi
  call   <pipe@plt>
  call   <fork@plt>
  cmp    $0xffffffff,%eax
  je     L78
  test   %eax,%eax
  je     L30
  mov    %r13,%rdi
  add    $0x8,%rbx
  call   <wait@plt>
  mov    0x14(%rsp),%edi
  call   <close@plt>
  cmpq   $0x0,(%rbx)
  mov    0x10(%rsp),%r12d
  jne    L64
L36:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L61
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L78:
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L1
L61:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void executePipe(char ***cmd) {
  int p[2];
  pid_t pid;
  int fd_in = 0;
  int status;
  while (*cmd != NULL) {
    pipe(p);
    if ((pid = fork()) == -1) {
      exit(1);
    } else if (pid == 0) {
      dup2(fd_in, 0);
      if (*(cmd + 1) != NULL) {
        dup2(p[1], 1);
      }
      close(p[0]);
      execvp((*cmd)[0], *cmd);
      exit(0);
    } else {
      wait(&status);
      close(p[1]);
      fd_in = p[0];
      cmd++;
    }
  }
}
```