#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 *);
void EMACConfigGet(uint32_t ui32Base, uint32_t *pui32Config,
                   uint32_t *pui32Mode, uint32_t *pui32RxMaxFrameSize) {
  uint32_t ui32Value;
  ASSERT(pui32Mode);
  ASSERT(pui32Config);
  ASSERT(pui32RxMaxFrameSize);
  *pui32Mode = (*((volatile uint32_t *)(ui32Base + 0x00000C18)));
  *pui32Config =
      ((*((volatile uint32_t *)(ui32Base + 0x00000000))) &
       ((0x40000000 | 0x20000000 | 0x30000000 | 0x08000000 | 0x02000000 |
         0x00400000 | 0x00100000 | 0x000E0000 | 0x00010000 | 0x00004000 |
         0x00002000 | 0x00001000 | 0x00000800 | 0x00000400 | 0x00000200 |
         0x00000080 | 0x00000060 | 0x00000010 | 0x00000003) |
        0x00000008 | 0x00000004));
  ui32Value = (*((volatile uint32_t *)(ui32Base + 0x000000DC)));
  if (ui32Value & 0x00010000) {
    *pui32RxMaxFrameSize = ui32Value & 0x00003FFF;
  } else {
    if ((*((volatile uint32_t *)(ui32Base + 0x00000000))) & 0x00100000) {
      *pui32RxMaxFrameSize = 10240;
    } else {
      *pui32RxMaxFrameSize = 2048;
    }
  }
}


x86 assembly (clang, -O0):
<EMACConfigGet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <ASSERT@plt>
mov    -0x10(%rbp),%rdi
call   1030 <ASSERT@plt>
mov    -0x20(%rbp),%rdi
call   1030 <ASSERT@plt>
mov    -0x4(%rbp),%eax
add    $0xc18,%eax
cltq
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
add    $0x0,%eax
cltq
mov    (%rax),%ecx
and    $0x7a5f7eff,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
add    $0xdc,%eax
cltq
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
and    $0x10000,%eax
cmp    $0x0,%eax
je     119e <EMACConfigGet+0x8e>
mov    -0x24(%rbp),%ecx
and    $0x3fff,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
jmp    11d4 <EMACConfigGet+0xc4>
mov    -0x4(%rbp),%eax
add    $0x0,%eax
cltq
mov    (%rax),%eax
and    $0x100000,%eax
cmp    $0x0,%eax
je     11c5 <EMACConfigGet+0xb5>
mov    -0x20(%rbp),%rax
movl   $0x2800,(%rax)
jmp    11cf <EMACConfigGet+0xbf>
mov    -0x20(%rbp),%rax
movl   $0x800,(%rax)
jmp    11d4 <EMACConfigGet+0xc4>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EMACConfigGet>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %edi,%ebp
mov    %rdx,%rdi
call   1030 <ASSERT@plt>
mov    %r15,%rdi
call   1030 <ASSERT@plt>
mov    %r14,%rdi
call   1030 <ASSERT@plt>
movslq %ebp,%rcx
mov    0xc18(%rcx),%eax
mov    %eax,(%rbx)
mov    $0x7a5f7eff,%eax
and    (%rcx),%eax
mov    %eax,(%r15)
mov    0xdc(%rcx),%eax
test   $0x10000,%eax
jne    116d <EMACConfigGet+0x5d>
mov    $0x100000,%eax
and    (%rcx),%eax
shr    $0x7,%eax
or     $0x800,%eax
jmp    1172 <EMACConfigGet+0x62>
and    $0x3fff,%eax
mov    %eax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @EMACConfigGet(i32 %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
store i32 %0, i32* %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%10 = load i32*, i32** %7
%11 = call i32 @ASSERT(i32* %10)
%12 = load i32*, i32** %6
%13 = call i32 @ASSERT(i32* %12)
%14 = load i32*, i32** %8
%15 = call i32 @ASSERT(i32* %14)
%16 = load i32, i32* %5
%17 = add nsw i32 %16, 3096
%18 = sext i32 %17 to i64
%19 = inttoptr i64 %18 to i32*
%20 = load volatile i32, i32* %19
%21 = load i32*, i32** %7
store i32 %20, i32* %21
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 0
%24 = sext i32 %23 to i64
%25 = inttoptr i64 %24 to i32*
%26 = load volatile i32, i32* %25
%27 = and i32 %26, 2053078783
%28 = load i32*, i32** %6
store i32 %27, i32* %28
%29 = load i32, i32* %5
%30 = add nsw i32 %29, 220
%31 = sext i32 %30 to i64
%32 = inttoptr i64 %31 to i32*
%33 = load volatile i32, i32* %32
store i32 %33, i32* %9
%34 = load i32, i32* %9
%35 = and i32 %34, 65536
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %41
37: ; preds = %4
%38 = load i32, i32* %9
%39 = and i32 %38, 16383
%40 = load i32*, i32** %8
store i32 %39, i32* %40
br label %54
41: ; preds = %4
%42 = load i32, i32* %5
%43 = add nsw i32 %42, 0
%44 = sext i32 %43 to i64
%45 = inttoptr i64 %44 to i32*
%46 = load volatile i32, i32* %45
%47 = and i32 %46, 1048576
%48 = icmp ne i32 %47, 0
br i1 %48, label %49, label %51
49: ; preds = %41
%50 = load i32*, i32** %8
store i32 10240, i32* %50
br label %53
51: ; preds = %41
%52 = load i32*, i32** %8
store i32 2048, i32* %52
br label %53
53: ; preds = %51, %49
br label %54
54: ; preds = %53, %37
ret void
}

LLVM IR (-O2):
define void @EMACConfigGet(i32 %0, i32* %1, i32* %2, i32* %3) {
%5 = tail call i32 @ASSERT(i32* %2)
%6 = tail call i32 @ASSERT(i32* %1)
%7 = tail call i32 @ASSERT(i32* %3)
%8 = add nsw i32 %0, 3096
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i32*
%11 = load volatile i32, i32* %10
store i32 %11, i32* %2
%12 = sext i32 %0 to i64
%13 = inttoptr i64 %12 to i32*
%14 = load volatile i32, i32* %13
%15 = and i32 %14, 2053078783
store i32 %15, i32* %1
%16 = add nsw i32 %0, 220
%17 = sext i32 %16 to i64
%18 = inttoptr i64 %17 to i32*
%19 = load volatile i32, i32* %18
%20 = and i32 %19, 65536
%21 = icmp eq i32 %20, 0
br i1 %21, label %24, label %22
22: ; preds = %4
%23 = and i32 %19, 16383
br label %29
24: ; preds = %4
%25 = load volatile i32, i32* %13
%26 = and i32 %25, 1048576
%27 = icmp eq i32 %26, 0
%28 = select i1 %27, i32 2048, i32 10240
br label %29
29: ; preds = %24, %22
%30 = phi i32 [ %23, %22 ], [ %28, %24 ]
store i32 %30, i32* %3
ret void
}