#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 EMACConfigSet(uint32_t ui32Base, uint32_t ui32Config,
                   uint32_t ui32ModeFlags, uint32_t ui32RxMaxFrameSize) {
  ASSERT((ui32Config &
          ~((0x40000000 | 0x20000000 | 0x30000000 | 0x08000000 | 0x02000000 |
             0x00400000 | 0x00100000 | 0x000E0000 | 0x00010000 | 0x00004000 |
             0x00002000 | 0x00001000 | 0x00000800 | 0x00000400 | 0x00000200 |
             0x00000080 | 0x00000060 | 0x00000010 | 0x00000003) |
            0x00000008 | 0x00000004)) == 0);
  ASSERT(!ui32RxMaxFrameSize ||
         ((ui32RxMaxFrameSize < 0x4000) && (ui32RxMaxFrameSize > 1522)));
  (*((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
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
and    $0x85a08100,%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    $0x1,%al
cmpl   $0x0,-0x10(%rbp)
mov    %al,-0x11(%rbp)
je     1170 <EMACConfigSet+0x60>
xor    %eax,%eax
cmpl   $0x4000,-0x10(%rbp)
mov    %al,-0x12(%rbp)
jge    116a <EMACConfigSet+0x5a>
cmpl   $0x5f2,-0x10(%rbp)
setg   %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
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     11c4 <EMACConfigSet+0xb4>
mov    -0x10(%rbp),%ecx
or     $0x10000,%ecx
mov    -0x4(%rbp),%eax
add    $0xdc,%eax
cltq
mov    %ecx,(%rax)
jmp    11d8 <EMACConfigSet+0xc8>
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)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EMACConfigSet>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%ebx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%r15d
xor    %edi,%edi
test   $0x85a08100,%esi
sete   %dil
call   1030 <ASSERT@plt>
test   %ebx,%ebx
sete   %al
lea    -0x5f3(%rbx),%ecx
cmp    $0x3a0d,%ecx
setb   %cl
or     %al,%cl
movzbl %cl,%edi
call   1030 <ASSERT@plt>
movslq %r15d,%rax
mov    $0x85a0010c,%ecx
and    (%rax),%ecx
or     %ebp,%ecx
or     $0x8000,%ecx
mov    %ecx,(%rax)
test   %ebx,%ebx
je     1176 <EMACConfigSet+0x66>
or     $0x10000,%ebx
mov    %ebx,0xdc(%rax)
jmp    1180 <EMACConfigSet+0x70>
andl   $0xfffeffff,0xdc(%rax)
ff fe ff
mov    %r14d,0xc18(%rax)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
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* %6
%10 = and i32 %9, -2053078784
%11 = icmp eq i32 %10, 0
%12 = zext i1 %11 to i32
%13 = call i32 @ASSERT(i32 %12)
%14 = load i32, i32* %8
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %24
16: ; preds = %4
%17 = load i32, i32* %8
%18 = icmp slt i32 %17, 16384
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = load i32, i32* %8
%21 = icmp sgt i32 %20, 1522
br label %22
22: ; preds = %19, %16
%23 = phi i1 [ false, %16 ], [ %21, %19 ]
br label %24
24: ; preds = %22, %4
%25 = phi i1 [ true, %4 ], [ %23, %22 ]
%26 = zext i1 %25 to i32
%27 = call i32 @ASSERT(i32 %26)
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 0
%30 = sext i32 %29 to i64
%31 = inttoptr i64 %30 to i32*
%32 = load volatile i32, i32* %31
%33 = and i32 %32, -2053078772
%34 = load i32, i32* %6
%35 = or i32 %33, %34
%36 = or i32 %35, 32768
%37 = load i32, i32* %5
%38 = add nsw i32 %37, 0
%39 = sext i32 %38 to i64
%40 = inttoptr i64 %39 to i32*
store volatile i32 %36, i32* %40
%41 = load i32, i32* %8
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %50
43: ; preds = %24
%44 = load i32, i32* %8
%45 = or i32 %44, 65536
%46 = load i32, i32* %5
%47 = add nsw i32 %46, 220
%48 = sext i32 %47 to i64
%49 = inttoptr i64 %48 to i32*
store volatile i32 %45, i32* %49
br label %57
50: ; preds = %24
%51 = load i32, i32* %5
%52 = add nsw i32 %51, 220
%53 = sext i32 %52 to i64
%54 = inttoptr i64 %53 to i32*
%55 = load volatile i32, i32* %54
%56 = and i32 %55, -65537
store volatile i32 %56, i32* %54
br label %57
57: ; preds = %50, %43
%58 = load i32, i32* %7
%59 = load i32, i32* %5
%60 = add nsw i32 %59, 3096
%61 = sext i32 %60 to i64
%62 = inttoptr i64 %61 to i32*
store volatile i32 %58, i32* %62
ret void
}

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