#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 uint64_t;
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *, unsigned long long, ...);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  uint64_t host_le, netw_be;
  uint64_t actual1, actual2;
  if (((((1) & 0xff000000) >> 24) | (((1) & 0x00ff0000) >> 8) |
       (((1) & 0x0000ff00) << 8) | (((1) & 0x000000ff) << 24)) == 1) {
    fprintf(stderr, "this expects a little endian host\n");
  }
  host_le = 0x554E49584C4f5645;
  netw_be = 0x45564f4c58494e55;
  printf("host_le: %0llx\n", (unsigned long long)host_le);
  printf("netw_be: %0llx\n", (unsigned long long)netw_be);
  actual1 =
      ((((((1) & 0xff000000) >> 24) | (((1) & 0x00ff0000) >> 8) |
         (((1) & 0x0000ff00) << 8) | (((1) & 0x000000ff) << 24)) == 1)
           ? host_le
           : ((((uint64_t)(((((uint32_t)host_le) & 0xff000000) >> 24) |
                           ((((uint32_t)host_le) & 0x00ff0000) >> 8) |
                           ((((uint32_t)host_le) & 0x0000ff00) << 8) |
                           ((((uint32_t)host_le) & 0x000000ff) << 24))
                << 32) |
               ((uint64_t)(((((uint32_t)(host_le >> 32)) & 0xff000000) >> 24) |
                           ((((uint32_t)(host_le >> 32)) & 0x00ff0000) >> 8) |
                           ((((uint32_t)(host_le >> 32)) & 0x0000ff00) << 8) |
                           ((((uint32_t)(host_le >> 32)) & 0x000000ff)
                            << 24))))));
  actual2 =
      ((((((1) & 0xff000000) >> 24) | (((1) & 0x00ff0000) >> 8) |
         (((1) & 0x0000ff00) << 8) | (((1) & 0x000000ff) << 24)) == 1)
           ? netw_be
           : ((((uint64_t)(((((uint32_t)netw_be) & 0xff000000) >> 24) |
                           ((((uint32_t)netw_be) & 0x00ff0000) >> 8) |
                           ((((uint32_t)netw_be) & 0x0000ff00) << 8) |
                           ((((uint32_t)netw_be) & 0x000000ff) << 24))
                << 32) |
               ((uint64_t)(((((uint32_t)(netw_be >> 32)) & 0xff000000) >> 24) |
                           ((((uint32_t)(netw_be >> 32)) & 0x00ff0000) >> 8) |
                           ((((uint32_t)(netw_be >> 32)) & 0x0000ff00) << 8) |
                           ((((uint32_t)(netw_be >> 32)) & 0x000000ff)
                            << 24))))));
  printf("htonll(%0llx): %0llx\n", (unsigned long long)host_le,
         (unsigned long long)actual1);
  printf("ntohll(%0llx): %0llx\n", (unsigned long long)netw_be,
         (unsigned long long)actual2);
  return actual1 == netw_be ? 0 : 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x4c4f5645,-0x14(%rbp)
movl   $0x58494e55,-0x18(%rbp)
movslq -0x14(%rbp),%rsi
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x18(%rbp),%rsi
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
and    $0xff000000,%eax
shr    $0x18,%eax
mov    -0x14(%rbp),%ecx
and    $0xff0000,%ecx
sar    $0x8,%ecx
or     %ecx,%eax
mov    -0x14(%rbp),%ecx
and    $0xff00,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x14(%rbp),%ecx
and    $0xff,%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    $0x20,%ecx
shl    %cl,%eax
mov    -0x14(%rbp),%edx
mov    $0x20,%ecx
sar    %cl,%edx
mov    %edx,%ecx
and    $0xff000000,%ecx
shr    $0x18,%ecx
mov    %ecx,-0x38(%rbp)
mov    -0x14(%rbp),%edx
mov    $0x20,%ecx
sar    %cl,%edx
mov    -0x38(%rbp),%ecx
and    $0xff0000,%edx
sar    $0x8,%edx
or     %edx,%ecx
mov    %ecx,-0x34(%rbp)
mov    -0x14(%rbp),%edx
mov    $0x20,%ecx
sar    %cl,%edx
mov    -0x34(%rbp),%ecx
and    $0xff00,%edx
shl    $0x8,%edx
or     %edx,%ecx
mov    %ecx,-0x30(%rbp)
mov    -0x14(%rbp),%edx
mov    $0x20,%ecx
sar    %cl,%edx
mov    -0x30(%rbp),%ecx
and    $0xff,%edx
shl    $0x18,%edx
or     %edx,%ecx
or     %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
and    $0xff000000,%eax
shr    $0x18,%eax
mov    -0x18(%rbp),%ecx
and    $0xff0000,%ecx
sar    $0x8,%ecx
or     %ecx,%eax
mov    -0x18(%rbp),%ecx
and    $0xff00,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x18(%rbp),%ecx
and    $0xff,%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    $0x20,%ecx
shl    %cl,%eax
mov    -0x18(%rbp),%edx
mov    $0x20,%ecx
sar    %cl,%edx
mov    %edx,%ecx
and    $0xff000000,%ecx
shr    $0x18,%ecx
mov    %ecx,-0x2c(%rbp)
mov    -0x18(%rbp),%edx
mov    $0x20,%ecx
sar    %cl,%edx
mov    -0x2c(%rbp),%ecx
and    $0xff0000,%edx
sar    $0x8,%edx
or     %edx,%ecx
mov    %ecx,-0x28(%rbp)
mov    -0x18(%rbp),%edx
mov    $0x20,%ecx
sar    %cl,%edx
mov    -0x28(%rbp),%ecx
and    $0xff00,%edx
shl    $0x8,%edx
or     %edx,%ecx
mov    %ecx,-0x24(%rbp)
mov    -0x18(%rbp),%edx
mov    $0x20,%ecx
sar    %cl,%edx
mov    -0x24(%rbp),%ecx
and    $0xff,%edx
shl    $0x18,%edx
or     %edx,%ecx
or     %ecx,%eax
mov    %eax,-0x20(%rbp)
movslq -0x14(%rbp),%rsi
movslq -0x1c(%rbp),%rdx
lea    0xd6b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x18(%rbp),%rsi
movslq -0x20(%rbp),%rdx
lea    0xd6b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%edx
mov    -0x18(%rbp),%esi
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    %esi,%edx
cmove  %ecx,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x4c4f5645,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee5(%rip),%rdi
mov    $0x58494e55,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee2(%rip),%rdi
mov    $0x4c4f5645,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee5(%rip),%rdi
mov    $0x58494e55,%esi
xor    %eax,%eax
pop    %rcx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"host_le: %0llx\0A\00"
@.str.1 = [16 x i8] c"netw_be: %0llx\0A\00"
@.str.2 = [22 x i8] c"htonll(%0llx): %0llx\0A\00"
@.str.3 = [22 x i8] c"ntohll(%0llx): %0llx\0A\00"
@stderr = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1280267845, i32* %6
store i32 1481199189, i32* %7
%10 = load i32, i32* %6
%11 = sext i32 %10 to i64
%12 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i64 %11)
%13 = load i32, i32* %7
%14 = sext i32 %13 to i64
%15 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i64 %14)
%16 = load i32, i32* %6
%17 = and i32 %16, -16777216
%18 = lshr i32 %17, 24
%19 = load i32, i32* %6
%20 = and i32 %19, 16711680
%21 = ashr i32 %20, 8
%22 = or i32 %18, %21
%23 = load i32, i32* %6
%24 = and i32 %23, 65280
%25 = shl i32 %24, 8
%26 = or i32 %22, %25
%27 = load i32, i32* %6
%28 = and i32 %27, 255
%29 = shl i32 %28, 24
%30 = or i32 %26, %29
%31 = shl i32 %30, 32
%32 = load i32, i32* %6
%33 = ashr i32 %32, 32
%34 = and i32 %33, -16777216
%35 = lshr i32 %34, 24
%36 = load i32, i32* %6
%37 = ashr i32 %36, 32
%38 = and i32 %37, 16711680
%39 = ashr i32 %38, 8
%40 = or i32 %35, %39
%41 = load i32, i32* %6
%42 = ashr i32 %41, 32
%43 = and i32 %42, 65280
%44 = shl i32 %43, 8
%45 = or i32 %40, %44
%46 = load i32, i32* %6
%47 = ashr i32 %46, 32
%48 = and i32 %47, 255
%49 = shl i32 %48, 24
%50 = or i32 %45, %49
%51 = or i32 %31, %50
store i32 %51, i32* %8
%52 = load i32, i32* %7
%53 = and i32 %52, -16777216
%54 = lshr i32 %53, 24
%55 = load i32, i32* %7
%56 = and i32 %55, 16711680
%57 = ashr i32 %56, 8
%58 = or i32 %54, %57
%59 = load i32, i32* %7
%60 = and i32 %59, 65280
%61 = shl i32 %60, 8
%62 = or i32 %58, %61
%63 = load i32, i32* %7
%64 = and i32 %63, 255
%65 = shl i32 %64, 24
%66 = or i32 %62, %65
%67 = shl i32 %66, 32
%68 = load i32, i32* %7
%69 = ashr i32 %68, 32
%70 = and i32 %69, -16777216
%71 = lshr i32 %70, 24
%72 = load i32, i32* %7
%73 = ashr i32 %72, 32
%74 = and i32 %73, 16711680
%75 = ashr i32 %74, 8
%76 = or i32 %71, %75
%77 = load i32, i32* %7
%78 = ashr i32 %77, 32
%79 = and i32 %78, 65280
%80 = shl i32 %79, 8
%81 = or i32 %76, %80
%82 = load i32, i32* %7
%83 = ashr i32 %82, 32
%84 = and i32 %83, 255
%85 = shl i32 %84, 24
%86 = or i32 %81, %85
%87 = or i32 %67, %86
store i32 %87, i32* %9
%88 = load i32, i32* %6
%89 = sext i32 %88 to i64
%90 = load i32, i32* %8
%91 = sext i32 %90 to i64
%92 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i64 %89, i64 %91)
%93 = load i32, i32* %7
%94 = sext i32 %93 to i64
%95 = load i32, i32* %9
%96 = sext i32 %95 to i64
%97 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i64 %94, i64 %96)
%98 = load i32, i32* %8
%99 = load i32, i32* %7
%100 = icmp eq i32 %98, %99
%101 = zext i1 %100 to i64
%102 = select i1 %100, i32 0, i32 1
ret i32 %102
}

LLVM IR (-O2):
@.str = [16 x i8] c"host_le: %0llx\0A\00"
@.str.1 = [16 x i8] c"netw_be: %0llx\0A\00"
@.str.2 = [22 x i8] c"htonll(%0llx): %0llx\0A\00"
@.str.3 = [22 x i8] c"ntohll(%0llx): %0llx\0A\00"
@stderr = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i64 1280267845)
%4 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i64 1481199189)
%5 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i64 1280267845, i64 poison)
%6 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i64 1481199189, i64 poison)
ret i32 poison
}