user: Demonstrate the C code that generates the assembly output below:

```asm
<couponcode>:
  endbr64
  push   %r15
  xor    %r8d,%r8d
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  mov    %esi,%eax
  mov    0x70(%rsp),%r15
  mov    0x78(%rsp),%r13
  sub    %edx,%eax
  cmp    %ecx,%eax
  jl     L444
  test   %eax,%eax
  mov    %rdi,%r12
  mov    %esi,%ebx
  mov    %r9,%rbp
  setne  %cl
  cmp    $0x14,%eax
  jg     L359
  test   %cl,%cl
  je     L359
  movl   $0x4,(%r9)
L444:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L199
  add    $0x38,%rsp
  mov    %r8d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L359:
  mov    0x80(%rsp),%eax
  test   %eax,%eax
  jne    L157
  test   %cl,%cl
  jne    L128
L157:
  mov    $0x1,%r8d
  jmp    L444
  nopw   0x0(%rax,%rax,1)
L128:
  sub    $0x8,%rsp
  movslq %edx,%rdx
  xor    %r9d,%r9d
  mov    $0x6,%r8d
  push   %r13
  add    %r12,%rdx
  lea    D97(%rip),%rcx
  mov    %ebx,%esi
  push   %r15
  mov    %r12,%rdi
  push   %rbp
  push   $0x0
  push   $0x6
  call   <coupon_vli@plt>
  add    $0x30,%rsp
  mov    %rax,%rdx
  test   %rax,%rax
  je     L269
  sub    $0x8,%rsp
  xor    %r9d,%r9d
  mov    $0x6,%r8d
  mov    %ebx,%esi
  push   %r13
  lea    D181(%rip),%rcx
  mov    %r12,%rdi
  push   %r15
  push   %rbp
  call   <coupon_val@plt>
  add    $0x20,%rsp
  mov    %rax,%rdx
  test   %rax,%rax
  je     L269
  sub    $0x8,%rsp
  mov    $0x1,%r9d
  xor    %r8d,%r8d
  mov    %ebx,%esi
  push   %r13
  lea    D108(%rip),%rcx
  mov    %r12,%rdi
  push   %r15
  push   %rbp
  push   $0x0
  push   $0x5
  call   <coupon_vli@plt>
  add    $0x30,%rsp
  mov    %rax,%rdx
  test   %rax,%rax
  je     L269
  sub    $0x8,%rsp
  mov    $0x1,%r9d
  xor    %r8d,%r8d
  mov    %ebx,%esi
  push   %r13
  lea    D105(%rip),%rcx
  mov    %r12,%rdi
  push   %r15
  push   %rbp
  push   $0x0
  push   $0x5
  call   <coupon_vli@plt>
  add    $0x30,%rsp
  mov    %rax,%rdx
  test   %rax,%rax
  je     L269
  lea    0x24(%rsp),%rax
  sub    $0x8,%rsp
  mov    %ebx,%esi
  mov    %r12,%rdi
  mov    %rax,0x10(%rsp)
  mov    %rax,%r9
  mov    $0x1,%r8d
  lea    D86(%rip),%rcx
  push   %r13
  push   %r15
  push   %rbp
  call   <coupon_val@plt>
  add    $0x20,%rsp
  mov    %rax,%rdx
  test   %rax,%rax
  je     L269
  mov    0x24(%rsp),%eax
  sub    $0x6,%eax
  cmp    $0x2,%eax
  jbe    L29
  sub    $0x8,%rsp
  xor    %r9d,%r9d
  mov    $0x3,%r8d
  mov    %ebx,%esi
  push   %r13
  lea    D329(%rip),%rcx
  mov    %r12,%rdi
  push   %r15
  push   %rbp
  call   <coupon_val@plt>
  add    $0x20,%rsp
  mov    %rax,%r14
  test   %rax,%rax
  je     L269
  sub    %r12,%rax
  movslq %ebx,%rsi
  mov    %rax,0x10(%rsp)
  mov    %rsi,0x18(%rsp)
  cmp    %rsi,%rax
  jge    L157
  nop
L50:
  mov    $0x1,%esi
  mov    %r14,%rdi
  call   <to_int@plt>
  lea    0x1(%r14),%r11
  cmp    $0x1,%eax
  je     L500
  cmp    $0x9,%eax
  ja     L206
  lea    D183(%rip),%rdi
  mov    %eax,%edx
  movslq (%rdi,%rdx,4),%rdx
  add    %rdi,%rdx
  notrack jmp *%rdx
L29:
  mov    %edx,%eax
  movl   $0x3,0x0(%rbp)
  lea    D208(%rip),%rsi
  mov    %r13,%rdi
  sub    %r12d,%eax
  mov    %eax,(%r15)
  movzbl -0x1(%rdx),%edx
  call   <sprintf@plt>
  nopl   0x0(%rax,%rax,1)
L269:
  xor    %r8d,%r8d
  jmp    L444
  sub    $0x8,%rsp
  mov    %r11,%rdx
  mov    $0x1,%r8d
  mov    %ebx,%esi
  push   %r13
  lea    D71(%rip),%rcx
  mov    %r12,%rdi
  push   %r15
  push   %rbp
  mov    0x28(%rsp),%r9
  call   <coupon_val@plt>
  add    $0x20,%rsp
  mov    %rax,%rdx
  test   %rax,%rax
  je     L269
  mov    0x24(%rsp),%eax
  lea    -0x3(%rax),%ecx
  cmp    $0x1,%ecx
  jbe    L233
  cmp    $0x6,%eax
  jg     L233
  sub    $0x8,%rsp
  mov    $0x1,%r8d
  mov    %ebx,%esi
  mov    %r12,%rdi
  push   %r13
  lea    D75(%rip),%rcx
  push   %r15
  push   %rbp
  mov    0x28(%rsp),%r9
  call   <coupon_val@plt>
  add    $0x20,%rsp
  mov    %rax,%rdx
  test   %rax,%rax
  je     L269
  cmpl   $0x2,0x24(%rsp)
  jg     L92
  sub    $0x8,%rsp
  xor    %r9d,%r9d
  mov    $0x1,%r8d
  mov    %ebx,%esi
  push   %r13
  lea    D136(%rip),%rcx
  mov    %r12,%rdi
  push   %r15
  push   %rbp
  call   <coupon_val@plt>
  add    $0x20,%rsp
  mov    %rax,%rdx
  test   %rax,%rax
  je     L269
  sub    $0x8,%rsp
  mov    $0x1,%r8d
  mov    %ebx,%esi
  mov    %r12,%rdi
  push   %r13
  lea    D275(%rip),%rcx
  push   %r15
  push   %rbp
  mov    0x28(%rsp),%r9
  call   <coupon_val@plt>
  add    $0x20,%rsp
  mov    %rax,%r14
  test   %rax,%rax
  je     L269
  cmpl   $0x1,0x24(%rsp)
  jg     L228
  nopl   0x0(%rax,%rax,1)
L229:
  mov    %r14,%rax
  sub    %r12,%rax
  mov    %rax,0x10(%rsp)
  cmp    %rax,0x18(%rsp)
  jg     L50
  jmp    L157
  sub    $0x8,%rsp
  mov    $0x1,%r9d
  mov    $0x6,%r8d
  push   %r13
  lea    D222(%rip),%rcx
  push   %r15
  push   %rbp
  push   $0x0
  push   $0x7
L458:
  mov    %r11,%rdx
L440:
  mov    %ebx,%esi
  mov    %r12,%rdi
  call   <coupon_vli@plt>
  add    $0x30,%rsp
  mov    %rax,%r14
  test   %rax,%rax
  jne    L229
  jmp    L269
  nopl   0x0(%rax)
  sub    $0x8,%rsp
  xor    %r9d,%r9d
  mov    $0x6,%r8d
  push   %r13
  lea    D140(%rip),%rcx
  push   %r15
  push   %rbp
  push   $0x0
  push   $0x9
  jmp    L458
  sub    $0x8,%rsp
  xor    %r9d,%r9d
  mov    $0x6,%r8d
  push   %r13
  lea    D16(%rip),%rcx
  push   %r15
  push   %rbp
L224:
  mov    %r11,%rdx
  mov    %ebx,%esi
  mov    %r12,%rdi
  call   <coupon_val@plt>
  add    $0x20,%rsp
  mov    %rax,%r14
  test   %rax,%rax
  je     L269
  sub    $0x8,%rsp
  lea    -0x6(%rax),%rdx
  mov    %rbp,%r9
  mov    $0x6,%ecx
  push   $0x0
  mov    $0x6,%r8d
  sub    %r12d,%edx
  mov    %ebx,%esi
  push   %r13
  mov    %r12,%rdi
  push   %r15
  call   <yymmd0@plt>
  add    $0x20,%rsp
  test   %eax,%eax
  jne    L229
  jmp    L269
  nop
  sub    $0x8,%rsp
  xor    %r9d,%r9d
  mov    $0x6,%r8d
  push   %r13
  lea    D282(%rip),%rcx
  push   %r15
  push   %rbp
  jmp    L224
  sub    $0x8,%rsp
  mov    %r11,%rdx
  mov    $0x1,%r9d
  xor    %r8d,%r8d
  push   %r13
  lea    D194(%rip),%rcx
  mov    %ebx,%esi
  mov    %r12,%rdi
  push   %r15
  push   %rbp
  push   $0x0
  push   $0x5
  call   <coupon_vli@plt>
  add    $0x30,%rsp
  mov    %rax,%rdx
  test   %rax,%rax
  je     L269
  sub    $0x8,%rsp
  mov    $0x1,%r8d
  mov    %ebx,%esi
  mov    %r12,%rdi
  push   %r13
  lea    D190(%rip),%rcx
  push   %r15
  push   %rbp
  mov    0x28(%rsp),%r9
  call   <coupon_val@plt>
  add    $0x20,%rsp
  mov    %rax,%rdx
  test   %rax,%rax
  je     L269
  mov    0x24(%rsp),%eax
  sub    $0x5,%eax
  cmp    $0x3,%eax
  jbe    L196
  sub    $0x8,%rsp
  xor    %r9d,%r9d
  mov    $0x3,%r8d
  mov    %ebx,%esi
  push   %r13
  lea    D202(%rip),%rcx
  mov    %r12,%rdi
  push   %r15
  push   %rbp
  call   <coupon_val@plt>
  add    $0x20,%rsp
  mov    %rax,%rdx
  test   %rax,%rax
  je     L269
  sub    $0x8,%rsp
  xor    %r9d,%r9d
  mov    $0x6,%r8d
  push   %r13
  lea    D4(%rip),%rcx
  push   %r15
  push   %rbp
  push   $0x1
  push   $0x6
  jmp    L440
  nop
L206:
  mov    0x10(%rsp),%edx
  movl   $0x3,0x0(%rbp)
  lea    D206(%rip),%rsi
  mov    %r13,%rdi
  add    $0x1,%edx
  test   %eax,%eax
  lea    D209(%rip),%rax
  mov    %edx,(%r15)
  cmovns %rax,%rsi
  movzbl (%r14),%edx
  call   <sprintf@plt>
  jmp    L269
  cs nopw 0x0(%rax,%rax,1)
L500:
  sub    $0x8,%rsp
  mov    %r11,%rdx
  mov    $0x1,%r8d
  mov    %ebx,%esi
  push   %r13
  lea    D18(%rip),%rcx
  mov    %r12,%rdi
  push   %r15
  push   %rbp
  mov    0x28(%rsp),%r9
  call   <coupon_val@plt>
  add    $0x20,%rsp
  mov    %rax,%rdx
  test   %rax,%rax
  je     L269
  cmpl   $0x3,0x24(%rsp)
  jg     L419
  sub    $0x8,%rsp
  mov    $0x1,%r9d
  xor    %r8d,%r8d
  mov    %ebx,%esi
  push   %r13
  lea    D298(%rip),%rcx
  mov    %r12,%rdi
  push   %r15
  push   %rbp
  push   $0x0
  push   $0x5
  call   <coupon_vli@plt>
  add    $0x30,%rsp
  mov    %rax,%rdx
  test   %rax,%rax
  je     L269
  sub    $0x8,%rsp
  mov    $0x1,%r8d
  mov    %ebx,%esi
  mov    %r12,%rdi
  push   %r13
  lea    D211(%rip),%rcx
  push   %r15
  push   %rbp
  mov    0x28(%rsp),%r9
  call   <coupon_val@plt>
  add    $0x20,%rsp
  mov    %rax,%rdx
  test   %rax,%rax
  je     L269
  mov    0x24(%rsp),%eax
  sub    $0x5,%eax
  cmp    $0x3,%eax
  jbe    L418
  sub    $0x8,%rsp
  xor    %r9d,%r9d
  mov    $0x3,%r8d
  mov    %ebx,%esi
  push   %r13
  lea    D122(%rip),%rcx
  mov    %r12,%rdi
  push   %r15
  push   %rbp
  call   <coupon_val@plt>
  add    $0x20,%rsp
  mov    %rax,%rdx
  test   %rax,%rax
  je     L269
  sub    $0x8,%rsp
  xor    %r9d,%r9d
  mov    $0x6,%r8d
  push   %r13
  lea    D90(%rip),%rcx
  push   %r15
  push   %rbp
  push   $0x1
  push   $0x6
  jmp    L440
L199:
  call   <__stack_chk_fail@plt>
L418:
  mov    %edx,%eax
  movl   $0x3,0x0(%rbp)
  lea    D310(%rip),%rsi
  mov    %r13,%rdi
  sub    %r12d,%eax
  mov    %eax,(%r15)
  movzbl -0x1(%rdx),%edx
  call   <sprintf@plt>
  jmp    L269
L419:
  sub    %r12d,%eax
  movl   $0x3,0x0(%rbp)
  lea    D297(%rip),%rsi
  mov    %r13,%rdi
  mov    %eax,(%r15)
  movzbl -0x1(%rdx),%edx
  call   <sprintf@plt>
  jmp    L269
L92:
  sub    %r12d,%eax
  movl   $0x3,0x0(%rbp)
  lea    D62(%rip),%rsi
  mov    %r13,%rdi
  mov    %eax,(%r15)
  movzbl -0x1(%rdx),%edx
  call   <sprintf@plt>
  jmp    L269
L233:
  mov    %edx,%eax
  movl   $0x3,0x0(%rbp)
  lea    D26(%rip),%rsi
  mov    %r13,%rdi
  sub    %r12d,%eax
  mov    %eax,(%r15)
  movzbl -0x1(%rdx),%edx
  call   <sprintf@plt>
  jmp    L269
L196:
  mov    %edx,%eax
  movl   $0x3,0x0(%rbp)
  lea    D326(%rip),%rsi
  mov    %r13,%rdi
  sub    %r12d,%eax
  mov    %eax,(%r15)
  movzbl -0x1(%rdx),%edx
  call   <sprintf@plt>
  jmp    L269
L228:
  sub    %r12d,%eax
  movl   $0x3,0x0(%rbp)
  lea    D240(%rip),%rsi
  mov    %r13,%rdi
  mov    %eax,(%r15)
  movzbl -0x1(%r14),%edx
  call   <sprintf@plt>
  jmp    L269
```

tool_calls: name: unpack_data
arguments: label: D97
type_guessed: string
name: unpack_data
arguments: label: D181
type_guessed: string
name: unpack_data
arguments: label: D108
type_guessed: string
name: unpack_data
arguments: label: D105
type_guessed: string
name: unpack_data
arguments: label: D86
type_guessed: string
name: unpack_data
arguments: label: D329
type_guessed: string
name: unpack_data
arguments: label: D208
type_guessed: string
name: unpack_data
arguments: label: D71
type_guessed: string
name: unpack_data
arguments: label: D75
type_guessed: string
name: unpack_data
arguments: label: D136
type_guessed: string
name: unpack_data
arguments: label: D275
type_guessed: string
name: unpack_data
arguments: label: D222
type_guessed: string
name: unpack_data
arguments: label: D140
type_guessed: string
name: unpack_data
arguments: label: D16
type_guessed: string
name: unpack_data
arguments: label: D282
type_guessed: string
name: unpack_data
arguments: label: D194
type_guessed: string
name: unpack_data
arguments: label: D190
type_guessed: string
name: unpack_data
arguments: label: D202
type_guessed: string
name: unpack_data
arguments: label: D4
type_guessed: string
name: unpack_data
arguments: label: D206
type_guessed: string
name: unpack_data
arguments: label: D209
type_guessed: string
name: unpack_data
arguments: label: D18
type_guessed: string
name: unpack_data
arguments: label: D298
type_guessed: string
name: unpack_data
arguments: label: D211
type_guessed: string
name: unpack_data
arguments: label: D122
type_guessed: string
name: unpack_data
arguments: label: D90
type_guessed: string
name: unpack_data
arguments: label: D310
type_guessed: string
name: unpack_data
arguments: label: D297
type_guessed: string
name: unpack_data
arguments: label: D62
type_guessed: string
name: unpack_data
arguments: label: D26
type_guessed: string
name: unpack_data
arguments: label: D326
type_guessed: string
name: unpack_data
arguments: label: D240
type_guessed: string

tool: D97: Primary GS1 Co. Prefix

tool: D181: Offer Code

tool: D108: Save Value

tool: D105: Primary Purch. Req.

tool: D86: Primary Purch. Req. Code

tool: D329: Primary Purch. Family Code

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

tool: D71: Save Value Code

tool: D75: Save Value Applies To

tool: D136: Store Coupon Flag

tool: D275: Don't Multiply Flag

tool: D222: Retailer ID

tool: D140: Serial Number

tool: D16: Start Date

tool: D282: Expiration Date

tool: D194: 3rd Purch. Req.

tool: D190: 3rd Purch. Req. Code

tool: D202: 3rd Purch. Family Code

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

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

tool: D209: Invalid Data Field '%c'

tool: D18: Add. Purch. Rules Code

tool: D298: 2nd Purch. Req.

tool: D211: 2nd Purch. Req. Code

tool: D122: 2nd Purch. Family Code

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

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

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

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

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

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

tool: D240: Invalid Don't Multiply Flag '%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;
}
```