ylfeng/ReF-Decompile-dataset huggingface dataset:
user: Demonstrate the C code that generates the assembly output below:

```asm
<logging>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rsi,%rbx
  lea    D22(%rip),%rsi
  sub    $0x178,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x168(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%r13
  lea    0x60(%rsp),%r12
  call   <fopen@plt>
  xor    %edi,%edi
  mov    %rax,%rbp
  call   <time@plt>
  lea    0x8(%rsp),%rdi
  mov    %eax,0x8(%rsp)
  call   <localtime@plt>
  lea    0xc(%rsp),%rcx
  mov    $0x50,%esi
  mov    %r13,%rdi
  mov    (%rax),%eax
  lea    D14(%rip),%rdx
  mov    %eax,0xc(%rsp)
  call   <strftime@plt>
  mov    %rbx,%r8
  mov    %r13,%rcx
  mov    $0x100,%esi
  lea    D19(%rip),%rdx
  mov    %r12,%rdi
  call   <snprintf@plt>
  mov    %r12,%rdi
  call   <strlen@plt>
  mov    %r12,%rdi
  mov    %rbp,%rcx
  mov    $0x1,%esi
  mov    %eax,%edx
  call   <fwrite@plt>
  mov    %rbp,%rdi
  call   <fclose@plt>
  mov    0x168(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L8
  add    $0x178,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L8:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_label: D22
type: string
name: parse_data
arguments: data_label: D14
type: string
name: parse_data
arguments: data_label: D19
type: string

tool: D22: a+

tool: D14: %Y-%m-%d %X

tool: D19: [%s]: %s

assistant: ```c
int logging(char *filename, char *message) {
  FILE *fp;
  if ((fp = fopen(filename, "a+")) < 0) {
    fprintf(stderr, "openlogging: Failed to open file: %s\n", filename);
    return -1;
  }
  char buf[80];
  time_t now = time(0);
  struct tm tstruct;
  tstruct = *localtime(&now);
  strftime(buf, sizeof(buf), "%Y-%m-%d %X", &tstruct);
  char newmsg[256];
  snprintf(newmsg, sizeof(newmsg), "[%s]: %s", buf, message);
  fwrite(newmsg, 1, strlen(newmsg), fp);
  fclose(fp);
  return 0;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    $0x4,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  movl   $0x14,(%rax)
  mov    -0x8(%rbp),%rax
  lea    -0x4(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  mov    (%rax),%eax
  mov    %eax,-0xc(%rbp)
  mov    -0x8(%rbp),%rax
  mov    (%rax),%eax
  leave
  ret
```

assistant: ```c
int main() {
  int *x;
  int y;
  x = (int *)malloc(4);
  *x = 20;
  y = *x--;
  return *x;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x4,%edi
  call   <malloc@plt>
  movl   $0x14,(%rax)
  mov    -0x4(%rax),%eax
  add    $0x8,%rsp
  ret
```

assistant: ```c
int main() {
  int *x;
  int y;
  x = (int *)malloc(4);
  *x = 20;
  y = *x--;
  return *x;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x4,%edi
  call   <malloc@plt>
  movl   $0x14,(%rax)
  mov    -0x4(%rax),%eax
  add    $0x8,%rsp
  ret
```

assistant: ```c
int main() {
  int *x;
  int y;
  x = (int *)malloc(4);
  *x = 20;
  y = *x--;
  return *x;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x4,%edi
  call   <malloc@plt>
  movl   $0x14,(%rax)
  mov    -0x4(%rax),%eax
  add    $0x8,%rsp
  ret
```

assistant: ```c
int main() {
  int *x;
  int y;
  x = (int *)malloc(4);
  *x = 20;
  y = *x--;
  return *x;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<softfloat_shiftLeftM>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %edx,-0x28(%rbp)
  mov    %rcx,-0x38(%rbp)
  mov    -0x28(%rbp),%eax
  sar    $0x5,%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x14(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jge    L0
  mov    -0x28(%rbp),%eax
  and    $0x1f,%eax
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  je     L77
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x24(%rbp),%eax
  sub    -0x14(%rbp),%eax
  mov    -0xc(%rbp),%edx
  mov    -0x30(%rbp),%rsi
  mov    %eax,%edi
  call   <softfloat_shortShiftLeftM@plt>
  cmpl   $0x0,-0x14(%rbp)
  jne    L43
  jmp    L4
L77:
  mov    -0x24(%rbp),%eax
  sub    -0x14(%rbp),%eax
  cltq
  shl    $0x2,%rax
  sub    $0x4,%rax
  add    %rax,-0x30(%rbp)
  mov    -0x24(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    -0x4(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x24(%rbp),%eax
  sub    -0x14(%rbp),%eax
  mov    %eax,-0x10(%rbp)
  jmp    L42
L8:
  mov    -0x30(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x8(%rbp),%rax
  mov    %edx,(%rax)
  subq   $0x4,-0x30(%rbp)
  subq   $0x4,-0x8(%rbp)
  subl   $0x1,-0x10(%rbp)
L42:
  cmpl   $0x0,-0x10(%rbp)
  jne    L8
  jmp    L43
L0:
  mov    -0x24(%rbp),%eax
  mov    %eax,-0x14(%rbp)
L43:
  mov    -0x38(%rbp),%rax
  lea    0x4(%rax),%rdx
  mov    %rdx,-0x38(%rbp)
  movl   $0x0,(%rax)
  subl   $0x1,-0x14(%rbp)
  cmpl   $0x0,-0x14(%rbp)
  jne    L43
L4:
  leave
  ret
```

assistant: ```c
void softfloat_shiftLeftM(uint_fast8_t size_words, const uint32_t *aPtr, uint32_t count, uint32_t *zPtr) {
  uint32_t wordCount;
  uint_fast8_t innerCount;
  uint32_t *destPtr;
  uint_fast8_t i;
  wordCount = count >> 5;
  if (wordCount < size_words) {
    aPtr += 0;
    innerCount = count & 31;
    if (innerCount) {
      softfloat_shortShiftLeftM(size_words - wordCount, aPtr, innerCount, zPtr + (wordCount));
      if (!wordCount)
        return;
    } else {
      aPtr += ((size_words - wordCount) - 1);
      destPtr = zPtr + ((size_words)-1);
      for (i = size_words - wordCount; i; --i) {
        *destPtr = *aPtr;
        aPtr -= 1;
        destPtr -= 1;
      }
    }
    zPtr += 0;
  } else {
    wordCount = size_words;
  }
  do {
    *zPtr++ = 0;
    --wordCount;
  } while (wordCount);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<softfloat_shiftLeftM>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %edi,%eax
  mov    %rcx,%rbx
  mov    %edx,%ebp
  sar    $0x5,%ebp
  cmp    %edi,%ebp
  jge    L39
  and    $0x1f,%edx
  jne    L55
  mov    %edi,%edx
  sub    %ebp,%edx
  movslq %edx,%rcx
  lea    -0x4(%rsi,%rcx,4),%rsi
  cltq
  lea    -0x4(%rbx,%rax,4),%rdi
  je     L45
  lea    -0x1(%rdx),%ecx
  not    %rcx
  shl    $0x2,%rcx
  mov    $0x0,%eax
L26:
  mov    (%rsi,%rax,1),%edx
  mov    %edx,(%rdi,%rax,1)
  sub    $0x4,%rax
  cmp    %rcx,%rax
  jne    L26
  mov    %ebp,%eax
L39:
  lea    -0x1(%rax),%eax
  lea    0x4(%rbx,%rax,4),%rax
L69:
  add    $0x4,%rbx
  movl   $0x0,-0x4(%rbx)
  cmp    %rax,%rbx
  jne    L69
L2:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
L55:
  movslq %ebp,%rcx
  lea    (%rbx,%rcx,4),%rcx
  sub    %ebp,%eax
  mov    %eax,%edi
  call   <softfloat_shortShiftLeftM@plt>
  mov    %ebp,%eax
  test   %ebp,%ebp
  jne    L39
  jmp    L2
L45:
  mov    %ebp,%eax
  jmp    L39
```

assistant: ```c
void softfloat_shiftLeftM(uint_fast8_t size_words, const uint32_t *aPtr, uint32_t count, uint32_t *zPtr) {
  uint32_t wordCount;
  uint_fast8_t innerCount;
  uint32_t *destPtr;
  uint_fast8_t i;
  wordCount = count >> 5;
  if (wordCount < size_words) {
    aPtr += 0;
    innerCount = count & 31;
    if (innerCount) {
      softfloat_shortShiftLeftM(size_words - wordCount, aPtr, innerCount, zPtr + (wordCount));
      if (!wordCount)
        return;
    } else {
      aPtr += ((size_words - wordCount) - 1);
      destPtr = zPtr + ((size_words)-1);
      for (i = size_words - wordCount; i; --i) {
        *destPtr = *aPtr;
        aPtr -= 1;
        destPtr -= 1;
      }
    }
    zPtr += 0;
  } else {
    wordCount = size_words;
  }
  do {
    *zPtr++ = 0;
    --wordCount;
  } while (wordCount);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<softfloat_shiftLeftM>:
  endbr64
  push   %rbp
  mov    %rcx,%rbp
  push   %rbx
  mov    %edx,%ebx
  sar    $0x5,%ebx
  sub    $0x8,%rsp
  cmp    %edi,%ebx
  jge    L8
  mov    %edi,%r8d
  sub    %ebx,%r8d
  and    $0x1f,%edx
  jne    L34
  movslq %r8d,%rdx
  movslq %edi,%rdi
  xor    %eax,%eax
  lea    -0x4(%rsi,%rdx,4),%r8
  neg    %rdx
  lea    -0x4(%rcx,%rdi,4),%rsi
  shl    $0x2,%rdx
  nopw   0x0(%rax,%rax,1)
L32:
  mov    (%r8,%rax,1),%ecx
  mov    %ecx,(%rsi,%rax,1)
  sub    $0x4,%rax
  cmp    %rdx,%rax
  jne    L32
  mov    %ebx,%edi
L8:
  lea    -0x1(%rdi),%eax
  add    $0x8,%rsp
  mov    %rbp,%rdi
  xor    %esi,%esi
  pop    %rbx
  lea    0x4(,%rax,4),%rdx
  pop    %rbp
  jmp    1060 <memset@plt>
  nopl   (%rax)
L34:
  movslq %ebx,%rax
  mov    %r8d,%edi
  lea    (%rcx,%rax,4),%rcx
  call   <softfloat_shortShiftLeftM@plt>
  mov    %ebx,%edi
  test   %ebx,%ebx
  jne    L8
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
void softfloat_shiftLeftM(uint_fast8_t size_words, const uint32_t *aPtr, uint32_t count, uint32_t *zPtr) {
  uint32_t wordCount;
  uint_fast8_t innerCount;
  uint32_t *destPtr;
  uint_fast8_t i;
  wordCount = count >> 5;
  if (wordCount < size_words) {
    aPtr += 0;
    innerCount = count & 31;
    if (innerCount) {
      softfloat_shortShiftLeftM(size_words - wordCount, aPtr, innerCount, zPtr + (wordCount));
      if (!wordCount)
        return;
    } else {
      aPtr += ((size_words - wordCount) - 1);
      destPtr = zPtr + ((size_words)-1);
      for (i = size_words - wordCount; i; --i) {
        *destPtr = *aPtr;
        aPtr -= 1;
        destPtr -= 1;
      }
    }
    zPtr += 0;
  } else {
    wordCount = size_words;
  }
  do {
    *zPtr++ = 0;
    --wordCount;
  } while (wordCount);
}
```
user: What is the c source code of the assembly code below:

```asm
<softfloat_shiftLeftM>:
  endbr64
  push   %rbp
  mov    %rcx,%rbp
  push   %rbx
  mov    %edx,%ebx
  sar    $0x5,%ebx
  sub    $0x8,%rsp
  cmp    %edi,%ebx
  jge    L44
  mov    %edi,%r8d
  sub    %ebx,%r8d
  and    $0x1f,%edx
  jne    L27
  movslq %edi,%rdi
  movslq %ebx,%rdx
  movslq %r8d,%rax
  lea    0x0(,%rdi,4),%r10
  sub    %rdx,%rdi
  lea    -0x4(%rsi,%rax,4),%rcx
  lea    -0x4(%rbp,%r10,1),%r9
  shl    $0x2,%rdi
  lea    -0x8(%rsi,%rdi,1),%r11
  mov    %r9,%rdx
  sub    %r11,%rdx
  add    $0x8,%rdx
  cmp    $0x8,%rdx
  jbe    L7
  lea    -0x1(%r8),%edx
  cmp    $0x2,%edx
  jbe    L7
  mov    %r8d,%edx
  lea    -0x10(%rsi,%rdi,1),%rdi
  lea    -0x10(%rbp,%r10,1),%rsi
  xor    %eax,%eax
  shr    $0x2,%edx
  neg    %rdx
  shl    $0x4,%rdx
  nopw   0x0(%rax,%rax,1)
L24:
  movdqu (%rdi,%rax,1),%xmm0
  movups %xmm0,(%rsi,%rax,1)
  sub    $0x10,%rax
  cmp    %rax,%rdx
  jne    L24
  mov    %r8d,%edx
  mov    %r8d,%esi
  and    $0xfffffffc,%edx
  mov    %edx,%eax
  sub    %edx,%esi
  neg    %rax
  shl    $0x2,%rax
  add    %rax,%rcx
  add    %r9,%rax
  cmp    %edx,%r8d
  je     L40
  mov    (%rcx),%edx
  mov    %edx,(%rax)
  cmp    $0x1,%esi
  je     L40
  mov    -0x4(%rcx),%edx
  mov    %edx,-0x4(%rax)
  cmp    $0x2,%esi
  je     L40
  mov    -0x8(%rcx),%edx
  mov    %edx,-0x8(%rax)
L40:
  mov    %ebx,%edi
L44:
  lea    -0x1(%rdi),%eax
  add    $0x8,%rsp
  mov    %rbp,%rdi
  xor    %esi,%esi
  pop    %rbx
  lea    0x4(,%rax,4),%rdx
  pop    %rbp
  jmp    1060 <memset@plt>
  nopl   0x0(%rax,%rax,1)
L27:
  movslq %ebx,%rax
  mov    %r8d,%edi
  lea    (%rcx,%rax,4),%rcx
  call   <softfloat_shortShiftLeftM@plt>
  mov    %ebx,%edi
  test   %ebx,%ebx
  jne    L44
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
L7:
  neg    %rax
  lea    0x0(,%rax,4),%rdx
  xor    %eax,%eax
  nopl   0x0(%rax)
L63:
  mov    (%rcx,%rax,1),%esi
  mov    %esi,(%r9,%rax,1)
  sub    $0x4,%rax
  cmp    %rdx,%rax
  jne    L63
  mov    %ebx,%edi
  jmp    L44
```

assistant: ```c
void softfloat_shiftLeftM(uint_fast8_t size_words, const uint32_t *aPtr, uint32_t count, uint32_t *zPtr) {
  uint32_t wordCount;
  uint_fast8_t innerCount;
  uint32_t *destPtr;
  uint_fast8_t i;
  wordCount = count >> 5;
  if (wordCount < size_words) {
    aPtr += 0;
    innerCount = count & 31;
    if (innerCount) {
      softfloat_shortShiftLeftM(size_words - wordCount, aPtr, innerCount, zPtr + (wordCount));
      if (!wordCount)
        return;
    } else {
      aPtr += ((size_words - wordCount) - 1);
      destPtr = zPtr + ((size_words)-1);
      for (i = size_words - wordCount; i; --i) {
        *destPtr = *aPtr;
        aPtr -= 1;
        destPtr -= 1;
      }
    }
    zPtr += 0;
  } else {
    wordCount = size_words;
  }
  do {
    *zPtr++ = 0;
    --wordCount;
  } while (wordCount);
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<dvbdemux_set_pid_filter>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %esi,-0x28(%rbp)
  mov    %edx,-0x2c(%rbp)
  mov    %ecx,-0x30(%rbp)
  mov    %r8d,-0x34(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x20(%rbp),%rax
  mov    $0x14,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  cmpl   $0xffffffff,-0x28(%rbp)
  jne    L172
  movl   $0x2000,-0x20(%rbp)
  jmp    L86
L172:
  mov    -0x28(%rbp),%eax
  mov    %eax,-0x20(%rbp)
L86:
  cmpl   $0x0,-0x2c(%rbp)
  je     L122
  cmpl   $0x1,-0x2c(%rbp)
  je     L82
  jmp    L114
L122:
  mov    D99(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x10(%rbp)
  jmp    L7
L82:
  mov    D87(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x10(%rbp)
  jmp    L7
L114:
  mov    D93(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
  jmp    L100
L7:
  cmpl   $0x2,-0x30(%rbp)
  je     L1
  cmpl   $0x2,-0x30(%rbp)
  jg     L22
  cmpl   $0x0,-0x30(%rbp)
  je     L143
  cmpl   $0x1,-0x30(%rbp)
  je     L77
  jmp    L22
L143:
  mov    D6(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x14(%rbp)
  jmp    L13
L77:
  mov    D84(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x14(%rbp)
  jmp    L13
L1:
  mov    D4(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x14(%rbp)
  jmp    L13
L22:
  mov    D93(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
  jmp    L100
L13:
  mov    D39(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0x18(%rbp)
  cmpl   $0x0,-0x34(%rbp)
  je     L79
  mov    -0x1c(%rbp),%edx
  mov    D32(%rip),%rax
  mov    (%rax),%eax
  or     %edx,%eax
  mov    %eax,-0x1c(%rbp)
L79:
  mov    D37(%rip),%rax
  mov    (%rax),%ecx
  lea    -0x20(%rbp),%rdx
  mov    -0x24(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <ioctl@plt>
L100:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L183
  call   <__stack_chk_fail@plt>
L183:
  leave
  ret
```

assistant: ```c
int dvbdemux_set_pid_filter(int fd, int pid, int input, int output, int start) {
  struct dmx_pes_filter_params filter;
  memset(&filter, 0, sizeof(filter));
  if (pid == -1)
    filter.pid = 0x2000;
  else
    filter.pid = pid;
  switch (input) {
  case 0:
    filter.input = DMX_IN_FRONTEND;
    break;
  case 1:
    filter.input = DMX_IN_DVR;
    break;
  default:
    return -EINVAL;
  }
  switch (output) {
  case 0:
    filter.output = DMX_OUT_DECODER;
    break;
  case 1:
    filter.output = DMX_OUT_TAP;
    break;
  case 2:
    filter.output = DMX_OUT_TS_TAP;
    break;
  default:
    return -EINVAL;
  }
  filter.pes_type = DMX_PES_OTHER;
  if (start)
    filter.flags |= DMX_IMMEDIATE_START;
  return ioctl(fd, DMX_SET_PES_FILTER, &filter);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<dvbdemux_set_pid_filter>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x20,%rsp
  mov    %edi,%r13d
  mov    %esi,%ebx
  mov    %edx,%ebp
  mov    %ecx,%r12d
  mov    %r8d,%r14d
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rdi
  mov    $0x14,%edx
  mov    $0x0,%esi
  call   <memset@plt>
  cmp    $0xffffffff,%ebx
  mov    $0x2000,%eax
  cmove  %eax,%ebx
  mov    %ebx,(%rsp)
  test   %ebp,%ebp
  je     L14
  cmp    $0x1,%ebp
  je     L40
  mov    D34(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
  jmp    L43
L14:
  mov    D1(%rip),%rax
  mov    (%rax),%eax
L84:
  mov    %eax,0x10(%rsp)
  cmp    $0x1,%r12d
  je     L17
  cmp    $0x2,%r12d
  je     L77
  test   %r12d,%r12d
  je     L91
  mov    D34(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
  jmp    L43
L40:
  mov    D92(%rip),%rax
  mov    (%rax),%eax
  jmp    L84
L91:
  mov    D87(%rip),%rax
  mov    (%rax),%eax
L100:
  mov    %eax,0xc(%rsp)
  mov    D75(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,0x8(%rsp)
  test   %r14d,%r14d
  je     L54
  mov    D88(%rip),%rax
  mov    (%rax),%eax
  or     %eax,0x4(%rsp)
L54:
  mov    %rsp,%rdx
  mov    D22(%rip),%rax
  mov    (%rax),%esi
  mov    %r13d,%edi
  call   <ioctl@plt>
L43:
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L34
  add    $0x20,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L17:
  mov    D98(%rip),%rax
  mov    (%rax),%eax
  jmp    L100
L77:
  mov    D82(%rip),%rax
  mov    (%rax),%eax
  jmp    L100
L34:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int dvbdemux_set_pid_filter(int fd, int pid, int input, int output, int start) {
  struct dmx_pes_filter_params filter;
  memset(&filter, 0, sizeof(filter));
  if (pid == -1)
    filter.pid = 0x2000;
  else
    filter.pid = pid;
  switch (input) {
  case 0:
    filter.input = DMX_IN_FRONTEND;
    break;
  case 1:
    filter.input = DMX_IN_DVR;
    break;
  default:
    return -EINVAL;
  }
  switch (output) {
  case 0:
    filter.output = DMX_OUT_DECODER;
    break;
  case 1:
    filter.output = DMX_OUT_TAP;
    break;
  case 2:
    filter.output = DMX_OUT_TS_TAP;
    break;
  default:
    return -EINVAL;
  }
  filter.pes_type = DMX_PES_OTHER;
  if (start)
    filter.flags |= DMX_IMMEDIATE_START;
  return ioctl(fd, DMX_SET_PES_FILTER, &filter);
}
```
user: What is the c source code of the assembly code below:

```asm
<dvbdemux_set_pid_filter>:
  endbr64
  push   %r15
  push   %r14
  mov    %r8d,%r14d
  push   %r13
  mov    %edi,%r13d
  push   %r12
  mov    %ecx,%r12d
  push   %rbp
  mov    %edx,%ebp
  mov    $0x14,%edx
  push   %rbx
  mov    %esi,%ebx
  xor    %esi,%esi
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  mov    %rsp,%r15
  mov    %r15,%rdi
  call   <memset@plt>
  cmp    $0xffffffff,%ebx
  mov    $0x2000,%eax
  cmove  %eax,%ebx
  mov    %ebx,(%rsp)
  test   %ebp,%ebp
  je     L25
  cmp    $0x1,%ebp
  jne    L6
  mov    D7(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,0x10(%rsp)
  cmp    $0x1,%r12d
  je     L33
L74:
  cmp    $0x2,%r12d
  je     L36
  test   %r12d,%r12d
  je     L98
L6:
  mov    D23(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
L21:
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L22
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L25:
  mov    D69(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,0x10(%rsp)
  cmp    $0x1,%r12d
  jne    L74
L33:
  mov    D81(%rip),%rax
  mov    (%rax),%eax
  jmp    L79
  xchg   %ax,%ax
L98:
  mov    D75(%rip),%rax
  mov    (%rax),%eax
L79:
  mov    %eax,0xc(%rsp)
  mov    D26(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,0x8(%rsp)
  test   %r14d,%r14d
  je     L68
  mov    D6(%rip),%rax
  mov    (%rax),%eax
  or     %eax,0x4(%rsp)
L68:
  mov    D28(%rip),%rax
  mov    %r15,%rdx
  mov    %r13d,%edi
  mov    (%rax),%esi
  call   <ioctl@plt>
  jmp    L21
  nopl   (%rax)
L36:
  mov    D20(%rip),%rax
  mov    (%rax),%eax
  jmp    L79
L22:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int dvbdemux_set_pid_filter(int fd, int pid, int input, int output, int start) {
  struct dmx_pes_filter_params filter;
  memset(&filter, 0, sizeof(filter));
  if (pid == -1)
    filter.pid = 0x2000;
  else
    filter.pid = pid;
  switch (input) {
  case 0:
    filter.input = DMX_IN_FRONTEND;
    break;
  case 1:
    filter.input = DMX_IN_DVR;
    break;
  default:
    return -EINVAL;
  }
  switch (output) {
  case 0:
    filter.output = DMX_OUT_DECODER;
    break;
  case 1:
    filter.output = DMX_OUT_TAP;
    break;
  case 2:
    filter.output = DMX_OUT_TS_TAP;
    break;
  default:
    return -EINVAL;
  }
  filter.pes_type = DMX_PES_OTHER;
  if (start)
    filter.flags |= DMX_IMMEDIATE_START;
  return ioctl(fd, DMX_SET_PES_FILTER, &filter);
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<dvbdemux_set_pid_filter>:
  endbr64
  push   %r15
  push   %r14
  mov    %r8d,%r14d
  push   %r13
  mov    %edi,%r13d
  push   %r12
  mov    %ecx,%r12d
  push   %rbp
  mov    %edx,%ebp
  mov    $0x14,%edx
  push   %rbx
  mov    %esi,%ebx
  xor    %esi,%esi
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  mov    %rsp,%r15
  mov    %r15,%rdi
  call   <memset@plt>
  cmp    $0xffffffff,%ebx
  mov    $0x2000,%eax
  cmove  %eax,%ebx
  mov    %ebx,(%rsp)
  test   %ebp,%ebp
  je     L73
  cmp    $0x1,%ebp
  jne    L9
  mov    D13(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,0x10(%rsp)
  cmp    $0x1,%r12d
  je     L38
L99:
  cmp    $0x2,%r12d
  je     L0
  test   %r12d,%r12d
  je     L19
L9:
  mov    D9(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
L2:
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L5
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L73:
  mov    D86(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,0x10(%rsp)
  cmp    $0x1,%r12d
  jne    L99
L38:
  mov    D72(%rip),%rax
  movd   (%rax),%xmm1
  jmp    L68
L19:
  mov    D21(%rip),%rax
  movd   (%rax),%xmm1
L68:
  mov    D52(%rip),%rax
  movd   (%rax),%xmm0
  punpckldq %xmm1,%xmm0
  movq   %xmm0,0x8(%rsp)
  test   %r14d,%r14d
  je     L13
  mov    D66(%rip),%rax
  mov    (%rax),%eax
  or     %eax,0x4(%rsp)
L13:
  mov    D77(%rip),%rax
  mov    %r15,%rdx
  mov    %r13d,%edi
  mov    (%rax),%esi
  call   <ioctl@plt>
  jmp    L2
  nopl   0x0(%rax,%rax,1)
L0:
  mov    D71(%rip),%rax
  movd   (%rax),%xmm1
  jmp    L68
L5:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int dvbdemux_set_pid_filter(int fd, int pid, int input, int output, int start) {
  struct dmx_pes_filter_params filter;
  memset(&filter, 0, sizeof(filter));
  if (pid == -1)
    filter.pid = 0x2000;
  else
    filter.pid = pid;
  switch (input) {
  case 0:
    filter.input = DMX_IN_FRONTEND;
    break;
  case 1:
    filter.input = DMX_IN_DVR;
    break;
  default:
    return -EINVAL;
  }
  switch (output) {
  case 0:
    filter.output = DMX_OUT_DECODER;
    break;
  case 1:
    filter.output = DMX_OUT_TAP;
    break;
  case 2:
    filter.output = DMX_OUT_TS_TAP;
    break;
  default:
    return -EINVAL;
  }
  filter.pes_type = DMX_PES_OTHER;
  if (start)
    filter.flags |= DMX_IMMEDIATE_START;
  return ioctl(fd, DMX_SET_PES_FILTER, &filter);
}
```