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


x86 assembly (clang, -O0):
<n14_csum_n4_pieceoftotal>:
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   $0x12,-0xc(%rbp)
mov    %al,-0x29(%rbp)
jne    12f1 <n14_csum_n4_pieceoftotal+0x1c1>
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     12f1 <n14_csum_n4_pieceoftotal+0x1c1>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%r9
mov    -0x20(%rbp),%r10
mov    -0x28(%rbp),%rax
mov    $0xe,%edx
mov    $0x4,%r8d
mov    %r8d,%ecx
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
movl   $0x1,0x10(%rsp)
call   1050 <pieceoftotal@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x29(%rbp)
je     12f1 <n14_csum_n4_pieceoftotal+0x1c1>
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   1040 <numeric@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x29(%rbp)
je     12f1 <n14_csum_n4_pieceoftotal+0x1c1>
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     12f1 <n14_csum_n4_pieceoftotal+0x1c1>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%r9
mov    -0x20(%rbp),%r10
mov    -0x28(%rbp),%rax
mov    $0xe,%edx
mov    $0x4,%r8d
mov    %r8d,%ecx
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1040 <numeric@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x29(%rbp)
je     12f1 <n14_csum_n4_pieceoftotal+0x1c1>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%r9
mov    -0x20(%rbp),%r10
mov    -0x28(%rbp),%rax
mov    $0xe,%edx
mov    $0x4,%r8d
xor    %ecx,%ecx
mov    %r8d,%ecx
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
movl   $0x0,0x10(%rsp)
call   1050 <pieceoftotal@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_n4_pieceoftotal>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
xor    %ebp,%ebp
cmp    $0x12,%esi
jne    127f <n14_csum_n4_pieceoftotal+0x14f>
mov    %r8,%r15
mov    %rcx,%r14
mov    %rdx,%r12
mov    %rdi,%rbx
sub    $0x8,%rsp
xor    %ebp,%ebp
mov    $0x12,%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     127f <n14_csum_n4_pieceoftotal+0x14f>
sub    $0x8,%rsp
mov    %rbx,%rdi
mov    $0x12,%esi
mov    $0xe,%edx
mov    $0x4,%ecx
mov    $0x4,%r8d
mov    %r12,%r9
push   $0x1
push   %r15
push   %r14
call   1050 <pieceoftotal@plt>
add    $0x20,%rsp
test   %rax,%rax
je     127f <n14_csum_n4_pieceoftotal+0x14f>
xor    %ebp,%ebp
mov    %rbx,%rdi
mov    $0x12,%esi
xor    %edx,%edx
mov    $0xe,%ecx
mov    $0xe,%r8d
mov    %r12,%r9
push   %r15
push   %r14
call   1040 <numeric@plt>
add    $0x10,%rsp
test   %rax,%rax
je     127f <n14_csum_n4_pieceoftotal+0x14f>
sub    $0x8,%rsp
xor    %ebp,%ebp
mov    %rbx,%rdi
mov    $0x12,%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     127f <n14_csum_n4_pieceoftotal+0x14f>
mov    %rbx,%rdi
mov    $0x12,%esi
mov    $0xe,%edx
mov    $0x4,%ecx
mov    $0x4,%r8d
mov    %r12,%r9
push   %r15
push   %r14
call   1040 <numeric@plt>
add    $0x10,%rsp
test   %rax,%rax
je     127f <n14_csum_n4_pieceoftotal+0x14f>
sub    $0x8,%rsp
mov    %rbx,%rdi
mov    $0x12,%esi
mov    $0xe,%edx
mov    $0x4,%ecx
mov    $0x4,%r8d
mov    %r12,%r9
push   $0x0
push   %r15
push   %r14
call   1050 <pieceoftotal@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_n4_pieceoftotal(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, 18
br i1 %12, label %13, label %61
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 %61
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 @pieceoftotal(i8* %22, i32 %23, i32 14, i32 4, i32 4, i32* %24, i32* %25, i8* %26, i32 1)
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %61
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 %61
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 %61
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 @numeric(i8* %46, i32 %47, i32 14, i32 4, i32 4, i32* %48, i32* %49, i8* %50)
%52 = icmp ne i64 %51, 0
br i1 %52, label %53, label %61
53: ; preds = %45
%54 = load i8*, i8** %6
%55 = load i32, i32* %7
%56 = load i32*, i32** %8
%57 = load i32*, i32** %9
%58 = load i8*, i8** %10
%59 = call i64 @pieceoftotal(i8* %54, i32 %55, i32 14, i32 4, i32 4, i32* %56, i32* %57, i8* %58, i32 0)
%60 = icmp ne i64 %59, 0
br label %61
61: ; preds = %53, %45, %37, %29, %21, %13, %5
%62 = phi i1 [ false, %45 ], [ false, %37 ], [ false, %29 ], [ false, %21 ], [ false, %13 ], [ false, %5 ], [ %60, %53 ]
%63 = zext i1 %62 to i32
ret i32 %63
}

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