ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 这段汇编代码用C语言表示是什么样的:

```asm
<duplicate>:
  endbr64
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  sub    $0x8,%rsp
  call   <strlen@plt>
  lea    0x1(%rax),%edi
  call   <malloc@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L3
  mov    %rbp,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
L3:
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
char *duplicate(const char *s) {
  char *t = malloc((strlen(s) + 1) * sizeof(char));
  if (!t)
    return NULL;
  strcpy(t, s);
  return t;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<hash>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  movq   $0x2a,-0x8(%rbp)
  movl   $0x0,-0x10(%rbp)
  jmp    L12
L2:
  addl   $0x1,-0x10(%rbp)
L12:
  mov    -0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L2
  movl   $0x0,-0xc(%rbp)
  jmp    L35
L16:
  mov    -0xc(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbq %al,%rdx
  mov    -0xc(%rbp),%eax
  add    $0x1,%eax
  cltq
  imul   %rdx,%rax
  add    %rax,-0x8(%rbp)
  addl   $0x1,-0xc(%rbp)
L35:
  mov    -0xc(%rbp),%eax
  cmp    -0x10(%rbp),%eax
  jl     L16
  mov    -0x8(%rbp),%rax
  pop    %rbp
  ret
```

assistant: ```c
long hash(char *word) {
  long hash1 = 42;
  int len = 0;
  while (word[len] != '\0')
    len++;
  for (int i = 0; i < len; ++i) {
    hash1 += ((long)word[i]) * (i + 1);
  }
  return hash1;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<hash>:
  endbr64
  cmpb   $0x0,(%rdi)
  je     L1
  lea    0x1(%rdi),%rdx
  mov    $0x0,%eax
L42:
  mov    %eax,%esi
  add    $0x1,%eax
  add    $0x1,%rdx
  cmpb   $0x0,-0x1(%rdx)
  jne    L42
  test   %eax,%eax
  jle    L46
  mov    $0x1,%eax
  mov    $0x2a,%ecx
L37:
  movsbq -0x1(%rdi,%rax,1),%rdx
  imul   %rax,%rdx
  add    %rdx,%rcx
  add    $0x1,%rax
  lea    -0x2(%rax),%edx
  cmp    %esi,%edx
  jl     L37
L5:
  mov    %rcx,%rax
  ret
L1:
  mov    $0x2a,%ecx
  jmp    L5
L46:
  mov    $0x2a,%ecx
  jmp    L5
```

assistant: ```c
long hash(char *word) {
  long hash1 = 42;
  int len = 0;
  while (word[len] != '\0')
    len++;
  for (int i = 0; i < len; ++i) {
    hash1 += ((long)word[i]) * (i + 1);
  }
  return hash1;
}
```
user: 请从给定的汇编指令推导出C源代码:

```asm
<hash>:
  endbr64
  movsbq (%rdi),%rax
  test   %al,%al
  je     L28
  xor    %edx,%edx
  xchg   %ax,%ax
L21:
  mov    %edx,%ecx
  add    $0x1,%rdx
  cmpb   $0x0,(%rdi,%rdx,1)
  jne    L21
  add    $0x1,%ecx
  mov    $0x1,%edx
  mov    $0x2a,%r8d
  jmp    L26
  nopl   0x0(%rax)
L7:
  movsbq (%rdi,%rdx,1),%rax
  add    $0x1,%rdx
L26:
  imul   %rdx,%rax
  add    %rax,%r8
  cmp    %rdx,%rcx
  jne    L7
  mov    %r8,%rax
  ret
  nopl   0x0(%rax)
L28:
  mov    $0x2a,%r8d
  mov    %r8,%rax
  ret
```

assistant: ```c
long hash(char *word) {
  long hash1 = 42;
  int len = 0;
  while (word[len] != '\0')
    len++;
  for (int i = 0; i < len; ++i) {
    hash1 += ((long)word[i]) * (i + 1);
  }
  return hash1;
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<isbn_check>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  movl   $0x0,-0x8(%rbp)
  movl   $0x1,-0xc(%rbp)
  movl   $0x0,-0x10(%rbp)
  jmp    L12
L14:
  mov    -0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  mov    %eax,%edi
  call   <ctoi@plt>
  imul   -0xc(%rbp),%eax
  add    %eax,-0x8(%rbp)
  addl   $0x1,-0xc(%rbp)
  addl   $0x1,-0x10(%rbp)
L12:
  mov    -0x10(%rbp),%eax
  cmp    -0x2c(%rbp),%eax
  jl     L14
  mov    -0x8(%rbp),%edx
  movslq %edx,%rax
  imul   $0x2e8ba2e9,%rax,%rax
  shr    $0x20,%rax
  sar    %eax
  mov    %edx,%esi
  sar    $0x1f,%esi
  sub    %esi,%eax
  mov    %eax,%ecx
  mov    %ecx,%eax
  shl    $0x2,%eax
  add    %ecx,%eax
  add    %eax,%eax
  add    %ecx,%eax
  sub    %eax,%edx
  mov    %edx,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  mov    %eax,%edi
  call   <itoc@plt>
  mov    %al,-0x11(%rbp)
  cmpl   $0xa,-0x4(%rbp)
  jne    L27
  movb   $0x58,-0x11(%rbp)
L27:
  movzbl -0x11(%rbp),%eax
  leave
  ret
```

assistant: ```c
char isbn_check(const unsigned char source[], const int length) {
  int i, weight, sum, check;
  char check_char;
  sum = 0;
  weight = 1;
  for (i = 0; i < length; i++) {
    sum += ctoi(source[i]) * weight;
    weight++;
  }
  check = sum % 11;
  check_char = itoc(check);
  if (check == 10) {
    check_char = 'X';
  }
  return check_char;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<isbn_check>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  test   %esi,%esi
  jle    L15
  mov    %rdi,%r12
  lea    0x1(%rsi),%r13d
  mov    $0x1,%ebx
  mov    $0x0,%ebp
L18:
  movzbl -0x1(%r12,%rbx,1),%edi
  call   <ctoi@plt>
  imul   %ebx,%eax
  add    %eax,%ebp
  add    $0x1,%rbx
  cmp    %r13,%rbx
  jne    L18
  movslq %ebp,%rbx
  imul   $0x2e8ba2e9,%rbx,%rbx
  sar    $0x21,%rbx
  mov    %ebp,%eax
  sar    $0x1f,%eax
  sub    %eax,%ebx
  lea    (%rbx,%rbx,4),%eax
  lea    (%rbx,%rax,2),%eax
  mov    %ebp,%ebx
  sub    %eax,%ebx
  mov    %ebx,%edi
  call   <itoc@plt>
  cmp    $0xa,%ebx
  mov    $0x58,%edx
  cmove  %edx,%eax
L22:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L15:
  mov    $0x0,%edi
  call   <itoc@plt>
  jmp    L22
```

assistant: ```c
char isbn_check(const unsigned char source[], const int length) {
  int i, weight, sum, check;
  char check_char;
  sum = 0;
  weight = 1;
  for (i = 0; i < length; i++) {
    sum += ctoi(source[i]) * weight;
    weight++;
  }
  check = sum % 11;
  check_char = itoc(check);
  if (check == 10) {
    check_char = 'X';
  }
  return check_char;
}
```
user: Translate the below assembly code into C programming language:

```asm
<isbn_check>:
  endbr64
  test   %esi,%esi
  jle    L11
  push   %r13
  lea    0x1(%rsi),%r13d
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  xor    %ebp,%ebp
  push   %rbx
  mov    $0x1,%ebx
  sub    $0x8,%rsp
L10:
  movzbl -0x1(%r12,%rbx,1),%edi
  call   <ctoi@plt>
  imul   %ebx,%eax
  add    $0x1,%rbx
  add    %eax,%ebp
  cmp    %r13,%rbx
  jne    L10
  movslq %ebp,%rbx
  mov    %ebp,%eax
  imul   $0x2e8ba2e9,%rbx,%rbx
  sar    $0x1f,%eax
  sar    $0x21,%rbx
  sub    %eax,%ebx
  lea    (%rbx,%rbx,4),%eax
  lea    (%rbx,%rax,2),%eax
  mov    %ebp,%ebx
  sub    %eax,%ebx
  mov    %ebx,%edi
  call   <itoc@plt>
  cmp    $0xa,%ebx
  mov    $0x58,%edx
  cmove  %edx,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   (%rax)
L11:
  xor    %edi,%edi
  jmp    1060 <itoc@plt>
```

assistant: ```c
char isbn_check(const unsigned char source[], const int length) {
  int i, weight, sum, check;
  char check_char;
  sum = 0;
  weight = 1;
  for (i = 0; i < length; i++) {
    sum += ctoi(source[i]) * weight;
    weight++;
  }
  check = sum % 11;
  check_char = itoc(check);
  if (check == 10) {
    check_char = 'X';
  }
  return check_char;
}
```
user: What is the c source code of the assembly code below?

```asm
<isbn_check>:
  endbr64
  test   %esi,%esi
  jle    L18
  push   %r13
  lea    0x1(%rsi),%r13d
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  xor    %ebp,%ebp
  push   %rbx
  mov    $0x1,%ebx
  sub    $0x8,%rsp
L2:
  movzbl -0x1(%r12,%rbx,1),%edi
  call   <ctoi@plt>
  imul   %ebx,%eax
  add    $0x1,%rbx
  add    %eax,%ebp
  cmp    %r13,%rbx
  jne    L2
  movslq %ebp,%rbx
  mov    %ebp,%eax
  imul   $0x2e8ba2e9,%rbx,%rbx
  sar    $0x1f,%eax
  sar    $0x21,%rbx
  sub    %eax,%ebx
  lea    (%rbx,%rbx,4),%eax
  lea    (%rbx,%rax,2),%eax
  mov    %ebp,%ebx
  sub    %eax,%ebx
  mov    %ebx,%edi
  call   <itoc@plt>
  cmp    $0xa,%ebx
  mov    $0x58,%edx
  cmove  %edx,%eax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   (%rax)
L18:
  xor    %edi,%edi
  jmp    1060 <itoc@plt>
```

assistant: ```c
char isbn_check(const unsigned char source[], const int length) {
  int i, weight, sum, check;
  char check_char;
  sum = 0;
  weight = 1;
  for (i = 0; i < length; i++) {
    sum += ctoi(source[i]) * weight;
    weight++;
  }
  check = sum % 11;
  check_char = itoc(check);
  if (check == 10) {
    check_char = 'X';
  }
  return check_char;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<BTSHASP_ParseHexN>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  movl   $0x0,-0x4(%rbp)
  movl   $0x0,-0xc(%rbp)
  jmp    L2
L19:
  movl   $0x0,-0x8(%rbp)
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jle    L20
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x39,%al
  jg     L20
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x30,%eax
  mov    %eax,-0x8(%rbp)
L20:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x40,%al
  jle    L66
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x46,%al
  jg     L66
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x37,%eax
  mov    %eax,-0x8(%rbp)
L66:
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x60,%al
  jle    L47
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x66,%al
  jg     L47
  mov    -0x18(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x57,%eax
  mov    %eax,-0x8(%rbp)
L47:
  addq   $0x1,-0x18(%rbp)
  mov    -0x4(%rbp),%eax
  shl    $0x4,%eax
  or     -0x8(%rbp),%eax
  mov    %eax,-0x4(%rbp)
  addl   $0x1,-0xc(%rbp)
L2:
  mov    -0xc(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jl     L19
  mov    -0x4(%rbp),%eax
  pop    %rbp
  ret
```

assistant: ```c
int BTSHASP_ParseHexN(char *s, int n) {
  int i, j, k;
  k = 0;
  for (i = 0; i < n; i++) {
    j = 0;
    if ((*s >= '0') && (*s <= '9'))
      j = *s - '0';
    if ((*s >= 'A') && (*s <= 'F'))
      j = 10 + (*s - 'A');
    if ((*s >= 'a') && (*s <= 'f'))
      j = 10 + (*s - 'a');
    s++;
    k = (k << 4) | j;
  }
  return (k);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<BTSHASP_ParseHexN>:
  endbr64
  mov    %rdi,%rcx
  test   %esi,%esi
  jle    L84
  mov    %esi,%esi
  lea    (%rdi,%rsi,1),%rdi
  mov    $0x0,%eax
  mov    $0x0,%r8d
  jmp    L40
L30:
  lea    -0x41(%rdx),%esi
  cmp    $0x5,%sil
  ja     L70
  movsbl %dl,%edx
  sub    $0x37,%edx
L18:
  add    $0x1,%rcx
  shl    $0x4,%eax
  or     %edx,%eax
  cmp    %rdi,%rcx
  je     L32
L40:
  movzbl (%rcx),%edx
  lea    -0x30(%rdx),%esi
  cmp    $0x9,%sil
  ja     L30
  movsbl %dl,%edx
  sub    $0x30,%edx
  jmp    L18
L70:
  lea    -0x61(%rdx),%esi
  cmp    $0x5,%sil
  ja     L48
  movsbl %dl,%edx
  sub    $0x57,%edx
  jmp    L18
L48:
  mov    %r8d,%edx
  jmp    L18
L32:
  ret
L84:
  mov    $0x0,%eax
  ret
```

assistant: ```c
int BTSHASP_ParseHexN(char *s, int n) {
  int i, j, k;
  k = 0;
  for (i = 0; i < n; i++) {
    j = 0;
    if ((*s >= '0') && (*s <= '9'))
      j = *s - '0';
    if ((*s >= 'A') && (*s <= 'F'))
      j = 10 + (*s - 'A');
    if ((*s >= 'a') && (*s <= 'f'))
      j = 10 + (*s - 'a');
    s++;
    k = (k << 4) | j;
  }
  return (k);
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<BTSHASP_ParseHexN>:
  endbr64
  test   %esi,%esi
  jle    L51
  movslq %esi,%rsi
  xor    %eax,%eax
  add    %rdi,%rsi
  jmp    L3
  nopw   0x0(%rax,%rax,1)
L68:
  movsbl %cl,%edx
L16:
  shl    $0x4,%eax
  add    $0x1,%rdi
  or     %edx,%eax
  cmp    %rdi,%rsi
  je     L36
L3:
  movzbl (%rdi),%edx
  lea    -0x30(%rdx),%ecx
  cmp    $0x9,%cl
  jbe    L68
  lea    -0x41(%rdx),%ecx
  cmp    $0x5,%cl
  ja     L31
  sub    $0x37,%edx
  shl    $0x4,%eax
  add    $0x1,%rdi
  movsbl %dl,%edx
  or     %edx,%eax
  cmp    %rdi,%rsi
  jne    L3
L36:
  ret
L31:
  lea    -0x61(%rdx),%ecx
  cmp    $0x5,%cl
  ja     L1
  sub    $0x57,%edx
  movsbl %dl,%edx
  jmp    L16
  nopl   0x0(%rax)
L51:
  xor    %eax,%eax
  ret
L1:
  xor    %edx,%edx
  jmp    L16
```

assistant: ```c
int BTSHASP_ParseHexN(char *s, int n) {
  int i, j, k;
  k = 0;
  for (i = 0; i < n; i++) {
    j = 0;
    if ((*s >= '0') && (*s <= '9'))
      j = *s - '0';
    if ((*s >= 'A') && (*s <= 'F'))
      j = 10 + (*s - 'A');
    if ((*s >= 'a') && (*s <= 'f'))
      j = 10 + (*s - 'a');
    s++;
    k = (k << 4) | j;
  }
  return (k);
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<BTSHASP_ParseHexN>:
  endbr64
  test   %esi,%esi
  jle    L65
  movslq %esi,%rsi
  xor    %eax,%eax
  add    %rdi,%rsi
  jmp    L4
  nopw   0x0(%rax,%rax,1)
L79:
  movsbl %cl,%edx
L77:
  shl    $0x4,%eax
  add    $0x1,%rdi
  or     %edx,%eax
  cmp    %rdi,%rsi
  je     L60
L4:
  movzbl (%rdi),%edx
  lea    -0x30(%rdx),%ecx
  cmp    $0x9,%cl
  jbe    L79
  lea    -0x41(%rdx),%ecx
  cmp    $0x5,%cl
  ja     L49
  sub    $0x37,%edx
  shl    $0x4,%eax
  add    $0x1,%rdi
  movsbl %dl,%edx
  or     %edx,%eax
  cmp    %rdi,%rsi
  jne    L4
L60:
  ret
L49:
  lea    -0x61(%rdx),%ecx
  cmp    $0x5,%cl
  ja     L13
  sub    $0x57,%edx
  movsbl %dl,%edx
  jmp    L77
  nopl   0x0(%rax)
L65:
  xor    %eax,%eax
  ret
L13:
  xor    %edx,%edx
  jmp    L77
```

assistant: ```c
int BTSHASP_ParseHexN(char *s, int n) {
  int i, j, k;
  k = 0;
  for (i = 0; i < n; i++) {
    j = 0;
    if ((*s >= '0') && (*s <= '9'))
      j = *s - '0';
    if ((*s >= 'A') && (*s <= 'F'))
      j = 10 + (*s - 'A');
    if ((*s >= 'a') && (*s <= 'f'))
      j = 10 + (*s - 'a');
    s++;
    k = (k << 4) | j;
  }
  return (k);
}
```
user: Translate the below assembly code into C programming language:

```asm
<foo>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  cmpl   $0x0,-0x24(%rbp)
  je     L7
  lea    -0x12(%rbp),%rdx
  mov    -0x24(%rbp),%eax
  add    %rdx,%rax
  jmp    L13
L7:
  mov    $0x0,%eax
L13:
  mov    %rax,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L20
  call   <__stack_chk_fail@plt>
L20:
  leave
  ret
```

assistant: ```c
char volatile *__attribute__((no)) foo(unsigned i) {
  char volatile buffer[10];
  char volatile *k = i ? &buffer[i] : NULL;
  return k;
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<foo>:
  endbr64
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  test   %edi,%edi
  mov    %edi,%eax
  lea    0xe(%rsp,%rax,1),%rax
  mov    $0x0,%edx
  cmove  %rdx,%rax
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L0
  add    $0x28,%rsp
  ret
L0:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
char volatile *__attribute__((no)) foo(unsigned i) {
  char volatile buffer[10];
  char volatile *k = i ? &buffer[i] : NULL;
  return k;
}
```
user: Translate the below assembly code into C programming language:

```asm
<foo>:
  endbr64
  xor    %eax,%eax
  ret
```

assistant: ```c
char volatile *__attribute__((no)) foo(unsigned i) {
  char volatile buffer[10];
  char volatile *k = i ? &buffer[i] : NULL;
  return k;
}
```
user: 请从给定的汇编指令推导出C源代码：

```asm
<foo>:
  endbr64
  xor    %eax,%eax
  ret
```

assistant: ```c
char volatile *__attribute__((no)) foo(unsigned i) {
  char volatile buffer[10];
  char volatile *k = i ? &buffer[i] : NULL;
  return k;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<jbg_newlen>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    -0x18(%rbp),%rax
  add    $0x14,%rax
  mov    %rax,-0x8(%rbp)
  cmpq   $0x13,-0x20(%rbp)
  ja     L53
  mov    $0x2,%eax
  jmp    L8
L53:
  mov    -0x18(%rbp),%rax
  add    $0x13,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  and    $0x7,%eax
  cmp    $0x6,%eax
  jne    L117
  addq   $0x6c0,-0x8(%rbp)
L117:
  mov    -0x18(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  cmp    %rax,-0x8(%rbp)
  jb     L144
  mov    $0x2,%eax
  jmp    L8
L45:
  mov    -0x18(%rbp),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  cmp    %rax,-0x8(%rbp)
  jne    L131
  mov    $0x0,%eax
  jmp    L8
L131:
  mov    -0x8(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0xff,%al
  jne    L144
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  cmp    $0x4,%eax
  je     L73
  cmp    $0x5,%eax
  jne    L144
  movl   $0x0,-0xc(%rbp)
  jmp    L22
L106:
  mov    -0xc(%rbp),%eax
  add    $0x2,%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    -0xc(%rbp),%edx
  add    $0x8,%edx
  movslq %edx,%rcx
  mov    -0x18(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  addl   $0x1,-0xc(%rbp)
L22:
  cmpl   $0x3,-0xc(%rbp)
  jle    L106
  mov    $0x0,%eax
  jmp    L8
L73:
  mov    $0x4,%eax
  jmp    L8
L144:
  mov    -0x8(%rbp),%rax
  sub    -0x18(%rbp),%rax
  mov    %rax,%rcx
  mov    -0x20(%rbp),%rax
  sub    %rcx,%rax
  mov    %rax,%rdx
  mov    -0x8(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <jbg_next_pscdms@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L45
  mov    $0x7,%eax
L8:
  leave
  ret
```

assistant: ```c
int jbg_newlen(unsigned char *bie, size_t len) {
  unsigned char *p = bie + 20;
  int i;
  if (len < 20)
    return 2;
  if ((bie[19] & (0x04 | 0x02 | 0x01)) == (0x04 | 0x02))
    p += 1728;
  if (p >= bie + len)
    return 2;
  while ((p = jbg_next_pscdms(p, len - (p - bie)))) {
    if (p == bie + len)
      return 0;
    else if (p[0] == 0xff)
      switch (p[1]) {
      case 0x05:
        for (i = 0; i < 4; i++) {
          bie[8 + i] = p[2 + i];
        }
        return 0;
      case 0x04:
        return 4;
      }
  }
  return 7;
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<jbg_newlen>:
  endbr64
  mov    $0x2,%eax
  cmp    $0x13,%rsi
  jbe    L32
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  mov    %rsi,%rbp
  movzbl 0x13(%rdi),%eax
  and    $0x7,%eax
  lea    0x14(%rdi),%rdx
  lea    0x6d4(%rdi),%rdi
  cmp    $0x6,%al
  cmovne %rdx,%rdi
  lea    (%rbx,%rsi,1),%r12
  mov    $0x2,%eax
  cmp    %rdi,%r12
  jbe    L53
L63:
  mov    %rdi,%rax
  sub    %rbx,%rax
  mov    %rbp,%rsi
  sub    %rax,%rsi
  call   <jbg_next_pscdms@plt>
  mov    %rax,%rdi
  test   %rax,%rax
  je     L94
  cmp    %rdi,%r12
  je     L66
  cmpb   $0xff,(%rdi)
  jne    L63
  movzbl 0x1(%rdi),%eax
  cmp    $0x4,%al
  je     L68
  cmp    $0x5,%al
  jne    L63
  movzbl 0x2(%rdi),%eax
  mov    %al,0x8(%rbx)
  movzbl 0x3(%rdi),%eax
  mov    %al,0x9(%rbx)
  movzbl 0x4(%rdi),%eax
  mov    %al,0xa(%rbx)
  movzbl 0x5(%rdi),%eax
  mov    %al,0xb(%rbx)
  mov    $0x0,%eax
L53:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L94:
  mov    $0x7,%eax
  jmp    L53
L66:
  mov    $0x0,%eax
  jmp    L53
L68:
  mov    $0x4,%eax
  jmp    L53
L32:
  ret
```

assistant: ```c
int jbg_newlen(unsigned char *bie, size_t len) {
  unsigned char *p = bie + 20;
  int i;
  if (len < 20)
    return 2;
  if ((bie[19] & (0x04 | 0x02 | 0x01)) == (0x04 | 0x02))
    p += 1728;
  if (p >= bie + len)
    return 2;
  while ((p = jbg_next_pscdms(p, len - (p - bie)))) {
    if (p == bie + len)
      return 0;
    else if (p[0] == 0xff)
      switch (p[1]) {
      case 0x05:
        for (i = 0; i < 4; i++) {
          bie[8 + i] = p[2 + i];
        }
        return 0;
      case 0x04:
        return 4;
      }
  }
  return 7;
}
```
user: Translate the below assembly code into C programming language:

```asm
<jbg_newlen>:
  endbr64
  mov    $0x2,%r8d
  cmp    $0x13,%rsi
  jbe    L61
  push   %r12
  lea    0x14(%rdi),%rdx
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  movzbl 0x13(%rdi),%eax
  mov    %rdi,%rbx
  lea    0x6d4(%rdi),%rdi
  lea    (%rbx,%rsi,1),%r12
  and    $0x7,%eax
  cmp    $0x6,%al
  cmovne %rdx,%rdi
  cmp    %rdi,%r12
  jbe    L78
L39:
  mov    %rdi,%rax
  mov    %rbp,%rsi
  sub    %rbx,%rax
  sub    %rax,%rsi
  call   <jbg_next_pscdms@plt>
  mov    %rax,%rdi
  test   %rax,%rax
  je     L57
  cmp    %rdi,%r12
  je     L22
  cmpb   $0xff,(%rdi)
  jne    L39
  movzbl 0x1(%rdi),%eax
  cmp    $0x4,%al
  je     L45
  cmp    $0x5,%al
  jne    L39
  movzbl 0x2(%rdi),%eax
  mov    %al,0x8(%rbx)
  movzbl 0x3(%rdi),%eax
  mov    %al,0x9(%rbx)
  movzbl 0x4(%rdi),%eax
  mov    %al,0xa(%rbx)
  movzbl 0x5(%rdi),%eax
  mov    %al,0xb(%rbx)
L22:
  xor    %r8d,%r8d
L78:
  pop    %rbx
  mov    %r8d,%eax
  pop    %rbp
  pop    %r12
  ret
  nopl   (%rax)
L45:
  mov    $0x4,%r8d
  pop    %rbx
  pop    %rbp
  mov    %r8d,%eax
  pop    %r12
  ret
  cs nopw 0x0(%rax,%rax,1)
L61:
  mov    %r8d,%eax
  ret
  nopl   0x0(%rax)
L57:
  mov    $0x7,%r8d
  jmp    L78
```

assistant: ```c
int jbg_newlen(unsigned char *bie, size_t len) {
  unsigned char *p = bie + 20;
  int i;
  if (len < 20)
    return 2;
  if ((bie[19] & (0x04 | 0x02 | 0x01)) == (0x04 | 0x02))
    p += 1728;
  if (p >= bie + len)
    return 2;
  while ((p = jbg_next_pscdms(p, len - (p - bie)))) {
    if (p == bie + len)
      return 0;
    else if (p[0] == 0xff)
      switch (p[1]) {
      case 0x05:
        for (i = 0; i < 4; i++) {
          bie[8 + i] = p[2 + i];
        }
        return 0;
      case 0x04:
        return 4;
      }
  }
  return 7;
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<jbg_newlen>:
  endbr64
  mov    $0x2,%r8d
  cmp    $0x13,%rsi
  jbe    L46
  push   %r12
  lea    0x14(%rdi),%rdx
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  movzbl 0x13(%rdi),%eax
  mov    %rdi,%rbx
  lea    0x6d4(%rdi),%rdi
  lea    (%rbx,%rsi,1),%r12
  and    $0x7,%eax
  cmp    $0x6,%al
  cmovne %rdx,%rdi
  cmp    %rdi,%r12
  jbe    L36
L35:
  mov    %rdi,%rax
  mov    %rbp,%rsi
  sub    %rbx,%rax
  sub    %rax,%rsi
  call   <jbg_next_pscdms@plt>
  mov    %rax,%rdi
  test   %rax,%rax
  je     L73
  cmp    %rdi,%r12
  je     L60
  cmpb   $0xff,(%rdi)
  jne    L35
  movzbl 0x1(%rdi),%eax
  cmp    $0x4,%al
  je     L45
  cmp    $0x5,%al
  jne    L35
  movzbl 0x2(%rdi),%eax
  mov    %al,0x8(%rbx)
  movzbl 0x3(%rdi),%eax
  mov    %al,0x9(%rbx)
  movzbl 0x4(%rdi),%eax
  mov    %al,0xa(%rbx)
  movzbl 0x5(%rdi),%eax
  mov    %al,0xb(%rbx)
L60:
  xor    %r8d,%r8d
L36:
  pop    %rbx
  mov    %r8d,%eax
  pop    %rbp
  pop    %r12
  ret
  nopl   (%rax)
L45:
  mov    $0x4,%r8d
  pop    %rbx
  pop    %rbp
  mov    %r8d,%eax
  pop    %r12
  ret
  cs nopw 0x0(%rax,%rax,1)
L46:
  mov    %r8d,%eax
  ret
  nopl   0x0(%rax)
L73:
  mov    $0x7,%r8d
  jmp    L36
```

assistant: ```c
int jbg_newlen(unsigned char *bie, size_t len) {
  unsigned char *p = bie + 20;
  int i;
  if (len < 20)
    return 2;
  if ((bie[19] & (0x04 | 0x02 | 0x01)) == (0x04 | 0x02))
    p += 1728;
  if (p >= bie + len)
    return 2;
  while ((p = jbg_next_pscdms(p, len - (p - bie)))) {
    if (p == bie + len)
      return 0;
    else if (p[0] == 0xff)
      switch (p[1]) {
      case 0x05:
        for (i = 0; i < 4; i++) {
          bie[8 + i] = p[2 + i];
        }
        return 0;
      case 0x04:
        return 4;
      }
  }
  return 7;
}
```