#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 */
int POSH_SwapU16(int);
int POSH_SwapU32(int);
scalar_t__ s_testBigEndian();
const char *s_testEndianess(void) {
  if (s_testBigEndian() != 0) {
    return "*ERROR: POSH compile time endianess does not match run-time "
           "endianess verification.  Please report this to "
           "poshlib@poshlib.org!\n";
  }
  if (((0x11223344L) != 0x11223344L) ||
      (POSH_SwapU32(0x11223344L) != 0x44332211L) || ((0x1234) != 0x1234) ||
      (POSH_SwapU16(0x1234) != 0x3412)) {
    return "*ERROR: POSH endianess macro selection failed.  Please report this "
           "to poshlib@poshlib.org!\n";
  }
  return 0;
}


x86 assembly (clang, -O0):
<s_testEndianess>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <s_testBigEndian@plt>
cmp    $0x0,%rax
je     1159 <s_testEndianess+0x29>
lea    0xeb0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    119e <s_testEndianess+0x6e>
mov    $0x11223344,%edi
call   1030 <POSH_SwapU32@plt>
cltq
cmp    $0x44332211,%rax
jne    1186 <s_testEndianess+0x56>
mov    $0x1234,%edi
call   1040 <POSH_SwapU16@plt>
cmp    $0x3412,%eax
je     1196 <s_testEndianess+0x66>
lea    0xef4(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    119e <s_testEndianess+0x6e>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<s_testEndianess>:
push   %rax
xor    %eax,%eax
call   1050 <s_testBigEndian@plt>
test   %rax,%rax
je     1146 <s_testEndianess+0x16>
lea    0xebc(%rip),%rax
pop    %rcx
ret
mov    $0x11223344,%edi
call   1030 <POSH_SwapU32@plt>
cmp    $0x44332211,%eax
jne    1178 <s_testEndianess+0x48>
mov    $0x1234,%edi
call   1040 <POSH_SwapU16@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x3412,%ecx
lea    0xf0f(%rip),%rcx
cmovne %rcx,%rax
pop    %rcx
ret
lea    0xf02(%rip),%rax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [129 x i8] c"*ERROR: POSH compile time endianess does not match run-time endianess verification. Please report this to poshlib@poshlib.org!\0A\00"
@.str.1 = [92 x i8] c"*ERROR: POSH endianess macro selection failed. Please report this to poshlib@poshlib.org!\0A\00"
define i8* @s_testEndianess() {
%1 = alloca i8*
%2 = call i64 (...) @s_testBigEndian()
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %0
store i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), i8** %1
br label %14
5: ; preds = %0
%6 = call i32 @POSH_SwapU32(i32 287454020)
%7 = sext i32 %6 to i64
%8 = icmp ne i64 %7, 1144201745
br i1 %8, label %12, label %9
9: ; preds = %5
%10 = call i32 @POSH_SwapU16(i32 4660)
%11 = icmp ne i32 %10, 13330
br i1 %11, label %12, label %13
12: ; preds = %9, %5
store i8* getelementptr inbounds ([92 x i8], [92 x i8]* @.str.1, i64 0, i64 0), i8** %1
br label %14
13: ; preds = %9
store i8* null, i8** %1
br label %14
14: ; preds = %13, %12, %4
%15 = load i8*, i8** %1
ret i8* %15
}

LLVM IR (-O2):
@.str = [129 x i8] c"*ERROR: POSH compile time endianess does not match run-time endianess verification. Please report this to poshlib@poshlib.org!\0A\00"
@.str.1 = [92 x i8] c"*ERROR: POSH endianess macro selection failed. Please report this to poshlib@poshlib.org!\0A\00"
define i8* @s_testEndianess() {
%1 = tail call i64 (...) @s_testBigEndian()
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %10
3: ; preds = %0
%4 = tail call i32 @POSH_SwapU32(i32 287454020)
%5 = icmp eq i32 %4, 1144201745
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = tail call i32 @POSH_SwapU16(i32 4660)
%8 = icmp eq i32 %7, 13330
%9 = select i1 %8, i8* null, i8* getelementptr inbounds ([92 x i8], [92 x i8]* @.str.1, i64 0, i64 0)
br label %10
10: ; preds = %6, %3, %0
%11 = phi i8* [ getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0), %0 ], [ getelementptr inbounds ([92 x i8], [92 x i8]* @.str.1, i64 0, i64 0), %3 ], [ %9, %6 ]
ret i8* %11
}