#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 */
uint32_t EMACIntStatus(uint32_t ui32Base, bool bMasked) {
  uint32_t ui32Val, ui32PHYStat;
  ;
  ui32Val = (*((volatile uint32_t *)(ui32Base + 0x00000C14)));
  ui32Val &= ~(0x03800000 | 0x00700000 | 0x000E0000);
  if (bMasked) {
    ui32Val &= ((0x20000000 | 0x10000000 | 0x08000000) |
                (*((volatile uint32_t *)(ui32Base + 0x00000C1C))));
  }
  if (bMasked) {
    ui32PHYStat = (*((volatile uint32_t *)(ui32Base + 0x00000FD8)));
  } else {
    ui32PHYStat = (*((volatile uint32_t *)(ui32Base + 0x00000FD0)));
  }
  if (ui32PHYStat & 0x00000001) {
    ui32Val |= 0x80000000;
  }
  return (ui32Val);
}


x86 assembly (clang, -O0):
<EMACIntStatus>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc14,%eax
cltq
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0xfc01ffff,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1145 <EMACIntStatus+0x45>
mov    -0x4(%rbp),%eax
add    $0xc1c,%eax
cltq
mov    (%rax),%eax
or     $0x38000000,%eax
and    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1163 <EMACIntStatus+0x63>
mov    -0x4(%rbp),%eax
add    $0xfd8,%eax
cltq
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
jmp    1172 <EMACIntStatus+0x72>
mov    -0x4(%rbp),%eax
add    $0xfd0,%eax
cltq
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     118c <EMACIntStatus+0x8c>
mov    -0xc(%rbp),%eax
or     $0x80000000,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<EMACIntStatus>:
movslq %edi,%rax
mov    $0xfc01ffff,%ecx
and    0xc14(%rax),%ecx
test   %esi,%esi
je     1126 <EMACIntStatus+0x26>
mov    $0x38000000,%edx
or     0xc1c(%rax),%edx
and    %edx,%ecx
mov    $0xfd8,%edx
jmp    112b <EMACIntStatus+0x2b>
mov    $0xfd0,%edx
mov    %edx,%edx
mov    (%rdx,%rax,1),%eax
shl    $0x1f,%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @EMACIntStatus(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = add nsw i32 %7, 3092
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i32*
%11 = load volatile i32, i32* %10
store i32 %11, i32* %5
%12 = load i32, i32* %5
%13 = and i32 %12, -66977793
store i32 %13, i32* %5
%14 = load i32, i32* %4
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %25
16: ; preds = %2
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 3100
%19 = sext i32 %18 to i64
%20 = inttoptr i64 %19 to i32*
%21 = load volatile i32, i32* %20
%22 = or i32 939524096, %21
%23 = load i32, i32* %5
%24 = and i32 %23, %22
store i32 %24, i32* %5
br label %25
25: ; preds = %16, %2
%26 = load i32, i32* %4
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %34
28: ; preds = %25
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 4056
%31 = sext i32 %30 to i64
%32 = inttoptr i64 %31 to i32*
%33 = load volatile i32, i32* %32
store i32 %33, i32* %6
br label %40
34: ; preds = %25
%35 = load i32, i32* %3
%36 = add nsw i32 %35, 4048
%37 = sext i32 %36 to i64
%38 = inttoptr i64 %37 to i32*
%39 = load volatile i32, i32* %38
store i32 %39, i32* %6
br label %40
40: ; preds = %34, %28
%41 = load i32, i32* %6
%42 = and i32 %41, 1
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %47
44: ; preds = %40
%45 = load i32, i32* %5
%46 = or i32 %45, -2147483648
store i32 %46, i32* %5
br label %47
47: ; preds = %44, %40
%48 = load i32, i32* %5
ret i32 %48
}

LLVM IR (-O2):
define i32 @EMACIntStatus(i32 %0, i32 %1) {
%3 = add nsw i32 %0, 3092
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i32*
%6 = load volatile i32, i32* %5
%7 = and i32 %6, -66977793
%8 = icmp eq i32 %1, 0
br i1 %8, label %16, label %9
9: ; preds = %2
%10 = add nsw i32 %0, 3100
%11 = sext i32 %10 to i64
%12 = inttoptr i64 %11 to i32*
%13 = load volatile i32, i32* %12
%14 = or i32 %13, 939524096
%15 = and i32 %14, %7
br label %16
16: ; preds = %9, %2
%17 = phi i32 [ 4056, %9 ], [ 4048, %2 ]
%18 = phi i32 [ %15, %9 ], [ %7, %2 ]
%19 = add nsw i32 %17, %0
%20 = sext i32 %19 to i64
%21 = inttoptr i64 %20 to i32*
%22 = load volatile i32, i32* %21
%23 = shl i32 %22, 31
%24 = or i32 %23, %18
ret i32 %24
}