#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*/ DisableInterrupts();
int /*<<< orphan*/ EnableInterrupts();
void PortB_Init(void) {
  DisableInterrupts();
  (*((volatile uint32_t *)0x400FE608)) |= 0x00000002;
  while (((*((volatile uint32_t *)0x400FEA08)) & 0x00000002) == 0) {
  }
  (*((volatile uint32_t *)0x40005528)) &= ~0xFF;
  (*((volatile uint32_t *)0x4000552C)) &= ~0xFFFFFFFF;
  (*((volatile uint32_t *)0x40005400)) |= 0xFF;
  (*((volatile uint32_t *)0x40005420)) &= ~0xFF;
  (*((volatile uint32_t *)0x4000551C)) |= 0xFF;
  EnableInterrupts();
}


x86 assembly (clang, -O0):
<PortB_Init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <DisableInterrupts@plt>
mov    $0x400fe608,%eax
mov    (%rax),%ecx
or     $0x2,%ecx
mov    $0x400fe608,%eax
mov    %ecx,(%rax)
mov    $0x400fea08,%eax
mov    (%rax),%eax
and    $0x2,%eax
cmp    $0x0,%eax
jne    1154 <PortB_Init+0x34>
jmp    113c <PortB_Init+0x1c>
mov    $0x40005528,%eax
mov    (%rax),%ecx
and    $0xffffff00,%ecx
mov    $0x40005528,%eax
mov    %ecx,(%rax)
mov    $0x4000552c,%eax
mov    (%rax),%ecx
and    $0x0,%ecx
mov    $0x4000552c,%eax
mov    %ecx,(%rax)
mov    $0x40005400,%eax
mov    (%rax),%ecx
or     $0xff,%ecx
mov    $0x40005400,%eax
mov    %ecx,(%rax)
mov    $0x40005420,%eax
mov    (%rax),%ecx
and    $0xffffff00,%ecx
mov    $0x40005420,%eax
mov    %ecx,(%rax)
mov    $0x4000551c,%eax
mov    (%rax),%ecx
or     $0xff,%ecx
mov    $0x4000551c,%eax
mov    %ecx,(%rax)
mov    $0x0,%al
call   1040 <EnableInterrupts@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<PortB_Init>:
push   %rax
xor    %eax,%eax
call   1030 <DisableInterrupts@plt>
orl    $0x2,0x400fe608
02
testl  $0x2,0x400fea08
je     1130 <PortB_Init+0x10>
andl   $0xffffff00,0x40005528
mov    0x4000552c,%eax
movl   $0x0,0x4000552c
orl    $0xff,0x40005400
andl   $0xffffff00,0x40005420
orl    $0xff,0x4000551c
xor    %eax,%eax
pop    %rcx
jmp    1040 <EnableInterrupts@plt>

LLVM IR (-O0):
define void @PortB_Init() {
%1 = call i32 (...) @DisableInterrupts()
%2 = load volatile i32, i32* inttoptr (i64 1074783752 to i32*)
%3 = or i32 %2, 2
store volatile i32 %3, i32* inttoptr (i64 1074783752 to i32*)
br label %4
4: ; preds = %8, %0
%5 = load volatile i32, i32* inttoptr (i64 1074784776 to i32*)
%6 = and i32 %5, 2
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %4
br label %4
9: ; preds = %4
%10 = load volatile i32, i32* inttoptr (i64 1073763624 to i32*)
%11 = and i32 %10, -256
store volatile i32 %11, i32* inttoptr (i64 1073763624 to i32*)
%12 = load volatile i32, i32* inttoptr (i64 1073763628 to i32*)
%13 = and i32 %12, 0
store volatile i32 %13, i32* inttoptr (i64 1073763628 to i32*)
%14 = load volatile i32, i32* inttoptr (i64 1073763328 to i32*)
%15 = or i32 %14, 255
store volatile i32 %15, i32* inttoptr (i64 1073763328 to i32*)
%16 = load volatile i32, i32* inttoptr (i64 1073763360 to i32*)
%17 = and i32 %16, -256
store volatile i32 %17, i32* inttoptr (i64 1073763360 to i32*)
%18 = load volatile i32, i32* inttoptr (i64 1073763612 to i32*)
%19 = or i32 %18, 255
store volatile i32 %19, i32* inttoptr (i64 1073763612 to i32*)
%20 = call i32 (...) @EnableInterrupts()
ret void
}

LLVM IR (-O2):
define void @PortB_Init() {
%1 = tail call i32 (...) @DisableInterrupts()
%2 = load volatile i32, i32* inttoptr (i64 1074783752 to i32*)
%3 = or i32 %2, 2
store volatile i32 %3, i32* inttoptr (i64 1074783752 to i32*)
br label %4
4: ; preds = %4, %0
%5 = load volatile i32, i32* inttoptr (i64 1074784776 to i32*)
%6 = and i32 %5, 2
%7 = icmp eq i32 %6, 0
br i1 %7, label %4, label %8
8: ; preds = %4
%9 = load volatile i32, i32* inttoptr (i64 1073763624 to i32*)
%10 = and i32 %9, -256
store volatile i32 %10, i32* inttoptr (i64 1073763624 to i32*)
%11 = load volatile i32, i32* inttoptr (i64 1073763628 to i32*)
store volatile i32 0, i32* inttoptr (i64 1073763628 to i32*)
%12 = load volatile i32, i32* inttoptr (i64 1073763328 to i32*)
%13 = or i32 %12, 255
store volatile i32 %13, i32* inttoptr (i64 1073763328 to i32*)
%14 = load volatile i32, i32* inttoptr (i64 1073763360 to i32*)
%15 = and i32 %14, -256
store volatile i32 %15, i32* inttoptr (i64 1073763360 to i32*)
%16 = load volatile i32, i32* inttoptr (i64 1073763612 to i32*)
%17 = or i32 %16, 255
store volatile i32 %17, i32* inttoptr (i64 1073763612 to i32*)
%18 = tail call i32 (...) @EnableInterrupts()
ret void
}