#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__ iso3166(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 n3_iso3166(const unsigned char *data, const int data_len, int *p_err_no,
               int *p_err_posn, char err_msg[50]) {
  return data_len == 3 &&
         iso3166(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg, 1) &&
         numeric(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg) &&
         iso3166(data, data_len, 0, 3, 3, p_err_no, p_err_posn, err_msg, 0);
}


x86 assembly (clang, -O0):
<n3_iso3166>:
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   $0x3,-0xc(%rbp)
mov    %al,-0x29(%rbp)
jne    120c <n3_iso3166+0xec>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%r9
mov    -0x20(%rbp),%r10
mov    -0x28(%rbp),%rax
xor    %edx,%edx
mov    $0x3,%r8d
mov    %r8d,%ecx
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
movl   $0x1,0x10(%rsp)
call   1030 <iso3166@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x29(%rbp)
je     120c <n3_iso3166+0xec>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%r9
mov    -0x20(%rbp),%r10
mov    -0x28(%rbp),%rax
xor    %edx,%edx
mov    $0x3,%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     120c <n3_iso3166+0xec>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%r9
mov    -0x20(%rbp),%r10
mov    -0x28(%rbp),%rax
xor    %edx,%edx
mov    $0x3,%r8d
mov    %r8d,%ecx
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
movl   $0x0,0x10(%rsp)
call   1030 <iso3166@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):
<n3_iso3166>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
xor    %ebp,%ebp
cmp    $0x3,%esi
jne    11ce <n3_iso3166+0xae>
mov    %r8,%r15
mov    %rcx,%r14
mov    %rdx,%r12
mov    %rdi,%rbx
sub    $0x8,%rsp
xor    %ebp,%ebp
mov    $0x3,%esi
xor    %edx,%edx
mov    $0x3,%ecx
mov    $0x3,%r8d
mov    %r12,%r9
push   $0x1
push   %r15
push   %r14
call   1030 <iso3166@plt>
add    $0x20,%rsp
test   %rax,%rax
je     11ce <n3_iso3166+0xae>
xor    %ebp,%ebp
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %edx,%edx
mov    $0x3,%ecx
mov    $0x3,%r8d
mov    %r12,%r9
push   %r15
push   %r14
call   1040 <numeric@plt>
add    $0x10,%rsp
test   %rax,%rax
je     11ce <n3_iso3166+0xae>
sub    $0x8,%rsp
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %edx,%edx
mov    $0x3,%ecx
mov    $0x3,%r8d
mov    %r12,%r9
push   $0x0
push   %r15
push   %r14
call   1030 <iso3166@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 @n3_iso3166(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, 3
br i1 %12, label %13, label %37
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 @iso3166(i8* %14, i32 %15, i32 0, i32 3, i32 3, i32* %16, i32* %17, i8* %18, i32 1)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %37
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 @numeric(i8* %22, i32 %23, i32 0, i32 3, i32 3, i32* %24, i32* %25, i8* %26)
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %37
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 @iso3166(i8* %30, i32 %31, i32 0, i32 3, i32 3, i32* %32, i32* %33, i8* %34, i32 0)
%36 = icmp ne i64 %35, 0
br label %37
37: ; preds = %29, %21, %13, %5
%38 = phi i1 [ false, %21 ], [ false, %13 ], [ false, %5 ], [ %36, %29 ]
%39 = zext i1 %38 to i32
ret i32 %39
}

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