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

```asm
<couponposoffer>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %esi,%ebx
  sub    %edx,%ebx
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  mov    0x40(%rsp),%r13
  mov    0x48(%rsp),%r12
  cmp    %ecx,%ebx
  jl     L127
  test   %ebx,%ebx
  lea    -0x15(%rbx),%esi
  mov    %rdi,%r14
  mov    %r9,%rbp
  setne  %cl
  cmp    $0xf,%esi
  jbe    L106
  test   %cl,%cl
  je     L106
  movl   $0x4,(%r9)
L127:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L133
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax)
L106:
  mov    0x50(%rsp),%eax
  test   %eax,%eax
  jne    L21
  test   %cl,%cl
  jne    L28
L21:
  mov    $0x1,%eax
  jmp    L127
  nopl   0x0(%rax,%rax,1)
L28:
  sub    $0x8,%rsp
  movslq %edx,%rdx
  mov    $0x1,%r8d
  mov    %ebx,%esi
  push   %r12
  add    %r14,%rdx
  lea    D17(%rip),%rcx
  mov    %r14,%rdi
  push   %r13
  push   %rbp
  lea    0x24(%rsp),%r9
  call   <coupon_val@plt>
  add    $0x20,%rsp
  mov    %rax,%rdx
  test   %rax,%rax
  je     L26
  cmpl   $0x1,0x4(%rsp)
  ja     L132
  sub    $0x8,%rsp
  xor    %r9d,%r9d
  mov    $0x6,%r8d
  mov    %ebx,%esi
  push   %r12
  lea    D35(%rip),%rcx
  mov    %r14,%rdi
  push   %r13
  push   %rbp
  push   $0x0
  push   $0x6
  call   <coupon_vli@plt>
  add    $0x30,%rsp
  mov    %rax,%rdx
  test   %rax,%rax
  je     L26
  sub    $0x8,%rsp
  xor    %r9d,%r9d
  mov    $0x6,%r8d
  mov    %ebx,%esi
  push   %r12
  lea    D45(%rip),%rcx
  mov    %r14,%rdi
  push   %r13
  push   %rbp
  call   <coupon_val@plt>
  add    $0x20,%rsp
  mov    %rax,%rdx
  test   %rax,%rax
  je     L26
  sub    $0x8,%rsp
  xor    %r9d,%r9d
  mov    $0x6,%r8d
  mov    %ebx,%esi
  push   %r12
  lea    D36(%rip),%rcx
  mov    %r14,%rdi
  push   %r13
  push   %rbp
  push   $0x0
  push   $0x9
  call   <coupon_vli@plt>
  add    $0x30,%rsp
  test   %rax,%rax
  je     L26
  sub    %r14,%rax
  movslq %ebx,%rbx
  mov    %rax,%rdx
  mov    $0x1,%eax
  cmp    %rbx,%rdx
  je     L127
  lea    0x1(%rdx),%eax
  movl   $0x3,0x0(%rbp)
  lea    D40(%rip),%rsi
  mov    %r12,%rdi
  mov    %eax,0x0(%r13)
  call   <strcpy@plt>
L26:
  xor    %eax,%eax
  jmp    L127
  nopw   0x0(%rax,%rax,1)
L132:
  sub    %r14d,%edx
  movl   $0x3,0x0(%rbp)
  lea    D30(%rip),%rsi
  mov    %r12,%rdi
  mov    %edx,0x0(%r13)
  call   <strcpy@plt>
  xor    %eax,%eax
  jmp    L127
L133:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_tag: D17
type: string
name: unpack_data
arguments: data_tag: D35
type: string
name: unpack_data
arguments: data_tag: D45
type: string
name: unpack_data
arguments: data_tag: D36
type: string
name: unpack_data
arguments: data_tag: D40
type: string
name: unpack_data
arguments: data_tag: D30
type: string

tool: D17: Coupon Format

tool: D35: Coupon Funder ID

tool: D45: Offer Code

tool: D36: Serial Number

tool: D40: Reserved trailing characters

tool: D30: Coupon Format must be 0 or 1

assistant: ```c
int couponposoffer(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, int *p_err_posn, char err_msg[50], const int length_only) {
  const int min_len = 1 + 1 + 6 + 6 + 1 + 6;
  const int max_len = 36;
  (void)max;
  data_len -= offset;
  if (data_len < min) {
    return 0;
  }
  if (data_len && (data_len < min_len || data_len > max_len)) {
    *p_err_no = 4;
    return 0;
  }
  if (!length_only && data_len) {
    const unsigned char *d = data + offset;
    int val;
    d = coupon_val(data, data_len, d, "Coupon Format", 1, &val, p_err_no, p_err_posn, err_msg);
    if (d == NULL) {
      return 0;
    }
    if (val != 0 && val != 1) {
      *p_err_no = 3;
      *p_err_posn = d - 1 - data + 1;
      strcpy(err_msg, "Coupon Format must be 0 or 1");
      return 0;
    }
    d = coupon_vli(data, data_len, d, "Coupon Funder ID", 6, 0, 6, 0, p_err_no, p_err_posn, err_msg);
    if (d == NULL) {
      return 0;
    }
    d = coupon_val(data, data_len, d, "Offer Code", 6, NULL, p_err_no, p_err_posn, err_msg);
    if (d == NULL) {
      return 0;
    }
    d = coupon_vli(data, data_len, d, "Serial Number", 6, 0, 9, 0, p_err_no, p_err_posn, err_msg);
    if (d == NULL) {
      return 0;
    }
    if (d - data != data_len) {
      *p_err_no = 3;
      *p_err_posn = d - data + 1;
      strcpy(err_msg, "Reserved trailing characters");
      return 0;
    }
  }
  return 1;
}
```