user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<bp_tx_verify>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  cmp    $0x3b,%rsi
  jbe    L170
  mov    %rsp,%rbp
  mov    %rsi,%r14
  mov    %rdx,%r13
  mov    %rsi,%rdx
  mov    %rbp,%rsi
  movq   $0x4,(%rsp)
  mov    %rdi,%rbx
  call   <bp_readvarint@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L170
  mov    (%rsp),%rax
  mov    $0x0,%r15d
  jg     L156
  jmp    L11
  nopl   0x0(%rax)
L159:
  add    $0x24,%rax
  mov    %r14,%rdx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  mov    %rax,(%rsp)
  call   <bp_readvarint@plt>
  mov    (%rsp),%rdx
  mov    %r14,%rsi
  lea    0x4(%rax),%rcx
  sub    %rdx,%rsi
  cmp    %rcx,%rsi
  jb     L170
  cmp    $0x2710,%rax
  jg     L170
  lea    0x4(%rdx,%rax,1),%rax
  add    $0x1,%r15
  mov    %rax,(%rsp)
  cmp    %r15,%r12
  je     L11
L156:
  mov    %r14,%rdx
  sub    %rax,%rdx
  cmp    $0x24,%rdx
  ja     L159
L170:
  mov    $0xffffffff,%eax
L176:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L35
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nop
L11:
  mov    %r14,%rdx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <bp_readvarint@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L170
  mov    (%rsp),%rax
  jle    L84
  xor    %r15d,%r15d
  jmp    L173
  nopl   0x0(%rax)
L4:
  add    $0x8,%rax
  mov    %r14,%rdx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  mov    %rax,(%rsp)
  add    $0x1,%r15
  call   <bp_readvarint@plt>
  add    (%rsp),%rax
  mov    %rax,(%rsp)
  cmp    %r15,%r12
  je     L84
L173:
  mov    %r14,%rdx
  sub    %rax,%rdx
  cmp    $0x8,%rdx
  ja     L4
  jmp    L170
L84:
  add    $0x4,%rax
  test   %r13,%r13
  je     L120
  mov    %rax,0x0(%r13)
  xor    %eax,%eax
  jmp    L176
L120:
  cmp    %r14,%rax
  setne  %al
  movzbl %al,%eax
  neg    %eax
  jmp    L176
L35:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int bp_tx_verify(char *tx, size_t tx_len, size_t *store_length) {
  if (tx_len < 60)
    return -1;
  int version = *(unsigned int *)tx;
  (void)(version);
  size_t position = 4;
  ev_uint64_t tx_in_c = bp_readvarint((unsigned char *)tx, &position, tx_len);
  if (tx_in_c == 0)
    return -1;
  for (int i = 0; i < tx_in_c; i++) {
    if (tx_len - position < 37)
      return -1;
    char *hash = tx + position;
    ev_uint32_t index = *(ev_uint32_t *)(tx + position + 32);
    position += 36;
    ev_uint64_t script_len = bp_readvarint((unsigned char *)tx, &position, tx_len);
    if (tx_len - position < script_len + 4)
      return -1;
    if (script_len > 10000)
      return -1;
    position += script_len;
    ev_uint32_t seq = *(ev_uint32_t *)(tx + position);
    position += 4;
    (void)(seq);
    (void)(index);
    (void)(hash);
  }
  ev_uint64_t tx_out_c = bp_readvarint((unsigned char *)tx, &position, tx_len);
  if (tx_out_c == 0)
    return -1;
  for (int i = 0; i < tx_out_c; i++) {
    if (tx_len - position < 9)
      return -1;
    ev_uint64_t value = *(ev_uint64_t *)(tx + position);
    position += 8;
    ev_uint64_t script_len = bp_readvarint((unsigned char *)tx, &position, tx_len);
    position += script_len;
    (void)(value);
  }
  position += 4;
  if (!store_length) {
    if (tx_len - position != 0)
      return -1;
  } else {
    *store_length = position;
  }
  return 0;
}
```