#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 */
typedef int uint8_t;
typedef int uint64_t;
typedef int uint32_t;
typedef int uint16_t;

/* Variables and functions */
int /*<<< orphan*/ _bmo_swap_16(int *);
int /*<<< orphan*/ _bmo_swap_24(int *);
int /*<<< orphan*/ _bmo_swap_32(int *);
int /*<<< orphan*/ _bmo_swap_64(int *);
int /*<<< orphan*/ assert(int);
int main(void) {
  uint16_t word = 0xbeef;
  uint32_t dword = 0xdeadbeef;
  uint64_t qword = 0xdeadbeeff00dfeed;
  uint8_t _24bits[3] = {0xde, 0xad, 0xbe};
  _bmo_swap_16(&word);
  assert(word == 0xefbe);
  _bmo_swap_24(_24bits);
  assert(_24bits[0] == 0xbe && _24bits[1] == 0xad && _24bits[2] == 0xde);
  _bmo_swap_32(&dword);
  assert(dword == 0xefbeadde);
  _bmo_swap_64(&qword);
  assert(qword == 0xedfe0df0efbeadde);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xbeef,-0x8(%rbp)
movl   $0xdeadbeef,-0xc(%rbp)
movl   $0xf00dfeed,-0x10(%rbp)
mov    0xe85(%rip),%rax
mov    %rax,-0x1c(%rbp)
mov    0xe83(%rip),%eax
mov    %eax,-0x14(%rbp)
lea    -0x8(%rbp),%rdi
call   1030 <_bmo_swap_16@plt>
cmpl   $0xefbe,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    -0x1c(%rbp),%rdi
call   1070 <_bmo_swap_24@plt>
xor    %eax,%eax
cmpl   $0xbe,-0x1c(%rbp)
mov    %al,-0x1d(%rbp)
jne    11df <main+0x8f>
xor    %eax,%eax
cmpl   $0xad,-0x18(%rbp)
mov    %al,-0x1d(%rbp)
jne    11df <main+0x8f>
cmpl   $0xde,-0x14(%rbp)
sete   %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    -0xc(%rbp),%rdi
call   1050 <_bmo_swap_32@plt>
cmpl   $0xefbeadde,-0xc(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    -0x10(%rbp),%rdi
call   1040 <_bmo_swap_64@plt>
movslq -0x10(%rbp),%rax
movabs $0xedfe0df0efbeadde,%rcx
0d fe ed
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movl   $0xbeef,0x4(%rsp)
movl   $0xdeadbeef,(%rsp)
movl   $0xf00dfeed,0x14(%rsp)
f0
mov    0xe97(%rip),%eax
mov    %eax,0x10(%rsp)
mov    0xe84(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <_bmo_swap_16@plt>
xor    %edi,%edi
cmpl   $0xefbe,0x4(%rsp)
sete   %dil
call   1060 <assert@plt>
lea    0x8(%rsp),%rdi
call   1070 <_bmo_swap_24@plt>
mov    $0xbe,%eax
xor    0x8(%rsp),%eax
mov    $0xad,%ecx
xor    0xc(%rsp),%ecx
mov    $0xde,%edx
xor    0x10(%rsp),%edx
or     %eax,%ecx
xor    %edi,%edi
or     %ecx,%edx
sete   %dil
call   1060 <assert@plt>
mov    %rsp,%rdi
call   1050 <_bmo_swap_32@plt>
xor    %edi,%edi
cmpl   $0xefbeadde,(%rsp)
sete   %dil
call   1060 <assert@plt>
lea    0x14(%rsp),%rdi
call   1040 <_bmo_swap_64@plt>
xor    %edi,%edi
call   1060 <assert@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main._24bits = [3 x i32] [i32 222, i32 173, i32 190]
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [3 x i32]
store i32 0, i32* %1
store i32 48879, i32* %2
store i32 -559038737, i32* %3
store i32 -267518227, i32* %4
%6 = bitcast [3 x i32]* %5 to i8*
%7 = call i32 @_bmo_swap_16(i32* %2)
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, 61374
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 0
%13 = call i32 @_bmo_swap_24(i32* %12)
%14 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 0
%15 = load i32, i32* %14
%16 = icmp eq i32 %15, 190
br i1 %16, label %17, label %25
17: ; preds = %0
%18 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 1
%19 = load i32, i32* %18
%20 = icmp eq i32 %19, 173
br i1 %20, label %21, label %25
21: ; preds = %17
%22 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 2
%23 = load i32, i32* %22
%24 = icmp eq i32 %23, 222
br label %25
25: ; preds = %21, %17, %0
%26 = phi i1 [ false, %17 ], [ false, %0 ], [ %24, %21 ]
%27 = zext i1 %26 to i32
%28 = call i32 @assert(i32 %27)
%29 = call i32 @_bmo_swap_32(i32* %3)
%30 = load i32, i32* %3
%31 = icmp eq i32 %30, -272716322
%32 = zext i1 %31 to i32
%33 = call i32 @assert(i32 %32)
%34 = call i32 @_bmo_swap_64(i32* %4)
%35 = load i32, i32* %4
%36 = sext i32 %35 to i64
%37 = icmp eq i64 %36, -1297584314170561058
%38 = zext i1 %37 to i32
%39 = call i32 @assert(i32 %38)
ret i32 0
}

LLVM IR (-O2):
@__const.main._24bits = [3 x i32] [i32 222, i32 173, i32 190]
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [3 x i32]
%5 = bitcast i32* %1 to i8*
store i32 48879, i32* %1
%6 = bitcast i32* %2 to i8*
store i32 -559038737, i32* %2
%7 = bitcast i32* %3 to i8*
store i32 -267518227, i32* %3
%8 = bitcast [3 x i32]* %4 to i8*
%9 = call i32 @_bmo_swap_16(i32* %1)
%10 = load i32, i32* %1
%11 = icmp eq i32 %10, 61374
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 0
%15 = call i32 @_bmo_swap_24(i32* %14)
%16 = load i32, i32* %14
%17 = icmp eq i32 %16, 190
%18 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 1
%19 = load i32, i32* %18
%20 = icmp eq i32 %19, 173
%21 = select i1 %17, i1 %20, i1 false
%22 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 2
%23 = load i32, i32* %22
%24 = icmp eq i32 %23, 222
%25 = select i1 %21, i1 %24, i1 false
%26 = zext i1 %25 to i32
%27 = call i32 @assert(i32 %26)
%28 = call i32 @_bmo_swap_32(i32* %2)
%29 = load i32, i32* %2
%30 = icmp eq i32 %29, -272716322
%31 = zext i1 %30 to i32
%32 = call i32 @assert(i32 %31)
%33 = call i32 @_bmo_swap_64(i32* %3)
%34 = call i32 @assert(i32 0)
ret i32 0
}