ylfeng/ReF-Decompile-dataset huggingface dataset:
user: Demonstrate the C code that generates the assembly output below:

```asm
<Dijkstra>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdx,%r14
  push   %r13
  mov    %rdi,%r13
  push   %r12
  movslq %ecx,%r12
  push   %rbp
  lea    0x0(,%r12,4),%edi
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x18,%rsp
  mov    %r12d,0xc(%rsp)
  call   <malloc@plt>
  mov    0xc(%rsp),%r8d
  movl   $0x0,(%rbx)
  mov    %rax,%rbp
  movl   $0x0,(%r14)
  movl   $0x1,(%rax)
  mov    $0x1,%eax
  cmp    $0x1,%r8d
  jle    L16
  nopw   0x0(%rax,%rax,1)
L54:
  mov    0x0(%r13,%rax,4),%edx
  mov    %edx,(%rbx,%rax,4)
  movl   $0x0,(%r14,%rax,4)
  movl   $0x0,0x0(%rbp,%rax,4)
  add    $0x1,%rax
  cmp    %r12,%rax
  jne    L54
  mov    $0x1,%r15d
  nopw   0x0(%rax,%rax,1)
L39:
  mov    %r8d,%edx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  mov    %r8d,0xc(%rsp)
  call   <Find_min_dist@plt>
  mov    0xc(%rsp),%r8d
  mov    %eax,%esi
  cltq
  mov    %esi,%edi
  movl   $0x1,0x0(%rbp,%rax,4)
  lea    0x0(,%rax,4),%r9
  mov    $0x1,%eax
  imul   %r8d,%edi
  nopw   0x0(%rax,%rax,1)
L33:
  mov    0x0(%rbp,%rax,4),%edx
  test   %edx,%edx
  jne    L49
  lea    (%rdi,%rax,1),%ecx
  mov    (%rbx,%r9,1),%edx
  movslq %ecx,%rcx
  add    0x0(%r13,%rcx,4),%edx
  cmp    %edx,(%rbx,%rax,4)
  jle    L49
  mov    %edx,(%rbx,%rax,4)
  mov    %esi,(%r14,%rax,4)
L49:
  add    $0x1,%rax
  cmp    %r12,%rax
  jne    L33
  add    $0x1,%r15d
  cmp    %r15d,%r8d
  jne    L39
L16:
  add    $0x18,%rsp
  mov    %rbp,%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1070 <free@plt>
```

assistant: ```c
void Dijkstra(int mat[], int dist[], int pred[], int n) {
  int i, u, v, *known, new_dist;
  known = malloc(n * sizeof(int));
  dist[0] = 0;
  pred[0] = 0;
  known[0] = 1;
  for (v = 1; v < n; v++) {
    dist[v] = mat[0 * n + v];
    pred[v] = 0;
    known[v] = 0;
  }
  for (i = 1; i < n; i++) {
    u = Find_min_dist(dist, known, n);
    known[u] = 1;
    for (v = 1; v < n; v++)
      if (!known[v]) {
        new_dist = dist[u] + mat[u * n + v];
        if (new_dist < dist[v]) {
          dist[v] = new_dist;
          pred[v] = u;
        }
      }
  }
  free(known);
}
```
user: What is the c source code of the assembly code below?

```asm
<set_template_var>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  lea    D15(%rip),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,%ebx
  mov    -0x40(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    %ebx,%eax
  add    $0x1,%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x24(%rbp),%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x20(%rbp)
  mov    -0x24(%rbp),%edx
  mov    -0x20(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  mov    -0x20(%rbp),%rax
  lea    D6(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  mov    -0x40(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  mov    -0x20(%rbp),%rax
  lea    D8(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  mov    -0x48(%rbp),%rdx
  mov    -0x20(%rbp),%rcx
  mov    -0x38(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <str_replace@plt>
  mov    %rax,-0x18(%rbp)
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x18(%rbp),%rax
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

tool_calls: name: parse_data
arguments: label: D15
type_guessed: string
name: parse_data
arguments: label: D6
type_guessed: string
name: parse_data
arguments: label: D8
type_guessed: string

tool: D15: {{data.}}

tool: D6: {{data.

tool: D8: }}

assistant: ```c
char *set_template_var(char *template, const char *key, const char *value) {
  int keylen = strlen("{{data.}}") + strlen(key) + 1;
  char *fullkey = malloc(keylen);
  memset(fullkey, 0, keylen);
  strcat(fullkey, "{{data.");
  strcat(fullkey, key);
  strcat(fullkey, "}}");
  char *ret = str_replace(template, fullkey, value);
  free(fullkey);
  return ret;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<set_template_var>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%r12
  mov    %rsi,%rbp
  mov    %rdx,%r13
  lea    D22(%rip),%rdi
  call   <strlen@plt>
  mov    %eax,%ebx
  mov    %rbp,%rdi
  call   <strlen@plt>
  lea    0x1(%rbx,%rax,1),%r14d
  mov    %r14d,%edi
  call   <malloc@plt>
  mov    %rax,%rbx
  mov    %r14d,%edx
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  lea    D27(%rip),%rsi
  mov    %rbx,%rdi
  call   <strcat@plt>
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <strcat@plt>
  lea    D10(%rip),%rsi
  mov    %rbx,%rdi
  call   <strcat@plt>
  mov    %r13,%rdx
  mov    %rbx,%rsi
  mov    %r12,%rdi
  call   <str_replace@plt>
  mov    %rax,%rbp
  mov    %rbx,%rdi
  call   <free@plt>
  mov    %rbp,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

tool_calls: name: read_data
arguments: data_label: D22
type_guessed: string
name: read_data
arguments: data_label: D27
type_guessed: string
name: read_data
arguments: data_label: D10
type_guessed: string

tool: D22: {{data.}}

tool: D27: {{data.

tool: D10: }}

assistant: ```c
char *set_template_var(char *template, const char *key, const char *value) {
  int keylen = strlen("{{data.}}") + strlen(key) + 1;
  char *fullkey = malloc(keylen);
  memset(fullkey, 0, keylen);
  strcat(fullkey, "{{data.");
  strcat(fullkey, key);
  strcat(fullkey, "}}");
  char *ret = str_replace(template, fullkey, value);
  free(fullkey);
  return ret;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<set_template_var>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdx,%r14
  push   %r13
  mov    %rdi,%r13
  lea    D20(%rip),%rdi
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  call   <strlen@plt>
  mov    %r12,%rdi
  mov    %eax,%ebp
  call   <strlen@plt>
  lea    0x1(%rbp,%rax,1),%r15d
  mov    %r15d,%edi
  call   <malloc@plt>
  mov    %r15d,%edx
  xor    %esi,%esi
  mov    %rax,%rbp
  mov    %rax,%rdi
  call   <memset@plt>
  mov    %rbp,%rdi
  lea    D16(%rip),%rsi
  call   <strcat@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <strcat@plt>
  mov    %rbp,%rdi
  lea    D17(%rip),%rsi
  call   <strcat@plt>
  mov    %r14,%rdx
  mov    %rbp,%rsi
  mov    %r13,%rdi
  call   <str_replace@plt>
  mov    %rbp,%rdi
  mov    %rax,%r12
  call   <free@plt>
  pop    %rbp
  mov    %r12,%rax
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: retrieve_data
arguments: data_label: D20
datatype: string
name: retrieve_data
arguments: data_label: D16
datatype: string
name: retrieve_data
arguments: data_label: D17
datatype: string

tool: D20: {{data.}}

tool: D16: {{data.

tool: D17: }}

assistant: ```c
char *set_template_var(char *template, const char *key, const char *value) {
  int keylen = strlen("{{data.}}") + strlen(key) + 1;
  char *fullkey = malloc(keylen);
  memset(fullkey, 0, keylen);
  strcat(fullkey, "{{data.");
  strcat(fullkey, key);
  strcat(fullkey, "}}");
  char *ret = str_replace(template, fullkey, value);
  free(fullkey);
  return ret;
}
```
user: Translate the below assembly code into C programming language:

```asm
<set_template_var>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdx,%r14
  push   %r13
  mov    %rdi,%r13
  lea    D29(%rip),%rdi
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  call   <strlen@plt>
  mov    %r12,%rdi
  mov    %eax,%ebp
  call   <strlen@plt>
  lea    0x1(%rbp,%rax,1),%r15d
  mov    %r15d,%edi
  call   <malloc@plt>
  mov    %r15d,%edx
  xor    %esi,%esi
  mov    %rax,%rbp
  mov    %rax,%rdi
  call   <memset@plt>
  mov    %rbp,%rdi
  lea    D15(%rip),%rsi
  call   <strcat@plt>
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <strcat@plt>
  mov    %rbp,%rdi
  lea    D10(%rip),%rsi
  call   <strcat@plt>
  mov    %r14,%rdx
  mov    %rbp,%rsi
  mov    %r13,%rdi
  call   <str_replace@plt>
  mov    %rbp,%rdi
  mov    %rax,%r12
  call   <free@plt>
  pop    %rbp
  mov    %r12,%rax
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: parse_data
arguments: tag: D29
type_guessed: string
name: parse_data
arguments: tag: D15
type_guessed: string
name: parse_data
arguments: tag: D10
type_guessed: string

tool: D29: {{data.}}

tool: D15: {{data.

tool: D10: }}

assistant: ```c
char *set_template_var(char *template, const char *key, const char *value) {
  int keylen = strlen("{{data.}}") + strlen(key) + 1;
  char *fullkey = malloc(keylen);
  memset(fullkey, 0, keylen);
  strcat(fullkey, "{{data.");
  strcat(fullkey, key);
  strcat(fullkey, "}}");
  char *ret = str_replace(template, fullkey, value);
  free(fullkey);
  return ret;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<my_str_islower>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  movl   $0x0,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L16
  mov    $0x1,%eax
  jmp    L59
L35:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x60,%al
  jle    L20
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x7a,%al
  jg     L20
  addl   $0x1,-0x4(%rbp)
  jmp    L16
L20:
  mov    $0x0,%eax
  jmp    L59
L16:
  mov    -0x4(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L35
  mov    $0x1,%eax
L59:
  pop    %rbp
  ret
```

assistant: ```c
int my_str_islower(char const *str) {
  int i = 0;
  if (str[i] == '\0')
    return (1);
  while (str[i] != '\0') {
    if (str[i] >= 'a' && str[i] <= 'z')
      i++;
    else
      return (0);
  }
  return (1);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<my_str_islower>:
  endbr64
  movzbl (%rdi),%eax
  mov    $0x1,%edx
  test   %al,%al
  je     L24
  add    $0x1,%rdi
L8:
  sub    $0x61,%eax
  cmp    $0x19,%al
  ja     L6
  add    $0x1,%rdi
  movzbl -0x1(%rdi),%eax
  test   %al,%al
  jne    L8
  mov    $0x1,%edx
  jmp    L24
L6:
  mov    $0x0,%edx
L24:
  mov    %edx,%eax
  ret
```

assistant: ```c
int my_str_islower(char const *str) {
  int i = 0;
  if (str[i] == '\0')
    return (1);
  while (str[i] != '\0') {
    if (str[i] >= 'a' && str[i] <= 'z')
      i++;
    else
      return (0);
  }
  return (1);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<my_str_islower>:
  endbr64
  movzbl (%rdi),%eax
  mov    $0x1,%r8d
  test   %al,%al
  je     L12
  add    $0x1,%rdi
  jmp    L35
  nopw   0x0(%rax,%rax,1)
L22:
  movzbl (%rdi),%eax
  add    $0x1,%rdi
  test   %al,%al
  je     L13
L35:
  sub    $0x61,%eax
  cmp    $0x19,%al
  jbe    L22
  xor    %r8d,%r8d
L12:
  mov    %r8d,%eax
  ret
  nopl   0x0(%rax)
L13:
  mov    $0x1,%r8d
  mov    %r8d,%eax
  ret
```

assistant: ```c
int my_str_islower(char const *str) {
  int i = 0;
  if (str[i] == '\0')
    return (1);
  while (str[i] != '\0') {
    if (str[i] >= 'a' && str[i] <= 'z')
      i++;
    else
      return (0);
  }
  return (1);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<my_str_islower>:
  endbr64
  movzbl (%rdi),%eax
  mov    $0x1,%r8d
  test   %al,%al
  je     L35
  add    $0x1,%rdi
  jmp    L37
  nopw   0x0(%rax,%rax,1)
L29:
  movzbl (%rdi),%eax
  add    $0x1,%rdi
  test   %al,%al
  je     L5
L37:
  sub    $0x61,%eax
  cmp    $0x19,%al
  jbe    L29
  xor    %r8d,%r8d
L35:
  mov    %r8d,%eax
  ret
  nopl   0x0(%rax)
L5:
  mov    $0x1,%r8d
  mov    %r8d,%eax
  ret
```

assistant: ```c
int my_str_islower(char const *str) {
  int i = 0;
  if (str[i] == '\0')
    return (1);
  while (str[i] != '\0') {
    if (str[i] >= 'a' && str[i] <= 'z')
      i++;
    else
      return (0);
  }
  return (1);
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<uitoa>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %edi,-0x54(%rbp)
  mov    %rsi,-0x60(%rbp)
  mov    %edx,-0x58(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x30(%rbp),%rax
  mov    %rax,-0x38(%rbp)
  mov    -0x54(%rbp),%eax
  mov    %eax,-0x48(%rbp)
  cmpq   $0x0,-0x60(%rbp)
  je     L103
  cmpl   $0x24,-0x58(%rbp)
  jg     L103
  cmpl   $0x1,-0x58(%rbp)
  jg     L38
L103:
  mov    $0x0,%eax
  jmp    L14
L64:
  mov    -0x58(%rbp),%ecx
  mov    -0x48(%rbp),%eax
  mov    $0x0,%edx
  div    %ecx
  mov    %edx,%eax
  mov    %eax,-0x44(%rbp)
  mov    -0x58(%rbp),%esi
  mov    -0x48(%rbp),%eax
  mov    $0x0,%edx
  div    %esi
  mov    %eax,-0x48(%rbp)
  cmpl   $0x9,-0x44(%rbp)
  jg     L10
  mov    -0x44(%rbp),%eax
  lea    0x30(%rax),%ecx
  mov    -0x38(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x38(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
  jmp    L38
L10:
  mov    -0x44(%rbp),%eax
  lea    0x37(%rax),%ecx
  mov    -0x38(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x38(%rbp)
  mov    %ecx,%edx
  mov    %dl,(%rax)
L38:
  cmpl   $0x0,-0x48(%rbp)
  jne    L64
  lea    -0x30(%rbp),%rax
  cmp    %rax,-0x38(%rbp)
  je     L64
  mov    -0x60(%rbp),%rax
  mov    %rax,-0x40(%rbp)
  jmp    L79
L80:
  subq   $0x1,-0x38(%rbp)
  mov    -0x40(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x40(%rbp)
  mov    -0x38(%rbp),%rdx
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
L79:
  lea    -0x30(%rbp),%rax
  cmp    %rax,-0x38(%rbp)
  ja     L80
  mov    -0x40(%rbp),%rax
  movb   $0x0,(%rax)
  mov    -0x60(%rbp),%rax
L14:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L72
  call   <__stack_chk_fail@plt>
L72:
  leave
  ret
```

assistant: ```c
char *uitoa(unsigned int value, char *string, int radix) {
  int i;
  char *sp;
  char tmp[33];
  char *tp = tmp;
  unsigned int v = value;
  if (!string || radix > 36 || radix <= 1) {
    return 0;
  }
  while (v || tp == tmp) {
    i = v % radix;
    v = v / radix;
    if (i < 10) {
      *tp++ = i + '0';
    } else {
      *tp++ = i + 'A' - 10;
    }
  }
  sp = string;
  while (tp > tmp) {
    *sp++ = *--tp;
  }
  *sp = 0;
  return string;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<uitoa>:
  endbr64
  sub    $0x38,%rsp
  mov    %edx,%r11d
  mov    %fs:0x28,%rdx
  mov    %rdx,0x28(%rsp)
  xor    %edx,%edx
  lea    -0x2(%r11),%edx
  cmp    $0x22,%edx
  ja     L61
  mov    %edi,%eax
  mov    %rsi,%r10
  mov    %r11d,%edi
  test   %rsi,%rsi
  je     L61
  lea    0x1(%rsp),%rcx
  mov    %rsp,%r9
L93:
  mov    %eax,%r8d
  mov    $0x0,%edx
  div    %edi
  cmp    $0x9,%edx
  jg     L38
  mov    %rcx,%rsi
  add    $0x30,%edx
L76:
  mov    %dl,-0x1(%rcx)
  add    $0x1,%rcx
  cmp    %r9,%rsi
  je     L93
  cmp    %r8d,%r11d
  jbe    L93
  mov    %rsp,%rax
  cmp    %rax,%rsi
  jbe    L36
  mov    %rsi,%rax
  mov    %r10,%rdx
  mov    %rsp,%rdi
L54:
  sub    $0x1,%rax
  add    $0x1,%rdx
  movzbl (%rax),%ecx
  mov    %cl,-0x1(%rdx)
  cmp    %rdi,%rax
  jne    L54
  lea    0x30(%rsp),%rax
  sub    %rax,%rsi
  lea    0x30(%rsi,%r10,1),%rax
L26:
  movb   $0x0,(%rax)
  mov    %r10,%rax
L92:
  mov    0x28(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L107
  add    $0x38,%rsp
  ret
L38:
  mov    %rcx,%rsi
  add    $0x37,%edx
  jmp    L76
L36:
  mov    %r10,%rax
  jmp    L26
L61:
  mov    $0x0,%eax
  jmp    L92
L107:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
char *uitoa(unsigned int value, char *string, int radix) {
  int i;
  char *sp;
  char tmp[33];
  char *tp = tmp;
  unsigned int v = value;
  if (!string || radix > 36 || radix <= 1) {
    return 0;
  }
  while (v || tp == tmp) {
    i = v % radix;
    v = v / radix;
    if (i < 10) {
      *tp++ = i + '0';
    } else {
      *tp++ = i + 'A' - 10;
    }
  }
  sp = string;
  while (tp > tmp) {
    *sp++ = *--tp;
  }
  *sp = 0;
  return string;
}
```
user: What is the c source code of the assembly code below?

```asm
<uitoa>:
  endbr64
  sub    $0x38,%rsp
  mov    %edi,%eax
  mov    %edx,%edi
  mov    %fs:0x28,%rdx
  mov    %rdx,0x28(%rsp)
  xor    %edx,%edx
  lea    -0x2(%rdi),%edx
  cmp    $0x22,%edx
  ja     L72
  mov    %rsi,%r10
  test   %rsi,%rsi
  je     L72
  mov    %rsp,%r9
  mov    %r9,%rsi
  nopw   0x0(%rax,%rax,1)
L0:
  xor    %edx,%edx
  mov    %eax,%r11d
  add    $0x1,%rsi
  div    %edi
  lea    0x30(%rdx),%r8d
  lea    0x37(%rdx),%ecx
  cmp    $0x9,%edx
  mov    %r8d,%edx
  cmova  %ecx,%edx
  mov    %dl,-0x1(%rsi)
  cmp    %r9,%rsi
  je     L0
  cmp    %r11d,%edi
  jbe    L0
  cmp    %r9,%rsi
  jbe    L80
  mov    %rsi,%rax
  mov    %r10,%rcx
  jmp    L1
  nopl   (%rax)
L31:
  movzbl -0x1(%rax),%edx
L1:
  sub    $0x1,%rax
  add    $0x1,%rcx
  mov    %dl,-0x1(%rcx)
  cmp    %r9,%rax
  jne    L31
  sub    %rax,%rsi
  add    %r10,%rsi
L27:
  movb   $0x0,(%rsi)
  mov    %r10,%rax
L93:
  mov    0x28(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L48
  add    $0x38,%rsp
  ret
  nopl   (%rax)
L72:
  xor    %eax,%eax
  jmp    L93
L80:
  mov    %r10,%rsi
  jmp    L27
L48:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
char *uitoa(unsigned int value, char *string, int radix) {
  int i;
  char *sp;
  char tmp[33];
  char *tp = tmp;
  unsigned int v = value;
  if (!string || radix > 36 || radix <= 1) {
    return 0;
  }
  while (v || tp == tmp) {
    i = v % radix;
    v = v / radix;
    if (i < 10) {
      *tp++ = i + '0';
    } else {
      *tp++ = i + 'A' - 10;
    }
  }
  sp = string;
  while (tp > tmp) {
    *sp++ = *--tp;
  }
  *sp = 0;
  return string;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<uitoa>:
  endbr64
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  lea    -0x2(%rdx),%eax
  cmp    $0x22,%eax
  ja     L40
  mov    %rsi,%r8
  test   %rsi,%rsi
  je     L40
  mov    %edi,%ecx
  mov    %edx,%edi
  xor    %edx,%edx
  mov    %rsp,%r9
  mov    %ecx,%eax
  mov    %r9,%rsi
  div    %edi
  add    $0x1,%rsi
  cmp    $0x9,%edx
  ja     L17
  nopl   0x0(%rax)
L36:
  add    $0x30,%edx
  mov    %dl,-0x1(%rsi)
  cmp    %edi,%ecx
  jae    L30
  cmp    %r9,%rsi
  jne    L110
L30:
  mov    %eax,%ecx
  xor    %edx,%edx
  add    $0x1,%rsi
  mov    %ecx,%eax
  div    %edi
  cmp    $0x9,%edx
  jbe    L36
L17:
  add    $0x37,%edx
  mov    %dl,-0x1(%rsi)
  cmp    %edi,%ecx
  jae    L30
  cmp    %r9,%rsi
  je     L30
L110:
  cmp    %r9,%rsi
  jbe    L117
  mov    %rsi,%rax
  mov    %r8,%rdx
  nopw   0x0(%rax,%rax,1)
L108:
  movzbl -0x1(%rax),%ecx
  sub    $0x1,%rax
  add    $0x1,%rdx
  mov    %cl,-0x1(%rdx)
  cmp    %r9,%rax
  jne    L108
  sub    %rax,%rsi
  add    %r8,%rsi
L71:
  movb   $0x0,(%rsi)
  mov    %r8,%rax
L70:
  mov    0x28(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L101
  add    $0x38,%rsp
  ret
  nopl   (%rax)
L40:
  xor    %eax,%eax
  jmp    L70
L117:
  mov    %r8,%rsi
  jmp    L71
L101:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
char *uitoa(unsigned int value, char *string, int radix) {
  int i;
  char *sp;
  char tmp[33];
  char *tp = tmp;
  unsigned int v = value;
  if (!string || radix > 36 || radix <= 1) {
    return 0;
  }
  while (v || tp == tmp) {
    i = v % radix;
    v = v / radix;
    if (i < 10) {
      *tp++ = i + '0';
    } else {
      *tp++ = i + 'A' - 10;
    }
  }
  sp = string;
  while (tp > tmp) {
    *sp++ = *--tp;
  }
  *sp = 0;
  return string;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<sort>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  movl   $0x0,-0xc(%rbp)
  jmp    L1
L17:
  mov    -0xc(%rbp),%eax
  mov    %eax,-0x4(%rbp)
  mov    -0xc(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x8(%rbp)
  jmp    L42
L30:
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x8(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jle    L36
  mov    -0x8(%rbp),%eax
  mov    %eax,-0x4(%rbp)
L36:
  mov    -0x4(%rbp),%eax
  cmp    -0xc(%rbp),%eax
  je     L15
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rax,%rdx
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x18(%rbp),%rax
  add    %rcx,%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <swap@plt>
L15:
  addl   $0x1,-0x8(%rbp)
L42:
  mov    -0x8(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jl     L30
  addl   $0x1,-0xc(%rbp)
L1:
  mov    -0x1c(%rbp),%eax
  sub    $0x1,%eax
  cmp    %eax,-0xc(%rbp)
  jl     L17
  nop
  nop
  leave
  ret
```

assistant: ```c
void sort(int a[], int length) {
  int i, j;
  int tmp;
  int min;
  for (i = 0; i < length - 1; i++) {
    min = i;
    for (j = i + 1; j < length; j++) {
      if (a[min] > a[j]) {
        min = j;
      }
      if (min != i) {
        swap(&a[i], &a[min]);
      }
    }
  }
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<sort>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %esi,0x8(%rsp)
  cmp    $0x1,%esi
  jle    L4
  mov    %rdi,%r12
  mov    %esi,%eax
  sub    $0x2,%eax
  mov    %eax,0xc(%rsp)
  mov    %eax,%eax
  mov    %rax,(%rsp)
  mov    $0x0,%r13d
  jmp    L53
L21:
  add    $0x1,%rbx
  cmp    %r14,%rbx
  je     L79
L58:
  movslq %ebp,%rax
  mov    (%r12,%rbx,4),%edx
  cmp    %edx,(%r12,%rax,4)
  cmovg  %ebx,%ebp
  cmp    %r13d,%ebp
  je     L21
  movslq %ebp,%rax
  lea    (%r12,%rax,4),%rsi
  mov    %r15,%rdi
  call   <swap@plt>
  jmp    L21
L79:
  lea    0x1(%r13),%rax
  cmp    (%rsp),%r13
  je     L4
  mov    %rax,%r13
L53:
  mov    %r13d,%ebp
  lea    0x1(%r13),%eax
  cmp    %eax,0x8(%rsp)
  jle    L79
  lea    (%r12,%r13,4),%r15
  lea    0x1(%r13),%rbx
  mov    0xc(%rsp),%eax
  sub    %r13d,%eax
  lea    0x2(%r13,%rax,1),%r14
  jmp    L58
L4:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void sort(int a[], int length) {
  int i, j;
  int tmp;
  int min;
  for (i = 0; i < length - 1; i++) {
    min = i;
    for (j = i + 1; j < length; j++) {
      if (a[min] > a[j]) {
        min = j;
      }
      if (min != i) {
        swap(&a[i], &a[min]);
      }
    }
  }
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<sort>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %esi,0x18(%rsp)
  cmp    $0x1,%esi
  jle    L15
  mov    %esi,%eax
  xor    %r14d,%r14d
  mov    %rdi,%r15
  sub    $0x2,%eax
  mov    %r14d,%r12d
  mov    %eax,0x1c(%rsp)
  mov    %rax,0x10(%rsp)
  lea    0x1(%r14),%eax
  cmp    %eax,0x18(%rsp)
  jle    L58
L4:
  lea    0x1(%r14),%rax
  lea    (%r15,%r14,4),%rbp
  mov    %rax,0x8(%rsp)
  mov    %rax,%r13
  mov    0x1c(%rsp),%eax
  sub    %r14d,%eax
  lea    0x2(%r14,%rax,1),%rbx
  nopl   0x0(%rax)
L28:
  movslq %r12d,%rax
  mov    (%r15,%r13,4),%edx
  cmp    %edx,(%r15,%rax,4)
  cmovg  %r13d,%r12d
  cmp    %r14d,%r12d
  je     L56
  movslq %r12d,%rax
  mov    %rbp,%rdi
  lea    (%r15,%rax,4),%rsi
  call   <swap@plt>
L56:
  add    $0x1,%r13
  cmp    %rbx,%r13
  jne    L28
  cmp    0x10(%rsp),%r14
  je     L15
L69:
  mov    0x8(%rsp),%r14
  mov    %r14d,%r12d
  lea    0x1(%r14),%eax
  cmp    %eax,0x18(%rsp)
  jg     L4
L58:
  lea    0x1(%r14),%rax
  mov    %rax,0x8(%rsp)
  cmp    0x10(%rsp),%r14
  jne    L69
L15:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
void sort(int a[], int length) {
  int i, j;
  int tmp;
  int min;
  for (i = 0; i < length - 1; i++) {
    min = i;
    for (j = i + 1; j < length; j++) {
      if (a[min] > a[j]) {
        min = j;
      }
      if (min != i) {
        swap(&a[i], &a[min]);
      }
    }
  }
}
```