#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 /*<<< orphan*/ overwrite_byte(int);
int /*<<< orphan*/ overwrite_bytes(int, int, int);
int /*<<< orphan*/ overwrite_random(int);
void overwrite_selector(const int sunlink_mode) {
  if (sunlink_mode & (1 << 6)) {
    overwrite_byte(0xF6);
    overwrite_byte(0x00);
    overwrite_byte(0xFF);
    overwrite_random(1);
    overwrite_byte(0x00);
    overwrite_byte(0xFF);
    overwrite_random(1);
    return;
  }
  if (sunlink_mode & (1 << 7)) {
    overwrite_random(2);
    overwrite_bytes('D', 'o', 'E');
    return;
  }
  if (sunlink_mode & (1 << 5)) {
    overwrite_byte(0xFF);
    overwrite_byte(0x00);
    overwrite_byte(0xFF);
    return;
  }
  if (sunlink_mode & (1 << 4)) {
    overwrite_byte(0x00);
    return;
  }
  overwrite_random(4);
  overwrite_byte(0x55);
  overwrite_byte(0xAA);
  overwrite_bytes(0x92, 0x49, 0x24);
  overwrite_bytes(0x49, 0x24, 0x92);
  overwrite_bytes(0x24, 0x92, 0x49);
  overwrite_byte(0x00);
  overwrite_byte(0x11);
  overwrite_byte(0x22);
  overwrite_byte(0x33);
  overwrite_byte(0x44);
  overwrite_byte(0x55);
  overwrite_byte(0x66);
  overwrite_byte(0x77);
  overwrite_byte(0x88);
  overwrite_byte(0x99);
  overwrite_byte(0xAA);
  overwrite_byte(0xBB);
  overwrite_byte(0xCC);
  overwrite_byte(0xDD);
  overwrite_byte(0xEE);
  overwrite_byte(0xFF);
  overwrite_bytes(0x92, 0x49, 0x24);
  overwrite_bytes(0x49, 0x24, 0x92);
  overwrite_bytes(0x24, 0x92, 0x49);
  overwrite_bytes(0x6D, 0xB6, 0xDB);
  overwrite_bytes(0xB6, 0xDB, 0x6D);
  overwrite_bytes(0xDB, 0x6D, 0xB6);
  overwrite_random(4);
  overwrite_byte(0x00);
}


x86 assembly (clang, -O0):
<overwrite_selector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x40,%eax
cmp    $0x0,%eax
je     118f <overwrite_selector+0x5f>
mov    $0xf6,%edi
call   1050 <overwrite_byte@plt>
xor    %edi,%edi
call   1050 <overwrite_byte@plt>
mov    $0xff,%edi
call   1050 <overwrite_byte@plt>
mov    $0x1,%edi
call   1030 <overwrite_random@plt>
xor    %edi,%edi
call   1050 <overwrite_byte@plt>
mov    $0xff,%edi
call   1050 <overwrite_byte@plt>
mov    $0x1,%edi
call   1030 <overwrite_random@plt>
jmp    138d <overwrite_selector+0x25d>
mov    -0x4(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     11c3 <overwrite_selector+0x93>
mov    $0x2,%edi
call   1030 <overwrite_random@plt>
mov    $0x44,%edi
mov    $0x6f,%esi
mov    $0x45,%edx
call   1040 <overwrite_bytes@plt>
jmp    138d <overwrite_selector+0x25d>
mov    -0x4(%rbp),%eax
and    $0x20,%eax
cmp    $0x0,%eax
je     11f2 <overwrite_selector+0xc2>
mov    $0xff,%edi
call   1050 <overwrite_byte@plt>
xor    %edi,%edi
call   1050 <overwrite_byte@plt>
mov    $0xff,%edi
call   1050 <overwrite_byte@plt>
jmp    138d <overwrite_selector+0x25d>
mov    -0x4(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     120d <overwrite_selector+0xdd>
xor    %edi,%edi
call   1050 <overwrite_byte@plt>
jmp    138d <overwrite_selector+0x25d>
mov    $0x4,%edi
call   1030 <overwrite_random@plt>
mov    $0x55,%edi
call   1050 <overwrite_byte@plt>
mov    $0xaa,%edi
call   1050 <overwrite_byte@plt>
mov    $0x92,%edi
mov    $0x49,%esi
mov    $0x24,%edx
call   1040 <overwrite_bytes@plt>
mov    $0x49,%edi
mov    $0x24,%esi
mov    $0x92,%edx
call   1040 <overwrite_bytes@plt>
mov    $0x24,%edi
mov    $0x92,%esi
mov    $0x49,%edx
call   1040 <overwrite_bytes@plt>
xor    %edi,%edi
call   1050 <overwrite_byte@plt>
mov    $0x11,%edi
call   1050 <overwrite_byte@plt>
mov    $0x22,%edi
call   1050 <overwrite_byte@plt>
mov    $0x33,%edi
call   1050 <overwrite_byte@plt>
mov    $0x44,%edi
call   1050 <overwrite_byte@plt>
mov    $0x55,%edi
call   1050 <overwrite_byte@plt>
mov    $0x66,%edi
call   1050 <overwrite_byte@plt>
mov    $0x77,%edi
call   1050 <overwrite_byte@plt>
mov    $0x88,%edi
call   1050 <overwrite_byte@plt>
mov    $0x99,%edi
call   1050 <overwrite_byte@plt>
mov    $0xaa,%edi
call   1050 <overwrite_byte@plt>
mov    $0xbb,%edi
call   1050 <overwrite_byte@plt>
mov    $0xcc,%edi
call   1050 <overwrite_byte@plt>
mov    $0xdd,%edi
call   1050 <overwrite_byte@plt>
mov    $0xee,%edi
call   1050 <overwrite_byte@plt>
mov    $0xff,%edi
call   1050 <overwrite_byte@plt>
mov    $0x92,%edi
mov    $0x49,%esi
mov    $0x24,%edx
call   1040 <overwrite_bytes@plt>
mov    $0x49,%edi
mov    $0x24,%esi
mov    $0x92,%edx
call   1040 <overwrite_bytes@plt>
mov    $0x24,%edi
mov    $0x92,%esi
mov    $0x49,%edx
call   1040 <overwrite_bytes@plt>
mov    $0x6d,%edi
mov    $0xb6,%esi
mov    $0xdb,%edx
call   1040 <overwrite_bytes@plt>
mov    $0xb6,%edi
mov    $0xdb,%esi
mov    $0x6d,%edx
call   1040 <overwrite_bytes@plt>
mov    $0xdb,%edi
mov    $0x6d,%esi
mov    $0xb6,%edx
call   1040 <overwrite_bytes@plt>
mov    $0x4,%edi
call   1030 <overwrite_random@plt>
xor    %edi,%edi
call   1050 <overwrite_byte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<overwrite_selector>:
push   %rax
test   $0x40,%dil
jne    12da <overwrite_selector+0x1aa>
test   $0x80,%dil
jne    131b <overwrite_selector+0x1eb>
test   $0x20,%dil
jne    133a <overwrite_selector+0x20a>
test   $0x10,%dil
jne    12d2 <overwrite_selector+0x1a2>
mov    $0x4,%edi
call   1030 <overwrite_random@plt>
mov    $0x55,%edi
call   1050 <overwrite_byte@plt>
mov    $0xaa,%edi
call   1050 <overwrite_byte@plt>
mov    $0x92,%edi
mov    $0x49,%esi
mov    $0x24,%edx
call   1040 <overwrite_bytes@plt>
mov    $0x49,%edi
mov    $0x24,%esi
mov    $0x92,%edx
call   1040 <overwrite_bytes@plt>
mov    $0x24,%edi
mov    $0x92,%esi
mov    $0x49,%edx
call   1040 <overwrite_bytes@plt>
xor    %edi,%edi
call   1050 <overwrite_byte@plt>
mov    $0x11,%edi
call   1050 <overwrite_byte@plt>
mov    $0x22,%edi
call   1050 <overwrite_byte@plt>
mov    $0x33,%edi
call   1050 <overwrite_byte@plt>
mov    $0x44,%edi
call   1050 <overwrite_byte@plt>
mov    $0x55,%edi
call   1050 <overwrite_byte@plt>
mov    $0x66,%edi
call   1050 <overwrite_byte@plt>
mov    $0x77,%edi
call   1050 <overwrite_byte@plt>
mov    $0x88,%edi
call   1050 <overwrite_byte@plt>
mov    $0x99,%edi
call   1050 <overwrite_byte@plt>
mov    $0xaa,%edi
call   1050 <overwrite_byte@plt>
mov    $0xbb,%edi
call   1050 <overwrite_byte@plt>
mov    $0xcc,%edi
call   1050 <overwrite_byte@plt>
mov    $0xdd,%edi
call   1050 <overwrite_byte@plt>
mov    $0xee,%edi
call   1050 <overwrite_byte@plt>
mov    $0xff,%edi
call   1050 <overwrite_byte@plt>
mov    $0x92,%edi
mov    $0x49,%esi
mov    $0x24,%edx
call   1040 <overwrite_bytes@plt>
mov    $0x49,%edi
mov    $0x24,%esi
mov    $0x92,%edx
call   1040 <overwrite_bytes@plt>
mov    $0x24,%edi
mov    $0x92,%esi
mov    $0x49,%edx
call   1040 <overwrite_bytes@plt>
mov    $0x6d,%edi
mov    $0xb6,%esi
mov    $0xdb,%edx
call   1040 <overwrite_bytes@plt>
mov    $0xb6,%edi
mov    $0xdb,%esi
mov    $0x6d,%edx
call   1040 <overwrite_bytes@plt>
mov    $0xdb,%edi
mov    $0x6d,%esi
mov    $0xb6,%edx
call   1040 <overwrite_bytes@plt>
mov    $0x4,%edi
call   1030 <overwrite_random@plt>
xor    %edi,%edi
pop    %rax
jmp    1050 <overwrite_byte@plt>
mov    $0xf6,%edi
call   1050 <overwrite_byte@plt>
xor    %edi,%edi
call   1050 <overwrite_byte@plt>
mov    $0xff,%edi
call   1050 <overwrite_byte@plt>
mov    $0x1,%edi
call   1030 <overwrite_random@plt>
xor    %edi,%edi
call   1050 <overwrite_byte@plt>
mov    $0xff,%edi
call   1050 <overwrite_byte@plt>
mov    $0x1,%edi
pop    %rax
jmp    1030 <overwrite_random@plt>
mov    $0x2,%edi
call   1030 <overwrite_random@plt>
mov    $0x44,%edi
mov    $0x6f,%esi
mov    $0x45,%edx
pop    %rax
jmp    1040 <overwrite_bytes@plt>
mov    $0xff,%edi
call   1050 <overwrite_byte@plt>
xor    %edi,%edi
call   1050 <overwrite_byte@plt>
mov    $0xff,%edi
pop    %rax
jmp    1050 <overwrite_byte@plt>

LLVM IR (-O0):
define void @overwrite_selector(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 64
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %14
6: ; preds = %1
%7 = call i32 @overwrite_byte(i32 246)
%8 = call i32 @overwrite_byte(i32 0)
%9 = call i32 @overwrite_byte(i32 255)
%10 = call i32 @overwrite_random(i32 1)
%11 = call i32 @overwrite_byte(i32 0)
%12 = call i32 @overwrite_byte(i32 255)
%13 = call i32 @overwrite_random(i32 1)
br label %66
14: ; preds = %1
%15 = load i32, i32* %2
%16 = and i32 %15, 128
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %14
%19 = call i32 @overwrite_random(i32 2)
%20 = call i32 @overwrite_bytes(i32 68, i32 111, i32 69)
br label %66
21: ; preds = %14
%22 = load i32, i32* %2
%23 = and i32 %22, 32
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %29
25: ; preds = %21
%26 = call i32 @overwrite_byte(i32 255)
%27 = call i32 @overwrite_byte(i32 0)
%28 = call i32 @overwrite_byte(i32 255)
br label %66
29: ; preds = %21
%30 = load i32, i32* %2
%31 = and i32 %30, 16
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %29
%34 = call i32 @overwrite_byte(i32 0)
br label %66
35: ; preds = %29
%36 = call i32 @overwrite_random(i32 4)
%37 = call i32 @overwrite_byte(i32 85)
%38 = call i32 @overwrite_byte(i32 170)
%39 = call i32 @overwrite_bytes(i32 146, i32 73, i32 36)
%40 = call i32 @overwrite_bytes(i32 73, i32 36, i32 146)
%41 = call i32 @overwrite_bytes(i32 36, i32 146, i32 73)
%42 = call i32 @overwrite_byte(i32 0)
%43 = call i32 @overwrite_byte(i32 17)
%44 = call i32 @overwrite_byte(i32 34)
%45 = call i32 @overwrite_byte(i32 51)
%46 = call i32 @overwrite_byte(i32 68)
%47 = call i32 @overwrite_byte(i32 85)
%48 = call i32 @overwrite_byte(i32 102)
%49 = call i32 @overwrite_byte(i32 119)
%50 = call i32 @overwrite_byte(i32 136)
%51 = call i32 @overwrite_byte(i32 153)
%52 = call i32 @overwrite_byte(i32 170)
%53 = call i32 @overwrite_byte(i32 187)
%54 = call i32 @overwrite_byte(i32 204)
%55 = call i32 @overwrite_byte(i32 221)
%56 = call i32 @overwrite_byte(i32 238)
%57 = call i32 @overwrite_byte(i32 255)
%58 = call i32 @overwrite_bytes(i32 146, i32 73, i32 36)
%59 = call i32 @overwrite_bytes(i32 73, i32 36, i32 146)
%60 = call i32 @overwrite_bytes(i32 36, i32 146, i32 73)
%61 = call i32 @overwrite_bytes(i32 109, i32 182, i32 219)
%62 = call i32 @overwrite_bytes(i32 182, i32 219, i32 109)
%63 = call i32 @overwrite_bytes(i32 219, i32 109, i32 182)
%64 = call i32 @overwrite_random(i32 4)
%65 = call i32 @overwrite_byte(i32 0)
br label %66
66: ; preds = %35, %33, %25, %18, %6
ret void
}

LLVM IR (-O2):
define void @overwrite_selector(i32 %0) {
%2 = and i32 %0, 64
%3 = icmp eq i32 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1
%5 = tail call i32 @overwrite_byte(i32 246)
%6 = tail call i32 @overwrite_byte(i32 0)
%7 = tail call i32 @overwrite_byte(i32 255)
%8 = tail call i32 @overwrite_random(i32 1)
%9 = tail call i32 @overwrite_byte(i32 0)
%10 = tail call i32 @overwrite_byte(i32 255)
%11 = tail call i32 @overwrite_random(i32 1)
br label %61
12: ; preds = %1
%13 = and i32 %0, 128
%14 = icmp eq i32 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = tail call i32 @overwrite_random(i32 2)
%17 = tail call i32 @overwrite_bytes(i32 68, i32 111, i32 69)
br label %61
18: ; preds = %12
%19 = and i32 %0, 32
%20 = icmp eq i32 %19, 0
br i1 %20, label %25, label %21
21: ; preds = %18
%22 = tail call i32 @overwrite_byte(i32 255)
%23 = tail call i32 @overwrite_byte(i32 0)
%24 = tail call i32 @overwrite_byte(i32 255)
br label %61
25: ; preds = %18
%26 = and i32 %0, 16
%27 = icmp eq i32 %26, 0
br i1 %27, label %30, label %28
28: ; preds = %25
%29 = tail call i32 @overwrite_byte(i32 0)
br label %61
30: ; preds = %25
%31 = tail call i32 @overwrite_random(i32 4)
%32 = tail call i32 @overwrite_byte(i32 85)
%33 = tail call i32 @overwrite_byte(i32 170)
%34 = tail call i32 @overwrite_bytes(i32 146, i32 73, i32 36)
%35 = tail call i32 @overwrite_bytes(i32 73, i32 36, i32 146)
%36 = tail call i32 @overwrite_bytes(i32 36, i32 146, i32 73)
%37 = tail call i32 @overwrite_byte(i32 0)
%38 = tail call i32 @overwrite_byte(i32 17)
%39 = tail call i32 @overwrite_byte(i32 34)
%40 = tail call i32 @overwrite_byte(i32 51)
%41 = tail call i32 @overwrite_byte(i32 68)
%42 = tail call i32 @overwrite_byte(i32 85)
%43 = tail call i32 @overwrite_byte(i32 102)
%44 = tail call i32 @overwrite_byte(i32 119)
%45 = tail call i32 @overwrite_byte(i32 136)
%46 = tail call i32 @overwrite_byte(i32 153)
%47 = tail call i32 @overwrite_byte(i32 170)
%48 = tail call i32 @overwrite_byte(i32 187)
%49 = tail call i32 @overwrite_byte(i32 204)
%50 = tail call i32 @overwrite_byte(i32 221)
%51 = tail call i32 @overwrite_byte(i32 238)
%52 = tail call i32 @overwrite_byte(i32 255)
%53 = tail call i32 @overwrite_bytes(i32 146, i32 73, i32 36)
%54 = tail call i32 @overwrite_bytes(i32 73, i32 36, i32 146)
%55 = tail call i32 @overwrite_bytes(i32 36, i32 146, i32 73)
%56 = tail call i32 @overwrite_bytes(i32 109, i32 182, i32 219)
%57 = tail call i32 @overwrite_bytes(i32 182, i32 219, i32 109)
%58 = tail call i32 @overwrite_bytes(i32 219, i32 109, i32 182)
%59 = tail call i32 @overwrite_random(i32 4)
%60 = tail call i32 @overwrite_byte(i32 0)
br label %61
61: ; preds = %30, %28, %21, %15, %4
ret void
}