#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 */
void EMACConfigGet(uint32_t ui32Base, uint32_t *pui32Config,
                   uint32_t *pui32Mode, uint32_t *pui32RxMaxFrameSize) {
  uint32_t ui32Value;
  ;
  ;
  ;
  *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
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
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     116f <EMACConfigGet+0x6f>
mov    -0x24(%rbp),%ecx
and    $0x3fff,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
jmp    11a5 <EMACConfigGet+0xa5>
mov    -0x4(%rbp),%eax
add    $0x0,%eax
cltq
mov    (%rax),%eax
and    $0x100000,%eax
cmp    $0x0,%eax
je     1196 <EMACConfigGet+0x96>
mov    -0x20(%rbp),%rax
movl   $0x2800,(%rax)
jmp    11a0 <EMACConfigGet+0xa0>
mov    -0x20(%rbp),%rax
movl   $0x800,(%rax)
jmp    11a5 <EMACConfigGet+0xa5>
pop    %rbp
ret

x86 assembly (clang, -O2):
<EMACConfigGet>:
movslq %edi,%rdi
mov    0xc18(%rdi),%eax
mov    %eax,(%rdx)
mov    $0x7a5f7eff,%eax
and    (%rdi),%eax
mov    %eax,(%rsi)
mov    0xdc(%rdi),%eax
test   $0x10000,%eax
jne    1133 <EMACConfigGet+0x33>
mov    $0x100000,%eax
and    (%rdi),%eax
shr    $0x7,%eax
or     $0x800,%eax
mov    %eax,(%rcx)
ret
and    $0x3fff,%eax
mov    %eax,(%rcx)
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* %5
%11 = add nsw i32 %10, 3096
%12 = sext i32 %11 to i64
%13 = inttoptr i64 %12 to i32*
%14 = load volatile i32, i32* %13
%15 = load i32*, i32** %7
store i32 %14, i32* %15
%16 = load i32, i32* %5
%17 = add nsw i32 %16, 0
%18 = sext i32 %17 to i64
%19 = inttoptr i64 %18 to i32*
%20 = load volatile i32, i32* %19
%21 = and i32 %20, 2053078783
%22 = load i32*, i32** %6
store i32 %21, i32* %22
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 220
%25 = sext i32 %24 to i64
%26 = inttoptr i64 %25 to i32*
%27 = load volatile i32, i32* %26
store i32 %27, i32* %9
%28 = load i32, i32* %9
%29 = and i32 %28, 65536
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %35
31: ; preds = %4
%32 = load i32, i32* %9
%33 = and i32 %32, 16383
%34 = load i32*, i32** %8
store i32 %33, i32* %34
br label %48
35: ; preds = %4
%36 = load i32, i32* %5
%37 = add nsw i32 %36, 0
%38 = sext i32 %37 to i64
%39 = inttoptr i64 %38 to i32*
%40 = load volatile i32, i32* %39
%41 = and i32 %40, 1048576
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %35
%44 = load i32*, i32** %8
store i32 10240, i32* %44
br label %47
45: ; preds = %35
%46 = load i32*, i32** %8
store i32 2048, i32* %46
br label %47
47: ; preds = %45, %43
br label %48
48: ; preds = %47, %31
ret void
}

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