#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 EMACAddrFilterSet(uint32_t ui32Base, uint32_t ui32Index,
                       uint32_t ui32Config) {
  uint32_t ui32Val;
  ASSERT(ui32Index < 4);
  ASSERT((ui32Config & ~(0x3F000000 | 0x80000000 | 0x40000000)) == 0);
  ASSERT(ui32Index);
  (*((volatile uint32_t *)(ui32Base + (0x00000040 + ((0x0000004C - 0x00000044) *
                                                     (ui32Index)))))) =
      ((*((volatile uint32_t *)(ui32Base +
                                (0x00000040 +
                                 ((0x0000004C - 0x00000044) * (ui32Index)))))) &
       0xFFFF) |
      ui32Config;
  ui32Val = (*((volatile uint32_t *)(ui32Base +
                                     (0x00000044 + ((0x0000004C - 0x00000044) *
                                                    (ui32Index))))));
  (*((volatile uint32_t *)(ui32Base + (0x00000044 + ((0x0000004C - 0x00000044) *
                                                     (ui32Index)))))) = ui32Val;
}


x86 assembly (clang, -O0):
<EMACAddrFilterSet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x4,-0x8(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0xc(%rbp),%eax
and    $0xffffff,%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x8(%rbp),%edi
call   1030 <ASSERT@plt>
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x3,%ecx
add    $0x40,%ecx
add    %ecx,%eax
cltq
mov    (%rax),%ecx
and    $0xffff,%ecx
or     -0xc(%rbp),%ecx
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%edx
shl    $0x3,%edx
add    $0x40,%edx
add    %edx,%eax
cltq
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x3,%ecx
add    $0x44,%ecx
add    %ecx,%eax
cltq
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%ecx
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%edx
shl    $0x3,%edx
add    $0x44,%edx
add    %edx,%eax
cltq
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EMACAddrFilterSet>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %esi,%ebx
mov    %edi,%r14d
xor    %edi,%edi
cmp    $0x4,%esi
setl   %dil
call   1030 <ASSERT@plt>
xor    %edi,%edi
test   $0xffffff,%ebp
sete   %dil
call   1030 <ASSERT@plt>
mov    %ebx,%edi
call   1030 <ASSERT@plt>
lea    (%r14,%rbx,8),%eax
add    $0x40,%eax
cltq
mov    (%rax),%ecx
movzwl %cx,%ecx
or     %ebp,%ecx
mov    %ecx,(%rax)
lea    (%r14,%rbx,8),%eax
add    $0x44,%eax
cltq
mov    (%rax),%ecx
mov    %ecx,(%rax)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @EMACAddrFilterSet(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 4
%10 = zext i1 %9 to i32
%11 = call i32 @ASSERT(i32 %10)
%12 = load i32, i32* %6
%13 = and i32 %12, 16777215
%14 = icmp eq i32 %13, 0
%15 = zext i1 %14 to i32
%16 = call i32 @ASSERT(i32 %15)
%17 = load i32, i32* %5
%18 = call i32 @ASSERT(i32 %17)
%19 = load i32, i32* %4
%20 = load i32, i32* %5
%21 = mul nsw i32 8, %20
%22 = add nsw i32 64, %21
%23 = add nsw i32 %19, %22
%24 = sext i32 %23 to i64
%25 = inttoptr i64 %24 to i32*
%26 = load volatile i32, i32* %25
%27 = and i32 %26, 65535
%28 = load i32, i32* %6
%29 = or i32 %27, %28
%30 = load i32, i32* %4
%31 = load i32, i32* %5
%32 = mul nsw i32 8, %31
%33 = add nsw i32 64, %32
%34 = add nsw i32 %30, %33
%35 = sext i32 %34 to i64
%36 = inttoptr i64 %35 to i32*
store volatile i32 %29, i32* %36
%37 = load i32, i32* %4
%38 = load i32, i32* %5
%39 = mul nsw i32 8, %38
%40 = add nsw i32 68, %39
%41 = add nsw i32 %37, %40
%42 = sext i32 %41 to i64
%43 = inttoptr i64 %42 to i32*
%44 = load volatile i32, i32* %43
store i32 %44, i32* %7
%45 = load i32, i32* %7
%46 = load i32, i32* %4
%47 = load i32, i32* %5
%48 = mul nsw i32 8, %47
%49 = add nsw i32 68, %48
%50 = add nsw i32 %46, %49
%51 = sext i32 %50 to i64
%52 = inttoptr i64 %51 to i32*
store volatile i32 %45, i32* %52
ret void
}

LLVM IR (-O2):
define void @EMACAddrFilterSet(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, 4
%5 = zext i1 %4 to i32
%6 = tail call i32 @ASSERT(i32 %5)
%7 = and i32 %2, 16777215
%8 = icmp eq i32 %7, 0
%9 = zext i1 %8 to i32
%10 = tail call i32 @ASSERT(i32 %9)
%11 = tail call i32 @ASSERT(i32 %1)
%12 = shl nsw i32 %1, 3
%13 = add i32 %12, %0
%14 = add i32 %13, 64
%15 = sext i32 %14 to i64
%16 = inttoptr i64 %15 to i32*
%17 = load volatile i32, i32* %16
%18 = and i32 %17, 65535
%19 = or i32 %18, %2
store volatile i32 %19, i32* %16
%20 = add i32 %13, 68
%21 = sext i32 %20 to i64
%22 = inttoptr i64 %21 to i32*
%23 = load volatile i32, i32* %22
store volatile i32 %23, i32* %22
ret void
}