ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<do_write>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  movq   $0x0,-0x10(%rbp)
  movq   $0x0,-0x8(%rbp)
  jmp    L57
L37:
  mov    -0x28(%rbp),%rax
  sub    -0x10(%rbp),%rax
  mov    %rax,%rdx
  mov    -0x10(%rbp),%rcx
  mov    -0x20(%rbp),%rax
  add    %rax,%rcx
  mov    -0x14(%rbp),%eax
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <write@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0xffffffffffffffff,-0x8(%rbp)
  jne    L16
  mov    D9(%rip),%rax
  mov    (%rax),%rdx
  mov    D11(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  je     L16
  mov    -0x8(%rbp),%rax
  jmp    L75
L16:
  cmpq   $0x0,-0x8(%rbp)
  jne    L29
  mov    -0x8(%rbp),%rax
  jmp    L75
L29:
  cmpq   $0x0,-0x8(%rbp)
  jle    L57
  mov    -0x8(%rbp),%rax
  add    %rax,-0x10(%rbp)
L57:
  mov    -0x10(%rbp),%rax
  cmp    -0x28(%rbp),%rax
  jl     L37
  mov    -0x10(%rbp),%rax
L75:
  leave
  ret
```

assistant: ```c
ssize_t do_write(int fd, char *buf, ssize_t cc) {
  ssize_t off = 0;
  ssize_t n = 0;
  while (off < cc) {
    n = write(fd, buf + off, cc - off);
    if (n == -1 && errno != EAGAIN)
      return n;
    if (n == 0)
      return n;
    if (n > 0) {
      off += n;
    }
  }
  return off;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<do_write>:
  endbr64
  test   %rdx,%rdx
  jle    L22
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %edi,%r12d
  mov    %rsi,%r13
  mov    %rdx,%rbp
  mov    $0x0,%ebx
  jmp    L9
L20:
  mov    D18(%rip),%rcx
  mov    D19(%rip),%rdx
  mov    (%rdx),%rdi
  cmp    %rdi,(%rcx)
  jne    L57
L8:
  cmp    %rbx,%rbp
  jle    L2
L9:
  mov    %rbp,%rdx
  sub    %rbx,%rdx
  lea    0x0(%r13,%rbx,1),%rsi
  mov    %r12d,%edi
  call   <write@plt>
  cmp    $0xffffffffffffffff,%rax
  je     L20
  test   %rax,%rax
  je     L57
  lea    (%rbx,%rax,1),%rdx
  cmovg  %rdx,%rbx
  jmp    L8
L2:
  mov    %rbx,%rax
L57:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L22:
  mov    $0x0,%eax
  ret
```

assistant: ```c
ssize_t do_write(int fd, char *buf, ssize_t cc) {
  ssize_t off = 0;
  ssize_t n = 0;
  while (off < cc) {
    n = write(fd, buf + off, cc - off);
    if (n == -1 && errno != EAGAIN)
      return n;
    if (n == 0)
      return n;
    if (n > 0) {
      off += n;
    }
  }
  return off;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<do_write>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  test   %rdx,%rdx
  jle    L58
  mov    %edi,%ebp
  mov    %rsi,%r13
  mov    %rdx,%rbx
  xor    %r12d,%r12d
  jmp    L49
L16:
  test   %rax,%rax
  je     L58
  lea    (%r12,%rax,1),%rdx
  cmovg  %rdx,%r12
L13:
  cmp    %rbx,%r12
  jge    L46
L49:
  mov    %rbx,%rdx
  lea    0x0(%r13,%r12,1),%rsi
  mov    %ebp,%edi
  sub    %r12,%rdx
  call   <write@plt>
  cmp    $0xffffffffffffffff,%rax
  jne    L16
  mov    D0(%rip),%rax
  mov    D12(%rip),%rdx
  mov    (%rax),%rax
  cmp    %rax,(%rdx)
  je     L13
  mov    $0xffffffffffffffff,%r12
L46:
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   (%rax)
L58:
  add    $0x8,%rsp
  xor    %r12d,%r12d
  pop    %rbx
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
ssize_t do_write(int fd, char *buf, ssize_t cc) {
  ssize_t off = 0;
  ssize_t n = 0;
  while (off < cc) {
    n = write(fd, buf + off, cc - off);
    if (n == -1 && errno != EAGAIN)
      return n;
    if (n == 0)
      return n;
    if (n > 0) {
      off += n;
    }
  }
  return off;
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<do_write>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  test   %rdx,%rdx
  jle    L7
  mov    %edi,%ebp
  mov    %rsi,%r13
  mov    %rdx,%rbx
  xor    %r12d,%r12d
  jmp    L21
L53:
  test   %rax,%rax
  je     L7
  lea    (%r12,%rax,1),%rdx
  cmovg  %rdx,%r12
L54:
  cmp    %rbx,%r12
  jge    L0
L21:
  mov    %rbx,%rdx
  lea    0x0(%r13,%r12,1),%rsi
  mov    %ebp,%edi
  sub    %r12,%rdx
  call   <write@plt>
  cmp    $0xffffffffffffffff,%rax
  jne    L53
  mov    D14(%rip),%rax
  mov    D19(%rip),%rdx
  mov    (%rax),%rax
  cmp    %rax,(%rdx)
  je     L54
  mov    $0xffffffffffffffff,%r12
L0:
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   (%rax)
L7:
  add    $0x8,%rsp
  xor    %r12d,%r12d
  pop    %rbx
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
ssize_t do_write(int fd, char *buf, ssize_t cc) {
  ssize_t off = 0;
  ssize_t n = 0;
  while (off < cc) {
    n = write(fd, buf + off, cc - off);
    if (n == -1 && errno != EAGAIN)
      return n;
    if (n == 0)
      return n;
    if (n > 0) {
      off += n;
    }
  }
  return off;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<my_str_isupper>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  movl   $0x0,-0x4(%rbp)
  jmp    L17
L6:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x40,%al
  jle    L19
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x5a,%al
  jg     L19
  addl   $0x1,-0x4(%rbp)
  jmp    L17
L19:
  mov    $0x0,%eax
  jmp    L34
L17:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L6
  mov    $0x1,%eax
L34:
  pop    %rbp
  ret
```

assistant: ```c
int my_str_isupper(char *str) {
  int i;
  i = 0;
  while (str[i] != '\0') {
    if (str[i] >= 'A' && str[i] <= 'Z')
      i++;
    else
      return (0);
  }
  return (1);
}
```
user: Translate the below assembly code into C programming language:

```asm
<my_str_isupper>:
  endbr64
  movzbl (%rdi),%eax
  test   %al,%al
  je     L11
  add    $0x1,%rdi
L3:
  sub    $0x41,%eax
  cmp    $0x19,%al
  ja     L7
  add    $0x1,%rdi
  movzbl -0x1(%rdi),%eax
  test   %al,%al
  jne    L3
  mov    $0x1,%eax
  ret
L11:
  mov    $0x1,%eax
  ret
L7:
  mov    $0x0,%eax
  ret
```

assistant: ```c
int my_str_isupper(char *str) {
  int i;
  i = 0;
  while (str[i] != '\0') {
    if (str[i] >= 'A' && str[i] <= 'Z')
      i++;
    else
      return (0);
  }
  return (1);
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<my_str_isupper>:
  endbr64
  movzbl (%rdi),%eax
  test   %al,%al
  je     L21
  add    $0x1,%rdi
  jmp    L38
  nopl   0x0(%rax)
L37:
  movzbl (%rdi),%eax
  add    $0x1,%rdi
  test   %al,%al
  je     L21
L38:
  sub    $0x41,%eax
  cmp    $0x19,%al
  jbe    L37
  xor    %eax,%eax
  ret
  nopl   (%rax)
L21:
  mov    $0x1,%eax
  ret
```

assistant: ```c
int my_str_isupper(char *str) {
  int i;
  i = 0;
  while (str[i] != '\0') {
    if (str[i] >= 'A' && str[i] <= 'Z')
      i++;
    else
      return (0);
  }
  return (1);
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<my_str_isupper>:
  endbr64
  movzbl (%rdi),%eax
  test   %al,%al
  je     L3
  add    $0x1,%rdi
  jmp    L32
  nopl   0x0(%rax)
L8:
  movzbl (%rdi),%eax
  add    $0x1,%rdi
  test   %al,%al
  je     L3
L32:
  sub    $0x41,%eax
  cmp    $0x19,%al
  jbe    L8
  xor    %eax,%eax
  ret
  nopl   (%rax)
L3:
  mov    $0x1,%eax
  ret
```

assistant: ```c
int my_str_isupper(char *str) {
  int i;
  i = 0;
  while (str[i] != '\0') {
    if (str[i] >= 'A' && str[i] <= 'Z')
      i++;
    else
      return (0);
  }
  return (1);
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<validuser>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isalpha@plt>
  test   %eax,%eax
  jne    L9
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x5f,%al
  je     L9
  mov    $0x0,%eax
  jmp    L52
L9:
  addq   $0x1,-0x8(%rbp)
  jmp    L7
L27:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,%edi
  call   <isalnum@plt>
  test   %eax,%eax
  jne    L14
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x5f,%al
  je     L14
  mov    $0x0,%eax
  jmp    L52
L14:
  addq   $0x1,-0x8(%rbp)
L7:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L27
  mov    $0x1,%eax
L52:
  leave
  ret
```

assistant: ```c
bool validuser(char *s) {
  if (!isalpha(s[0]) && s[0] != '_')
    return false;
  for (s++; s[0]; s++)
    if (!isalnum(s[0]) && s[0] != '_')
      return false;
  return true;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<validuser>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbp
  movsbl (%rdi),%edi
  call   <isalpha@plt>
  test   %eax,%eax
  jne    L15
  cmpb   $0x5f,0x0(%rbp)
  jne    L10
L15:
  lea    0x1(%rbp),%rbx
  movzbl 0x1(%rbp),%edi
  test   %dil,%dil
  jne    L64
  mov    $0x1,%eax
  jmp    L10
L6:
  add    $0x1,%rbx
  movzbl (%rbx),%edi
  test   %dil,%dil
  je     L34
L64:
  movsbl %dil,%edi
  call   <isalnum@plt>
  test   %eax,%eax
  jne    L6
  cmpb   $0x5f,(%rbx)
  je     L6
  jmp    L10
L34:
  mov    $0x1,%eax
L10:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
bool validuser(char *s) {
  if (!isalpha(s[0]) && s[0] != '_')
    return false;
  for (s++; s[0]; s++)
    if (!isalnum(s[0]) && s[0] != '_')
      return false;
  return true;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<validuser>:
  endbr64
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x8,%rsp
  movsbl (%rdi),%edi
  call   <isalpha@plt>
  test   %eax,%eax
  jne    L20
  cmpb   $0x5f,0x0(%rbp)
  jne    L31
L20:
  movsbl 0x1(%rbp),%edi
  lea    0x1(%rbp),%rbx
  test   %dil,%dil
  je     L35
  nopl   0x0(%rax)
L59:
  call   <isalnum@plt>
  test   %eax,%eax
  jne    L30
  cmpb   $0x5f,(%rbx)
  jne    L31
L30:
  movsbl 0x1(%rbx),%edi
  add    $0x1,%rbx
  test   %dil,%dil
  jne    L59
L35:
  add    $0x8,%rsp
  mov    $0x1,%eax
  pop    %rbx
  pop    %rbp
  ret
  nopw   0x0(%rax,%rax,1)
L31:
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
bool validuser(char *s) {
  if (!isalpha(s[0]) && s[0] != '_')
    return false;
  for (s++; s[0]; s++)
    if (!isalnum(s[0]) && s[0] != '_')
      return false;
  return true;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<validuser>:
  endbr64
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x8,%rsp
  movsbl (%rdi),%edi
  call   <isalpha@plt>
  test   %eax,%eax
  jne    L32
  cmpb   $0x5f,0x0(%rbp)
  jne    L53
L32:
  movsbl 0x1(%rbp),%edi
  lea    0x1(%rbp),%rbx
  test   %dil,%dil
  je     L9
  nopl   0x0(%rax)
L48:
  call   <isalnum@plt>
  test   %eax,%eax
  jne    L41
  cmpb   $0x5f,(%rbx)
  jne    L53
L41:
  movsbl 0x1(%rbx),%edi
  add    $0x1,%rbx
  test   %dil,%dil
  jne    L48
L9:
  add    $0x8,%rsp
  mov    $0x1,%eax
  pop    %rbx
  pop    %rbp
  ret
  nopw   0x0(%rax,%rax,1)
L53:
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
bool validuser(char *s) {
  if (!isalpha(s[0]) && s[0] != '_')
    return false;
  for (s++; s[0]; s++)
    if (!isalnum(s[0]) && s[0] != '_')
      return false;
  return true;
}
```
user: What is the c source code of the assembly code below:

```asm
<ipv6_endpoint>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <getport@plt>
  mov    %eax,-0x10(%rbp)
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <gethost@plt>
  mov    %rax,-0x8(%rbp)
  cmpl   $0x0,-0x10(%rbp)
  js     L9
  cmpq   $0x0,-0x8(%rbp)
  jne    L28
L9:
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    $0xffffffff,%eax
  jmp    L27
L28:
  mov    -0x10(%rbp),%edx
  mov    -0x8(%rbp),%rcx
  mov    -0x18(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <ipv6_hostport@plt>
  mov    %eax,-0xc(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    $0x0,%eax
L27:
  leave
  ret
```

assistant: ```c
int ipv6_endpoint(struct sockaddr_in6 *sa, const char *ep) {
  int rc, port;
  char *host;
  port = getport(ep);
  host = gethost(ep);
  if (port < 0 || !host) {
    free(host);
    return -1;
  }
  rc = ipv6_hostport(sa, host, port);
  free(host);
  return 0;
}
```
user: What is the c source code of the assembly code below?

```asm
<ipv6_endpoint>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%r12
  mov    %rsi,%rbx
  mov    %rsi,%rdi
  call   <getport@plt>
  mov    %eax,%ebp
  mov    %rbx,%rdi
  call   <gethost@plt>
  mov    %rax,%rbx
  test   %ebp,%ebp
  js     L13
  test   %rax,%rax
  je     L13
  mov    %ebp,%edx
  mov    %rax,%rsi
  mov    %r12,%rdi
  call   <ipv6_hostport@plt>
  mov    %rbx,%rdi
  call   <free@plt>
  mov    $0x0,%eax
L17:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L13:
  mov    %rbx,%rdi
  call   <free@plt>
  mov    $0xffffffff,%eax
  jmp    L17
```

assistant: ```c
int ipv6_endpoint(struct sockaddr_in6 *sa, const char *ep) {
  int rc, port;
  char *host;
  port = getport(ep);
  host = gethost(ep);
  if (port < 0 || !host) {
    free(host);
    return -1;
  }
  rc = ipv6_hostport(sa, host, port);
  free(host);
  return 0;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<ipv6_endpoint>:
  endbr64
  push   %r13
  mov    %rdi,%r13
  mov    %rsi,%rdi
  push   %r12
  push   %rbp
  mov    %rsi,%rbp
  call   <getport@plt>
  mov    %rbp,%rdi
  mov    %eax,%r12d
  call   <gethost@plt>
  mov    %rax,%rbp
  test   %r12d,%r12d
  js     L22
  test   %rax,%rax
  je     L22
  mov    %r12d,%edx
  mov    %rax,%rsi
  mov    %r13,%rdi
  call   <ipv6_hostport@plt>
  mov    %rbp,%rdi
  call   <free@plt>
  xor    %eax,%eax
L7:
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   (%rax)
L22:
  mov    %rbp,%rdi
  call   <free@plt>
  mov    $0xffffffff,%eax
  jmp    L7
```

assistant: ```c
int ipv6_endpoint(struct sockaddr_in6 *sa, const char *ep) {
  int rc, port;
  char *host;
  port = getport(ep);
  host = gethost(ep);
  if (port < 0 || !host) {
    free(host);
    return -1;
  }
  rc = ipv6_hostport(sa, host, port);
  free(host);
  return 0;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<ipv6_endpoint>:
  endbr64
  push   %r13
  mov    %rdi,%r13
  mov    %rsi,%rdi
  push   %r12
  push   %rbp
  mov    %rsi,%rbp
  call   <getport@plt>
  mov    %rbp,%rdi
  mov    %eax,%r12d
  call   <gethost@plt>
  mov    %rax,%rbp
  test   %r12d,%r12d
  js     L7
  test   %rax,%rax
  je     L7
  mov    %r12d,%edx
  mov    %rax,%rsi
  mov    %r13,%rdi
  call   <ipv6_hostport@plt>
  mov    %rbp,%rdi
  call   <free@plt>
  xor    %eax,%eax
L16:
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   (%rax)
L7:
  mov    %rbp,%rdi
  call   <free@plt>
  mov    $0xffffffff,%eax
  jmp    L16
```

assistant: ```c
int ipv6_endpoint(struct sockaddr_in6 *sa, const char *ep) {
  int rc, port;
  char *host;
  port = getport(ep);
  host = gethost(ep);
  if (port < 0 || !host) {
    free(host);
    return -1;
  }
  rc = ipv6_hostport(sa, host, port);
  free(host);
  return 0;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<dng_restore_metadata>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x800,%rsp
  mov    %rdi,-0x7f8(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x7f8(%rbp),%rax
  mov    %rax,%rsi
  lea    D38(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    -0x7f8(%rbp),%rdx
  lea    -0x7e0(%rbp),%rax
  mov    %rdx,%rcx
  lea    D30(%rip),%rdx
  mov    $0x3e8,%esi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <snprintf@plt>
  mov    %eax,-0x7e8(%rbp)
  mov    -0x7e8(%rbp),%eax
  sub    $0x3,%eax
  cltq
  movb   $0x6a,-0x7e0(%rbp,%rax,1)
  mov    -0x7e8(%rbp),%eax
  sub    $0x2,%eax
  cltq
  movb   $0x73,-0x7e0(%rbp,%rax,1)
  mov    -0x7e8(%rbp),%eax
  sub    $0x1,%eax
  cltq
  movb   $0x6f,-0x7e0(%rbp,%rax,1)
  mov    -0x7e8(%rbp),%eax
  cltq
  movb   $0x6e,-0x7e0(%rbp,%rax,1)
  mov    -0x7e8(%rbp),%eax
  add    $0x1,%eax
  cltq
  movb   $0x0,-0x7e0(%rbp,%rax,1)
  mov    -0x7f8(%rbp),%rcx
  lea    -0x7e0(%rbp),%rdx
  lea    -0x3f0(%rbp),%rax
  mov    %rcx,%r8
  mov    %rdx,%rcx
  lea    D36(%rip),%rdx
  mov    $0x3e8,%esi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <snprintf@plt>
  lea    -0x3f0(%rbp),%rax
  mov    %rax,%rdi
  call   <system@plt>
  mov    %eax,-0x7e4(%rbp)
  cmpl   $0x0,-0x7e4(%rbp)
  je     L2
  mov    -0x7f8(%rbp),%rax
  mov    %rax,%rsi
  lea    D10(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  jmp    L29
L2:
  lea    -0x7e0(%rbp),%rax
  mov    %rax,%rdi
  call   <unlink@plt>
L29:
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L7
  call   <__stack_chk_fail@plt>
L7:
  leave
  ret
```

tool_calls: name: parse_data
arguments: data_label: D38
data_type: string
name: parse_data
arguments: data_label: D30
data_type: string
name: parse_data
arguments: data_label: D36
data_type: string
name: parse_data
arguments: data_label: D10
data_type: string

tool: D38: %-16s: restoring metadata


tool: D30: %s

tool: D36: exiftool "-json=%s" "%s" -q -overwrite_original

tool: D10: %-16s: could not restore metadata


assistant: ```c
void dng_restore_metadata(const char *dng_file) {
  printf("%-16s: restoring metadata\n", dng_file);
  char json_file[1000];
  int len = snprintf(json_file, sizeof(json_file), "%s", dng_file);
  json_file[len - 3] = 'j';
  json_file[len - 2] = 's';
  json_file[len - 1] = 'o';
  json_file[len - 0] = 'n';
  json_file[len + 1] = '\0';
  char exif_cmd[1000];
  snprintf(exif_cmd, sizeof(exif_cmd), "exiftool \"-json=%s\" \"%s\" -q -overwrite_original", json_file, dng_file);
  int r = system(exif_cmd);
  if (r != 0) {
    printf("%-16s: could not restore metadata\n", dng_file);
    return;
  }
  unlink(json_file);
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<dng_restore_metadata>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x7e0,%rsp
  mov    %rdi,%rbx
  mov    %fs:0x28,%rax
  mov    %rax,0x7d8(%rsp)
  xor    %eax,%eax
  mov    %rdi,%rsi
  lea    D32(%rip),%rdi
  call   <printf@plt>
  mov    %rsp,%rbp
  mov    %rbx,%rcx
  lea    D11(%rip),%rdx
  mov    $0x3e8,%esi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <snprintf@plt>
  lea    -0x3(%rax),%edx
  movslq %edx,%rdx
  movb   $0x6a,(%rsp,%rdx,1)
  lea    -0x2(%rax),%edx
  movslq %edx,%rdx
  movb   $0x73,(%rsp,%rdx,1)
  lea    -0x1(%rax),%edx
  movslq %edx,%rdx
  movb   $0x6f,(%rsp,%rdx,1)
  movslq %eax,%rdx
  movb   $0x6e,(%rsp,%rdx,1)
  add    $0x1,%eax
  cltq
  movb   $0x0,(%rsp,%rax,1)
  lea    0x3f0(%rsp),%r12
  mov    %rbx,%r8
  mov    %rbp,%rcx
  lea    D10(%rip),%rdx
  mov    $0x3e8,%esi
  mov    %r12,%rdi
  mov    $0x0,%eax
  call   <snprintf@plt>
  mov    %r12,%rdi
  call   <system@plt>
  test   %eax,%eax
  jne    L10
  mov    %rsp,%rdi
  call   <unlink@plt>
L3:
  mov    0x7d8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L6
  add    $0x7e0,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L10:
  mov    %rbx,%rsi
  lea    D31(%rip),%rdi
  call   <printf@plt>
  jmp    L3
L6:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: label: D32
datatype: string
name: parse_data
arguments: label: D11
datatype: string
name: parse_data
arguments: label: D10
datatype: string
name: parse_data
arguments: label: D31
datatype: string

tool: D32: %-16s: restoring metadata


tool: D11: %s

tool: D10: exiftool "-json=%s" "%s" -q -overwrite_original

tool: D31: %-16s: could not restore metadata


assistant: ```c
void dng_restore_metadata(const char *dng_file) {
  printf("%-16s: restoring metadata\n", dng_file);
  char json_file[1000];
  int len = snprintf(json_file, sizeof(json_file), "%s", dng_file);
  json_file[len - 3] = 'j';
  json_file[len - 2] = 's';
  json_file[len - 1] = 'o';
  json_file[len - 0] = 'n';
  json_file[len + 1] = '\0';
  char exif_cmd[1000];
  snprintf(exif_cmd, sizeof(exif_cmd), "exiftool \"-json=%s\" \"%s\" -q -overwrite_original", json_file, dng_file);
  int r = system(exif_cmd);
  if (r != 0) {
    printf("%-16s: could not restore metadata\n", dng_file);
    return;
  }
  unlink(json_file);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<dng_restore_metadata>:
  endbr64
  push   %r13
  mov    %rdi,%rsi
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  lea    D1(%rip),%rdi
  sub    $0x7e0,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x7d8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%r12
  lea    0x3f0(%rsp),%r13
  call   <printf@plt>
  mov    %rbp,%rcx
  mov    $0x3e8,%esi
  mov    %r12,%rdi
  lea    D20(%rip),%rdx
  xor    %eax,%eax
  call   <snprintf@plt>
  mov    %r13,%rdi
  mov    %rbp,%r8
  mov    %r12,%rcx
  lea    -0x3(%rax),%edx
  mov    $0x3e8,%esi
  movslq %edx,%rdx
  movb   $0x6a,(%rsp,%rdx,1)
  lea    -0x2(%rax),%edx
  movslq %edx,%rdx
  movb   $0x73,(%rsp,%rdx,1)
  lea    -0x1(%rax),%edx
  movslq %edx,%rdx
  movb   $0x6f,(%rsp,%rdx,1)
  movslq %eax,%rdx
  add    $0x1,%eax
  cltq
  movb   $0x6e,(%rsp,%rdx,1)
  lea    D18(%rip),%rdx
  movb   $0x0,(%rsp,%rax,1)
  xor    %eax,%eax
  call   <snprintf@plt>
  mov    %r13,%rdi
  call   <system@plt>
  test   %eax,%eax
  jne    L26
  mov    %r12,%rdi
  call   <unlink@plt>
L0:
  mov    0x7d8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L10
  add    $0x7e0,%rsp
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopw   0x0(%rax,%rax,1)
L26:
  mov    %rbp,%rsi
  lea    D35(%rip),%rdi
  call   <printf@plt>
  jmp    L0
L10:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_tag: D1
type_infered: string
name: unpack_data
arguments: data_tag: D20
type_infered: string
name: unpack_data
arguments: data_tag: D18
type_infered: string
name: unpack_data
arguments: data_tag: D35
type_infered: string

tool: D1: %-16s: restoring metadata


tool: D20: %s

tool: D18: exiftool "-json=%s" "%s" -q -overwrite_original

tool: D35: %-16s: could not restore metadata


assistant: ```c
void dng_restore_metadata(const char *dng_file) {
  printf("%-16s: restoring metadata\n", dng_file);
  char json_file[1000];
  int len = snprintf(json_file, sizeof(json_file), "%s", dng_file);
  json_file[len - 3] = 'j';
  json_file[len - 2] = 's';
  json_file[len - 1] = 'o';
  json_file[len - 0] = 'n';
  json_file[len + 1] = '\0';
  char exif_cmd[1000];
  snprintf(exif_cmd, sizeof(exif_cmd), "exiftool \"-json=%s\" \"%s\" -q -overwrite_original", json_file, dng_file);
  int r = system(exif_cmd);
  if (r != 0) {
    printf("%-16s: could not restore metadata\n", dng_file);
    return;
  }
  unlink(json_file);
}
```