ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请将以下的汇编代码转换成C语言代码:

```asm
<sleep_time_get>:
  endbr64
  push   %rbx
  sub    $0x10,%rsp
  mov    %rdi,%rbx
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  movq   $0x0,(%rsp)
  mov    D44(%rip),%rax
  movq   $0x0,(%rax)
  mov    %rsp,%rsi
  mov    $0xa,%edx
  call   <strtoul@plt>
  test   %rax,%rax
  jne    L26
  cmp    %rbx,(%rsp)
  je     L95
  mov    D26(%rip),%rdx
  cmpq   $0x0,(%rdx)
  jne    L4
  mov    D17(%rip),%rcx
  mov    D44(%rip),%rdx
  mov    (%rdx),%rbx
  cmp    %rbx,(%rcx)
  jne    L4
  mov    $0xffffffffffffffff,%rax
  jmp    L4
L26:
  mov    D26(%rip),%rdx
  cmp    %rax,(%rdx)
  je     L77
L99:
  mov    %eax,%edx
  cmp    %rax,%rdx
  jne    L115
L4:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L111
  add    $0x10,%rsp
  pop    %rbx
  ret
L77:
  mov    D17(%rip),%rcx
  mov    D44(%rip),%rdx
  mov    (%rdx),%rbx
  cmp    %rbx,(%rcx)
  jne    L99
  mov    $0xffffffffffffffff,%rax
  jmp    L4
L95:
  mov    $0xffffffffffffffff,%rax
  jmp    L4
L115:
  mov    $0xffffffffffffffff,%rax
  jmp    L4
L111:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
long long sleep_time_get(const char *restrict token) {
  char *endptr = NULL;
  errno = 0;
  unsigned result = 0;
  unsigned long tmp = 0UL;
  if (0UL == (tmp = strtoul(token, &endptr, 10)) && endptr == token) {
    return -1;
  }
  if (ULONG_MAX == tmp && ERANGE == errno) {
    return -1;
  }
  result = tmp;
  if ((unsigned long)result != tmp) {
    return -1;
  }
  return result;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<sleep_time_get>:
  endbr64
  push   %rbp
  mov    $0xa,%edx
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x18,%rsp
  mov    D12(%rip),%rbp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rsi
  movq   $0x0,(%rsp)
  movq   $0x0,0x0(%rbp)
  call   <strtoul@plt>
  test   %rax,%rax
  jne    L21
  cmp    %rbx,(%rsp)
  je     L17
  mov    D29(%rip),%rdx
  cmpq   $0x0,(%rdx)
  je     L101
L59:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L109
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  ret
L21:
  mov    D29(%rip),%rdx
  cmp    %rax,(%rdx)
  je     L31
  mov    %eax,%edx
  cmp    %rax,%rdx
  je     L59
L17:
  mov    $0xffffffffffffffff,%rax
  jmp    L59
  nopl   0x0(%rax)
L31:
  mov    D34(%rip),%rdx
  mov    0x0(%rbp),%rcx
  cmp    %rcx,(%rdx)
  je     L17
  mov    %eax,%edx
  cmp    %rax,%rdx
  je     L59
  jmp    L17
  nopl   0x0(%rax)
L101:
  mov    D34(%rip),%rdx
  mov    (%rdx),%rcx
  cmp    %rcx,0x0(%rbp)
  jne    L59
  jmp    L17
L109:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
long long sleep_time_get(const char *restrict token) {
  char *endptr = NULL;
  errno = 0;
  unsigned result = 0;
  unsigned long tmp = 0UL;
  if (0UL == (tmp = strtoul(token, &endptr, 10)) && endptr == token) {
    return -1;
  }
  if (ULONG_MAX == tmp && ERANGE == errno) {
    return -1;
  }
  result = tmp;
  if ((unsigned long)result != tmp) {
    return -1;
  }
  return result;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<sleep_time_get>:
  endbr64
  push   %rbp
  mov    $0xa,%edx
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x18,%rsp
  mov    D45(%rip),%rbp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rsi
  movq   $0x0,(%rsp)
  movq   $0x0,0x0(%rbp)
  call   <strtoul@plt>
  test   %rax,%rax
  jne    L47
  cmp    %rbx,(%rsp)
  je     L44
  mov    D15(%rip),%rdx
  cmpq   $0x0,(%rdx)
  je     L77
L81:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L55
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  ret
L47:
  mov    D15(%rip),%rdx
  cmp    %rax,(%rdx)
  je     L18
  mov    %eax,%edx
  cmp    %rax,%rdx
  je     L81
L44:
  mov    $0xffffffffffffffff,%rax
  jmp    L81
  nopl   0x0(%rax)
L18:
  mov    D39(%rip),%rdx
  mov    0x0(%rbp),%rcx
  cmp    %rcx,(%rdx)
  je     L44
  mov    %eax,%edx
  cmp    %rax,%rdx
  je     L81
  jmp    L44
  nopl   0x0(%rax)
L77:
  mov    D39(%rip),%rdx
  mov    (%rdx),%rcx
  cmp    %rcx,0x0(%rbp)
  jne    L81
  jmp    L44
L55:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
long long sleep_time_get(const char *restrict token) {
  char *endptr = NULL;
  errno = 0;
  unsigned result = 0;
  unsigned long tmp = 0UL;
  if (0UL == (tmp = strtoul(token, &endptr, 10)) && endptr == token) {
    return -1;
  }
  if (ULONG_MAX == tmp && ERANGE == errno) {
    return -1;
  }
  result = tmp;
  if ((unsigned long)result != tmp) {
    return -1;
  }
  return result;
}
```
user: What is the c source code of the assembly code below?

```asm
<ypit_nthdow>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %esi,-0x28(%rbp)
  mov    %edx,-0x2c(%rbp)
  mov    %ecx,-0x30(%rbp)
  mov    -0x2c(%rbp),%eax
  shr    $0x1f,%eax
  movzbl %al,%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x28(%rbp),%edx
  mov    -0x18(%rbp),%eax
  lea    (%rdx,%rax,1),%ebx
  mov    -0x24(%rbp),%eax
  mov    %eax,%edi
  call   <ypit_year@plt>
  mov    %ebx,%esi
  mov    %eax,%edi
  call   <days_before_month@plt>
  sub    -0x18(%rbp),%eax
  mov    %eax,-0x1c(%rbp)
  mov    -0x24(%rbp),%edx
  mov    -0x1c(%rbp),%eax
  add    %edx,%eax
  mov    %eax,%edi
  call   <fast_mod7@plt>
  mov    %eax,-0x14(%rbp)
  mov    -0x2c(%rbp),%edx
  mov    -0x18(%rbp),%eax
  add    %eax,%edx
  mov    %edx,%eax
  shl    $0x3,%eax
  sub    %edx,%eax
  add    %eax,-0x1c(%rbp)
  cmpl   $0x0,-0x18(%rbp)
  je     L0
  mov    -0x14(%rbp),%eax
  sub    -0x30(%rbp),%eax
  mov    %eax,%edi
  call   <fast_mod7@plt>
  sub    %eax,-0x1c(%rbp)
  jmp    L13
L0:
  mov    -0x30(%rbp),%eax
  sub    -0x14(%rbp),%eax
  mov    %eax,%edi
  call   <fast_mod7@plt>
  add    %eax,-0x1c(%rbp)
L13:
  mov    -0x1c(%rbp),%eax
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
int ypit_nthdow(int j1, int m, int n, int dow) {
  int doy, m1dow, is_neg;
  is_neg = n < 0;
  doy = days_before_month(ypit_year(j1), m + is_neg) - is_neg;
  m1dow = fast_mod7(j1 + doy);
  doy += 7 * (n + is_neg);
  if (is_neg)
    doy -= fast_mod7(m1dow - dow);
  else
    doy += fast_mod7(dow - m1dow);
  return doy;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<ypit_nthdow>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %edi,%ebp
  mov    %edx,%r12d
  mov    %ecx,%r13d
  mov    %edx,%ebx
  shr    $0x1f,%ebx
  lea    (%rbx,%rsi,1),%r14d
  call   <ypit_year@plt>
  mov    %eax,%edi
  mov    %r14d,%esi
  call   <days_before_month@plt>
  sub    %ebx,%eax
  mov    %eax,%r14d
  lea    0x0(%rbp,%rax,1),%edi
  call   <fast_mod7@plt>
  add    %r12d,%ebx
  lea    (%r14,%rbx,8),%ebp
  sub    %ebx,%ebp
  test   %r12d,%r12d
  js     L15
  mov    %r13d,%edi
  sub    %eax,%edi
  call   <fast_mod7@plt>
  add    %ebp,%eax
L1:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L15:
  sub    %r13d,%eax
  mov    %eax,%edi
  call   <fast_mod7@plt>
  mov    %eax,%edx
  mov    %ebp,%eax
  sub    %edx,%eax
  jmp    L1
```

assistant: ```c
int ypit_nthdow(int j1, int m, int n, int dow) {
  int doy, m1dow, is_neg;
  is_neg = n < 0;
  doy = days_before_month(ypit_year(j1), m + is_neg) - is_neg;
  m1dow = fast_mod7(j1 + doy);
  doy += 7 * (n + is_neg);
  if (is_neg)
    doy -= fast_mod7(m1dow - dow);
  else
    doy += fast_mod7(dow - m1dow);
  return doy;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<ypit_nthdow>:
  endbr64
  push   %r14
  mov    %edx,%r14d
  push   %r13
  push   %r12
  mov    %ecx,%r12d
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  mov    %edx,%ebx
  shr    $0x1f,%ebx
  lea    (%rbx,%rsi,1),%r13d
  call   <ypit_year@plt>
  mov    %r13d,%esi
  mov    %eax,%edi
  call   <days_before_month@plt>
  sub    %ebx,%eax
  add    %r14d,%ebx
  mov    %eax,%r13d
  lea    0x0(%rbp,%rax,1),%edi
  call   <fast_mod7@plt>
  lea    0x0(%r13,%rbx,8),%ebp
  sub    %ebx,%ebp
  test   %r14d,%r14d
  js     L9
  mov    %r12d,%edi
  sub    %eax,%edi
  call   <fast_mod7@plt>
  pop    %rbx
  add    %ebp,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  xchg   %ax,%ax
L9:
  sub    %r12d,%eax
  mov    %eax,%edi
  call   <fast_mod7@plt>
  pop    %rbx
  mov    %eax,%r8d
  mov    %ebp,%eax
  pop    %rbp
  pop    %r12
  sub    %r8d,%eax
  pop    %r13
  pop    %r14
  ret
```

assistant: ```c
int ypit_nthdow(int j1, int m, int n, int dow) {
  int doy, m1dow, is_neg;
  is_neg = n < 0;
  doy = days_before_month(ypit_year(j1), m + is_neg) - is_neg;
  m1dow = fast_mod7(j1 + doy);
  doy += 7 * (n + is_neg);
  if (is_neg)
    doy -= fast_mod7(m1dow - dow);
  else
    doy += fast_mod7(dow - m1dow);
  return doy;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<ypit_nthdow>:
  endbr64
  push   %r14
  mov    %edx,%r14d
  push   %r13
  push   %r12
  mov    %ecx,%r12d
  push   %rbp
  mov    %edi,%ebp
  push   %rbx
  mov    %edx,%ebx
  shr    $0x1f,%ebx
  lea    (%rbx,%rsi,1),%r13d
  call   <ypit_year@plt>
  mov    %r13d,%esi
  mov    %eax,%edi
  call   <days_before_month@plt>
  sub    %ebx,%eax
  add    %r14d,%ebx
  mov    %eax,%r13d
  lea    0x0(%rbp,%rax,1),%edi
  call   <fast_mod7@plt>
  lea    0x0(%r13,%rbx,8),%ebp
  sub    %ebx,%ebp
  test   %r14d,%r14d
  js     L7
  mov    %r12d,%edi
  sub    %eax,%edi
  call   <fast_mod7@plt>
  pop    %rbx
  add    %ebp,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  xchg   %ax,%ax
L7:
  sub    %r12d,%eax
  mov    %eax,%edi
  call   <fast_mod7@plt>
  pop    %rbx
  mov    %eax,%r8d
  mov    %ebp,%eax
  pop    %rbp
  pop    %r12
  sub    %r8d,%eax
  pop    %r13
  pop    %r14
  ret
```

assistant: ```c
int ypit_nthdow(int j1, int m, int n, int dow) {
  int doy, m1dow, is_neg;
  is_neg = n < 0;
  doy = days_before_month(ypit_year(j1), m + is_neg) - is_neg;
  m1dow = fast_mod7(j1 + doy);
  doy += 7 * (n + is_neg);
  if (is_neg)
    doy -= fast_mod7(m1dow - dow);
  else
    doy += fast_mod7(dow - m1dow);
  return doy;
}
```
user: What is the c source code of the assembly code below:

```asm
<base64_decode>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,0x8(%rsp)
  cmpb   $0x0,(%rsi)
  je     L42
  mov    %rsi,%rbx
  mov    %edx,%r14d
  test   %edx,%edx
  je     L42
  mov    %rdi,%r13
  jmp    L112
L35:
  lea    0x2(%r12),%r15
L19:
  movb   $0x0,(%r15)
  mov    %r15d,%eax
  sub    0x8(%rsp),%eax
  jmp    L108
L59:
  add    $0x1,%rdx
  movzbl (%rdx),%eax
  test   %al,%al
  je     L88
L132:
  cmp    $0xd,%al
  je     L59
  cmp    $0xa,%al
  je     L59
  mov    %rdx,%rbx
L76:
  sub    $0x4,%r14d
  je     L96
L112:
  movsbl (%rbx),%edi
  call   <base64_value@plt>
  mov    %al,0x7(%rsp)
  movsbl 0x1(%rbx),%edi
  call   <base64_value@plt>
  mov    %eax,%r12d
  movsbl 0x2(%rbx),%edi
  call   <base64_value@plt>
  mov    %eax,%ebp
  movsbl 0x3(%rbx),%edi
  call   <base64_value@plt>
  mov    %eax,%edx
  lea    0x1(%r13),%r15
  movzbl 0x7(%rsp),%eax
  shl    $0x2,%eax
  mov    %r12d,%ecx
  sar    $0x4,%cl
  or     %ecx,%eax
  mov    %al,0x0(%r13)
  shl    $0x4,%r12d
  mov    %ebp,%eax
  sar    $0x2,%al
  or     %eax,%r12d
  mov    %r12b,0x1(%r13)
  mov    %r13,%r12
  add    $0x3,%r13
  shl    $0x6,%ebp
  or     %edx,%ebp
  mov    %bpl,-0x1(%r13)
  movsbl 0x1(%rbx),%edi
  call   <isbase64@plt>
  test   %eax,%eax
  je     L19
  movsbl 0x2(%rbx),%edi
  call   <isbase64@plt>
  test   %eax,%eax
  je     L19
  movsbl 0x3(%rbx),%edi
  call   <isbase64@plt>
  test   %eax,%eax
  je     L35
  lea    0x4(%rbx),%rdx
  movzbl 0x4(%rbx),%eax
  mov    %rdx,%rbx
  test   %al,%al
  jne    L132
  jmp    L76
L88:
  mov    %rdx,%rbx
  jmp    L76
L96:
  mov    %r13,%r15
  jmp    L19
L42:
  mov    $0x0,%eax
L108:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
int base64_decode(char *dest, char *src, int srclen) {
  if (*src == 0 || srclen == 0) {
    return 0;
  }
  char *p = dest;
  do {
    char a = base64_value(src[0]);
    char b = base64_value(src[1]);
    char c = base64_value(src[2]);
    char d = base64_value(src[3]);
    *p++ = (a << 2) | (b >> 4);
    *p++ = (b << 4) | (c >> 2);
    *p++ = (c << 6) | d;
    if (!isbase64(src[1])) {
      p -= 2;
      break;
    } else if (!isbase64(src[2])) {
      p -= 2;
      break;
    } else if (!isbase64(src[3])) {
      p--;
      break;
    }
    src += 4;
    while (*src && (*src == 13 || *src == 10))
      src++;
  } while (srclen -= 4);
  *p = 0;
  return p - dest;
}
```
user: What would the C source look like for the assembly code provided here:

```asm
<base64_decode>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdi,%r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,0x8(%rsp)
  movsbl (%rsi),%edi
  test   %edx,%edx
  je     L104
  mov    %rsi,%rbx
  mov    %edx,%ebp
  test   %dil,%dil
  je     L104
  nopl   0x0(%rax,%rax,1)
L95:
  call   <base64_value@plt>
  movsbl 0x1(%rbx),%edi
  mov    %eax,%r12d
  call   <base64_value@plt>
  movsbl 0x2(%rbx),%edi
  shl    $0x2,%r12d
  mov    %eax,%r15d
  call   <base64_value@plt>
  movsbl 0x3(%rbx),%edi
  mov    %eax,%r13d
  call   <base64_value@plt>
  mov    %r15d,%esi
  lea    0x1(%r14),%rcx
  mov    %r13d,%edx
  sar    $0x4,%sil
  mov    %rcx,(%rsp)
  mov    %r15d,%ecx
  shl    $0x6,%edx
  or     %esi,%r12d
  mov    %r13d,%esi
  shl    $0x4,%ecx
  or     %eax,%edx
  sar    $0x2,%sil
  mov    %r12b,(%r14)
  lea    0x3(%r14),%r12
  or     %esi,%ecx
  mov    %cl,0x1(%r14)
  mov    %dl,-0x1(%r12)
  movsbl 0x1(%rbx),%edi
  call   <isbase64@plt>
  test   %eax,%eax
  je     L50
  movsbl 0x2(%rbx),%edi
  call   <isbase64@plt>
  test   %eax,%eax
  je     L50
  movsbl 0x3(%rbx),%edi
  call   <isbase64@plt>
  test   %eax,%eax
  je     L127
  movzbl 0x4(%rbx),%eax
  lea    0x4(%rbx),%rdx
  test   %al,%al
  jne    L36
  jmp    L58
  nopl   0x0(%rax,%rax,1)
L45:
  movzbl 0x1(%rdx),%eax
  add    $0x1,%rdx
  test   %al,%al
  je     L58
L36:
  cmp    $0xd,%al
  je     L45
  cmp    $0xa,%al
  je     L45
L58:
  sub    $0x4,%ebp
  je     L72
  movsbl (%rdx),%edi
  mov    %r12,%r14
  mov    %rdx,%rbx
  jmp    L95
  nop
L104:
  add    $0x18,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L127:
  lea    0x2(%r14),%rax
  mov    %rax,(%rsp)
L50:
  mov    (%rsp),%rax
  movb   $0x0,(%rax)
  sub    0x8(%rsp),%eax
L34:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L72:
  mov    %r12,(%rsp)
  mov    (%rsp),%rax
  movb   $0x0,(%rax)
  sub    0x8(%rsp),%eax
  jmp    L34
```

assistant: ```c
int base64_decode(char *dest, char *src, int srclen) {
  if (*src == 0 || srclen == 0) {
    return 0;
  }
  char *p = dest;
  do {
    char a = base64_value(src[0]);
    char b = base64_value(src[1]);
    char c = base64_value(src[2]);
    char d = base64_value(src[3]);
    *p++ = (a << 2) | (b >> 4);
    *p++ = (b << 4) | (c >> 2);
    *p++ = (c << 6) | d;
    if (!isbase64(src[1])) {
      p -= 2;
      break;
    } else if (!isbase64(src[2])) {
      p -= 2;
      break;
    } else if (!isbase64(src[3])) {
      p--;
      break;
    }
    src += 4;
    while (*src && (*src == 13 || *src == 10))
      src++;
  } while (srclen -= 4);
  *p = 0;
  return p - dest;
}
```
user: Translate the below assembly code into C programming language:

```asm
<base64_decode>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,0x18(%rsp)
  movsbl (%rsi),%edi
  test   %edx,%edx
  je     L97
  mov    %rsi,%rbx
  mov    %edx,%r13d
  test   %dil,%dil
  je     L97
  nopl   0x0(%rax)
L62:
  call   <base64_value@plt>
  movsbl 0x1(%rbx),%edi
  mov    %eax,%ebp
  call   <base64_value@plt>
  movsbl 0x2(%rbx),%edi
  shl    $0x2,%ebp
  mov    %eax,%r14d
  call   <base64_value@plt>
  movsbl 0x3(%rbx),%edi
  mov    %eax,%r15d
  call   <base64_value@plt>
  mov    %r14d,%esi
  lea    0x1(%r12),%rcx
  mov    %r15d,%edx
  sar    $0x4,%sil
  mov    %rcx,0x8(%rsp)
  mov    %r14d,%ecx
  shl    $0x6,%edx
  or     %esi,%ebp
  mov    %r15d,%esi
  shl    $0x4,%ecx
  mov    %r12,0x10(%rsp)
  sar    $0x2,%sil
  mov    %bpl,(%r12)
  or     %eax,%edx
  add    $0x3,%r12
  or     %esi,%ecx
  mov    %cl,-0x2(%r12)
  mov    %dl,-0x1(%r12)
  movsbl 0x1(%rbx),%edi
  call   <isbase64@plt>
  test   %eax,%eax
  je     L67
  movsbl 0x2(%rbx),%edi
  call   <isbase64@plt>
  test   %eax,%eax
  je     L67
  movsbl 0x3(%rbx),%edi
  call   <isbase64@plt>
  test   %eax,%eax
  je     L82
  movsbl 0x4(%rbx),%edi
  lea    0x4(%rbx),%rax
  test   %dil,%dil
  jne    L23
  jmp    L112
  nopw   0x0(%rax,%rax,1)
L118:
  movsbl 0x1(%rax),%edi
  add    $0x1,%rax
  test   %dil,%dil
  je     L112
L23:
  cmp    $0xd,%dil
  je     L118
  cmp    $0xa,%dil
  je     L118
L112:
  mov    %rax,%rbx
  sub    $0x4,%r13d
  jne    L62
  mov    %r12,0x8(%rsp)
L67:
  mov    0x8(%rsp),%rax
  movb   $0x0,(%rax)
  sub    0x18(%rsp),%eax
L89:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  cs nopw 0x0(%rax,%rax,1)
L97:
  add    $0x28,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L82:
  mov    0x10(%rsp),%rax
  add    $0x2,%rax
  mov    %rax,0x8(%rsp)
  mov    0x8(%rsp),%rax
  movb   $0x0,(%rax)
  sub    0x18(%rsp),%eax
  jmp    L89
```

assistant: ```c
int base64_decode(char *dest, char *src, int srclen) {
  if (*src == 0 || srclen == 0) {
    return 0;
  }
  char *p = dest;
  do {
    char a = base64_value(src[0]);
    char b = base64_value(src[1]);
    char c = base64_value(src[2]);
    char d = base64_value(src[3]);
    *p++ = (a << 2) | (b >> 4);
    *p++ = (b << 4) | (c >> 2);
    *p++ = (c << 6) | d;
    if (!isbase64(src[1])) {
      p -= 2;
      break;
    } else if (!isbase64(src[2])) {
      p -= 2;
      break;
    } else if (!isbase64(src[3])) {
      p--;
      break;
    }
    src += 4;
    while (*src && (*src == 13 || *src == 10))
      src++;
  } while (srclen -= 4);
  *p = 0;
  return p - dest;
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<f1>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    -0x18(%rbp),%rax
  mov    $0x0,%edx
  mov    -0x20(%rbp),%rcx
  add    %rcx,%rax
  jae    L6
  mov    $0x1,%edx
L6:
  mov    %rax,-0x18(%rbp)
  mov    %rdx,%rax
  and    $0x1,%eax
  movzbl %al,%eax
  mov    %rax,-0x8(%rbp)
  mov    -0x18(%rbp),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  pop    %rbp
  ret
```

assistant: ```c
__attribute__((noipa)) unsigned long f1(unsigned long a, unsigned long b) {
  unsigned long i = __builtin_add_overflow(a, b, &a);
  return a + i;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<f1>:
  endbr64
  add    %rsi,%rdi
  mov    %rdi,%rax
  adc    $0x0,%rax
  ret
```

assistant: ```c
__attribute__((noipa)) unsigned long f1(unsigned long a, unsigned long b) {
  unsigned long i = __builtin_add_overflow(a, b, &a);
  return a + i;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<f1>:
  endbr64
  add    %rsi,%rdi
  mov    %rdi,%rax
  adc    $0x0,%rax
  ret
```

assistant: ```c
__attribute__((noipa)) unsigned long f1(unsigned long a, unsigned long b) {
  unsigned long i = __builtin_add_overflow(a, b, &a);
  return a + i;
}
```
user: Translate the below assembly code into C programming language:

```asm
<f1>:
  endbr64
  add    %rsi,%rdi
  mov    %rdi,%rax
  adc    $0x0,%rax
  ret
```

assistant: ```c
__attribute__((noipa)) unsigned long f1(unsigned long a, unsigned long b) {
  unsigned long i = __builtin_add_overflow(a, b, &a);
  return a + i;
}
```
user: Translate the below assembly code into C programming language:

```asm
<qfile_read>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%r15
  mov    %rsi,0x8(%rsp)
  test   %rsi,%rsi
  je     L124
  mov    (%rsi),%r13
  test   %r13,%r13
  mov    $0x400,%r14d
  cmovne %r13,%r14
L106:
  mov    $0x0,%r12d
  mov    $0x0,%ebx
  jmp    L147
L124:
  mov    $0x0,%r13d
  mov    $0x400,%r14d
  jmp    L106
L100:
  test   %rbx,%rbx
  je     L119
  lea    -0x1(%r14),%rax
  cmp    %rbx,%rax
  je     L46
L153:
  mov    %bpl,(%r12,%rbx,1)
  lea    0x1(%rbx),%rbx
L147:
  mov    %r15,%rdi
  call   <fgetc@plt>
  mov    %eax,%ebp
  mov    D1(%rip),%rax
  cmp    %ebp,(%rax)
  je     L33
  test   %r13,%r13
  je     L100
  cmp    %rbx,%r13
  jne    L100
L2:
  movb   $0x0,(%r12,%rbx,1)
  mov    0x8(%rsp),%rax
  test   %rax,%rax
  je     L70
  mov    %rbx,(%rax)
L70:
  mov    %r12,%rax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L119:
  mov    %r14d,%edi
  call   <malloc@plt>
  mov    %rax,%r12
  test   %rax,%rax
  jne    L153
  mov    $0x0,%r12d
  jmp    L70
L46:
  add    %r14,%r14
  lea    0x1(%r14),%edi
  call   <malloc@plt>
  mov    %rax,(%rsp)
  test   %rax,%rax
  je     L34
  mov    %rbx,%rdx
  mov    %r12,%rsi
  mov    (%rsp),%rdi
  call   <memcpy@plt>
  mov    %r12,%rdi
  call   <free@plt>
  mov    (%rsp),%r12
  jmp    L153
L34:
  mov    %r12,%rdi
  call   <free@plt>
  mov    $0x0,%r12d
  jmp    L70
L33:
  test   %rbx,%rbx
  jne    L2
  mov    $0x0,%r12d
  jmp    L70
```

assistant: ```c
void *qfile_read(FILE *fp, size_t *nbytes) {
  size_t memsize = 1024;
  size_t size = 0;
  if (nbytes != NULL && *nbytes > 0) {
    memsize = *nbytes;
    size = *nbytes;
  }
  int c;
  size_t c_count;
  char *data = NULL;
  for (c_count = 0; (c = fgetc(fp)) != EOF;) {
    if (size > 0 && c_count == size)
      break;
    if (c_count == 0) {
      data = (char *)malloc(sizeof(char) * memsize);
      if (data == NULL) {
        ;
        return NULL;
      }
    } else if (c_count == memsize - 1) {
      memsize *= 2;
      char *datatmp = (char *)malloc(sizeof(char) * (memsize + 1));
      if (datatmp == NULL) {
        ;
        free(data);
        return NULL;
      }
      memcpy(datatmp, data, c_count);
      free(data);
      data = datatmp;
    }
    data[c_count++] = (char)c;
  }
  if (c_count == 0 && c == EOF)
    return NULL;
  data[c_count] = '\0';
  if (nbytes != NULL)
    *nbytes = c_count;
  return (void *)data;
}
```