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

```asm
<wrap_one_var>:
  endbr64
  push   %r14
  mov    %rdi,%r14
  mov    $0xa,%edi
  push   %r13
  mov    %rsi,%r13
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  mov    %rcx,%rbp
  sub    $0x8,%rsp
  call   <putchar@plt>
  mov    %rbp,%rdx
  mov    %r12,%rsi
  xor    %eax,%eax
  lea    D47(%rip),%rdi
  call   <printf@plt>
  lea    D27(%rip),%rdi
  call   <puts@plt>
  mov    %r13,%rsi
  lea    D20(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    %r14,%rsi
  lea    D76(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  lea    D60(%rip),%rdi
  call   <puts@plt>
  mov    %rbp,%rsi
  mov    %r13,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L8
  mov    %rbp,%rsi
  lea    D65(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
L17:
  add    $0x8,%rsp
  mov    %r12,%rsi
  lea    D24(%rip),%rdi
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  jmp    10a0 <printf@plt>
L8:
  lea    D22(%rip),%rdi
  call   <puts@plt>
  jmp    L17
```

tool_calls: name: extract_symbolic_data
arguments: tag: D47
datatype: string
name: extract_symbolic_data
arguments: tag: D27
datatype: string
name: extract_symbolic_data
arguments: tag: D20
datatype: string
name: extract_symbolic_data
arguments: tag: D76
datatype: string
name: extract_symbolic_data
arguments: tag: D60
datatype: string
name: extract_symbolic_data
arguments: tag: D65
datatype: string
name: extract_symbolic_data
arguments: tag: D24
datatype: string
name: extract_symbolic_data
arguments: tag: D22
datatype: string

tool: D47:    function %s return %s


tool: D27:    is

tool: D20:       Result : %s;


tool: D76:       pragma Import (C, Result, "%s");


tool: D60:    begin

tool: D65:       return %s (Result);


tool: D24:    end %s;


tool: D22:       return Result;

assistant: ```c
void wrap_one_var(const char *c_var, const char *c_type, const char *ada_func, const char *ada_type) {
  printf("\n");
  printf("   function %s return %s\n", ada_func, ada_type);
  printf("   is\n");
  printf("      Result : %s;\n", c_type);
  printf("      pragma Import (C, Result, \"%s\");\n", c_var);
  printf("   begin\n");
  if (strcmp(c_type, ada_type))
    printf("      return %s (Result);\n", ada_type);
  else
    printf("      return Result;\n");
  printf("   end %s;\n", ada_func);
}
```
user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<find_filename_extension>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  mov    $0x2e,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  jmp    L27
L4:
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  mov    $0x2e,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  je     L27
  mov    -0x8(%rbp),%rax
  mov    %rax,-0x10(%rbp)
L27:
  cmpq   $0x0,-0x8(%rbp)
  jne    L4
  cmpq   $0x0,-0x10(%rbp)
  je     L25
  addq   $0x1,-0x10(%rbp)
L25:
  mov    -0x10(%rbp),%rax
  leave
  ret
```

assistant: ```c
const char *find_filename_extension(const char *fname) {
  const char *retval = strchr(fname, '.');
  const char *p = retval;
  while (p != NULL) {
    p = strchr(p + 1, '.');
    if (p != NULL)
      retval = p;
  }
  if (retval != NULL)
    retval++;
  return (retval);
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<find_filename_extension>:
  endbr64
  push   %rbx
  mov    $0x2e,%esi
  call   <strchr@plt>
  test   %rax,%rax
  je     L39
  mov    %rax,%rdi
  jmp    L9
L35:
  mov    %rax,%rdi
L9:
  add    $0x1,%rdi
  mov    %rax,%rbx
  mov    $0x2e,%esi
  call   <strchr@plt>
  test   %rax,%rax
  jne    L35
  cmp    $0x1,%rbx
  sbb    $0xffffffffffffffff,%rbx
L4:
  mov    %rbx,%rax
  pop    %rbx
  ret
L39:
  mov    %rax,%rbx
  jmp    L4
```

assistant: ```c
const char *find_filename_extension(const char *fname) {
  const char *retval = strchr(fname, '.');
  const char *p = retval;
  while (p != NULL) {
    p = strchr(p + 1, '.');
    if (p != NULL)
      retval = p;
  }
  if (retval != NULL)
    retval++;
  return (retval);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<find_filename_extension>:
  endbr64
  push   %rbx
  mov    $0x2e,%esi
  call   <strchr@plt>
  nop
L10:
  test   %rax,%rax
  je     L3
  lea    0x1(%rax),%rbx
  mov    $0x2e,%esi
  mov    %rbx,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  jne    L10
  mov    %rbx,%rax
L3:
  pop    %rbx
  ret
```

assistant: ```c
const char *find_filename_extension(const char *fname) {
  const char *retval = strchr(fname, '.');
  const char *p = retval;
  while (p != NULL) {
    p = strchr(p + 1, '.');
    if (p != NULL)
      retval = p;
  }
  if (retval != NULL)
    retval++;
  return (retval);
}
```
user: What is the c source code of the assembly code below?

```asm
<find_filename_extension>:
  endbr64
  push   %rbx
  mov    $0x2e,%esi
  call   <strchr@plt>
  nop
L1:
  test   %rax,%rax
  je     L0
  lea    0x1(%rax),%rbx
  mov    $0x2e,%esi
  mov    %rbx,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  jne    L1
  mov    %rbx,%rax
L0:
  pop    %rbx
  ret
```

assistant: ```c
const char *find_filename_extension(const char *fname) {
  const char *retval = strchr(fname, '.');
  const char *p = retval;
  while (p != NULL) {
    p = strchr(p + 1, '.');
    if (p != NULL)
      retval = p;
  }
  if (retval != NULL)
    retval++;
  return (retval);
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<v4l_format_s_ycbcr_enc>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x8(%rbp)
  mov    %esi,-0xc(%rbp)
  mov    -0x8(%rbp),%rax
  mov    (%rax),%eax
  cmp    $0x83,%eax
  je     L39
  cmp    $0x83,%eax
  jg     L23
  cmp    $0x82,%eax
  je     L53
  cmp    $0x82,%eax
  jg     L23
  cmp    $0x80,%eax
  je     L53
  cmp    $0x81,%eax
  jne    L23
L39:
  mov    -0x8(%rbp),%rax
  mov    -0xc(%rbp),%edx
  mov    %edx,0x8(%rax)
  jmp    L23
L53:
  mov    -0x8(%rbp),%rax
  mov    -0xc(%rbp),%edx
  mov    %edx,0x4(%rax)
  nop
L23:
  nop
  pop    %rbp
  ret
```

assistant: ```c
void v4l_format_s_ycbcr_enc(struct v4l2_format *fmt, unsigned ycbcr_enc) {
  switch (fmt->type) {
  case V4L2_BUF_TYPE_VIDEO_CAPTURE:
  case V4L2_BUF_TYPE_VIDEO_OUTPUT:
    fmt->fmt.pix.ycbcr_enc = ycbcr_enc;
    break;
  case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
  case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
    fmt->fmt.pix_mp.ycbcr_enc = ycbcr_enc;
    break;
  }
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<v4l_format_s_ycbcr_enc>:
  endbr64
  mov    (%rdi),%eax
  cmp    $0x82,%eax
  je     L18
  jg     L27
  cmp    $0x80,%eax
  je     L18
  cmp    $0x81,%eax
  jne    L16
L34:
  mov    %esi,0x8(%rdi)
  ret
L16:
  ret
L27:
  cmp    $0x83,%eax
  je     L34
L54:
  ret
L18:
  mov    %esi,0x4(%rdi)
  jmp    L54
```

assistant: ```c
void v4l_format_s_ycbcr_enc(struct v4l2_format *fmt, unsigned ycbcr_enc) {
  switch (fmt->type) {
  case V4L2_BUF_TYPE_VIDEO_CAPTURE:
  case V4L2_BUF_TYPE_VIDEO_OUTPUT:
    fmt->fmt.pix.ycbcr_enc = ycbcr_enc;
    break;
  case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
  case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
    fmt->fmt.pix_mp.ycbcr_enc = ycbcr_enc;
    break;
  }
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<v4l_format_s_ycbcr_enc>:
  endbr64
  mov    (%rdi),%eax
  cmp    $0x82,%eax
  je     L41
  jg     L18
  cmp    $0x80,%eax
  je     L41
  cmp    $0x81,%eax
  jne    L1
L47:
  mov    %esi,0x8(%rdi)
  ret
  nopl   0x0(%rax)
L18:
  cmp    $0x83,%eax
  je     L47
  ret
L41:
  mov    %esi,0x4(%rdi)
  ret
L1:
  ret
```

assistant: ```c
void v4l_format_s_ycbcr_enc(struct v4l2_format *fmt, unsigned ycbcr_enc) {
  switch (fmt->type) {
  case V4L2_BUF_TYPE_VIDEO_CAPTURE:
  case V4L2_BUF_TYPE_VIDEO_OUTPUT:
    fmt->fmt.pix.ycbcr_enc = ycbcr_enc;
    break;
  case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
  case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
    fmt->fmt.pix_mp.ycbcr_enc = ycbcr_enc;
    break;
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<v4l_format_s_ycbcr_enc>:
  endbr64
  mov    (%rdi),%eax
  cmp    $0x82,%eax
  je     L49
  jg     L21
  cmp    $0x80,%eax
  je     L49
  cmp    $0x81,%eax
  jne    L8
L44:
  mov    %esi,0x8(%rdi)
  ret
  nopl   0x0(%rax)
L21:
  cmp    $0x83,%eax
  je     L44
  ret
L49:
  mov    %esi,0x4(%rdi)
  ret
L8:
  ret
```

assistant: ```c
void v4l_format_s_ycbcr_enc(struct v4l2_format *fmt, unsigned ycbcr_enc) {
  switch (fmt->type) {
  case V4L2_BUF_TYPE_VIDEO_CAPTURE:
  case V4L2_BUF_TYPE_VIDEO_OUTPUT:
    fmt->fmt.pix.ycbcr_enc = ycbcr_enc;
    break;
  case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
  case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
    fmt->fmt.pix_mp.ycbcr_enc = ycbcr_enc;
    break;
  }
}
```
user: Translate the below assembly code into C programming language:

```asm
<hotstart_open>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    $0x0,%eax
  call   <openHotstartFile1@plt>
  test   %eax,%eax
  jne    L25
  mov    $0x0,%eax
  jmp    L10
L25:
  mov    $0x0,%eax
  call   <openHotstartFile2@plt>
  test   %eax,%eax
  jne    L17
  mov    $0x0,%eax
  jmp    L10
L17:
  mov    $0x1,%eax
L10:
  pop    %rbp
  ret
```

assistant: ```c
int hotstart_open() {
  if (!openHotstartFile1())
    return 0;
  if (!openHotstartFile2())
    return 0;
  return 1;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<hotstart_open>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x0,%eax
  call   <openHotstartFile1@plt>
  test   %eax,%eax
  jne    L18
L6:
  add    $0x8,%rsp
  ret
L18:
  mov    $0x0,%eax
  call   <openHotstartFile2@plt>
  test   %eax,%eax
  setne  %al
  movzbl %al,%eax
  jmp    L6
```

assistant: ```c
int hotstart_open() {
  if (!openHotstartFile1())
    return 0;
  if (!openHotstartFile2())
    return 0;
  return 1;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<hotstart_open>:
  endbr64
  sub    $0x8,%rsp
  xor    %eax,%eax
  call   <openHotstartFile1@plt>
  test   %eax,%eax
  je     L4
  xor    %eax,%eax
  call   <openHotstartFile2@plt>
  test   %eax,%eax
  setne  %al
  movzbl %al,%eax
L4:
  add    $0x8,%rsp
  ret
```

assistant: ```c
int hotstart_open() {
  if (!openHotstartFile1())
    return 0;
  if (!openHotstartFile2())
    return 0;
  return 1;
}
```
user: Translate the below assembly code into C programming language:

```asm
<hotstart_open>:
  endbr64
  sub    $0x8,%rsp
  xor    %eax,%eax
  call   <openHotstartFile1@plt>
  test   %eax,%eax
  je     L6
  xor    %eax,%eax
  call   <openHotstartFile2@plt>
  test   %eax,%eax
  setne  %al
  movzbl %al,%eax
L6:
  add    $0x8,%rsp
  ret
```

assistant: ```c
int hotstart_open() {
  if (!openHotstartFile1())
    return 0;
  if (!openHotstartFile2())
    return 0;
  return 1;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<generate_numbers>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  movl   $0x1,-0x4(%rbp)
  jmp    L8
L9:
  mov    -0x4(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    -0x4(%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  add    $0x4,%edx
  mov    %edx,(%rax)
  addl   $0x1,-0x4(%rbp)
L8:
  cmpl   $0x9,-0x4(%rbp)
  jle    L9
  nop
  nop
  pop    %rbp
  ret
```

assistant: ```c
void generate_numbers(int *numbers) {
  int i;
  for (i = 1; i < 10; i++)
    numbers[i] = numbers[i - 1] + 4;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<generate_numbers>:
  endbr64
  lea    0x24(%rdi),%rdx
L0:
  mov    (%rdi),%eax
  add    $0x4,%eax
  mov    %eax,0x4(%rdi)
  add    $0x4,%rdi
  cmp    %rdx,%rdi
  jne    L0
  ret
```

assistant: ```c
void generate_numbers(int *numbers) {
  int i;
  for (i = 1; i < 10; i++)
    numbers[i] = numbers[i - 1] + 4;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<generate_numbers>:
  endbr64
  lea    0x24(%rdi),%rdx
  nopl   0x0(%rax,%rax,1)
L9:
  mov    (%rdi),%eax
  add    $0x4,%rdi
  add    $0x4,%eax
  mov    %eax,(%rdi)
  cmp    %rdx,%rdi
  jne    L9
  ret
```

assistant: ```c
void generate_numbers(int *numbers) {
  int i;
  for (i = 1; i < 10; i++)
    numbers[i] = numbers[i - 1] + 4;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<generate_numbers>:
  endbr64
  mov    (%rdi),%eax
  lea    0x18(%rax),%ecx
  lea    0x10(%rax),%esi
  movd   %eax,%xmm4
  lea    0x14(%rax),%edx
  movd   %ecx,%xmm1
  lea    0x1c(%rax),%ecx
  movd   %esi,%xmm0
  movd   %ecx,%xmm2
  movd   %edx,%xmm3
  punpckldq %xmm2,%xmm1
  punpckldq %xmm3,%xmm0
  punpcklqdq %xmm1,%xmm0
  paddd  D18(%rip),%xmm0
  pshufd $0x0,%xmm4,%xmm1
  paddd  D8(%rip),%xmm1
  movups %xmm0,0x14(%rdi)
  pshufd $0xff,%xmm0,%xmm0
  movd   %xmm0,%eax
  movups %xmm1,0x4(%rdi)
  add    $0x4,%eax
  mov    %eax,0x24(%rdi)
  ret
```

tool_calls: name: disassemble_data
arguments: data_label: D18
data_type: byte[16]
name: disassemble_data
arguments: data_label: D8
data_type: byte[16]

tool: {"D18": [0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00]}

tool: {"D8": [0x04,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x10,0x00,0x00,0x00]}

assistant: ```c
void generate_numbers(int *numbers) {
  int i;
  for (i = 1; i < 10; i++)
    numbers[i] = numbers[i - 1] + 4;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<xstrdup>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  jne    L7
  mov    $0x0,%eax
  jmp    L26
L7:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    $0x1,%eax
  cltq
  mov    %rax,-0x10(%rbp)
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  je     L25
  mov    -0x10(%rbp),%rdx
  mov    -0x18(%rbp),%rcx
  mov    -0x8(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
L25:
  mov    -0x8(%rbp),%rax
L26:
  leave
  ret
```

assistant: ```c
char *xstrdup(const char *s) {
  char *t;
  size_t len;
  if (!s)
    return NULL;
  len = strlen(s) + 1;
  t = (char *)malloc(len);
  if (t) {
    memcpy(t, s, len);
  }
  return t;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<xstrdup>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbp
  test   %rdi,%rdi
  je     L6
  call   <strlen@plt>
  lea    0x1(%rax),%ebx
  movslq %ebx,%rbx
  mov    %rbx,%rdi
  call   <malloc@plt>
  mov    %rax,%r12
  test   %rax,%rax
  jne    L38
L20:
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L38:
  mov    %rbx,%rdx
  mov    %rbp,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  jmp    L20
L6:
  mov    %rdi,%r12
  jmp    L20
```

assistant: ```c
char *xstrdup(const char *s) {
  char *t;
  size_t len;
  if (!s)
    return NULL;
  len = strlen(s) + 1;
  t = (char *)malloc(len);
  if (t) {
    memcpy(t, s, len);
  }
  return t;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<xstrdup>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  test   %rdi,%rdi
  je     L7
  mov    %rdi,%rbp
  call   <strlen@plt>
  lea    0x1(%rax),%r13d
  movslq %r13d,%r13
  mov    %r13,%rdi
  call   <malloc@plt>
  mov    %rax,%r12
  test   %rax,%rax
  jne    L0
L7:
  xor    %r12d,%r12d
  pop    %rbp
  mov    %r12,%rax
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L0:
  mov    %r13,%rdx
  mov    %rbp,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
char *xstrdup(const char *s) {
  char *t;
  size_t len;
  if (!s)
    return NULL;
  len = strlen(s) + 1;
  t = (char *)malloc(len);
  if (t) {
    memcpy(t, s, len);
  }
  return t;
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<xstrdup>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  test   %rdi,%rdi
  je     L1
  mov    %rdi,%rbp
  call   <strlen@plt>
  lea    0x1(%rax),%r13d
  movslq %r13d,%r13
  mov    %r13,%rdi
  call   <malloc@plt>
  mov    %rax,%r12
  test   %rax,%rax
  jne    L2
L1:
  xor    %r12d,%r12d
  pop    %rbp
  mov    %r12,%rax
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L2:
  mov    %r13,%rdx
  mov    %rbp,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
char *xstrdup(const char *s) {
  char *t;
  size_t len;
  if (!s)
    return NULL;
  len = strlen(s) + 1;
  t = (char *)malloc(len);
  if (t) {
    memcpy(t, s, len);
  }
  return t;
}
```
user: What is the c source code of the assembly code below:

```asm
<partition>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    %edx,-0x20(%rbp)
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  %xmm0,-0x8(%rbp)
  mov    -0x1c(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x10(%rbp)
  mov    -0x1c(%rbp),%eax
  mov    %eax,-0xc(%rbp)
  jmp    L5
L8:
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  movsd  -0x8(%rbp),%xmm0
  comisd %xmm1,%xmm0
  jb     L23
  addl   $0x1,-0x10(%rbp)
  mov    -0xc(%rbp),%edx
  mov    -0x10(%rbp),%ecx
  mov    -0x18(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <swap@plt>
L23:
  addl   $0x1,-0xc(%rbp)
L5:
  mov    -0xc(%rbp),%eax
  cmp    -0x20(%rbp),%eax
  jl     L8
  mov    -0x10(%rbp),%eax
  lea    0x1(%rax),%ecx
  mov    -0x20(%rbp),%edx
  mov    -0x18(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <swap@plt>
  mov    -0x10(%rbp),%eax
  add    $0x1,%eax
  leave
  ret
```

assistant: ```c
int partition(double *v, int low, int high) {
  double pivot = v[high];
  int i = low - 1;
  for (int j = low; j < high; j++) {
    if (v[j] <= pivot) {
      i++;
      swap(v, i, j);
    }
  }
  swap(v, i + 1, high);
  return i + 1;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<partition>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbp
  mov    %edx,%r14d
  movslq %edx,%rax
  mov    (%rdi,%rax,8),%r13
  lea    -0x1(%rsi),%r12d
  cmp    %esi,%edx
  jle    L12
  movslq %esi,%rbx
  mov    %edx,%eax
  sub    %esi,%eax
  lea    -0x1(%rax),%eax
  lea    0x1(%rbx,%rax,1),%r15
  jmp    L31
L17:
  add    $0x1,%rbx
  cmp    %r15,%rbx
  je     L12
L31:
  mov    %ebx,%edx
  movq   %r13,%xmm0
  comisd 0x0(%rbp,%rbx,8),%xmm0
  jb     L17
  add    $0x1,%r12d
  mov    %r12d,%esi
  mov    %rbp,%rdi
  call   <swap@plt>
  jmp    L17
L12:
  add    $0x1,%r12d
  mov    %r14d,%edx
  mov    %r12d,%esi
  mov    %rbp,%rdi
  call   <swap@plt>
  mov    %r12d,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
int partition(double *v, int low, int high) {
  double pivot = v[high];
  int i = low - 1;
  for (int j = low; j < high; j++) {
    if (v[j] <= pivot) {
      i++;
      swap(v, i, j);
    }
  }
  swap(v, i + 1, high);
  return i + 1;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<partition>:
  endbr64
  push   %r14
  movslq %edx,%rax
  push   %r13
  mov    %rax,%r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x10,%rsp
  movsd  (%rdi,%rax,8),%xmm0
  cmp    %esi,%eax
  jle    L0
  mov    %r13d,%edx
  movslq %esi,%rax
  lea    -0x1(%rsi),%r14d
  sub    %esi,%edx
  lea    0x1(%rax),%rbx
  lea    -0x1(%rdx),%r12d
  add    %rbx,%r12
  jmp    L49
  nopl   0x0(%rax,%rax,1)
L47:
  mov    %rbx,%rax
  cmp    %r12,%rbx
  je     L54
L23:
  add    $0x1,%rbx
L49:
  comisd 0x0(%rbp,%rax,8),%xmm0
  mov    %eax,%edx
  jb     L47
  add    $0x1,%r14d
  mov    %rbp,%rdi
  movsd  %xmm0,0x8(%rsp)
  mov    %r14d,%esi
  call   <swap@plt>
  movsd  0x8(%rsp),%xmm0
  mov    %rbx,%rax
  cmp    %r12,%rbx
  jne    L23
L54:
  add    $0x1,%r14d
L34:
  mov    %r13d,%edx
  mov    %r14d,%esi
  mov    %rbp,%rdi
  call   <swap@plt>
  add    $0x10,%rsp
  mov    %r14d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax,%rax,1)
L0:
  mov    %esi,%r14d
  jmp    L34
```

assistant: ```c
int partition(double *v, int low, int high) {
  double pivot = v[high];
  int i = low - 1;
  for (int j = low; j < high; j++) {
    if (v[j] <= pivot) {
      i++;
      swap(v, i, j);
    }
  }
  swap(v, i + 1, high);
  return i + 1;
}
```
user: Translate the below assembly code into C programming language:

```asm
<partition>:
  endbr64
  push   %r14
  movslq %edx,%rax
  push   %r13
  mov    %rax,%r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x10,%rsp
  movsd  (%rdi,%rax,8),%xmm0
  cmp    %esi,%eax
  jle    L55
  mov    %r13d,%edx
  movslq %esi,%rax
  lea    -0x1(%rsi),%r14d
  sub    %esi,%edx
  lea    0x1(%rax),%rbx
  lea    -0x1(%rdx),%r12d
  add    %rbx,%r12
  jmp    L7
  nopl   0x0(%rax,%rax,1)
L18:
  mov    %rbx,%rax
  cmp    %r12,%rbx
  je     L16
L50:
  add    $0x1,%rbx
L7:
  comisd 0x0(%rbp,%rax,8),%xmm0
  mov    %eax,%edx
  jb     L18
  add    $0x1,%r14d
  mov    %rbp,%rdi
  movsd  %xmm0,0x8(%rsp)
  mov    %r14d,%esi
  call   <swap@plt>
  movsd  0x8(%rsp),%xmm0
  mov    %rbx,%rax
  cmp    %r12,%rbx
  jne    L50
L16:
  add    $0x1,%r14d
L22:
  mov    %r13d,%edx
  mov    %r14d,%esi
  mov    %rbp,%rdi
  call   <swap@plt>
  add    $0x10,%rsp
  mov    %r14d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax,%rax,1)
L55:
  mov    %esi,%r14d
  jmp    L22
```

assistant: ```c
int partition(double *v, int low, int high) {
  double pivot = v[high];
  int i = low - 1;
  for (int j = low; j < high; j++) {
    if (v[j] <= pivot) {
      i++;
      swap(v, i, j);
    }
  }
  swap(v, i + 1, high);
  return i + 1;
}
```
user: What is the c source code of the assembly code below?

```asm
<conv_num>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %edx,-0x24(%rbp)
  mov    %ecx,-0x28(%rbp)
  movl   $0x0,-0x8(%rbp)
  mov    -0x28(%rbp),%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jle    L40
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rax
  movzbl (%rax),%eax
  cmp    $0x39,%al
  jle    L91
L40:
  mov    $0x0,%eax
  jmp    L49
L91:
  mov    -0x8(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  add    %eax,%eax
  mov    %eax,-0x8(%rbp)
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rax
  lea    0x1(%rax),%rcx
  mov    -0x18(%rbp),%rdx
  mov    %rcx,(%rdx)
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x30,%eax
  add    %eax,-0x8(%rbp)
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  imul   $0x66666667,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x2,%edx
  sar    $0x1f,%eax
  mov    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  mov    %eax,-0x4(%rbp)
  mov    -0x8(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  add    %eax,%eax
  cmp    %eax,-0x28(%rbp)
  jl     L63
  cmpl   $0x0,-0x4(%rbp)
  je     L63
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jle    L63
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rax
  movzbl (%rax),%eax
  cmp    $0x39,%al
  jle    L91
L63:
  mov    -0x8(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jl     L69
  mov    -0x8(%rbp),%eax
  cmp    -0x28(%rbp),%eax
  jle    L50
L69:
  mov    $0x0,%eax
  jmp    L49
L50:
  mov    -0x20(%rbp),%rax
  mov    -0x8(%rbp),%edx
  mov    %edx,(%rax)
  mov    $0x1,%eax
L49:
  pop    %rbp
  ret
```

assistant: ```c
int conv_num(buf, dest, llim, ulim) const char **buf;
int *dest;
int llim, ulim;
{
  int result = 0;
  int rulim = ulim;
  if (**buf < '0' || **buf > '9')
    return (0);
  do {
    result *= 10;
    result += *(*buf)++ - '0';
    rulim /= 10;
  } while ((result * 10 <= ulim) && rulim && **buf >= '0' && **buf <= '9');
  if (result < llim || result > ulim)
    return (0);
  *dest = result;
  return (1);
}
```