#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 uint8_t;
typedef int uint32_t;
typedef int uint16_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
int /*<<< orphan*/ EMACPHYWrite(int, int, int, int);
void EMACPHYExtendedWrite(uint32_t ui32Base, uint8_t ui8PhyAddr,
                          uint16_t ui16RegAddr, uint16_t ui16Value) {
  ASSERT(ui8PhyAddr < 32);
  ASSERT(ui32Base == 0x400EC000);
  EMACPHYWrite(0x400EC000, ui8PhyAddr, 0x0000000D, 0x001F);
  EMACPHYWrite(0x400EC000, ui8PhyAddr, 0x0000000E, ui16RegAddr);
  EMACPHYWrite(0x400EC000, ui8PhyAddr, 0x0000000D, 0x401F);
  EMACPHYWrite(0x400EC000, ui8PhyAddr, 0x0000000E, ui16Value);
}


x86 assembly (clang, -O0):
<EMACPHYExtendedWrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
cmpl   $0x20,-0x8(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
cmpl   $0x400ec000,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x8(%rbp),%esi
mov    $0x400ec000,%edi
mov    $0xd,%edx
mov    $0x1f,%ecx
call   1040 <EMACPHYWrite@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%ecx
mov    $0x400ec000,%edi
mov    $0xe,%edx
call   1040 <EMACPHYWrite@plt>
mov    -0x8(%rbp),%esi
mov    $0x400ec000,%edi
mov    $0xd,%edx
mov    $0x401f,%ecx
call   1040 <EMACPHYWrite@plt>
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%ecx
mov    $0x400ec000,%edi
mov    $0xe,%edx
call   1040 <EMACPHYWrite@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EMACPHYExtendedWrite>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %esi,%ebp
mov    %edi,%ebx
xor    %edi,%edi
cmp    $0x20,%esi
setl   %dil
call   1030 <ASSERT@plt>
xor    %edi,%edi
cmp    $0x400ec000,%ebx
sete   %dil
call   1030 <ASSERT@plt>
mov    $0x400ec000,%edi
mov    %ebp,%esi
mov    $0xd,%edx
mov    $0x1f,%ecx
call   1040 <EMACPHYWrite@plt>
mov    $0x400ec000,%edi
mov    %ebp,%esi
mov    $0xe,%edx
mov    %r15d,%ecx
call   1040 <EMACPHYWrite@plt>
mov    $0x400ec000,%edi
mov    %ebp,%esi
mov    $0xd,%edx
mov    $0x401f,%ecx
call   1040 <EMACPHYWrite@plt>
mov    $0x400ec000,%edi
mov    %ebp,%esi
mov    $0xe,%edx
mov    %r14d,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <EMACPHYWrite@plt>

LLVM IR (-O0):
define void @EMACPHYExtendedWrite(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 = icmp slt i32 %9, 32
%11 = zext i1 %10 to i32
%12 = call i32 @ASSERT(i32 %11)
%13 = load i32, i32* %5
%14 = icmp eq i32 %13, 1074708480
%15 = zext i1 %14 to i32
%16 = call i32 @ASSERT(i32 %15)
%17 = load i32, i32* %6
%18 = call i32 @EMACPHYWrite(i32 1074708480, i32 %17, i32 13, i32 31)
%19 = load i32, i32* %6
%20 = load i32, i32* %7
%21 = call i32 @EMACPHYWrite(i32 1074708480, i32 %19, i32 14, i32 %20)
%22 = load i32, i32* %6
%23 = call i32 @EMACPHYWrite(i32 1074708480, i32 %22, i32 13, i32 16415)
%24 = load i32, i32* %6
%25 = load i32, i32* %8
%26 = call i32 @EMACPHYWrite(i32 1074708480, i32 %24, i32 14, i32 %25)
ret void
}

LLVM IR (-O2):
define void @EMACPHYExtendedWrite(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp slt i32 %1, 32
%6 = zext i1 %5 to i32
%7 = tail call i32 @ASSERT(i32 %6)
%8 = icmp eq i32 %0, 1074708480
%9 = zext i1 %8 to i32
%10 = tail call i32 @ASSERT(i32 %9)
%11 = tail call i32 @EMACPHYWrite(i32 1074708480, i32 %1, i32 13, i32 31)
%12 = tail call i32 @EMACPHYWrite(i32 1074708480, i32 %1, i32 14, i32 %2)
%13 = tail call i32 @EMACPHYWrite(i32 1074708480, i32 %1, i32 13, i32 16415)
%14 = tail call i32 @EMACPHYWrite(i32 1074708480, i32 %1, i32 14, i32 %3)
ret void
}