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

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
int /*<<< orphan*/ _HibernateWriteComplete();
void HibernateTamperIODisable(uint32_t ui32Input) {
  ASSERT(ui32Input < 4);
  (*((volatile uint32_t *)(0x400FC360))) = 0xA3359554;
  _HibernateWriteComplete();
  (*((volatile uint32_t *)(0x400FC410))) &= ((~0x00000001) << (ui32Input << 3));
  _HibernateWriteComplete();
  (*((volatile uint32_t *)(0x400FC360))) = 0;
  _HibernateWriteComplete();
}


x86 assembly (clang, -O0):
<HibernateTamperIODisable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x4,-0x4(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <ASSERT@plt>
mov    $0x400fc360,%eax
movl   $0xa3359554,(%rax)
mov    $0x0,%al
call   1030 <_HibernateWriteComplete@plt>
mov    -0x4(%rbp),%ecx
shl    $0x3,%ecx
mov    $0xfffffffe,%eax
shl    %cl,%eax
mov    $0x400fc410,%ecx
mov    (%rcx),%ecx
and    %eax,%ecx
mov    $0x400fc410,%eax
mov    %ecx,(%rax)
mov    $0x0,%al
call   1030 <_HibernateWriteComplete@plt>
mov    $0x400fc360,%eax
movl   $0x0,(%rax)
mov    $0x0,%al
call   1030 <_HibernateWriteComplete@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HibernateTamperIODisable>:
push   %rbx
mov    %edi,%ebx
xor    %edi,%edi
cmp    $0x4,%ebx
setl   %dil
call   1040 <ASSERT@plt>
movl   $0xa3359554,0x400fc360
54 95 35 a3
xor    %eax,%eax
call   1030 <_HibernateWriteComplete@plt>
shl    $0x3,%ebx
mov    $0xfffffffe,%eax
mov    %ebx,%ecx
shl    %cl,%eax
and    %eax,0x400fc410
xor    %eax,%eax
call   1030 <_HibernateWriteComplete@plt>
movl   $0x0,0x400fc360
xor    %eax,%eax
pop    %rbx
jmp    1030 <_HibernateWriteComplete@plt>

LLVM IR (-O0):
define void @HibernateTamperIODisable(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 4
%5 = zext i1 %4 to i32
%6 = call i32 @ASSERT(i32 %5)
store volatile i32 -1556769452, i32* inttoptr (i64 1074774880 to i32*)
%7 = call i32 (...) @_HibernateWriteComplete()
%8 = load i32, i32* %2
%9 = shl i32 %8, 3
%10 = shl i32 -2, %9
%11 = load volatile i32, i32* inttoptr (i64 1074775056 to i32*)
%12 = and i32 %11, %10
store volatile i32 %12, i32* inttoptr (i64 1074775056 to i32*)
%13 = call i32 (...) @_HibernateWriteComplete()
store volatile i32 0, i32* inttoptr (i64 1074774880 to i32*)
%14 = call i32 (...) @_HibernateWriteComplete()
ret void
}

LLVM IR (-O2):
define void @HibernateTamperIODisable(i32 %0) {
%2 = icmp slt i32 %0, 4
%3 = zext i1 %2 to i32
%4 = tail call i32 @ASSERT(i32 %3)
store volatile i32 -1556769452, i32* inttoptr (i64 1074774880 to i32*)
%5 = tail call i32 (...) @_HibernateWriteComplete()
%6 = shl i32 %0, 3
%7 = shl i32 -2, %6
%8 = load volatile i32, i32* inttoptr (i64 1074775056 to i32*)
%9 = and i32 %8, %7
store volatile i32 %9, i32* inttoptr (i64 1074775056 to i32*)
%10 = tail call i32 (...) @_HibernateWriteComplete()
store volatile i32 0, i32* inttoptr (i64 1074774880 to i32*)
%11 = tail call i32 (...) @_HibernateWriteComplete()
ret void
}