#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 */
unsigned int gnulliver();
unsigned char *gnulliver64c(unsigned char *ch) {
  static unsigned endian, init = 1;
  unsigned char tmpch;
  if (init) {
    endian = gnulliver();
    init = 0;
  }
  if (endian != 0) {
    if (endian == (1 | 2 | 4 | 8)) {
      tmpch = ch[0];
      ch[0] = ch[7];
      ch[7] = tmpch;
      tmpch = ch[1];
      ch[1] = ch[6];
      ch[6] = tmpch;
      tmpch = ch[2];
      ch[2] = ch[5];
      ch[5] = tmpch;
      tmpch = ch[3];
      ch[3] = ch[4];
      ch[4] = tmpch;
    } else {
      tmpch = ch[0];
      ch[0] = ch[6];
      ch[6] = tmpch;
      tmpch = ch[1];
      ch[1] = ch[7];
      ch[7] = tmpch;
      tmpch = ch[2];
      ch[2] = ch[4];
      ch[4] = tmpch;
      tmpch = ch[3];
      ch[3] = ch[5];
      ch[5] = tmpch;
    }
  }
  return (ch);
}


x86 assembly (clang, -O0):
<gnulliver64c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpl   $0x0,0x2f05(%rip)
je     1140 <gnulliver64c+0x30>
mov    $0x0,%al
call   1030 <gnulliver@plt>
mov    %eax,0x2efa(%rip)
movl   $0x0,0x2ee8(%rip)
cmpl   $0x0,0x2ee9(%rip)
je     1270 <gnulliver64c+0x160>
cmpl   $0xf,0x2edc(%rip)
jne    11e5 <gnulliver64c+0xd5>
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
mov    0x7(%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x9(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x7(%rax)
mov    -0x8(%rbp),%rax
mov    0x1(%rax),%al
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
mov    0x6(%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x9(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x6(%rax)
mov    -0x8(%rbp),%rax
mov    0x2(%rax),%al
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
mov    0x5(%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0x9(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x5(%rax)
mov    -0x8(%rbp),%rax
mov    0x3(%rax),%al
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0x9(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x4(%rax)
jmp    126b <gnulliver64c+0x15b>
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
mov    0x6(%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x9(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x6(%rax)
mov    -0x8(%rbp),%rax
mov    0x1(%rax),%al
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
mov    0x7(%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x9(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x7(%rax)
mov    -0x8(%rbp),%rax
mov    0x2(%rax),%al
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0x9(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x4(%rax)
mov    -0x8(%rbp),%rax
mov    0x3(%rax),%al
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
mov    0x5(%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0x9(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x5(%rax)
jmp    1270 <gnulliver64c+0x160>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gnulliver64c>:
push   %rbx
mov    %rdi,%rbx
cmpb   $0x0,0x2f15(%rip)
je     1129 <gnulliver64c+0x19>
mov    0x2f09(%rip),%eax
test   %eax,%eax
jne    1141 <gnulliver64c+0x31>
jmp    1181 <gnulliver64c+0x71>
xor    %eax,%eax
call   1030 <gnulliver@plt>
mov    %eax,0x2ef6(%rip)
movb   $0x1,0x2ef3(%rip)
test   %eax,%eax
je     1181 <gnulliver64c+0x71>
cmp    $0xf,%eax
jne    116f <gnulliver64c+0x5f>
mov    (%rbx),%al
mov    0x7(%rbx),%cl
mov    %cl,(%rbx)
mov    %al,0x7(%rbx)
movzwl 0x1(%rbx),%eax
rol    $0x8,%ax
movzwl 0x5(%rbx),%ecx
rol    $0x8,%cx
mov    %cx,0x1(%rbx)
mov    %ax,0x5(%rbx)
rolw   $0x8,0x3(%rbx)
jmp    1181 <gnulliver64c+0x71>
movzwl (%rbx),%eax
movzwl 0x6(%rbx),%ecx
mov    %cx,(%rbx)
mov    %ax,0x6(%rbx)
roll   $0x10,0x2(%rbx)
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@gnulliver64c.endian = internal global i32 0
@gnulliver64c.init = internal global i32 1
define i8* @gnulliver64c(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
store i8* %0, i8** %2
%4 = load i32, i32* @gnulliver64c.init
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 (...) @gnulliver()
store i32 %7, i32* @gnulliver64c.endian
store i32 0, i32* @gnulliver64c.init
br label %8
8: ; preds = %6, %1
%9 = load i32, i32* @gnulliver64c.endian
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %105
11: ; preds = %8
%12 = load i32, i32* @gnulliver64c.endian
%13 = icmp eq i32 %12, 15
br i1 %13, label %14, label %59
14: ; preds = %11
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i64 0
%17 = load i8, i8* %16
store i8 %17, i8* %3
%18 = load i8*, i8** %2
%19 = getelementptr inbounds i8, i8* %18, i64 7
%20 = load i8, i8* %19
%21 = load i8*, i8** %2
%22 = getelementptr inbounds i8, i8* %21, i64 0
store i8 %20, i8* %22
%23 = load i8, i8* %3
%24 = load i8*, i8** %2
%25 = getelementptr inbounds i8, i8* %24, i64 7
store i8 %23, i8* %25
%26 = load i8*, i8** %2
%27 = getelementptr inbounds i8, i8* %26, i64 1
%28 = load i8, i8* %27
store i8 %28, i8* %3
%29 = load i8*, i8** %2
%30 = getelementptr inbounds i8, i8* %29, i64 6
%31 = load i8, i8* %30
%32 = load i8*, i8** %2
%33 = getelementptr inbounds i8, i8* %32, i64 1
store i8 %31, i8* %33
%34 = load i8, i8* %3
%35 = load i8*, i8** %2
%36 = getelementptr inbounds i8, i8* %35, i64 6
store i8 %34, i8* %36
%37 = load i8*, i8** %2
%38 = getelementptr inbounds i8, i8* %37, i64 2
%39 = load i8, i8* %38
store i8 %39, i8* %3
%40 = load i8*, i8** %2
%41 = getelementptr inbounds i8, i8* %40, i64 5
%42 = load i8, i8* %41
%43 = load i8*, i8** %2
%44 = getelementptr inbounds i8, i8* %43, i64 2
store i8 %42, i8* %44
%45 = load i8, i8* %3
%46 = load i8*, i8** %2
%47 = getelementptr inbounds i8, i8* %46, i64 5
store i8 %45, i8* %47
%48 = load i8*, i8** %2
%49 = getelementptr inbounds i8, i8* %48, i64 3
%50 = load i8, i8* %49
store i8 %50, i8* %3
%51 = load i8*, i8** %2
%52 = getelementptr inbounds i8, i8* %51, i64 4
%53 = load i8, i8* %52
%54 = load i8*, i8** %2
%55 = getelementptr inbounds i8, i8* %54, i64 3
store i8 %53, i8* %55
%56 = load i8, i8* %3
%57 = load i8*, i8** %2
%58 = getelementptr inbounds i8, i8* %57, i64 4
store i8 %56, i8* %58
br label %104
59: ; preds = %11
%60 = load i8*, i8** %2
%61 = getelementptr inbounds i8, i8* %60, i64 0
%62 = load i8, i8* %61
store i8 %62, i8* %3
%63 = load i8*, i8** %2
%64 = getelementptr inbounds i8, i8* %63, i64 6
%65 = load i8, i8* %64
%66 = load i8*, i8** %2
%67 = getelementptr inbounds i8, i8* %66, i64 0
store i8 %65, i8* %67
%68 = load i8, i8* %3
%69 = load i8*, i8** %2
%70 = getelementptr inbounds i8, i8* %69, i64 6
store i8 %68, i8* %70
%71 = load i8*, i8** %2
%72 = getelementptr inbounds i8, i8* %71, i64 1
%73 = load i8, i8* %72
store i8 %73, i8* %3
%74 = load i8*, i8** %2
%75 = getelementptr inbounds i8, i8* %74, i64 7
%76 = load i8, i8* %75
%77 = load i8*, i8** %2
%78 = getelementptr inbounds i8, i8* %77, i64 1
store i8 %76, i8* %78
%79 = load i8, i8* %3
%80 = load i8*, i8** %2
%81 = getelementptr inbounds i8, i8* %80, i64 7
store i8 %79, i8* %81
%82 = load i8*, i8** %2
%83 = getelementptr inbounds i8, i8* %82, i64 2
%84 = load i8, i8* %83
store i8 %84, i8* %3
%85 = load i8*, i8** %2
%86 = getelementptr inbounds i8, i8* %85, i64 4
%87 = load i8, i8* %86
%88 = load i8*, i8** %2
%89 = getelementptr inbounds i8, i8* %88, i64 2
store i8 %87, i8* %89
%90 = load i8, i8* %3
%91 = load i8*, i8** %2
%92 = getelementptr inbounds i8, i8* %91, i64 4
store i8 %90, i8* %92
%93 = load i8*, i8** %2
%94 = getelementptr inbounds i8, i8* %93, i64 3
%95 = load i8, i8* %94
store i8 %95, i8* %3
%96 = load i8*, i8** %2
%97 = getelementptr inbounds i8, i8* %96, i64 5
%98 = load i8, i8* %97
%99 = load i8*, i8** %2
%100 = getelementptr inbounds i8, i8* %99, i64 3
store i8 %98, i8* %100
%101 = load i8, i8* %3
%102 = load i8*, i8** %2
%103 = getelementptr inbounds i8, i8* %102, i64 5
store i8 %101, i8* %103
br label %104
104: ; preds = %59, %14
br label %105
105: ; preds = %104, %8
%106 = load i8*, i8** %2
ret i8* %106
}

LLVM IR (-O2):
@gnulliver64c.endian = internal unnamed_addr global i32 0
@gnulliver64c.init = internal unnamed_addr global i1 false
define i8* @gnulliver64c(i8* returned %0) {
%2 = load i1, i1* @gnulliver64c.init
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 (...) @gnulliver()
store i32 %4, i32* @gnulliver64c.endian
store i1 true, i1* @gnulliver64c.init
br label %7
5: ; preds = %1
%6 = load i32, i32* @gnulliver64c.endian
br label %7
7: ; preds = %5, %3
%8 = phi i32 [ %6, %5 ], [ %4, %3 ]
switch i32 %8, label %25 [
i32 0, label %41
i32 15, label %9
]
9: ; preds = %7
%10 = load i8, i8* %0
%11 = getelementptr inbounds i8, i8* %0, i64 7
%12 = load i8, i8* %11
store i8 %12, i8* %0
store i8 %10, i8* %11
%13 = getelementptr inbounds i8, i8* %0, i64 1
%14 = load i8, i8* %13
%15 = getelementptr inbounds i8, i8* %0, i64 6
%16 = load i8, i8* %15
store i8 %16, i8* %13
store i8 %14, i8* %15
%17 = getelementptr inbounds i8, i8* %0, i64 2
%18 = load i8, i8* %17
%19 = getelementptr inbounds i8, i8* %0, i64 5
%20 = load i8, i8* %19
store i8 %20, i8* %17
store i8 %18, i8* %19
%21 = getelementptr inbounds i8, i8* %0, i64 3
%22 = load i8, i8* %21
%23 = getelementptr inbounds i8, i8* %0, i64 4
%24 = load i8, i8* %23
store i8 %24, i8* %21
store i8 %22, i8* %23
br label %41
25: ; preds = %7
%26 = load i8, i8* %0
%27 = getelementptr inbounds i8, i8* %0, i64 6
%28 = load i8, i8* %27
store i8 %28, i8* %0
store i8 %26, i8* %27
%29 = getelementptr inbounds i8, i8* %0, i64 1
%30 = load i8, i8* %29
%31 = getelementptr inbounds i8, i8* %0, i64 7
%32 = load i8, i8* %31
store i8 %32, i8* %29
store i8 %30, i8* %31
%33 = getelementptr inbounds i8, i8* %0, i64 2
%34 = load i8, i8* %33
%35 = getelementptr inbounds i8, i8* %0, i64 4
%36 = load i8, i8* %35
store i8 %36, i8* %33
store i8 %34, i8* %35
%37 = getelementptr inbounds i8, i8* %0, i64 3
%38 = load i8, i8* %37
%39 = getelementptr inbounds i8, i8* %0, i64 5
%40 = load i8, i8* %39
store i8 %40, i8* %37
store i8 %38, i8* %39
br label %41
41: ; preds = %7, %9, %25
ret i8* %0
}