ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<addbits>:
  endbr64
  push   %r13
  mov    %rsi,%r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x8,%rsp
  call   <strlen@plt>
  mov    %r13,%rdi
  mov    %eax,%ebx
  call   <strlen@plt>
  mov    %rbp,%rdi
  mov    %eax,%r12d
  call   <getint@plt>
  mov    %r13,%rdi
  mov    %eax,%ebp
  call   <getint@plt>
  cmp    %r12d,%ebx
  mov    %r12d,%esi
  cmovge %ebx,%esi
  add    $0x8,%rsp
  lea    0x0(%rbp,%rax,1),%edi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  jmp    1090 <get_bitstr@plt>
```

assistant: ```c
char *addbits(char str1[], char str2[]) {
  int len1 = strlen(str1);
  int len2 = strlen(str2);
  int x = getint(str1);
  int y = getint(str2);
  int z = x + y;
  char *res = get_bitstr(z, (len1 > len2) ? len1 : len2);
  return res;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<addbits>:
  endbr64
  push   %r13
  mov    %rsi,%r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x8,%rsp
  call   <strlen@plt>
  mov    %r13,%rdi
  mov    %eax,%ebx
  call   <strlen@plt>
  mov    %rbp,%rdi
  mov    %eax,%r12d
  call   <getint@plt>
  mov    %r13,%rdi
  mov    %eax,%ebp
  call   <getint@plt>
  cmp    %r12d,%ebx
  mov    %r12d,%esi
  cmovge %ebx,%esi
  add    $0x8,%rsp
  lea    0x0(%rbp,%rax,1),%edi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  jmp    1090 <get_bitstr@plt>
```

assistant: ```c
char *addbits(char str1[], char str2[]) {
  int len1 = strlen(str1);
  int len2 = strlen(str2);
  int x = getint(str1);
  int y = getint(str2);
  int z = x + y;
  char *res = get_bitstr(z, (len1 > len2) ? len1 : len2);
  return res;
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<timeval_sub>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,%rax
  mov    %rdx,%rsi
  mov    %rsi,%rdx
  mov    %rax,-0x30(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    %rcx,%rax
  mov    %r8,%rcx
  mov    %rcx,%rdx
  mov    %rax,-0x40(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    -0x40(%rbp),%rdx
  mov    -0x30(%rbp),%rax
  cmp    %rax,%rdx
  jge    L11
  mov    -0x30(%rbp),%rax
  mov    -0x40(%rbp),%rdx
  sub    %rdx,%rax
  mov    %rax,%rcx
  movabs $0x431bde82d7b634db,%rdx
  mov    %rcx,%rax
  imul   %rdx
  mov    %rdx,%rax
  sar    $0x12,%rax
  sar    $0x3f,%rcx
  mov    %rcx,%rdx
  sub    %rdx,%rax
  add    $0x1,%eax
  mov    %eax,-0x8(%rbp)
  mov    -0x30(%rbp),%rax
  mov    -0x8(%rbp),%edx
  imul   $0xf4240,%edx,%edx
  movslq %edx,%rdx
  sub    %rdx,%rax
  mov    %rax,-0x30(%rbp)
  mov    -0x28(%rbp),%rdx
  mov    -0x8(%rbp),%eax
  cltq
  add    %rdx,%rax
  mov    %rax,-0x28(%rbp)
L11:
  mov    -0x40(%rbp),%rax
  mov    -0x30(%rbp),%rdx
  sub    %rdx,%rax
  cmp    $0xf4240,%rax
  jle    L8
  mov    -0x30(%rbp),%rax
  mov    -0x40(%rbp),%rdx
  sub    %rdx,%rax
  mov    %rax,%rcx
  movabs $0x431bde82d7b634db,%rdx
  mov    %rcx,%rax
  imul   %rdx
  mov    %rdx,%rax
  sar    $0x12,%rax
  sar    $0x3f,%rcx
  mov    %rcx,%rdx
  sub    %rdx,%rax
  mov    %eax,-0x4(%rbp)
  mov    -0x30(%rbp),%rdx
  mov    -0x4(%rbp),%eax
  imul   $0xf4240,%eax,%eax
  cltq
  add    %rdx,%rax
  mov    %rax,-0x30(%rbp)
  mov    -0x28(%rbp),%rax
  mov    -0x4(%rbp),%edx
  movslq %edx,%rdx
  sub    %rdx,%rax
  mov    %rax,-0x28(%rbp)
L8:
  mov    -0x28(%rbp),%rax
  mov    -0x38(%rbp),%rcx
  sub    %rcx,%rax
  mov    %rax,%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,0x8(%rax)
  mov    -0x30(%rbp),%rax
  mov    -0x40(%rbp),%rcx
  sub    %rcx,%rax
  mov    %rax,%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,(%rax)
  mov    -0x28(%rbp),%rdx
  mov    -0x38(%rbp),%rax
  cmp    %rax,%rdx
  setl   %al
  movzbl %al,%eax
  pop    %rbp
  ret
```

assistant: ```c
int timeval_sub(struct timeval *result, struct timeval end, struct timeval start) {
  if (start.tv_usec < end.tv_usec) {
    int nsec = (end.tv_usec - start.tv_usec) / 1000000 + 1;
    end.tv_usec -= 1000000 * nsec;
    end.tv_sec += nsec;
  }
  if (start.tv_usec - end.tv_usec > 1000000) {
    int nsec = (end.tv_usec - start.tv_usec) / 1000000;
    end.tv_usec += 1000000 * nsec;
    end.tv_sec -= nsec;
  }
  result->tv_sec = end.tv_sec - start.tv_sec;
  result->tv_usec = end.tv_usec - start.tv_usec;
  return end.tv_sec < start.tv_sec;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<timeval_sub>:
  endbr64
  mov    %rsi,%r9
  mov    %rdx,%r10
  mov    %rcx,%rsi
  mov    %r9,%r11
  mov    %rdx,%rcx
  cmp    %rsi,%r9
  jle    L13
  mov    %r9,%rcx
  sub    %rsi,%rcx
  movabs $0x431bde82d7b634db,%rdx
  mov    %rcx,%rax
  imul   %rdx
  sar    $0x12,%rdx
  sar    $0x3f,%rcx
  sub    %rcx,%rdx
  lea    0x1(%rdx),%ecx
  imul   $0xf4240,%ecx,%eax
  cltq
  sub    %rax,%r11
  movslq %ecx,%rcx
  add    %r10,%rcx
L13:
  mov    %rsi,%rax
  sub    %r11,%rax
  cmp    $0xf4240,%rax
  jle    L2
  mov    %r11,%r9
  sub    %rsi,%r9
  movabs $0x431bde82d7b634db,%rdx
  mov    %r9,%rax
  imul   %rdx
  sar    $0x12,%rdx
  sar    $0x3f,%r9
  sub    %r9,%rdx
  imul   $0xf4240,%edx,%eax
  cltq
  add    %rax,%r11
  movslq %edx,%rdx
  sub    %rdx,%rcx
L2:
  mov    %rcx,%rax
  sub    %r8,%rax
  mov    %rax,0x8(%rdi)
  mov    %r11,%rax
  sub    %rsi,%rax
  mov    %rax,(%rdi)
  cmp    %r8,%rcx
  setl   %al
  movzbl %al,%eax
  ret
```

assistant: ```c
int timeval_sub(struct timeval *result, struct timeval end, struct timeval start) {
  if (start.tv_usec < end.tv_usec) {
    int nsec = (end.tv_usec - start.tv_usec) / 1000000 + 1;
    end.tv_usec -= 1000000 * nsec;
    end.tv_sec += nsec;
  }
  if (start.tv_usec - end.tv_usec > 1000000) {
    int nsec = (end.tv_usec - start.tv_usec) / 1000000;
    end.tv_usec += 1000000 * nsec;
    end.tv_sec -= nsec;
  }
  result->tv_sec = end.tv_sec - start.tv_sec;
  result->tv_usec = end.tv_usec - start.tv_usec;
  return end.tv_sec < start.tv_sec;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<timeval_sub>:
  endbr64
  mov    %rdi,%r9
  mov    %rcx,%rdi
  mov    %rsi,%rcx
  mov    %rdx,%rsi
  cmp    %rdi,%rcx
  jle    L18
  movabs $0x431bde82d7b634db,%r10
  mov    %rcx,%rdx
  sub    %rdi,%rdx
  mov    %rdx,%rax
  mul    %r10
  shr    $0x12,%rdx
  add    $0x1,%edx
  imul   $0xf4240,%edx,%eax
  movslq %edx,%rdx
  add    %rdx,%rsi
  cltq
  sub    %rax,%rcx
L18:
  mov    %rdi,%rax
  sub    %rcx,%rax
  cmp    $0xf4240,%rax
  jle    L17
  movabs $0x431bde82d7b634db,%rdx
  mov    %rcx,%r10
  sub    %rdi,%r10
  mov    %r10,%rax
  sar    $0x3f,%r10
  imul   %rdx
  sar    $0x12,%rdx
  sub    %r10,%rdx
  imul   $0xf4240,%edx,%eax
  movslq %edx,%rdx
  sub    %rdx,%rsi
  cltq
  add    %rax,%rcx
L17:
  mov    %rsi,%rax
  sub    %rdi,%rcx
  sub    %r8,%rax
  mov    %rcx,(%r9)
  mov    %rax,0x8(%r9)
  xor    %eax,%eax
  cmp    %r8,%rsi
  setl   %al
  ret
```

assistant: ```c
int timeval_sub(struct timeval *result, struct timeval end, struct timeval start) {
  if (start.tv_usec < end.tv_usec) {
    int nsec = (end.tv_usec - start.tv_usec) / 1000000 + 1;
    end.tv_usec -= 1000000 * nsec;
    end.tv_sec += nsec;
  }
  if (start.tv_usec - end.tv_usec > 1000000) {
    int nsec = (end.tv_usec - start.tv_usec) / 1000000;
    end.tv_usec += 1000000 * nsec;
    end.tv_sec -= nsec;
  }
  result->tv_sec = end.tv_sec - start.tv_sec;
  result->tv_usec = end.tv_usec - start.tv_usec;
  return end.tv_sec < start.tv_sec;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<timeval_sub>:
  endbr64
  mov    %rsi,-0x28(%rsp)
  mov    %rcx,-0x18(%rsp)
  mov    %r8,-0x10(%rsp)
  movdqa -0x18(%rsp),%xmm2
  mov    %rdx,-0x20(%rsp)
  movdqa -0x28(%rsp),%xmm0
  movq   %xmm2,%rcx
  mov    -0x10(%rsp),%rsi
  movq   %xmm0,%rax
  cmp    %rcx,%rax
  jle    L3
  movabs $0x431bde82d7b634db,%rdx
  sub    %rcx,%rax
  mul    %rdx
  shr    $0x12,%rdx
  add    $0x1,%edx
  imul   $0xf4240,%edx,%eax
  movslq %edx,%rdx
  movq   %rdx,%xmm6
  cltq
  movq   %rax,%xmm1
  punpcklqdq %xmm6,%xmm1
  psubq  %xmm1,%xmm0
  paddq  -0x28(%rsp),%xmm1
  shufpd $0x2,%xmm1,%xmm0
L3:
  movq   %xmm0,%rax
  mov    %rcx,%rdx
  sub    %rax,%rdx
  cmp    $0xf4240,%rdx
  jle    L14
  sub    %rcx,%rax
  movdqa %xmm0,%xmm3
  movabs $0x431bde82d7b634db,%rdx
  mov    %rax,%r8
  imul   %rdx
  mov    %r8,%rax
  sar    $0x3f,%rax
  sar    $0x12,%rdx
  sub    %rax,%rdx
  imul   $0xf4240,%edx,%eax
  movslq %edx,%rdx
  movq   %rdx,%xmm7
  cltq
  movq   %rax,%xmm1
  punpcklqdq %xmm7,%xmm1
  movdqa %xmm1,%xmm4
  psubq  %xmm1,%xmm3
  paddq  %xmm0,%xmm4
  shufpd $0x2,%xmm3,%xmm4
  movdqa %xmm4,%xmm0
L14:
  movhlps %xmm0,%xmm5
  movdqa %xmm0,%xmm1
  movq   %xmm5,%rax
  psubq  %xmm2,%xmm1
  cmp    %rsi,%rax
  movups %xmm1,(%rdi)
  setl   %al
  movzbl %al,%eax
  ret
```

assistant: ```c
int timeval_sub(struct timeval *result, struct timeval end, struct timeval start) {
  if (start.tv_usec < end.tv_usec) {
    int nsec = (end.tv_usec - start.tv_usec) / 1000000 + 1;
    end.tv_usec -= 1000000 * nsec;
    end.tv_sec += nsec;
  }
  if (start.tv_usec - end.tv_usec > 1000000) {
    int nsec = (end.tv_usec - start.tv_usec) / 1000000;
    end.tv_usec += 1000000 * nsec;
    end.tv_sec -= nsec;
  }
  result->tv_sec = end.tv_sec - start.tv_sec;
  result->tv_usec = end.tv_usec - start.tv_usec;
  return end.tv_sec < start.tv_sec;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<ux_sendto>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    %ecx,-0x18(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    D5(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,-0xc(%rbp)
  mov    -0x10(%rbp),%eax
  mov    -0x20(%rbp),%rdx
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <strcpy@plt>
  lea    -0x10(%rbp),%rcx
  mov    -0x18(%rbp),%edx
  mov    -0x28(%rbp),%rsi
  mov    -0x14(%rbp),%eax
  mov    $0x8,%r9d
  mov    %rcx,%r8
  mov    $0x0,%ecx
  mov    %eax,%edi
  call   <sendto@plt>
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L2
  call   <__stack_chk_fail@plt>
L2:
  leave
  ret
```

assistant: ```c
int ux_sendto(int sock, char *topath, unsigned char *data, int len) {
  struct sockaddr_un name;
  name.sun_family = AF_UNIX;
  strcpy(name.sun_path, topath);
  return sendto(sock, data, len, 0, (struct sockaddr *)&name, sizeof(struct sockaddr_un));
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<ux_sendto>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x10,%rsp
  mov    %edi,%ebx
  mov    %rdx,%rbp
  mov    %ecx,%r12d
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    D0(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,0x4(%rsp)
  mov    (%rsp),%edi
  call   <strcpy@plt>
  mov    $0x8,%r9d
  mov    %rsp,%r8
  mov    $0x0,%ecx
  mov    %r12d,%edx
  mov    %rbp,%rsi
  mov    %ebx,%edi
  call   <sendto@plt>
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L8
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L8:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int ux_sendto(int sock, char *topath, unsigned char *data, int len) {
  struct sockaddr_un name;
  name.sun_family = AF_UNIX;
  strcpy(name.sun_path, topath);
  return sendto(sock, data, len, 0, (struct sockaddr *)&name, sizeof(struct sockaddr_un));
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<ux_sendto>:
  endbr64
  push   %r13
  mov    %ecx,%r13d
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  mov    %edi,%ebp
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  mov    D6(%rip),%rax
  mov    (%rsp),%edi
  mov    (%rax),%eax
  mov    %eax,0x4(%rsp)
  call   <strcpy@plt>
  xor    %ecx,%ecx
  mov    %r13d,%edx
  mov    $0x8,%r9d
  mov    %rsp,%r8
  mov    %r12,%rsi
  mov    %ebp,%edi
  call   <sendto@plt>
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L7
  add    $0x10,%rsp
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L7:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int ux_sendto(int sock, char *topath, unsigned char *data, int len) {
  struct sockaddr_un name;
  name.sun_family = AF_UNIX;
  strcpy(name.sun_path, topath);
  return sendto(sock, data, len, 0, (struct sockaddr *)&name, sizeof(struct sockaddr_un));
}
```
user: What is the c source code of the assembly code below:

```asm
<ux_sendto>:
  endbr64
  push   %r13
  mov    %ecx,%r13d
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  mov    %edi,%ebp
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  mov    D8(%rip),%rax
  mov    (%rsp),%edi
  mov    (%rax),%eax
  mov    %eax,0x4(%rsp)
  call   <strcpy@plt>
  xor    %ecx,%ecx
  mov    %r13d,%edx
  mov    $0x8,%r9d
  mov    %rsp,%r8
  mov    %r12,%rsi
  mov    %ebp,%edi
  call   <sendto@plt>
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L1
  add    $0x10,%rsp
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L1:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int ux_sendto(int sock, char *topath, unsigned char *data, int len) {
  struct sockaddr_un name;
  name.sun_family = AF_UNIX;
  strcpy(name.sun_path, topath);
  return sendto(sock, data, len, 0, (struct sockaddr *)&name, sizeof(struct sockaddr_un));
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<show_tree_pic>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <tree_depth@plt>
  mov    %eax,-0x8(%rbp)
  mov    -0x18(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <find_most_left@plt>
  mov    %eax,-0x4(%rbp)
  mov    $0xa,%edi
  call   <putchar@plt>
  movl   $0x0,-0xc(%rbp)
  jmp    L71
L28:
  mov    $0xa,%edi
  call   <putchar@plt>
  addl   $0x1,-0xc(%rbp)
L71:
  mov    -0x8(%rbp),%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  cmp    %eax,-0xc(%rbp)
  jle    L28
  movl   $0x0,-0xc(%rbp)
  jmp    L21
L67:
  mov    $0x0,%eax
  call   <move_up@plt>
  addl   $0x1,-0xc(%rbp)
L21:
  mov    -0x8(%rbp),%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  cmp    %eax,-0xc(%rbp)
  jle    L67
  movl   $0x0,-0xc(%rbp)
  jmp    L56
L13:
  mov    $0x0,%eax
  call   <move_right@plt>
  addl   $0x1,-0xc(%rbp)
L56:
  mov    $0x1,%eax
  sub    -0x4(%rbp),%eax
  cmp    %eax,-0xc(%rbp)
  jl     L13
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <ptree@plt>
  movl   $0x0,-0xc(%rbp)
  jmp    L14
L39:
  mov    $0x0,%eax
  call   <move_down@plt>
  addl   $0x1,-0xc(%rbp)
L14:
  mov    -0x8(%rbp),%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  cmp    %eax,-0xc(%rbp)
  jle    L39
  mov    $0xa,%edi
  call   <putchar@plt>
  nop
  leave
  ret
```

assistant: ```c
void show_tree_pic(struct link *r) {
  int depth = tree_depth(r);
  int most_left = find_most_left(r, 0);
  int i;
  putchar('\n');
  for (i = 0; i < depth * 3 + 1; i++)
    putchar('\n');
  for (i = 0; i < depth * 3 + 1; i++)
    move_up();
  for (i = 0; i < (0 - most_left) + 1; i++)
    move_right();
  ptree(r);
  for (i = 0; i < depth * 3 + 1; i++)
    move_down();
  putchar('\n');
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<show_tree_pic>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%r13
  call   <tree_depth@plt>
  mov    %eax,%ebx
  mov    $0x0,%esi
  mov    %r13,%rdi
  call   <find_most_left@plt>
  mov    %eax,%r14d
  mov    $0xa,%edi
  call   <putchar@plt>
  lea    (%rbx,%rbx,2),%ebx
  test   %ebx,%ebx
  js     L58
  mov    $0x0,%ebp
L30:
  mov    $0xa,%edi
  call   <putchar@plt>
  add    $0x1,%ebp
  cmp    %ebx,%ebp
  jle    L30
  mov    $0x0,%ebp
L69:
  mov    $0x0,%eax
  call   <move_up@plt>
  add    $0x1,%ebp
  cmp    %ebx,%ebp
  jle    L69
  mov    $0x1,%r12d
  sub    %r14d,%r12d
  test   %r12d,%r12d
  jle    L46
L45:
  mov    $0x0,%ebp
L76:
  mov    $0x0,%eax
  call   <move_right@plt>
  add    $0x1,%ebp
  cmp    %r12d,%ebp
  jl     L76
  mov    %r13,%rdi
  call   <ptree@plt>
  test   %ebx,%ebx
  js     L59
L77:
  mov    $0x0,%ebp
L48:
  mov    $0x0,%eax
  call   <move_down@plt>
  add    $0x1,%ebp
  cmp    %ebx,%ebp
  jle    L48
L59:
  mov    $0xa,%edi
  call   <putchar@plt>
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L46:
  mov    %r13,%rdi
  call   <ptree@plt>
  jmp    L77
L58:
  mov    $0x1,%r12d
  sub    %r14d,%r12d
  test   %r12d,%r12d
  jg     L45
  mov    %r13,%rdi
  call   <ptree@plt>
  jmp    L59
```

assistant: ```c
void show_tree_pic(struct link *r) {
  int depth = tree_depth(r);
  int most_left = find_most_left(r, 0);
  int i;
  putchar('\n');
  for (i = 0; i < depth * 3 + 1; i++)
    putchar('\n');
  for (i = 0; i < depth * 3 + 1; i++)
    move_up();
  for (i = 0; i < (0 - most_left) + 1; i++)
    move_right();
  ptree(r);
  for (i = 0; i < depth * 3 + 1; i++)
    move_down();
  putchar('\n');
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<show_tree_pic>:
  endbr64
  push   %r14
  push   %r13
  mov    %rdi,%r13
  push   %r12
  push   %rbp
  push   %rbx
  call   <tree_depth@plt>
  xor    %esi,%esi
  mov    %r13,%rdi
  mov    %eax,%ebx
  call   <find_most_left@plt>
  lea    (%rbx,%rbx,2),%ebx
  mov    $0xa,%edi
  mov    %eax,%r14d
  call   <putchar@plt>
  test   %ebx,%ebx
  js     L88
  xor    %ebp,%ebp
  nopw   0x0(%rax,%rax,1)
L20:
  mov    $0xa,%edi
  add    $0x1,%ebp
  call   <putchar@plt>
  cmp    %ebx,%ebp
  jle    L20
  xor    %ebp,%ebp
  nopl   0x0(%rax,%rax,1)
L57:
  xor    %eax,%eax
  add    $0x1,%ebp
  call   <move_up@plt>
  cmp    %ebx,%ebp
  jle    L57
  mov    $0x1,%r12d
  sub    %r14d,%r12d
  test   %r12d,%r12d
  jle    L53
L4:
  xor    %ebp,%ebp
  cs nopw 0x0(%rax,%rax,1)
L72:
  xor    %eax,%eax
  add    $0x1,%ebp
  call   <move_right@plt>
  cmp    %r12d,%ebp
  jl     L72
  mov    %r13,%rdi
  call   <ptree@plt>
  test   %ebx,%ebx
  js     L50
L74:
  xor    %ebp,%ebp
  nopl   (%rax)
L31:
  xor    %eax,%eax
  add    $0x1,%ebp
  call   <move_down@plt>
  cmp    %ebx,%ebp
  jle    L31
L50:
  pop    %rbx
  mov    $0xa,%edi
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  jmp    10b0 <putchar@plt>
L53:
  mov    %r13,%rdi
  call   <ptree@plt>
  jmp    L74
  nopw   0x0(%rax,%rax,1)
L88:
  mov    $0x1,%r12d
  sub    %r14d,%r12d
  test   %r12d,%r12d
  jg     L4
  mov    %r13,%rdi
  call   <ptree@plt>
  jmp    L50
```

assistant: ```c
void show_tree_pic(struct link *r) {
  int depth = tree_depth(r);
  int most_left = find_most_left(r, 0);
  int i;
  putchar('\n');
  for (i = 0; i < depth * 3 + 1; i++)
    putchar('\n');
  for (i = 0; i < depth * 3 + 1; i++)
    move_up();
  for (i = 0; i < (0 - most_left) + 1; i++)
    move_right();
  ptree(r);
  for (i = 0; i < depth * 3 + 1; i++)
    move_down();
  putchar('\n');
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<show_tree_pic>:
  endbr64
  push   %r14
  push   %r13
  mov    %rdi,%r13
  push   %r12
  push   %rbp
  push   %rbx
  call   <tree_depth@plt>
  xor    %esi,%esi
  mov    %r13,%rdi
  mov    %eax,%ebx
  call   <find_most_left@plt>
  lea    (%rbx,%rbx,2),%ebx
  mov    $0xa,%edi
  mov    %eax,%r14d
  call   <putchar@plt>
  test   %ebx,%ebx
  js     L18
  xor    %ebp,%ebp
  nopw   0x0(%rax,%rax,1)
L27:
  mov    $0xa,%edi
  add    $0x1,%ebp
  call   <putchar@plt>
  cmp    %ebx,%ebp
  jle    L27
  xor    %ebp,%ebp
  nopl   0x0(%rax,%rax,1)
L44:
  xor    %eax,%eax
  add    $0x1,%ebp
  call   <move_up@plt>
  cmp    %ebx,%ebp
  jle    L44
  mov    $0x1,%r12d
  sub    %r14d,%r12d
  test   %r12d,%r12d
  jle    L62
L87:
  xor    %ebp,%ebp
  cs nopw 0x0(%rax,%rax,1)
L6:
  xor    %eax,%eax
  add    $0x1,%ebp
  call   <move_right@plt>
  cmp    %r12d,%ebp
  jl     L6
  mov    %r13,%rdi
  call   <ptree@plt>
  test   %ebx,%ebx
  js     L90
L48:
  xor    %ebp,%ebp
  nopl   (%rax)
L28:
  xor    %eax,%eax
  add    $0x1,%ebp
  call   <move_down@plt>
  cmp    %ebx,%ebp
  jle    L28
L90:
  pop    %rbx
  mov    $0xa,%edi
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  jmp    10b0 <putchar@plt>
L62:
  mov    %r13,%rdi
  call   <ptree@plt>
  jmp    L48
  nopw   0x0(%rax,%rax,1)
L18:
  mov    $0x1,%r12d
  sub    %r14d,%r12d
  test   %r12d,%r12d
  jg     L87
  mov    %r13,%rdi
  call   <ptree@plt>
  jmp    L90
```

assistant: ```c
void show_tree_pic(struct link *r) {
  int depth = tree_depth(r);
  int most_left = find_most_left(r, 0);
  int i;
  putchar('\n');
  for (i = 0; i < depth * 3 + 1; i++)
    putchar('\n');
  for (i = 0; i < depth * 3 + 1; i++)
    move_up();
  for (i = 0; i < (0 - most_left) + 1; i++)
    move_right();
  ptree(r);
  for (i = 0; i < depth * 3 + 1; i++)
    move_down();
  putchar('\n');
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<Battle>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %esi,-0x18(%rbp)
  mov    %rdx,-0x20(%rbp)
  mov    %rcx,-0x28(%rbp)
  mov    $0x0,%edi
  call   <time@plt>
  mov    %eax,%edi
  call   <srand@plt>
  mov    -0x28(%rbp),%rdx
  mov    -0x18(%rbp),%ecx
  mov    -0x14(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <BattleOne@plt>
  mov    %eax,-0x4(%rbp)
  cmpl   $0x0,-0x4(%rbp)
  jns    L4
  mov    -0x28(%rbp),%rax
  mov    (%rax),%esi
  mov    -0x20(%rbp),%rax
  mov    (%rax),%eax
  mov    -0x28(%rbp),%rcx
  mov    -0x20(%rbp),%rdx
  mov    %eax,%edi
  call   <BattleTwo@plt>
  mov    %eax,-0x4(%rbp)
L4:
  cmpl   $0x0,-0x4(%rbp)
  jns    L12
  mov    -0x28(%rbp),%rax
  mov    (%rax),%esi
  mov    -0x20(%rbp),%rax
  mov    (%rax),%eax
  mov    -0x28(%rbp),%rcx
  mov    -0x20(%rbp),%rdx
  mov    %eax,%edi
  call   <BattleThree@plt>
  mov    %eax,-0x4(%rbp)
L12:
  mov    -0x4(%rbp),%eax
  leave
  ret
```

assistant: ```c
int Battle(int atkForce, int defForce, int *atkSurvivors, int *defSurvivors) {
  int won;
  srand(time(NULL));
  won = BattleOne(atkForce, defForce, defSurvivors);
  if (won < 0)
    won = BattleTwo(*atkSurvivors, *defSurvivors, atkSurvivors, defSurvivors);
  if (won < 0)
    won = BattleThree(*atkSurvivors, *defSurvivors, atkSurvivors, defSurvivors);
  return won;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<Battle>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %edi,%r12d
  mov    %esi,%r13d
  mov    %rdx,%rbp
  mov    %rcx,%rbx
  mov    $0x0,%edi
  call   <time@plt>
  mov    %eax,%edi
  call   <srand@plt>
  mov    %rbx,%rdx
  mov    %r13d,%esi
  mov    %r12d,%edi
  call   <BattleOne@plt>
  test   %eax,%eax
  js     L18
L12:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L18:
  mov    %rbx,%rcx
  mov    %rbp,%rdx
  mov    (%rbx),%esi
  mov    0x0(%rbp),%edi
  call   <BattleTwo@plt>
  test   %eax,%eax
  jns    L12
  mov    %rbx,%rcx
  mov    %rbp,%rdx
  mov    (%rbx),%esi
  mov    0x0(%rbp),%edi
  call   <BattleThree@plt>
  jmp    L12
```

assistant: ```c
int Battle(int atkForce, int defForce, int *atkSurvivors, int *defSurvivors) {
  int won;
  srand(time(NULL));
  won = BattleOne(atkForce, defForce, defSurvivors);
  if (won < 0)
    won = BattleTwo(*atkSurvivors, *defSurvivors, atkSurvivors, defSurvivors);
  if (won < 0)
    won = BattleThree(*atkSurvivors, *defSurvivors, atkSurvivors, defSurvivors);
  return won;
}
```
user: What is the c source code of the assembly code below?

```asm
<Battle>:
  endbr64
  push   %r13
  mov    %esi,%r13d
  push   %r12
  mov    %edi,%r12d
  xor    %edi,%edi
  push   %rbp
  mov    %rdx,%rbp
  push   %rbx
  mov    %rcx,%rbx
  sub    $0x8,%rsp
  call   <time@plt>
  mov    %eax,%edi
  call   <srand@plt>
  mov    %rbx,%rdx
  mov    %r13d,%esi
  mov    %r12d,%edi
  call   <BattleOne@plt>
  test   %eax,%eax
  js     L4
L6:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   (%rax)
L4:
  mov    (%rbx),%esi
  mov    0x0(%rbp),%edi
  mov    %rbx,%rcx
  mov    %rbp,%rdx
  call   <BattleTwo@plt>
  test   %eax,%eax
  jns    L6
  mov    (%rbx),%esi
  mov    0x0(%rbp),%edi
  add    $0x8,%rsp
  mov    %rbx,%rcx
  mov    %rbp,%rdx
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  jmp    1090 <BattleThree@plt>
```

assistant: ```c
int Battle(int atkForce, int defForce, int *atkSurvivors, int *defSurvivors) {
  int won;
  srand(time(NULL));
  won = BattleOne(atkForce, defForce, defSurvivors);
  if (won < 0)
    won = BattleTwo(*atkSurvivors, *defSurvivors, atkSurvivors, defSurvivors);
  if (won < 0)
    won = BattleThree(*atkSurvivors, *defSurvivors, atkSurvivors, defSurvivors);
  return won;
}
```