#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 EMACConfigSet(uint32_t ui32Base, uint32_t ui32Config,
                   uint32_t ui32ModeFlags, uint32_t ui32RxMaxFrameSize) {

  ;

  ;
  (*((volatile uint32_t *)(ui32Base + 0x00000000))) =
      (((*((volatile uint32_t *)(ui32Base + 0x00000000))) &
        ~(0x40000000 | 0x20000000 | 0x30000000 | 0x08000000 | 0x02000000 |
          0x00400000 | 0x00100000 | 0x000E0000 | 0x00010000 | 0x00004000 |
          0x00002000 | 0x00001000 | 0x00000800 | 0x00000400 | 0x00000200 |
          0x00000080 | 0x00000060 | 0x00000010 | 0x00000003)) |
       ui32Config | 0x00008000);
  if (ui32RxMaxFrameSize) {
    (*((volatile uint32_t *)(ui32Base + 0x000000DC))) =
        ui32RxMaxFrameSize | 0x00010000;
  } else {
    (*((volatile uint32_t *)(ui32Base + 0x000000DC))) &= ~0x00010000;
  }
  (*((volatile uint32_t *)(ui32Base + 0x00000C18))) = ui32ModeFlags;
}


x86 assembly (clang, -O0):
<EMACConfigSet>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0x0,%eax
cltq
mov    (%rax),%ecx
and    $0x85a0810c,%ecx
or     -0x8(%rbp),%ecx
or     $0x8000,%ecx
mov    -0x4(%rbp),%eax
add    $0x0,%eax
cltq
mov    %ecx,(%rax)
cmpl   $0x0,-0x10(%rbp)
je     1157 <EMACConfigSet+0x57>
mov    -0x10(%rbp),%ecx
or     $0x10000,%ecx
mov    -0x4(%rbp),%eax
add    $0xdc,%eax
cltq
mov    %ecx,(%rax)
jmp    116b <EMACConfigSet+0x6b>
mov    -0x4(%rbp),%eax
add    $0xdc,%eax
cltq
mov    (%rax),%ecx
and    $0xfffeffff,%ecx
mov    %ecx,(%rax)
mov    -0xc(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    $0xc18,%eax
cltq
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<EMACConfigSet>:
movslq %edi,%rax
mov    $0x85a0010c,%edi
and    (%rax),%edi
or     %esi,%edi
or     $0x8000,%edi
mov    %edi,(%rax)
test   %ecx,%ecx
je     112b <EMACConfigSet+0x2b>
or     $0x10000,%ecx
mov    %ecx,0xdc(%rax)
mov    %edx,0xc18(%rax)
ret
andl   $0xfffeffff,0xdc(%rax)
ff fe ff
mov    %edx,0xc18(%rax)
ret

LLVM IR (-O0):
define void @EMACConfigSet(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = add nsw i32 %9, 0
%11 = sext i32 %10 to i64
%12 = inttoptr i64 %11 to i32*
%13 = load volatile i32, i32* %12
%14 = and i32 %13, -2053078772
%15 = load i32, i32* %6
%16 = or i32 %14, %15
%17 = or i32 %16, 32768
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 0
%20 = sext i32 %19 to i64
%21 = inttoptr i64 %20 to i32*
store volatile i32 %17, i32* %21
%22 = load i32, i32* %8
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %31
24: ; preds = %4
%25 = load i32, i32* %8
%26 = or i32 %25, 65536
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 220
%29 = sext i32 %28 to i64
%30 = inttoptr i64 %29 to i32*
store volatile i32 %26, i32* %30
br label %38
31: ; preds = %4
%32 = load i32, i32* %5
%33 = add nsw i32 %32, 220
%34 = sext i32 %33 to i64
%35 = inttoptr i64 %34 to i32*
%36 = load volatile i32, i32* %35
%37 = and i32 %36, -65537
store volatile i32 %37, i32* %35
br label %38
38: ; preds = %31, %24
%39 = load i32, i32* %7
%40 = load i32, i32* %5
%41 = add nsw i32 %40, 3096
%42 = sext i32 %41 to i64
%43 = inttoptr i64 %42 to i32*
store volatile i32 %39, i32* %43
ret void
}

LLVM IR (-O2):
define void @EMACConfigSet(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = sext i32 %0 to i64
%6 = inttoptr i64 %5 to i32*
%7 = load volatile i32, i32* %6
%8 = and i32 %7, -2053111540
%9 = or i32 %8, %1
%10 = or i32 %9, 32768
store volatile i32 %10, i32* %6
%11 = icmp eq i32 %3, 0
br i1 %11, label %17, label %12
12: ; preds = %4
%13 = or i32 %3, 65536
%14 = add nsw i32 %0, 220
%15 = sext i32 %14 to i64
%16 = inttoptr i64 %15 to i32*
store volatile i32 %13, i32* %16
br label %23
17: ; preds = %4
%18 = add nsw i32 %0, 220
%19 = sext i32 %18 to i64
%20 = inttoptr i64 %19 to i32*
%21 = load volatile i32, i32* %20
%22 = and i32 %21, -65537
store volatile i32 %22, i32* %20
br label %23
23: ; preds = %17, %12
%24 = add nsw i32 %0, 3096
%25 = sext i32 %24 to i64
%26 = inttoptr i64 %25 to i32*
store volatile i32 %2, i32* %26
ret void
}