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

```asm
<has_uppercase_letters>:
  endbr64
  push   %r12
  push   %rbp
  xor    %ebp,%ebp
  push   %rbx
  call   <to_wide@plt>
  test   %rax,%rax
  je     L37
  mov    %rax,%r12
  lea    -0x4(%rax),%rbx
  jmp    L3
  nopl   (%rax)
L42:
  mov    %ebp,%edi
  call   <iswupper@plt>
  test   %rax,%rax
  jne    L14
L3:
  mov    0x4(%rbx),%ebp
  add    $0x4,%rbx
  test   %ebp,%ebp
  jne    L42
L48:
  mov    %r12,%rdi
  call   <free@plt>
L37:
  mov    %ebp,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  cs nopw 0x0(%rax,%rax,1)
L14:
  mov    $0x1,%ebp
  jmp    L48
```

assistant: ```c
int has_uppercase_letters(const char str[]) {
  int has_uppercase = 0;
  wchar_t *const wstring = to_wide(str);
  if (wstring != NULL) {
    const wchar_t *p = wstring - 1;
    while (*++p != L'\0') {
      if (iswupper(*p)) {
        has_uppercase = 1;
        break;
      }
    }
    free(wstring);
  }
  return has_uppercase;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    $0x4,%edi
  call   <__wrap_malloc@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x8(%rbp),%rax
  movl   $0x5,(%rax)
  mov    -0x8(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,%esi
  lea    D6(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <__wrap_free@plt>
  mov    $0x0,%eax
  leave
  ret
```

tool_calls: name: parse_data
arguments: data_label: D6
datatype: string

tool: D6: %d


assistant: ```c
int main(void) {
  int *a = __wrap_malloc(sizeof(int));
  *a = 5;
  printf("%d\n", *a);
  __wrap_free(a);
  return 0;
}
```
user: Translate the below assembly code into C programming language:

```asm
<main>:
  endbr64
  push   %rbx
  mov    $0x4,%edi
  call   <__wrap_malloc@plt>
  mov    %rax,%rbx
  movl   $0x5,(%rax)
  mov    $0x5,%esi
  lea    D2(%rip),%rdi
  call   <printf@plt>
  mov    %rbx,%rdi
  call   <__wrap_free@plt>
  mov    $0x0,%eax
  pop    %rbx
  ret
```

tool_calls: name: disassemble_data
arguments: tag: D2
type_infered: string

tool: D2: %d


assistant: ```c
int main(void) {
  int *a = __wrap_malloc(sizeof(int));
  *a = 5;
  printf("%d\n", *a);
  __wrap_free(a);
  return 0;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<main>:
  endbr64
  push   %rbp
  mov    $0x4,%edi
  call   <__wrap_malloc@plt>
  mov    $0x5,%esi
  lea    D8(%rip),%rdi
  movl   $0x5,(%rax)
  mov    %rax,%rbp
  call   <printf@plt>
  mov    %rbp,%rdi
  call   <__wrap_free@plt>
  xor    %eax,%eax
  pop    %rbp
  ret
```

tool_calls: name: disassemble_data
arguments: data_tag: D8
data_type: string

tool: D8: %d


assistant: ```c
int main(void) {
  int *a = __wrap_malloc(sizeof(int));
  *a = 5;
  printf("%d\n", *a);
  __wrap_free(a);
  return 0;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<main>:
  endbr64
  push   %rbp
  mov    $0x4,%edi
  call   <__wrap_malloc@plt>
  mov    $0x5,%esi
  lea    D8(%rip),%rdi
  movl   $0x5,(%rax)
  mov    %rax,%rbp
  call   <printf@plt>
  mov    %rbp,%rdi
  call   <__wrap_free@plt>
  xor    %eax,%eax
  pop    %rbp
  ret
```

tool_calls: name: disassemble_data
arguments: data_label: D8
datatype: string

tool: D8: %d


assistant: ```c
int main(void) {
  int *a = __wrap_malloc(sizeof(int));
  *a = 5;
  printf("%d\n", *a);
  __wrap_free(a);
  return 0;
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    $0x0,%eax
  call   <a@plt>
  mov    $0x7,%edi
  call   <b@plt>
  mov    $0x0,%eax
  pop    %rbp
  ret
```

assistant: ```c
int main(void) {
  a();
  b(7);
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  mov    $0x0,%eax
  call   <a@plt>
  mov    $0x7,%edi
  call   <b@plt>
  mov    $0x0,%eax
  add    $0x8,%rsp
  ret
```

assistant: ```c
int main(void) {
  a();
  b(7);
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  xor    %eax,%eax
  call   <a@plt>
  mov    $0x7,%edi
  call   <b@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  ret
```

assistant: ```c
int main(void) {
  a();
  b(7);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<main>:
  endbr64
  sub    $0x8,%rsp
  xor    %eax,%eax
  call   <a@plt>
  mov    $0x7,%edi
  call   <b@plt>
  xor    %eax,%eax
  add    $0x8,%rsp
  ret
```

assistant: ```c
int main(void) {
  a();
  b(7);
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<url_decode_xml_encode>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    -0x28(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L15
  mov    $0x0,%eax
  jmp    L11
L15:
  mov    -0x28(%rbp),%rdx
  mov    -0x20(%rbp),%rcx
  mov    -0x8(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <urldecode@plt>
  mov    -0x28(%rbp),%rax
  add    %eax,%eax
  mov    %eax,%edx
  mov    -0x8(%rbp),%rcx
  mov    -0x18(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <xmlencode@plt>
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    $0x1,%eax
L11:
  leave
  ret
```

assistant: ```c
int url_decode_xml_encode(char *dst, char *src, size_t src_size) {
  char *url_decoded_key = (char *)malloc(src_size + 1);
  if (url_decoded_key == NULL) {
    return 0;
  }
  urldecode(url_decoded_key, src, src_size);
  xmlencode(dst, url_decoded_key, 2 * src_size);
  free(url_decoded_key);
  return 1;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<url_decode_xml_encode>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%r12
  mov    %rsi,%r13
  mov    %rdx,%rbx
  lea    0x1(%rdx),%rdi
  call   <malloc@plt>
  mov    %rax,%rbp
  mov    $0x0,%eax
  test   %rbp,%rbp
  jne    L5
L13:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L5:
  mov    %rbx,%rdx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <urldecode@plt>
  lea    (%rbx,%rbx,1),%edx
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <xmlencode@plt>
  mov    %rbp,%rdi
  call   <free@plt>
  mov    $0x1,%eax
  jmp    L13
```

assistant: ```c
int url_decode_xml_encode(char *dst, char *src, size_t src_size) {
  char *url_decoded_key = (char *)malloc(src_size + 1);
  if (url_decoded_key == NULL) {
    return 0;
  }
  urldecode(url_decoded_key, src, src_size);
  xmlencode(dst, url_decoded_key, 2 * src_size);
  free(url_decoded_key);
  return 1;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<url_decode_xml_encode>:
  endbr64
  push   %r13
  mov    %rsi,%r13
  push   %r12
  mov    %rdi,%r12
  lea    0x1(%rdx),%rdi
  push   %rbp
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x8,%rsp
  call   <malloc@plt>
  mov    %rax,%rbp
  xor    %eax,%eax
  test   %rbp,%rbp
  je     L1
  mov    %rbx,%rdx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <urldecode@plt>
  lea    (%rbx,%rbx,1),%edx
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <xmlencode@plt>
  mov    %rbp,%rdi
  call   <free@plt>
  mov    $0x1,%eax
L1:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
int url_decode_xml_encode(char *dst, char *src, size_t src_size) {
  char *url_decoded_key = (char *)malloc(src_size + 1);
  if (url_decoded_key == NULL) {
    return 0;
  }
  urldecode(url_decoded_key, src, src_size);
  xmlencode(dst, url_decoded_key, 2 * src_size);
  free(url_decoded_key);
  return 1;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<url_decode_xml_encode>:
  endbr64
  push   %r13
  mov    %rsi,%r13
  push   %r12
  mov    %rdi,%r12
  lea    0x1(%rdx),%rdi
  push   %rbp
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x8,%rsp
  call   <malloc@plt>
  mov    %rax,%rbp
  xor    %eax,%eax
  test   %rbp,%rbp
  je     L2
  mov    %rbx,%rdx
  mov    %r13,%rsi
  mov    %rbp,%rdi
  call   <urldecode@plt>
  lea    (%rbx,%rbx,1),%edx
  mov    %rbp,%rsi
  mov    %r12,%rdi
  call   <xmlencode@plt>
  mov    %rbp,%rdi
  call   <free@plt>
  mov    $0x1,%eax
L2:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
```

assistant: ```c
int url_decode_xml_encode(char *dst, char *src, size_t src_size) {
  char *url_decoded_key = (char *)malloc(src_size + 1);
  if (url_decoded_key == NULL) {
    return 0;
  }
  urldecode(url_decoded_key, src, src_size);
  xmlencode(dst, url_decoded_key, 2 * src_size);
  free(url_decoded_key);
  return 1;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<fake_timestamp>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    -0x28(%rbp),%rdx
  lea    -0x20(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <gettimeofday@plt>
  mov    -0x18(%rbp),%rax
  imul   $0x3e8,%eax,%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x24(%rbp),%eax
  movslq %eax,%rdx
  imul   $0x10624dd3,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x6,%edx
  sar    $0x1f,%eax
  mov    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  imul   $0x3e8,%eax,%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x20(%rbp),%eax
  movslq %eax,%rdx
  imul   $0x10624dd3,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x6,%edx
  sar    $0x1f,%eax
  mov    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  add    %eax,-0x24(%rbp)
  mov    -0x24(%rbp),%eax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L7
  call   <__stack_chk_fail@plt>
L7:
  leave
  ret
```

assistant: ```c
Time fake_timestamp() {
  int tint;
  struct timeval tv;
  struct timezone tz;
  gettimeofday(&tv, &tz);
  tint = (int)tv.tv_sec * 1000;
  tint = tint / 1000 * 1000;
  tint = tint + tv.tv_usec / 1000;
  return (Time)tint;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<fake_timestamp>:
  endbr64
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  lea    0xc(%rsp),%rsi
  lea    0x10(%rsp),%rdi
  call   <gettimeofday@plt>
  imul   $0x3e8,0x18(%rsp),%ecx
  mov    0x10(%rsp),%edx
  movslq %edx,%rax
  imul   $0x10624dd3,%rax,%rax
  sar    $0x26,%rax
  sar    $0x1f,%edx
  sub    %edx,%eax
  add    %ecx,%eax
  mov    0x28(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L2
  add    $0x38,%rsp
  ret
L2:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
Time fake_timestamp() {
  int tint;
  struct timeval tv;
  struct timezone tz;
  gettimeofday(&tv, &tz);
  tint = (int)tv.tv_sec * 1000;
  tint = tint / 1000 * 1000;
  tint = tint + tv.tv_usec / 1000;
  return (Time)tint;
}
```
user: Translate the below assembly code into C programming language:

```asm
<fake_timestamp>:
  endbr64
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  lea    0xc(%rsp),%rsi
  lea    0x10(%rsp),%rdi
  call   <gettimeofday@plt>
  movslq 0x10(%rsp),%rax
  imul   $0x3e8,0x18(%rsp),%ecx
  mov    %rax,%rdx
  imul   $0x10624dd3,%rax,%rax
  sar    $0x1f,%edx
  sar    $0x26,%rax
  sub    %edx,%eax
  add    %ecx,%eax
  mov    0x28(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L8
  add    $0x38,%rsp
  ret
L8:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
Time fake_timestamp() {
  int tint;
  struct timeval tv;
  struct timezone tz;
  gettimeofday(&tv, &tz);
  tint = (int)tv.tv_sec * 1000;
  tint = tint / 1000 * 1000;
  tint = tint + tv.tv_usec / 1000;
  return (Time)tint;
}
```
user: 这段汇编代码用C语言表示是什么样的?

```asm
<fake_timestamp>:
  endbr64
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  lea    0xc(%rsp),%rsi
  lea    0x10(%rsp),%rdi
  call   <gettimeofday@plt>
  movslq 0x10(%rsp),%rax
  imul   $0x3e8,0x18(%rsp),%ecx
  mov    %rax,%rdx
  imul   $0x10624dd3,%rax,%rax
  sar    $0x1f,%edx
  sar    $0x26,%rax
  sub    %edx,%eax
  add    %ecx,%eax
  mov    0x28(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L4
  add    $0x38,%rsp
  ret
L4:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
Time fake_timestamp() {
  int tint;
  struct timeval tv;
  struct timezone tz;
  gettimeofday(&tv, &tz);
  tint = (int)tv.tv_sec * 1000;
  tint = tint / 1000 * 1000;
  tint = tint + tv.tv_usec / 1000;
  return (Time)tint;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<Array_binary_search>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    %edx,-0x20(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <assert@plt>
  cmpl   $0x0,-0x1c(%rbp)
  setg   %al
  movzbl %al,%eax
  mov    %eax,%edi
  mov    $0x0,%eax
  call   <assert@plt>
  mov    -0x1c(%rbp),%ecx
  mov    -0x18(%rbp),%rax
  mov    $0x64,%edx
  mov    %ecx,%esi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <Array_sorted@plt>
  test   %eax,%eax
  jne    L12
  mov    $0xfffffffe,%eax
  jmp    L39
L12:
  movl   $0x0,-0xc(%rbp)
  mov    -0x1c(%rbp),%eax
  mov    %eax,-0x8(%rbp)
  mov    -0xc(%rbp),%edx
  mov    -0x8(%rbp),%eax
  add    %edx,%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,-0x4(%rbp)
  jmp    L35
L62:
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    %eax,-0x20(%rbp)
  jge    L33
  mov    -0x4(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x8(%rbp)
  jmp    L70
L33:
  mov    -0x4(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0xc(%rbp)
L70:
  mov    -0xc(%rbp),%edx
  mov    -0x8(%rbp),%eax
  add    %edx,%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,-0x4(%rbp)
L35:
  mov    -0xc(%rbp),%eax
  cmp    -0x8(%rbp),%eax
  jge    L26
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    %eax,-0x20(%rbp)
  jne    L62
L26:
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    %eax,-0x20(%rbp)
  jne    L73
  mov    -0x4(%rbp),%eax
  jmp    L39
L73:
  mov    $0xffffffff,%eax
L39:
  leave
  ret
```

assistant: ```c
int Array_binary_search(int *arr, int len, int item) {
  assert(arr);
  assert(len > 0);
  if (!Array_sorted(arr, len, 100))
    return -2;
  ;
  int start = 0, end = len, mid = (start + end) / 2;
  while (start < end && arr[mid] != item) {
    if (arr[mid] > item)
      end = mid - 1;
    else
      start = mid + 1;
    mid = (start + end) / 2;
  }
  if (arr[mid] == item)
    return mid;
  else
    return -1;
  ;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<Array_binary_search>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%r12
  mov    %esi,%ebx
  mov    %edx,%ebp
  mov    $0x0,%eax
  call   <assert@plt>
  test   %ebx,%ebx
  setg   %dil
  movzbl %dil,%edi
  mov    $0x0,%eax
  call   <assert@plt>
  mov    $0x64,%edx
  mov    %ebx,%esi
  mov    %r12,%rdi
  mov    $0x0,%eax
  call   <Array_sorted@plt>
  test   %eax,%eax
  je     L49
  mov    %ebx,%eax
  shr    $0x1f,%eax
  add    %ebx,%eax
  sar    %eax
  mov    $0x0,%ecx
  test   %ebx,%ebx
  jg     L10
L23:
  movslq %eax,%rdx
  cmp    %ebp,(%r12,%rdx,4)
  mov    $0xffffffff,%edx
  cmovne %edx,%eax
L54:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L34:
  lea    0x1(%rax),%ecx
L66:
  lea    (%rcx,%rbx,1),%edx
  mov    %edx,%eax
  shr    $0x1f,%eax
  add    %edx,%eax
  sar    %eax
  cmp    %ebx,%ecx
  jge    L23
L10:
  movslq %eax,%rdx
  mov    (%r12,%rdx,4),%edx
  cmp    %ebp,%edx
  je     L54
  jle    L34
  lea    -0x1(%rax),%ebx
  jmp    L66
L49:
  mov    $0xfffffffe,%eax
  jmp    L54
```

assistant: ```c
int Array_binary_search(int *arr, int len, int item) {
  assert(arr);
  assert(len > 0);
  if (!Array_sorted(arr, len, 100))
    return -2;
  ;
  int start = 0, end = len, mid = (start + end) / 2;
  while (start < end && arr[mid] != item) {
    if (arr[mid] > item)
      end = mid - 1;
    else
      start = mid + 1;
    mid = (start + end) / 2;
  }
  if (arr[mid] == item)
    return mid;
  else
    return -1;
  ;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<Array_binary_search>:
  endbr64
  push   %r12
  xor    %eax,%eax
  mov    %edx,%r12d
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %esi,%ebx
  call   <assert@plt>
  xor    %edi,%edi
  test   %ebx,%ebx
  setg   %dil
  xor    %eax,%eax
  call   <assert@plt>
  xor    %eax,%eax
  mov    $0x64,%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <Array_sorted@plt>
  test   %eax,%eax
  je     L23
  mov    %ebx,%eax
  xor    %ecx,%ecx
  shr    $0x1f,%eax
  add    %ebx,%eax
  sar    %eax
  test   %ebx,%ebx
  jg     L64
  jmp    L46
  nopl   0x0(%rax)
L42:
  lea    -0x1(%rax),%ebx
  lea    (%rcx,%rbx,1),%edx
  mov    %edx,%eax
  shr    $0x1f,%eax
  add    %edx,%eax
  sar    %eax
  cmp    %ebx,%ecx
  jge    L46
L64:
  movslq %eax,%rdx
  cmp    %r12d,0x0(%rbp,%rdx,4)
  je     L51
  jg     L42
  lea    0x1(%rax),%ecx
  lea    (%rcx,%rbx,1),%edx
  mov    %edx,%eax
  shr    $0x1f,%eax
  add    %edx,%eax
  sar    %eax
  cmp    %ebx,%ecx
  jl     L64
L46:
  movslq %eax,%rdx
  cmp    %r12d,0x0(%rbp,%rdx,4)
  mov    $0xffffffff,%edx
  cmovne %edx,%eax
L51:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L23:
  mov    $0xfffffffe,%eax
  jmp    L51
```

assistant: ```c
int Array_binary_search(int *arr, int len, int item) {
  assert(arr);
  assert(len > 0);
  if (!Array_sorted(arr, len, 100))
    return -2;
  ;
  int start = 0, end = len, mid = (start + end) / 2;
  while (start < end && arr[mid] != item) {
    if (arr[mid] > item)
      end = mid - 1;
    else
      start = mid + 1;
    mid = (start + end) / 2;
  }
  if (arr[mid] == item)
    return mid;
  else
    return -1;
  ;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<Array_binary_search>:
  endbr64
  push   %r12
  xor    %eax,%eax
  mov    %edx,%r12d
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %esi,%ebx
  call   <assert@plt>
  xor    %edi,%edi
  test   %ebx,%ebx
  setg   %dil
  xor    %eax,%eax
  call   <assert@plt>
  xor    %eax,%eax
  mov    $0x64,%edx
  mov    %ebx,%esi
  mov    %rbp,%rdi
  call   <Array_sorted@plt>
  test   %eax,%eax
  je     L23
  mov    %ebx,%eax
  xor    %edx,%edx
  shr    $0x1f,%eax
  add    %ebx,%eax
  sar    %eax
  test   %ebx,%ebx
  jle    L34
  nopw   0x0(%rax,%rax,1)
L68:
  movslq %eax,%rcx
  cmp    %r12d,0x0(%rbp,%rcx,4)
  je     L20
  jle    L46
  lea    -0x1(%rax),%ebx
  lea    (%rbx,%rdx,1),%ecx
  mov    %ecx,%eax
  shr    $0x1f,%eax
  add    %ecx,%eax
  sar    %eax
  cmp    %edx,%ebx
  jg     L68
L34:
  movslq %eax,%rdx
  cmp    %r12d,0x0(%rbp,%rdx,4)
  mov    $0xffffffff,%edx
  cmovne %edx,%eax
L20:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax)
L46:
  lea    0x1(%rax),%edx
  lea    (%rdx,%rbx,1),%ecx
  mov    %ecx,%eax
  shr    $0x1f,%eax
  add    %ecx,%eax
  sar    %eax
  cmp    %ebx,%edx
  jl     L68
  jmp    L34
L23:
  mov    $0xfffffffe,%eax
  jmp    L20
```

assistant: ```c
int Array_binary_search(int *arr, int len, int item) {
  assert(arr);
  assert(len > 0);
  if (!Array_sorted(arr, len, 100))
    return -2;
  ;
  int start = 0, end = len, mid = (start + end) / 2;
  while (start < end && arr[mid] != item) {
    if (arr[mid] > item)
      end = mid - 1;
    else
      start = mid + 1;
    mid = (start + end) / 2;
  }
  if (arr[mid] == item)
    return mid;
  else
    return -1;
  ;
}
```
user: Translate the below assembly code into C programming language:

```asm
<exgcd>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    %rcx,-0x30(%rbp)
  cmpq   $0x0,-0x20(%rbp)
  jne    L0
  mov    -0x28(%rbp),%rax
  movq   $0x1,(%rax)
  mov    -0x30(%rbp),%rax
  movq   $0x0,(%rax)
  mov    -0x18(%rbp),%rax
  jmp    L7
L0:
  mov    -0x18(%rbp),%rax
  cqto
  idivq  -0x20(%rbp)
  mov    %rdx,%rsi
  mov    -0x30(%rbp),%rcx
  mov    -0x28(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <exgcd>
  mov    %rax,-0x10(%rbp)
  mov    -0x28(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x30(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x28(%rbp),%rax
  mov    %rdx,(%rax)
  mov    -0x18(%rbp),%rax
  cqto
  idivq  -0x20(%rbp)
  mov    %rax,%rdx
  mov    -0x30(%rbp),%rax
  mov    (%rax),%rax
  mov    %rdx,%rcx
  imul   %rax,%rcx
  mov    -0x8(%rbp),%rax
  sub    %rcx,%rax
  mov    %rax,%rdx
  mov    -0x30(%rbp),%rax
  mov    %rdx,(%rax)
  mov    -0x10(%rbp),%rax
L7:
  leave
  ret
```

assistant: ```c
long long exgcd(long long a, long long b, long long *x, long long *y) {
  if (b == 0) {
    *x = 1;
    *y = 0;
    return a;
  } else {
    long long d = exgcd(b, a % b, x, y);
    long long t = *x;
    *x = *y;
    *y = t - a / b * (*y);
    return d;
  }
}
```
user: Translate the below assembly code into C programming language:

```asm
<exgcd>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rax
  mov    %rsi,%rdi
  mov    %rdx,%r12
  mov    %rcx,%rbp
  mov    $0x1,%edx
  test   %rsi,%rsi
  jne    L3
L6:
  mov    %rdx,(%r12)
  mov    %rdi,0x0(%rbp)
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L3:
  cqto
  idiv   %rsi
  mov    %rdx,%rsi
  mov    %rax,%rbx
  mov    %r12,%rdx
  call   <exgcd>
  mov    %rax,%rcx
  mov    0x0(%rbp),%rdx
  mov    %rbx,%rax
  imul   %rdx,%rax
  mov    (%r12),%rdi
  sub    %rax,%rdi
  mov    %rcx,%rax
  jmp    L6
```

assistant: ```c
long long exgcd(long long a, long long b, long long *x, long long *y) {
  if (b == 0) {
    *x = 1;
    *y = 0;
    return a;
  } else {
    long long d = exgcd(b, a % b, x, y);
    long long t = *x;
    *x = *y;
    *y = t - a / b * (*y);
    return d;
  }
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<exgcd>:
  endbr64
  push   %r14
  mov    %rdi,%rax
  push   %r13
  mov    %rcx,%r13
  mov    $0x1,%ecx
  push   %r12
  mov    %rdx,%r12
  push   %rbp
  push   %rbx
  test   %rsi,%rsi
  jne    L33
L15:
  pop    %rbx
  pop    %rbp
  mov    %rcx,(%r12)
  pop    %r12
  mov    %rsi,0x0(%r13)
  pop    %r13
  pop    %r14
  ret
L33:
  cqto
  xor    %ecx,%ecx
  mov    $0x1,%r8d
  idiv   %rsi
  mov    %rdx,%rdi
  mov    %rax,%rbp
  test   %rdx,%rdx
  jne    L38
L31:
  mov    %r8,(%r12)
  mov    %rsi,%rax
  mov    %rcx,0x0(%r13)
  mov    (%r12),%rsi
  sub    %rdi,%rsi
  jmp    L15
  nopl   0x0(%rax)
L38:
  mov    %rsi,%rax
  cqto
  idiv   %rdi
  mov    %rdx,%r8
  mov    %rax,%rbx
  xor    %edx,%edx
  mov    $0x1,%eax
  test   %r8,%r8
  jne    L52
L44:
  mov    %rax,(%r12)
  mov    %rdi,%rsi
  mov    %rbp,%rdi
  mov    %r8,0x0(%r13)
  mov    (%r12),%rcx
  sub    %rdx,%rcx
  imul   %rcx,%rdi
  jmp    L31
  nopl   (%rax)
L52:
  mov    %rdi,%rax
  mov    %r13,%rcx
  mov    %r8,%rdi
  cqto
  idiv   %r8
  mov    %rdx,%rsi
  mov    %r12,%rdx
  mov    %rax,%r14
  call   <exgcd>
  mov    (%r12),%r8
  mov    %rax,%rdi
  mov    0x0(%r13),%rax
  imul   %rax,%r14
  sub    %r14,%r8
  imul   %r8,%rbx
  mov    %rbx,%rdx
  jmp    L44
```

assistant: ```c
long long exgcd(long long a, long long b, long long *x, long long *y) {
  if (b == 0) {
    *x = 1;
    *y = 0;
    return a;
  } else {
    long long d = exgcd(b, a % b, x, y);
    long long t = *x;
    *x = *y;
    *y = t - a / b * (*y);
    return d;
  }
}
```