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

```asm
<i2s_ASN1_INTEGER>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rsi,%rdi
  test   %rsi,%rsi
  je     L9
  mov    $0x0,%esi
  call   <ASN1_INTEGER_to_BN@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L21
  mov    %rax,%rdi
  call   <BN_bn2dec@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  jne    L11
L21:
  mov    D3(%rip),%rax
  mov    (%rax),%edi
  call   <X509V3error@plt>
  mov    $0x0,%ebx
L11:
  mov    %rbp,%rdi
  call   <BN_free@plt>
L31:
  mov    %rbx,%rax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  ret
L9:
  mov    %rsi,%rbx
  jmp    L31
```

assistant: ```c
char *i2s_ASN1_INTEGER(X509V3_EXT_METHOD *method, const ASN1_INTEGER *a) {
  BIGNUM *bntmp = NULL;
  char *strtmp = NULL;
  if (!a)
    return NULL;
  if (!(bntmp = ASN1_INTEGER_to_BN(a, NULL)) || !(strtmp = BN_bn2dec(bntmp)))
    X509V3error(ERR_R_MALLOC_FAILURE);
  BN_free(bntmp);
  return strtmp;
}
```
user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<i2s_ASN1_INTEGER>:
  endbr64
  push   %r12
  push   %rbp
  sub    $0x8,%rsp
  test   %rsi,%rsi
  je     L1
  mov    %rsi,%rdi
  xor    %esi,%esi
  call   <ASN1_INTEGER_to_BN@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L22
  mov    %rax,%rdi
  call   <BN_bn2dec@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L22
L19:
  mov    %rbp,%rdi
  call   <BN_free@plt>
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  ret
  nopl   (%rax)
L22:
  mov    D6(%rip),%rax
  xor    %r12d,%r12d
  mov    (%rax),%edi
  call   <X509V3error@plt>
  jmp    L19
  nopl   0x0(%rax,%rax,1)
L1:
  xor    %r12d,%r12d
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
char *i2s_ASN1_INTEGER(X509V3_EXT_METHOD *method, const ASN1_INTEGER *a) {
  BIGNUM *bntmp = NULL;
  char *strtmp = NULL;
  if (!a)
    return NULL;
  if (!(bntmp = ASN1_INTEGER_to_BN(a, NULL)) || !(strtmp = BN_bn2dec(bntmp)))
    X509V3error(ERR_R_MALLOC_FAILURE);
  BN_free(bntmp);
  return strtmp;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<i2s_ASN1_INTEGER>:
  endbr64
  push   %r12
  push   %rbp
  sub    $0x8,%rsp
  test   %rsi,%rsi
  je     L13
  mov    %rsi,%rdi
  xor    %esi,%esi
  call   <ASN1_INTEGER_to_BN@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L15
  mov    %rax,%rdi
  call   <BN_bn2dec@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L15
L22:
  mov    %rbp,%rdi
  call   <BN_free@plt>
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  ret
  nopl   (%rax)
L15:
  mov    D5(%rip),%rax
  xor    %r12d,%r12d
  mov    (%rax),%edi
  call   <X509V3error@plt>
  jmp    L22
  nopl   0x0(%rax,%rax,1)
L13:
  xor    %r12d,%r12d
  add    $0x8,%rsp
  mov    %r12,%rax
  pop    %rbp
  pop    %r12
  ret
```

assistant: ```c
char *i2s_ASN1_INTEGER(X509V3_EXT_METHOD *method, const ASN1_INTEGER *a) {
  BIGNUM *bntmp = NULL;
  char *strtmp = NULL;
  if (!a)
    return NULL;
  if (!(bntmp = ASN1_INTEGER_to_BN(a, NULL)) || !(strtmp = BN_bn2dec(bntmp)))
    X509V3error(ERR_R_MALLOC_FAILURE);
  BN_free(bntmp);
  return strtmp;
}
```
user: Translate the below assembly code into C programming language:

```asm
<sine>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x34(%rbp)
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x20(%rbp)
  pxor   %xmm0,%xmm0
  cvtsi2sdl -0x34(%rbp),%xmm0
  movsd  D9(%rip),%xmm2
  movapd %xmm0,%xmm1
  divsd  %xmm2,%xmm1
  movsd  D0(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,-0x8(%rbp)
  movsd  D12(%rip),%xmm0
  movsd  %xmm0,-0x18(%rbp)
  movsd  -0x8(%rbp),%xmm0
  movsd  %xmm0,-0x10(%rbp)
  movl   $0x1,-0x24(%rbp)
  movl   $0x1,-0x28(%rbp)
  jmp    L8
L15:
  cmpl   $0x1,-0x28(%rbp)
  jle    L20
  negl   -0x24(%rbp)
  pxor   %xmm0,%xmm0
  cvtsi2sdl -0x28(%rbp),%xmm0
  movapd %xmm0,%xmm1
  mulsd  -0x18(%rbp),%xmm1
  mov    -0x28(%rbp),%eax
  sub    $0x1,%eax
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,-0x18(%rbp)
  movsd  -0x8(%rbp),%xmm0
  mulsd  %xmm0,%xmm0
  movsd  -0x10(%rbp),%xmm1
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,-0x10(%rbp)
L20:
  pxor   %xmm0,%xmm0
  cvtsi2sdl -0x24(%rbp),%xmm0
  mulsd  -0x10(%rbp),%xmm0
  divsd  -0x18(%rbp),%xmm0
  movsd  -0x20(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x20(%rbp)
  addl   $0x2,-0x28(%rbp)
L8:
  cmpl   $0x27,-0x28(%rbp)
  jle    L15
  movsd  -0x20(%rbp),%xmm0
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  pop    %rbp
  ret
```

tool_calls: name: retrieve_data
arguments: tag: D9
type_infered: f64
name: retrieve_data
arguments: tag: D0
type_infered: f64
name: retrieve_data
arguments: tag: D12
type_infered: f64

tool: D9: 180

tool: D0: 3.141592

tool: D12: 1

assistant: ```c
double sine(int degree) {
  double solution = 0.0, radyan = (double)degree / 180 * 3.141592, fact = 1;
  double pow = radyan;
  int i, k = 1;
  for (i = 1; i < 40; i += 2) {
    if (i > 1) {
      k = k * -1;
      fact = fact * i * (i - 1);
      pow *= radyan * radyan;
    }
    solution += k * pow / fact;
  }
  return solution;
}
```
user: 这段汇编代码用C语言表示是什么样的：

```asm
<sine>:
  endbr64
  pxor   %xmm3,%xmm3
  cvtsi2sd %edi,%xmm3
  divsd  D15(%rip),%xmm3
  mulsd  D9(%rip),%xmm3
  movapd %xmm3,%xmm2
  mov    $0x1,%eax
  pxor   %xmm4,%xmm4
  mov    $0x1,%ecx
  movsd  D0(%rip),%xmm1
  jmp    L38
L11:
  mov    %edx,%eax
L38:
  pxor   %xmm0,%xmm0
  cvtsi2sd %ecx,%xmm0
  mulsd  %xmm2,%xmm0
  divsd  %xmm1,%xmm0
  addsd  %xmm0,%xmm4
  lea    0x2(%rax),%edx
  cmp    $0x27,%eax
  je     L8
  cmp    $0x1,%edx
  jle    L11
  neg    %ecx
  pxor   %xmm0,%xmm0
  cvtsi2sd %edx,%xmm0
  mulsd  %xmm0,%xmm1
  add    $0x1,%eax
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  mulsd  %xmm0,%xmm1
  movapd %xmm3,%xmm0
  mulsd  %xmm3,%xmm0
  mulsd  %xmm0,%xmm2
  jmp    L11
L8:
  movapd %xmm4,%xmm0
  ret
```

tool_calls: name: parse_data
arguments: data_tag: D15
data_type: f64
name: parse_data
arguments: data_tag: D9
data_type: f64
name: parse_data
arguments: data_tag: D0
data_type: f64

tool: D15: 180

tool: D9: 3.141592

tool: D0: 1

assistant: ```c
double sine(int degree) {
  double solution = 0.0, radyan = (double)degree / 180 * 3.141592, fact = 1;
  double pow = radyan;
  int i, k = 1;
  for (i = 1; i < 40; i += 2) {
    if (i > 1) {
      k = k * -1;
      fact = fact * i * (i - 1);
      pow *= radyan * radyan;
    }
    solution += k * pow / fact;
  }
  return solution;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<sine>:
  endbr64
  pxor   %xmm3,%xmm3
  mov    $0x1,%esi
  mov    $0x1,%eax
  movsd  D18(%rip),%xmm1
  cvtsi2sd %edi,%xmm3
  divsd  D14(%rip),%xmm3
  pxor   %xmm4,%xmm4
  mulsd  D29(%rip),%xmm3
  movapd %xmm3,%xmm5
  mulsd  %xmm3,%xmm5
  jmp    L34
  nopl   0x0(%rax)
L2:
  pxor   %xmm3,%xmm3
  cvtsi2sd %eax,%xmm3
  sub    $0x1,%eax
  mulsd  %xmm3,%xmm1
  pxor   %xmm3,%xmm3
  cvtsi2sd %eax,%xmm3
  mulsd  %xmm3,%xmm1
  divsd  %xmm1,%xmm0
  addsd  %xmm0,%xmm4
  cmp    $0x27,%ecx
  jg     L39
L9:
  mov    %edx,%esi
  mov    %ecx,%eax
  movapd %xmm2,%xmm3
L34:
  movapd %xmm3,%xmm2
  pxor   %xmm0,%xmm0
  lea    0x2(%rax),%ecx
  mov    %esi,%edx
  mulsd  %xmm5,%xmm2
  neg    %edx
  cvtsi2sd %edx,%xmm0
  mulsd  %xmm2,%xmm0
  cmp    $0x1,%eax
  jne    L2
  pxor   %xmm0,%xmm0
  mov    %esi,%edx
  movapd %xmm3,%xmm2
  cvtsi2sd %esi,%xmm0
  mulsd  %xmm3,%xmm0
  divsd  %xmm1,%xmm0
  addsd  %xmm0,%xmm4
  jmp    L9
  nopl   0x0(%rax)
L39:
  movapd %xmm4,%xmm0
  ret
```

tool_calls: name: read_data
arguments: data_tag: D18
datatype: f64
name: read_data
arguments: data_tag: D14
datatype: f64
name: read_data
arguments: data_tag: D29
datatype: f64

tool: D18: 1

tool: D14: 180

tool: D29: 3.141592

assistant: ```c
double sine(int degree) {
  double solution = 0.0, radyan = (double)degree / 180 * 3.141592, fact = 1;
  double pow = radyan;
  int i, k = 1;
  for (i = 1; i < 40; i += 2) {
    if (i > 1) {
      k = k * -1;
      fact = fact * i * (i - 1);
      pow *= radyan * radyan;
    }
    solution += k * pow / fact;
  }
  return solution;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<sine>:
  endbr64
  pxor   %xmm3,%xmm3
  mov    $0x1,%esi
  mov    $0x1,%eax
  movsd  D29(%rip),%xmm1
  cvtsi2sd %edi,%xmm3
  divsd  D24(%rip),%xmm3
  pxor   %xmm4,%xmm4
  mulsd  D13(%rip),%xmm3
  movapd %xmm3,%xmm5
  mulsd  %xmm3,%xmm5
  jmp    L13
  nopl   0x0(%rax)
L7:
  pxor   %xmm3,%xmm3
  cvtsi2sd %eax,%xmm3
  sub    $0x1,%eax
  mulsd  %xmm3,%xmm1
  pxor   %xmm3,%xmm3
  cvtsi2sd %eax,%xmm3
  mulsd  %xmm3,%xmm1
  divsd  %xmm1,%xmm0
  addsd  %xmm0,%xmm4
  cmp    $0x27,%ecx
  jg     L23
L0:
  mov    %edx,%esi
  mov    %ecx,%eax
  movapd %xmm2,%xmm3
L13:
  movapd %xmm3,%xmm2
  pxor   %xmm0,%xmm0
  lea    0x2(%rax),%ecx
  mov    %esi,%edx
  mulsd  %xmm5,%xmm2
  neg    %edx
  cvtsi2sd %edx,%xmm0
  mulsd  %xmm2,%xmm0
  cmp    $0x1,%eax
  jne    L7
  pxor   %xmm0,%xmm0
  mov    %esi,%edx
  movapd %xmm3,%xmm2
  cvtsi2sd %esi,%xmm0
  mulsd  %xmm3,%xmm0
  divsd  %xmm1,%xmm0
  addsd  %xmm0,%xmm4
  jmp    L0
  nopl   0x0(%rax)
L23:
  movapd %xmm4,%xmm0
  ret
```

tool_calls: name: unpack_data
arguments: tag: D29
datatype: f64
name: unpack_data
arguments: tag: D24
datatype: f64
name: unpack_data
arguments: tag: D13
datatype: f64

tool: D29: 1

tool: D24: 180

tool: D13: 3.141592

assistant: ```c
double sine(int degree) {
  double solution = 0.0, radyan = (double)degree / 180 * 3.141592, fact = 1;
  double pow = radyan;
  int i, k = 1;
  for (i = 1; i < 40; i += 2) {
    if (i > 1) {
      k = k * -1;
      fact = fact * i * (i - 1);
      pow *= radyan * radyan;
    }
    solution += k * pow / fact;
  }
  return solution;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<setHashBitset>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  mov    (%rax),%eax
  mov    %eax,-0x8(%rbp)
  movl   $0x2,-0x4(%rbp)
  jmp    L8
L10:
  mov    -0x4(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x8(%rbp),%eax
  shl    $0x6,%eax
  add    %eax,%edx
  mov    -0x8(%rbp),%eax
  shr    $0x2,%eax
  add    %edx,%eax
  sub    $0x61c88647,%eax
  xor    %eax,-0x8(%rbp)
  addl   $0x1,-0x4(%rbp)
L8:
  mov    -0x18(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x4(%rbp),%eax
  cmp    %eax,%edx
  jae    L10
  mov    -0x18(%rbp),%rax
  lea    0x4(%rax),%rdx
  mov    -0x8(%rbp),%eax
  mov    %eax,(%rdx)
  nop
  pop    %rbp
  ret
```

assistant: ```c
void setHashBitset(unsigned int *bitset) {
  unsigned int hash = bitset[0];
  for (int i = 2; i <= bitset[0]; i++) {
    hash ^= bitset[i] + 0x9e3779b9 + (hash << 6) + (hash >> 2);
  }
  bitset[1] = hash;
}
```
user: Translate the below assembly code into C programming language:

```asm
<setHashBitset>:
  endbr64
  mov    (%rdi),%eax
  cmp    $0x1,%eax
  jbe    L19
  lea    0x8(%rdi),%rdx
  lea    -0x2(%rax),%ecx
  lea    0xc(%rdi,%rcx,4),%r8
L1:
  mov    %eax,%esi
  shl    $0x6,%esi
  mov    %eax,%ecx
  shr    $0x2,%ecx
  lea    -0x61c88647(%rsi,%rcx,1),%ecx
  add    (%rdx),%ecx
  xor    %ecx,%eax
  add    $0x4,%rdx
  cmp    %r8,%rdx
  jne    L1
L19:
  mov    %eax,0x4(%rdi)
  ret
```

assistant: ```c
void setHashBitset(unsigned int *bitset) {
  unsigned int hash = bitset[0];
  for (int i = 2; i <= bitset[0]; i++) {
    hash ^= bitset[i] + 0x9e3779b9 + (hash << 6) + (hash >> 2);
  }
  bitset[1] = hash;
}
```
user: What is the c source code of the assembly code below:

```asm
<setHashBitset>:
  endbr64
  mov    (%rdi),%eax
  cmp    $0x1,%eax
  jbe    L1
  lea    -0x2(%rax),%ecx
  lea    0x8(%rdi),%rdx
  lea    0xc(%rdi,%rcx,4),%r8
  nopw   0x0(%rax,%rax,1)
L17:
  mov    %eax,%esi
  mov    %eax,%ecx
  add    $0x4,%rdx
  shl    $0x6,%esi
  shr    $0x2,%ecx
  lea    -0x61c88647(%rsi,%rcx,1),%ecx
  add    -0x4(%rdx),%ecx
  xor    %ecx,%eax
  cmp    %rdx,%r8
  jne    L17
L1:
  mov    %eax,0x4(%rdi)
  ret
```

assistant: ```c
void setHashBitset(unsigned int *bitset) {
  unsigned int hash = bitset[0];
  for (int i = 2; i <= bitset[0]; i++) {
    hash ^= bitset[i] + 0x9e3779b9 + (hash << 6) + (hash >> 2);
  }
  bitset[1] = hash;
}
```
user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<setHashBitset>:
  endbr64
  mov    (%rdi),%eax
  cmp    $0x1,%eax
  jbe    L13
  lea    -0x2(%rax),%ecx
  lea    0x8(%rdi),%rdx
  lea    0xc(%rdi,%rcx,4),%r8
  nopw   0x0(%rax,%rax,1)
L5:
  mov    %eax,%esi
  mov    %eax,%ecx
  add    $0x4,%rdx
  shl    $0x6,%esi
  shr    $0x2,%ecx
  lea    -0x61c88647(%rsi,%rcx,1),%ecx
  add    -0x4(%rdx),%ecx
  xor    %ecx,%eax
  cmp    %rdx,%r8
  jne    L5
L13:
  mov    %eax,0x4(%rdi)
  ret
```

assistant: ```c
void setHashBitset(unsigned int *bitset) {
  unsigned int hash = bitset[0];
  for (int i = 2; i <= bitset[0]; i++) {
    hash ^= bitset[i] + 0x9e3779b9 + (hash << 6) + (hash >> 2);
  }
  bitset[1] = hash;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<foo>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %edi,-0x14(%rbp)
  movl   $0x0,-0x4(%rbp)
  cmpl   $0x3,-0x14(%rbp)
  je     L35
  cmpl   $0x3,-0x14(%rbp)
  jg     L0
  cmpl   $0x2,-0x14(%rbp)
  je     L54
  cmpl   $0x2,-0x14(%rbp)
  jg     L0
  cmpl   $0x0,-0x14(%rbp)
  je     L82
  cmpl   $0x1,-0x14(%rbp)
  je     L63
  jmp    L0
L82:
  mov    $0x6f,%eax
  jmp    L87
L63:
  addl   $0x1,-0x4(%rbp)
L54:
  mov    -0x4(%rbp),%eax
  add    $0x3,%eax
  jmp    L87
L0:
  mov    $0xde,%eax
  jmp    L87
L35:
  nop
  mov    $0x14d,%eax
L87:
  pop    %rbp
  ret
```

assistant: ```c
int foo(int predicate) {
  int x = 0;
  switch (predicate) {
  case 0:
    return 111;
  case 1:
    x = x + 1;
  case 2:
    return (x + 3);
  case 3:
    break;
  default:
    return 222;
  }
  return 333;
}
```
user: Translate the below assembly code into C programming language:

```asm
<foo>:
  endbr64
  cmp    $0x2,%edi
  je     L3
  cmp    $0x2,%edi
  jg     L2
  mov    $0x6f,%eax
  test   %edi,%edi
  je     L12
  cmp    $0x1,%edi
  jne    L27
L31:
  lea    0x3(%rdi),%eax
L12:
  ret
L27:
  mov    $0xde,%eax
  ret
L2:
  cmp    $0x3,%edi
  mov    $0xde,%eax
  mov    $0x14d,%edx
  cmove  %edx,%eax
  ret
L3:
  mov    $0x0,%edi
  jmp    L31
```

assistant: ```c
int foo(int predicate) {
  int x = 0;
  switch (predicate) {
  case 0:
    return 111;
  case 1:
    x = x + 1;
  case 2:
    return (x + 3);
  case 3:
    break;
  default:
    return 222;
  }
  return 333;
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<foo>:
  endbr64
  cmp    $0x2,%edi
  je     L27
  jg     L19
  mov    $0x6f,%eax
  test   %edi,%edi
  je     L24
  cmp    $0x1,%edi
  mov    $0xde,%edx
  mov    $0x4,%eax
  cmovne %edx,%eax
  ret
  nopl   (%rax)
L19:
  cmp    $0x3,%edi
  mov    $0x14d,%edx
  mov    $0xde,%eax
  cmove  %edx,%eax
  ret
  nopl   0x0(%rax)
L27:
  mov    $0x3,%eax
L24:
  ret
```

assistant: ```c
int foo(int predicate) {
  int x = 0;
  switch (predicate) {
  case 0:
    return 111;
  case 1:
    x = x + 1;
  case 2:
    return (x + 3);
  case 3:
    break;
  default:
    return 222;
  }
  return 333;
}
```
user: 这段汇编代码用C语言表示是什么样的:

```asm
<foo>:
  endbr64
  cmp    $0x2,%edi
  je     L26
  jg     L18
  mov    $0x6f,%eax
  test   %edi,%edi
  je     L6
  cmp    $0x1,%edi
  mov    $0xde,%edx
  mov    $0x4,%eax
  cmovne %edx,%eax
  ret
  nopl   (%rax)
L18:
  cmp    $0x3,%edi
  mov    $0x14d,%edx
  mov    $0xde,%eax
  cmove  %edx,%eax
  ret
  nopl   0x0(%rax)
L26:
  mov    $0x3,%eax
L6:
  ret
```

assistant: ```c
int foo(int predicate) {
  int x = 0;
  switch (predicate) {
  case 0:
    return 111;
  case 1:
    x = x + 1;
  case 2:
    return (x + 3);
  case 3:
    break;
  default:
    return 222;
  }
  return 333;
}
```
user: What is the c source code of the assembly code below:

```asm
<get_unusual_el_valence>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %esi,-0x28(%rbp)
  mov    %edx,-0x2c(%rbp)
  mov    %ecx,-0x30(%rbp)
  mov    %r8d,-0x34(%rbp)
  mov    %r9d,-0x38(%rbp)
  cmpl   $0x0,-0x38(%rbp)
  jne    L143
  cmpl   $0x0,-0x34(%rbp)
  jne    L143
  mov    $0x0,%eax
  jmp    L66
L143:
  cmpl   $0xfffffffe,-0x28(%rbp)
  jl     L177
  cmpl   $0x2,-0x28(%rbp)
  jle    L139
L177:
  mov    -0x30(%rbp),%eax
  cmp    -0x38(%rbp),%eax
  jne    L109
  mov    $0x0,%eax
  jmp    L66
L109:
  mov    -0x30(%rbp),%eax
  jmp    L66
L139:
  mov    -0x28(%rbp),%ecx
  mov    -0x24(%rbp),%eax
  mov    $0x0,%edx
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <get_el_valence@plt>
  test   %eax,%eax
  jne    L67
  mov    -0x30(%rbp),%eax
  cmp    -0x38(%rbp),%eax
  jne    L67
  mov    $0x0,%eax
  jmp    L66
L67:
  mov    -0x30(%rbp),%edx
  mov    -0x34(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x8(%rbp)
  movl   $0x0,-0x10(%rbp)
  movl   $0x0,-0x14(%rbp)
  movl   $0x0,-0xc(%rbp)
  cmpl   $0x2,-0x2c(%rbp)
  jne    L161
  movl   $0x1,-0x10(%rbp)
  jmp    L28
L161:
  cmpl   $0x3,-0x2c(%rbp)
  jne    L28
  movl   $0x2,-0x10(%rbp)
L28:
  movl   $0x0,-0x18(%rbp)
  jmp    L181
L2:
  mov    -0x18(%rbp),%edx
  mov    -0x28(%rbp),%ecx
  mov    -0x24(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <get_el_valence@plt>
  sub    -0x10(%rbp),%eax
  mov    %eax,-0x4(%rbp)
  cmpl   $0x0,-0x4(%rbp)
  jle    L209
  mov    -0x38(%rbp),%eax
  cmp    -0x4(%rbp),%eax
  jg     L209
  mov    -0x4(%rbp),%eax
  cmp    -0x8(%rbp),%eax
  jg     L209
  addl   $0x1,-0x14(%rbp)
  mov    -0x4(%rbp),%eax
  cmp    -0x8(%rbp),%eax
  jne    L209
  movl   $0x1,-0xc(%rbp)
  jmp    L167
L209:
  addl   $0x1,-0x18(%rbp)
L181:
  cmpl   $0x4,-0x18(%rbp)
  jle    L2
L167:
  cmpl   $0x0,-0xc(%rbp)
  je     L157
  cmpl   $0x1,-0x14(%rbp)
  je     L194
L157:
  mov    -0x8(%rbp),%eax
  jmp    L66
L194:
  mov    $0x0,%eax
L66:
  leave
  ret
```

assistant: ```c
int get_unusual_el_valence(int nPeriodicNum, int charge, int radical, int bonds_valence, int num_H, int num_bonds) {
  int i, num_found, chem_valence, rad_adj, known_chem_valence, exact_found;
  if (!num_bonds && !num_H)
    return 0;
  if (charge < (-2) || charge > 2) {
    if (bonds_valence == num_bonds)
      return 0;
    return bonds_valence;
  }
  if (!get_el_valence(nPeriodicNum, charge, 0) && bonds_valence == num_bonds)
    return 0;
  chem_valence = bonds_valence + num_H;
  rad_adj = 0;
  num_found = 0;
  exact_found = 0;
  if (radical == 2)
    rad_adj = 1;
  else if (radical == 3)
    rad_adj = 2;
  for (i = 0; i < 5; i++) {
    if (0 < (known_chem_valence = get_el_valence(nPeriodicNum, charge, i) - rad_adj) && num_bonds <= known_chem_valence && known_chem_valence <= chem_valence) {
      num_found++;
      if (known_chem_valence == chem_valence) {
        exact_found = 1;
        break;
      }
    }
  }
  return (exact_found && 1 == num_found) ? 0 : chem_valence;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<get_unusual_el_valence>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %r8d,0xc(%rsp)
  or     %r9d,%r8d
  mov    %r8d,%r12d
  je     L53
  mov    %edi,%r14d
  mov    %esi,%ebp
  mov    %edx,%r15d
  mov    %ecx,%r13d
  mov    %r9d,%ebx
  lea    0x2(%rsi),%eax
  cmp    $0x4,%eax
  jbe    L112
  cmp    %ecx,%r9d
  mov    $0x0,%r12d
  cmovne %ecx,%r12d
L53:
  mov    %r12d,%eax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L112:
  mov    $0x0,%edx
  call   <get_el_valence@plt>
  cmp    %r13d,%ebx
  jne    L70
  test   %eax,%eax
  je     L51
L70:
  mov    0xc(%rsp),%r12d
  add    %r13d,%r12d
  movl   $0x1,0xc(%rsp)
  cmp    $0x2,%r15d
  je     L69
  cmp    $0x3,%r15d
  sete   %al
  movzbl %al,%eax
  add    %eax,%eax
  mov    %eax,0xc(%rsp)
L69:
  mov    $0x0,%r15d
  mov    $0x0,%r13d
  jmp    L77
L97:
  add    $0x1,%r13d
  cmp    $0x5,%r13d
  je     L53
L77:
  mov    %r13d,%edx
  mov    %ebp,%esi
  mov    %r14d,%edi
  call   <get_el_valence@plt>
  sub    0xc(%rsp),%eax
  test   %eax,%eax
  jle    L97
  cmp    %eax,%ebx
  jg     L97
  cmp    %eax,%r12d
  jl     L97
  add    $0x1,%r15d
  cmp    %eax,%r12d
  jne    L97
  cmp    $0x1,%r15d
  mov    $0x0,%eax
  cmove  %eax,%r12d
  jmp    L53
L51:
  mov    $0x0,%r12d
  jmp    L53
```

assistant: ```c
int get_unusual_el_valence(int nPeriodicNum, int charge, int radical, int bonds_valence, int num_H, int num_bonds) {
  int i, num_found, chem_valence, rad_adj, known_chem_valence, exact_found;
  if (!num_bonds && !num_H)
    return 0;
  if (charge < (-2) || charge > 2) {
    if (bonds_valence == num_bonds)
      return 0;
    return bonds_valence;
  }
  if (!get_el_valence(nPeriodicNum, charge, 0) && bonds_valence == num_bonds)
    return 0;
  chem_valence = bonds_valence + num_H;
  rad_adj = 0;
  num_found = 0;
  exact_found = 0;
  if (radical == 2)
    rad_adj = 1;
  else if (radical == 3)
    rad_adj = 2;
  for (i = 0; i < 5; i++) {
    if (0 < (known_chem_valence = get_el_valence(nPeriodicNum, charge, i) - rad_adj) && num_bonds <= known_chem_valence && known_chem_valence <= chem_valence) {
      num_found++;
      if (known_chem_valence == chem_valence) {
        exact_found = 1;
        break;
      }
    }
  }
  return (exact_found && 1 == num_found) ? 0 : chem_valence;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<get_unusual_el_valence>:
  endbr64
  push   %r15
  mov    %r9d,%eax
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  or     %r8d,%eax
  je     L128
  lea    0x2(%rsi),%eax
  mov    %esi,%ebx
  mov    %ecx,%r12d
  cmp    $0x4,%eax
  jbe    L53
  cmp    %ecx,%r9d
  jne    L60
L128:
  xor    %r12d,%r12d
L60:
  add    $0x18,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L53:
  mov    %edx,%r13d
  xor    %edx,%edx
  mov    %r9d,0xc(%rsp)
  mov    %edi,%r14d
  mov    %r8d,%ebp
  call   <get_el_valence@plt>
  mov    0xc(%rsp),%r9d
  cmp    %r12d,%r9d
  jne    L81
  test   %eax,%eax
  je     L128
L81:
  add    %ebp,%r12d
  mov    $0x1,%ebp
  cmp    $0x2,%r13d
  je     L7
  xor    %ebp,%ebp
  cmp    $0x3,%r13d
  sete   %bpl
  add    %ebp,%ebp
L7:
  xor    %r13d,%r13d
  xor    %r15d,%r15d
L39:
  mov    %r15d,%edx
  mov    %ebx,%esi
  mov    %r14d,%edi
  mov    %r9d,0xc(%rsp)
  call   <get_el_valence@plt>
  mov    0xc(%rsp),%r9d
  sub    %ebp,%eax
  test   %eax,%eax
  jle    L63
  cmp    %eax,%r9d
  jg     L63
  cmp    %eax,%r12d
  jl     L63
  add    $0x1,%r13d
  cmp    %eax,%r12d
  je     L48
L63:
  add    $0x1,%r15d
  cmp    $0x5,%r15d
  jne    L39
  jmp    L60
  nopw   0x0(%rax,%rax,1)
L48:
  cmp    $0x1,%r13d
  je     L128
  jmp    L60
```

assistant: ```c
int get_unusual_el_valence(int nPeriodicNum, int charge, int radical, int bonds_valence, int num_H, int num_bonds) {
  int i, num_found, chem_valence, rad_adj, known_chem_valence, exact_found;
  if (!num_bonds && !num_H)
    return 0;
  if (charge < (-2) || charge > 2) {
    if (bonds_valence == num_bonds)
      return 0;
    return bonds_valence;
  }
  if (!get_el_valence(nPeriodicNum, charge, 0) && bonds_valence == num_bonds)
    return 0;
  chem_valence = bonds_valence + num_H;
  rad_adj = 0;
  num_found = 0;
  exact_found = 0;
  if (radical == 2)
    rad_adj = 1;
  else if (radical == 3)
    rad_adj = 2;
  for (i = 0; i < 5; i++) {
    if (0 < (known_chem_valence = get_el_valence(nPeriodicNum, charge, i) - rad_adj) && num_bonds <= known_chem_valence && known_chem_valence <= chem_valence) {
      num_found++;
      if (known_chem_valence == chem_valence) {
        exact_found = 1;
        break;
      }
    }
  }
  return (exact_found && 1 == num_found) ? 0 : chem_valence;
}
```