ylfeng/ReF-Decompile-dataset huggingface dataset:
user: Translate the below assembly code into C programming language:

```asm
<sanitizestr>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  movzbl (%rdi),%ebp
  test   %bpl,%bpl
  je     L76
  mov    %rdi,%r12
  mov    %ebp,%edx
  mov    $0x1,%eax
  mov    $0x1,%ebx
L11:
  mov    %rbx,%rcx
  cmp    $0x5f,%dl
  sete   %bl
  movzbl %bl,%ebx
  lea    0x1(%rbx,%rcx,1),%rbx
  mov    %eax,%ecx
  add    $0x1,%rax
  movzbl -0x1(%r12,%rax,1),%edx
  test   %dl,%dl
  jne    L11
  cmp    %ebx,%ecx
  je     L89
  mov    %rbx,%rdi
  call   <malloc@plt>
  test   %rax,%rax
  je     L56
  lea    0x1(%r12),%rcx
  mov    $0x0,%edx
  jmp    L28
L89:
  mov    %r12,%rdi
  call   <strdup@plt>
  jmp    L56
L49:
  movslq %edx,%rsi
  movb   $0x5c,(%rax,%rsi,1)
  movb   $0x5f,0x1(%rax,%rsi,1)
  add    $0x2,%edx
L71:
  add    $0x1,%rcx
  movzbl -0x1(%rcx),%ebp
  test   %bpl,%bpl
  je     L31
L28:
  cmp    $0x5f,%bpl
  je     L49
  movslq %edx,%rsi
  mov    %bpl,(%rax,%rsi,1)
  add    $0x1,%edx
  jmp    L71
L76:
  mov    $0x1,%edi
  call   <malloc@plt>
  mov    $0x1,%ebx
  test   %rax,%rax
  je     L56
L31:
  movb   $0x0,-0x1(%rax,%rbx,1)
L56:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
char *sanitizestr(const char *str) {
  int i = 0;
  int j = 0;
  size_t nchars = 1;
  char *new;
  for (i = 0; str[i] != '\0'; i++) {
    if (str[i] == '_')
      nchars += 2;
    else
      nchars++;
  }
  if (i == (int)nchars)
    return strdup(str);
  if ((new = malloc(nchars)) == NULL)
    return NULL;
  for (i = 0; str[i] != '\0'; i++) {
    if (str[i] == '_') {
      new[j] = '\\';
      new[j + 1] = '_';
      j += 2;
    } else {
      new[j] = str[i];
      j++;
    }
  }
  new[nchars - 1] = '\0';
  return new;
}
```
user: Translate the below assembly code into C programming language:

```asm
<sanitizestr>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  movzbl (%rdi),%r12d
  test   %r12b,%r12b
  je     L82
  mov    %rdi,%rbp
  mov    %r12d,%edx
  mov    $0x1,%eax
  mov    $0x1,%ebx
  nopl   (%rax)
L89:
  mov    %rbx,%rcx
  xor    %ebx,%ebx
  cmp    $0x5f,%dl
  sete   %bl
  lea    0x1(%rbx,%rcx,1),%rbx
  mov    %eax,%ecx
  add    $0x1,%rax
  movzbl -0x1(%rbp,%rax,1),%edx
  test   %dl,%dl
  jne    L89
  cmp    %ebx,%ecx
  je     L94
  mov    %rbx,%rdi
  call   <malloc@plt>
  test   %rax,%rax
  je     L66
  lea    0x1(%rbp),%rdi
  xor    %edx,%edx
  jmp    L86
L5:
  add    $0x1,%rdi
  mov    %r12b,(%rsi)
  add    $0x1,%edx
  movzbl -0x1(%rdi),%r12d
  test   %r12b,%r12b
  je     L73
L86:
  movslq %edx,%rcx
  lea    (%rax,%rcx,1),%rsi
  cmp    $0x5f,%r12b
  jne    L5
  movzbl (%rdi),%r12d
  movb   $0x5c,(%rsi)
  add    $0x1,%rdi
  add    $0x2,%edx
  movb   $0x5f,0x1(%rax,%rcx,1)
  test   %r12b,%r12b
  jne    L86
L73:
  movb   $0x0,-0x1(%rax,%rbx,1)
L66:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L94:
  pop    %rbx
  mov    %rbp,%rdi
  pop    %rbp
  pop    %r12
  jmp    1070 <strdup@plt>
  nopl   0x0(%rax)
L82:
  mov    $0x1,%edi
  mov    $0x1,%ebx
  call   <malloc@plt>
  test   %rax,%rax
  jne    L73
  jmp    L66
```

assistant: ```c
char *sanitizestr(const char *str) {
  int i = 0;
  int j = 0;
  size_t nchars = 1;
  char *new;
  for (i = 0; str[i] != '\0'; i++) {
    if (str[i] == '_')
      nchars += 2;
    else
      nchars++;
  }
  if (i == (int)nchars)
    return strdup(str);
  if ((new = malloc(nchars)) == NULL)
    return NULL;
  for (i = 0; str[i] != '\0'; i++) {
    if (str[i] == '_') {
      new[j] = '\\';
      new[j + 1] = '_';
      j += 2;
    } else {
      new[j] = str[i];
      j++;
    }
  }
  new[nchars - 1] = '\0';
  return new;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<sanitizestr>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  movzbl (%rdi),%r12d
  test   %r12b,%r12b
  je     L28
  mov    %rdi,%rbp
  mov    %r12d,%edx
  mov    $0x1,%eax
  mov    $0x1,%ebx
  nopl   (%rax)
L54:
  mov    %rbx,%rcx
  xor    %ebx,%ebx
  cmp    $0x5f,%dl
  sete   %bl
  lea    0x1(%rbx,%rcx,1),%rbx
  mov    %eax,%ecx
  add    $0x1,%rax
  movzbl -0x1(%rbp,%rax,1),%edx
  test   %dl,%dl
  jne    L54
  cmp    %ebx,%ecx
  je     L77
  mov    %rbx,%rdi
  call   <malloc@plt>
  test   %rax,%rax
  je     L1
  lea    0x1(%rbp),%rdi
  xor    %edx,%edx
  xchg   %ax,%ax
L25:
  movslq %edx,%rcx
  lea    (%rax,%rcx,1),%rsi
  cmp    $0x5f,%r12b
  je     L57
  add    $0x1,%rdi
  mov    %r12b,(%rsi)
  add    $0x1,%edx
  movzbl -0x1(%rdi),%r12d
  test   %r12b,%r12b
  jne    L25
L94:
  movb   $0x0,-0x1(%rax,%rbx,1)
L1:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L57:
  add    $0x1,%rdi
  movb   $0x5c,(%rsi)
  add    $0x2,%edx
  movb   $0x5f,0x1(%rax,%rcx,1)
  movzbl -0x1(%rdi),%r12d
  test   %r12b,%r12b
  jne    L25
  jmp    L94
  nopl   0x0(%rax,%rax,1)
L77:
  pop    %rbx
  mov    %rbp,%rdi
  pop    %rbp
  pop    %r12
  jmp    1070 <strdup@plt>
  nopl   0x0(%rax)
L28:
  mov    $0x1,%edi
  mov    $0x1,%ebx
  call   <malloc@plt>
  test   %rax,%rax
  jne    L94
  jmp    L1
```

assistant: ```c
char *sanitizestr(const char *str) {
  int i = 0;
  int j = 0;
  size_t nchars = 1;
  char *new;
  for (i = 0; str[i] != '\0'; i++) {
    if (str[i] == '_')
      nchars += 2;
    else
      nchars++;
  }
  if (i == (int)nchars)
    return strdup(str);
  if ((new = malloc(nchars)) == NULL)
    return NULL;
  for (i = 0; str[i] != '\0'; i++) {
    if (str[i] == '_') {
      new[j] = '\\';
      new[j + 1] = '_';
      j += 2;
    } else {
      new[j] = str[i];
      j++;
    }
  }
  new[nchars - 1] = '\0';
  return new;
}
```
user: What is the c source code of the assembly code below:

```asm
<version>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  lea    D11(%rip),%rax
  mov    %rax,%rsi
  lea    D19(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x0,%edi
  call   <exit@plt>
  nop
  pop    %rbp
  ret
```

tool_calls: name: disassemble_data
arguments: label: D11
type_infered: string
name: disassemble_data
arguments: label: D19
type_infered: string

tool: D11: 1.0.16

tool: D19: D-Bus Message Bus Launcher %s
Copyright (C) 2003 Red Hat, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


assistant: ```c
void version(void) {
  printf("D-Bus Message Bus Launcher %s\n"
         "Copyright (C) 2003 Red Hat, Inc.\n"
         "This is free software; see the source for copying conditions.\n"
         "There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
         "1.0.16");
  exit(0);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<version>:
  endbr64
  sub    $0x8,%rsp
  lea    D18(%rip),%rsi
  lea    D9(%rip),%rdi
  call   <printf@plt>
  mov    $0x0,%edi
  call   <exit@plt>
  add    $0x8,%rsp
  ret
```

tool_calls: name: retrieve_data
arguments: label: D18
type_infered: string
name: retrieve_data
arguments: label: D9
type_infered: string

tool: D18: 1.0.16

tool: D9: D-Bus Message Bus Launcher %s
Copyright (C) 2003 Red Hat, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


assistant: ```c
void version(void) {
  printf("D-Bus Message Bus Launcher %s\n"
         "Copyright (C) 2003 Red Hat, Inc.\n"
         "This is free software; see the source for copying conditions.\n"
         "There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
         "1.0.16");
  exit(0);
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<version>:
  endbr64
  sub    $0x8,%rsp
  lea    D11(%rip),%rdi
  lea    D5(%rip),%rsi
  call   <printf@plt>
  xor    %edi,%edi
  add    $0x8,%rsp
  jmp    1070 <exit@plt>
```

tool_calls: name: retrieve_data
arguments: data_tag: D11
type_guessed: string
name: retrieve_data
arguments: data_tag: D5
type_guessed: string

tool: D11: D-Bus Message Bus Launcher %s
Copyright (C) 2003 Red Hat, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


tool: D5: 1.0.16

assistant: ```c
void version(void) {
  printf("D-Bus Message Bus Launcher %s\n"
         "Copyright (C) 2003 Red Hat, Inc.\n"
         "This is free software; see the source for copying conditions.\n"
         "There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
         "1.0.16");
  exit(0);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<version>:
  endbr64
  sub    $0x8,%rsp
  lea    D0(%rip),%rdi
  lea    D15(%rip),%rsi
  call   <printf@plt>
  xor    %edi,%edi
  add    $0x8,%rsp
  jmp    1070 <exit@plt>
```

tool_calls: name: read_data
arguments: label: D0
type_guessed: string
name: read_data
arguments: label: D15
type_guessed: string

tool: D0: D-Bus Message Bus Launcher %s
Copyright (C) 2003 Red Hat, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


tool: D15: 1.0.16

assistant: ```c
void version(void) {
  printf("D-Bus Message Bus Launcher %s\n"
         "Copyright (C) 2003 Red Hat, Inc.\n"
         "This is free software; see the source for copying conditions.\n"
         "There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n",
         "1.0.16");
  exit(0);
}
```
user: What is the c source code of the assembly code below:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  movl   $0x0,-0x8(%rbp)
  jmp    L21
L52:
  cmpl   $0x20,-0x4(%rbp)
  je     L19
  cmpl   $0x9,-0x4(%rbp)
  je     L19
  cmpl   $0xa,-0x4(%rbp)
  jne    L63
L19:
  cmpl   $0x0,-0x8(%rbp)
  je     L21
  movl   $0x0,-0x8(%rbp)
  mov    $0xa,%edi
  call   <putchar@plt>
  jmp    L21
L63:
  cmpl   $0x0,-0x8(%rbp)
  jne    L41
  movl   $0x1,-0x8(%rbp)
L41:
  mov    -0x4(%rbp),%eax
  mov    %eax,%edi
  call   <putchar@plt>
L21:
  mov    $0x0,%eax
  call   <getchar@plt>
  mov    %eax,-0x4(%rbp)
  mov    D7(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x4(%rbp)
  jne    L52
  mov    $0x0,%eax
  leave
  ret
```

assistant: ```c
int main() {
  int c;
  int in_word = 0;
  while ((c = getchar()) != EOF) {
    if (c == ' ' || c == '\t' || c == '\n') {
      if (in_word) {
        in_word = 0;
        putchar('\n');
      }
    } else {
      if (!in_word)
        in_word = 1;
      putchar(c);
    }
  }
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<main>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    $0x0,%ebx
  mov    $0x0,%ebp
  jmp    L66
L44:
  test   %ebx,%ebx
  jne    L2
L66:
  mov    $0x0,%eax
  call   <getchar@plt>
  mov    %eax,%edi
  mov    D2(%rip),%rax
  cmp    %edi,(%rax)
  je     L3
  lea    -0x9(%rdi),%eax
  cmp    $0x1,%eax
  jbe    L44
  cmp    $0x20,%edi
  je     L44
  call   <putchar@plt>
  mov    $0x1,%ebx
  jmp    L66
L2:
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    %ebp,%ebx
  jmp    L66
L3:
  mov    $0x0,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
int main() {
  int c;
  int in_word = 0;
  while ((c = getchar()) != EOF) {
    if (c == ' ' || c == '\t' || c == '\n') {
      if (in_word) {
        in_word = 0;
        putchar('\n');
      }
    } else {
      if (!in_word)
        in_word = 1;
      putchar(c);
    }
  }
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<main>:
  endbr64
  push   %rbp
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x8,%rsp
  mov    D5(%rip),%rbp
  nopl   0x0(%rax,%rax,1)
L48:
  xor    %eax,%eax
  call   <getchar@plt>
  mov    %eax,%edi
  cmp    %eax,0x0(%rbp)
  je     L29
L2:
  lea    -0x9(%rdi),%eax
  cmp    $0x1,%eax
  jbe    L11
  cmp    $0x20,%edi
  je     L11
  call   <putchar@plt>
  xor    %eax,%eax
  mov    $0x1,%ebx
  call   <getchar@plt>
  mov    %eax,%edi
  cmp    %eax,0x0(%rbp)
  jne    L2
L29:
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  ret
  nopl   0x0(%rax)
L11:
  test   %ebx,%ebx
  je     L48
  mov    $0xa,%edi
  xor    %ebx,%ebx
  call   <putchar@plt>
  jmp    L48
```

assistant: ```c
int main() {
  int c;
  int in_word = 0;
  while ((c = getchar()) != EOF) {
    if (c == ' ' || c == '\t' || c == '\n') {
      if (in_word) {
        in_word = 0;
        putchar('\n');
      }
    } else {
      if (!in_word)
        in_word = 1;
      putchar(c);
    }
  }
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<main>:
  endbr64
  push   %rbp
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x8,%rsp
  mov    D2(%rip),%rbp
  nopl   0x0(%rax,%rax,1)
L38:
  xor    %eax,%eax
  call   <getchar@plt>
  mov    %eax,%edi
  cmp    %eax,0x0(%rbp)
  je     L30
L31:
  lea    -0x9(%rdi),%eax
  cmp    $0x1,%eax
  jbe    L11
  cmp    $0x20,%edi
  je     L11
  call   <putchar@plt>
  xor    %eax,%eax
  mov    $0x1,%ebx
  call   <getchar@plt>
  mov    %eax,%edi
  cmp    %eax,0x0(%rbp)
  jne    L31
L30:
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  ret
  nopl   0x0(%rax)
L11:
  test   %ebx,%ebx
  je     L38
  mov    $0xa,%edi
  xor    %ebx,%ebx
  call   <putchar@plt>
  jmp    L38
```

assistant: ```c
int main() {
  int c;
  int in_word = 0;
  while ((c = getchar()) != EOF) {
    if (c == ' ' || c == '\t' || c == '\n') {
      if (in_word) {
        in_word = 0;
        putchar('\n');
      }
    } else {
      if (!in_word)
        in_word = 1;
      putchar(c);
    }
  }
}
```
user: Translate the below assembly code into C programming language:

```asm
<MMU_Disable>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    $0x0,%eax
  call   <__get_SCTLR@plt>
  and    $0xfffffffe,%eax
  mov    %eax,%edi
  call   <__set_SCTLR@plt>
  mov    $0x0,%eax
  call   <__ISB@plt>
  nop
  pop    %rbp
  ret
```

assistant: ```c
void MMU_Disable(void) {
  __set_SCTLR(__get_SCTLR() & ~1);
  __ISB();
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<MMU_Disable>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x0,%eax
  call   <__get_SCTLR@plt>
  and    $0xfffffffe,%eax
  mov    %eax,%edi
  call   <__set_SCTLR@plt>
  mov    $0x0,%eax
  call   <__ISB@plt>
  add    $0x8,%rsp
  ret
```

assistant: ```c
void MMU_Disable(void) {
  __set_SCTLR(__get_SCTLR() & ~1);
  __ISB();
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<MMU_Disable>:
  endbr64
  sub    $0x8,%rsp
  xor    %eax,%eax
  call   <__get_SCTLR@plt>
  and    $0xfffffffe,%eax
  mov    %eax,%edi
  call   <__set_SCTLR@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  jmp    1090 <__ISB@plt>
```

assistant: ```c
void MMU_Disable(void) {
  __set_SCTLR(__get_SCTLR() & ~1);
  __ISB();
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<MMU_Disable>:
  endbr64
  sub    $0x8,%rsp
  xor    %eax,%eax
  call   <__get_SCTLR@plt>
  and    $0xfffffffe,%eax
  mov    %eax,%edi
  call   <__set_SCTLR@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  jmp    1090 <__ISB@plt>
```

assistant: ```c
void MMU_Disable(void) {
  __set_SCTLR(__get_SCTLR() & ~1);
  __ISB();
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<extract7bit_dates>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    %ecx,-0x2c(%rbp)
  mov    -0x20(%rbp),%rax
  movl   $0xffffffff,(%rax)
  mov    -0x28(%rbp),%rax
  movl   $0xffffffff,(%rax)
  jmp    L78
L156:
  addq   $0x1,-0x18(%rbp)
L146:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L11
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L156
L11:
  movl   $0x0,-0x10(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  jmp    L134
L110:
  addl   $0x1,-0x10(%rbp)
  addq   $0x1,-0x8(%rbp)
L134:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L96
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  mov    %eax,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L110
L96:
  cmpl   $0x4,-0x10(%rbp)
  jne    L116
  cmpl   $0x0,-0x2c(%rbp)
  je     L18
L116:
  cmpl   $0x0,-0x2c(%rbp)
  je     L87
  cmpl   $0x3,-0x10(%rbp)
  jle    L87
  cmpl   $0x8,-0x10(%rbp)
  jg     L87
L18:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <atoi@plt>
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0x2c(%rbp)
  je     L25
  cmpl   $0x4,-0x10(%rbp)
  jne    L25
  mov    -0xc(%rbp),%eax
  imul   $0x2710,%eax,%eax
  mov    %eax,-0xc(%rbp)
L25:
  mov    -0x20(%rbp),%rax
  mov    (%rax),%eax
  test   %eax,%eax
  js     L53
  mov    -0x20(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,-0xc(%rbp)
  jge    L14
L53:
  mov    -0x20(%rbp),%rax
  mov    -0xc(%rbp),%edx
  mov    %edx,(%rax)
L14:
  mov    -0x28(%rbp),%rax
  mov    (%rax),%eax
  test   %eax,%eax
  js     L88
  mov    -0x28(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,-0xc(%rbp)
  jle    L87
L88:
  mov    -0x28(%rbp),%rax
  mov    -0xc(%rbp),%edx
  mov    %edx,(%rax)
L87:
  mov    -0x8(%rbp),%rax
  mov    %rax,-0x18(%rbp)
L78:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L146
  mov    -0x20(%rbp),%rax
  mov    (%rax),%eax
  leave
  ret
```

assistant: ```c
int extract7bit_dates(const char *buf, int *first, int *last, int longdate) {
  *first = -1;
  *last = -1;
  while (*buf) {
    const char *e;
    int len;
    while (*buf && !isdigit(*(unsigned char *)buf))
      buf++;
    len = 0;
    for (e = buf; *e && isdigit(*(unsigned char *)e); e++)
      len++;
    if ((len == 4 && !longdate) || (longdate && len >= 4 && len <= 8)) {
      int value = atoi(buf);
      if (longdate && len == 4)
        value *= 10000;
      if (*first < 0 || value < *first)
        *first = value;
      if (*last < 0 || value > *last)
        *last = value;
    }
    buf = e;
  }
  return *first;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<extract7bit_dates>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbx
  mov    %rsi,%rbp
  mov    %rdx,%r13
  mov    %ecx,%r12d
  movl   $0xffffffff,(%rsi)
  movl   $0xffffffff,(%rdx)
  cmpb   $0x0,(%rdi)
  jne    L115
L130:
  mov    0x0(%rbp),%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L147:
  movzbl (%rbx),%edi
  test   %dil,%dil
  je     L104
  mov    %rbx,%r14
  mov    $0x0,%r15d
L111:
  movzbl %dil,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L4
  add    $0x1,%r15d
  add    $0x1,%r14
  movzbl (%r14),%edi
  test   %dil,%dil
  jne    L111
L4:
  cmp    $0x4,%r15d
  jne    L8
  test   %r12d,%r12d
  jne    L8
  mov    %rbx,%rdi
  call   <atoi@plt>
L184:
  mov    0x0(%rbp),%edx
  cmp    %eax,%edx
  jg     L134
  test   %edx,%edx
  jns    L1
L134:
  mov    %eax,0x0(%rbp)
L1:
  test   %eax,%eax
  mov    $0x0,%edx
  cmovns %eax,%edx
  mov    %r14,%rbx
  cmp    %edx,0x0(%r13)
  jge    L104
  mov    %eax,0x0(%r13)
  jmp    L104
L8:
  lea    -0x4(%r15),%eax
  cmp    $0x4,%eax
  ja     L161
  test   %r12d,%r12d
  jne    L178
L161:
  mov    %r14,%rbx
L104:
  cmpb   $0x0,(%rbx)
  je     L130
L115:
  movzbl (%rbx),%edi
  test   %dil,%dil
  je     L104
L127:
  movzbl %dil,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L147
  add    $0x1,%rbx
  movzbl (%rbx),%edi
  test   %dil,%dil
  jne    L127
  jmp    L104
L178:
  mov    %rbx,%rdi
  call   <atoi@plt>
  cmp    $0x4,%r15d
  jne    L184
  imul   $0x2710,%eax,%eax
  jmp    L184
```

assistant: ```c
int extract7bit_dates(const char *buf, int *first, int *last, int longdate) {
  *first = -1;
  *last = -1;
  while (*buf) {
    const char *e;
    int len;
    while (*buf && !isdigit(*(unsigned char *)buf))
      buf++;
    len = 0;
    for (e = buf; *e && isdigit(*(unsigned char *)e); e++)
      len++;
    if ((len == 4 && !longdate) || (longdate && len >= 4 && len <= 8)) {
      int value = atoi(buf);
      if (longdate && len == 4)
        value *= 10000;
      if (*first < 0 || value < *first)
        *first = value;
      if (*last < 0 || value > *last)
        *last = value;
    }
    buf = e;
  }
  return *first;
}
```
user: What is the c source code of the assembly code below:

```asm
<extract7bit_dates>:
  endbr64
  push   %r15
  mov    %rdi,%r15
  push   %r14
  push   %r13
  mov    %rdx,%r13
  push   %r12
  mov    %ecx,%r12d
  push   %rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x8,%rsp
  movl   $0xffffffff,(%rsi)
  movl   $0xffffffff,(%rdx)
  movzbl (%rdi),%edi
  test   %dil,%dil
  je     L35
  cs nopw 0x0(%rax,%rax,1)
L155:
  mov    %r15,%rbp
  jmp    L92
  nopl   (%rax)
L97:
  movzbl 0x1(%rbp),%edi
  add    $0x1,%rbp
  test   %dil,%dil
  je     L158
L92:
  call   <isdigit@plt>
  test   %rax,%rax
  je     L97
  movzbl 0x0(%rbp),%edi
  test   %dil,%dil
  je     L35
  mov    %rbp,%r15
  xor    %r14d,%r14d
  jmp    L60
  nopl   0x0(%rax)
L113:
  movzbl 0x1(%r15),%edi
  add    $0x1,%r15
  add    $0x1,%r14d
  test   %dil,%dil
  je     L169
L60:
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L113
L169:
  cmp    $0x4,%r14d
  jne    L183
  test   %r12d,%r12d
  jne    L183
  mov    %rbp,%rdi
  call   <atoi@plt>
L22:
  mov    (%rbx),%edx
  cmp    %eax,%edx
  jg     L66
  test   %edx,%edx
  jns    L65
L66:
  mov    %eax,(%rbx)
L65:
  xor    %edx,%edx
  test   %eax,%eax
  cmovns %eax,%edx
  cmp    %edx,0x0(%r13)
  jge    L25
  mov    %eax,0x0(%r13)
L25:
  movzbl (%r15),%edi
  test   %dil,%dil
  jne    L155
L35:
  mov    (%rbx),%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L183:
  lea    -0x4(%r14),%eax
  cmp    $0x4,%eax
  ja     L25
  test   %r12d,%r12d
  je     L25
  mov    %rbp,%rdi
  call   <atoi@plt>
  cmp    $0x4,%r14d
  jne    L22
  imul   $0x2710,%eax,%eax
  jmp    L22
  nopl   0x0(%rax)
L158:
  mov    %rbp,%r15
  jmp    L25
```

assistant: ```c
int extract7bit_dates(const char *buf, int *first, int *last, int longdate) {
  *first = -1;
  *last = -1;
  while (*buf) {
    const char *e;
    int len;
    while (*buf && !isdigit(*(unsigned char *)buf))
      buf++;
    len = 0;
    for (e = buf; *e && isdigit(*(unsigned char *)e); e++)
      len++;
    if ((len == 4 && !longdate) || (longdate && len >= 4 && len <= 8)) {
      int value = atoi(buf);
      if (longdate && len == 4)
        value *= 10000;
      if (*first < 0 || value < *first)
        *first = value;
      if (*last < 0 || value > *last)
        *last = value;
    }
    buf = e;
  }
  return *first;
}
```