#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 */
scalar_t__ couponcode(unsigned char const *, int const, int /*<<< orphan*/, int,
                      int, int *, int *, char *, int);
scalar_t__ cset82(unsigned char const *, int const, int /*<<< orphan*/, int,
                  int, int *, int *, char *);
int x1__70_couponcode(const unsigned char *data, const int data_len,
                      int *p_err_no, int *p_err_posn, char err_msg[50]) {
  return data_len >= 1 && data_len <= 70 &&
         couponcode(data, data_len, 0, 1, 70, p_err_no, p_err_posn, err_msg,
                    1) &&
         cset82(data, data_len, 0, 1, 70, p_err_no, p_err_posn, err_msg) &&
         couponcode(data, data_len, 0, 1, 70, p_err_no, p_err_posn, err_msg, 0);
}


x86 assembly (clang, -O0):
<x1__70_couponcode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
xor    %eax,%eax
cmpl   $0x1,-0xc(%rbp)
mov    %al,-0x29(%rbp)
jl     1221 <x1__70_couponcode+0x101>
xor    %eax,%eax
cmpl   $0x46,-0xc(%rbp)
mov    %al,-0x29(%rbp)
jg     1221 <x1__70_couponcode+0x101>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%r9
mov    -0x20(%rbp),%r10
mov    -0x28(%rbp),%rax
xor    %edx,%edx
mov    $0x1,%ecx
mov    $0x46,%r8d
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
movl   $0x1,0x10(%rsp)
call   1030 <couponcode@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x29(%rbp)
je     1221 <x1__70_couponcode+0x101>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%r9
mov    -0x20(%rbp),%r10
mov    -0x28(%rbp),%rax
xor    %edx,%edx
mov    $0x1,%ecx
mov    $0x46,%r8d
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1040 <cset82@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x29(%rbp)
je     1221 <x1__70_couponcode+0x101>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%r9
mov    -0x20(%rbp),%r10
mov    -0x28(%rbp),%rax
xor    %edx,%edx
mov    $0x1,%ecx
mov    $0x46,%r8d
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
movl   $0x0,0x10(%rsp)
call   1030 <couponcode@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<x1__70_couponcode>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%ebx
lea    -0x1(%rbx),%eax
xor    %ebp,%ebp
cmp    $0x45,%eax
ja     11cd <x1__70_couponcode+0xad>
mov    %r8,%r15
mov    %rcx,%r14
mov    %rdx,%r12
mov    %rdi,%r13
sub    $0x8,%rsp
xor    %ebp,%ebp
mov    %ebx,%esi
xor    %edx,%edx
mov    $0x1,%ecx
mov    $0x46,%r8d
mov    %r12,%r9
push   $0x1
push   %r15
push   %r14
call   1030 <couponcode@plt>
add    $0x20,%rsp
test   %rax,%rax
je     11cd <x1__70_couponcode+0xad>
xor    %ebp,%ebp
mov    %r13,%rdi
mov    %ebx,%esi
xor    %edx,%edx
mov    $0x1,%ecx
mov    $0x46,%r8d
mov    %r12,%r9
push   %r15
push   %r14
call   1040 <cset82@plt>
add    $0x10,%rsp
test   %rax,%rax
je     11cd <x1__70_couponcode+0xad>
sub    $0x8,%rsp
mov    %r13,%rdi
mov    %ebx,%esi
xor    %edx,%edx
mov    $0x1,%ecx
mov    $0x46,%r8d
mov    %r12,%r9
push   $0x0
push   %r15
push   %r14
call   1030 <couponcode@plt>
add    $0x20,%rsp
xor    %ebp,%ebp
test   %rax,%rax
setne  %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @x1__70_couponcode(i8* %0, i32 %1, i32* %2, i32* %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i8*
store i8* %0, i8** %6
store i32 %1, i32* %7
store i32* %2, i32** %8
store i32* %3, i32** %9
store i8* %4, i8** %10
%11 = load i32, i32* %7
%12 = icmp sge i32 %11, 1
br i1 %12, label %13, label %40
13: ; preds = %5
%14 = load i32, i32* %7
%15 = icmp sle i32 %14, 70
br i1 %15, label %16, label %40
16: ; preds = %13
%17 = load i8*, i8** %6
%18 = load i32, i32* %7
%19 = load i32*, i32** %8
%20 = load i32*, i32** %9
%21 = load i8*, i8** %10
%22 = call i64 @couponcode(i8* %17, i32 %18, i32 0, i32 1, i32 70, i32* %19, i32* %20, i8* %21, i32 1)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %40
24: ; preds = %16
%25 = load i8*, i8** %6
%26 = load i32, i32* %7
%27 = load i32*, i32** %8
%28 = load i32*, i32** %9
%29 = load i8*, i8** %10
%30 = call i64 @cset82(i8* %25, i32 %26, i32 0, i32 1, i32 70, i32* %27, i32* %28, i8* %29)
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %40
32: ; preds = %24
%33 = load i8*, i8** %6
%34 = load i32, i32* %7
%35 = load i32*, i32** %8
%36 = load i32*, i32** %9
%37 = load i8*, i8** %10
%38 = call i64 @couponcode(i8* %33, i32 %34, i32 0, i32 1, i32 70, i32* %35, i32* %36, i8* %37, i32 0)
%39 = icmp ne i64 %38, 0
br label %40
40: ; preds = %32, %24, %16, %13, %5
%41 = phi i1 [ false, %24 ], [ false, %16 ], [ false, %13 ], [ false, %5 ], [ %39, %32 ]
%42 = zext i1 %41 to i32
ret i32 %42
}

LLVM IR (-O2):
define i32 @x1__70_couponcode(i8* %0, i32 %1, i32* %2, i32* %3, i8* %4) {
%6 = add i32 %1, -1
%7 = icmp ult i32 %6, 70
br i1 %7, label %8, label %18
8: ; preds = %5
%9 = tail call i64 @couponcode(i8* %0, i32 %1, i32 0, i32 1, i32 70, i32* %2, i32* %3, i8* %4, i32 1)
%10 = icmp eq i64 %9, 0
br i1 %10, label %18, label %11
11: ; preds = %8
%12 = tail call i64 @cset82(i8* %0, i32 %1, i32 0, i32 1, i32 70, i32* %2, i32* %3, i8* %4)
%13 = icmp eq i64 %12, 0
br i1 %13, label %18, label %14
14: ; preds = %11
%15 = tail call i64 @couponcode(i8* %0, i32 %1, i32 0, i32 1, i32 70, i32* %2, i32* %3, i8* %4, i32 0)
%16 = icmp ne i64 %15, 0
%17 = zext i1 %16 to i32
br label %18
18: ; preds = %14, %11, %8, %5
%19 = phi i32 [ 0, %11 ], [ 0, %8 ], [ 0, %5 ], [ %17, %14 ]
ret i32 %19
}