#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 */
struct sockaddr_un {
  int /*<<< orphan*/ sun_path;
  void *sun_family;
};
struct sockaddr {
  int dummy;
};
typedef scalar_t__ pid_t;
typedef int /*<<< orphan*/ outbuf;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
void *AF_UNIX;
int /*<<< orphan*/ SOCK_DGRAM;
scalar_t__ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ bzero(char *, int);
int /*<<< orphan*/ close(int);
scalar_t__ connect(int, struct sockaddr *, int);
int /*<<< orphan*/ exit(int);
scalar_t__ fork();
int /*<<< orphan*/ listen(int, int);
int /*<<< orphan*/ memcpy(char *, char *, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int raw_get_dev_index(char *);
int raw_init_socket(int);
int raw_recv(int, char *, int);
int /*<<< orphan*/ raw_send(int, int, char *, int);
int read(int, char *, int);
int socket(void *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strcpy(int /*<<< orphan*/, char *);
int /*<<< orphan*/ unlink(char *);
scalar_t__ write(int, char *, int);
void ioulive_main(char *IOULIVE_NAME, char *IOU_NAME, char *IOULIVE_INTF,
                  int IOU_INTF_ID, int IOU_INST, int IOULIVE_INST) {
  int ioulive_sock, iou_sock, raw_sock, raw_fd, raw_dev_id, rval, i;
  struct sockaddr_un router;
  struct sockaddr_un server;
  char buf[1522];
  char outbuf[1514];
  pid_t task;
  unlink(IOULIVE_NAME);
beginning:
  printf("Press CTRL-C to exit IOUlive86...\n");
  iou_sock = socket(AF_UNIX, SOCK_DGRAM, 0);
  if (iou_sock < 0) {
    perror("opening socket to router\n");
    exit(1);
  }
  router.sun_family = AF_UNIX;
  strcpy(router.sun_path, IOU_NAME);
  while (connect(iou_sock, (struct sockaddr *)&router,
                 sizeof(struct sockaddr_un)) < 0)
    ;
  unlink(IOULIVE_NAME);
  ioulive_sock = socket(AF_UNIX, SOCK_DGRAM, 0);
  if (ioulive_sock < 0) {
    perror("opening raw socket");
    exit(1);
  }
  server.sun_family = AF_UNIX;
  strcpy(server.sun_path, IOULIVE_NAME);
  if (bind(ioulive_sock, (struct sockaddr *)&server,
           sizeof(struct sockaddr_un))) {
    perror("binding raw socket");
    exit(1);
  }
  printf("Connected to IOU instance: %u\n", IOU_INST);
  listen(ioulive_sock, 5);
  raw_dev_id = raw_get_dev_index(IOULIVE_INTF);
  if (raw_dev_id == -1) {
    perror("Invalid Ethernet device specified");
    close(ioulive_sock);
    close(iou_sock);
    exit(1);
  }
  raw_fd = raw_init_socket(raw_dev_id);
  if (raw_fd < 0) {
    perror("Invalid file handle for Ethernet device");
    close(ioulive_sock);
    close(iou_sock);
    exit(1);
  }
  task = fork();
  if (task == 0) {
    while (1) {
      bzero(buf, sizeof(buf));
      bzero(outbuf, sizeof(outbuf));
      if ((rval = read(ioulive_sock, buf, 1522)) < 0)
        perror("reading frame from IOU instance");
      else if (rval == 0)
        perror("IOU instance ending connection");
      else {
        memcpy(outbuf, &buf[8], rval - 8);
        raw_send(raw_fd, raw_dev_id, outbuf, rval - 8);
      }
    }
  } else {
    while (1) {
      bzero(buf, sizeof(buf));
      bzero(outbuf, sizeof(outbuf));
      if ((rval = raw_recv(raw_fd, outbuf, 1522)) < 0)
        perror("reading raw Ethernet frame");
      else if (rval == 0)
        perror("ending raw Ethernet connection");
      else {
        buf[0] = IOU_INST >> 8;
        buf[1] = IOU_INST & 255;
        buf[2] = IOULIVE_INST >> 8;
        buf[3] = IOULIVE_INST & 255;
        buf[4] = IOU_INTF_ID;
        buf[5] = 0;
        buf[6] = 1;
        buf[7] = 0;
        memcpy(&buf[8], outbuf, rval);
        if (write(iou_sock, buf, 1522) < 0) {
          printf("IOU instance terminated: waiting for re-connection.\n");
          close(ioulive_sock);
          close(iou_sock);
          unlink(IOULIVE_NAME);
          goto beginning;
        }
      }
    }
  }
  close(ioulive_sock);
  close(iou_sock);
  unlink(IOULIVE_NAME);
}


x86 assembly (clang, -O0):
<ioulive_main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <unlink@plt>
lea    0xd9e(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    0x2d78(%rip),%rax
mov    (%rax),%rdi
mov    0x2d66(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1150 <socket@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jge    12a6 <ioulive_main+0x76>
lea    0xd8c(%rip),%rdi
call   1100 <perror@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    0x2d3b(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x48(%rbp)
mov    -0x50(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1050 <strcpy@plt>
mov    -0x2c(%rbp),%edi
lea    -0x50(%rbp),%rsi
mov    $0x10,%edx
call   1130 <connect@plt>
cmp    $0x0,%rax
jge    12e0 <ioulive_main+0xb0>
jmp    12c0 <ioulive_main+0x90>
mov    -0x8(%rbp),%rdi
call   1040 <unlink@plt>
mov    0x2cf8(%rip),%rax
mov    (%rax),%rdi
mov    0x2ce6(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1150 <socket@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
jge    1326 <ioulive_main+0xf6>
lea    0xd26(%rip),%rdi
call   1100 <perror@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    0x2cbb(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x58(%rbp)
mov    -0x60(%rbp),%edi
mov    -0x8(%rbp),%rsi
call   1050 <strcpy@plt>
mov    -0x28(%rbp),%edi
lea    -0x60(%rbp),%rsi
mov    $0x10,%edx
call   10f0 <bind@plt>
cmp    $0x0,%rax
je     1371 <ioulive_main+0x141>
lea    0xcee(%rip),%rdi
call   1100 <perror@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    -0x20(%rbp),%esi
lea    0xce8(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x28(%rbp),%edi
mov    $0x5,%esi
call   10e0 <listen@plt>
mov    -0x18(%rbp),%rdi
call   10b0 <raw_get_dev_index@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0xffffffff,-0x38(%rbp)
jne    13cb <ioulive_main+0x19b>
lea    0xcd6(%rip),%rdi
call   1100 <perror@plt>
mov    -0x28(%rbp),%edi
call   1080 <close@plt>
mov    -0x2c(%rbp),%edi
call   1080 <close@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    -0x38(%rbp),%edi
call   10c0 <raw_init_socket@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jge    1406 <ioulive_main+0x1d6>
lea    0xcbd(%rip),%rdi
call   1100 <perror@plt>
mov    -0x28(%rbp),%edi
call   1080 <close@plt>
mov    -0x2c(%rbp),%edi
call   1080 <close@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    $0x0,%al
call   1140 <fork@plt>
mov    %rax,-0xc58(%rbp)
cmpq   $0x0,-0xc58(%rbp)
jne    14d4 <ioulive_main+0x2a4>
jmp    1427 <ioulive_main+0x1f7>
lea    -0x660(%rbp),%rdi
mov    $0x5f2,%esi
call   1110 <bzero@plt>
lea    -0xc50(%rbp),%rdi
mov    $0x5ea,%esi
call   1110 <bzero@plt>
mov    -0x28(%rbp),%edi
lea    -0x660(%rbp),%rsi
mov    $0x5f2,%edx
call   1090 <read@plt>
mov    %eax,-0x3c(%rbp)
cmp    $0x0,%eax
jge    147a <ioulive_main+0x24a>
lea    0xc5c(%rip),%rdi
call   1100 <perror@plt>
jmp    14cf <ioulive_main+0x29f>
cmpl   $0x0,-0x3c(%rbp)
jne    1495 <ioulive_main+0x265>
lea    0xc61(%rip),%rdi
call   1100 <perror@plt>
jmp    14ca <ioulive_main+0x29a>
lea    -0xc50(%rbp),%rdi
lea    -0x660(%rbp),%rsi
add    $0x8,%rsi
mov    -0x3c(%rbp),%edx
sub    $0x8,%edx
call   10a0 <memcpy@plt>
mov    -0x34(%rbp),%edi
mov    -0x38(%rbp),%esi
lea    -0xc50(%rbp),%rdx
mov    -0x3c(%rbp),%ecx
sub    $0x8,%ecx
call   10d0 <raw_send@plt>
jmp    14cf <ioulive_main+0x29f>
jmp    1427 <ioulive_main+0x1f7>
jmp    14d9 <ioulive_main+0x2a9>
lea    -0x660(%rbp),%rdi
mov    $0x5f2,%esi
call   1110 <bzero@plt>
lea    -0xc50(%rbp),%rdi
mov    $0x5ea,%esi
call   1110 <bzero@plt>
mov    -0x34(%rbp),%edi
lea    -0xc50(%rbp),%rsi
mov    $0x5f2,%edx
call   1030 <raw_recv@plt>
mov    %eax,-0x3c(%rbp)
cmp    $0x0,%eax
jge    152c <ioulive_main+0x2fc>
lea    0xbe9(%rip),%rdi
call   1100 <perror@plt>
jmp    1607 <ioulive_main+0x3d7>
cmpl   $0x0,-0x3c(%rbp)
jne    1547 <ioulive_main+0x317>
lea    0xbe9(%rip),%rdi
call   1100 <perror@plt>
jmp    1602 <ioulive_main+0x3d2>
mov    -0x20(%rbp),%eax
sar    $0x8,%eax
mov    %al,-0x660(%rbp)
mov    -0x20(%rbp),%eax
and    $0xff,%eax
mov    %al,-0x65f(%rbp)
mov    -0x24(%rbp),%eax
sar    $0x8,%eax
mov    %al,-0x65e(%rbp)
mov    -0x24(%rbp),%eax
and    $0xff,%eax
mov    %al,-0x65d(%rbp)
mov    -0x1c(%rbp),%eax
mov    %al,-0x65c(%rbp)
movb   $0x0,-0x65b(%rbp)
movb   $0x1,-0x65a(%rbp)
movb   $0x0,-0x659(%rbp)
lea    -0x660(%rbp),%rdi
add    $0x8,%rdi
lea    -0xc50(%rbp),%rsi
mov    -0x3c(%rbp),%edx
call   10a0 <memcpy@plt>
mov    -0x2c(%rbp),%edi
lea    -0x660(%rbp),%rsi
mov    $0x5f2,%edx
call   1060 <write@plt>
cmp    $0x0,%rax
jge    15fd <ioulive_main+0x3cd>
lea    0xb6d(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x28(%rbp),%edi
call   1080 <close@plt>
mov    -0x2c(%rbp),%edi
call   1080 <close@plt>
mov    -0x8(%rbp),%rdi
call   1040 <unlink@plt>
jmp    125b <ioulive_main+0x2b>
jmp    1602 <ioulive_main+0x3d2>
jmp    1607 <ioulive_main+0x3d7>
jmp    14d9 <ioulive_main+0x2a9>

x86 assembly (clang, -O2):
<ioulive_main>:
push   %rax
call   1030 <unlink@plt>
lea    0xebd(%rip),%rdi
call   1040 <puts@plt>
mov    0x2e7f(%rip),%rax
mov    (%rax),%rdi
mov    0x2e6d(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1070 <socket@plt>
lea    0xe7d(%rip),%rdi
call   1050 <perror@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_un = type { i32, i8* }
%struct.sockaddr = type { i32 }
@.str = [35 x i8] c"Press CTRL-C to exit IOUlive86...\0A\00"
@AF_UNIX = global i8* null
@SOCK_DGRAM = global i32 0
@.str.1 = [26 x i8] c"opening socket to router\0A\00"
@.str.2 = [19 x i8] c"opening raw socket\00"
@.str.3 = [19 x i8] c"binding raw socket\00"
@.str.4 = [31 x i8] c"Connected to IOU instance: %u\0A\00"
@.str.5 = [34 x i8] c"Invalid Ethernet device specified\00"
@.str.6 = [40 x i8] c"Invalid file handle for Ethernet device\00"
@.str.7 = [32 x i8] c"reading frame from IOU instance\00"
@.str.8 = [31 x i8] c"IOU instance ending connection\00"
@.str.9 = [27 x i8] c"reading raw Ethernet frame\00"
@.str.10 = [31 x i8] c"ending raw Ethernet connection\00"
@.str.11 = [53 x i8] c"IOU instance terminated: waiting for re-connection.\0A\00"
define void @ioulive_main(i8* %0, i8* %1, i8* %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca %struct.sockaddr_un
%21 = alloca %struct.sockaddr_un
%22 = alloca [1522 x i8]
%23 = alloca [1514 x i8]
%24 = alloca i64
store i8* %0, i8** %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%25 = load i8*, i8** %7
%26 = call i32 @unlink(i8* %25)
br label %27
27: ; preds = %186, %6
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%29 = load i8*, i8** @AF_UNIX
%30 = load i32, i32* @SOCK_DGRAM
%31 = call i32 @socket(i8* %29, i32 %30, i32 0)
store i32 %31, i32* %14
%32 = load i32, i32* %14
%33 = icmp slt i32 %32, 0
br i1 %33, label %34, label %37
34: ; preds = %27
%35 = call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%36 = call i32 @exit(i32 1)
unreachable
37: ; preds = %27
%38 = load i8*, i8** @AF_UNIX
%39 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %20, i32 0, i32 1
store i8* %38, i8** %39
%40 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %20, i32 0, i32 0
%41 = load i32, i32* %40
%42 = load i8*, i8** %8
%43 = call i32 @strcpy(i32 %41, i8* %42)
br label %44
44: ; preds = %49, %37
%45 = load i32, i32* %14
%46 = bitcast %struct.sockaddr_un* %20 to %struct.sockaddr*
%47 = call i64 @connect(i32 %45, %struct.sockaddr* %46, i32 16)
%48 = icmp slt i64 %47, 0
br i1 %48, label %49, label %50
49: ; preds = %44
br label %44
50: ; preds = %44
%51 = load i8*, i8** %7
%52 = call i32 @unlink(i8* %51)
%53 = load i8*, i8** @AF_UNIX
%54 = load i32, i32* @SOCK_DGRAM
%55 = call i32 @socket(i8* %53, i32 %54, i32 0)
store i32 %55, i32* %13
%56 = load i32, i32* %13
%57 = icmp slt i32 %56, 0
br i1 %57, label %58, label %61
58: ; preds = %50
%59 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%60 = call i32 @exit(i32 1)
unreachable
61: ; preds = %50
%62 = load i8*, i8** @AF_UNIX
%63 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %21, i32 0, i32 1
store i8* %62, i8** %63
%64 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %21, i32 0, i32 0
%65 = load i32, i32* %64
%66 = load i8*, i8** %7
%67 = call i32 @strcpy(i32 %65, i8* %66)
%68 = load i32, i32* %13
%69 = bitcast %struct.sockaddr_un* %21 to %struct.sockaddr*
%70 = call i64 @bind(i32 %68, %struct.sockaddr* %69, i32 16)
%71 = icmp ne i64 %70, 0
br i1 %71, label %72, label %75
72: ; preds = %61
%73 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%74 = call i32 @exit(i32 1)
unreachable
75: ; preds = %61
%76 = load i32, i32* %11
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0), i32 %76)
%78 = load i32, i32* %13
%79 = call i32 @listen(i32 %78, i32 5)
%80 = load i8*, i8** %9
%81 = call i32 @raw_get_dev_index(i8* %80)
store i32 %81, i32* %17
%82 = load i32, i32* %17
%83 = icmp eq i32 %82, -1
br i1 %83, label %84, label %91
84: ; preds = %75
%85 = call i32 @perror(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0))
%86 = load i32, i32* %13
%87 = call i32 @close(i32 %86)
%88 = load i32, i32* %14
%89 = call i32 @close(i32 %88)
%90 = call i32 @exit(i32 1)
unreachable
91: ; preds = %75
%92 = load i32, i32* %17
%93 = call i32 @raw_init_socket(i32 %92)
store i32 %93, i32* %16
%94 = load i32, i32* %16
%95 = icmp slt i32 %94, 0
br i1 %95, label %96, label %103
96: ; preds = %91
%97 = call i32 @perror(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0))
%98 = load i32, i32* %13
%99 = call i32 @close(i32 %98)
%100 = load i32, i32* %14
%101 = call i32 @close(i32 %100)
%102 = call i32 @exit(i32 1)
unreachable
103: ; preds = %91
%104 = call i64 (...) @fork()
store i64 %104, i64* %24
%105 = load i64, i64* %24
%106 = icmp eq i64 %105, 0
br i1 %106, label %107, label %138
107: ; preds = %103
br label %108
108: ; preds = %107, %137
%109 = getelementptr inbounds [1522 x i8], [1522 x i8]* %22, i64 0, i64 0
%110 = call i32 @bzero(i8* %109, i32 1522)
%111 = getelementptr inbounds [1514 x i8], [1514 x i8]* %23, i64 0, i64 0
%112 = call i32 @bzero(i8* %111, i32 1514)
%113 = load i32, i32* %13
%114 = getelementptr inbounds [1522 x i8], [1522 x i8]* %22, i64 0, i64 0
%115 = call i32 @read(i32 %113, i8* %114, i32 1522)
store i32 %115, i32* %18
%116 = icmp slt i32 %115, 0
br i1 %116, label %117, label %119
117: ; preds = %108
%118 = call i32 @perror(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0))
br label %137
119: ; preds = %108
%120 = load i32, i32* %18
%121 = icmp eq i32 %120, 0
br i1 %121, label %122, label %124
122: ; preds = %119
%123 = call i32 @perror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0))
br label %136
124: ; preds = %119
%125 = getelementptr inbounds [1514 x i8], [1514 x i8]* %23, i64 0, i64 0
%126 = getelementptr inbounds [1522 x i8], [1522 x i8]* %22, i64 0, i64 8
%127 = load i32, i32* %18
%128 = sub nsw i32 %127, 8
%129 = call i32 @memcpy(i8* %125, i8* %126, i32 %128)
%130 = load i32, i32* %16
%131 = load i32, i32* %17
%132 = getelementptr inbounds [1514 x i8], [1514 x i8]* %23, i64 0, i64 0
%133 = load i32, i32* %18
%134 = sub nsw i32 %133, 8
%135 = call i32 @raw_send(i32 %130, i32 %131, i8* %132, i32 %134)
br label %136
136: ; preds = %124, %122
br label %137
137: ; preds = %136, %117
br label %108
138: ; preds = %103
br label %139
139: ; preds = %138, %196
%140 = getelementptr inbounds [1522 x i8], [1522 x i8]* %22, i64 0, i64 0
%141 = call i32 @bzero(i8* %140, i32 1522)
%142 = getelementptr inbounds [1514 x i8], [1514 x i8]* %23, i64 0, i64 0
%143 = call i32 @bzero(i8* %142, i32 1514)
%144 = load i32, i32* %16
%145 = getelementptr inbounds [1514 x i8], [1514 x i8]* %23, i64 0, i64 0
%146 = call i32 @raw_recv(i32 %144, i8* %145, i32 1522)
store i32 %146, i32* %18
%147 = icmp slt i32 %146, 0
br i1 %147, label %148, label %150
148: ; preds = %139
%149 = call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0))
br label %196
150: ; preds = %139
%151 = load i32, i32* %18
%152 = icmp eq i32 %151, 0
br i1 %152, label %153, label %155
153: ; preds = %150
%154 = call i32 @perror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.10, i64 0, i64 0))
br label %195
155: ; preds = %150
%156 = load i32, i32* %11
%157 = ashr i32 %156, 8
%158 = trunc i32 %157 to i8
%159 = getelementptr inbounds [1522 x i8], [1522 x i8]* %22, i64 0, i64 0
store i8 %158, i8* %159
%160 = load i32, i32* %11
%161 = and i32 %160, 255
%162 = trunc i32 %161 to i8
%163 = getelementptr inbounds [1522 x i8], [1522 x i8]* %22, i64 0, i64 1
store i8 %162, i8* %163
%164 = load i32, i32* %12
%165 = ashr i32 %164, 8
%166 = trunc i32 %165 to i8
%167 = getelementptr inbounds [1522 x i8], [1522 x i8]* %22, i64 0, i64 2
store i8 %166, i8* %167
%168 = load i32, i32* %12
%169 = and i32 %168, 255
%170 = trunc i32 %169 to i8
%171 = getelementptr inbounds [1522 x i8], [1522 x i8]* %22, i64 0, i64 3
store i8 %170, i8* %171
%172 = load i32, i32* %10
%173 = trunc i32 %172 to i8
%174 = getelementptr inbounds [1522 x i8], [1522 x i8]* %22, i64 0, i64 4
store i8 %173, i8* %174
%175 = getelementptr inbounds [1522 x i8], [1522 x i8]* %22, i64 0, i64 5
store i8 0, i8* %175
%176 = getelementptr inbounds [1522 x i8], [1522 x i8]* %22, i64 0, i64 6
store i8 1, i8* %176
%177 = getelementptr inbounds [1522 x i8], [1522 x i8]* %22, i64 0, i64 7
store i8 0, i8* %177
%178 = getelementptr inbounds [1522 x i8], [1522 x i8]* %22, i64 0, i64 8
%179 = getelementptr inbounds [1514 x i8], [1514 x i8]* %23, i64 0, i64 0
%180 = load i32, i32* %18
%181 = call i32 @memcpy(i8* %178, i8* %179, i32 %180)
%182 = load i32, i32* %14
%183 = getelementptr inbounds [1522 x i8], [1522 x i8]* %22, i64 0, i64 0
%184 = call i64 @write(i32 %182, i8* %183, i32 1522)
%185 = icmp slt i64 %184, 0
br i1 %185, label %186, label %194
186: ; preds = %155
%187 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.11, i64 0, i64 0))
%188 = load i32, i32* %13
%189 = call i32 @close(i32 %188)
%190 = load i32, i32* %14
%191 = call i32 @close(i32 %190)
%192 = load i8*, i8** %7
%193 = call i32 @unlink(i8* %192)
br label %27
194: ; preds = %155
br label %195
195: ; preds = %194, %153
br label %196
196: ; preds = %195, %148
br label %139
}

LLVM IR (-O2):
@AF_UNIX = global i8* null
@SOCK_DGRAM = global i32 0
@.str.1 = [26 x i8] c"opening socket to router\0A\00"
@str = [34 x i8] c"Press CTRL-C to exit IOUlive86...\00"
define void @ioulive_main(i8* %0, i8* %1, i8* %2, i32 %3, i32 %4, i32 %5) {
%7 = tail call i32 @unlink(i8* %0)
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%9 = load i8*, i8** @AF_UNIX
%10 = load i32, i32* @SOCK_DGRAM
%11 = call i32 @socket(i8* %9, i32 %10, i32 0)
%12 = icmp slt i32 %11, 0
%13 = call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
}