#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 bswap_16(int);
int bswap_32(int);
int bswap_64(int);
int /*<<< orphan*/ puts(char *);
int wash(int);
int main(void) {
  int result = 0;
  if (bswap_16(0x1234) != 0x3412) {
    puts("bswap_16 (constant) flunked");
    result = 1;
  }
  if (bswap_32(0x12345678) != 0x78563412) {
    puts("bswap_32 (constant) flunked");
    result = 1;
  }
  if (bswap_64(0x1234567890abcdefULL) != 0xefcdab9078563412ULL) {
    puts("bswap_64 (constant) flunked");
    result = 1;
  }
  if (bswap_16(wash(0x1234)) != 0x3412) {
    puts("bswap_16 (non-constant) flunked");
    result = 1;
  }
  if (bswap_32(wash(0x12345678)) != 0x78563412) {
    puts("bswap_32 (non-constant) flunked");
    result = 1;
  }
  if (bswap_64(wash(0x1234567890abcdefULL)) != 0xefcdab9078563412ULL) {
    puts("bswap_64 (non-constant) flunked");
    result = 1;
  }
  return result;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x1234,%edi
call   1070 <bswap_16@plt>
cmp    $0x3412,%eax
je     118e <main+0x3e>
lea    0xe7e(%rip),%rdi
call   1040 <puts@plt>
movl   $0x1,-0x8(%rbp)
mov    $0x12345678,%edi
call   1050 <bswap_32@plt>
cmp    $0x78563412,%eax
je     11b6 <main+0x66>
lea    0xe72(%rip),%rdi
call   1040 <puts@plt>
movl   $0x1,-0x8(%rbp)
mov    $0x90abcdef,%edi
call   1060 <bswap_64@plt>
cltq
movabs $0xefcdab9078563412,%rcx
ab cd ef
cmp    %rcx,%rax
je     11e8 <main+0x98>
lea    0xe5c(%rip),%rdi
call   1040 <puts@plt>
movl   $0x1,-0x8(%rbp)
mov    $0x1234,%edi
call   1030 <wash@plt>
mov    %eax,%edi
call   1070 <bswap_16@plt>
cmp    $0x3412,%eax
je     1217 <main+0xc7>
lea    0xe49(%rip),%rdi
call   1040 <puts@plt>
movl   $0x1,-0x8(%rbp)
mov    $0x12345678,%edi
call   1030 <wash@plt>
mov    %eax,%edi
call   1050 <bswap_32@plt>
cmp    $0x78563412,%eax
je     1246 <main+0xf6>
lea    0xe3a(%rip),%rdi
call   1040 <puts@plt>
movl   $0x1,-0x8(%rbp)
mov    $0x90abcdef,%edi
call   1030 <wash@plt>
mov    %eax,%edi
call   1060 <bswap_64@plt>
cltq
movabs $0xefcdab9078563412,%rcx
ab cd ef
cmp    %rcx,%rax
je     127f <main+0x12f>
lea    0xe21(%rip),%rdi
call   1040 <puts@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1234,%edi
call   1070 <bswap_16@plt>
cmp    $0x3412,%eax
je     116e <main+0x1e>
lea    0xe97(%rip),%rdi
call   1040 <puts@plt>
mov    $0x12345678,%edi
call   1050 <bswap_32@plt>
cmp    $0x78563412,%eax
je     118b <main+0x3b>
lea    0xe96(%rip),%rdi
call   1040 <puts@plt>
mov    $0x90abcdef,%edi
call   1060 <bswap_64@plt>
lea    0xe9c(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1234,%edi
call   1030 <wash@plt>
mov    %eax,%edi
call   1070 <bswap_16@plt>
cmp    $0x3412,%eax
je     11c5 <main+0x75>
lea    0xe94(%rip),%rdi
call   1040 <puts@plt>
mov    $0x12345678,%edi
call   1030 <wash@plt>
mov    %eax,%edi
call   1050 <bswap_32@plt>
cmp    $0x78563412,%eax
je     11e9 <main+0x99>
lea    0xe90(%rip),%rdi
call   1040 <puts@plt>
mov    $0x90abcdef,%edi
call   1030 <wash@plt>
mov    %eax,%edi
call   1060 <bswap_64@plt>
lea    0xe93(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"bswap_16 (constant) flunked\00"
@.str.1 = [28 x i8] c"bswap_32 (constant) flunked\00"
@.str.2 = [28 x i8] c"bswap_64 (constant) flunked\00"
@.str.3 = [32 x i8] c"bswap_16 (non-constant) flunked\00"
@.str.4 = [32 x i8] c"bswap_32 (non-constant) flunked\00"
@.str.5 = [32 x i8] c"bswap_64 (non-constant) flunked\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = call i32 @bswap_16(i32 4660)
%4 = icmp ne i32 %3, 13330
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 @puts(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %2
br label %7
7: ; preds = %5, %0
%8 = call i32 @bswap_32(i32 305419896)
%9 = icmp ne i32 %8, 2018915346
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = call i32 @puts(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %2
br label %12
12: ; preds = %10, %7
%13 = call i32 @bswap_64(i32 -1867788817)
%14 = sext i32 %13 to i64
%15 = icmp ne i64 %14, -1167088091436534766
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = call i32 @puts(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %2
br label %18
18: ; preds = %16, %12
%19 = call i32 @wash(i32 4660)
%20 = call i32 @bswap_16(i32 %19)
%21 = icmp ne i32 %20, 13330
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = call i32 @puts(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %2
br label %24
24: ; preds = %22, %18
%25 = call i32 @wash(i32 305419896)
%26 = call i32 @bswap_32(i32 %25)
%27 = icmp ne i32 %26, 2018915346
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = call i32 @puts(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %2
br label %30
30: ; preds = %28, %24
%31 = call i32 @wash(i32 -1867788817)
%32 = call i32 @bswap_64(i32 %31)
%33 = sext i32 %32 to i64
%34 = icmp ne i64 %33, -1167088091436534766
br i1 %34, label %35, label %37
35: ; preds = %30
%36 = call i32 @puts(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %2
br label %37
37: ; preds = %35, %30
%38 = load i32, i32* %2
ret i32 %38
}

LLVM IR (-O2):
@.str = [28 x i8] c"bswap_16 (constant) flunked\00"
@.str.1 = [28 x i8] c"bswap_32 (constant) flunked\00"
@.str.2 = [28 x i8] c"bswap_64 (constant) flunked\00"
@.str.3 = [32 x i8] c"bswap_16 (non-constant) flunked\00"
@.str.4 = [32 x i8] c"bswap_32 (non-constant) flunked\00"
@.str.5 = [32 x i8] c"bswap_64 (non-constant) flunked\00"
define i32 @main() {
%1 = tail call i32 @bswap_16(i32 4660)
%2 = icmp eq i32 %1, 13330
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
%6 = tail call i32 @bswap_32(i32 305419896)
%7 = icmp eq i32 %6, 2018915346
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %8, %5
%11 = tail call i32 @bswap_64(i32 -1867788817)
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%13 = tail call i32 @wash(i32 4660)
%14 = tail call i32 @bswap_16(i32 %13)
%15 = icmp eq i32 %14, 13330
br i1 %15, label %18, label %16
16: ; preds = %10
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
br label %18
18: ; preds = %16, %10
%19 = tail call i32 @wash(i32 305419896)
%20 = tail call i32 @bswap_32(i32 %19)
%21 = icmp eq i32 %20, 2018915346
br i1 %21, label %24, label %22
22: ; preds = %18
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
br label %24
24: ; preds = %22, %18
%25 = tail call i32 @wash(i32 -1867788817)
%26 = tail call i32 @bswap_64(i32 %25)
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0))
ret i32 1
}