#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*/ regmask32(int, int, int);
int regread32(int);
int /*<<< orphan*/ regwrite32(int, int);
void mmc_init(void) {
  regmask32(0x44e00000 + 0x3c, (0b11 << 0), (0b10 << 0));
  regwrite32(0x48060000 + 0x110, (1 << 1));
  while (!(regread32(0x48060000 + 0x114) & (1 << 0)))
    ;
  regmask32(0x48060000 + 0x240, (0b111 << 24), (1 << 26) | (1 << 25));
  regmask32(0x48060000 + 0x110, (0b11 << 8), (0b11 << 8));
  regmask32(0x48060000 + 0x110, (0b11 << 3), (0b01 << 3));
  regmask32(0x48060000 + 0x110, (1 << 2), (0 << 2));
  regmask32(0x48060000 + 0x110, (1 << 0), (0 << 0));
  regmask32(0x48060000 + 0x12c, (1 << 5), (0 << 5));
  regmask32(0x48060000 + 0x228, (1 << 1), (0 << 1));
  regmask32(0x48060000 + 0x228, (0b111 << 9), (0x6 << 9));
  regmask32(0x48060000 + 0x228, (1 << 8), (1 << 8));
  while (!(regread32(0x48060000 + 0x228) & (1 << 8)))
    ;
  regmask32(0x48060000 + 0x22c, (1 << 0), (1 << 0));
  regmask32(0x48060000 + 0x22c, (1 << 2), (1 << 2));
  regmask32(0x48060000 + 0x22c, (0x3ff << 6), (0x3ff << 6));
  while (!(regread32(0x48060000 + 0x22c) & (1 << 1)))
    ;
  regmask32(0x48060000 + 0x234, 0x337f07ff, 0x337f07ff);
}


x86 assembly (clang, -O0):
<mmc_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x44e0003c,%edi
mov    $0x3,%esi
mov    $0x2,%edx
call   1040 <regmask32@plt>
mov    $0x48060110,%edi
mov    $0x2,%esi
call   1050 <regwrite32@plt>
mov    $0x48060114,%edi
call   1030 <regread32@plt>
and    $0x1,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1179 <mmc_init+0x49>
jmp    117e <mmc_init+0x4e>
jmp    1157 <mmc_init+0x27>
mov    $0x48060240,%edi
mov    $0x7000000,%esi
mov    $0x6000000,%edx
call   1040 <regmask32@plt>
mov    $0x48060110,%edi
mov    $0x300,%edx
mov    %edx,%esi
call   1040 <regmask32@plt>
mov    $0x48060110,%edi
mov    $0x18,%esi
mov    $0x8,%edx
call   1040 <regmask32@plt>
mov    $0x48060110,%edi
mov    $0x4,%esi
xor    %edx,%edx
call   1040 <regmask32@plt>
mov    $0x48060110,%edi
mov    $0x1,%esi
xor    %edx,%edx
call   1040 <regmask32@plt>
mov    $0x4806012c,%edi
mov    $0x20,%esi
xor    %edx,%edx
call   1040 <regmask32@plt>
mov    $0x48060228,%edi
mov    $0x2,%esi
xor    %edx,%edx
call   1040 <regmask32@plt>
mov    $0x48060228,%edi
mov    $0xe00,%esi
mov    $0xc00,%edx
call   1040 <regmask32@plt>
mov    $0x48060228,%edi
mov    $0x100,%edx
mov    %edx,%esi
call   1040 <regmask32@plt>
mov    $0x48060228,%edi
call   1030 <regread32@plt>
and    $0x100,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1244 <mmc_init+0x114>
jmp    1249 <mmc_init+0x119>
jmp    1220 <mmc_init+0xf0>
mov    $0x4806022c,%edi
mov    $0x1,%edx
mov    %edx,%esi
call   1040 <regmask32@plt>
mov    $0x4806022c,%edi
mov    $0x4,%edx
mov    %edx,%esi
call   1040 <regmask32@plt>
mov    $0x4806022c,%edi
mov    $0xffc0,%edx
mov    %edx,%esi
call   1040 <regmask32@plt>
mov    $0x4806022c,%edi
call   1030 <regread32@plt>
and    $0x2,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    129e <mmc_init+0x16e>
jmp    12a3 <mmc_init+0x173>
jmp    127c <mmc_init+0x14c>
mov    $0x48060234,%edi
mov    $0x337f07ff,%edx
mov    %edx,%esi
call   1040 <regmask32@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<mmc_init>:
push   %rax
mov    $0x44e0003c,%edi
mov    $0x3,%esi
mov    $0x2,%edx
call   1040 <regmask32@plt>
mov    $0x48060110,%edi
mov    $0x2,%esi
call   1050 <regwrite32@plt>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x48060114,%edi
call   1030 <regread32@plt>
test   $0x1,%al
je     1160 <mmc_init+0x30>
mov    $0x48060240,%edi
mov    $0x7000000,%esi
mov    $0x6000000,%edx
call   1040 <regmask32@plt>
mov    $0x48060110,%edi
mov    $0x300,%esi
mov    $0x300,%edx
call   1040 <regmask32@plt>
mov    $0x48060110,%edi
mov    $0x18,%esi
mov    $0x8,%edx
call   1040 <regmask32@plt>
mov    $0x48060110,%edi
mov    $0x4,%esi
xor    %edx,%edx
call   1040 <regmask32@plt>
mov    $0x48060110,%edi
mov    $0x1,%esi
xor    %edx,%edx
call   1040 <regmask32@plt>
mov    $0x4806012c,%edi
mov    $0x20,%esi
xor    %edx,%edx
call   1040 <regmask32@plt>
mov    $0x48060228,%edi
mov    $0x2,%esi
xor    %edx,%edx
call   1040 <regmask32@plt>
mov    $0x48060228,%edi
mov    $0xe00,%esi
mov    $0xc00,%edx
call   1040 <regmask32@plt>
mov    $0x48060228,%edi
mov    $0x100,%esi
mov    $0x100,%edx
call   1040 <regmask32@plt>
cs nopw 0x0(%rax,%rax,1)
mov    $0x48060228,%edi
call   1030 <regread32@plt>
test   $0x100,%eax
je     1220 <mmc_init+0xf0>
mov    $0x4806022c,%edi
mov    $0x1,%esi
mov    $0x1,%edx
call   1040 <regmask32@plt>
mov    $0x4806022c,%edi
mov    $0x4,%esi
mov    $0x4,%edx
call   1040 <regmask32@plt>
mov    $0x4806022c,%edi
mov    $0xffc0,%esi
mov    $0xffc0,%edx
call   1040 <regmask32@plt>
nopl   (%rax)
mov    $0x4806022c,%edi
call   1030 <regread32@plt>
test   $0x2,%al
je     1270 <mmc_init+0x140>
mov    $0x48060234,%edi
mov    $0x337f07ff,%esi
mov    $0x337f07ff,%edx
pop    %rax
jmp    1040 <regmask32@plt>

LLVM IR (-O0):
define void @mmc_init() {
%1 = call i32 @regmask32(i32 1155530812, i32 3, i32 2)
%2 = call i32 @regwrite32(i32 1208353040, i32 2)
br label %3
3: ; preds = %8, %0
%4 = call i32 @regread32(i32 1208353044)
%5 = and i32 %4, 1
%6 = icmp ne i32 %5, 0
%7 = xor i1 %6, true
br i1 %7, label %8, label %9
8: ; preds = %3
br label %3
9: ; preds = %3
%10 = call i32 @regmask32(i32 1208353344, i32 117440512, i32 100663296)
%11 = call i32 @regmask32(i32 1208353040, i32 768, i32 768)
%12 = call i32 @regmask32(i32 1208353040, i32 24, i32 8)
%13 = call i32 @regmask32(i32 1208353040, i32 4, i32 0)
%14 = call i32 @regmask32(i32 1208353040, i32 1, i32 0)
%15 = call i32 @regmask32(i32 1208353068, i32 32, i32 0)
%16 = call i32 @regmask32(i32 1208353320, i32 2, i32 0)
%17 = call i32 @regmask32(i32 1208353320, i32 3584, i32 3072)
%18 = call i32 @regmask32(i32 1208353320, i32 256, i32 256)
br label %19
19: ; preds = %24, %9
%20 = call i32 @regread32(i32 1208353320)
%21 = and i32 %20, 256
%22 = icmp ne i32 %21, 0
%23 = xor i1 %22, true
br i1 %23, label %24, label %25
24: ; preds = %19
br label %19
25: ; preds = %19
%26 = call i32 @regmask32(i32 1208353324, i32 1, i32 1)
%27 = call i32 @regmask32(i32 1208353324, i32 4, i32 4)
%28 = call i32 @regmask32(i32 1208353324, i32 65472, i32 65472)
br label %29
29: ; preds = %34, %25
%30 = call i32 @regread32(i32 1208353324)
%31 = and i32 %30, 2
%32 = icmp ne i32 %31, 0
%33 = xor i1 %32, true
br i1 %33, label %34, label %35
34: ; preds = %29
br label %29
35: ; preds = %29
%36 = call i32 @regmask32(i32 1208353332, i32 863963135, i32 863963135)
ret void
}

LLVM IR (-O2):
define void @mmc_init() {
%1 = tail call i32 @regmask32(i32 1155530812, i32 3, i32 2)
%2 = tail call i32 @regwrite32(i32 1208353040, i32 2)
br label %3
3: ; preds = %3, %0
%4 = tail call i32 @regread32(i32 1208353044)
%5 = and i32 %4, 1
%6 = icmp eq i32 %5, 0
br i1 %6, label %3, label %7
7: ; preds = %3
%8 = tail call i32 @regmask32(i32 1208353344, i32 117440512, i32 100663296)
%9 = tail call i32 @regmask32(i32 1208353040, i32 768, i32 768)
%10 = tail call i32 @regmask32(i32 1208353040, i32 24, i32 8)
%11 = tail call i32 @regmask32(i32 1208353040, i32 4, i32 0)
%12 = tail call i32 @regmask32(i32 1208353040, i32 1, i32 0)
%13 = tail call i32 @regmask32(i32 1208353068, i32 32, i32 0)
%14 = tail call i32 @regmask32(i32 1208353320, i32 2, i32 0)
%15 = tail call i32 @regmask32(i32 1208353320, i32 3584, i32 3072)
%16 = tail call i32 @regmask32(i32 1208353320, i32 256, i32 256)
br label %17
17: ; preds = %17, %7
%18 = tail call i32 @regread32(i32 1208353320)
%19 = and i32 %18, 256
%20 = icmp eq i32 %19, 0
br i1 %20, label %17, label %21
21: ; preds = %17
%22 = tail call i32 @regmask32(i32 1208353324, i32 1, i32 1)
%23 = tail call i32 @regmask32(i32 1208353324, i32 4, i32 4)
%24 = tail call i32 @regmask32(i32 1208353324, i32 65472, i32 65472)
br label %25
25: ; preds = %25, %21
%26 = tail call i32 @regread32(i32 1208353324)
%27 = and i32 %26, 2
%28 = icmp eq i32 %27, 0
br i1 %28, label %25, label %29
29: ; preds = %25
%30 = tail call i32 @regmask32(i32 1208353332, i32 863963135, i32 863963135)
ret void
}