#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
unsigned char *coupon_val(unsigned char const *, int, unsigned char const *,
                          char *, int, int *, int *, int *, char *);
unsigned char *coupon_vli(unsigned char const *, int, unsigned char const *,
                          char *, int, int, int, int, int *, int *, char *);
int /*<<< orphan*/ sprintf(char *, char *, unsigned char const);
int to_int(unsigned char const *, int);
int /*<<< orphan*/ yymmd0(unsigned char const *, int, int, int, int, int *,
                          int *, char *, int /*<<< orphan*/);
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;
}


x86 assembly (clang, -O0):
<couponcode>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x68,%rsp
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x18(%rbp)
mov    %esi,-0x1c(%rbp)
mov    %edx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8d,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movl   $0x15,-0x34(%rbp)
mov    -0x20(%rbp),%ecx
mov    -0x1c(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    11a3 <couponcode+0x53>
movl   $0x0,-0xc(%rbp)
jmp    1e8f <couponcode+0xd3f>
cmpl   $0x0,-0x1c(%rbp)
je     11cd <couponcode+0x7d>
cmpl   $0x15,-0x1c(%rbp)
jge    11cd <couponcode+0x7d>
mov    -0x30(%rbp),%rax
movl   $0x4,(%rax)
movl   $0x0,-0xc(%rbp)
jmp    1e8f <couponcode+0xd3f>
cmpl   $0x0,0x20(%rbp)
jne    1e88 <couponcode+0xd38>
cmpl   $0x0,-0x1c(%rbp)
je     1e88 <couponcode+0xd38>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x20(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x40(%rbp),%rdx
mov    -0x30(%rbp),%r11
mov    0x10(%rbp),%r10
mov    0x18(%rbp),%rax
lea    0xde9(%rip),%rcx
mov    $0x6,%r8d
xor    %r9d,%r9d
movl   $0x6,(%rsp)
movl   $0x0,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10,0x18(%rsp)
mov    %rax,0x20(%rsp)
call   1040 <coupon_vli@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    125e <couponcode+0x10e>
movl   $0x0,-0xc(%rbp)
jmp    1e8f <couponcode+0xd3f>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x40(%rbp),%rdx
mov    -0x30(%rbp),%r11
mov    0x10(%rbp),%r10
mov    0x18(%rbp),%rax
lea    0xd9b(%rip),%rcx
mov    $0x6,%r8d
xor    %r9d,%r9d
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1030 <coupon_val@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    12b3 <couponcode+0x163>
movl   $0x0,-0xc(%rbp)
jmp    1e8f <couponcode+0xd3f>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x40(%rbp),%rdx
mov    -0x30(%rbp),%r11
mov    0x10(%rbp),%r10
mov    0x18(%rbp),%rax
lea    0xd51(%rip),%rcx
xor    %r8d,%r8d
mov    $0x1,%r9d
movl   $0x5,(%rsp)
movl   $0x0,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10,0x18(%rsp)
mov    %rax,0x20(%rsp)
call   1040 <coupon_vli@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    1318 <couponcode+0x1c8>
movl   $0x0,-0xc(%rbp)
jmp    1e8f <couponcode+0xd3f>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x40(%rbp),%rdx
mov    -0x30(%rbp),%r11
mov    0x10(%rbp),%r10
mov    0x18(%rbp),%rax
lea    0xcf7(%rip),%rcx
xor    %r8d,%r8d
mov    $0x1,%r9d
movl   $0x5,(%rsp)
movl   $0x0,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10,0x18(%rsp)
mov    %rax,0x20(%rsp)
call   1040 <coupon_vli@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    137d <couponcode+0x22d>
movl   $0x0,-0xc(%rbp)
jmp    1e8f <couponcode+0xd3f>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x40(%rbp),%rdx
mov    -0x30(%rbp),%r11
mov    0x10(%rbp),%r10
mov    0x18(%rbp),%rax
lea    0xca6(%rip),%rcx
mov    $0x1,%r8d
lea    -0x44(%rbp),%r9
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1030 <coupon_val@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    13d3 <couponcode+0x283>
movl   $0x0,-0xc(%rbp)
jmp    1e8f <couponcode+0xd3f>
cmpl   $0x5,-0x44(%rbp)
jle    1430 <couponcode+0x2e0>
cmpl   $0x9,-0x44(%rbp)
jge    1430 <couponcode+0x2e0>
mov    -0x30(%rbp),%rax
movl   $0x3,(%rax)
mov    -0x40(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    -0x18(%rbp),%rcx
sub    %rcx,%rax
add    $0x1,%rax
mov    %eax,%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    0x18(%rbp),%rdi
mov    -0x40(%rbp),%rax
lea    0xc3f(%rip),%rsi
movzbl -0x1(%rax),%edx
call   1060 <sprintf@plt>
movl   $0x0,-0xc(%rbp)
jmp    1e8f <couponcode+0xd3f>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x40(%rbp),%rdx
mov    -0x30(%rbp),%r11
mov    0x10(%rbp),%r10
mov    0x18(%rbp),%rax
lea    0xc32(%rip),%rcx
mov    $0x3,%r8d
xor    %r9d,%r9d
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1030 <coupon_val@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    1485 <couponcode+0x335>
movl   $0x0,-0xc(%rbp)
jmp    1e8f <couponcode+0xd3f>
jmp    148a <couponcode+0x33a>
mov    -0x40(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    %rcx,%rax
movslq -0x1c(%rbp),%rcx
cmp    %rcx,%rax
jge    1e83 <couponcode+0xd33>
mov    -0x40(%rbp),%rdi
mov    $0x1,%esi
call   1050 <to_int@plt>
mov    %eax,-0x48(%rbp)
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
cmpl   $0x1,-0x48(%rbp)
jne    1749 <couponcode+0x5f9>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x40(%rbp),%rdx
mov    -0x30(%rbp),%r11
mov    0x10(%rbp),%r10
mov    0x18(%rbp),%rax
lea    0xbb4(%rip),%rcx
mov    $0x1,%r8d
lea    -0x44(%rbp),%r9
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1030 <coupon_val@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    151f <couponcode+0x3cf>
movl   $0x0,-0xc(%rbp)
jmp    1e8f <couponcode+0xd3f>
cmpl   $0x3,-0x44(%rbp)
jle    1572 <couponcode+0x422>
mov    -0x30(%rbp),%rax
movl   $0x3,(%rax)
mov    -0x40(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    -0x18(%rbp),%rcx
sub    %rcx,%rax
add    $0x1,%rax
mov    %eax,%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    0x18(%rbp),%rdi
mov    -0x40(%rbp),%rax
lea    0xb55(%rip),%rsi
movzbl -0x1(%rax),%edx
call   1060 <sprintf@plt>
movl   $0x0,-0xc(%rbp)
jmp    1e8f <couponcode+0xd3f>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x40(%rbp),%rdx
mov    -0x30(%rbp),%r11
mov    0x10(%rbp),%r10
mov    0x18(%rbp),%rax
lea    0xb46(%rip),%rcx
xor    %r8d,%r8d
mov    $0x1,%r9d
movl   $0x5,(%rsp)
movl   $0x0,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10,0x18(%rsp)
mov    %rax,0x20(%rsp)
call   1040 <coupon_vli@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    15d7 <couponcode+0x487>
movl   $0x0,-0xc(%rbp)
jmp    1e8f <couponcode+0xd3f>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x40(%rbp),%rdx
mov    -0x30(%rbp),%r11
mov    0x10(%rbp),%r10
mov    0x18(%rbp),%rax
lea    0xaf1(%rip),%rcx
mov    $0x1,%r8d
lea    -0x44(%rbp),%r9
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1030 <coupon_val@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    162d <couponcode+0x4dd>
movl   $0x0,-0xc(%rbp)
jmp    1e8f <couponcode+0xd3f>
cmpl   $0x4,-0x44(%rbp)
jle    168a <couponcode+0x53a>
cmpl   $0x9,-0x44(%rbp)
jge    168a <couponcode+0x53a>
mov    -0x30(%rbp),%rax
movl   $0x3,(%rax)
mov    -0x40(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    -0x18(%rbp),%rcx
sub    %rcx,%rax
add    $0x1,%rax
mov    %eax,%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    0x18(%rbp),%rdi
mov    -0x40(%rbp),%rax
lea    0xa86(%rip),%rsi
movzbl -0x1(%rax),%edx
call   1060 <sprintf@plt>
movl   $0x0,-0xc(%rbp)
jmp    1e8f <couponcode+0xd3f>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x40(%rbp),%rdx
mov    -0x30(%rbp),%r11
mov    0x10(%rbp),%r10
mov    0x18(%rbp),%rax
lea    0xa75(%rip),%rcx
mov    $0x3,%r8d
xor    %r9d,%r9d
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1030 <coupon_val@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    16df <couponcode+0x58f>
movl   $0x0,-0xc(%rbp)
jmp    1e8f <couponcode+0xd3f>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x40(%rbp),%rdx
mov    -0x30(%rbp),%r11
mov    0x10(%rbp),%r10
mov    0x18(%rbp),%rax
lea    0xa37(%rip),%rcx
mov    $0x6,%r8d
xor    %r9d,%r9d
movl   $0x6,(%rsp)
movl   $0x1,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10,0x18(%rsp)
mov    %rax,0x20(%rsp)
call   1040 <coupon_vli@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    1744 <couponcode+0x5f4>
movl   $0x0,-0xc(%rbp)
jmp    1e8f <couponcode+0xd3f>
jmp    1e7e <couponcode+0xd2e>
cmpl   $0x2,-0x48(%rbp)
jne    192a <couponcode+0x7da>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x40(%rbp),%rdx
mov    -0x30(%rbp),%r11
mov    0x10(%rbp),%r10
mov    0x18(%rbp),%rax
lea    0x9dd(%rip),%rcx
xor    %r8d,%r8d
mov    $0x1,%r9d
movl   $0x5,(%rsp)
movl   $0x0,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10,0x18(%rsp)
mov    %rax,0x20(%rsp)
call   1040 <coupon_vli@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    17b8 <couponcode+0x668>
movl   $0x0,-0xc(%rbp)
jmp    1e8f <couponcode+0xd3f>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x40(%rbp),%rdx
mov    -0x30(%rbp),%r11
mov    0x10(%rbp),%r10
mov    0x18(%rbp),%rax
lea    0x988(%rip),%rcx
mov    $0x1,%r8d
lea    -0x44(%rbp),%r9
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1030 <coupon_val@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    180e <couponcode+0x6be>
movl   $0x0,-0xc(%rbp)
jmp    1e8f <couponcode+0xd3f>
cmpl   $0x4,-0x44(%rbp)
jle    186b <couponcode+0x71b>
cmpl   $0x9,-0x44(%rbp)
jge    186b <couponcode+0x71b>
mov    -0x30(%rbp),%rax
movl   $0x3,(%rax)
mov    -0x40(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    -0x18(%rbp),%rcx
sub    %rcx,%rax
add    $0x1,%rax
mov    %eax,%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    0x18(%rbp),%rdi
mov    -0x40(%rbp),%rax
lea    0x91d(%rip),%rsi
movzbl -0x1(%rax),%edx
call   1060 <sprintf@plt>
movl   $0x0,-0xc(%rbp)
jmp    1e8f <couponcode+0xd3f>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x40(%rbp),%rdx
mov    -0x30(%rbp),%r11
mov    0x10(%rbp),%r10
mov    0x18(%rbp),%rax
lea    0x90c(%rip),%rcx
mov    $0x3,%r8d
xor    %r9d,%r9d
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1030 <coupon_val@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    18c0 <couponcode+0x770>
movl   $0x0,-0xc(%rbp)
jmp    1e8f <couponcode+0xd3f>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x40(%rbp),%rdx
mov    -0x30(%rbp),%r11
mov    0x10(%rbp),%r10
mov    0x18(%rbp),%rax
lea    0x8ce(%rip),%rcx
mov    $0x6,%r8d
xor    %r9d,%r9d
movl   $0x6,(%rsp)
movl   $0x1,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10,0x18(%rsp)
mov    %rax,0x20(%rsp)
call   1040 <coupon_vli@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    1925 <couponcode+0x7d5>
movl   $0x0,-0xc(%rbp)
jmp    1e8f <couponcode+0xd3f>
jmp    1e79 <couponcode+0xd29>
cmpl   $0x3,-0x48(%rbp)
jne    19e8 <couponcode+0x898>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x40(%rbp),%rdx
mov    -0x30(%rbp),%r11
mov    0x10(%rbp),%r10
mov    0x18(%rbp),%rax
lea    0x874(%rip),%rcx
mov    $0x6,%r8d
xor    %r9d,%r9d
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1030 <coupon_val@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    1989 <couponcode+0x839>
movl   $0x0,-0xc(%rbp)
jmp    1e8f <couponcode+0xd3f>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x40(%rbp),%rax
add    $0xfffffffffffffffa,%rax
mov    -0x18(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%edx
mov    -0x30(%rbp),%r9
mov    0x10(%rbp),%r10
mov    0x18(%rbp),%rax
mov    $0x6,%r8d
xor    %ecx,%ecx
mov    %r8d,%ecx
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
movl   $0x0,0x10(%rsp)
call   1070 <yymmd0@plt>
cmp    $0x0,%eax
jne    19e3 <couponcode+0x893>
movl   $0x0,-0xc(%rbp)
jmp    1e8f <couponcode+0xd3f>
jmp    1e74 <couponcode+0xd24>
cmpl   $0x4,-0x48(%rbp)
jne    1aa6 <couponcode+0x956>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x40(%rbp),%rdx
mov    -0x30(%rbp),%r11
mov    0x10(%rbp),%r10
mov    0x18(%rbp),%rax
lea    0x7c6(%rip),%rcx
mov    $0x6,%r8d
xor    %r9d,%r9d
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1030 <coupon_val@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    1a47 <couponcode+0x8f7>
movl   $0x0,-0xc(%rbp)
jmp    1e8f <couponcode+0xd3f>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x40(%rbp),%rax
add    $0xfffffffffffffffa,%rax
mov    -0x18(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%edx
mov    -0x30(%rbp),%r9
mov    0x10(%rbp),%r10
mov    0x18(%rbp),%rax
mov    $0x6,%r8d
xor    %ecx,%ecx
mov    %r8d,%ecx
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
movl   $0x0,0x10(%rsp)
call   1070 <yymmd0@plt>
cmp    $0x0,%eax
jne    1aa1 <couponcode+0x951>
movl   $0x0,-0xc(%rbp)
jmp    1e8f <couponcode+0xd3f>
jmp    1e6f <couponcode+0xd1f>
cmpl   $0x5,-0x48(%rbp)
jne    1b1a <couponcode+0x9ca>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x40(%rbp),%rdx
mov    -0x30(%rbp),%r11
mov    0x10(%rbp),%r10
mov    0x18(%rbp),%rax
lea    0x713(%rip),%rcx
mov    $0x6,%r8d
xor    %r9d,%r9d
movl   $0x9,(%rsp)
movl   $0x0,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10,0x18(%rsp)
mov    %rax,0x20(%rsp)
call   1040 <coupon_vli@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    1b15 <couponcode+0x9c5>
movl   $0x0,-0xc(%rbp)
jmp    1e8f <couponcode+0xd3f>
jmp    1e6a <couponcode+0xd1a>
cmpl   $0x6,-0x48(%rbp)
jne    1b93 <couponcode+0xa43>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x40(%rbp),%rdx
mov    -0x30(%rbp),%r11
mov    0x10(%rbp),%r10
mov    0x18(%rbp),%rax
lea    0x6ad(%rip),%rcx
mov    $0x6,%r8d
mov    $0x1,%r9d
xor    %ebx,%ebx
movl   $0x7,(%rsp)
movl   $0x0,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10,0x18(%rsp)
mov    %rax,0x20(%rsp)
call   1040 <coupon_vli@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    1b8e <couponcode+0xa3e>
movl   $0x0,-0xc(%rbp)
jmp    1e8f <couponcode+0xd3f>
jmp    1e65 <couponcode+0xd15>
cmpl   $0x9,-0x48(%rbp)
jne    1e06 <couponcode+0xcb6>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x40(%rbp),%rdx
mov    -0x30(%rbp),%r11
mov    0x10(%rbp),%r10
mov    0x18(%rbp),%rax
lea    0x640(%rip),%rcx
mov    $0x1,%r8d
lea    -0x44(%rbp),%r9
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1030 <coupon_val@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    1bf3 <couponcode+0xaa3>
movl   $0x0,-0xc(%rbp)
jmp    1e8f <couponcode+0xd3f>
cmpl   $0x2,-0x44(%rbp)
jle    1c07 <couponcode+0xab7>
cmpl   $0x5,-0x44(%rbp)
jl     1c11 <couponcode+0xac1>
cmpl   $0x6,-0x44(%rbp)
jle    1c5a <couponcode+0xb0a>
mov    -0x30(%rbp),%rax
movl   $0x3,(%rax)
mov    -0x40(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    -0x18(%rbp),%rcx
sub    %rcx,%rax
add    $0x1,%rax
mov    %eax,%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    0x18(%rbp),%rdi
mov    -0x40(%rbp),%rax
lea    0x5c6(%rip),%rsi
movzbl -0x1(%rax),%edx
call   1060 <sprintf@plt>
movl   $0x0,-0xc(%rbp)
jmp    1e8f <couponcode+0xd3f>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x40(%rbp),%rdx
mov    -0x30(%rbp),%r11
mov    0x10(%rbp),%r10
mov    0x18(%rbp),%rax
lea    0x5b0(%rip),%rcx
mov    $0x1,%r8d
lea    -0x44(%rbp),%r9
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1030 <coupon_val@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    1cb0 <couponcode+0xb60>
movl   $0x0,-0xc(%rbp)
jmp    1e8f <couponcode+0xd3f>
cmpl   $0x2,-0x44(%rbp)
jle    1d03 <couponcode+0xbb3>
mov    -0x30(%rbp),%rax
movl   $0x3,(%rax)
mov    -0x40(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    -0x18(%rbp),%rcx
sub    %rcx,%rax
add    $0x1,%rax
mov    %eax,%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    0x18(%rbp),%rdi
mov    -0x40(%rbp),%rax
lea    0x550(%rip),%rsi
movzbl -0x1(%rax),%edx
call   1060 <sprintf@plt>
movl   $0x0,-0xc(%rbp)
jmp    1e8f <couponcode+0xd3f>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x40(%rbp),%rdx
mov    -0x30(%rbp),%r11
mov    0x10(%rbp),%r10
mov    0x18(%rbp),%rax
lea    0x540(%rip),%rcx
mov    $0x1,%r8d
xor    %r9d,%r9d
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1030 <coupon_val@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    1d58 <couponcode+0xc08>
movl   $0x0,-0xc(%rbp)
jmp    1e8f <couponcode+0xd3f>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x40(%rbp),%rdx
mov    -0x30(%rbp),%r11
mov    0x10(%rbp),%r10
mov    0x18(%rbp),%rax
lea    0x4fd(%rip),%rcx
mov    $0x1,%r8d
lea    -0x44(%rbp),%r9
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1030 <coupon_val@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    1dae <couponcode+0xc5e>
movl   $0x0,-0xc(%rbp)
jmp    1e8f <couponcode+0xd3f>
cmpl   $0x1,-0x44(%rbp)
jle    1e01 <couponcode+0xcb1>
mov    -0x30(%rbp),%rax
movl   $0x3,(%rax)
mov    -0x40(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    -0x18(%rbp),%rcx
sub    %rcx,%rax
add    $0x1,%rax
mov    %eax,%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    0x18(%rbp),%rdi
mov    -0x40(%rbp),%rax
lea    0x49b(%rip),%rsi
movzbl -0x1(%rax),%edx
call   1060 <sprintf@plt>
movl   $0x0,-0xc(%rbp)
jmp    1e8f <couponcode+0xd3f>
jmp    1e60 <couponcode+0xd10>
mov    -0x30(%rbp),%rax
movl   $0x3,(%rax)
mov    -0x40(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    -0x18(%rbp),%rcx
sub    %rcx,%rax
add    $0x1,%rax
mov    %eax,%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    0x18(%rbp),%rdi
mov    -0x48(%rbp),%ecx
lea    0x48b(%rip),%rsi
lea    0x468(%rip),%rax
cmp    $0x0,%ecx
cmovl  %rax,%rsi
mov    -0x40(%rbp),%rax
movzbl -0x1(%rax),%edx
call   1060 <sprintf@plt>
movl   $0x0,-0xc(%rbp)
jmp    1e8f <couponcode+0xd3f>
jmp    1e65 <couponcode+0xd15>
jmp    1e6a <couponcode+0xd1a>
jmp    1e6f <couponcode+0xd1f>
jmp    1e74 <couponcode+0xd24>
jmp    1e79 <couponcode+0xd29>
jmp    1e7e <couponcode+0xd2e>
jmp    148a <couponcode+0x33a>
jmp    1e88 <couponcode+0xd38>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x68,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<couponcode>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %esi,%eax
sub    %edx,%eax
xor    %ebx,%ebx
cmp    %ecx,%eax
jl     12fb <couponcode+0x1ab>
mov    %r9,%r13
mov    %esi,%ebp
mov    %rdi,%r15
test   %eax,%eax
je     118a <couponcode+0x3a>
cmp    $0x14,%eax
jg     118a <couponcode+0x3a>
movl   $0x4,0x0(%r13)
jmp    12fb <couponcode+0x1ab>
cmpl   $0x0,0x60(%rsp)
mov    $0x1,%ebx
jne    12fb <couponcode+0x1ab>
test   %eax,%eax
je     12fb <couponcode+0x1ab>
mov    0x58(%rsp),%r14
mov    0x50(%rsp),%r12
movslq %edx,%rdx
add    %r15,%rdx
sub    $0x8,%rsp
lea    0xe67(%rip),%rcx
xor    %ebx,%ebx
mov    %r15,%rdi
mov    %ebp,%esi
mov    $0x6,%r8d
xor    %r9d,%r9d
push   %r14
push   %r12
push   %r13
push   $0x0
push   $0x6
call   1040 <coupon_vli@plt>
add    $0x30,%rsp
test   %rax,%rax
je     12fb <couponcode+0x1ab>
sub    $0x8,%rsp
lea    0xe47(%rip),%rcx
xor    %ebx,%ebx
mov    %r15,%rdi
mov    %ebp,%esi
mov    %rax,%rdx
mov    $0x6,%r8d
xor    %r9d,%r9d
push   %r14
push   %r12
push   %r13
call   1030 <coupon_val@plt>
add    $0x20,%rsp
test   %rax,%rax
je     12fb <couponcode+0x1ab>
sub    $0x8,%rsp
lea    0xe1c(%rip),%rcx
xor    %ebx,%ebx
mov    %r15,%rdi
mov    %ebp,%esi
mov    %rax,%rdx
xor    %r8d,%r8d
mov    $0x1,%r9d
push   %r14
push   %r12
push   %r13
push   $0x0
push   $0x5
call   1040 <coupon_vli@plt>
add    $0x30,%rsp
test   %rax,%rax
je     12fb <couponcode+0x1ab>
sub    $0x8,%rsp
lea    0xded(%rip),%rcx
xor    %ebx,%ebx
mov    %r15,%rdi
mov    %ebp,%esi
mov    %rax,%rdx
xor    %r8d,%r8d
mov    $0x1,%r9d
push   %r14
push   %r12
push   %r13
push   $0x0
push   $0x5
call   1040 <coupon_vli@plt>
add    $0x30,%rsp
test   %rax,%rax
je     12fb <couponcode+0x1ab>
sub    $0x8,%rsp
lea    0xdcb(%rip),%rcx
lea    0x14(%rsp),%r9
mov    %r15,%rdi
mov    %ebp,%esi
mov    %rax,%rdx
mov    $0x1,%r8d
push   %r14
push   %r12
push   %r13
call   1030 <coupon_val@plt>
add    $0x20,%rsp
test   %rax,%rax
je     12f9 <couponcode+0x1a9>
mov    0xc(%rsp),%ecx
add    $0xfffffffa,%ecx
cmp    $0x2,%ecx
ja     130c <couponcode+0x1bc>
movl   $0x3,0x0(%r13)
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
sub    %r15d,%ecx
add    $0x1,%ecx
mov    %ecx,(%r12)
movzbl -0x1(%rax),%edx
lea    0xd8d(%rip),%rsi
mov    %r14,%rdi
call   1060 <sprintf@plt>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
sub    $0x8,%rsp
lea    0xd8d(%rip),%rcx
xor    %ebx,%ebx
mov    %r15,%rdi
mov    %ebp,%esi
mov    %rax,%rdx
mov    $0x3,%r8d
xor    %r9d,%r9d
push   %r14
push   %r12
push   %r13
call   1030 <coupon_val@plt>
add    $0x20,%rsp
test   %rax,%rax
je     12fb <couponcode+0x1ab>
mov    %rax,%r14
movslq %ebp,%rax
mov    %r14,%r12
sub    %r15,%r12
mov    %rax,0x10(%rsp)
cmp    %rax,%r12
jl     13a7 <couponcode+0x257>
mov    $0x1,%ebx
jmp    12fb <couponcode+0x1ab>
sub    $0x8,%rsp
mov    %r15,%rdi
mov    %ebp,%esi
lea    0xea8(%rip),%rcx
mov    $0x6,%r8d
mov    $0x1,%r9d
push   0x60(%rsp)
push   0x60(%rsp)
push   %r13
push   $0x0
push   $0x7
call   1040 <coupon_vli@plt>
add    $0x30,%rsp
mov    %rax,%r14
test   %rax,%rax
je     12f9 <couponcode+0x1a9>
mov    %r14,%r12
sub    %r15,%r12
cmp    0x10(%rsp),%r12
jge    1354 <couponcode+0x204>
mov    %r14,%rdi
mov    $0x1,%esi
call   1050 <to_int@plt>
lea    -0x1(%rax),%ecx
cmp    $0x8,%ecx
ja     17b7 <couponcode+0x667>
lea    0x1(%r14),%rdx
lea    0xc35(%rip),%rsi
movslq (%rsi,%rcx,4),%rcx
add    %rsi,%rcx
jmp    *%rcx
sub    $0x8,%rsp
mov    %r15,%rdi
mov    %ebp,%esi
lea    0xcdb(%rip),%rcx
mov    $0x1,%r8d
lea    0x14(%rsp),%r9
mov    0x60(%rsp),%rbx
push   %rbx
mov    0x60(%rsp),%r12
push   %r12
push   %r13
call   1030 <coupon_val@plt>
add    $0x20,%rsp
test   %rax,%rax
je     12f9 <couponcode+0x1a9>
mov    %rax,%r14
cmpl   $0x4,0xc(%rsp)
jge    17e9 <couponcode+0x699>
sub    $0x8,%rsp
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
lea    0xcc9(%rip),%rcx
xor    %r8d,%r8d
mov    $0x1,%r9d
push   %rbx
push   %r12
push   %r13
push   $0x0
push   $0x5
call   1040 <coupon_vli@plt>
add    $0x30,%rsp
test   %rax,%rax
je     12f9 <couponcode+0x1a9>
sub    $0x8,%rsp
mov    %r15,%rdi
mov    %ebp,%esi
mov    %rax,%rdx
lea    0xca2(%rip),%rcx
mov    $0x1,%r8d
lea    0x14(%rsp),%r9
push   %rbx
push   %r12
push   %r13
call   1030 <coupon_val@plt>
add    $0x20,%rsp
test   %rax,%rax
je     12f9 <couponcode+0x1a9>
mov    %rax,%r14
mov    0xc(%rsp),%eax
add    $0xfffffffb,%eax
cmp    $0x3,%eax
jbe    1852 <couponcode+0x702>
sub    $0x8,%rsp
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
lea    0xc91(%rip),%rcx
mov    $0x3,%r8d
xor    %r9d,%r9d
push   %rbx
push   %r12
push   %r13
call   1030 <coupon_val@plt>
add    $0x20,%rsp
test   %rax,%rax
je     12f9 <couponcode+0x1a9>
sub    $0x8,%rsp
mov    %r15,%rdi
mov    %ebp,%esi
mov    %rax,%rdx
lea    0xc75(%rip),%rcx
jmp    15b4 <couponcode+0x464>
sub    $0x8,%rsp
mov    %r15,%rdi
mov    %ebp,%esi
lea    0xc7a(%rip),%rcx
xor    %r8d,%r8d
mov    $0x1,%r9d
mov    0x60(%rsp),%rbx
push   %rbx
mov    0x60(%rsp),%r12
push   %r12
push   %r13
push   $0x0
push   $0x5
call   1040 <coupon_vli@plt>
add    $0x30,%rsp
test   %rax,%rax
je     12f9 <couponcode+0x1a9>
sub    $0x8,%rsp
mov    %r15,%rdi
mov    %ebp,%esi
mov    %rax,%rdx
lea    0xc49(%rip),%rcx
mov    $0x1,%r8d
lea    0x14(%rsp),%r9
push   %rbx
push   %r12
push   %r13
call   1030 <coupon_val@plt>
add    $0x20,%rsp
test   %rax,%rax
je     12f9 <couponcode+0x1a9>
mov    %rax,%r14
mov    0xc(%rsp),%eax
add    $0xfffffffb,%eax
cmp    $0x3,%eax
jbe    180e <couponcode+0x6be>
sub    $0x8,%rsp
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
lea    0xc38(%rip),%rcx
mov    $0x3,%r8d
xor    %r9d,%r9d
push   %rbx
push   %r12
push   %r13
call   1030 <coupon_val@plt>
add    $0x20,%rsp
test   %rax,%rax
je     12f9 <couponcode+0x1a9>
sub    $0x8,%rsp
mov    %r15,%rdi
mov    %ebp,%esi
mov    %rax,%rdx
lea    0xc1c(%rip),%rcx
mov    $0x6,%r8d
xor    %r9d,%r9d
push   %rbx
push   %r12
push   %r13
push   $0x1
push   $0x6
jmp    1385 <couponcode+0x235>
sub    $0x8,%rsp
mov    %r15,%rdi
mov    %ebp,%esi
lea    0xc0f(%rip),%rcx
jmp    15ed <couponcode+0x49d>
sub    $0x8,%rsp
mov    %r15,%rdi
mov    %ebp,%esi
lea    0xc0d(%rip),%rcx
mov    $0x6,%r8d
xor    %r9d,%r9d
mov    0x60(%rsp),%rbx
push   %rbx
mov    0x60(%rsp),%r12
push   %r12
push   %r13
call   1030 <coupon_val@plt>
add    $0x20,%rsp
test   %rax,%rax
je     12f9 <couponcode+0x1a9>
mov    %rax,%r14
mov    %r14d,%edx
sub    %r15d,%edx
add    $0xfffffffa,%edx
sub    $0x8,%rsp
mov    %r15,%rdi
mov    %ebp,%esi
mov    $0x6,%ecx
mov    $0x6,%r8d
mov    %r13,%r9
push   $0x0
push   %rbx
push   %r12
call   1070 <yymmd0@plt>
add    $0x20,%rsp
test   %eax,%eax
jne    139a <couponcode+0x24a>
jmp    12f9 <couponcode+0x1a9>
sub    $0x8,%rsp
mov    %r15,%rdi
mov    %ebp,%esi
lea    0xba0(%rip),%rcx
mov    $0x6,%r8d
xor    %r9d,%r9d
push   0x60(%rsp)
push   0x60(%rsp)
push   %r13
push   $0x0
push   $0x9
jmp    1385 <couponcode+0x235>
sub    $0x8,%rsp
mov    %r15,%rdi
mov    %ebp,%esi
lea    0xb8e(%rip),%rcx
mov    $0x1,%r8d
lea    0x14(%rsp),%r9
mov    0x60(%rsp),%rbx
push   %rbx
mov    0x60(%rsp),%r12
push   %r12
push   %r13
call   1030 <coupon_val@plt>
add    $0x20,%rsp
test   %rax,%rax
je     12f9 <couponcode+0x1a9>
mov    %rax,%r14
mov    0xc(%rsp),%eax
cmp    $0x6,%eax
jg     1830 <couponcode+0x6e0>
add    $0xfffffffd,%eax
cmp    $0x1,%eax
jbe    1830 <couponcode+0x6e0>
sub    $0x8,%rsp
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
lea    0xb60(%rip),%rcx
mov    $0x1,%r8d
lea    0x14(%rsp),%r9
push   %rbx
push   %r12
push   %r13
call   1030 <coupon_val@plt>
add    $0x20,%rsp
test   %rax,%rax
je     12f9 <couponcode+0x1a9>
mov    %rax,%r14
cmpl   $0x3,0xc(%rsp)
jge    1874 <couponcode+0x724>
sub    $0x8,%rsp
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14,%rdx
lea    0xb56(%rip),%rcx
mov    $0x1,%r8d
xor    %r9d,%r9d
push   %rbx
push   %r12
push   %r13
call   1030 <coupon_val@plt>
add    $0x20,%rsp
test   %rax,%rax
je     12f9 <couponcode+0x1a9>
sub    $0x8,%rsp
mov    %r15,%rdi
mov    %ebp,%esi
mov    %rax,%rdx
lea    0xb35(%rip),%rcx
mov    $0x1,%r8d
lea    0x14(%rsp),%r9
push   %rbx
push   %r12
push   %r13
call   1030 <coupon_val@plt>
add    $0x20,%rsp
test   %rax,%rax
je     12f9 <couponcode+0x1a9>
mov    %rax,%r14
cmpl   $0x2,0xc(%rsp)
jl     139a <couponcode+0x24a>
movl   $0x3,0x0(%r13)
add    $0xffffffffffffffff,%r14
mov    %r14d,%eax
sub    %r15d,%eax
add    $0x1,%eax
mov    %eax,(%r12)
lea    0xaf9(%rip),%rsi
jmp    1894 <couponcode+0x744>
movl   $0x3,0x0(%r13)
add    $0x1,%r12d
mov    0x50(%rsp),%rcx
mov    %r12d,(%rcx)
test   %eax,%eax
lea    0xaf8(%rip),%rax
lea    0xb0d(%rip),%rsi
cmovs  %rax,%rsi
mov    0x58(%rsp),%rbx
jmp    1894 <couponcode+0x744>
movl   $0x3,0x0(%r13)
add    $0xffffffffffffffff,%r14
mov    %r14d,%eax
sub    %r15d,%eax
add    $0x1,%eax
mov    %eax,(%r12)
lea    0x8cd(%rip),%rsi
jmp    1894 <couponcode+0x744>
movl   $0x3,0x0(%r13)
add    $0xffffffffffffffff,%r14
mov    %r14d,%eax
sub    %r15d,%eax
add    $0x1,%eax
mov    %eax,(%r12)
lea    0x969(%rip),%rsi
jmp    1894 <couponcode+0x744>
movl   $0x3,0x0(%r13)
add    $0xffffffffffffffff,%r14
mov    %r14d,%eax
sub    %r15d,%eax
add    $0x1,%eax
mov    %eax,(%r12)
lea    0x9df(%rip),%rsi
jmp    1894 <couponcode+0x744>
movl   $0x3,0x0(%r13)
add    $0xffffffffffffffff,%r14
mov    %r14d,%eax
sub    %r15d,%eax
add    $0x1,%eax
mov    %eax,(%r12)
lea    0x8ad(%rip),%rsi
jmp    1894 <couponcode+0x744>
movl   $0x3,0x0(%r13)
add    $0xffffffffffffffff,%r14
mov    %r14d,%eax
sub    %r15d,%eax
add    $0x1,%eax
mov    %eax,(%r12)
lea    0x9ce(%rip),%rsi
movzbl (%r14),%edx
mov    %rbx,%rdi
jmp    12f4 <couponcode+0x1a4>

LLVM IR (-O0):
@.str = [23 x i8] c"Primary GS1 Co. Prefix\00"
@.str.1 = [11 x i8] c"Offer Code\00"
@.str.2 = [11 x i8] c"Save Value\00"
@.str.3 = [20 x i8] c"Primary Purch. Req.\00"
@.str.4 = [25 x i8] c"Primary Purch. Req. Code\00"
@.str.5 = [38 x i8] c"Invalid Primary Purch. Req. Code '%c'\00"
@.str.6 = [27 x i8] c"Primary Purch. Family Code\00"
@.str.7 = [23 x i8] c"Add. Purch. Rules Code\00"
@.str.8 = [36 x i8] c"Invalid Add. Purch. Rules Code '%c'\00"
@.str.9 = [16 x i8] c"2nd Purch. Req.\00"
@.str.10 = [21 x i8] c"2nd Purch. Req. Code\00"
@.str.11 = [34 x i8] c"Invalid 2nd Purch. Req. Code '%c'\00"
@.str.12 = [23 x i8] c"2nd Purch. Family Code\00"
@.str.13 = [26 x i8] c"2nd Purch. GS1 Co. Prefix\00"
@.str.14 = [16 x i8] c"3rd Purch. Req.\00"
@.str.15 = [21 x i8] c"3rd Purch. Req. Code\00"
@.str.16 = [34 x i8] c"Invalid 3rd Purch. Req. Code '%c'\00"
@.str.17 = [23 x i8] c"3rd Purch. Family Code\00"
@.str.18 = [26 x i8] c"3rd Purch. GS1 Co. Prefix\00"
@.str.19 = [16 x i8] c"Expiration Date\00"
@.str.20 = [11 x i8] c"Start Date\00"
@.str.21 = [14 x i8] c"Serial Number\00"
@.str.22 = [12 x i8] c"Retailer ID\00"
@.str.23 = [16 x i8] c"Save Value Code\00"
@.str.24 = [29 x i8] c"Invalid Save Value Code '%c'\00"
@.str.25 = [22 x i8] c"Save Value Applies To\00"
@.str.26 = [35 x i8] c"Invalid Save Value Applies To '%c'\00"
@.str.27 = [18 x i8] c"Store Coupon Flag\00"
@.str.28 = [20 x i8] c"Don't Multiply Flag\00"
@.str.29 = [33 x i8] c"Invalid Don't Multiply Flag '%c'\00"
@.str.30 = [28 x i8] c"Non-numeric Data Field '%c'\00"
@.str.31 = [24 x i8] c"Invalid Data Field '%c'\00"
define i32 @couponcode(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32* %5, i32* %6, i8* %7, i32 %8) {
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32*
%17 = alloca i32*
%18 = alloca i8*
%19 = alloca i32
%20 = alloca i32
%21 = alloca i8*
%22 = alloca i32
%23 = alloca i32
store i8* %0, i8** %11
store i32 %1, i32* %12
store i32 %2, i32* %13
store i32 %3, i32* %14
store i32 %4, i32* %15
store i32* %5, i32** %16
store i32* %6, i32** %17
store i8* %7, i8** %18
store i32 %8, i32* %19
store i32 21, i32* %20
%24 = load i32, i32* %15
%25 = load i32, i32* %13
%26 = load i32, i32* %12
%27 = sub nsw i32 %26, %25
store i32 %27, i32* %12
%28 = load i32, i32* %12
%29 = load i32, i32* %14
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %32
31: ; preds = %9
store i32 0, i32* %10
br label %557
32: ; preds = %9
%33 = load i32, i32* %12
%34 = icmp ne i32 %33, 0
br i1 %34, label %35, label %40
35: ; preds = %32
%36 = load i32, i32* %12
%37 = icmp slt i32 %36, 21
br i1 %37, label %38, label %40
38: ; preds = %35
%39 = load i32*, i32** %16
store i32 4, i32* %39
store i32 0, i32* %10
br label %557
40: ; preds = %35, %32
%41 = load i32, i32* %19
%42 = icmp ne i32 %41, 0
br i1 %42, label %556, label %43
43: ; preds = %40
%44 = load i32, i32* %12
%45 = icmp ne i32 %44, 0
br i1 %45, label %46, label %556
46: ; preds = %43
%47 = load i8*, i8** %11
%48 = load i32, i32* %13
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8, i8* %47, i64 %49
store i8* %50, i8** %21
%51 = load i32, i32* %13
%52 = load i32, i32* %12
%53 = add nsw i32 %52, %51
store i32 %53, i32* %12
%54 = load i8*, i8** %11
%55 = load i32, i32* %12
%56 = load i8*, i8** %21
%57 = load i32*, i32** %16
%58 = load i32*, i32** %17
%59 = load i8*, i8** %18
%60 = call i8* @coupon_vli(i8* %54, i32 %55, i8* %56, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 6, i32 0, i32 6, i32 0, i32* %57, i32* %58, i8* %59)
store i8* %60, i8** %21
%61 = load i8*, i8** %21
%62 = icmp eq i8* %61, null
br i1 %62, label %63, label %64
63: ; preds = %46
store i32 0, i32* %10
br label %557
64: ; preds = %46
%65 = load i8*, i8** %11
%66 = load i32, i32* %12
%67 = load i8*, i8** %21
%68 = load i32*, i32** %16
%69 = load i32*, i32** %17
%70 = load i8*, i8** %18
%71 = call i8* @coupon_val(i8* %65, i32 %66, i8* %67, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 6, i32* null, i32* %68, i32* %69, i8* %70)
store i8* %71, i8** %21
%72 = load i8*, i8** %21
%73 = icmp eq i8* %72, null
br i1 %73, label %74, label %75
74: ; preds = %64
store i32 0, i32* %10
br label %557
75: ; preds = %64
%76 = load i8*, i8** %11
%77 = load i32, i32* %12
%78 = load i8*, i8** %21
%79 = load i32*, i32** %16
%80 = load i32*, i32** %17
%81 = load i8*, i8** %18
%82 = call i8* @coupon_vli(i8* %76, i32 %77, i8* %78, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 0, i32 1, i32 5, i32 0, i32* %79, i32* %80, i8* %81)
store i8* %82, i8** %21
%83 = load i8*, i8** %21
%84 = icmp eq i8* %83, null
br i1 %84, label %85, label %86
85: ; preds = %75
store i32 0, i32* %10
br label %557
86: ; preds = %75
%87 = load i8*, i8** %11
%88 = load i32, i32* %12
%89 = load i8*, i8** %21
%90 = load i32*, i32** %16
%91 = load i32*, i32** %17
%92 = load i8*, i8** %18
%93 = call i8* @coupon_vli(i8* %87, i32 %88, i8* %89, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 0, i32 1, i32 5, i32 0, i32* %90, i32* %91, i8* %92)
store i8* %93, i8** %21
%94 = load i8*, i8** %21
%95 = icmp eq i8* %94, null
br i1 %95, label %96, label %97
96: ; preds = %86
store i32 0, i32* %10
br label %557
97: ; preds = %86
%98 = load i8*, i8** %11
%99 = load i32, i32* %12
%100 = load i8*, i8** %21
%101 = load i32*, i32** %16
%102 = load i32*, i32** %17
%103 = load i8*, i8** %18
%104 = call i8* @coupon_val(i8* %98, i32 %99, i8* %100, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 1, i32* %22, i32* %101, i32* %102, i8* %103)
store i8* %104, i8** %21
%105 = load i8*, i8** %21
%106 = icmp eq i8* %105, null
br i1 %106, label %107, label %108
107: ; preds = %97
store i32 0, i32* %10
br label %557
108: ; preds = %97
%109 = load i32, i32* %22
%110 = icmp sgt i32 %109, 5
br i1 %110, label %111, label %130
111: ; preds = %108
%112 = load i32, i32* %22
%113 = icmp slt i32 %112, 9
br i1 %113, label %114, label %130
114: ; preds = %111
%115 = load i32*, i32** %16
store i32 3, i32* %115
%116 = load i8*, i8** %21
%117 = getelementptr inbounds i8, i8* %116, i64 -1
%118 = load i8*, i8** %11
%119 = ptrtoint i8* %117 to i64
%120 = ptrtoint i8* %118 to i64
%121 = sub i64 %119, %120
%122 = add nsw i64 %121, 1
%123 = trunc i64 %122 to i32
%124 = load i32*, i32** %17
store i32 %123, i32* %124
%125 = load i8*, i8** %18
%126 = load i8*, i8** %21
%127 = getelementptr inbounds i8, i8* %126, i64 -1
%128 = load i8, i8* %127
%129 = call i32 @sprintf(i8* %125, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i8 zeroext %128)
store i32 0, i32* %10
br label %557
130: ; preds = %111, %108
%131 = load i8*, i8** %11
%132 = load i32, i32* %12
%133 = load i8*, i8** %21
%134 = load i32*, i32** %16
%135 = load i32*, i32** %17
%136 = load i8*, i8** %18
%137 = call i8* @coupon_val(i8* %131, i32 %132, i8* %133, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i32 3, i32* null, i32* %134, i32* %135, i8* %136)
store i8* %137, i8** %21
%138 = load i8*, i8** %21
%139 = icmp eq i8* %138, null
br i1 %139, label %140, label %141
140: ; preds = %130
store i32 0, i32* %10
br label %557
141: ; preds = %130
br label %142
142: ; preds = %554, %141
%143 = load i8*, i8** %21
%144 = load i8*, i8** %11
%145 = ptrtoint i8* %143 to i64
%146 = ptrtoint i8* %144 to i64
%147 = sub i64 %145, %146
%148 = load i32, i32* %12
%149 = sext i32 %148 to i64
%150 = icmp slt i64 %147, %149
br i1 %150, label %151, label %555
151: ; preds = %142
%152 = load i8*, i8** %21
%153 = call i32 @to_int(i8* %152, i32 1)
store i32 %153, i32* %23
%154 = load i8*, i8** %21
%155 = getelementptr inbounds i8, i8* %154, i32 1
store i8* %155, i8** %21
%156 = load i32, i32* %23
%157 = icmp eq i32 %156, 1
br i1 %157, label %158, label %255
158: ; preds = %151
%159 = load i8*, i8** %11
%160 = load i32, i32* %12
%161 = load i8*, i8** %21
%162 = load i32*, i32** %16
%163 = load i32*, i32** %17
%164 = load i8*, i8** %18
%165 = call i8* @coupon_val(i8* %159, i32 %160, i8* %161, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 1, i32* %22, i32* %162, i32* %163, i8* %164)
store i8* %165, i8** %21
%166 = load i8*, i8** %21
%167 = icmp eq i8* %166, null
br i1 %167, label %168, label %169
168: ; preds = %158
store i32 0, i32* %10
br label %557
169: ; preds = %158
%170 = load i32, i32* %22
%171 = icmp sgt i32 %170, 3
br i1 %171, label %172, label %188
172: ; preds = %169
%173 = load i32*, i32** %16
store i32 3, i32* %173
%174 = load i8*, i8** %21
%175 = getelementptr inbounds i8, i8* %174, i64 -1
%176 = load i8*, i8** %11
%177 = ptrtoint i8* %175 to i64
%178 = ptrtoint i8* %176 to i64
%179 = sub i64 %177, %178
%180 = add nsw i64 %179, 1
%181 = trunc i64 %180 to i32
%182 = load i32*, i32** %17
store i32 %181, i32* %182
%183 = load i8*, i8** %18
%184 = load i8*, i8** %21
%185 = getelementptr inbounds i8, i8* %184, i64 -1
%186 = load i8, i8* %185
%187 = call i32 @sprintf(i8* %183, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.8, i64 0, i64 0), i8 zeroext %186)
store i32 0, i32* %10
br label %557
188: ; preds = %169
%189 = load i8*, i8** %11
%190 = load i32, i32* %12
%191 = load i8*, i8** %21
%192 = load i32*, i32** %16
%193 = load i32*, i32** %17
%194 = load i8*, i8** %18
%195 = call i8* @coupon_vli(i8* %189, i32 %190, i8* %191, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), i32 0, i32 1, i32 5, i32 0, i32* %192, i32* %193, i8* %194)
store i8* %195, i8** %21
%196 = load i8*, i8** %21
%197 = icmp eq i8* %196, null
br i1 %197, label %198, label %199
198: ; preds = %188
store i32 0, i32* %10
br label %557
199: ; preds = %188
%200 = load i8*, i8** %11
%201 = load i32, i32* %12
%202 = load i8*, i8** %21
%203 = load i32*, i32** %16
%204 = load i32*, i32** %17
%205 = load i8*, i8** %18
%206 = call i8* @coupon_val(i8* %200, i32 %201, i8* %202, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0), i32 1, i32* %22, i32* %203, i32* %204, i8* %205)
store i8* %206, i8** %21
%207 = load i8*, i8** %21
%208 = icmp eq i8* %207, null
br i1 %208, label %209, label %210
209: ; preds = %199
store i32 0, i32* %10
br label %557
210: ; preds = %199
%211 = load i32, i32* %22
%212 = icmp sgt i32 %211, 4
br i1 %212, label %213, label %232
213: ; preds = %210
%214 = load i32, i32* %22
%215 = icmp slt i32 %214, 9
br i1 %215, label %216, label %232
216: ; preds = %213
%217 = load i32*, i32** %16
store i32 3, i32* %217
%218 = load i8*, i8** %21
%219 = getelementptr inbounds i8, i8* %218, i64 -1
%220 = load i8*, i8** %11
%221 = ptrtoint i8* %219 to i64
%222 = ptrtoint i8* %220 to i64
%223 = sub i64 %221, %222
%224 = add nsw i64 %223, 1
%225 = trunc i64 %224 to i32
%226 = load i32*, i32** %17
store i32 %225, i32* %226
%227 = load i8*, i8** %18
%228 = load i8*, i8** %21
%229 = getelementptr inbounds i8, i8* %228, i64 -1
%230 = load i8, i8* %229
%231 = call i32 @sprintf(i8* %227, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.11, i64 0, i64 0), i8 zeroext %230)
store i32 0, i32* %10
br label %557
232: ; preds = %213, %210
%233 = load i8*, i8** %11
%234 = load i32, i32* %12
%235 = load i8*, i8** %21
%236 = load i32*, i32** %16
%237 = load i32*, i32** %17
%238 = load i8*, i8** %18
%239 = call i8* @coupon_val(i8* %233, i32 %234, i8* %235, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.12, i64 0, i64 0), i32 3, i32* null, i32* %236, i32* %237, i8* %238)
store i8* %239, i8** %21
%240 = load i8*, i8** %21
%241 = icmp eq i8* %240, null
br i1 %241, label %242, label %243
242: ; preds = %232
store i32 0, i32* %10
br label %557
243: ; preds = %232
%244 = load i8*, i8** %11
%245 = load i32, i32* %12
%246 = load i8*, i8** %21
%247 = load i32*, i32** %16
%248 = load i32*, i32** %17
%249 = load i8*, i8** %18
%250 = call i8* @coupon_vli(i8* %244, i32 %245, i8* %246, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.13, i64 0, i64 0), i32 6, i32 0, i32 6, i32 1, i32* %247, i32* %248, i8* %249)
store i8* %250, i8** %21
%251 = load i8*, i8** %21
%252 = icmp eq i8* %251, null
br i1 %252, label %253, label %254
253: ; preds = %243
store i32 0, i32* %10
br label %557
254: ; preds = %243
br label %554
255: ; preds = %151
%256 = load i32, i32* %23
%257 = icmp eq i32 %256, 2
br i1 %257, label %258, label %325
258: ; preds = %255
%259 = load i8*, i8** %11
%260 = load i32, i32* %12
%261 = load i8*, i8** %21
%262 = load i32*, i32** %16
%263 = load i32*, i32** %17
%264 = load i8*, i8** %18
%265 = call i8* @coupon_vli(i8* %259, i32 %260, i8* %261, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.14, i64 0, i64 0), i32 0, i32 1, i32 5, i32 0, i32* %262, i32* %263, i8* %264)
store i8* %265, i8** %21
%266 = load i8*, i8** %21
%267 = icmp eq i8* %266, null
br i1 %267, label %268, label %269
268: ; preds = %258
store i32 0, i32* %10
br label %557
269: ; preds = %258
%270 = load i8*, i8** %11
%271 = load i32, i32* %12
%272 = load i8*, i8** %21
%273 = load i32*, i32** %16
%274 = load i32*, i32** %17
%275 = load i8*, i8** %18
%276 = call i8* @coupon_val(i8* %270, i32 %271, i8* %272, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.15, i64 0, i64 0), i32 1, i32* %22, i32* %273, i32* %274, i8* %275)
store i8* %276, i8** %21
%277 = load i8*, i8** %21
%278 = icmp eq i8* %277, null
br i1 %278, label %279, label %280
279: ; preds = %269
store i32 0, i32* %10
br label %557
280: ; preds = %269
%281 = load i32, i32* %22
%282 = icmp sgt i32 %281, 4
br i1 %282, label %283, label %302
283: ; preds = %280
%284 = load i32, i32* %22
%285 = icmp slt i32 %284, 9
br i1 %285, label %286, label %302
286: ; preds = %283
%287 = load i32*, i32** %16
store i32 3, i32* %287
%288 = load i8*, i8** %21
%289 = getelementptr inbounds i8, i8* %288, i64 -1
%290 = load i8*, i8** %11
%291 = ptrtoint i8* %289 to i64
%292 = ptrtoint i8* %290 to i64
%293 = sub i64 %291, %292
%294 = add nsw i64 %293, 1
%295 = trunc i64 %294 to i32
%296 = load i32*, i32** %17
store i32 %295, i32* %296
%297 = load i8*, i8** %18
%298 = load i8*, i8** %21
%299 = getelementptr inbounds i8, i8* %298, i64 -1
%300 = load i8, i8* %299
%301 = call i32 @sprintf(i8* %297, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.16, i64 0, i64 0), i8 zeroext %300)
store i32 0, i32* %10
br label %557
302: ; preds = %283, %280
%303 = load i8*, i8** %11
%304 = load i32, i32* %12
%305 = load i8*, i8** %21
%306 = load i32*, i32** %16
%307 = load i32*, i32** %17
%308 = load i8*, i8** %18
%309 = call i8* @coupon_val(i8* %303, i32 %304, i8* %305, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.17, i64 0, i64 0), i32 3, i32* null, i32* %306, i32* %307, i8* %308)
store i8* %309, i8** %21
%310 = load i8*, i8** %21
%311 = icmp eq i8* %310, null
br i1 %311, label %312, label %313
312: ; preds = %302
store i32 0, i32* %10
br label %557
313: ; preds = %302
%314 = load i8*, i8** %11
%315 = load i32, i32* %12
%316 = load i8*, i8** %21
%317 = load i32*, i32** %16
%318 = load i32*, i32** %17
%319 = load i8*, i8** %18
%320 = call i8* @coupon_vli(i8* %314, i32 %315, i8* %316, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.18, i64 0, i64 0), i32 6, i32 0, i32 6, i32 1, i32* %317, i32* %318, i8* %319)
store i8* %320, i8** %21
%321 = load i8*, i8** %21
%322 = icmp eq i8* %321, null
br i1 %322, label %323, label %324
323: ; preds = %313
store i32 0, i32* %10
br label %557
324: ; preds = %313
br label %553
325: ; preds = %255
%326 = load i32, i32* %23
%327 = icmp eq i32 %326, 3
br i1 %327, label %328, label %356
328: ; preds = %325
%329 = load i8*, i8** %11
%330 = load i32, i32* %12
%331 = load i8*, i8** %21
%332 = load i32*, i32** %16
%333 = load i32*, i32** %17
%334 = load i8*, i8** %18
%335 = call i8* @coupon_val(i8* %329, i32 %330, i8* %331, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.19, i64 0, i64 0), i32 6, i32* null, i32* %332, i32* %333, i8* %334)
store i8* %335, i8** %21
%336 = load i8*, i8** %21
%337 = icmp eq i8* %336, null
br i1 %337, label %338, label %339
338: ; preds = %328
store i32 0, i32* %10
br label %557
339: ; preds = %328
%340 = load i8*, i8** %11
%341 = load i32, i32* %12
%342 = load i8*, i8** %21
%343 = getelementptr inbounds i8, i8* %342, i64 -6
%344 = load i8*, i8** %11
%345 = ptrtoint i8* %343 to i64
%346 = ptrtoint i8* %344 to i64
%347 = sub i64 %345, %346
%348 = trunc i64 %347 to i32
%349 = load i32*, i32** %16
%350 = load i32*, i32** %17
%351 = load i8*, i8** %18
%352 = call i32 @yymmd0(i8* %340, i32 %341, i32 %348, i32 6, i32 6, i32* %349, i32* %350, i8* %351, i32 0)
%353 = icmp ne i32 %352, 0
br i1 %353, label %355, label %354
354: ; preds = %339
store i32 0, i32* %10
br label %557
355: ; preds = %339
br label %552
356: ; preds = %325
%357 = load i32, i32* %23
%358 = icmp eq i32 %357, 4
br i1 %358, label %359, label %387
359: ; preds = %356
%360 = load i8*, i8** %11
%361 = load i32, i32* %12
%362 = load i8*, i8** %21
%363 = load i32*, i32** %16
%364 = load i32*, i32** %17
%365 = load i8*, i8** %18
%366 = call i8* @coupon_val(i8* %360, i32 %361, i8* %362, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.20, i64 0, i64 0), i32 6, i32* null, i32* %363, i32* %364, i8* %365)
store i8* %366, i8** %21
%367 = load i8*, i8** %21
%368 = icmp eq i8* %367, null
br i1 %368, label %369, label %370
369: ; preds = %359
store i32 0, i32* %10
br label %557
370: ; preds = %359
%371 = load i8*, i8** %11
%372 = load i32, i32* %12
%373 = load i8*, i8** %21
%374 = getelementptr inbounds i8, i8* %373, i64 -6
%375 = load i8*, i8** %11
%376 = ptrtoint i8* %374 to i64
%377 = ptrtoint i8* %375 to i64
%378 = sub i64 %376, %377
%379 = trunc i64 %378 to i32
%380 = load i32*, i32** %16
%381 = load i32*, i32** %17
%382 = load i8*, i8** %18
%383 = call i32 @yymmd0(i8* %371, i32 %372, i32 %379, i32 6, i32 6, i32* %380, i32* %381, i8* %382, i32 0)
%384 = icmp ne i32 %383, 0
br i1 %384, label %386, label %385
385: ; preds = %370
store i32 0, i32* %10
br label %557
386: ; preds = %370
br label %551
387: ; preds = %356
%388 = load i32, i32* %23
%389 = icmp eq i32 %388, 5
br i1 %389, label %390, label %402
390: ; preds = %387
%391 = load i8*, i8** %11
%392 = load i32, i32* %12
%393 = load i8*, i8** %21
%394 = load i32*, i32** %16
%395 = load i32*, i32** %17
%396 = load i8*, i8** %18
%397 = call i8* @coupon_vli(i8* %391, i32 %392, i8* %393, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.21, i64 0, i64 0), i32 6, i32 0, i32 9, i32 0, i32* %394, i32* %395, i8* %396)
store i8* %397, i8** %21
%398 = load i8*, i8** %21
%399 = icmp eq i8* %398, null
br i1 %399, label %400, label %401
400: ; preds = %390
store i32 0, i32* %10
br label %557
401: ; preds = %390
br label %550
402: ; preds = %387
%403 = load i32, i32* %23
%404 = icmp eq i32 %403, 6
br i1 %404, label %405, label %417
405: ; preds = %402
%406 = load i8*, i8** %11
%407 = load i32, i32* %12
%408 = load i8*, i8** %21
%409 = load i32*, i32** %16
%410 = load i32*, i32** %17
%411 = load i8*, i8** %18
%412 = call i8* @coupon_vli(i8* %406, i32 %407, i8* %408, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.22, i64 0, i64 0), i32 6, i32 1, i32 7, i32 0, i32* %409, i32* %410, i8* %411)
store i8* %412, i8** %21
%413 = load i8*, i8** %21
%414 = icmp eq i8* %413, null
br i1 %414, label %415, label %416
415: ; preds = %405
store i32 0, i32* %10
br label %557
416: ; preds = %405
br label %549
417: ; preds = %402
%418 = load i32, i32* %23
%419 = icmp eq i32 %418, 9
br i1 %419, label %420, label %528
420: ; preds = %417
%421 = load i8*, i8** %11
%422 = load i32, i32* %12
%423 = load i8*, i8** %21
%424 = load i32*, i32** %16
%425 = load i32*, i32** %17
%426 = load i8*, i8** %18
%427 = call i8* @coupon_val(i8* %421, i32 %422, i8* %423, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.23, i64 0, i64 0), i32 1, i32* %22, i32* %424, i32* %425, i8* %426)
store i8* %427, i8** %21
%428 = load i8*, i8** %21
%429 = icmp eq i8* %428, null
br i1 %429, label %430, label %431
430: ; preds = %420
store i32 0, i32* %10
br label %557
431: ; preds = %420
%432 = load i32, i32* %22
%433 = icmp sgt i32 %432, 2
br i1 %433, label %434, label %437
434: ; preds = %431
%435 = load i32, i32* %22
%436 = icmp slt i32 %435, 5
br i1 %436, label %440, label %437
437: ; preds = %434, %431
%438 = load i32, i32* %22
%439 = icmp sgt i32 %438, 6
br i1 %439, label %440, label %456
440: ; preds = %437, %434
%441 = load i32*, i32** %16
store i32 3, i32* %441
%442 = load i8*, i8** %21
%443 = getelementptr inbounds i8, i8* %442, i64 -1
%444 = load i8*, i8** %11
%445 = ptrtoint i8* %443 to i64
%446 = ptrtoint i8* %444 to i64
%447 = sub i64 %445, %446
%448 = add nsw i64 %447, 1
%449 = trunc i64 %448 to i32
%450 = load i32*, i32** %17
store i32 %449, i32* %450
%451 = load i8*, i8** %18
%452 = load i8*, i8** %21
%453 = getelementptr inbounds i8, i8* %452, i64 -1
%454 = load i8, i8* %453
%455 = call i32 @sprintf(i8* %451, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.24, i64 0, i64 0), i8 zeroext %454)
store i32 0, i32* %10
br label %557
456: ; preds = %437
%457 = load i8*, i8** %11
%458 = load i32, i32* %12
%459 = load i8*, i8** %21
%460 = load i32*, i32** %16
%461 = load i32*, i32** %17
%462 = load i8*, i8** %18
%463 = call i8* @coupon_val(i8* %457, i32 %458, i8* %459, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.25, i64 0, i64 0), i32 1, i32* %22, i32* %460, i32* %461, i8* %462)
store i8* %463, i8** %21
%464 = load i8*, i8** %21
%465 = icmp eq i8* %464, null
br i1 %465, label %466, label %467
466: ; preds = %456
store i32 0, i32* %10
br label %557
467: ; preds = %456
%468 = load i32, i32* %22
%469 = icmp sgt i32 %468, 2
br i1 %469, label %470, label %486
470: ; preds = %467
%471 = load i32*, i32** %16
store i32 3, i32* %471
%472 = load i8*, i8** %21
%473 = getelementptr inbounds i8, i8* %472, i64 -1
%474 = load i8*, i8** %11
%475 = ptrtoint i8* %473 to i64
%476 = ptrtoint i8* %474 to i64
%477 = sub i64 %475, %476
%478 = add nsw i64 %477, 1
%479 = trunc i64 %478 to i32
%480 = load i32*, i32** %17
store i32 %479, i32* %480
%481 = load i8*, i8** %18
%482 = load i8*, i8** %21
%483 = getelementptr inbounds i8, i8* %482, i64 -1
%484 = load i8, i8* %483
%485 = call i32 @sprintf(i8* %481, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.26, i64 0, i64 0), i8 zeroext %484)
store i32 0, i32* %10
br label %557
486: ; preds = %467
%487 = load i8*, i8** %11
%488 = load i32, i32* %12
%489 = load i8*, i8** %21
%490 = load i32*, i32** %16
%491 = load i32*, i32** %17
%492 = load i8*, i8** %18
%493 = call i8* @coupon_val(i8* %487, i32 %488, i8* %489, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.27, i64 0, i64 0), i32 1, i32* null, i32* %490, i32* %491, i8* %492)
store i8* %493, i8** %21
%494 = load i8*, i8** %21
%495 = icmp eq i8* %494, null
br i1 %495, label %496, label %497
496: ; preds = %486
store i32 0, i32* %10
br label %557
497: ; preds = %486
%498 = load i8*, i8** %11
%499 = load i32, i32* %12
%500 = load i8*, i8** %21
%501 = load i32*, i32** %16
%502 = load i32*, i32** %17
%503 = load i8*, i8** %18
%504 = call i8* @coupon_val(i8* %498, i32 %499, i8* %500, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.28, i64 0, i64 0), i32 1, i32* %22, i32* %501, i32* %502, i8* %503)
store i8* %504, i8** %21
%505 = load i8*, i8** %21
%506 = icmp eq i8* %505, null
br i1 %506, label %507, label %508
507: ; preds = %497
store i32 0, i32* %10
br label %557
508: ; preds = %497
%509 = load i32, i32* %22
%510 = icmp sgt i32 %509, 1
br i1 %510, label %511, label %527
511: ; preds = %508
%512 = load i32*, i32** %16
store i32 3, i32* %512
%513 = load i8*, i8** %21
%514 = getelementptr inbounds i8, i8* %513, i64 -1
%515 = load i8*, i8** %11
%516 = ptrtoint i8* %514 to i64
%517 = ptrtoint i8* %515 to i64
%518 = sub i64 %516, %517
%519 = add nsw i64 %518, 1
%520 = trunc i64 %519 to i32
%521 = load i32*, i32** %17
store i32 %520, i32* %521
%522 = load i8*, i8** %18
%523 = load i8*, i8** %21
%524 = getelementptr inbounds i8, i8* %523, i64 -1
%525 = load i8, i8* %524
%526 = call i32 @sprintf(i8* %522, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.29, i64 0, i64 0), i8 zeroext %525)
store i32 0, i32* %10
br label %557
527: ; preds = %508
br label %548
528: ; preds = %417
%529 = load i32*, i32** %16
store i32 3, i32* %529
%530 = load i8*, i8** %21
%531 = getelementptr inbounds i8, i8* %530, i64 -1
%532 = load i8*, i8** %11
%533 = ptrtoint i8* %531 to i64
%534 = ptrtoint i8* %532 to i64
%535 = sub i64 %533, %534
%536 = add nsw i64 %535, 1
%537 = trunc i64 %536 to i32
%538 = load i32*, i32** %17
store i32 %537, i32* %538
%539 = load i8*, i8** %18
%540 = load i32, i32* %23
%541 = icmp slt i32 %540, 0
%542 = zext i1 %541 to i64
%543 = select i1 %541, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.30, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.31, i64 0, i64 0)
%544 = load i8*, i8** %21
%545 = getelementptr inbounds i8, i8* %544, i64 -1
%546 = load i8, i8* %545
%547 = call i32 @sprintf(i8* %539, i8* %543, i8 zeroext %546)
store i32 0, i32* %10
br label %557
548: ; preds = %527
br label %549
549: ; preds = %548, %416
br label %550
550: ; preds = %549, %401
br label %551
551: ; preds = %550, %386
br label %552
552: ; preds = %551, %355
br label %553
553: ; preds = %552, %324
br label %554
554: ; preds = %553, %254
br label %142
555: ; preds = %142
br label %556
556: ; preds = %555, %43, %40
store i32 1, i32* %10
br label %557
557: ; preds = %556, %528, %511, %507, %496, %470, %466, %440, %430, %415, %400, %385, %369, %354, %338, %323, %312, %286, %279, %268, %253, %242, %216, %209, %198, %172, %168, %140, %114, %107, %96, %85, %74, %63, %38, %31
%558 = load i32, i32* %10
ret i32 %558
}

LLVM IR (-O2):
@.str = [23 x i8] c"Primary GS1 Co. Prefix\00"
@.str.1 = [11 x i8] c"Offer Code\00"
@.str.2 = [11 x i8] c"Save Value\00"
@.str.3 = [20 x i8] c"Primary Purch. Req.\00"
@.str.4 = [25 x i8] c"Primary Purch. Req. Code\00"
@.str.5 = [38 x i8] c"Invalid Primary Purch. Req. Code '%c'\00"
@.str.6 = [27 x i8] c"Primary Purch. Family Code\00"
@.str.7 = [23 x i8] c"Add. Purch. Rules Code\00"
@.str.8 = [36 x i8] c"Invalid Add. Purch. Rules Code '%c'\00"
@.str.9 = [16 x i8] c"2nd Purch. Req.\00"
@.str.10 = [21 x i8] c"2nd Purch. Req. Code\00"
@.str.11 = [34 x i8] c"Invalid 2nd Purch. Req. Code '%c'\00"
@.str.12 = [23 x i8] c"2nd Purch. Family Code\00"
@.str.13 = [26 x i8] c"2nd Purch. GS1 Co. Prefix\00"
@.str.14 = [16 x i8] c"3rd Purch. Req.\00"
@.str.15 = [21 x i8] c"3rd Purch. Req. Code\00"
@.str.16 = [34 x i8] c"Invalid 3rd Purch. Req. Code '%c'\00"
@.str.17 = [23 x i8] c"3rd Purch. Family Code\00"
@.str.18 = [26 x i8] c"3rd Purch. GS1 Co. Prefix\00"
@.str.19 = [16 x i8] c"Expiration Date\00"
@.str.20 = [11 x i8] c"Start Date\00"
@.str.21 = [14 x i8] c"Serial Number\00"
@.str.22 = [12 x i8] c"Retailer ID\00"
@.str.23 = [16 x i8] c"Save Value Code\00"
@.str.24 = [29 x i8] c"Invalid Save Value Code '%c'\00"
@.str.25 = [22 x i8] c"Save Value Applies To\00"
@.str.26 = [35 x i8] c"Invalid Save Value Applies To '%c'\00"
@.str.27 = [18 x i8] c"Store Coupon Flag\00"
@.str.28 = [20 x i8] c"Don't Multiply Flag\00"
@.str.29 = [33 x i8] c"Invalid Don't Multiply Flag '%c'\00"
@.str.30 = [28 x i8] c"Non-numeric Data Field '%c'\00"
@.str.31 = [24 x i8] c"Invalid Data Field '%c'\00"
define i32 @couponcode(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32* %5, i32* %6, i8* %7, i32 %8) {
%10 = alloca i32
%11 = sub nsw i32 %1, %2
%12 = icmp slt i32 %11, %3
br i1 %12, label %213, label %13
13: ; preds = %9
%14 = icmp ne i32 %11, 0
%15 = icmp slt i32 %11, 21
%16 = and i1 %14, %15
br i1 %16, label %17, label %18
17: ; preds = %13
store i32 4, i32* %5
br label %213
18: ; preds = %13
%19 = icmp eq i32 %8, 0
%20 = select i1 %19, i1 %14, i1 false
br i1 %20, label %21, label %213
21: ; preds = %18
%22 = sext i32 %2 to i64
%23 = getelementptr inbounds i8, i8* %0, i64 %22
%24 = bitcast i32* %10 to i8*
%25 = tail call i8* @coupon_vli(i8* %0, i32 %1, i8* %23, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 6, i32 0, i32 6, i32 0, i32* %5, i32* %6, i8* %7)
%26 = icmp eq i8* %25, null
br i1 %26, label %207, label %27
27: ; preds = %21
%28 = tail call i8* @coupon_val(i8* %0, i32 %1, i8* %25, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 6, i32* null, i32* %5, i32* %6, i8* %7)
%29 = icmp eq i8* %28, null
br i1 %29, label %208, label %30
30: ; preds = %27
%31 = tail call i8* @coupon_vli(i8* %0, i32 %1, i8* %28, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 0, i32 1, i32 5, i32 0, i32* %5, i32* %6, i8* %7)
%32 = icmp eq i8* %31, null
br i1 %32, label %209, label %33
33: ; preds = %30
%34 = tail call i8* @coupon_vli(i8* %0, i32 %1, i8* %31, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 0, i32 1, i32 5, i32 0, i32* %5, i32* %6, i8* %7)
%35 = icmp eq i8* %34, null
br i1 %35, label %210, label %36
36: ; preds = %33
%37 = call i8* @coupon_val(i8* %0, i32 %1, i8* %34, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 1, i32* %10, i32* %5, i32* %6, i8* %7)
%38 = icmp eq i8* %37, null
br i1 %38, label %211, label %39
39: ; preds = %36
%40 = load i32, i32* %10
%41 = add i32 %40, -6
%42 = icmp ult i32 %41, 3
br i1 %42, label %43, label %52
43: ; preds = %39
store i32 3, i32* %5
%44 = getelementptr inbounds i8, i8* %37, i64 -1
%45 = ptrtoint i8* %44 to i64
%46 = ptrtoint i8* %0 to i64
%47 = sub i64 %45, %46
%48 = trunc i64 %47 to i32
%49 = add i32 %48, 1
store i32 %49, i32* %6
%50 = load i8, i8* %44
%51 = call i32 @sprintf(i8* dereferenceable(1) %7, i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i8 zeroext %50)
br label %213
52: ; preds = %39
%53 = call i8* @coupon_val(i8* %0, i32 %1, i8* %37, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i32 3, i32* null, i32* %5, i32* %6, i8* %7)
%54 = icmp eq i8* %53, null
br i1 %54, label %212, label %55
55: ; preds = %52
%56 = ptrtoint i8* %0 to i64
%57 = sext i32 %1 to i64
%58 = ptrtoint i8* %53 to i64
%59 = sub i64 %58, %56
%60 = icmp slt i64 %59, %57
br i1 %60, label %61, label %200
61: ; preds = %55, %195
%62 = phi i64 [ %198, %195 ], [ %59, %55 ]
%63 = phi i8* [ %196, %195 ], [ %53, %55 ]
%64 = call i32 @to_int(i8* %63, i32 1)
%65 = getelementptr inbounds i8, i8* %63, i64 1
switch i32 %64, label %190 [
i32 1, label %66
i32 2, label %100
i32 3, label %122
i32 4, label %132
i32 5, label %142
i32 6, label %145
i32 9, label %148
]
66: ; preds = %61
%67 = call i8* @coupon_val(i8* %0, i32 %1, i8* %65, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i32 1, i32* %10, i32* %5, i32* %6, i8* %7)
%68 = icmp eq i8* %67, null
br i1 %68, label %206, label %69
69: ; preds = %66
%70 = load i32, i32* %10
%71 = icmp sgt i32 %70, 3
br i1 %71, label %72, label %78
72: ; preds = %69
store i32 3, i32* %5
%73 = getelementptr inbounds i8, i8* %67, i64 -1
%74 = ptrtoint i8* %73 to i64
%75 = sub i64 %74, %56
%76 = trunc i64 %75 to i32
%77 = add i32 %76, 1
store i32 %77, i32* %6
br label %201
78: ; preds = %69
%79 = call i8* @coupon_vli(i8* %0, i32 %1, i8* %67, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), i32 0, i32 1, i32 5, i32 0, i32* %5, i32* %6, i8* %7)
%80 = icmp eq i8* %79, null
br i1 %80, label %206, label %81
81: ; preds = %78
%82 = call i8* @coupon_val(i8* %0, i32 %1, i8* %79, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0), i32 1, i32* %10, i32* %5, i32* %6, i8* %7)
%83 = icmp eq i8* %82, null
br i1 %83, label %206, label %84
84: ; preds = %81
%85 = load i32, i32* %10
%86 = add i32 %85, -5
%87 = icmp ult i32 %86, 4
br i1 %87, label %88, label %94
88: ; preds = %84
store i32 3, i32* %5
%89 = getelementptr inbounds i8, i8* %82, i64 -1
%90 = ptrtoint i8* %89 to i64
%91 = sub i64 %90, %56
%92 = trunc i64 %91 to i32
%93 = add i32 %92, 1
store i32 %93, i32* %6
br label %201
94: ; preds = %84
%95 = call i8* @coupon_val(i8* %0, i32 %1, i8* %82, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.12, i64 0, i64 0), i32 3, i32* null, i32* %5, i32* %6, i8* %7)
%96 = icmp eq i8* %95, null
br i1 %96, label %206, label %97
97: ; preds = %94
%98 = call i8* @coupon_vli(i8* %0, i32 %1, i8* %95, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.13, i64 0, i64 0), i32 6, i32 0, i32 6, i32 1, i32* %5, i32* %6, i8* %7)
%99 = icmp eq i8* %98, null
br i1 %99, label %206, label %195
100: ; preds = %61
%101 = call i8* @coupon_vli(i8* %0, i32 %1, i8* %65, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.14, i64 0, i64 0), i32 0, i32 1, i32 5, i32 0, i32* %5, i32* %6, i8* %7)
%102 = icmp eq i8* %101, null
br i1 %102, label %206, label %103
103: ; preds = %100
%104 = call i8* @coupon_val(i8* %0, i32 %1, i8* %101, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.15, i64 0, i64 0), i32 1, i32* %10, i32* %5, i32* %6, i8* %7)
%105 = icmp eq i8* %104, null
br i1 %105, label %206, label %106
106: ; preds = %103
%107 = load i32, i32* %10
%108 = add i32 %107, -5
%109 = icmp ult i32 %108, 4
br i1 %109, label %110, label %116
110: ; preds = %106
store i32 3, i32* %5
%111 = getelementptr inbounds i8, i8* %104, i64 -1
%112 = ptrtoint i8* %111 to i64
%113 = sub i64 %112, %56
%114 = trunc i64 %113 to i32
%115 = add i32 %114, 1
store i32 %115, i32* %6
br label %201
116: ; preds = %106
%117 = call i8* @coupon_val(i8* %0, i32 %1, i8* %104, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.17, i64 0, i64 0), i32 3, i32* null, i32* %5, i32* %6, i8* %7)
%118 = icmp eq i8* %117, null
br i1 %118, label %206, label %119
119: ; preds = %116
%120 = call i8* @coupon_vli(i8* %0, i32 %1, i8* %117, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.18, i64 0, i64 0), i32 6, i32 0, i32 6, i32 1, i32* %5, i32* %6, i8* %7)
%121 = icmp eq i8* %120, null
br i1 %121, label %206, label %195
122: ; preds = %61
%123 = call i8* @coupon_val(i8* %0, i32 %1, i8* %65, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.19, i64 0, i64 0), i32 6, i32* null, i32* %5, i32* %6, i8* %7)
%124 = icmp eq i8* %123, null
br i1 %124, label %206, label %125
125: ; preds = %122
%126 = getelementptr inbounds i8, i8* %123, i64 -6
%127 = ptrtoint i8* %126 to i64
%128 = sub i64 %127, %56
%129 = trunc i64 %128 to i32
%130 = call i32 @yymmd0(i8* %0, i32 %1, i32 %129, i32 6, i32 6, i32* %5, i32* %6, i8* %7, i32 0)
%131 = icmp eq i32 %130, 0
br i1 %131, label %206, label %195
132: ; preds = %61
%133 = call i8* @coupon_val(i8* %0, i32 %1, i8* %65, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.20, i64 0, i64 0), i32 6, i32* null, i32* %5, i32* %6, i8* %7)
%134 = icmp eq i8* %133, null
br i1 %134, label %206, label %135
135: ; preds = %132
%136 = getelementptr inbounds i8, i8* %133, i64 -6
%137 = ptrtoint i8* %136 to i64
%138 = sub i64 %137, %56
%139 = trunc i64 %138 to i32
%140 = call i32 @yymmd0(i8* %0, i32 %1, i32 %139, i32 6, i32 6, i32* %5, i32* %6, i8* %7, i32 0)
%141 = icmp eq i32 %140, 0
br i1 %141, label %206, label %195
142: ; preds = %61
%143 = call i8* @coupon_vli(i8* %0, i32 %1, i8* %65, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.21, i64 0, i64 0), i32 6, i32 0, i32 9, i32 0, i32* %5, i32* %6, i8* %7)
%144 = icmp eq i8* %143, null
br i1 %144, label %206, label %195
145: ; preds = %61
%146 = call i8* @coupon_vli(i8* %0, i32 %1, i8* %65, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.22, i64 0, i64 0), i32 6, i32 1, i32 7, i32 0, i32* %5, i32* %6, i8* %7)
%147 = icmp eq i8* %146, null
br i1 %147, label %206, label %195
148: ; preds = %61
%149 = call i8* @coupon_val(i8* %0, i32 %1, i8* %65, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.23, i64 0, i64 0), i32 1, i32* %10, i32* %5, i32* %6, i8* %7)
%150 = icmp eq i8* %149, null
br i1 %150, label %206, label %151
151: ; preds = %148
%152 = load i32, i32* %10
%153 = add i32 %152, -3
%154 = icmp ult i32 %153, 2
%155 = icmp sgt i32 %152, 6
%156 = or i1 %155, %154
br i1 %156, label %157, label %163
157: ; preds = %151
store i32 3, i32* %5
%158 = getelementptr inbounds i8, i8* %149, i64 -1
%159 = ptrtoint i8* %158 to i64
%160 = sub i64 %159, %56
%161 = trunc i64 %160 to i32
%162 = add i32 %161, 1
store i32 %162, i32* %6
br label %201
163: ; preds = %151
%164 = call i8* @coupon_val(i8* %0, i32 %1, i8* %149, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.25, i64 0, i64 0), i32 1, i32* %10, i32* %5, i32* %6, i8* %7)
%165 = icmp eq i8* %164, null
br i1 %165, label %206, label %166
166: ; preds = %163
%167 = load i32, i32* %10
%168 = icmp sgt i32 %167, 2
br i1 %168, label %169, label %175
169: ; preds = %166
store i32 3, i32* %5
%170 = getelementptr inbounds i8, i8* %164, i64 -1
%171 = ptrtoint i8* %170 to i64
%172 = sub i64 %171, %56
%173 = trunc i64 %172 to i32
%174 = add i32 %173, 1
store i32 %174, i32* %6
br label %201
175: ; preds = %166
%176 = call i8* @coupon_val(i8* %0, i32 %1, i8* %164, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.27, i64 0, i64 0), i32 1, i32* null, i32* %5, i32* %6, i8* %7)
%177 = icmp eq i8* %176, null
br i1 %177, label %206, label %178
178: ; preds = %175
%179 = call i8* @coupon_val(i8* %0, i32 %1, i8* %176, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.28, i64 0, i64 0), i32 1, i32* %10, i32* %5, i32* %6, i8* %7)
%180 = icmp eq i8* %179, null
br i1 %180, label %206, label %181
181: ; preds = %178
%182 = load i32, i32* %10
%183 = icmp sgt i32 %182, 1
br i1 %183, label %184, label %195
184: ; preds = %181
store i32 3, i32* %5
%185 = getelementptr inbounds i8, i8* %179, i64 -1
%186 = ptrtoint i8* %185 to i64
%187 = sub i64 %186, %56
%188 = trunc i64 %187 to i32
%189 = add i32 %188, 1
store i32 %189, i32* %6
br label %201
190: ; preds = %61
store i32 3, i32* %5
%191 = trunc i64 %62 to i32
%192 = add i32 %191, 1
store i32 %192, i32* %6
%193 = icmp slt i32 %64, 0
%194 = select i1 %193, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.30, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.31, i64 0, i64 0)
br label %201
195: ; preds = %97, %125, %142, %181, %145, %135, %119
%196 = phi i8* [ %98, %97 ], [ %120, %119 ], [ %123, %125 ], [ %133, %135 ], [ %143, %142 ], [ %146, %145 ], [ %179, %181 ]
%197 = ptrtoint i8* %196 to i64
%198 = sub i64 %197, %56
%199 = icmp slt i64 %198, %57
br i1 %199, label %61, label %200
200: ; preds = %195, %55
br label %213
201: ; preds = %72, %88, %110, %157, %169, %184, %190
%202 = phi i8* [ %63, %190 ], [ %185, %184 ], [ %170, %169 ], [ %158, %157 ], [ %111, %110 ], [ %89, %88 ], [ %73, %72 ]
%203 = phi i8* [ %194, %190 ], [ getelementptr inbounds ([33 x i8], [33 x i8]* @.str.29, i64 0, i64 0), %184 ], [ getelementptr inbounds ([35 x i8], [35 x i8]* @.str.26, i64 0, i64 0), %169 ], [ getelementptr inbounds ([29 x i8], [29 x i8]* @.str.24, i64 0, i64 0), %157 ], [ getelementptr inbounds ([34 x i8], [34 x i8]* @.str.16, i64 0, i64 0), %110 ], [ getelementptr inbounds ([34 x i8], [34 x i8]* @.str.11, i64 0, i64 0), %88 ], [ getelementptr inbounds ([36 x i8], [36 x i8]* @.str.8, i64 0, i64 0), %72 ]
%204 = load i8, i8* %202
%205 = call i32 @sprintf(i8* dereferenceable(1) %7, i8* dereferenceable(1) %203, i8 zeroext %204)
br label %206
206: ; preds = %66, %78, %81, %94, %97, %100, %103, %116, %119, %122, %125, %132, %135, %142, %145, %148, %163, %175, %178, %201
br label %213
207: ; preds = %21
br label %213
208: ; preds = %27
br label %213
209: ; preds = %30
br label %213
210: ; preds = %33
br label %213
211: ; preds = %36
br label %213
212: ; preds = %52
br label %213
213: ; preds = %18, %200, %212, %211, %210, %209, %208, %207, %43, %206, %9, %17
%214 = phi i32 [ 0, %17 ], [ 0, %9 ], [ 0, %206 ], [ 0, %43 ], [ 0, %207 ], [ 0, %208 ], [ 0, %209 ], [ 0, %210 ], [ 0, %211 ], [ 0, %212 ], [ 1, %200 ], [ 1, %18 ]
ret i32 %214
}