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

```asm
<tree_bal>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  add    $0xffffffffffffff80,%rsp
  mov    %rdi,-0x68(%rbp)
  mov    %rsi,-0x70(%rbp)
  mov    %rdx,-0x78(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x30(%rbp),%r8
  lea    -0x38(%rbp),%rdi
  lea    -0x48(%rbp),%rcx
  lea    -0x58(%rbp),%rdx
  mov    -0x70(%rbp),%rsi
  mov    -0x68(%rbp),%rax
  mov    %r8,%r9
  mov    %rdi,%r8
  mov    %rax,%rdi
  call   <get_next_br@plt>
  mov    -0x38(%rbp),%rax
  test   %rax,%rax
  je     L55
  mov    -0x30(%rbp),%rdx
  mov    -0x38(%rbp),%rcx
  mov    -0x70(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <tree_bal>
  movq   %xmm0,%rax
  mov    %rax,-0x20(%rbp)
  jmp    L1
L55:
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x20(%rbp)
L1:
  lea    -0x30(%rbp),%r8
  lea    -0x38(%rbp),%rdi
  lea    -0x40(%rbp),%rcx
  lea    -0x50(%rbp),%rdx
  mov    -0x78(%rbp),%rsi
  mov    -0x68(%rbp),%rax
  mov    %r8,%r9
  mov    %rdi,%r8
  mov    %rax,%rdi
  call   <get_next_br@plt>
  mov    -0x38(%rbp),%rax
  test   %rax,%rax
  je     L13
  mov    -0x30(%rbp),%rdx
  mov    -0x38(%rbp),%rcx
  mov    -0x78(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <tree_bal>
  movq   %xmm0,%rax
  mov    %rax,-0x28(%rbp)
  jmp    L9
L13:
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x28(%rbp)
L9:
  movsd  -0x20(%rbp),%xmm1
  movsd  D16(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x18(%rbp)
  movsd  -0x28(%rbp),%xmm1
  movsd  D16(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x10(%rbp)
  movsd  -0x18(%rbp),%xmm0
  comisd -0x10(%rbp),%xmm0
  jbe    L23
  movsd  -0x18(%rbp),%xmm0
  movsd  %xmm0,-0x10(%rbp)
  jmp    L58
L23:
  movsd  -0x10(%rbp),%xmm0
  movsd  %xmm0,-0x18(%rbp)
L58:
  mov    -0x48(%rbp),%rax
  movsd  -0x18(%rbp),%xmm0
  subsd  -0x20(%rbp),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x58(%rbp),%rdx
  movsd  (%rax),%xmm0
  movsd  %xmm0,(%rdx)
  mov    -0x40(%rbp),%rax
  movsd  -0x10(%rbp),%xmm0
  subsd  -0x28(%rbp),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x50(%rbp),%rdx
  movsd  (%rax),%xmm0
  movsd  %xmm0,(%rdx)
  movsd  -0x18(%rbp),%xmm0
  movq   %xmm0,%rax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L28
  call   <__stack_chk_fail@plt>
L28:
  movq   %rax,%xmm0
  leave
  ret
```

tool_calls: name: disassemble_data
arguments: data_label: D16
type_guessed: f32[2]

tool: {"D16": [0.0,1.875]}

assistant: ```c
double tree_bal(struct noeud *centre, struct noeud *p1, struct noeud *p2) {
  double ld, lg, pg, pd, *abup1, *abup2, *abdown1, *abdown2;
  struct noeud *f1, *f2;
  get_next_br(centre, p1, &abup1, &abdown1, &f1, &f2);
  if (f1 != NULL)
    lg = tree_bal(p1, f1, f2);
  else
    lg = 0.0;
  get_next_br(centre, p2, &abup2, &abdown2, &f1, &f2);
  if (f1 != NULL)
    ld = tree_bal(p2, f1, f2);
  else
    ld = 0.0;
  pg = lg + 1;
  pd = ld + 1;
  if (pg > pd)
    pd = pg;
  else
    pg = pd;
  *abup1 = *abdown1 = pg - lg;
  *abup2 = *abdown2 = pd - ld;
  return (pg);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<tree_bal>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x40,%rsp
  mov    %rdi,%rbx
  mov    %rsi,%rbp
  mov    %rdx,%r12
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  lea    0x18(%rsp),%rcx
  lea    0x8(%rsp),%rdx
  lea    0x30(%rsp),%r9
  lea    0x28(%rsp),%r8
  call   <get_next_br@plt>
  mov    0x28(%rsp),%rsi
  test   %rsi,%rsi
  je     L21
  mov    0x30(%rsp),%rdx
  mov    %rbp,%rdi
  call   <tree_bal>
  movq   %xmm0,%rbp
  lea    0x20(%rsp),%rcx
  lea    0x10(%rsp),%rdx
  lea    0x30(%rsp),%r9
  lea    0x28(%rsp),%r8
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <get_next_br@plt>
  mov    0x28(%rsp),%rsi
  pxor   %xmm1,%xmm1
  test   %rsi,%rsi
  je     L0
L27:
  mov    0x30(%rsp),%rdx
  mov    %r12,%rdi
  call   <tree_bal>
  movapd %xmm0,%xmm1
L0:
  movsd  D29(%rip),%xmm2
  movq   %rbp,%xmm0
  addsd  %xmm2,%xmm0
  addsd  %xmm1,%xmm2
  maxsd  %xmm2,%xmm0
L32:
  movapd %xmm0,%xmm2
  movq   %rbp,%xmm3
  subsd  %xmm3,%xmm2
  mov    0x18(%rsp),%rax
  movsd  %xmm2,(%rax)
  mov    0x8(%rsp),%rax
  movsd  %xmm2,(%rax)
  movapd %xmm0,%xmm2
  subsd  %xmm1,%xmm2
  mov    0x20(%rsp),%rax
  movsd  %xmm2,(%rax)
  mov    0x10(%rsp),%rax
  movsd  %xmm2,(%rax)
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L20
  add    $0x40,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L21:
  lea    0x20(%rsp),%rcx
  lea    0x10(%rsp),%rdx
  lea    0x30(%rsp),%r9
  lea    0x28(%rsp),%r8
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <get_next_br@plt>
  mov    0x28(%rsp),%rsi
  mov    D1(%rip),%rbp
  test   %rsi,%rsi
  jne    L27
  movq   %rbp,%xmm1
  movsd  D29(%rip),%xmm0
  jmp    L32
L20:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: tag: D29
type_infered: f32[2]
name: unpack_data
arguments: tag: D1
type_infered: f32[2]

tool: {"D29": [0.0,1.875]}

tool: {"D1": [0.0,0.0]}

assistant: ```c
double tree_bal(struct noeud *centre, struct noeud *p1, struct noeud *p2) {
  double ld, lg, pg, pd, *abup1, *abup2, *abdown1, *abdown2;
  struct noeud *f1, *f2;
  get_next_br(centre, p1, &abup1, &abdown1, &f1, &f2);
  if (f1 != NULL)
    lg = tree_bal(p1, f1, f2);
  else
    lg = 0.0;
  get_next_br(centre, p2, &abup2, &abdown2, &f1, &f2);
  if (f1 != NULL)
    ld = tree_bal(p2, f1, f2);
  else
    ld = 0.0;
  pg = lg + 1;
  pd = ld + 1;
  if (pg > pd)
    pd = pg;
  else
    pg = pd;
  *abup1 = *abdown1 = pg - lg;
  *abup2 = *abdown2 = pd - ld;
  return (pg);
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<tree_bal>:
  endbr64
  push   %r14
  push   %r13
  mov    %rdx,%r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x50,%rsp
  lea    0x40(%rsp),%r14
  lea    0x38(%rsp),%rbx
  lea    0x28(%rsp),%rcx
  lea    0x18(%rsp),%rdx
  mov    %r14,%r9
  mov    %rbx,%r8
  mov    %fs:0x28,%rax
  mov    %rax,0x48(%rsp)
  xor    %eax,%eax
  call   <get_next_br@plt>
  mov    0x38(%rsp),%rsi
  test   %rsi,%rsi
  je     L37
  mov    0x40(%rsp),%rdx
  mov    %r12,%rdi
  call   <tree_bal>
  mov    %r13,%rsi
  lea    0x30(%rsp),%rcx
  mov    %r14,%r9
  lea    0x20(%rsp),%rdx
  mov    %rbx,%r8
  mov    %rbp,%rdi
  movsd  %xmm0,0x8(%rsp)
  call   <get_next_br@plt>
  mov    0x38(%rsp),%rsi
  movsd  0x8(%rsp),%xmm1
  test   %rsi,%rsi
  je     L8
L44:
  mov    0x40(%rsp),%rdx
  mov    %r13,%rdi
  movsd  %xmm1,0x8(%rsp)
  call   <tree_bal>
  movsd  0x8(%rsp),%xmm1
  movapd %xmm0,%xmm2
  movsd  D24(%rip),%xmm0
  movapd %xmm2,%xmm4
  addsd  %xmm0,%xmm4
  addsd  %xmm1,%xmm0
  comisd %xmm4,%xmm0
  jbe    L62
L55:
  movapd %xmm0,%xmm3
  subsd  %xmm1,%xmm3
  movapd %xmm0,%xmm1
  subsd  %xmm2,%xmm1
L33:
  mov    0x28(%rsp),%rax
  movsd  %xmm3,(%rax)
  mov    0x18(%rsp),%rax
  movsd  %xmm3,(%rax)
  mov    0x30(%rsp),%rax
  movsd  %xmm1,(%rax)
  mov    0x20(%rsp),%rax
  movsd  %xmm1,(%rax)
  mov    0x48(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L38
  add    $0x50,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L8:
  movsd  D24(%rip),%xmm0
  pxor   %xmm2,%xmm2
  movapd %xmm0,%xmm4
  addsd  %xmm1,%xmm0
  comisd %xmm4,%xmm0
  ja     L55
L62:
  movapd %xmm4,%xmm3
  movapd %xmm4,%xmm0
  subsd  %xmm1,%xmm3
  movapd %xmm4,%xmm1
  subsd  %xmm2,%xmm1
  jmp    L33
L37:
  mov    %r13,%rsi
  lea    0x30(%rsp),%rcx
  lea    0x20(%rsp),%rdx
  mov    %r14,%r9
  mov    %rbx,%r8
  mov    %rbp,%rdi
  call   <get_next_br@plt>
  mov    0x38(%rsp),%rsi
  pxor   %xmm1,%xmm1
  test   %rsi,%rsi
  jne    L44
  movsd  D24(%rip),%xmm1
  movapd %xmm1,%xmm3
  movapd %xmm1,%xmm0
  jmp    L33
L38:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: tag: D24
datatype: f32[2]

tool: {"D24": [0.0,1.875]}

assistant: ```c
double tree_bal(struct noeud *centre, struct noeud *p1, struct noeud *p2) {
  double ld, lg, pg, pd, *abup1, *abup2, *abdown1, *abdown2;
  struct noeud *f1, *f2;
  get_next_br(centre, p1, &abup1, &abdown1, &f1, &f2);
  if (f1 != NULL)
    lg = tree_bal(p1, f1, f2);
  else
    lg = 0.0;
  get_next_br(centre, p2, &abup2, &abdown2, &f1, &f2);
  if (f1 != NULL)
    ld = tree_bal(p2, f1, f2);
  else
    ld = 0.0;
  pg = lg + 1;
  pd = ld + 1;
  if (pg > pd)
    pd = pg;
  else
    pg = pd;
  *abup1 = *abdown1 = pg - lg;
  *abup2 = *abdown2 = pd - ld;
  return (pg);
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<tree_bal>:
  endbr64
  push   %r14
  push   %r13
  mov    %rdx,%r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x50,%rsp
  lea    0x40(%rsp),%r14
  lea    0x38(%rsp),%rbx
  lea    0x28(%rsp),%rcx
  lea    0x18(%rsp),%rdx
  mov    %r14,%r9
  mov    %rbx,%r8
  mov    %fs:0x28,%rax
  mov    %rax,0x48(%rsp)
  xor    %eax,%eax
  call   <get_next_br@plt>
  mov    0x38(%rsp),%rsi
  test   %rsi,%rsi
  je     L55
  mov    0x40(%rsp),%rdx
  mov    %r12,%rdi
  call   <tree_bal>
  mov    %r13,%rsi
  lea    0x30(%rsp),%rcx
  mov    %r14,%r9
  lea    0x20(%rsp),%rdx
  mov    %rbx,%r8
  mov    %rbp,%rdi
  movsd  %xmm0,0x8(%rsp)
  call   <get_next_br@plt>
  mov    0x38(%rsp),%rsi
  movsd  0x8(%rsp),%xmm1
  test   %rsi,%rsi
  je     L47
L24:
  mov    0x40(%rsp),%rdx
  mov    %r13,%rdi
  movsd  %xmm1,0x8(%rsp)
  call   <tree_bal>
  movsd  0x8(%rsp),%xmm1
  movapd %xmm0,%xmm2
  movsd  D20(%rip),%xmm0
  movapd %xmm2,%xmm4
  addsd  %xmm0,%xmm4
  addsd  %xmm1,%xmm0
  comisd %xmm4,%xmm0
  jbe    L35
L31:
  movapd %xmm0,%xmm3
  subsd  %xmm1,%xmm3
  movapd %xmm0,%xmm1
  subsd  %xmm2,%xmm1
L0:
  mov    0x28(%rsp),%rax
  movsd  %xmm3,(%rax)
  mov    0x18(%rsp),%rax
  movsd  %xmm3,(%rax)
  mov    0x30(%rsp),%rax
  movsd  %xmm1,(%rax)
  mov    0x20(%rsp),%rax
  movsd  %xmm1,(%rax)
  mov    0x48(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L73
  add    $0x50,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L47:
  movsd  D20(%rip),%xmm0
  pxor   %xmm2,%xmm2
  movapd %xmm0,%xmm4
  addsd  %xmm1,%xmm0
  comisd %xmm4,%xmm0
  ja     L31
L35:
  movapd %xmm4,%xmm3
  movapd %xmm4,%xmm0
  subsd  %xmm1,%xmm3
  movapd %xmm4,%xmm1
  subsd  %xmm2,%xmm1
  jmp    L0
L55:
  mov    %r13,%rsi
  lea    0x30(%rsp),%rcx
  lea    0x20(%rsp),%rdx
  mov    %r14,%r9
  mov    %rbx,%r8
  mov    %rbp,%rdi
  call   <get_next_br@plt>
  mov    0x38(%rsp),%rsi
  pxor   %xmm1,%xmm1
  test   %rsi,%rsi
  jne    L24
  movsd  D20(%rip),%xmm1
  movapd %xmm1,%xmm3
  movapd %xmm1,%xmm0
  jmp    L0
L73:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: label: D20
type: f32[2]

tool: {"D20": [0.0,1.875]}

assistant: ```c
double tree_bal(struct noeud *centre, struct noeud *p1, struct noeud *p2) {
  double ld, lg, pg, pd, *abup1, *abup2, *abdown1, *abdown2;
  struct noeud *f1, *f2;
  get_next_br(centre, p1, &abup1, &abdown1, &f1, &f2);
  if (f1 != NULL)
    lg = tree_bal(p1, f1, f2);
  else
    lg = 0.0;
  get_next_br(centre, p2, &abup2, &abdown2, &f1, &f2);
  if (f1 != NULL)
    ld = tree_bal(p2, f1, f2);
  else
    ld = 0.0;
  pg = lg + 1;
  pd = ld + 1;
  if (pg > pd)
    pd = pg;
  else
    pg = pd;
  *abup1 = *abdown1 = pg - lg;
  *abup2 = *abdown2 = pd - ld;
  return (pg);
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<scan_int>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x10(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  lea    D2(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <sscanf@plt>
  mov    %eax,-0xc(%rbp)
  cmpl   $0x1,-0xc(%rbp)
  je     L20
  mov    -0x20(%rbp),%rax
  mov    %rax,%rsi
  lea    D18(%rip),%rax
  mov    %rax,%rdi
  call   <err_printf@plt>
  mov    $0xffffffff,%eax
  jmp    L10
L20:
  mov    -0x10(%rbp),%edx
  mov    -0x18(%rbp),%rax
  mov    %edx,(%rax)
  mov    $0x0,%eax
L10:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L28
  call   <__stack_chk_fail@plt>
L28:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: data_tag: D2
data_type: string
name: retrieve_data
arguments: data_tag: D18
data_type: string

tool: D2: %d

tool: D18: bad int value: %s


assistant: ```c
int scan_int(int *d, char *val) {
  int ret;
  int v;
  ret = sscanf(val, "%d", &v);
  if (ret != 1) {
    err_printf("bad int value: %s\n", val);
    return -1;
  }
  *d = v;
  return 0;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<scan_int>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%rbp
  mov    %rsi,%rbx
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    0x4(%rsp),%rdx
  lea    D10(%rip),%rsi
  mov    %rbx,%rdi
  call   <sscanf@plt>
  cmp    $0x1,%eax
  jne    L0
  mov    0x4(%rsp),%eax
  mov    %eax,0x0(%rbp)
  mov    $0x0,%eax
L23:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L14
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  ret
L0:
  mov    %rbx,%rsi
  lea    D15(%rip),%rdi
  call   <err_printf@plt>
  mov    $0xffffffff,%eax
  jmp    L23
L14:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_label: D10
type_infered: string
name: retrieve_data
arguments: data_label: D15
type_infered: string

tool: D10: %d

tool: D15: bad int value: %s


assistant: ```c
int scan_int(int *d, char *val) {
  int ret;
  int v;
  ret = sscanf(val, "%d", &v);
  if (ret != 1) {
    err_printf("bad int value: %s\n", val);
    return -1;
  }
  *d = v;
  return 0;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<scan_int>:
  endbr64
  push   %rbp
  mov    %rsi,%rbp
  lea    D19(%rip),%rsi
  push   %rbx
  mov    %rdi,%rbx
  mov    %rbp,%rdi
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    0x4(%rsp),%rdx
  call   <sscanf@plt>
  cmp    $0x1,%eax
  jne    L8
  mov    0x4(%rsp),%eax
  mov    %eax,(%rbx)
  xor    %eax,%eax
L7:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L29
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  ret
L8:
  mov    %rbp,%rsi
  lea    D0(%rip),%rdi
  call   <err_printf@plt>
  mov    $0xffffffff,%eax
  jmp    L7
L29:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_label: D19
type: string
name: disassemble_data
arguments: data_label: D0
type: string

tool: D19: %d

tool: D0: bad int value: %s


assistant: ```c
int scan_int(int *d, char *val) {
  int ret;
  int v;
  ret = sscanf(val, "%d", &v);
  if (ret != 1) {
    err_printf("bad int value: %s\n", val);
    return -1;
  }
  *d = v;
  return 0;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<scan_int>:
  endbr64
  push   %rbp
  mov    %rsi,%rbp
  lea    D13(%rip),%rsi
  push   %rbx
  mov    %rdi,%rbx
  mov    %rbp,%rdi
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    0x4(%rsp),%rdx
  call   <sscanf@plt>
  cmp    $0x1,%eax
  jne    L11
  mov    0x4(%rsp),%eax
  mov    %eax,(%rbx)
  xor    %eax,%eax
L13:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L25
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  ret
L11:
  mov    %rbp,%rsi
  lea    D3(%rip),%rdi
  call   <err_printf@plt>
  mov    $0xffffffff,%eax
  jmp    L13
L25:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_tag: D13
datatype: string
name: retrieve_data
arguments: data_tag: D3
datatype: string

tool: D13: %d

tool: D3: bad int value: %s


assistant: ```c
int scan_int(int *d, char *val) {
  int ret;
  int v;
  ret = sscanf(val, "%d", &v);
  if (ret != 1) {
    err_printf("bad int value: %s\n", val);
    return -1;
  }
  *d = v;
  return 0;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<median>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %edx,0x18(%rsp)
  mov    %ecx,0x1c(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  test   %ecx,%ecx
  jle    L169
  mov    %rdi,%rbp
  mov    %rsi,%rbx
  mov    %edx,%eax
  mov    %edx,%r15d
  neg    %r15d
  mov    $0x0,%r11d
  mov    $0x0,%r9d
  mov    %edx,%r12d
  lea    -0x1(%rcx),%r13d
  lea    -0x1(%rdx),%r14d
  cltq
  mov    %rax,0x8(%rsp)
  lea    0x2f(%rsp),%r10
  jmp    L185
L166:
  add    $0x1,%rdx
  cmp    %rdi,%rdx
  je     L126
L75:
  movzbl (%rdx),%ecx
  movzbl 0x1(%rdx),%esi
  cmp    %sil,%cl
  jbe    L166
  mov    %sil,(%rdx)
  mov    %cl,0x1(%rdx)
  jmp    L166
L126:
  sub    $0x1,%rdi
  cmp    %r10,%rdi
  je     L88
L12:
  mov    %edi,%ecx
  sub    %r10d,%ecx
  mov    %r10,%rdx
  test   %ecx,%ecx
  jg     L75
  jmp    L126
L88:
  add    %r11d,%eax
  cltq
  movzbl 0x33(%rsp),%edx
  mov    %dl,0x0(%rbp,%rax,1)
  jmp    L164
L67:
  add    %r11d,%eax
  cltq
  movzbl (%rbx,%rax,1),%edx
  mov    %dl,0x0(%rbp,%rax,1)
L164:
  add    $0x1,%r8
  cmp    %r12,%r8
  je     L148
L22:
  mov    %r8d,%eax
  test   %r9d,%r9d
  jle    L67
  cmp    %r9d,%r13d
  jle    L67
  test   %r8d,%r8d
  jle    L67
  cmp    %r8d,%r14d
  jle    L67
  mov    0x10(%rsp),%rdi
  lea    (%rdi,%r8,1),%rsi
  mov    %r10,%rcx
  mov    $0x0,%edi
L167:
  mov    $0xffffffffffffffff,%rdx
  mov    %eax,0x4(%rsp)
L66:
  movzbl (%rsi,%rdx,1),%eax
  mov    %al,0x1(%rcx,%rdx,1)
  add    $0x1,%rdx
  cmp    $0x2,%rdx
  jne    L66
  mov    0x4(%rsp),%eax
  add    $0x3,%edi
  add    0x8(%rsp),%rsi
  add    $0x3,%rcx
  cmp    $0x9,%edi
  jne    L167
  lea    0x8(%r10),%rdi
  jmp    L12
L148:
  add    $0x1,%r9d
  mov    0x18(%rsp),%eax
  add    %eax,%r11d
  add    %eax,%r15d
  cmp    %r9d,0x1c(%rsp)
  je     L169
L185:
  mov    $0x0,%r8d
  movslq %r15d,%rax
  add    %rbx,%rax
  mov    %rax,0x10(%rsp)
  cmpl   $0x0,0x18(%rsp)
  jg     L22
  jmp    L148
L169:
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L62
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L62:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void median(unsigned char *out, unsigned char *in, int w, int h) {
  int i, j, m, n;
  unsigned char sort[9];
  unsigned char tmp;
  for (i = 0; i < h; i++) {
    for (j = 0; j < w; j++) {
      if (i > 0 && i < h - 1 && j > 0 && j < w - 1) {
        for (m = -1; m <= +1; m++) {
          for (n = -1; n <= +1; n++) {
            sort[(m + 1) * 3 + (n + 1)] = in[(i + m) * w + (j + n)];
          }
        }
        for (m = 0; m < 8; m++) {
          for (n = 0; n < 8 - m; n++) {
            if (sort[n] > sort[n + 1]) {
              tmp = sort[n];
              sort[n] = sort[n + 1];
              sort[n + 1] = tmp;
            }
          }
        }
        out[i * w + j] = sort[4];
      } else {
        out[i * w + j] = in[i * w + j];
      }
    }
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<median>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x58,%rsp
  mov    %ecx,0xc(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x48(%rsp)
  xor    %eax,%eax
  test   %ecx,%ecx
  jle    L1
  movslq %edx,%rax
  mov    %edx,%r12d
  mov    %rdi,%r11
  mov    %rsi,%rbp
  mov    %rax,0x20(%rsp)
  lea    -0x1(%rsi),%rax
  neg    %r12d
  mov    %edx,%r15d
  mov    %rax,0x10(%rsp)
  lea    0x48(%rsp),%rax
  xor    %r9d,%r9d
  lea    -0x1(%rcx),%r13d
  mov    %rax,0x28(%rsp)
  lea    0x3f(%rsp),%rbx
  movslq %r12d,%rax
  nopw   0x0(%rax,%rax,1)
L0:
  lea    (%rax,%r15,1),%r12d
  test   %r15d,%r15d
  jle    L139
  lea    -0x1(%r15),%r10d
  add    0x10(%rsp),%rax
  mov    %r12d,%r8d
  xor    %edi,%edi
  mov    %rax,(%rsp)
  mov    %r10,%r14
  jmp    L111
L77:
  mov    %rax,%rdi
L111:
  test   %r9d,%r9d
  je     L33
  cmp    %r9d,%r13d
  jle    L33
  test   %edi,%edi
  je     L33
  cmp    %edi,%r14d
  jg     L146
  cs nopw 0x0(%rax,%rax,1)
L33:
  movslq %r8d,%rax
  movzbl 0x0(%rbp,%rax,1),%edx
  mov    %dl,(%r11,%rax,1)
L90:
  lea    0x1(%rdi),%rax
  add    $0x1,%r8d
  cmp    %r10,%rdi
  jne    L77
L139:
  add    $0x1,%r9d
  movslq %r12d,%rax
  cmp    %r9d,0xc(%rsp)
  jne    L0
L1:
  mov    0x48(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L80
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L146:
  mov    (%rsp),%rax
  mov    0x20(%rsp),%rsi
  mov    %rdi,0x18(%rsp)
  mov    0x28(%rsp),%rcx
  lea    (%rax,%rdi,1),%rdx
  mov    %rbx,%rax
L51:
  movzwl (%rdx),%edi
  add    $0x3,%rax
  mov    %di,-0x3(%rax)
  movzbl 0x2(%rdx),%edi
  add    %rsi,%rdx
  mov    %dil,-0x1(%rax)
  cmp    %rcx,%rax
  jne    L51
  mov    0x18(%rsp),%rdi
  lea    0x8(%rbx),%rsi
  xchg   %ax,%ax
L24:
  mov    %rbx,%rax
  nopl   0x0(%rax,%rax,1)
L82:
  movzbl (%rax),%edx
  movzbl 0x1(%rax),%ecx
  cmp    %cl,%dl
  jbe    L94
  mov    %cl,(%rax)
  mov    %dl,0x1(%rax)
L94:
  add    $0x1,%rax
  cmp    %rax,%rsi
  jne    L82
  sub    $0x1,%rsi
  cmp    %rsi,%rbx
  jne    L24
  movzbl 0x43(%rsp),%edx
  movslq %r8d,%rax
  mov    %dl,(%r11,%rax,1)
  jmp    L90
L80:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void median(unsigned char *out, unsigned char *in, int w, int h) {
  int i, j, m, n;
  unsigned char sort[9];
  unsigned char tmp;
  for (i = 0; i < h; i++) {
    for (j = 0; j < w; j++) {
      if (i > 0 && i < h - 1 && j > 0 && j < w - 1) {
        for (m = -1; m <= +1; m++) {
          for (n = -1; n <= +1; n++) {
            sort[(m + 1) * 3 + (n + 1)] = in[(i + m) * w + (j + n)];
          }
        }
        for (m = 0; m < 8; m++) {
          for (n = 0; n < 8 - m; n++) {
            if (sort[n] > sort[n + 1]) {
              tmp = sort[n];
              sort[n] = sort[n + 1];
              sort[n + 1] = tmp;
            }
          }
        }
        out[i * w + j] = sort[4];
      } else {
        out[i * w + j] = in[i * w + j];
      }
    }
  }
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<StrLower>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  jmp    L12
L22:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x40,%al
  jle    L34
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x5a,%al
  jg     L34
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movzbl (%rax),%eax
  lea    0x20(%rax),%ecx
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
  jmp    L12
L34:
  mov    -0x18(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x8(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
L12:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L22
  mov    -0x8(%rbp),%rax
  movb   $0x0,(%rax)
  mov    -0x20(%rbp),%rax
  pop    %rbp
  ret
```

assistant: ```c
char *StrLower(const char *in, char *out) {
  char *scan = out;
  while (*in != '\0')
    if ((*in >= 'A') && (*in <= 'Z'))
      *scan++ = *in++ + 'a' - 'A';
    else
      *scan++ = *in++;
  *scan = '\0';
  return out;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<StrLower>:
  endbr64
  mov    %rsi,%rax
  movzbl (%rdi),%edx
  test   %dl,%dl
  je     L32
  add    $0x1,%rdi
  lea    0x1(%rsi),%rcx
  jmp    L16
L43:
  mov    %rdi,%r8
  mov    %rcx,%r9
L41:
  mov    %dl,-0x1(%rcx)
  movzbl (%r8),%edx
  add    $0x1,%rdi
  add    $0x1,%rcx
  test   %dl,%dl
  je     L6
L16:
  lea    -0x41(%rdx),%r8d
  cmp    $0x19,%r8b
  ja     L43
  mov    %rdi,%r8
  mov    %rcx,%r9
  add    $0x20,%edx
  jmp    L41
L32:
  mov    %rsi,%r9
L6:
  movb   $0x0,(%r9)
  ret
```

assistant: ```c
char *StrLower(const char *in, char *out) {
  char *scan = out;
  while (*in != '\0')
    if ((*in >= 'A') && (*in <= 'Z'))
      *scan++ = *in++ + 'a' - 'A';
    else
      *scan++ = *in++;
  *scan = '\0';
  return out;
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<StrLower>:
  endbr64
  movzbl (%rdi),%edx
  mov    %rsi,%rax
  mov    %rsi,%rcx
  test   %dl,%dl
  je     L14
  nopl   0x0(%rax)
L13:
  lea    -0x41(%rdx),%r9d
  add    $0x1,%rdi
  lea    0x20(%rdx),%r8d
  add    $0x1,%rcx
  cmp    $0x1a,%r9b
  cmovb  %r8d,%edx
  mov    %dl,-0x1(%rcx)
  movzbl (%rdi),%edx
  test   %dl,%dl
  jne    L13
L14:
  movb   $0x0,(%rcx)
  ret
```

assistant: ```c
char *StrLower(const char *in, char *out) {
  char *scan = out;
  while (*in != '\0')
    if ((*in >= 'A') && (*in <= 'Z'))
      *scan++ = *in++ + 'a' - 'A';
    else
      *scan++ = *in++;
  *scan = '\0';
  return out;
}
```