#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__ csum(unsigned char const *, int const, int /*<<< orphan*/, int, int,
                int *, int *, char *, int);
scalar_t__ key(unsigned char const *, int const, int /*<<< orphan*/, int, int,
               int *, int *, char *, int);
scalar_t__ numeric(unsigned char const *, int const, int /*<<< orphan*/, int,
                   int, int *, int *, char *);
int n14_csum_key(const unsigned char *data, const int data_len, int *p_err_no,
                 int *p_err_posn, char err_msg[50]) {
  return data_len == 14 &&
         csum(data, data_len, 0, 14, 14, p_err_no, p_err_posn, err_msg, 1) &&
         key(data, data_len, 0, 14, 14, p_err_no, p_err_posn, err_msg, 1) &&
         numeric(data, data_len, 0, 14, 14, p_err_no, p_err_posn, err_msg) &&
         csum(data, data_len, 0, 14, 14, p_err_no, p_err_posn, err_msg, 0) &&
         key(data, data_len, 0, 14, 14, p_err_no, p_err_posn, err_msg, 0);
}


x86 assembly (clang, -O0):
<n14_csum_key>:
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   $0xe,-0xc(%rbp)
mov    %al,-0x29(%rbp)
jne    12a8 <n14_csum_key+0x178>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%r9
mov    -0x20(%rbp),%r10
mov    -0x28(%rbp),%rax
xor    %edx,%edx
mov    $0xe,%r8d
mov    %r8d,%ecx
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
movl   $0x1,0x10(%rsp)
call   1030 <csum@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x29(%rbp)
je     12a8 <n14_csum_key+0x178>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%r9
mov    -0x20(%rbp),%r10
mov    -0x28(%rbp),%rax
xor    %edx,%edx
mov    $0xe,%r8d
mov    %r8d,%ecx
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
movl   $0x1,0x10(%rsp)
call   1040 <key@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x29(%rbp)
je     12a8 <n14_csum_key+0x178>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%r9
mov    -0x20(%rbp),%r10
mov    -0x28(%rbp),%rax
xor    %edx,%edx
mov    $0xe,%r8d
mov    %r8d,%ecx
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1050 <numeric@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x29(%rbp)
je     12a8 <n14_csum_key+0x178>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%r9
mov    -0x20(%rbp),%r10
mov    -0x28(%rbp),%rax
xor    %edx,%edx
mov    $0xe,%r8d
mov    %r8d,%ecx
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
movl   $0x0,0x10(%rsp)
call   1030 <csum@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x29(%rbp)
je     12a8 <n14_csum_key+0x178>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%r9
mov    -0x20(%rbp),%r10
mov    -0x28(%rbp),%rax
xor    %edx,%edx
mov    $0xe,%r8d
mov    %r8d,%ecx
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
movl   $0x0,0x10(%rsp)
call   1040 <key@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):
<n14_csum_key>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
xor    %ebp,%ebp
cmp    $0xe,%esi
jne    124a <n14_csum_key+0x11a>
mov    %r8,%r15
mov    %rcx,%r14
mov    %rdx,%r12
mov    %rdi,%rbx
sub    $0x8,%rsp
xor    %ebp,%ebp
mov    $0xe,%esi
xor    %edx,%edx
mov    $0xe,%ecx
mov    $0xe,%r8d
mov    %r12,%r9
push   $0x1
push   %r15
push   %r14
call   1030 <csum@plt>
add    $0x20,%rsp
test   %rax,%rax
je     124a <n14_csum_key+0x11a>
sub    $0x8,%rsp
xor    %ebp,%ebp
mov    %rbx,%rdi
mov    $0xe,%esi
xor    %edx,%edx
mov    $0xe,%ecx
mov    $0xe,%r8d
mov    %r12,%r9
push   $0x1
push   %r15
push   %r14
call   1040 <key@plt>
add    $0x20,%rsp
test   %rax,%rax
je     124a <n14_csum_key+0x11a>
xor    %ebp,%ebp
mov    %rbx,%rdi
mov    $0xe,%esi
xor    %edx,%edx
mov    $0xe,%ecx
mov    $0xe,%r8d
mov    %r12,%r9
push   %r15
push   %r14
call   1050 <numeric@plt>
add    $0x10,%rsp
test   %rax,%rax
je     124a <n14_csum_key+0x11a>
sub    $0x8,%rsp
xor    %ebp,%ebp
mov    %rbx,%rdi
mov    $0xe,%esi
xor    %edx,%edx
mov    $0xe,%ecx
mov    $0xe,%r8d
mov    %r12,%r9
push   $0x0
push   %r15
push   %r14
call   1030 <csum@plt>
add    $0x20,%rsp
test   %rax,%rax
je     124a <n14_csum_key+0x11a>
sub    $0x8,%rsp
mov    %rbx,%rdi
mov    $0xe,%esi
xor    %edx,%edx
mov    $0xe,%ecx
mov    $0xe,%r8d
mov    %r12,%r9
push   $0x0
push   %r15
push   %r14
call   1040 <key@plt>
add    $0x20,%rsp
xor    %ebp,%ebp
test   %rax,%rax
setne  %bpl
mov    %ebp,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @n14_csum_key(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 eq i32 %11, 14
br i1 %12, label %13, label %53
13: ; preds = %5
%14 = load i8*, i8** %6
%15 = load i32, i32* %7
%16 = load i32*, i32** %8
%17 = load i32*, i32** %9
%18 = load i8*, i8** %10
%19 = call i64 @csum(i8* %14, i32 %15, i32 0, i32 14, i32 14, i32* %16, i32* %17, i8* %18, i32 1)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %53
21: ; preds = %13
%22 = load i8*, i8** %6
%23 = load i32, i32* %7
%24 = load i32*, i32** %8
%25 = load i32*, i32** %9
%26 = load i8*, i8** %10
%27 = call i64 @key(i8* %22, i32 %23, i32 0, i32 14, i32 14, i32* %24, i32* %25, i8* %26, i32 1)
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %53
29: ; preds = %21
%30 = load i8*, i8** %6
%31 = load i32, i32* %7
%32 = load i32*, i32** %8
%33 = load i32*, i32** %9
%34 = load i8*, i8** %10
%35 = call i64 @numeric(i8* %30, i32 %31, i32 0, i32 14, i32 14, i32* %32, i32* %33, i8* %34)
%36 = icmp ne i64 %35, 0
br i1 %36, label %37, label %53
37: ; preds = %29
%38 = load i8*, i8** %6
%39 = load i32, i32* %7
%40 = load i32*, i32** %8
%41 = load i32*, i32** %9
%42 = load i8*, i8** %10
%43 = call i64 @csum(i8* %38, i32 %39, i32 0, i32 14, i32 14, i32* %40, i32* %41, i8* %42, i32 0)
%44 = icmp ne i64 %43, 0
br i1 %44, label %45, label %53
45: ; preds = %37
%46 = load i8*, i8** %6
%47 = load i32, i32* %7
%48 = load i32*, i32** %8
%49 = load i32*, i32** %9
%50 = load i8*, i8** %10
%51 = call i64 @key(i8* %46, i32 %47, i32 0, i32 14, i32 14, i32* %48, i32* %49, i8* %50, i32 0)
%52 = icmp ne i64 %51, 0
br label %53
53: ; preds = %45, %37, %29, %21, %13, %5
%54 = phi i1 [ false, %37 ], [ false, %29 ], [ false, %21 ], [ false, %13 ], [ false, %5 ], [ %52, %45 ]
%55 = zext i1 %54 to i32
ret i32 %55
}

LLVM IR (-O2):
define i32 @n14_csum_key(i8* %0, i32 %1, i32* %2, i32* %3, i8* %4) {
%6 = icmp eq i32 %1, 14
br i1 %6, label %7, label %23
7: ; preds = %5
%8 = tail call i64 @csum(i8* %0, i32 14, i32 0, i32 14, i32 14, i32* %2, i32* %3, i8* %4, i32 1)
%9 = icmp eq i64 %8, 0
br i1 %9, label %23, label %10
10: ; preds = %7
%11 = tail call i64 @key(i8* %0, i32 14, i32 0, i32 14, i32 14, i32* %2, i32* %3, i8* %4, i32 1)
%12 = icmp eq i64 %11, 0
br i1 %12, label %23, label %13
13: ; preds = %10
%14 = tail call i64 @numeric(i8* %0, i32 14, i32 0, i32 14, i32 14, i32* %2, i32* %3, i8* %4)
%15 = icmp eq i64 %14, 0
br i1 %15, label %23, label %16
16: ; preds = %13
%17 = tail call i64 @csum(i8* %0, i32 14, i32 0, i32 14, i32 14, i32* %2, i32* %3, i8* %4, i32 0)
%18 = icmp eq i64 %17, 0
br i1 %18, label %23, label %19
19: ; preds = %16
%20 = tail call i64 @key(i8* %0, i32 14, i32 0, i32 14, i32 14, i32* %2, i32* %3, i8* %4, i32 0)
%21 = icmp ne i64 %20, 0
%22 = zext i1 %21 to i32
br label %23
23: ; preds = %19, %16, %13, %10, %7, %5
%24 = phi i32 [ 0, %16 ], [ 0, %13 ], [ 0, %10 ], [ 0, %7 ], [ 0, %5 ], [ %22, %19 ]
ret i32 %24
}