#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;

/* Variables and functions */
void Set_Fan(uint8_t enable) {
  if (enable < 0xff) {
    (*(volatile unsigned long *)(0xE002C000 + 0x00)) |= (2 << 16);
  } else {
    (*(volatile unsigned long *)(0xE002C000 + 0x00)) &= ~(2 << 16);
    enable = 0xfe;
  }
  (*(volatile unsigned long *)(0xE0014000 + 0x40)) = 0xff - enable;
  (*(volatile unsigned long *)(0xE0014000 + 0x50)) |= (1 << 4);
}


x86 assembly (clang, -O0):
<Set_Fan>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0xff,-0x4(%rbp)
jge    1130 <Set_Fan+0x30>
mov    $0xe002c000,%eax
mov    (%rax),%rcx
or     $0x20000,%rcx
mov    $0xe002c000,%eax
mov    %rcx,(%rax)
jmp    114e <Set_Fan+0x4e>
mov    $0xe002c000,%eax
mov    (%rax),%rcx
and    $0xfffffffffffdffff,%rcx
mov    $0xe002c000,%eax
mov    %rcx,(%rax)
movl   $0xfe,-0x4(%rbp)
mov    $0xff,%eax
sub    -0x4(%rbp),%eax
movslq %eax,%rcx
mov    $0xe0014040,%eax
mov    %rcx,(%rax)
mov    $0xe0014050,%eax
mov    (%rax),%rcx
or     $0x10,%rcx
mov    $0xe0014050,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<Set_Fan>:
mov    $0xe002c000,%eax
mov    (%rax),%rcx
cmp    $0xfe,%edi
jg     1126 <Set_Fan+0x26>
or     $0x20000,%rcx
mov    %rcx,(%rax)
mov    $0xff,%ecx
sub    %edi,%ecx
movslq %ecx,%rcx
jmp    1135 <Set_Fan+0x35>
and    $0xfffffffffffdffff,%rcx
mov    %rcx,(%rax)
mov    $0x1,%ecx
mov    %rcx,-0x17fc0(%rax)
orq    $0x10,-0x17fb0(%rax)
10
ret

LLVM IR (-O0):
define void @Set_Fan(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 255
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load volatile i64, i64* inttoptr (i64 3758276608 to i64*)
%7 = or i64 %6, 131072
store volatile i64 %7, i64* inttoptr (i64 3758276608 to i64*)
br label %11
8: ; preds = %1
%9 = load volatile i64, i64* inttoptr (i64 3758276608 to i64*)
%10 = and i64 %9, -131073
store volatile i64 %10, i64* inttoptr (i64 3758276608 to i64*)
store i32 254, i32* %2
br label %11
11: ; preds = %8, %5
%12 = load i32, i32* %2
%13 = sub nsw i32 255, %12
%14 = sext i32 %13 to i64
store volatile i64 %14, i64* inttoptr (i64 3758178368 to i64*)
%15 = load volatile i64, i64* inttoptr (i64 3758178384 to i64*)
%16 = or i64 %15, 16
store volatile i64 %16, i64* inttoptr (i64 3758178384 to i64*)
ret void
}

LLVM IR (-O2):
define void @Set_Fan(i32 %0) {
%2 = icmp slt i32 %0, 255
%3 = load volatile i64, i64* inttoptr (i64 3758276608 to i64*)
br i1 %2, label %4, label %8
4: ; preds = %1
%5 = or i64 %3, 131072
store volatile i64 %5, i64* inttoptr (i64 3758276608 to i64*)
%6 = sub i32 255, %0
%7 = sext i32 %6 to i64
br label %10
8: ; preds = %1
%9 = and i64 %3, -131073
store volatile i64 %9, i64* inttoptr (i64 3758276608 to i64*)
br label %10
10: ; preds = %8, %4
%11 = phi i64 [ %7, %4 ], [ 1, %8 ]
store volatile i64 %11, i64* inttoptr (i64 3758178368 to i64*)
%12 = load volatile i64, i64* inttoptr (i64 3758178384 to i64*)
%13 = or i64 %12, 16
store volatile i64 %13, i64* inttoptr (i64 3758178384 to i64*)
ret void
}