user: 下面的汇编指令对应的C源代码是什么:

```asm
<couponcode>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %esi,%ebx
  mov    %ecx,%esi
  mov    0x60(%rsp),%r13
  mov    0x68(%rsp),%r12
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  mov    %ebx,%eax
  sub    %edx,%eax
  mov    $0x0,%ecx
  cmp    %esi,%eax
  jl     L514
  mov    %rdi,%r15
  mov    %r9,%rbp
  test   %eax,%eax
  setne  %cl
  cmp    $0x14,%eax
  jg     L104
  test   %cl,%cl
  je     L104
  movl   $0x4,(%r9)
  mov    $0x0,%ecx
  jmp    L514
L104:
  cmpl   $0x0,0x70(%rsp)
  jne    L118
  test   %cl,%cl
  jne    L324
L118:
  mov    $0x1,%ecx
L514:
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L240
  mov    %ecx,%eax
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L324:
  movslq %edx,%rdx
  add    %r15,%rdx
  sub    $0x8,%rsp
  push   %r12
  push   %r13
  push   %rbp
  push   $0x0
  push   $0x6
  mov    $0x0,%r9d
  mov    $0x6,%r8d
  lea    D287(%rip),%rcx
  mov    %ebx,%esi
  mov    %r15,%rdi
  call   <coupon_vli@plt>
  mov    %rax,%rdx
  add    $0x30,%rsp
  test   %rax,%rax
  je     L490
  sub    $0x8,%rsp
  push   %r12
  push   %r13
  push   %rbp
  mov    $0x0,%r9d
  mov    $0x6,%r8d
  lea    D156(%rip),%rcx
  mov    %ebx,%esi
  mov    %r15,%rdi
  call   <coupon_val@plt>
  mov    %rax,%rdx
  add    $0x20,%rsp
  test   %rax,%rax
  je     L490
  sub    $0x8,%rsp
  push   %r12
  push   %r13
  push   %rbp
  push   $0x0
  push   $0x5
  mov    $0x1,%r9d
  mov    $0x0,%r8d
  lea    D177(%rip),%rcx
  mov    %ebx,%esi
  mov    %r15,%rdi
  call   <coupon_vli@plt>
  mov    %rax,%rdx
  add    $0x30,%rsp
  test   %rax,%rax
  je     L490
  sub    $0x8,%rsp
  push   %r12
  push   %r13
  push   %rbp
  push   $0x0
  push   $0x5
  mov    $0x1,%r9d
  mov    $0x0,%r8d
  lea    D87(%rip),%rcx
  mov    %ebx,%esi
  mov    %r15,%rdi
  call   <coupon_vli@plt>
  mov    %rax,%rdx
  add    $0x30,%rsp
  test   %rax,%rax
  je     L490
  sub    $0x8,%rsp
  push   %r12
  push   %r13
  push   %rbp
  lea    0x34(%rsp),%r9
  mov    $0x1,%r8d
  lea    D2(%rip),%rcx
  mov    %ebx,%esi
  mov    %r15,%rdi
  call   <coupon_val@plt>
  mov    %rax,%rdx
  add    $0x20,%rsp
  test   %rax,%rax
  je     L490
  mov    0x14(%rsp),%eax
  sub    $0x6,%eax
  cmp    $0x2,%eax
  jbe    L138
  sub    $0x8,%rsp
  push   %r12
  push   %r13
  push   %rbp
  mov    $0x0,%r9d
  mov    $0x3,%r8d
  lea    D3(%rip),%rcx
  mov    %ebx,%esi
  mov    %r15,%rdi
  call   <coupon_val@plt>
  mov    %rax,%r14
  add    $0x20,%rsp
  test   %rax,%rax
  je     L490
  sub    %r15,%rax
  mov    %rax,(%rsp)
  movslq %ebx,%rdi
  mov    %rdi,0x8(%rsp)
  cmp    %rdi,%rax
  jl     L173
L551:
  mov    $0x1,%ecx
  jmp    L514
L138:
  movl   $0x3,0x0(%rbp)
  mov    %edx,%eax
  sub    %r15d,%eax
  mov    %eax,0x0(%r13)
  movzbl -0x1(%rdx),%edx
  lea    D226(%rip),%rsi
  mov    %r12,%rdi
  call   <sprintf@plt>
L490:
  mov    $0x0,%ecx
  jmp    L514
L23:
  sub    $0x8,%rsp
  push   %r12
  push   %r13
  push   %rbp
  lea    0x34(%rsp),%r9
  mov    $0x1,%r8d
  lea    D308(%rip),%rcx
  mov    %rsi,%rdx
  mov    %ebx,%esi
  mov    %r15,%rdi
  call   <coupon_val@plt>
  mov    %rax,%rdx
  add    $0x20,%rsp
  test   %rax,%rax
  je     L490
  cmpl   $0x3,0x14(%rsp)
  jg     L529
  sub    $0x8,%rsp
  push   %r12
  push   %r13
  push   %rbp
  push   $0x0
  push   $0x5
  mov    $0x1,%r9d
  mov    $0x0,%r8d
  lea    D278(%rip),%rcx
  mov    %ebx,%esi
  mov    %r15,%rdi
  call   <coupon_vli@plt>
  mov    %rax,%rdx
  add    $0x30,%rsp
  test   %rax,%rax
  je     L490
  sub    $0x8,%rsp
  push   %r12
  push   %r13
  push   %rbp
  lea    0x34(%rsp),%r9
  mov    $0x1,%r8d
  lea    D52(%rip),%rcx
  mov    %ebx,%esi
  mov    %r15,%rdi
  call   <coupon_val@plt>
  mov    %rax,%rdx
  add    $0x20,%rsp
  test   %rax,%rax
  je     L490
  mov    0x14(%rsp),%eax
  sub    $0x5,%eax
  cmp    $0x3,%eax
  jbe    L103
  sub    $0x8,%rsp
  push   %r12
  push   %r13
  push   %rbp
  mov    $0x0,%r9d
  mov    $0x3,%r8d
  lea    D228(%rip),%rcx
  mov    %ebx,%esi
  mov    %r15,%rdi
  call   <coupon_val@plt>
  mov    %rax,%rdx
  add    $0x20,%rsp
  test   %rax,%rax
  je     L490
  sub    $0x8,%rsp
  push   %r12
  push   %r13
  push   %rbp
  push   $0x1
  push   $0x6
  mov    $0x0,%r9d
  mov    $0x6,%r8d
  lea    D315(%rip),%rcx
  mov    %ebx,%esi
  mov    %r15,%rdi
  call   <coupon_vli@plt>
  mov    %rax,%r14
  add    $0x30,%rsp
  test   %rax,%rax
  je     L490
L365:
  mov    %r14,%rax
  sub    %r15,%rax
  mov    %rax,(%rsp)
  cmp    0x8(%rsp),%rax
  jge    L551
L173:
  mov    $0x1,%esi
  mov    %r14,%rdi
  call   <to_int@plt>
  lea    0x1(%r14),%rsi
  cmp    $0x1,%eax
  je     L23
  cmp    $0x9,%eax
  ja     L545
  mov    %eax,%edx
  lea    D160(%rip),%rdi
  movslq (%rdi,%rdx,4),%rdx
  add    %rdi,%rdx
  notrack jmp *%rdx
L529:
  movl   $0x3,0x0(%rbp)
  sub    %r15d,%eax
  mov    %eax,0x0(%r13)
  movzbl -0x1(%rdx),%edx
  lea    D14(%rip),%rsi
  mov    %r12,%rdi
  call   <sprintf@plt>
  jmp    L490
L103:
  movl   $0x3,0x0(%rbp)
  mov    %edx,%eax
  sub    %r15d,%eax
  mov    %eax,0x0(%r13)
  movzbl -0x1(%rdx),%edx
  lea    D39(%rip),%rsi
  mov    %r12,%rdi
  call   <sprintf@plt>
  jmp    L490
  sub    $0x8,%rsp
  push   %r12
  push   %r13
  push   %rbp
  push   $0x0
  push   $0x5
  mov    $0x1,%r9d
  mov    $0x0,%r8d
  lea    D273(%rip),%rcx
  mov    %rsi,%rdx
  mov    %ebx,%esi
  mov    %r15,%rdi
  call   <coupon_vli@plt>
  mov    %rax,%rdx
  add    $0x30,%rsp
  test   %rax,%rax
  je     L490
  sub    $0x8,%rsp
  push   %r12
  push   %r13
  push   %rbp
  lea    0x34(%rsp),%r9
  mov    $0x1,%r8d
  lea    D55(%rip),%rcx
  mov    %ebx,%esi
  mov    %r15,%rdi
  call   <coupon_val@plt>
  mov    %rax,%rdx
  add    $0x20,%rsp
  test   %rax,%rax
  je     L490
  mov    0x14(%rsp),%eax
  sub    $0x5,%eax
  cmp    $0x3,%eax
  jbe    L188
  sub    $0x8,%rsp
  push   %r12
  push   %r13
  push   %rbp
  mov    $0x0,%r9d
  mov    $0x3,%r8d
  lea    D286(%rip),%rcx
  mov    %ebx,%esi
  mov    %r15,%rdi
  call   <coupon_val@plt>
  mov    %rax,%rdx
  add    $0x20,%rsp
  test   %rax,%rax
  je     L490
  sub    $0x8,%rsp
  push   %r12
  push   %r13
  push   %rbp
  push   $0x1
  push   $0x6
  mov    $0x0,%r9d
  mov    $0x6,%r8d
  lea    D211(%rip),%rcx
  mov    %ebx,%esi
  mov    %r15,%rdi
  call   <coupon_vli@plt>
  mov    %rax,%r14
  add    $0x30,%rsp
  test   %rax,%rax
  jne    L365
  jmp    L490
L188:
  movl   $0x3,0x0(%rbp)
  mov    %edx,%eax
  sub    %r15d,%eax
  mov    %eax,0x0(%r13)
  movzbl -0x1(%rdx),%edx
  lea    D179(%rip),%rsi
  mov    %r12,%rdi
  call   <sprintf@plt>
  jmp    L490
  sub    $0x8,%rsp
  push   %r12
  push   %r13
  push   %rbp
  mov    $0x0,%r9d
  mov    $0x6,%r8d
  lea    D272(%rip),%rcx
  mov    %rsi,%rdx
  mov    %ebx,%esi
  mov    %r15,%rdi
  call   <coupon_val@plt>
  mov    %rax,%r14
  add    $0x20,%rsp
  test   %rax,%rax
  je     L490
  lea    -0x6(%rax),%rdx
  sub    $0x8,%rsp
  push   $0x0
  push   %r12
  push   %r13
  mov    %rbp,%r9
  mov    $0x6,%r8d
  mov    $0x6,%ecx
  sub    %r15d,%edx
  mov    %ebx,%esi
  mov    %r15,%rdi
  call   <yymmd0@plt>
  add    $0x20,%rsp
  test   %eax,%eax
  jne    L365
  jmp    L490
  sub    $0x8,%rsp
  push   %r12
  push   %r13
  push   %rbp
  mov    $0x0,%r9d
  mov    $0x6,%r8d
  lea    D19(%rip),%rcx
  mov    %rsi,%rdx
  mov    %ebx,%esi
  mov    %r15,%rdi
  call   <coupon_val@plt>
  mov    %rax,%r14
  add    $0x20,%rsp
  test   %rax,%rax
  je     L490
  lea    -0x6(%rax),%rdx
  sub    $0x8,%rsp
  push   $0x0
  push   %r12
  push   %r13
  mov    %rbp,%r9
  mov    $0x6,%r8d
  mov    $0x6,%ecx
  sub    %r15d,%edx
  mov    %ebx,%esi
  mov    %r15,%rdi
  call   <yymmd0@plt>
  add    $0x20,%rsp
  test   %eax,%eax
  jne    L365
  jmp    L490
  sub    $0x8,%rsp
  push   %r12
  push   %r13
  push   %rbp
  push   $0x0
  push   $0x9
  mov    $0x0,%r9d
  mov    $0x6,%r8d
  lea    D140(%rip),%rcx
  mov    %rsi,%rdx
  mov    %ebx,%esi
  mov    %r15,%rdi
  call   <coupon_vli@plt>
  mov    %rax,%r14
  add    $0x30,%rsp
  test   %rax,%rax
  jne    L365
  jmp    L490
  sub    $0x8,%rsp
  push   %r12
  push   %r13
  push   %rbp
  push   $0x0
  push   $0x7
  mov    $0x1,%r9d
  mov    $0x6,%r8d
  lea    D136(%rip),%rcx
  mov    %rsi,%rdx
  mov    %ebx,%esi
  mov    %r15,%rdi
  call   <coupon_vli@plt>
  mov    %rax,%r14
  add    $0x30,%rsp
  test   %rax,%rax
  jne    L365
  jmp    L490
  sub    $0x8,%rsp
  push   %r12
  push   %r13
  push   %rbp
  lea    0x34(%rsp),%r9
  mov    $0x1,%r8d
  lea    D213(%rip),%rcx
  mov    %rsi,%rdx
  mov    %ebx,%esi
  mov    %r15,%rdi
  call   <coupon_val@plt>
  mov    %rax,%rdx
  add    $0x20,%rsp
  test   %rax,%rax
  je     L490
  mov    0x14(%rsp),%eax
  lea    -0x3(%rax),%ecx
  cmp    $0x1,%ecx
  jbe    L359
  cmp    $0x6,%eax
  jg     L359
  sub    $0x8,%rsp
  push   %r12
  push   %r13
  push   %rbp
  lea    0x34(%rsp),%r9
  mov    $0x1,%r8d
  lea    D183(%rip),%rcx
  mov    %ebx,%esi
  mov    %r15,%rdi
  call   <coupon_val@plt>
  mov    %rax,%rdx
  add    $0x20,%rsp
  test   %rax,%rax
  je     L490
  cmpl   $0x2,0x14(%rsp)
  jg     L501
  sub    $0x8,%rsp
  push   %r12
  push   %r13
  push   %rbp
  mov    $0x0,%r9d
  mov    $0x1,%r8d
  lea    D65(%rip),%rcx
  mov    %ebx,%esi
  mov    %r15,%rdi
  call   <coupon_val@plt>
  mov    %rax,%rdx
  add    $0x20,%rsp
  test   %rax,%rax
  je     L490
  sub    $0x8,%rsp
  push   %r12
  push   %r13
  push   %rbp
  lea    0x34(%rsp),%r9
  mov    $0x1,%r8d
  lea    D126(%rip),%rcx
  mov    %ebx,%esi
  mov    %r15,%rdi
  call   <coupon_val@plt>
  mov    %rax,%r14
  add    $0x20,%rsp
  test   %rax,%rax
  je     L490
  cmpl   $0x1,0x14(%rsp)
  jle    L365
  movl   $0x3,0x0(%rbp)
  sub    %r15d,%eax
  mov    %eax,0x0(%r13)
  movzbl -0x1(%r14),%edx
  lea    D96(%rip),%rsi
  mov    %r12,%rdi
  call   <sprintf@plt>
  jmp    L490
L359:
  movl   $0x3,0x0(%rbp)
  mov    %edx,%eax
  sub    %r15d,%eax
  mov    %eax,0x0(%r13)
  movzbl -0x1(%rdx),%edx
  lea    D33(%rip),%rsi
  mov    %r12,%rdi
  call   <sprintf@plt>
  jmp    L490
L501:
  movl   $0x3,0x0(%rbp)
  sub    %r15d,%eax
  mov    %eax,0x0(%r13)
  movzbl -0x1(%rdx),%edx
  lea    D162(%rip),%rsi
  mov    %r12,%rdi
  call   <sprintf@plt>
  jmp    L490
L545:
  movl   $0x3,0x0(%rbp)
  mov    (%rsp),%r15d
  add    $0x1,%r15d
  mov    %r15d,0x0(%r13)
  movzbl (%r14),%edx
  test   %eax,%eax
  lea    D205(%rip),%rsi
  lea    D16(%rip),%rax
  cmovns %rax,%rsi
  mov    %r12,%rdi
  call   <sprintf@plt>
  jmp    L490
L240:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D287
datatype: string
name: extract_symbolic_data
arguments: data_tag: D156
datatype: string
name: extract_symbolic_data
arguments: data_tag: D177
datatype: string
name: extract_symbolic_data
arguments: data_tag: D87
datatype: string
name: extract_symbolic_data
arguments: data_tag: D2
datatype: string
name: extract_symbolic_data
arguments: data_tag: D3
datatype: string
name: extract_symbolic_data
arguments: data_tag: D226
datatype: string
name: extract_symbolic_data
arguments: data_tag: D308
datatype: string
name: extract_symbolic_data
arguments: data_tag: D278
datatype: string
name: extract_symbolic_data
arguments: data_tag: D52
datatype: string
name: extract_symbolic_data
arguments: data_tag: D228
datatype: string
name: extract_symbolic_data
arguments: data_tag: D315
datatype: string
name: extract_symbolic_data
arguments: data_tag: D14
datatype: string
name: extract_symbolic_data
arguments: data_tag: D39
datatype: string
name: extract_symbolic_data
arguments: data_tag: D273
datatype: string
name: extract_symbolic_data
arguments: data_tag: D55
datatype: string
name: extract_symbolic_data
arguments: data_tag: D286
datatype: string
name: extract_symbolic_data
arguments: data_tag: D211
datatype: string
name: extract_symbolic_data
arguments: data_tag: D179
datatype: string
name: extract_symbolic_data
arguments: data_tag: D272
datatype: string
name: extract_symbolic_data
arguments: data_tag: D19
datatype: string
name: extract_symbolic_data
arguments: data_tag: D140
datatype: string
name: extract_symbolic_data
arguments: data_tag: D136
datatype: string
name: extract_symbolic_data
arguments: data_tag: D213
datatype: string
name: extract_symbolic_data
arguments: data_tag: D183
datatype: string
name: extract_symbolic_data
arguments: data_tag: D65
datatype: string
name: extract_symbolic_data
arguments: data_tag: D126
datatype: string
name: extract_symbolic_data
arguments: data_tag: D96
datatype: string
name: extract_symbolic_data
arguments: data_tag: D33
datatype: string
name: extract_symbolic_data
arguments: data_tag: D162
datatype: string
name: extract_symbolic_data
arguments: data_tag: D205
datatype: string
name: extract_symbolic_data
arguments: data_tag: D16
datatype: string

tool: D287: Primary GS1 Co. Prefix

tool: D156: Offer Code

tool: D177: Save Value

tool: D87: Primary Purch. Req.

tool: D2: Primary Purch. Req. Code

tool: D3: Primary Purch. Family Code

tool: D226: Invalid Primary Purch. Req. Code '%c'

tool: D308: Add. Purch. Rules Code

tool: D278: 2nd Purch. Req.

tool: D52: 2nd Purch. Req. Code

tool: D228: 2nd Purch. Family Code

tool: D315: 2nd Purch. GS1 Co. Prefix

tool: D14: Invalid Add. Purch. Rules Code '%c'

tool: D39: Invalid 2nd Purch. Req. Code '%c'

tool: D273: 3rd Purch. Req.

tool: D55: 3rd Purch. Req. Code

tool: D286: 3rd Purch. Family Code

tool: D211: 3rd Purch. GS1 Co. Prefix

tool: D179: Invalid 3rd Purch. Req. Code '%c'

tool: D272: Expiration Date

tool: D19: Start Date

tool: D140: Serial Number

tool: D136: Retailer ID

tool: D213: Save Value Code

tool: D183: Save Value Applies To

tool: D65: Store Coupon Flag

tool: D126: Don't Multiply Flag

tool: D96: Invalid Don't Multiply Flag '%c'

tool: D33: Invalid Save Value Code '%c'

tool: D162: Invalid Save Value Applies To '%c'

tool: D205: Non-numeric Data Field '%c'

tool: D16: Invalid Data Field '%c'

assistant: ```c
int couponcode(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_req_len = 1 + 6 + 6 + 1 + 1 + 1 + 1 + 1 + 3;
  (void)max;
  data_len -= offset;
  if (data_len < min) {
    return 0;
  }
  if (data_len && data_len < min_req_len) {
    *p_err_no = 4;
    return 0;
  }
  if (!length_only && data_len) {
    const unsigned char *d = data + offset;
    int val;
    data_len += offset;
    d = coupon_vli(data, data_len, d, "Primary GS1 Co. Prefix", 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, "Save Value", 0, 1, 5, 0, p_err_no, p_err_posn, err_msg);
    if (d == NULL) {
      return 0;
    }
    d = coupon_vli(data, data_len, d, "Primary Purch. Req.", 0, 1, 5, 0, p_err_no, p_err_posn, err_msg);
    if (d == NULL) {
      return 0;
    }
    d = coupon_val(data, data_len, d, "Primary Purch. Req. Code", 1, &val, p_err_no, p_err_posn, err_msg);
    if (d == NULL) {
      return 0;
    }
    if (val > 5 && val < 9) {
      *p_err_no = 3;
      *p_err_posn = d - 1 - data + 1;
      sprintf(err_msg, "Invalid Primary Purch. Req. Code '%c'", *(d - 1));
      return 0;
    }
    d = coupon_val(data, data_len, d, "Primary Purch. Family Code", 3, NULL, p_err_no, p_err_posn, err_msg);
    if (d == NULL) {
      return 0;
    }
    while (d - data < data_len) {
      int data_field = to_int(d, 1);
      d++;
      if (data_field == 1) {
        d = coupon_val(data, data_len, d, "Add. Purch. Rules Code", 1, &val, p_err_no, p_err_posn, err_msg);
        if (d == NULL) {
          return 0;
        }
        if (val > 3) {
          *p_err_no = 3;
          *p_err_posn = d - 1 - data + 1;
          sprintf(err_msg, "Invalid Add. Purch. Rules Code '%c'", *(d - 1));
          return 0;
        }
        d = coupon_vli(data, data_len, d, "2nd Purch. Req.", 0, 1, 5, 0, p_err_no, p_err_posn, err_msg);
        if (d == NULL) {
          return 0;
        }
        d = coupon_val(data, data_len, d, "2nd Purch. Req. Code", 1, &val, p_err_no, p_err_posn, err_msg);
        if (d == NULL) {
          return 0;
        }
        if (val > 4 && val < 9) {
          *p_err_no = 3;
          *p_err_posn = d - 1 - data + 1;
          sprintf(err_msg, "Invalid 2nd Purch. Req. Code '%c'", *(d - 1));
          return 0;
        }
        d = coupon_val(data, data_len, d, "2nd Purch. Family Code", 3, NULL, p_err_no, p_err_posn, err_msg);
        if (d == NULL) {
          return 0;
        }
        d = coupon_vli(data, data_len, d, "2nd Purch. GS1 Co. Prefix", 6, 0, 6, 1, p_err_no, p_err_posn, err_msg);
        if (d == NULL) {
          return 0;
        }
      } else if (data_field == 2) {
        d = coupon_vli(data, data_len, d, "3rd Purch. Req.", 0, 1, 5, 0, p_err_no, p_err_posn, err_msg);
        if (d == NULL) {
          return 0;
        }
        d = coupon_val(data, data_len, d, "3rd Purch. Req. Code", 1, &val, p_err_no, p_err_posn, err_msg);
        if (d == NULL) {
          return 0;
        }
        if (val > 4 && val < 9) {
          *p_err_no = 3;
          *p_err_posn = d - 1 - data + 1;
          sprintf(err_msg, "Invalid 3rd Purch. Req. Code '%c'", *(d - 1));
          return 0;
        }
        d = coupon_val(data, data_len, d, "3rd Purch. Family Code", 3, NULL, p_err_no, p_err_posn, err_msg);
        if (d == NULL) {
          return 0;
        }
        d = coupon_vli(data, data_len, d, "3rd Purch. GS1 Co. Prefix", 6, 0, 6, 1, p_err_no, p_err_posn, err_msg);
        if (d == NULL) {
          return 0;
        }
      } else if (data_field == 3) {
        d = coupon_val(data, data_len, d, "Expiration Date", 6, NULL, p_err_no, p_err_posn, err_msg);
        if (d == NULL) {
          return 0;
        }
        if (!yymmd0(data, data_len, d - 6 - data, 6, 6, p_err_no, p_err_posn, err_msg, 0)) {
          return 0;
        }
      } else if (data_field == 4) {
        d = coupon_val(data, data_len, d, "Start Date", 6, NULL, p_err_no, p_err_posn, err_msg);
        if (d == NULL) {
          return 0;
        }
        if (!yymmd0(data, data_len, d - 6 - data, 6, 6, p_err_no, p_err_posn, err_msg, 0)) {
          return 0;
        }
      } else if (data_field == 5) {
        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;
        }
      } else if (data_field == 6) {
        d = coupon_vli(data, data_len, d, "Retailer ID", 6, 1, 7, 0, p_err_no, p_err_posn, err_msg);
        if (d == NULL) {
          return 0;
        }
      } else if (data_field == 9) {
        d = coupon_val(data, data_len, d, "Save Value Code", 1, &val, p_err_no, p_err_posn, err_msg);
        if (d == NULL) {
          return 0;
        }
        if ((val > 2 && val < 5) || val > 6) {
          *p_err_no = 3;
          *p_err_posn = d - 1 - data + 1;
          sprintf(err_msg, "Invalid Save Value Code '%c'", *(d - 1));
          return 0;
        }
        d = coupon_val(data, data_len, d, "Save Value Applies To", 1, &val, p_err_no, p_err_posn, err_msg);
        if (d == NULL) {
          return 0;
        }
        if (val > 2) {
          *p_err_no = 3;
          *p_err_posn = d - 1 - data + 1;
          sprintf(err_msg, "Invalid Save Value Applies To '%c'", *(d - 1));
          return 0;
        }
        d = coupon_val(data, data_len, d, "Store Coupon Flag", 1, NULL, p_err_no, p_err_posn, err_msg);
        if (d == NULL) {
          return 0;
        }
        d = coupon_val(data, data_len, d, "Don't Multiply Flag", 1, &val, p_err_no, p_err_posn, err_msg);
        if (d == NULL) {
          return 0;
        }
        if (val > 1) {
          *p_err_no = 3;
          *p_err_posn = d - 1 - data + 1;
          sprintf(err_msg, "Invalid Don't Multiply Flag '%c'", *(d - 1));
          return 0;
        }
      } else {
        *p_err_no = 3;
        *p_err_posn = d - 1 - data + 1;
        sprintf(err_msg, data_field < 0 ? "Non-numeric Data Field '%c'" : "Invalid Data Field '%c'", *(d - 1));
        return 0;
      }
    }
  }
  return 1;
}
```