#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_write(int, int, int);
void __cvmx_spi4000_configure_mac(int interface) {
  int port;
  __cvmx_spi4000_write(interface, 0x0505, 0x3ff);
  __cvmx_spi4000_write(interface, 0x0620, 0x3ff);
  __cvmx_spi4000_write(interface, 0x059e, 0x3ff);
  __cvmx_spi4000_write(interface, 0x0505, 0x0);
  __cvmx_spi4000_write(interface, 0x0500, 0x0);
  for (port = 0; port < 10; port++) {
    int port_offset = port << 7;
    __cvmx_spi4000_write(interface, port_offset | 0x0010, 0x3);
    __cvmx_spi4000_write(interface, port_offset | 0x000f, 0x3fff);
    __cvmx_spi4000_write(interface, port_offset | 0x0000, 0x0000);
    __cvmx_spi4000_write(interface, port_offset | 0x0001, 0x0000);
    if (0)
      __cvmx_spi4000_write(interface, port_offset | 0x0012, 0);
    else
      __cvmx_spi4000_write(interface, port_offset | 0x0012, 0x7);
    __cvmx_spi4000_write(interface, port_offset | 0x0015, 0x1);
    __cvmx_spi4000_write(interface, port_offset | 0x0018, 0x11cd);
    __cvmx_spi4000_write(interface, port_offset | 0x0019, 0x00);
  }
  __cvmx_spi4000_write(interface, 0x059f, 0x03ff);
  for (port = 0; port < 10; port++) {
    __cvmx_spi4000_write(interface, port + 0x0600, 0x0900);
    __cvmx_spi4000_write(interface, port + 0x060a, 0x0800);
    __cvmx_spi4000_write(interface, port + 0x0614, 0x0380);
  }
  __cvmx_spi4000_write(interface, 0x059e, 0x0);
  __cvmx_spi4000_write(interface, 0x0620, 0x0);
  __cvmx_spi4000_write(interface, 0x0500, 0x03ff);
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x505,%esi
mov    $0x3ff,%edx
call   1030 <__cvmx_spi4000_write@plt>
mov    -0x4(%rbp),%edi
mov    $0x620,%esi
mov    $0x3ff,%edx
call   1030 <__cvmx_spi4000_write@plt>
mov    -0x4(%rbp),%edi
mov    $0x59e,%esi
mov    $0x3ff,%edx
call   1030 <__cvmx_spi4000_write@plt>
mov    -0x4(%rbp),%edi
mov    $0x505,%esi
xor    %edx,%edx
call   1030 <__cvmx_spi4000_write@plt>
mov    -0x4(%rbp),%edi
mov    $0x500,%esi
xor    %edx,%edx
call   1030 <__cvmx_spi4000_write@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1226 <__cvmx_spi4000_configure_mac+0x116>
mov    -0x8(%rbp),%eax
shl    $0x7,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
or     $0x10,%esi
mov    $0x3,%edx
call   1030 <__cvmx_spi4000_write@plt>
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
or     $0xf,%esi
mov    $0x3fff,%edx
call   1030 <__cvmx_spi4000_write@plt>
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
or     $0x0,%esi
xor    %edx,%edx
call   1030 <__cvmx_spi4000_write@plt>
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
or     $0x1,%esi
xor    %edx,%edx
call   1030 <__cvmx_spi4000_write@plt>
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
or     $0x12,%esi
mov    $0x7,%edx
call   1030 <__cvmx_spi4000_write@plt>
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
or     $0x15,%esi
mov    $0x1,%edx
call   1030 <__cvmx_spi4000_write@plt>
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
or     $0x18,%esi
mov    $0x11cd,%edx
call   1030 <__cvmx_spi4000_write@plt>
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
or     $0x19,%esi
xor    %edx,%edx
call   1030 <__cvmx_spi4000_write@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1176 <__cvmx_spi4000_configure_mac+0x66>
mov    -0x4(%rbp),%edi
mov    $0x59f,%esi
mov    $0x3ff,%edx
call   1030 <__cvmx_spi4000_write@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1299 <__cvmx_spi4000_configure_mac+0x189>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
add    $0x600,%esi
mov    $0x900,%edx
call   1030 <__cvmx_spi4000_write@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
add    $0x60a,%esi
mov    $0x800,%edx
call   1030 <__cvmx_spi4000_write@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
add    $0x614,%esi
mov    $0x380,%edx
call   1030 <__cvmx_spi4000_write@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    123f <__cvmx_spi4000_configure_mac+0x12f>
mov    -0x4(%rbp),%edi
mov    $0x59e,%esi
xor    %edx,%edx
call   1030 <__cvmx_spi4000_write@plt>
mov    -0x4(%rbp),%edi
mov    $0x620,%esi
xor    %edx,%edx
call   1030 <__cvmx_spi4000_write@plt>
mov    -0x4(%rbp),%edi
mov    $0x500,%esi
mov    $0x3ff,%edx
call   1030 <__cvmx_spi4000_write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
mov    $0x505,%esi
mov    $0x3ff,%edx
call   1030 <__cvmx_spi4000_write@plt>
mov    %ebp,%edi
mov    $0x620,%esi
mov    $0x3ff,%edx
call   1030 <__cvmx_spi4000_write@plt>
mov    %ebp,%edi
mov    $0x59e,%esi
mov    $0x3ff,%edx
call   1030 <__cvmx_spi4000_write@plt>
xor    %ebx,%ebx
mov    %ebp,%edi
mov    $0x505,%esi
xor    %edx,%edx
call   1030 <__cvmx_spi4000_write@plt>
mov    %ebp,%edi
mov    $0x500,%esi
xor    %edx,%edx
call   1030 <__cvmx_spi4000_write@plt>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0x10(%rbx),%esi
mov    %ebp,%edi
mov    $0x3,%edx
call   1030 <__cvmx_spi4000_write@plt>
lea    0xf(%rbx),%esi
mov    %ebp,%edi
mov    $0x3fff,%edx
call   1030 <__cvmx_spi4000_write@plt>
mov    %ebp,%edi
mov    %ebx,%esi
xor    %edx,%edx
call   1030 <__cvmx_spi4000_write@plt>
lea    0x1(%rbx),%esi
mov    %ebp,%edi
xor    %edx,%edx
call   1030 <__cvmx_spi4000_write@plt>
lea    0x12(%rbx),%esi
mov    %ebp,%edi
mov    $0x7,%edx
call   1030 <__cvmx_spi4000_write@plt>
lea    0x15(%rbx),%esi
mov    %ebp,%edi
mov    $0x1,%edx
call   1030 <__cvmx_spi4000_write@plt>
lea    0x18(%rbx),%esi
mov    %ebp,%edi
mov    $0x11cd,%edx
call   1030 <__cvmx_spi4000_write@plt>
lea    0x19(%rbx),%esi
mov    %ebp,%edi
xor    %edx,%edx
call   1030 <__cvmx_spi4000_write@plt>
sub    $0xffffff80,%ebx
cmp    $0x500,%ebx
jne    1170 <__cvmx_spi4000_configure_mac+0x60>
mov    %ebp,%edi
mov    $0x59f,%esi
mov    $0x3ff,%edx
call   1030 <__cvmx_spi4000_write@plt>
mov    $0x600,%ebx
nop
mov    %ebp,%edi
mov    %ebx,%esi
mov    $0x900,%edx
call   1030 <__cvmx_spi4000_write@plt>
lea    0xa(%rbx),%esi
mov    %ebp,%edi
mov    $0x800,%edx
call   1030 <__cvmx_spi4000_write@plt>
lea    0x14(%rbx),%esi
mov    %ebp,%edi
mov    $0x380,%edx
call   1030 <__cvmx_spi4000_write@plt>
add    $0x1,%ebx
cmp    $0x60a,%ebx
jne    1200 <__cvmx_spi4000_configure_mac+0xf0>
mov    %ebp,%edi
mov    $0x59e,%esi
xor    %edx,%edx
call   1030 <__cvmx_spi4000_write@plt>
mov    %ebp,%edi
mov    $0x620,%esi
xor    %edx,%edx
call   1030 <__cvmx_spi4000_write@plt>
mov    %ebp,%edi
mov    $0x500,%esi
mov    $0x3ff,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <__cvmx_spi4000_write@plt>

LLVM IR (-O0):
define void @__cvmx_spi4000_configure_mac(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = call i32 @__cvmx_spi4000_write(i32 %5, i32 1285, i32 1023)
%7 = load i32, i32* %2
%8 = call i32 @__cvmx_spi4000_write(i32 %7, i32 1568, i32 1023)
%9 = load i32, i32* %2
%10 = call i32 @__cvmx_spi4000_write(i32 %9, i32 1438, i32 1023)
%11 = load i32, i32* %2
%12 = call i32 @__cvmx_spi4000_write(i32 %11, i32 1285, i32 0)
%13 = load i32, i32* %2
%14 = call i32 @__cvmx_spi4000_write(i32 %13, i32 1280, i32 0)
store i32 0, i32* %3
br label %15
15: ; preds = %53, %1
%16 = load i32, i32* %3
%17 = icmp slt i32 %16, 10
br i1 %17, label %18, label %56
18: ; preds = %15
%19 = load i32, i32* %3
%20 = shl i32 %19, 7
store i32 %20, i32* %4
%21 = load i32, i32* %2
%22 = load i32, i32* %4
%23 = or i32 %22, 16
%24 = call i32 @__cvmx_spi4000_write(i32 %21, i32 %23, i32 3)
%25 = load i32, i32* %2
%26 = load i32, i32* %4
%27 = or i32 %26, 15
%28 = call i32 @__cvmx_spi4000_write(i32 %25, i32 %27, i32 16383)
%29 = load i32, i32* %2
%30 = load i32, i32* %4
%31 = or i32 %30, 0
%32 = call i32 @__cvmx_spi4000_write(i32 %29, i32 %31, i32 0)
%33 = load i32, i32* %2
%34 = load i32, i32* %4
%35 = or i32 %34, 1
%36 = call i32 @__cvmx_spi4000_write(i32 %33, i32 %35, i32 0)
%37 = load i32, i32* %2
%38 = load i32, i32* %4
%39 = or i32 %38, 18
%40 = call i32 @__cvmx_spi4000_write(i32 %37, i32 %39, i32 7)
%41 = load i32, i32* %2
%42 = load i32, i32* %4
%43 = or i32 %42, 21
%44 = call i32 @__cvmx_spi4000_write(i32 %41, i32 %43, i32 1)
%45 = load i32, i32* %2
%46 = load i32, i32* %4
%47 = or i32 %46, 24
%48 = call i32 @__cvmx_spi4000_write(i32 %45, i32 %47, i32 4557)
%49 = load i32, i32* %2
%50 = load i32, i32* %4
%51 = or i32 %50, 25
%52 = call i32 @__cvmx_spi4000_write(i32 %49, i32 %51, i32 0)
br label %53
53: ; preds = %18
%54 = load i32, i32* %3
%55 = add nsw i32 %54, 1
store i32 %55, i32* %3
br label %15
56: ; preds = %15
%57 = load i32, i32* %2
%58 = call i32 @__cvmx_spi4000_write(i32 %57, i32 1439, i32 1023)
store i32 0, i32* %3
br label %59
59: ; preds = %75, %56
%60 = load i32, i32* %3
%61 = icmp slt i32 %60, 10
br i1 %61, label %62, label %78
62: ; preds = %59
%63 = load i32, i32* %2
%64 = load i32, i32* %3
%65 = add nsw i32 %64, 1536
%66 = call i32 @__cvmx_spi4000_write(i32 %63, i32 %65, i32 2304)
%67 = load i32, i32* %2
%68 = load i32, i32* %3
%69 = add nsw i32 %68, 1546
%70 = call i32 @__cvmx_spi4000_write(i32 %67, i32 %69, i32 2048)
%71 = load i32, i32* %2
%72 = load i32, i32* %3
%73 = add nsw i32 %72, 1556
%74 = call i32 @__cvmx_spi4000_write(i32 %71, i32 %73, i32 896)
br label %75
75: ; preds = %62
%76 = load i32, i32* %3
%77 = add nsw i32 %76, 1
store i32 %77, i32* %3
br label %59
78: ; preds = %59
%79 = load i32, i32* %2
%80 = call i32 @__cvmx_spi4000_write(i32 %79, i32 1438, i32 0)
%81 = load i32, i32* %2
%82 = call i32 @__cvmx_spi4000_write(i32 %81, i32 1568, i32 0)
%83 = load i32, i32* %2
%84 = call i32 @__cvmx_spi4000_write(i32 %83, i32 1280, i32 1023)
ret void
}

LLVM IR (-O2):
define void @__cvmx_spi4000_configure_mac(i32 %0) {
%2 = tail call i32 @__cvmx_spi4000_write(i32 %0, i32 1285, i32 1023)
%3 = tail call i32 @__cvmx_spi4000_write(i32 %0, i32 1568, i32 1023)
%4 = tail call i32 @__cvmx_spi4000_write(i32 %0, i32 1438, i32 1023)
%5 = tail call i32 @__cvmx_spi4000_write(i32 %0, i32 1285, i32 0)
%6 = tail call i32 @__cvmx_spi4000_write(i32 %0, i32 1280, i32 0)
br label %7
7: ; preds = %1, %7
%8 = phi i32 [ 0, %1 ], [ %25, %7 ]
%9 = shl nuw nsw i32 %8, 7
%10 = or i32 %9, 16
%11 = tail call i32 @__cvmx_spi4000_write(i32 %0, i32 %10, i32 3)
%12 = or i32 %9, 15
%13 = tail call i32 @__cvmx_spi4000_write(i32 %0, i32 %12, i32 16383)
%14 = tail call i32 @__cvmx_spi4000_write(i32 %0, i32 %9, i32 0)
%15 = or i32 %9, 1
%16 = tail call i32 @__cvmx_spi4000_write(i32 %0, i32 %15, i32 0)
%17 = or i32 %9, 18
%18 = tail call i32 @__cvmx_spi4000_write(i32 %0, i32 %17, i32 7)
%19 = or i32 %9, 21
%20 = tail call i32 @__cvmx_spi4000_write(i32 %0, i32 %19, i32 1)
%21 = or i32 %9, 24
%22 = tail call i32 @__cvmx_spi4000_write(i32 %0, i32 %21, i32 4557)
%23 = or i32 %9, 25
%24 = tail call i32 @__cvmx_spi4000_write(i32 %0, i32 %23, i32 0)
%25 = add nuw nsw i32 %8, 1
%26 = icmp eq i32 %25, 10
br i1 %26, label %27, label %7
27: ; preds = %7
%28 = tail call i32 @__cvmx_spi4000_write(i32 %0, i32 1439, i32 1023)
br label %29
29: ; preds = %27, %29
%30 = phi i32 [ 0, %27 ], [ %37, %29 ]
%31 = add nuw nsw i32 %30, 1536
%32 = tail call i32 @__cvmx_spi4000_write(i32 %0, i32 %31, i32 2304)
%33 = add nuw nsw i32 %30, 1546
%34 = tail call i32 @__cvmx_spi4000_write(i32 %0, i32 %33, i32 2048)
%35 = add nuw nsw i32 %30, 1556
%36 = tail call i32 @__cvmx_spi4000_write(i32 %0, i32 %35, i32 896)
%37 = add nuw nsw i32 %30, 1
%38 = icmp eq i32 %37, 10
br i1 %38, label %39, label %29
39: ; preds = %29
%40 = tail call i32 @__cvmx_spi4000_write(i32 %0, i32 1438, i32 0)
%41 = tail call i32 @__cvmx_spi4000_write(i32 %0, i32 1568, i32 0)
%42 = tail call i32 @__cvmx_spi4000_write(i32 %0, i32 1280, i32 1023)
ret void
}