ylfeng/ReF-Decompile-dataset huggingface dataset:
user: What is the c source code of the assembly code below:

```asm
<wii_chuck_setup>:
  endbr64
  sub    $0x18,%rsp
  mov    $0x40,%edx
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %dx,0x6(%rsp)
  call   <i2c_setup@plt>
  lea    0x6(%rsp),%rdi
  mov    $0x2,%esi
  call   <i2c_write@plt>
  mov    $0xf0,%edi
  call   <usleep@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L0
  add    $0x18,%rsp
  ret
L0:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void wii_chuck_setup(void) {
  unsigned char init_cmds[] = {0x40, 0x00};
  i2c_setup();
  i2c_write(init_cmds, sizeof(init_cmds));
  usleep(240);
}
```
user: What is the c source code of the assembly code below?

```asm
<wii_chuck_setup>:
  endbr64
  sub    $0x18,%rsp
  mov    $0x40,%edx
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %dx,0x6(%rsp)
  call   <i2c_setup@plt>
  lea    0x6(%rsp),%rdi
  mov    $0x2,%esi
  call   <i2c_write@plt>
  mov    $0xf0,%edi
  call   <usleep@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L5
  add    $0x18,%rsp
  ret
L5:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void wii_chuck_setup(void) {
  unsigned char init_cmds[] = {0x40, 0x00};
  i2c_setup();
  i2c_write(init_cmds, sizeof(init_cmds));
  usleep(240);
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<error>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0xd0,%rsp
  mov    %rdi,-0xc8(%rbp)
  mov    %rsi,-0xa8(%rbp)
  mov    %rdx,-0xa0(%rbp)
  mov    %rcx,-0x98(%rbp)
  mov    %r8,-0x90(%rbp)
  mov    %r9,-0x88(%rbp)
  test   %al,%al
  je     L7
  movaps %xmm0,-0x80(%rbp)
  movaps %xmm1,-0x70(%rbp)
  movaps %xmm2,-0x60(%rbp)
  movaps %xmm3,-0x50(%rbp)
  movaps %xmm4,-0x40(%rbp)
  movaps %xmm5,-0x30(%rbp)
  movaps %xmm6,-0x20(%rbp)
  movaps %xmm7,-0x10(%rbp)
L7:
  mov    -0xc8(%rbp),%rdx
  mov    -0xb4(%rbp),%eax
  mov    %rdx,%rsi
  mov    %eax,%edi
  call   <va_start@plt>
  mov    D4(%rip),%rax
  mov    (%rax),%eax
  mov    -0xb4(%rbp),%edx
  mov    -0xc8(%rbp),%rcx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <vsyslog@plt>
  mov    -0xb4(%rbp),%eax
  mov    %eax,%edi
  call   <va_end@plt>
  nop
  leave
  ret
```

assistant: ```c
void error(char *s, ...) {
  va_list ap;
  va_start(ap, s);
  vsyslog(LOG_INFO, s, ap);
  va_end(ap);
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<error>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbx
  mov    %rdi,%rsi
  mov    $0x0,%ebp
  mov    %ebp,%edi
  call   <va_start@plt>
  mov    %ebp,%edx
  mov    %rbx,%rsi
  mov    D2(%rip),%rax
  mov    (%rax),%edi
  call   <vsyslog@plt>
  mov    %ebp,%edi
  call   <va_end@plt>
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
```

assistant: ```c
void error(char *s, ...) {
  va_list ap;
  va_start(ap, s);
  vsyslog(LOG_INFO, s, ap);
  va_end(ap);
}
```
user: What is the c source code of the assembly code below:

```asm
<error>:
  endbr64
  push   %r12
  xor    %r12d,%r12d
  mov    %rdi,%rsi
  push   %rbp
  mov    %rdi,%rbp
  mov    %r12d,%edi
  sub    $0x8,%rsp
  call   <va_start@plt>
  mov    D5(%rip),%rax
  mov    %r12d,%edx
  mov    %rbp,%rsi
  mov    (%rax),%edi
  call   <vsyslog@plt>
  mov    %r12d,%edi
  call   <va_end@plt>
  add    $0x8,%rsp
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
void error(char *s, ...) {
  va_list ap;
  va_start(ap, s);
  vsyslog(LOG_INFO, s, ap);
  va_end(ap);
}
```
user: What is the c source code of the assembly code below:

```asm
<error>:
  endbr64
  push   %r12
  xor    %r12d,%r12d
  mov    %rdi,%rsi
  push   %rbp
  mov    %rdi,%rbp
  mov    %r12d,%edi
  sub    $0x8,%rsp
  call   <va_start@plt>
  mov    D3(%rip),%rax
  mov    %r12d,%edx
  mov    %rbp,%rsi
  mov    (%rax),%edi
  call   <vsyslog@plt>
  mov    %r12d,%edi
  call   <va_end@plt>
  add    $0x8,%rsp
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
void error(char *s, ...) {
  va_list ap;
  va_start(ap, s);
  vsyslog(LOG_INFO, s, ap);
  va_end(ap);
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<debug_test>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    $0x0,%eax
  call   <init_serial_gdb@plt>
  int3
  movl   $0x1,-0x4(%rbp)
  movl   $0x1,-0x8(%rbp)
  jmp    L19
L18:
  mov    -0x4(%rbp),%eax
  mov    $0x0,%edx
  divl   -0x8(%rbp)
  mov    %edx,%eax
  add    %eax,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  mov    %eax,%esi
  lea    D2(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  addl   $0x1,-0x8(%rbp)
L19:
  cmpl   $0x64,-0x8(%rbp)
  jbe    L18
  nop
  nop
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: tag: D2
type: string

tool: D2: Current sum = %d


assistant: ```c
void debug_test(void) {
  unsigned i, sum;
  init_serial_gdb();
  asm("int $3");
  sum = 1;
  for (i = 1; i <= 100; i++) {
    sum += sum % i;
    printf("Current sum = %d\n", sum);
  }
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<debug_test>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    $0x0,%eax
  call   <init_serial_gdb@plt>
  int3
  mov    $0x1,%ebp
  mov    $0x1,%ebx
  lea    D0(%rip),%r12
L1:
  mov    %ebp,%eax
  mov    $0x0,%edx
  div    %ebx
  add    %edx,%ebp
  mov    %ebp,%esi
  mov    %r12,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  add    $0x1,%ebx
  cmp    $0x65,%ebx
  jne    L1
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

tool_calls: name: unpack_data
arguments: data_tag: D0
type_infered: string

tool: D0: Current sum = %d


assistant: ```c
void debug_test(void) {
  unsigned i, sum;
  init_serial_gdb();
  asm("int $3");
  sum = 1;
  for (i = 1; i <= 100; i++) {
    sum += sum % i;
    printf("Current sum = %d\n", sum);
  }
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<debug_test>:
  endbr64
  push   %r12
  xor    %eax,%eax
  push   %rbp
  push   %rbx
  call   <init_serial_gdb@plt>
  int3
  mov    $0x1,%r12d
  mov    $0x1,%ebx
  lea    D7(%rip),%rbp
  nopw   0x0(%rax,%rax,1)
L1:
  mov    %r12d,%eax
  xor    %edx,%edx
  mov    %rbp,%rdi
  div    %ebx
  xor    %eax,%eax
  add    $0x1,%ebx
  add    %edx,%r12d
  mov    %r12d,%esi
  call   <printf@plt>
  cmp    $0x65,%ebx
  jne    L1
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

tool_calls: name: retrieve_data
arguments: data_tag: D7
type_infered: string

tool: D7: Current sum = %d


assistant: ```c
void debug_test(void) {
  unsigned i, sum;
  init_serial_gdb();
  asm("int $3");
  sum = 1;
  for (i = 1; i <= 100; i++) {
    sum += sum % i;
    printf("Current sum = %d\n", sum);
  }
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<debug_test>:
  endbr64
  push   %r12
  xor    %eax,%eax
  push   %rbp
  push   %rbx
  call   <init_serial_gdb@plt>
  int3
  mov    $0x1,%r12d
  mov    $0x1,%ebx
  lea    D3(%rip),%rbp
  nopw   0x0(%rax,%rax,1)
L6:
  mov    %r12d,%eax
  xor    %edx,%edx
  mov    %rbp,%rdi
  div    %ebx
  xor    %eax,%eax
  add    $0x1,%ebx
  add    %edx,%r12d
  mov    %r12d,%esi
  call   <printf@plt>
  cmp    $0x65,%ebx
  jne    L6
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
```

tool_calls: name: read_data
arguments: data_tag: D3
datatype: string

tool: D3: Current sum = %d


assistant: ```c
void debug_test(void) {
  unsigned i, sum;
  init_serial_gdb();
  asm("int $3");
  sum = 1;
  for (i = 1; i <= 100; i++) {
    sum += sum % i;
    printf("Current sum = %d\n", sum);
  }
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<strtok_r>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  jne    L67
  mov    -0x28(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x18(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  jne    L67
  mov    $0x0,%eax
  jmp    L53
L67:
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x18(%rbp)
  movzbl (%rax),%eax
  mov    %al,-0x1(%rbp)
  cmpb   $0x0,-0x1(%rbp)
  jne    L34
  mov    $0x0,%eax
  jmp    L53
L34:
  movsbl -0x1(%rbp),%edx
  mov    -0x20(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  jne    L67
  mov    -0x20(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcspn@plt>
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rax,%rdx
  mov    -0x28(%rbp),%rax
  mov    %rdx,(%rax)
  mov    -0x28(%rbp),%rax
  mov    (%rax),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L63
  mov    -0x28(%rbp),%rax
  mov    (%rax),%rax
  movb   $0x0,(%rax)
  mov    -0x28(%rbp),%rax
  mov    (%rax),%rax
  lea    0x1(%rax),%rdx
  mov    -0x28(%rbp),%rax
  mov    %rdx,(%rax)
L63:
  subq   $0x1,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
L53:
  leave
  ret
```

assistant: ```c
char *strtok_r(char *str, const char *delim, char **saveptr) {
  char ch;
  if (str == NULL && (NULL == (str = *saveptr))) {
    return NULL;
  }
  do {
    if ('\0' == (ch = *str++)) {
      return NULL;
    }
  } while (strchr(delim, ch));
  *saveptr = str + strcspn(str, delim);
  if (**saveptr != '\0') {
    **saveptr = 0;
    (*saveptr)++;
  }
  return --str;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<strtok_r>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbx
  mov    %rsi,%rbp
  mov    %rdx,%r13
  test   %rdi,%rdi
  je     L40
L54:
  mov    %rbx,%r12
  add    $0x1,%rbx
  movzbl -0x1(%rbx),%esi
  test   %sil,%sil
  je     L42
  movsbl %sil,%esi
  mov    %rbp,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  jne    L54
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <strcspn@plt>
  cltq
  add    %rbx,%rax
  mov    %rax,0x0(%r13)
  cmpb   $0x0,(%rax)
  je     L34
  movb   $0x0,(%rax)
  addq   $0x1,0x0(%r13)
  jmp    L34
L40:
  mov    (%rdx),%rbx
  test   %rbx,%rbx
  jne    L54
  mov    %rbx,%r12
  jmp    L34
L42:
  mov    $0x0,%r12d
L34:
  mov    %r12,%rax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
char *strtok_r(char *str, const char *delim, char **saveptr) {
  char ch;
  if (str == NULL && (NULL == (str = *saveptr))) {
    return NULL;
  }
  do {
    if ('\0' == (ch = *str++)) {
      return NULL;
    }
  } while (strchr(delim, ch));
  *saveptr = str + strcspn(str, delim);
  if (**saveptr != '\0') {
    **saveptr = 0;
    (*saveptr)++;
  }
  return --str;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<strtok_r>:
  endbr64
  push   %r13
  mov    %rsi,%r13
  push   %r12
  push   %rbp
  mov    %rdx,%rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x8,%rsp
  test   %rdi,%rdi
  jne    L51
  jmp    L27
  xchg   %ax,%ax
L34:
  mov    %r13,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L4
L51:
  mov    %rbx,%r12
  movsbl (%rbx),%esi
  lea    0x1(%rbx),%rbx
  test   %sil,%sil
  jne    L34
L5:
  xor    %r12d,%r12d
L63:
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   (%rax)
L4:
  mov    %rbx,%rdi
  mov    %r13,%rsi
  call   <strcspn@plt>
  cltq
  add    %rax,%rbx
  mov    %rbx,0x0(%rbp)
  cmpb   $0x0,(%rbx)
  je     L63
  movb   $0x0,(%rbx)
  mov    %r12,%rax
  addq   $0x1,0x0(%rbp)
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nop
L27:
  mov    (%rdx),%rbx
  test   %rbx,%rbx
  jne    L51
  jmp    L5
```

assistant: ```c
char *strtok_r(char *str, const char *delim, char **saveptr) {
  char ch;
  if (str == NULL && (NULL == (str = *saveptr))) {
    return NULL;
  }
  do {
    if ('\0' == (ch = *str++)) {
      return NULL;
    }
  } while (strchr(delim, ch));
  *saveptr = str + strcspn(str, delim);
  if (**saveptr != '\0') {
    **saveptr = 0;
    (*saveptr)++;
  }
  return --str;
}
```
user: What is the c source code of the assembly code below?

```asm
<strtok_r>:
  endbr64
  push   %r13
  mov    %rsi,%r13
  push   %r12
  push   %rbp
  mov    %rdx,%rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x8,%rsp
  test   %rdi,%rdi
  jne    L44
  jmp    L4
  xchg   %ax,%ax
L28:
  mov    %r13,%rdi
  call   <strchr@plt>
  test   %rax,%rax
  je     L29
L44:
  mov    %rbx,%r12
  movsbl (%rbx),%esi
  lea    0x1(%rbx),%rbx
  test   %sil,%sil
  jne    L28
L46:
  xor    %r12d,%r12d
L35:
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   (%rax)
L29:
  mov    %rbx,%rdi
  mov    %r13,%rsi
  call   <strcspn@plt>
  cltq
  add    %rax,%rbx
  mov    %rbx,0x0(%rbp)
  cmpb   $0x0,(%rbx)
  je     L35
  movb   $0x0,(%rbx)
  mov    %r12,%rax
  addq   $0x1,0x0(%rbp)
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nop
L4:
  mov    (%rdx),%rbx
  test   %rbx,%rbx
  jne    L44
  jmp    L46
```

assistant: ```c
char *strtok_r(char *str, const char *delim, char **saveptr) {
  char ch;
  if (str == NULL && (NULL == (str = *saveptr))) {
    return NULL;
  }
  do {
    if ('\0' == (ch = *str++)) {
      return NULL;
    }
  } while (strchr(delim, ch));
  *saveptr = str + strcspn(str, delim);
  if (**saveptr != '\0') {
    **saveptr = 0;
    (*saveptr)++;
  }
  return --str;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<min>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x4(%rbp)
  mov    %esi,-0x8(%rbp)
  mov    -0x4(%rbp),%eax
  cmp    -0x8(%rbp),%eax
  jge    L11
  mov    -0x4(%rbp),%eax
  jmp    L19
L11:
  mov    -0x8(%rbp),%eax
L19:
  pop    %rbp
  ret
```

assistant: ```c
min(a, b) {
  if (a < b)
    return (a);
  return (b);
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<min>:
  endbr64
  cmp    %esi,%edi
  mov    %esi,%eax
  cmovle %edi,%eax
  ret
```

assistant: ```c
min(a, b) {
  if (a < b)
    return (a);
  return (b);
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<min>:
  endbr64
  cmp    %esi,%edi
  mov    %esi,%eax
  cmovle %edi,%eax
  ret
```

assistant: ```c
min(a, b) {
  if (a < b)
    return (a);
  return (b);
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<min>:
  endbr64
  cmp    %esi,%edi
  mov    %esi,%eax
  cmovle %edi,%eax
  ret
```

assistant: ```c
min(a, b) {
  if (a < b)
    return (a);
  return (b);
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<kth_smallest_int>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  mov    %rdi,-0x30(%rbp)
  mov    %esi,-0x34(%rbp)
  mov    %edx,-0x38(%rbp)
  mov    $0x0,%r14d
  mov    -0x34(%rbp),%eax
  lea    -0x1(%rax),%r13d
  jmp    L26
L64:
  mov    -0x38(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%r15d
  mov    %r14d,%r12d
  mov    %r13d,%ebx
  jmp    L90
L5:
  add    $0x1,%r12d
L90:
  movslq %r12d,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    %eax,%r15d
  jg     L5
  jmp    L35
L57:
  sub    $0x1,%ebx
L35:
  movslq %ebx,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    %eax,%r15d
  jl     L57
  cmp    %ebx,%r12d
  jg     L45
  movslq %r12d,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%esi
  movslq %ebx,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  movslq %r12d,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x30(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  movslq %ebx,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    %esi,(%rax)
  add    $0x1,%r12d
  sub    $0x1,%ebx
L45:
  cmp    %ebx,%r12d
  jle    L90
  cmp    -0x38(%rbp),%ebx
  jge    L89
  mov    %r12d,%r14d
L89:
  cmp    %r12d,-0x38(%rbp)
  jge    L26
  mov    %ebx,%r13d
L26:
  cmp    %r13d,%r14d
  jl     L64
  mov    -0x38(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
```

assistant: ```c
int kth_smallest_int(int a[], int n, int k) {
  register int i, j, l, m;
  register int x;
  l = 0;
  m = n - 1;
  while (l < m) {
    x = a[k];
    i = l;
    j = m;
    do {
      while (a[i] < x)
        i++;
      while (x < a[j])
        j--;
      if (i <= j) {
        {
          register int t = (a[i]);
          (a[i]) = (a[j]);
          (a[j]) = t;
        };
        i++;
        j--;
      }
    } while (i <= j);
    if (j < k)
      l = i;
    if (k < i)
      m = j;
  }
  return a[k];
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<kth_smallest_int>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%r12
  mov    %edx,%r15d
  lea    -0x1(%rsi),%r14d
  test   %r14d,%r14d
  jle    L47
  movslq %edx,%rax
  lea    (%rdi,%rax,4),%rax
  mov    %rax,-0x8(%rsp)
  mov    $0x0,%r13d
  jmp    L110
L118:
  mov    %ecx,0x0(%rbp)
  mov    %r11d,(%rdi)
  mov    %r10d,%ebx
  sub    $0x1,%edx
  cmp    %edx,%r10d
  jg     L14
L69:
  add    $0x4,%r8
  add    $0x1,%r10d
  add    $0x1,%r9d
L9:
  mov    %r9d,%ebx
  mov    %r8,%rbp
  mov    (%r8),%r11d
  cmp    %esi,%r11d
  jl     L69
  movslq %edx,%rax
  lea    (%r12,%rax,4),%rdi
  mov    (%rdi),%ecx
  cmp    %ecx,%esi
  jge    L96
  lea    -0x4(%r12,%rax,4),%rax
L53:
  sub    $0x1,%edx
  mov    %rax,%rdi
  sub    $0x4,%rax
  mov    0x4(%rax),%ecx
  cmp    %esi,%ecx
  jg     L53
L96:
  cmp    %edx,%ebx
  jle    L118
L14:
  cmp    %edx,%r15d
  jg     L16
  cmp    %ebx,%r15d
  cmovl  %edx,%r14d
L117:
  cmp    %r13d,%r14d
  jle    L47
L110:
  mov    -0x8(%rsp),%rax
  mov    (%rax),%esi
  movslq %r13d,%rax
  lea    (%r12,%rax,4),%r8
  mov    %r13d,%r9d
  lea    0x1(%r13),%r10d
  mov    %r14d,%edx
  jmp    L9
L16:
  cmp    %ebx,%r15d
  jl     L47
  mov    %ebx,%r13d
  jmp    L117
L47:
  movslq %r15d,%r15
  mov    (%r12,%r15,4),%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
int kth_smallest_int(int a[], int n, int k) {
  register int i, j, l, m;
  register int x;
  l = 0;
  m = n - 1;
  while (l < m) {
    x = a[k];
    i = l;
    j = m;
    do {
      while (a[i] < x)
        i++;
      while (x < a[j])
        j--;
      if (i <= j) {
        {
          register int t = (a[i]);
          (a[i]) = (a[j]);
          (a[j]) = t;
        };
        i++;
        j--;
      }
    } while (i <= j);
    if (j < k)
      l = i;
    if (k < i)
      m = j;
  }
  return a[k];
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<kth_smallest_int>:
  endbr64
  push   %r15
  movslq %edx,%rax
  push   %r14
  lea    (%rdi,%rax,4),%r15
  push   %r13
  lea    -0x1(%rsi),%r13d
  push   %r12
  push   %rbp
  push   %rbx
  test   %r13d,%r13d
  jle    L66
  mov    %rdi,%rbp
  mov    %rax,%r14
  xor    %r12d,%r12d
  nopw   0x0(%rax,%rax,1)
L64:
  movslq %r12d,%rax
  mov    (%r15),%edi
  mov    %r12d,%r8d
  lea    0x1(%r12),%r10d
  lea    0x0(%rbp,%rax,4),%r9
  mov    %r13d,%edx
  movslq %r13d,%rax
  nopl   0x0(%rax)
L29:
  mov    (%r9),%r11d
  lea    0x0(%rbp,%rax,4),%rsi
  mov    %r8d,%ebx
  mov    (%rsi),%ecx
  cmp    %edi,%r11d
  jl     L2
  cmp    %ecx,%edi
  jge    L70
  lea    -0x4(%rbp,%rax,4),%rax
  nopl   0x0(%rax,%rax,1)
L4:
  mov    %rax,%rsi
  mov    (%rax),%ecx
  sub    $0x4,%rax
  sub    $0x1,%edx
  cmp    %edi,%ecx
  jg     L4
L70:
  cmp    %edx,%r8d
  jle    L44
L14:
  cmp    %edx,%r14d
  cmovg  %ebx,%r12d
  cmp    %ebx,%r14d
  cmovl  %edx,%r13d
  cmp    %r12d,%r13d
  jg     L64
L66:
  pop    %rbx
  mov    (%r15),%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  cs nopw 0x0(%rax,%rax,1)
L44:
  sub    $0x1,%edx
  mov    %ecx,(%r9)
  mov    %r10d,%ebx
  mov    %r11d,(%rsi)
  cmp    %edx,%r10d
  jg     L14
  movslq %edx,%rax
L2:
  add    $0x4,%r9
  add    $0x1,%r10d
  add    $0x1,%r8d
  jmp    L29
```

assistant: ```c
int kth_smallest_int(int a[], int n, int k) {
  register int i, j, l, m;
  register int x;
  l = 0;
  m = n - 1;
  while (l < m) {
    x = a[k];
    i = l;
    j = m;
    do {
      while (a[i] < x)
        i++;
      while (x < a[j])
        j--;
      if (i <= j) {
        {
          register int t = (a[i]);
          (a[i]) = (a[j]);
          (a[j]) = t;
        };
        i++;
        j--;
      }
    } while (i <= j);
    if (j < k)
      l = i;
    if (k < i)
      m = j;
  }
  return a[k];
}
```
user: What is the c source code of the assembly code below?

```asm
<kth_smallest_int>:
  endbr64
  push   %r15
  movslq %edx,%rax
  push   %r14
  lea    (%rdi,%rax,4),%r15
  mov    %rax,%r14
  push   %r13
  lea    -0x1(%rsi),%r13d
  push   %r12
  xor    %r12d,%r12d
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  test   %r13d,%r13d
  jle    L5
  nopw   0x0(%rax,%rax,1)
L65:
  movslq %r12d,%rax
  mov    (%r15),%edi
  mov    %r12d,%r8d
  lea    0x1(%r12),%r10d
  lea    0x0(%rbp,%rax,4),%r9
  mov    %r13d,%edx
  movslq %r13d,%rax
  nopl   0x0(%rax)
L75:
  mov    (%r9),%r11d
  lea    0x0(%rbp,%rax,4),%rsi
  mov    %r8d,%ebx
  mov    (%rsi),%ecx
  cmp    %edi,%r11d
  jl     L38
  cmp    %ecx,%edi
  jge    L58
  lea    -0x4(%rbp,%rax,4),%rax
  nopl   0x0(%rax,%rax,1)
L94:
  mov    %rax,%rsi
  mov    (%rax),%ecx
  sub    $0x4,%rax
  sub    $0x1,%edx
  cmp    %edi,%ecx
  jg     L94
L58:
  cmp    %edx,%r8d
  jle    L92
L48:
  cmp    %edx,%r14d
  cmovg  %ebx,%r12d
  cmp    %ebx,%r14d
  jl     L98
  cmp    %r13d,%r12d
  jl     L65
L5:
  pop    %rbx
  mov    (%r15),%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L92:
  sub    $0x1,%edx
  mov    %ecx,(%r9)
  mov    %r10d,%ebx
  mov    %r11d,(%rsi)
  cmp    %edx,%r10d
  jg     L48
  movslq %edx,%rax
L38:
  add    $0x4,%r9
  add    $0x1,%r10d
  add    $0x1,%r8d
  jmp    L75
L98:
  cmp    %edx,%r12d
  jge    L5
  mov    %edx,%r13d
  jmp    L65
```

assistant: ```c
int kth_smallest_int(int a[], int n, int k) {
  register int i, j, l, m;
  register int x;
  l = 0;
  m = n - 1;
  while (l < m) {
    x = a[k];
    i = l;
    j = m;
    do {
      while (a[i] < x)
        i++;
      while (x < a[j])
        j--;
      if (i <= j) {
        {
          register int t = (a[i]);
          (a[i]) = (a[j]);
          (a[j]) = t;
        };
        i++;
        j--;
      }
    } while (i <= j);
    if (j < k)
      l = i;
    if (k < i)
      m = j;
  }
  return a[k];
}
```