#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*/ led_write(int);
int /*<<< orphan*/ regmask32(int, int, int);
int regread32(int);
void led_init(void) {
  regmask32(0x44e10000 + 0x854, (1 << 6), (0 << 6));
  regmask32(0x44e10000 + 0x854, (1 << 5), (1 << 5));
  regmask32(0x44e10000 + 0x854, (1 << 4), (0 << 4));
  regmask32(0x44e10000 + 0x854, (1 << 3), (0 << 3));
  regmask32(0x44e10000 + 0x854, (0b111 << 0), (0b111 << 0));
  regmask32(0x44e10000 + 0x858, (1 << 6), (0 << 6));
  regmask32(0x44e10000 + 0x858, (1 << 5), (1 << 5));
  regmask32(0x44e10000 + 0x858, (1 << 4), (0 << 4));
  regmask32(0x44e10000 + 0x858, (1 << 3), (0 << 3));
  regmask32(0x44e10000 + 0x858, (0b111 << 0), (0b111 << 0));
  regmask32(0x44e10000 + 0x85c, (1 << 6), (0 << 6));
  regmask32(0x44e10000 + 0x85c, (1 << 5), (1 << 5));
  regmask32(0x44e10000 + 0x85c, (1 << 4), (0 << 4));
  regmask32(0x44e10000 + 0x85c, (1 << 3), (0 << 3));
  regmask32(0x44e10000 + 0x85c, (0b111 << 0), (0b111 << 0));
  regmask32(0x44e10000 + 0x860, (1 << 6), (0 << 6));
  regmask32(0x44e10000 + 0x860, (1 << 5), (1 << 5));
  regmask32(0x44e10000 + 0x860, (1 << 4), (0 << 4));
  regmask32(0x44e10000 + 0x860, (1 << 3), (0 << 3));
  regmask32(0x44e10000 + 0x860, (0b111 << 0), (0b111 << 0));
  regmask32(0x44e00000 + 0xac, (0b11 << 0), (0b10 << 0));
  while ((regread32(0x44e00000 + 0xac) & (0b11 << 0)) != (0b10 << 0))
    ;
  regmask32(0x4804c000 + 0x134, (0b1111 << 21), 0);
  led_write(0b0110);
}


x86 assembly (clang, -O0):
<led_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x44e10854,%edi
mov    $0x40,%esi
xor    %edx,%edx
call   1050 <regmask32@plt>
mov    $0x44e10854,%edi
mov    $0x20,%edx
mov    %edx,%esi
call   1050 <regmask32@plt>
mov    $0x44e10854,%edi
mov    $0x10,%esi
xor    %edx,%edx
call   1050 <regmask32@plt>
mov    $0x44e10854,%edi
mov    $0x8,%esi
xor    %edx,%edx
call   1050 <regmask32@plt>
mov    $0x44e10854,%edi
mov    $0x7,%edx
mov    %edx,%esi
call   1050 <regmask32@plt>
mov    $0x44e10858,%edi
mov    $0x40,%esi
xor    %edx,%edx
call   1050 <regmask32@plt>
mov    $0x44e10858,%edi
mov    $0x20,%edx
mov    %edx,%esi
call   1050 <regmask32@plt>
mov    $0x44e10858,%edi
mov    $0x10,%esi
xor    %edx,%edx
call   1050 <regmask32@plt>
mov    $0x44e10858,%edi
mov    $0x8,%esi
xor    %edx,%edx
call   1050 <regmask32@plt>
mov    $0x44e10858,%edi
mov    $0x7,%edx
mov    %edx,%esi
call   1050 <regmask32@plt>
mov    $0x44e1085c,%edi
mov    $0x40,%esi
xor    %edx,%edx
call   1050 <regmask32@plt>
mov    $0x44e1085c,%edi
mov    $0x20,%edx
mov    %edx,%esi
call   1050 <regmask32@plt>
mov    $0x44e1085c,%edi
mov    $0x10,%esi
xor    %edx,%edx
call   1050 <regmask32@plt>
mov    $0x44e1085c,%edi
mov    $0x8,%esi
xor    %edx,%edx
call   1050 <regmask32@plt>
mov    $0x44e1085c,%edi
mov    $0x7,%edx
mov    %edx,%esi
call   1050 <regmask32@plt>
mov    $0x44e10860,%edi
mov    $0x40,%esi
xor    %edx,%edx
call   1050 <regmask32@plt>
mov    $0x44e10860,%edi
mov    $0x20,%edx
mov    %edx,%esi
call   1050 <regmask32@plt>
mov    $0x44e10860,%edi
mov    $0x10,%esi
xor    %edx,%edx
call   1050 <regmask32@plt>
mov    $0x44e10860,%edi
mov    $0x8,%esi
xor    %edx,%edx
call   1050 <regmask32@plt>
mov    $0x44e10860,%edi
mov    $0x7,%edx
mov    %edx,%esi
call   1050 <regmask32@plt>
mov    $0x44e000ac,%edi
mov    $0x3,%esi
mov    $0x2,%edx
call   1050 <regmask32@plt>
mov    $0x44e000ac,%edi
call   1030 <regread32@plt>
and    $0x3,%eax
cmp    $0x2,%eax
je     12b7 <led_init+0x187>
jmp    129c <led_init+0x16c>
mov    $0x4804c134,%edi
mov    $0x1e00000,%esi
xor    %edx,%edx
call   1050 <regmask32@plt>
mov    $0x6,%edi
call   1040 <led_write@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<led_init>:
push   %rax
mov    $0x44e10854,%edi
mov    $0x40,%esi
xor    %edx,%edx
call   1050 <regmask32@plt>
mov    $0x44e10854,%edi
mov    $0x20,%esi
mov    $0x20,%edx
call   1050 <regmask32@plt>
mov    $0x44e10854,%edi
mov    $0x10,%esi
xor    %edx,%edx
call   1050 <regmask32@plt>
mov    $0x44e10854,%edi
mov    $0x8,%esi
xor    %edx,%edx
call   1050 <regmask32@plt>
mov    $0x44e10854,%edi
mov    $0x7,%esi
mov    $0x7,%edx
call   1050 <regmask32@plt>
mov    $0x44e10858,%edi
mov    $0x40,%esi
xor    %edx,%edx
call   1050 <regmask32@plt>
mov    $0x44e10858,%edi
mov    $0x20,%esi
mov    $0x20,%edx
call   1050 <regmask32@plt>
mov    $0x44e10858,%edi
mov    $0x10,%esi
xor    %edx,%edx
call   1050 <regmask32@plt>
mov    $0x44e10858,%edi
mov    $0x8,%esi
xor    %edx,%edx
call   1050 <regmask32@plt>
mov    $0x44e10858,%edi
mov    $0x7,%esi
mov    $0x7,%edx
call   1050 <regmask32@plt>
mov    $0x44e1085c,%edi
mov    $0x40,%esi
xor    %edx,%edx
call   1050 <regmask32@plt>
mov    $0x44e1085c,%edi
mov    $0x20,%esi
mov    $0x20,%edx
call   1050 <regmask32@plt>
mov    $0x44e1085c,%edi
mov    $0x10,%esi
xor    %edx,%edx
call   1050 <regmask32@plt>
mov    $0x44e1085c,%edi
mov    $0x8,%esi
xor    %edx,%edx
call   1050 <regmask32@plt>
mov    $0x44e1085c,%edi
mov    $0x7,%esi
mov    $0x7,%edx
call   1050 <regmask32@plt>
mov    $0x44e10860,%edi
mov    $0x40,%esi
xor    %edx,%edx
call   1050 <regmask32@plt>
mov    $0x44e10860,%edi
mov    $0x20,%esi
mov    $0x20,%edx
call   1050 <regmask32@plt>
mov    $0x44e10860,%edi
mov    $0x10,%esi
xor    %edx,%edx
call   1050 <regmask32@plt>
mov    $0x44e10860,%edi
mov    $0x8,%esi
xor    %edx,%edx
call   1050 <regmask32@plt>
mov    $0x44e10860,%edi
mov    $0x7,%esi
mov    $0x7,%edx
call   1050 <regmask32@plt>
mov    $0x44e000ac,%edi
mov    $0x3,%esi
mov    $0x2,%edx
call   1050 <regmask32@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x44e000ac,%edi
call   1030 <regread32@plt>
and    $0x3,%eax
cmp    $0x2,%eax
jne    12c0 <led_init+0x190>
mov    $0x4804c134,%edi
mov    $0x1e00000,%esi
xor    %edx,%edx
call   1050 <regmask32@plt>
mov    $0x6,%edi
pop    %rax
jmp    1040 <led_write@plt>

LLVM IR (-O0):
define void @led_init() {
%1 = call i32 @regmask32(i32 1155598420, i32 64, i32 0)
%2 = call i32 @regmask32(i32 1155598420, i32 32, i32 32)
%3 = call i32 @regmask32(i32 1155598420, i32 16, i32 0)
%4 = call i32 @regmask32(i32 1155598420, i32 8, i32 0)
%5 = call i32 @regmask32(i32 1155598420, i32 7, i32 7)
%6 = call i32 @regmask32(i32 1155598424, i32 64, i32 0)
%7 = call i32 @regmask32(i32 1155598424, i32 32, i32 32)
%8 = call i32 @regmask32(i32 1155598424, i32 16, i32 0)
%9 = call i32 @regmask32(i32 1155598424, i32 8, i32 0)
%10 = call i32 @regmask32(i32 1155598424, i32 7, i32 7)
%11 = call i32 @regmask32(i32 1155598428, i32 64, i32 0)
%12 = call i32 @regmask32(i32 1155598428, i32 32, i32 32)
%13 = call i32 @regmask32(i32 1155598428, i32 16, i32 0)
%14 = call i32 @regmask32(i32 1155598428, i32 8, i32 0)
%15 = call i32 @regmask32(i32 1155598428, i32 7, i32 7)
%16 = call i32 @regmask32(i32 1155598432, i32 64, i32 0)
%17 = call i32 @regmask32(i32 1155598432, i32 32, i32 32)
%18 = call i32 @regmask32(i32 1155598432, i32 16, i32 0)
%19 = call i32 @regmask32(i32 1155598432, i32 8, i32 0)
%20 = call i32 @regmask32(i32 1155598432, i32 7, i32 7)
%21 = call i32 @regmask32(i32 1155530924, i32 3, i32 2)
br label %22
22: ; preds = %26, %0
%23 = call i32 @regread32(i32 1155530924)
%24 = and i32 %23, 3
%25 = icmp ne i32 %24, 2
br i1 %25, label %26, label %27
26: ; preds = %22
br label %22
27: ; preds = %22
%28 = call i32 @regmask32(i32 1208271156, i32 31457280, i32 0)
%29 = call i32 @led_write(i32 6)
ret void
}

LLVM IR (-O2):
define void @led_init() {
%1 = tail call i32 @regmask32(i32 1155598420, i32 64, i32 0)
%2 = tail call i32 @regmask32(i32 1155598420, i32 32, i32 32)
%3 = tail call i32 @regmask32(i32 1155598420, i32 16, i32 0)
%4 = tail call i32 @regmask32(i32 1155598420, i32 8, i32 0)
%5 = tail call i32 @regmask32(i32 1155598420, i32 7, i32 7)
%6 = tail call i32 @regmask32(i32 1155598424, i32 64, i32 0)
%7 = tail call i32 @regmask32(i32 1155598424, i32 32, i32 32)
%8 = tail call i32 @regmask32(i32 1155598424, i32 16, i32 0)
%9 = tail call i32 @regmask32(i32 1155598424, i32 8, i32 0)
%10 = tail call i32 @regmask32(i32 1155598424, i32 7, i32 7)
%11 = tail call i32 @regmask32(i32 1155598428, i32 64, i32 0)
%12 = tail call i32 @regmask32(i32 1155598428, i32 32, i32 32)
%13 = tail call i32 @regmask32(i32 1155598428, i32 16, i32 0)
%14 = tail call i32 @regmask32(i32 1155598428, i32 8, i32 0)
%15 = tail call i32 @regmask32(i32 1155598428, i32 7, i32 7)
%16 = tail call i32 @regmask32(i32 1155598432, i32 64, i32 0)
%17 = tail call i32 @regmask32(i32 1155598432, i32 32, i32 32)
%18 = tail call i32 @regmask32(i32 1155598432, i32 16, i32 0)
%19 = tail call i32 @regmask32(i32 1155598432, i32 8, i32 0)
%20 = tail call i32 @regmask32(i32 1155598432, i32 7, i32 7)
%21 = tail call i32 @regmask32(i32 1155530924, i32 3, i32 2)
br label %22
22: ; preds = %22, %0
%23 = tail call i32 @regread32(i32 1155530924)
%24 = and i32 %23, 3
%25 = icmp eq i32 %24, 2
br i1 %25, label %26, label %22
26: ; preds = %22
%27 = tail call i32 @regmask32(i32 1208271156, i32 31457280, i32 0)
%28 = tail call i32 @led_write(i32 6)
ret void
}