#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*/ SPI_Write(int, int);
void W5100_Init(void) {
  unsigned char mac_addr[] = {0x00, 0x16, 0x36, 0xDE, 0x58, 0xF6};
  unsigned char ip_addr[] = {192, 168, 2, 10};
  unsigned char sub_mask[] = {255, 255, 255, 0};
  unsigned char gtw_addr[] = {192, 168, 2, 1};
  SPI_Write(0x0000, 0x80);
  SPI_Write(0x0001 + 0, gtw_addr[0]);
  SPI_Write(0x0001 + 1, gtw_addr[1]);
  SPI_Write(0x0001 + 2, gtw_addr[2]);
  SPI_Write(0x0001 + 3, gtw_addr[3]);
  SPI_Write(0x0009 + 0, mac_addr[0]);
  SPI_Write(0x0009 + 1, mac_addr[1]);
  SPI_Write(0x0009 + 2, mac_addr[2]);
  SPI_Write(0x0009 + 3, mac_addr[3]);
  SPI_Write(0x0009 + 4, mac_addr[4]);
  SPI_Write(0x0009 + 5, mac_addr[5]);
  SPI_Write(0x0005 + 0, sub_mask[0]);
  SPI_Write(0x0005 + 1, sub_mask[1]);
  SPI_Write(0x0005 + 2, sub_mask[2]);
  SPI_Write(0x0005 + 3, sub_mask[3]);
  SPI_Write(0x000F + 0, ip_addr[0]);
  SPI_Write(0x000F + 1, ip_addr[1]);
  SPI_Write(0x000F + 2, ip_addr[2]);
  SPI_Write(0x000F + 3, ip_addr[3]);
  SPI_Write(0x001A, 0x05);
  SPI_Write(0x001B, 0x05);
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xee2(%rip),%eax
mov    %eax,-0x6(%rbp)
mov    0xedc(%rip),%ax
mov    %ax,-0x2(%rbp)
mov    0xed4(%rip),%eax
mov    %eax,-0xa(%rbp)
mov    0xed3(%rip),%eax
mov    %eax,-0xe(%rbp)
mov    0xec6(%rip),%eax
mov    %eax,-0x12(%rbp)
xor    %edi,%edi
mov    $0x80,%esi
call   1030 <SPI_Write@plt>
movzbl -0x12(%rbp),%esi
mov    $0x1,%edi
call   1030 <SPI_Write@plt>
movzbl -0x11(%rbp),%esi
mov    $0x2,%edi
call   1030 <SPI_Write@plt>
movzbl -0x10(%rbp),%esi
mov    $0x3,%edi
call   1030 <SPI_Write@plt>
movzbl -0xf(%rbp),%esi
mov    $0x4,%edi
call   1030 <SPI_Write@plt>
movzbl -0x6(%rbp),%esi
mov    $0x9,%edi
call   1030 <SPI_Write@plt>
movzbl -0x5(%rbp),%esi
mov    $0xa,%edi
call   1030 <SPI_Write@plt>
movzbl -0x4(%rbp),%esi
mov    $0xb,%edi
call   1030 <SPI_Write@plt>
movzbl -0x3(%rbp),%esi
mov    $0xc,%edi
call   1030 <SPI_Write@plt>
movzbl -0x2(%rbp),%esi
mov    $0xd,%edi
call   1030 <SPI_Write@plt>
movzbl -0x1(%rbp),%esi
mov    $0xe,%edi
call   1030 <SPI_Write@plt>
movzbl -0xe(%rbp),%esi
mov    $0x5,%edi
call   1030 <SPI_Write@plt>
movzbl -0xd(%rbp),%esi
mov    $0x6,%edi
call   1030 <SPI_Write@plt>
movzbl -0xc(%rbp),%esi
mov    $0x7,%edi
call   1030 <SPI_Write@plt>
movzbl -0xb(%rbp),%esi
mov    $0x8,%edi
call   1030 <SPI_Write@plt>
movzbl -0xa(%rbp),%esi
mov    $0xf,%edi
call   1030 <SPI_Write@plt>
movzbl -0x9(%rbp),%esi
mov    $0x10,%edi
call   1030 <SPI_Write@plt>
movzbl -0x8(%rbp),%esi
mov    $0x11,%edi
call   1030 <SPI_Write@plt>
movzbl -0x7(%rbp),%esi
mov    $0x12,%edi
call   1030 <SPI_Write@plt>
mov    $0x1a,%edi
mov    $0x5,%esi
call   1030 <SPI_Write@plt>
mov    $0x1b,%edi
mov    $0x5,%esi
call   1030 <SPI_Write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rax
xor    %edi,%edi
mov    $0x80,%esi
call   1030 <SPI_Write@plt>
mov    $0x1,%edi
mov    $0xc0,%esi
call   1030 <SPI_Write@plt>
mov    $0x2,%edi
mov    $0xa8,%esi
call   1030 <SPI_Write@plt>
mov    $0x3,%edi
mov    $0x2,%esi
call   1030 <SPI_Write@plt>
mov    $0x4,%edi
mov    $0x1,%esi
call   1030 <SPI_Write@plt>
mov    $0x9,%edi
xor    %esi,%esi
call   1030 <SPI_Write@plt>
mov    $0xa,%edi
mov    $0x16,%esi
call   1030 <SPI_Write@plt>
mov    $0xb,%edi
mov    $0x36,%esi
call   1030 <SPI_Write@plt>
mov    $0xc,%edi
mov    $0xde,%esi
call   1030 <SPI_Write@plt>
mov    $0xd,%edi
mov    $0x58,%esi
call   1030 <SPI_Write@plt>
mov    $0xe,%edi
mov    $0xf6,%esi
call   1030 <SPI_Write@plt>
mov    $0x5,%edi
mov    $0xff,%esi
call   1030 <SPI_Write@plt>
mov    $0x6,%edi
mov    $0xff,%esi
call   1030 <SPI_Write@plt>
mov    $0x7,%edi
mov    $0xff,%esi
call   1030 <SPI_Write@plt>
mov    $0x8,%edi
xor    %esi,%esi
call   1030 <SPI_Write@plt>
mov    $0xf,%edi
mov    $0xc0,%esi
call   1030 <SPI_Write@plt>
mov    $0x10,%edi
mov    $0xa8,%esi
call   1030 <SPI_Write@plt>
mov    $0x11,%edi
mov    $0x2,%esi
call   1030 <SPI_Write@plt>
mov    $0x12,%edi
mov    $0xa,%esi
call   1030 <SPI_Write@plt>
mov    $0x1a,%edi
mov    $0x5,%esi
call   1030 <SPI_Write@plt>
mov    $0x1b,%edi
mov    $0x5,%esi
pop    %rax
jmp    1030 <SPI_Write@plt>

LLVM IR (-O0):
@__const.W5100_Init.mac_addr = [6 x i8] c"\00\166\DEX\F6"
@__const.W5100_Init.ip_addr = [4 x i8] c"\C0\A8\02\0A"
@__const.W5100_Init.sub_mask = [4 x i8] c"\FF\FF\FF\00"
@__const.W5100_Init.gtw_addr = [4 x i8] c"\C0\A8\02\01"
define void @W5100_Init() {
%1 = alloca [6 x i8]
%2 = alloca [4 x i8]
%3 = alloca [4 x i8]
%4 = alloca [4 x i8]
%5 = bitcast [6 x i8]* %1 to i8*
%6 = bitcast [4 x i8]* %2 to i8*
%7 = bitcast [4 x i8]* %3 to i8*
%8 = bitcast [4 x i8]* %4 to i8*
%9 = call i32 @SPI_Write(i32 0, i32 128)
%10 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = call i32 @SPI_Write(i32 1, i32 %12)
%14 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 1
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = call i32 @SPI_Write(i32 2, i32 %16)
%18 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 2
%19 = load i8, i8* %18
%20 = zext i8 %19 to i32
%21 = call i32 @SPI_Write(i32 3, i32 %20)
%22 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 3
%23 = load i8, i8* %22
%24 = zext i8 %23 to i32
%25 = call i32 @SPI_Write(i32 4, i32 %24)
%26 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%27 = load i8, i8* %26
%28 = zext i8 %27 to i32
%29 = call i32 @SPI_Write(i32 9, i32 %28)
%30 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 1
%31 = load i8, i8* %30
%32 = zext i8 %31 to i32
%33 = call i32 @SPI_Write(i32 10, i32 %32)
%34 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 2
%35 = load i8, i8* %34
%36 = zext i8 %35 to i32
%37 = call i32 @SPI_Write(i32 11, i32 %36)
%38 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 3
%39 = load i8, i8* %38
%40 = zext i8 %39 to i32
%41 = call i32 @SPI_Write(i32 12, i32 %40)
%42 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 4
%43 = load i8, i8* %42
%44 = zext i8 %43 to i32
%45 = call i32 @SPI_Write(i32 13, i32 %44)
%46 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 5
%47 = load i8, i8* %46
%48 = zext i8 %47 to i32
%49 = call i32 @SPI_Write(i32 14, i32 %48)
%50 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%51 = load i8, i8* %50
%52 = zext i8 %51 to i32
%53 = call i32 @SPI_Write(i32 5, i32 %52)
%54 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 1
%55 = load i8, i8* %54
%56 = zext i8 %55 to i32
%57 = call i32 @SPI_Write(i32 6, i32 %56)
%58 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 2
%59 = load i8, i8* %58
%60 = zext i8 %59 to i32
%61 = call i32 @SPI_Write(i32 7, i32 %60)
%62 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 3
%63 = load i8, i8* %62
%64 = zext i8 %63 to i32
%65 = call i32 @SPI_Write(i32 8, i32 %64)
%66 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%67 = load i8, i8* %66
%68 = zext i8 %67 to i32
%69 = call i32 @SPI_Write(i32 15, i32 %68)
%70 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 1
%71 = load i8, i8* %70
%72 = zext i8 %71 to i32
%73 = call i32 @SPI_Write(i32 16, i32 %72)
%74 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 2
%75 = load i8, i8* %74
%76 = zext i8 %75 to i32
%77 = call i32 @SPI_Write(i32 17, i32 %76)
%78 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 3
%79 = load i8, i8* %78
%80 = zext i8 %79 to i32
%81 = call i32 @SPI_Write(i32 18, i32 %80)
%82 = call i32 @SPI_Write(i32 26, i32 5)
%83 = call i32 @SPI_Write(i32 27, i32 5)
ret void
}

LLVM IR (-O2):
define void @W5100_Init() {
%1 = tail call i32 @SPI_Write(i32 0, i32 128)
%2 = tail call i32 @SPI_Write(i32 1, i32 192)
%3 = tail call i32 @SPI_Write(i32 2, i32 168)
%4 = tail call i32 @SPI_Write(i32 3, i32 2)
%5 = tail call i32 @SPI_Write(i32 4, i32 1)
%6 = tail call i32 @SPI_Write(i32 9, i32 0)
%7 = tail call i32 @SPI_Write(i32 10, i32 22)
%8 = tail call i32 @SPI_Write(i32 11, i32 54)
%9 = tail call i32 @SPI_Write(i32 12, i32 222)
%10 = tail call i32 @SPI_Write(i32 13, i32 88)
%11 = tail call i32 @SPI_Write(i32 14, i32 246)
%12 = tail call i32 @SPI_Write(i32 5, i32 255)
%13 = tail call i32 @SPI_Write(i32 6, i32 255)
%14 = tail call i32 @SPI_Write(i32 7, i32 255)
%15 = tail call i32 @SPI_Write(i32 8, i32 0)
%16 = tail call i32 @SPI_Write(i32 15, i32 192)
%17 = tail call i32 @SPI_Write(i32 16, i32 168)
%18 = tail call i32 @SPI_Write(i32 17, i32 2)
%19 = tail call i32 @SPI_Write(i32 18, i32 10)
%20 = tail call i32 @SPI_Write(i32 26, i32 5)
%21 = tail call i32 @SPI_Write(i32 27, i32 5)
ret void
}