#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 */

/* Variables and functions */
int /*<<< orphan*/ __cvmx_spi4000_mdio_write(int, int, int, int);
int /*<<< orphan*/ cvmx_spi4000_check_speed(int, int);
void __cvmx_spi4000_configure_phy(int interface) {
  int port;
  for (port = 0; port < 10; port++)
    cvmx_spi4000_check_speed(interface, port);
  for (port = 0; port < 10; port++)
    __cvmx_spi4000_mdio_write(interface, port, 0x14, 0x00e2);
  for (port = 0; port < 10; port++)
    __cvmx_spi4000_mdio_write(interface, port, 0x4, 0x0d01);
  for (port = 0; port < 10; port++)
    __cvmx_spi4000_mdio_write(interface, port, 0x0, 0x9140);
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1155 <__cvmx_spi4000_configure_phy+0x35>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <cvmx_spi4000_check_speed@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1132 <__cvmx_spi4000_configure_phy+0x12>
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1189 <__cvmx_spi4000_configure_phy+0x69>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    $0x14,%edx
mov    $0xe2,%ecx
call   1030 <__cvmx_spi4000_mdio_write@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    115c <__cvmx_spi4000_configure_phy+0x3c>
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    11bd <__cvmx_spi4000_configure_phy+0x9d>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    $0x4,%edx
mov    $0xd01,%ecx
call   1030 <__cvmx_spi4000_mdio_write@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1190 <__cvmx_spi4000_configure_phy+0x70>
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    11ee <__cvmx_spi4000_configure_phy+0xce>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
xor    %edx,%edx
mov    $0x9140,%ecx
call   1030 <__cvmx_spi4000_mdio_write@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11c4 <__cvmx_spi4000_configure_phy+0xa4>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rbx
mov    %edi,%ebx
xor    %esi,%esi
call   1040 <cvmx_spi4000_check_speed@plt>
mov    %ebx,%edi
mov    $0x1,%esi
call   1040 <cvmx_spi4000_check_speed@plt>
mov    %ebx,%edi
mov    $0x2,%esi
call   1040 <cvmx_spi4000_check_speed@plt>
mov    %ebx,%edi
mov    $0x3,%esi
call   1040 <cvmx_spi4000_check_speed@plt>
mov    %ebx,%edi
mov    $0x4,%esi
call   1040 <cvmx_spi4000_check_speed@plt>
mov    %ebx,%edi
mov    $0x5,%esi
call   1040 <cvmx_spi4000_check_speed@plt>
mov    %ebx,%edi
mov    $0x6,%esi
call   1040 <cvmx_spi4000_check_speed@plt>
mov    %ebx,%edi
mov    $0x7,%esi
call   1040 <cvmx_spi4000_check_speed@plt>
mov    %ebx,%edi
mov    $0x8,%esi
call   1040 <cvmx_spi4000_check_speed@plt>
mov    %ebx,%edi
mov    $0x9,%esi
call   1040 <cvmx_spi4000_check_speed@plt>
mov    %ebx,%edi
xor    %esi,%esi
mov    $0x14,%edx
mov    $0xe2,%ecx
call   1030 <__cvmx_spi4000_mdio_write@plt>
mov    %ebx,%edi
mov    $0x1,%esi
mov    $0x14,%edx
mov    $0xe2,%ecx
call   1030 <__cvmx_spi4000_mdio_write@plt>
mov    %ebx,%edi
mov    $0x2,%esi
mov    $0x14,%edx
mov    $0xe2,%ecx
call   1030 <__cvmx_spi4000_mdio_write@plt>
mov    %ebx,%edi
mov    $0x3,%esi
mov    $0x14,%edx
mov    $0xe2,%ecx
call   1030 <__cvmx_spi4000_mdio_write@plt>
mov    %ebx,%edi
mov    $0x4,%esi
mov    $0x14,%edx
mov    $0xe2,%ecx
call   1030 <__cvmx_spi4000_mdio_write@plt>
mov    %ebx,%edi
mov    $0x5,%esi
mov    $0x14,%edx
mov    $0xe2,%ecx
call   1030 <__cvmx_spi4000_mdio_write@plt>
mov    %ebx,%edi
mov    $0x6,%esi
mov    $0x14,%edx
mov    $0xe2,%ecx
call   1030 <__cvmx_spi4000_mdio_write@plt>
mov    %ebx,%edi
mov    $0x7,%esi
mov    $0x14,%edx
mov    $0xe2,%ecx
call   1030 <__cvmx_spi4000_mdio_write@plt>
mov    %ebx,%edi
mov    $0x8,%esi
mov    $0x14,%edx
mov    $0xe2,%ecx
call   1030 <__cvmx_spi4000_mdio_write@plt>
mov    %ebx,%edi
mov    $0x9,%esi
mov    $0x14,%edx
mov    $0xe2,%ecx
call   1030 <__cvmx_spi4000_mdio_write@plt>
mov    %ebx,%edi
xor    %esi,%esi
mov    $0x4,%edx
mov    $0xd01,%ecx
call   1030 <__cvmx_spi4000_mdio_write@plt>
mov    %ebx,%edi
mov    $0x1,%esi
mov    $0x4,%edx
mov    $0xd01,%ecx
call   1030 <__cvmx_spi4000_mdio_write@plt>
mov    %ebx,%edi
mov    $0x2,%esi
mov    $0x4,%edx
mov    $0xd01,%ecx
call   1030 <__cvmx_spi4000_mdio_write@plt>
mov    %ebx,%edi
mov    $0x3,%esi
mov    $0x4,%edx
mov    $0xd01,%ecx
call   1030 <__cvmx_spi4000_mdio_write@plt>
mov    %ebx,%edi
mov    $0x4,%esi
mov    $0x4,%edx
mov    $0xd01,%ecx
call   1030 <__cvmx_spi4000_mdio_write@plt>
mov    %ebx,%edi
mov    $0x5,%esi
mov    $0x4,%edx
mov    $0xd01,%ecx
call   1030 <__cvmx_spi4000_mdio_write@plt>
mov    %ebx,%edi
mov    $0x6,%esi
mov    $0x4,%edx
mov    $0xd01,%ecx
call   1030 <__cvmx_spi4000_mdio_write@plt>
mov    %ebx,%edi
mov    $0x7,%esi
mov    $0x4,%edx
mov    $0xd01,%ecx
call   1030 <__cvmx_spi4000_mdio_write@plt>
mov    %ebx,%edi
mov    $0x8,%esi
mov    $0x4,%edx
mov    $0xd01,%ecx
call   1030 <__cvmx_spi4000_mdio_write@plt>
mov    %ebx,%edi
mov    $0x9,%esi
mov    $0x4,%edx
mov    $0xd01,%ecx
call   1030 <__cvmx_spi4000_mdio_write@plt>
mov    %ebx,%edi
xor    %esi,%esi
xor    %edx,%edx
mov    $0x9140,%ecx
call   1030 <__cvmx_spi4000_mdio_write@plt>
mov    %ebx,%edi
mov    $0x1,%esi
xor    %edx,%edx
mov    $0x9140,%ecx
call   1030 <__cvmx_spi4000_mdio_write@plt>
mov    %ebx,%edi
mov    $0x2,%esi
xor    %edx,%edx
mov    $0x9140,%ecx
call   1030 <__cvmx_spi4000_mdio_write@plt>
mov    %ebx,%edi
mov    $0x3,%esi
xor    %edx,%edx
mov    $0x9140,%ecx
call   1030 <__cvmx_spi4000_mdio_write@plt>
mov    %ebx,%edi
mov    $0x4,%esi
xor    %edx,%edx
mov    $0x9140,%ecx
call   1030 <__cvmx_spi4000_mdio_write@plt>
mov    %ebx,%edi
mov    $0x5,%esi
xor    %edx,%edx
mov    $0x9140,%ecx
call   1030 <__cvmx_spi4000_mdio_write@plt>
mov    %ebx,%edi
mov    $0x6,%esi
xor    %edx,%edx
mov    $0x9140,%ecx
call   1030 <__cvmx_spi4000_mdio_write@plt>
mov    %ebx,%edi
mov    $0x7,%esi
xor    %edx,%edx
mov    $0x9140,%ecx
call   1030 <__cvmx_spi4000_mdio_write@plt>
mov    %ebx,%edi
mov    $0x8,%esi
xor    %edx,%edx
mov    $0x9140,%ecx
call   1030 <__cvmx_spi4000_mdio_write@plt>
mov    %ebx,%edi
mov    $0x9,%esi
xor    %edx,%edx
mov    $0x9140,%ecx
pop    %rbx
jmp    1030 <__cvmx_spi4000_mdio_write@plt>

LLVM IR (-O0):
define void @__cvmx_spi4000_configure_phy(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %11, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 10
br i1 %6, label %7, label %14
7: ; preds = %4
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = call i32 @cvmx_spi4000_check_speed(i32 %8, i32 %9)
br label %11
11: ; preds = %7
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
br label %4
14: ; preds = %4
store i32 0, i32* %3
br label %15
15: ; preds = %22, %14
%16 = load i32, i32* %3
%17 = icmp slt i32 %16, 10
br i1 %17, label %18, label %25
18: ; preds = %15
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = call i32 @__cvmx_spi4000_mdio_write(i32 %19, i32 %20, i32 20, i32 226)
br label %22
22: ; preds = %18
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
br label %15
25: ; preds = %15
store i32 0, i32* %3
br label %26
26: ; preds = %33, %25
%27 = load i32, i32* %3
%28 = icmp slt i32 %27, 10
br i1 %28, label %29, label %36
29: ; preds = %26
%30 = load i32, i32* %2
%31 = load i32, i32* %3
%32 = call i32 @__cvmx_spi4000_mdio_write(i32 %30, i32 %31, i32 4, i32 3329)
br label %33
33: ; preds = %29
%34 = load i32, i32* %3
%35 = add nsw i32 %34, 1
store i32 %35, i32* %3
br label %26
36: ; preds = %26
store i32 0, i32* %3
br label %37
37: ; preds = %44, %36
%38 = load i32, i32* %3
%39 = icmp slt i32 %38, 10
br i1 %39, label %40, label %47
40: ; preds = %37
%41 = load i32, i32* %2
%42 = load i32, i32* %3
%43 = call i32 @__cvmx_spi4000_mdio_write(i32 %41, i32 %42, i32 0, i32 37184)
br label %44
44: ; preds = %40
%45 = load i32, i32* %3
%46 = add nsw i32 %45, 1
store i32 %46, i32* %3
br label %37
47: ; preds = %37
ret void
}

LLVM IR (-O2):
define void @__cvmx_spi4000_configure_phy(i32 %0) {
%2 = tail call i32 @cvmx_spi4000_check_speed(i32 %0, i32 0)
%3 = tail call i32 @cvmx_spi4000_check_speed(i32 %0, i32 1)
%4 = tail call i32 @cvmx_spi4000_check_speed(i32 %0, i32 2)
%5 = tail call i32 @cvmx_spi4000_check_speed(i32 %0, i32 3)
%6 = tail call i32 @cvmx_spi4000_check_speed(i32 %0, i32 4)
%7 = tail call i32 @cvmx_spi4000_check_speed(i32 %0, i32 5)
%8 = tail call i32 @cvmx_spi4000_check_speed(i32 %0, i32 6)
%9 = tail call i32 @cvmx_spi4000_check_speed(i32 %0, i32 7)
%10 = tail call i32 @cvmx_spi4000_check_speed(i32 %0, i32 8)
%11 = tail call i32 @cvmx_spi4000_check_speed(i32 %0, i32 9)
%12 = tail call i32 @__cvmx_spi4000_mdio_write(i32 %0, i32 0, i32 20, i32 226)
%13 = tail call i32 @__cvmx_spi4000_mdio_write(i32 %0, i32 1, i32 20, i32 226)
%14 = tail call i32 @__cvmx_spi4000_mdio_write(i32 %0, i32 2, i32 20, i32 226)
%15 = tail call i32 @__cvmx_spi4000_mdio_write(i32 %0, i32 3, i32 20, i32 226)
%16 = tail call i32 @__cvmx_spi4000_mdio_write(i32 %0, i32 4, i32 20, i32 226)
%17 = tail call i32 @__cvmx_spi4000_mdio_write(i32 %0, i32 5, i32 20, i32 226)
%18 = tail call i32 @__cvmx_spi4000_mdio_write(i32 %0, i32 6, i32 20, i32 226)
%19 = tail call i32 @__cvmx_spi4000_mdio_write(i32 %0, i32 7, i32 20, i32 226)
%20 = tail call i32 @__cvmx_spi4000_mdio_write(i32 %0, i32 8, i32 20, i32 226)
%21 = tail call i32 @__cvmx_spi4000_mdio_write(i32 %0, i32 9, i32 20, i32 226)
%22 = tail call i32 @__cvmx_spi4000_mdio_write(i32 %0, i32 0, i32 4, i32 3329)
%23 = tail call i32 @__cvmx_spi4000_mdio_write(i32 %0, i32 1, i32 4, i32 3329)
%24 = tail call i32 @__cvmx_spi4000_mdio_write(i32 %0, i32 2, i32 4, i32 3329)
%25 = tail call i32 @__cvmx_spi4000_mdio_write(i32 %0, i32 3, i32 4, i32 3329)
%26 = tail call i32 @__cvmx_spi4000_mdio_write(i32 %0, i32 4, i32 4, i32 3329)
%27 = tail call i32 @__cvmx_spi4000_mdio_write(i32 %0, i32 5, i32 4, i32 3329)
%28 = tail call i32 @__cvmx_spi4000_mdio_write(i32 %0, i32 6, i32 4, i32 3329)
%29 = tail call i32 @__cvmx_spi4000_mdio_write(i32 %0, i32 7, i32 4, i32 3329)
%30 = tail call i32 @__cvmx_spi4000_mdio_write(i32 %0, i32 8, i32 4, i32 3329)
%31 = tail call i32 @__cvmx_spi4000_mdio_write(i32 %0, i32 9, i32 4, i32 3329)
%32 = tail call i32 @__cvmx_spi4000_mdio_write(i32 %0, i32 0, i32 0, i32 37184)
%33 = tail call i32 @__cvmx_spi4000_mdio_write(i32 %0, i32 1, i32 0, i32 37184)
%34 = tail call i32 @__cvmx_spi4000_mdio_write(i32 %0, i32 2, i32 0, i32 37184)
%35 = tail call i32 @__cvmx_spi4000_mdio_write(i32 %0, i32 3, i32 0, i32 37184)
%36 = tail call i32 @__cvmx_spi4000_mdio_write(i32 %0, i32 4, i32 0, i32 37184)
%37 = tail call i32 @__cvmx_spi4000_mdio_write(i32 %0, i32 5, i32 0, i32 37184)
%38 = tail call i32 @__cvmx_spi4000_mdio_write(i32 %0, i32 6, i32 0, i32 37184)
%39 = tail call i32 @__cvmx_spi4000_mdio_write(i32 %0, i32 7, i32 0, i32 37184)
%40 = tail call i32 @__cvmx_spi4000_mdio_write(i32 %0, i32 8, i32 0, i32 37184)
%41 = tail call i32 @__cvmx_spi4000_mdio_write(i32 %0, i32 9, i32 0, i32 37184)
ret void
}