user: 请从给定的汇编指令推导出C源代码:

```asm
<couponposoffer>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x10,%rsp
  mov    0x40(%rsp),%r14
  mov    0x48(%rsp),%r13
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  sub    %edx,%esi
  cmp    %ecx,%esi
  jl     L84
  mov    %rdi,%r12
  mov    %r9,%rbp
  mov    %esi,%ebx
  test   %esi,%esi
  setne  %al
  lea    -0x15(%rsi),%ecx
  cmp    $0xf,%ecx
  jbe    L22
  test   %al,%al
  je     L22
  movl   $0x4,(%r9)
  mov    $0x0,%eax
  jmp    L84
L22:
  cmpl   $0x0,0x50(%rsp)
  jne    L5
  test   %al,%al
  jne    L119
L5:
  mov    $0x1,%eax
L84:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L63
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L119:
  movslq %edx,%rdx
  add    %r12,%rdx
  sub    $0x8,%rsp
  push   %r13
  push   %r14
  push   %rbp
  lea    0x24(%rsp),%r9
  mov    $0x1,%r8d
  lea    D11(%rip),%rcx
  mov    %ebx,%esi
  mov    %r12,%rdi
  call   <coupon_val@plt>
  mov    %rax,%rdx
  add    $0x20,%rsp
  test   %rax,%rax
  je     L92
  cmpl   $0x1,0x4(%rsp)
  ja     L89
  sub    $0x8,%rsp
  push   %r13
  push   %r14
  push   %rbp
  push   $0x0
  push   $0x6
  mov    $0x0,%r9d
  mov    $0x6,%r8d
  lea    D25(%rip),%rcx
  mov    %ebx,%esi
  mov    %r12,%rdi
  call   <coupon_vli@plt>
  mov    %rax,%rdx
  add    $0x30,%rsp
  test   %rax,%rax
  je     L92
  sub    $0x8,%rsp
  push   %r13
  push   %r14
  push   %rbp
  mov    $0x0,%r9d
  mov    $0x6,%r8d
  lea    D42(%rip),%rcx
  mov    %ebx,%esi
  mov    %r12,%rdi
  call   <coupon_val@plt>
  mov    %rax,%rdx
  add    $0x20,%rsp
  test   %rax,%rax
  je     L92
  sub    $0x8,%rsp
  push   %r13
  push   %r14
  push   %rbp
  push   $0x0
  push   $0x9
  mov    $0x0,%r9d
  mov    $0x6,%r8d
  lea    D22(%rip),%rcx
  mov    %ebx,%esi
  mov    %r12,%rdi
  call   <coupon_vli@plt>
  add    $0x30,%rsp
  test   %rax,%rax
  je     L92
  sub    %r12,%rax
  mov    %rax,%rdx
  movslq %ebx,%rbx
  mov    $0x1,%eax
  cmp    %rbx,%rdx
  je     L84
  movl   $0x3,0x0(%rbp)
  lea    0x1(%rdx),%eax
  mov    %eax,(%r14)
  lea    D48(%rip),%rsi
  mov    %r13,%rdi
  call   <strcpy@plt>
  jmp    L92
L89:
  movl   $0x3,0x0(%rbp)
  sub    %r12d,%edx
  mov    %edx,(%r14)
  lea    D14(%rip),%rsi
  mov    %r13,%rdi
  call   <strcpy@plt>
L92:
  mov    $0x0,%eax
  jmp    L84
L63:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: label: D11
type: string
name: retrieve_data
arguments: label: D25
type: string
name: retrieve_data
arguments: label: D42
type: string
name: retrieve_data
arguments: label: D22
type: string
name: retrieve_data
arguments: label: D48
type: string
name: retrieve_data
arguments: label: D14
type: string

tool: D11: Coupon Format

tool: D25: Coupon Funder ID

tool: D42: Offer Code

tool: D22: Serial Number

tool: D48: Reserved trailing characters

tool: D14: 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;
}
```