ylfeng/ReF-Decompile-dataset huggingface dataset:
user: What would the C source look like for the assembly code provided here:

```asm
<strn_reverse>:
  endbr64
  xor    %eax,%eax
  test   %rdi,%rdi
  je     L6
  push   %rbx
  mov    %rdi,%rbx
  call   <strllen@plt>
  mov    %rax,%rsi
  shr    %rsi
  je     L20
  mov    %rbx,%rdi
  lea    -0x1(%rbx,%rax,1),%rcx
  add    %rbx,%rsi
  nopw   0x0(%rax,%rax,1)
L14:
  movzbl (%rdi),%edx
  xor    (%rcx),%dl
  sub    $0x1,%rcx
  mov    %dl,(%rdi)
  xor    0x1(%rcx),%dl
  mov    %dl,0x1(%rcx)
  xor    %dl,(%rdi)
  add    $0x1,%rdi
  cmp    %rsi,%rdi
  jne    L14
L20:
  pop    %rbx
  ret
  xchg   %ax,%ax
L6:
  ret
```

assistant: ```c
size_t strn_reverse(char *buf, size_t n) {
  size_t i;
  size_t len;
  if (!buf)
    return 0;
  len = strllen(buf, n);
  for (i = 0; i < len / 2; ++i) {
    do {
      buf[i] ^= buf[(len - i) - 1];
      buf[(len - i) - 1] ^= buf[i];
      buf[i] ^= buf[(len - i) - 1];
    } while (0);
  }
  return len;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<faster_despace32>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  movq   $0x0,-0x10(%rbp)
  movq   $0x0,-0x8(%rbp)
  jmp    L37
L16:
  mov    -0x10(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x10(%rbp)
  mov    -0x28(%rbp),%rdx
  add    %rdx,%rax
  movzbl (%rax),%eax
  mov    %al,-0x11(%rbp)
  mov    -0x28(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  add    %rax,%rdx
  movzbl -0x11(%rbp),%eax
  mov    %al,(%rdx)
  movzbl -0x11(%rbp),%eax
  cmp    $0x20,%al
  jbe    L0
  mov    $0x1,%eax
  jmp    L7
L0:
  mov    $0x0,%eax
L7:
  add    %rax,-0x8(%rbp)
L37:
  mov    -0x10(%rbp),%rax
  cmp    -0x30(%rbp),%rax
  jb     L16
  mov    -0x8(%rbp),%rax
  pop    %rbp
  ret
```

assistant: ```c
size_t faster_despace32(char *bytes, size_t howmany) {
  size_t i = 0, pos = 0;
  while (i < howmany) {
    const char c = bytes[i++];
    bytes[pos] = c;
    pos += ((unsigned char)c > 32 ? 1 : 0);
  }
  return pos;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<faster_despace32>:
  endbr64
  test   %rsi,%rsi
  je     L10
  mov    %rdi,%rdx
  add    %rdi,%rsi
  mov    $0x0,%eax
L9:
  movzbl (%rdx),%ecx
  mov    %cl,(%rdi,%rax,1)
  cmp    $0x20,%cl
  seta   %cl
  movzbl %cl,%ecx
  add    %rcx,%rax
  add    $0x1,%rdx
  cmp    %rsi,%rdx
  jne    L9
  ret
L10:
  mov    %rsi,%rax
  ret
```

assistant: ```c
size_t faster_despace32(char *bytes, size_t howmany) {
  size_t i = 0, pos = 0;
  while (i < howmany) {
    const char c = bytes[i++];
    bytes[pos] = c;
    pos += ((unsigned char)c > 32 ? 1 : 0);
  }
  return pos;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<faster_despace32>:
  endbr64
  test   %rsi,%rsi
  je     L9
  mov    %rdi,%rax
  add    %rdi,%rsi
  xor    %r8d,%r8d
  nopw   0x0(%rax,%rax,1)
L6:
  movzbl (%rax),%edx
  cmp    $0x20,%dl
  mov    %dl,(%rdi,%r8,1)
  seta   %dl
  add    $0x1,%rax
  movzbl %dl,%edx
  add    %rdx,%r8
  cmp    %rax,%rsi
  jne    L6
  mov    %r8,%rax
  ret
  nopl   0x0(%rax,%rax,1)
L9:
  xor    %r8d,%r8d
  mov    %r8,%rax
  ret
```

assistant: ```c
size_t faster_despace32(char *bytes, size_t howmany) {
  size_t i = 0, pos = 0;
  while (i < howmany) {
    const char c = bytes[i++];
    bytes[pos] = c;
    pos += ((unsigned char)c > 32 ? 1 : 0);
  }
  return pos;
}
```
user: What is the c source code of the assembly code below:

```asm
<faster_despace32>:
  endbr64
  test   %rsi,%rsi
  je     L3
  mov    %rdi,%rax
  add    %rdi,%rsi
  xor    %r8d,%r8d
  nopw   0x0(%rax,%rax,1)
L2:
  movzbl (%rax),%edx
  cmp    $0x20,%dl
  mov    %dl,(%rdi,%r8,1)
  seta   %dl
  add    $0x1,%rax
  movzbl %dl,%edx
  add    %rdx,%r8
  cmp    %rax,%rsi
  jne    L2
  mov    %r8,%rax
  ret
  nopl   0x0(%rax,%rax,1)
L3:
  xor    %r8d,%r8d
  mov    %r8,%rax
  ret
```

assistant: ```c
size_t faster_despace32(char *bytes, size_t howmany) {
  size_t i = 0, pos = 0;
  while (i < howmany) {
    const char c = bytes[i++];
    bytes[pos] = c;
    pos += ((unsigned char)c > 32 ? 1 : 0);
  }
  return pos;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<Time_to_UTC>:
  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
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  lea    -0x76c(%rax),%edx
  mov    -0x18(%rbp),%rax
  mov    %edx,(%rax)
  mov    -0x18(%rbp),%rax
  movl   $0xffffffff,0x4(%rax)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <mktime@plt>
  mov    %eax,-0xc(%rbp)
  mov    -0x20(%rbp),%rdx
  lea    -0xc(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <gmtime_r@plt>
  mov    -0x20(%rbp),%rax
  mov    (%rax),%eax
  lea    0x76c(%rax),%edx
  mov    -0x20(%rbp),%rax
  mov    %edx,(%rax)
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L0
  call   <__stack_chk_fail@plt>
L0:
  leave
  ret
```

assistant: ```c
void Time_to_UTC(struct tm *cdate, struct tm *odate) {
  time_t tdate;
  cdate->tm_year -= 1900;
  cdate->tm_isdst = -1;
  tdate = mktime(cdate);
  gmtime_r(&tdate, odate);
  odate->tm_year += 1900;
}
```
user: What is the c source code of the assembly code below?

```asm
<Time_to_UTC>:
  endbr64
  push   %rbx
  sub    $0x10,%rsp
  mov    %rsi,%rbx
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  subl   $0x76c,(%rdi)
  movl   $0xffffffff,0x4(%rdi)
  call   <mktime@plt>
  mov    %eax,0x4(%rsp)
  lea    0x4(%rsp),%rdi
  mov    %rbx,%rsi
  call   <gmtime_r@plt>
  addl   $0x76c,(%rbx)
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L4
  add    $0x10,%rsp
  pop    %rbx
  ret
L4:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void Time_to_UTC(struct tm *cdate, struct tm *odate) {
  time_t tdate;
  cdate->tm_year -= 1900;
  cdate->tm_isdst = -1;
  tdate = mktime(cdate);
  gmtime_r(&tdate, odate);
  odate->tm_year += 1900;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<Time_to_UTC>:
  endbr64
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  subl   $0x76c,(%rdi)
  movl   $0xffffffff,0x4(%rdi)
  call   <mktime@plt>
  lea    0x4(%rsp),%rdi
  mov    %rbx,%rsi
  mov    %eax,0x4(%rsp)
  call   <gmtime_r@plt>
  addl   $0x76c,(%rbx)
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L0
  add    $0x10,%rsp
  pop    %rbx
  ret
L0:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void Time_to_UTC(struct tm *cdate, struct tm *odate) {
  time_t tdate;
  cdate->tm_year -= 1900;
  cdate->tm_isdst = -1;
  tdate = mktime(cdate);
  gmtime_r(&tdate, odate);
  odate->tm_year += 1900;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<Time_to_UTC>:
  endbr64
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  subl   $0x76c,(%rdi)
  movl   $0xffffffff,0x4(%rdi)
  call   <mktime@plt>
  lea    0x4(%rsp),%rdi
  mov    %rbx,%rsi
  mov    %eax,0x4(%rsp)
  call   <gmtime_r@plt>
  addl   $0x76c,(%rbx)
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L7
  add    $0x10,%rsp
  pop    %rbx
  ret
L7:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void Time_to_UTC(struct tm *cdate, struct tm *odate) {
  time_t tdate;
  cdate->tm_year -= 1900;
  cdate->tm_isdst = -1;
  tdate = mktime(cdate);
  gmtime_r(&tdate, odate);
  odate->tm_year += 1900;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<atcommand_memo>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x14(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    %rcx,-0x30(%rbp)
  movl   $0x0,-0x4(%rbp)
  cmpq   $0x0,-0x30(%rbp)
  je     L41
  mov    -0x30(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L10
L41:
  mov    $0xffffffff,%eax
  jmp    L21
L10:
  mov    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <atoi@plt>
  mov    %eax,-0x4(%rbp)
  cmpl   $0x0,-0x4(%rbp)
  js     L28
  cmpl   $0x2,-0x4(%rbp)
  jle    L24
L28:
  movl   $0x0,-0x4(%rbp)
L24:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x20(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <pc_memo@plt>
  mov    $0x0,%eax
L21:
  leave
  ret
```

assistant: ```c
atcommand_memo(const int fd, struct map_session_data *sd, const char *command, const char *message) {
  int position = 0;
  if (!message || !*message)
    return -1;
  position = atoi(message);
  if (position < 0 || position > 2)
    position = 0;
  pc_memo(sd, position + 0);
  return 0;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<atcommand_memo>:
  endbr64
  test   %rcx,%rcx
  je     L10
  push   %rbx
  mov    %rsi,%rbx
  mov    %rcx,%rdi
  cmpb   $0x0,(%rcx)
  je     L23
  call   <atoi@plt>
  cmp    $0x3,%eax
  mov    $0x0,%edx
  cmovae %edx,%eax
  movslq %eax,%rsi
  mov    %rbx,%rdi
  call   <pc_memo@plt>
  mov    $0x0,%eax
L9:
  pop    %rbx
  ret
L10:
  mov    $0xffffffff,%eax
  ret
L23:
  mov    $0xffffffff,%eax
  jmp    L9
```

assistant: ```c
atcommand_memo(const int fd, struct map_session_data *sd, const char *command, const char *message) {
  int position = 0;
  if (!message || !*message)
    return -1;
  position = atoi(message);
  if (position < 0 || position > 2)
    position = 0;
  pc_memo(sd, position + 0);
  return 0;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<atcommand_memo>:
  endbr64
  test   %rcx,%rcx
  je     L16
  cmpb   $0x0,(%rcx)
  mov    %rcx,%rdi
  je     L16
  push   %rbp
  mov    %rsi,%rbp
  call   <atoi@plt>
  xor    %edx,%edx
  mov    %rbp,%rdi
  cmp    $0x3,%eax
  cmovae %edx,%eax
  movslq %eax,%rsi
  call   <pc_memo@plt>
  xor    %eax,%eax
  pop    %rbp
  ret
  nopl   0x0(%rax)
L16:
  mov    $0xffffffff,%eax
  ret
```

assistant: ```c
atcommand_memo(const int fd, struct map_session_data *sd, const char *command, const char *message) {
  int position = 0;
  if (!message || !*message)
    return -1;
  position = atoi(message);
  if (position < 0 || position > 2)
    position = 0;
  pc_memo(sd, position + 0);
  return 0;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<atcommand_memo>:
  endbr64
  test   %rcx,%rcx
  je     L16
  cmpb   $0x0,(%rcx)
  mov    %rcx,%rdi
  je     L16
  push   %rbp
  mov    %rsi,%rbp
  call   <atoi@plt>
  xor    %edx,%edx
  mov    %rbp,%rdi
  cmp    $0x3,%eax
  cmovae %edx,%eax
  movslq %eax,%rsi
  call   <pc_memo@plt>
  xor    %eax,%eax
  pop    %rbp
  ret
  nopl   0x0(%rax)
L16:
  mov    $0xffffffff,%eax
  ret
```

assistant: ```c
atcommand_memo(const int fd, struct map_session_data *sd, const char *command, const char *message) {
  int position = 0;
  if (!message || !*message)
    return -1;
  position = atoi(message);
  if (position < 0 || position > 2)
    position = 0;
  pc_memo(sd, position + 0);
  return 0;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<checkfneg>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  movss  %xmm0,-0x4(%rbp)
  pxor   %xmm0,%xmm0
  comiss -0x4(%rbp),%xmm0
  ja     L15
  jmp    L13
L15:
  lea    D8(%rip),%rax
  mov    %rax,%rdi
  call   <xlfail@plt>
L13:
  nop
  leave
  ret
```

tool_calls: name: parse_data
arguments: data_label: D8
type: string

tool: D8: square root of a negative number

assistant: ```c
void checkfneg(float farg) {
  if (farg < 0.0)
    xlfail("square root of a negative number");
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<checkfneg>:
  endbr64
  pxor   %xmm1,%xmm1
  comiss %xmm0,%xmm1
  ja     L5
  ret
L5:
  sub    $0x8,%rsp
  lea    D1(%rip),%rdi
  call   <xlfail@plt>
  add    $0x8,%rsp
  ret
```

tool_calls: name: parse_data
arguments: tag: D1
type_guessed: string

tool: D1: square root of a negative number

assistant: ```c
void checkfneg(float farg) {
  if (farg < 0.0)
    xlfail("square root of a negative number");
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<checkfneg>:
  endbr64
  pxor   %xmm1,%xmm1
  comiss %xmm0,%xmm1
  ja     L6
  ret
  xchg   %ax,%ax
L6:
  lea    D6(%rip),%rdi
  jmp    1050 <xlfail@plt>
```

tool_calls: name: retrieve_data
arguments: label: D6
datatype: string

tool: D6: square root of a negative number

assistant: ```c
void checkfneg(float farg) {
  if (farg < 0.0)
    xlfail("square root of a negative number");
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<checkfneg>:
  endbr64
  pxor   %xmm1,%xmm1
  comiss %xmm0,%xmm1
  ja     L6
  ret
  xchg   %ax,%ax
L6:
  lea    D7(%rip),%rdi
  jmp    1050 <xlfail@plt>
```

tool_calls: name: parse_data
arguments: tag: D7
type_infered: string

tool: D7: square root of a negative number

assistant: ```c
void checkfneg(float farg) {
  if (farg < 0.0)
    xlfail("square root of a negative number");
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<gcd>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  jns    L54
  negq   -0x18(%rbp)
L54:
  cmpq   $0x0,-0x20(%rbp)
  jns    L20
  negq   -0x20(%rbp)
L20:
  cmpq   $0x0,-0x18(%rbp)
  jne    L65
  mov    -0x20(%rbp),%rax
  jmp    L67
L65:
  cmpq   $0x0,-0x20(%rbp)
  jne    L39
  mov    -0x18(%rbp),%rax
  jmp    L67
L62:
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x20(%rbp),%rax
  cqto
  idivq  -0x18(%rbp)
  mov    %rdx,-0x18(%rbp)
  mov    -0x8(%rbp),%rax
  mov    %rax,-0x20(%rbp)
L39:
  cmpq   $0x0,-0x18(%rbp)
  jg     L62
  mov    -0x20(%rbp),%rax
L67:
  pop    %rbp
  ret
```

assistant: ```c
long gcd(long x, long y) {
  if (x < 0)
    x = -x;
  if (y < 0)
    y = -y;
  if (x == 0)
    return y;
  if (y == 0)
    return x;
  while (x > 0) {
    long t = x;
    x = y % x;
    y = t;
  }
  return y;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<gcd>:
  endbr64
  mov    %rsi,%rax
  neg    %rax
  cmovs  %rsi,%rax
  mov    %rax,%rcx
  test   %rdi,%rdi
  je     L35
  mov    %rdi,%rcx
  neg    %rcx
  cmovs  %rdi,%rcx
  test   %rsi,%rsi
  jne    L0
  jmp    L35
L21:
  mov    %rdx,%rcx
L0:
  cqto
  idiv   %rcx
  mov    %rcx,%rax
  test   %rdx,%rdx
  jg     L21
L35:
  mov    %rcx,%rax
  ret
```

assistant: ```c
long gcd(long x, long y) {
  if (x < 0)
    x = -x;
  if (y < 0)
    y = -y;
  if (x == 0)
    return y;
  if (y == 0)
    return x;
  while (x > 0) {
    long t = x;
    x = y % x;
    y = t;
  }
  return y;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<gcd>:
  endbr64
  mov    %rsi,%rax
  neg    %rax
  cmovs  %rsi,%rax
  mov    %rax,%r8
  test   %rdi,%rdi
  je     L2
  mov    %rdi,%r8
  neg    %r8
  cmovs  %rdi,%r8
  test   %rsi,%rsi
  jne    L24
L2:
  mov    %r8,%rax
  ret
  nopl   0x0(%rax)
L27:
  mov    %rdx,%r8
L24:
  cqto
  idiv   %r8
  mov    %r8,%rax
  test   %rdx,%rdx
  jne    L27
  mov    %r8,%rax
  ret
```

assistant: ```c
long gcd(long x, long y) {
  if (x < 0)
    x = -x;
  if (y < 0)
    y = -y;
  if (x == 0)
    return y;
  if (y == 0)
    return x;
  while (x > 0) {
    long t = x;
    x = y % x;
    y = t;
  }
  return y;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<gcd>:
  endbr64
  mov    %rsi,%rax
  neg    %rax
  cmovs  %rsi,%rax
  mov    %rax,%r8
  test   %rdi,%rdi
  je     L29
  mov    %rdi,%r8
  neg    %r8
  cmovs  %rdi,%r8
  test   %rsi,%rsi
  jne    L21
L29:
  mov    %r8,%rax
  ret
  nopl   0x0(%rax)
L12:
  mov    %rdx,%r8
L21:
  cqto
  idiv   %r8
  mov    %r8,%rax
  test   %rdx,%rdx
  jne    L12
  mov    %r8,%rax
  ret
```

assistant: ```c
long gcd(long x, long y) {
  if (x < 0)
    x = -x;
  if (y < 0)
    y = -y;
  if (x == 0)
    return y;
  if (y == 0)
    return x;
  while (x > 0) {
    long t = x;
    x = y % x;
    y = t;
  }
  return y;
}
```
user: Translate the below assembly code into C programming language:

```asm
<sendmsg_1>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %edi,-0x34(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %edx,-0x38(%rbp)
  mov    -0x40(%rbp),%rax
  movq   $0x0,0x18(%rax)
  mov    -0x40(%rbp),%rax
  mov    (%rax),%eax
  cmp    $0x1,%eax
  jne    L6
  mov    -0x40(%rbp),%rax
  mov    0x4(%rax),%r8d
  mov    -0x40(%rbp),%rax
  mov    0x8(%rax),%edi
  mov    -0x40(%rbp),%rax
  mov    0x10(%rax),%rax
  mov    0x8(%rax),%edx
  mov    -0x40(%rbp),%rax
  mov    0x10(%rax),%rax
  mov    (%rax),%rsi
  mov    -0x38(%rbp),%ecx
  mov    -0x34(%rbp),%eax
  mov    %r8d,%r9d
  mov    %edi,%r8d
  mov    %eax,%edi
  call   <sendto@plt>
  jmp    L32
L6:
  mov    -0x40(%rbp),%rax
  mov    0x10(%rax),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x40(%rbp),%rax
  mov    (%rax),%eax
  cltq
  mov    %rax,-0x8(%rbp)
  movl   $0x0,-0x2c(%rbp)
  movl   $0x0,-0x28(%rbp)
  jmp    L9
L8:
  mov    -0x2c(%rbp),%eax
  shl    $0x4,%rax
  mov    %rax,%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    0x8(%rax),%eax
  add    %eax,-0x28(%rbp)
  addl   $0x1,-0x2c(%rbp)
L9:
  mov    -0x2c(%rbp),%eax
  cmp    %rax,-0x8(%rbp)
  ja     L8
  mov    -0x28(%rbp),%eax
  mov    %rax,-0x20(%rbp)
  movl   $0x0,-0x2c(%rbp)
  jmp    L69
L24:
  mov    -0x2c(%rbp),%eax
  shl    $0x4,%rax
  mov    %rax,%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    0x8(%rax),%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x2c(%rbp),%eax
  shl    $0x4,%rax
  mov    %rax,%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rcx
  mov    -0x24(%rbp),%edx
  mov    -0x18(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x24(%rbp),%eax
  cltq
  add    %rax,-0x18(%rbp)
  mov    -0x24(%rbp),%eax
  cltq
  sub    %rax,-0x20(%rbp)
  addl   $0x1,-0x2c(%rbp)
L69:
  cmpq   $0x0,-0x20(%rbp)
  je     L51
  mov    -0x2c(%rbp),%eax
  cmp    %rax,-0x8(%rbp)
  ja     L24
L51:
  mov    -0x40(%rbp),%rax
  mov    0x4(%rax),%r8d
  mov    -0x40(%rbp),%rax
  mov    0x8(%rax),%edi
  mov    -0x38(%rbp),%ecx
  mov    -0x28(%rbp),%edx
  mov    -0x18(%rbp),%rsi
  mov    -0x34(%rbp),%eax
  mov    %r8d,%r9d
  mov    %edi,%r8d
  mov    %eax,%edi
  call   <sendto@plt>
  cltq
  mov    %rax,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
L32:
  leave
  ret
```

assistant: ```c
int sendmsg_1(int fd, struct msghdr *msg, int flags) {
  msg->msg_controllen = 0;
  if (msg->msg_iovlen == 1) {
    return sendto(fd, msg->msg_iov->iov_base, msg->msg_iov->iov_len, flags, msg->msg_name, msg->msg_namelen);
  } else {
    struct iovec *msg_iov;
    size_t msg_iovlen;
    unsigned int i, totalsize;
    size_t size;
    char *lbuf;
    msg_iov = msg->msg_iov;
    msg_iovlen = msg->msg_iovlen;
    for (i = 0, totalsize = 0; i < msg_iovlen; i++)
      totalsize += msg_iov[i].iov_len;
    size = totalsize;
    for (i = 0; size > 0 && i < msg_iovlen; i++) {
      int qty = msg_iov[i].iov_len;
      memcpy(lbuf, msg_iov[i].iov_base, qty);
      lbuf += qty;
      size -= qty;
    }
    size = sendto(fd, lbuf, totalsize, flags, msg->msg_name, msg->msg_namelen);
    return size;
  }
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<sendmsg_1>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %edi,0x18(%rsp)
  mov    %rsi,0x10(%rsp)
  mov    %edx,0x1c(%rsp)
  movq   $0x0,0x18(%rsi)
  mov    (%rsi),%r14d
  cmp    $0x1,%r14d
  je     L71
  mov    0x10(%rsp),%rax
  mov    0x10(%rax),%rax
  mov    %rax,0x8(%rsp)
  movslq %r14d,%r14
  test   %r14,%r14
  je     L43
  mov    $0x0,%r15d
  mov    $0x0,%edx
  mov    $0x0,%eax
L55:
  shl    $0x4,%rax
  mov    0x8(%rsp),%rcx
  add    0x8(%rcx,%rax,1),%r15d
  add    $0x1,%edx
  mov    %edx,%eax
  cmp    %r14,%rax
  jb     L55
  mov    %r15d,%ebp
  test   %rbp,%rbp
  je     L72
  mov    $0x0,%r13d
  mov    $0x0,%eax
L88:
  shl    $0x4,%rax
  add    0x8(%rsp),%rax
  mov    0x8(%rax),%ebx
  mov    %ebx,%edx
  mov    (%rax),%rsi
  mov    %r12,%rdi
  call   <memcpy@plt>
  movslq %ebx,%rbx
  add    %rbx,%r12
  add    $0x1,%r13d
  sub    %rbx,%rbp
  je     L65
  mov    %r13d,%eax
  cmp    %r14,%rax
  jb     L88
L65:
  mov    0x10(%rsp),%rax
  mov    0x4(%rax),%r9d
  mov    0x8(%rax),%r8d
  mov    0x1c(%rsp),%ecx
  mov    %r15d,%edx
  mov    %r12,%rsi
  mov    0x18(%rsp),%edi
  call   <sendto@plt>
L31:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L71:
  mov    0x10(%rsi),%rax
  mov    0x8(%rax),%edx
  mov    0x4(%rsi),%r9d
  mov    0x8(%rsi),%r8d
  mov    0x1c(%rsp),%ecx
  mov    (%rax),%rsi
  mov    0x18(%rsp),%edi
  call   <sendto@plt>
  jmp    L31
L43:
  mov    $0x0,%r15d
  jmp    L65
L72:
  mov    $0x0,%r15d
  jmp    L65
```

assistant: ```c
int sendmsg_1(int fd, struct msghdr *msg, int flags) {
  msg->msg_controllen = 0;
  if (msg->msg_iovlen == 1) {
    return sendto(fd, msg->msg_iov->iov_base, msg->msg_iov->iov_len, flags, msg->msg_name, msg->msg_namelen);
  } else {
    struct iovec *msg_iov;
    size_t msg_iovlen;
    unsigned int i, totalsize;
    size_t size;
    char *lbuf;
    msg_iov = msg->msg_iov;
    msg_iovlen = msg->msg_iovlen;
    for (i = 0, totalsize = 0; i < msg_iovlen; i++)
      totalsize += msg_iov[i].iov_len;
    size = totalsize;
    for (i = 0; size > 0 && i < msg_iovlen; i++) {
      int qty = msg_iov[i].iov_len;
      memcpy(lbuf, msg_iov[i].iov_base, qty);
      lbuf += qty;
      size -= qty;
    }
    size = sendto(fd, lbuf, totalsize, flags, msg->msg_name, msg->msg_namelen);
    return size;
  }
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<sendmsg_1>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    (%rsi),%r12d
  movq   $0x0,0x18(%rsi)
  mov    %edi,0x18(%rsp)
  mov    0x10(%rsi),%r15
  mov    %rsi,0x10(%rsp)
  mov    %edx,0x1c(%rsp)
  cmp    $0x1,%r12d
  je     L64
  movslq %r12d,%rax
  xor    %r14d,%r14d
  mov    %rax,0x8(%rsp)
  test   %rax,%rax
  je     L89
  xor    %edx,%edx
  xor    %eax,%eax
  nopl   0x0(%rax)
L51:
  shl    $0x4,%rax
  add    0x8(%r15,%rax,1),%r14d
  lea    0x1(%rdx),%eax
  mov    %rax,%rdx
  cmp    0x8(%rsp),%rax
  jb     L51
  mov    %r14d,%ebx
  test   %rbx,%rbx
  je     L52
  xor    %r13d,%r13d
  xor    %eax,%eax
  jmp    L86
  nopl   0x0(%rax)
L82:
  mov    %r13d,%eax
  cmp    0x8(%rsp),%rax
  jae    L89
L86:
  shl    $0x4,%rax
  mov    %rbp,%rdi
  add    $0x1,%r13d
  add    %r15,%rax
  mov    0x8(%rax),%r12d
  mov    (%rax),%rsi
  mov    %r12d,%edx
  call   <memcpy@plt>
  movslq %r12d,%rax
  add    %rax,%rbp
  sub    %rax,%rbx
  jne    L82
L89:
  mov    0x10(%rsp),%rax
  mov    0x1c(%rsp),%ecx
  mov    %r14d,%edx
  mov    %rbp,%rsi
  mov    0x18(%rsp),%edi
  mov    0x4(%rax),%r9d
  mov    0x8(%rax),%r8d
L40:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1060 <sendto@plt>
L64:
  mov    0x4(%rsi),%r9d
  mov    0x8(%rsi),%r8d
  mov    0x8(%r15),%edx
  mov    0x1c(%rsp),%ecx
  mov    (%r15),%rsi
  jmp    L40
L52:
  xor    %r14d,%r14d
  jmp    L89
```

assistant: ```c
int sendmsg_1(int fd, struct msghdr *msg, int flags) {
  msg->msg_controllen = 0;
  if (msg->msg_iovlen == 1) {
    return sendto(fd, msg->msg_iov->iov_base, msg->msg_iov->iov_len, flags, msg->msg_name, msg->msg_namelen);
  } else {
    struct iovec *msg_iov;
    size_t msg_iovlen;
    unsigned int i, totalsize;
    size_t size;
    char *lbuf;
    msg_iov = msg->msg_iov;
    msg_iovlen = msg->msg_iovlen;
    for (i = 0, totalsize = 0; i < msg_iovlen; i++)
      totalsize += msg_iov[i].iov_len;
    size = totalsize;
    for (i = 0; size > 0 && i < msg_iovlen; i++) {
      int qty = msg_iov[i].iov_len;
      memcpy(lbuf, msg_iov[i].iov_base, qty);
      lbuf += qty;
      size -= qty;
    }
    size = sendto(fd, lbuf, totalsize, flags, msg->msg_name, msg->msg_namelen);
    return size;
  }
}
```