#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_in {
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_addr;
  int /*<<< orphan*/ sin_family;
};
struct hostent {
  int /*<<< orphan*/ h_length;
  scalar_t__ h_addr;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ server;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ atoi(char *);
int /*<<< orphan*/ bcopy(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ bzero(struct sockaddr_in *, int);
int /*<<< orphan*/ error(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fileRead(int /*<<< orphan*/ *, int, struct sockaddr_in, int,
                            char *, char *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int fread(char *, int, long, int /*<<< orphan*/ *);
struct hostent *gethostbyname(char *);
int /*<<< orphan*/ htons(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  FILE *switch_file;
  char addr_buff[4];
  int result;
  unsigned int addr;
  unsigned int last_addr;
  last_addr = 0;
  long size;
  size = 4;
  int myswitch;
  int wait;
  wait = !(0);
  int originalnum;
  int has_switched;
  has_switched = 0;
  int sock, length;
  socklen_t tolen;
  struct sockaddr_in server;
  struct sockaddr_in to;
  struct hostent *hp;
  FILE *myfile;
  if (argc < 3) {
    fprintf(stderr, "Usage: process id, ppout specific\n");
    return 0;
  }
  sock = socket(AF_INET, SOCK_DGRAM, 0);
  if (sock < 0)
    error("ERROR opening socket");
  length = sizeof(server);
  bzero(&server, length);
  to.sin_family = AF_INET;
  hp = gethostbyname("192.168.1.1");
  if (hp == 0)
    error("Unknown host");
  bcopy((char *)hp->h_addr, (char *)&to.sin_addr, hp->h_length);
  to.sin_port = htons(atoi("12345"));
  tolen = sizeof(struct sockaddr_in);
  char addr_specs_switch[256];
  char addr_specs_a[256];
  char addr_specs_b[256];
  char addr_specs_chan[256];
  sprintf(addr_specs_switch, "/proc/%s/hw/ioreg/%s_addr", argv[1], argv[2]);
  sprintf(addr_specs_a, "/proc/%s/hw/ioreg/%s_a", argv[1], argv[2]);
  sprintf(addr_specs_b, "/proc/%s/hw/ioreg/%s_b", argv[1], argv[2]);
  sprintf(addr_specs_chan, "/proc/%s/hw/ioreg/%s_chan", argv[1], argv[2]);
  while (1) {
    switch_file = fopen(addr_specs_switch, "r");
    result = fread(addr_buff, 1, size, switch_file);
    addr = *(unsigned int *)addr_buff;
    if (((int)addr) - ((int)last_addr) > 4096) {
      printf("discrepancy between subsequent addrs ");
      printf("%d\n", ((int)addr) - ((int)last_addr));
    }
    last_addr = addr;
    myswitch = addr % 8192;
    fclose(switch_file);
    if (wait == !(0)) {
      if (has_switched == 0) {
        originalnum = myswitch;
        has_switched = 1;
      }
      if (myswitch < 4096) {
        if (originalnum >= 4096) {
          wait = 0;
        }
      }
      if (myswitch >= 4096) {
        if (originalnum < 4096) {
          wait = 0;
        }
      }
    } else {
      if (myswitch < 4096) {
        myfile = fopen(addr_specs_b, "r");
        fileRead(myfile, sock, to, tolen, addr_buff, addr_specs_chan);
        fclose(myfile);
        wait = !(0);
        has_switched = 0;
      }
      if (myswitch >= 4096) {
        myfile = fopen(addr_specs_a, "r");
        fileRead(myfile, sock, to, tolen, addr_buff, addr_specs_chan);
        fclose(myfile);
        wait = !(0);
        has_switched = 0;
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4b0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x28(%rbp)
movq   $0x4,-0x30(%rbp)
movl   $0x1,-0x38(%rbp)
movl   $0x0,-0x40(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1240 <main+0x60>
mov    0x2da9(%rip),%rax
mov    (%rax),%edi
lea    0xdd0(%rip),%rsi
call   1090 <fprintf@plt>
xor    %eax,%eax
add    $0x4b0,%rsp
pop    %rbp
ret
mov    0x2da1(%rip),%rax
mov    (%rax),%edi
mov    0x2d90(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1100 <socket@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
jge    1272 <main+0x92>
lea    0xdb6(%rip),%rdi
call   10b0 <error@plt>
movl   $0xc,-0x48(%rbp)
mov    -0x48(%rbp),%esi
lea    -0x58(%rbp),%rdi
call   10d0 <bzero@plt>
mov    0x2d5c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x60(%rbp)
lea    0xda0(%rip),%rdi
call   1080 <gethostbyname@plt>
mov    %rax,-0x70(%rbp)
cmpq   $0x0,-0x70(%rbp)
jne    12b8 <main+0xd8>
lea    0xd91(%rip),%rdi
call   10b0 <error@plt>
mov    -0x70(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x68(%rbp),%rsi
add    $0x4,%rsi
mov    -0x70(%rbp),%rax
mov    (%rax),%edx
call   10a0 <bcopy@plt>
lea    0xd77(%rip),%rdi
call   10e0 <atoi@plt>
mov    %eax,%edi
call   1050 <htons@plt>
mov    %eax,-0x68(%rbp)
movl   $0xc,-0x4c(%rbp)
lea    -0x180(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rcx
lea    0xd49(%rip),%rsi
call   10f0 <sprintf@plt>
lea    -0x280(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rcx
lea    0xd40(%rip),%rsi
call   10f0 <sprintf@plt>
lea    -0x380(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rcx
lea    0xd34(%rip),%rsi
call   10f0 <sprintf@plt>
lea    -0x480(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rcx
lea    0xd28(%rip),%rsi
call   10f0 <sprintf@plt>
lea    -0x180(%rbp),%rdi
lea    0xce5(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x18(%rbp)
lea    -0x1c(%rbp),%rdi
mov    -0x30(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
call   1030 <fread@plt>
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
sub    -0x28(%rbp),%eax
cmp    $0x1000,%eax
jle    13e5 <main+0x205>
lea    0xcef(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x24(%rbp),%esi
sub    -0x28(%rbp),%esi
lea    0xd01(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%eax
and    $0x1fff,%eax
mov    %eax,-0x34(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
cmpl   $0x1,-0x38(%rbp)
jne    1471 <main+0x291>
cmpl   $0x0,-0x40(%rbp)
jne    1420 <main+0x240>
mov    -0x34(%rbp),%eax
mov    %eax,-0x3c(%rbp)
movl   $0x1,-0x40(%rbp)
cmpl   $0x1000,-0x34(%rbp)
jge    1446 <main+0x266>
cmpl   $0x1000,-0x3c(%rbp)
jl     1441 <main+0x261>
movl   $0x0,-0x38(%rbp)
jmp    1446 <main+0x266>
cmpl   $0x1000,-0x34(%rbp)
jl     146c <main+0x28c>
cmpl   $0x1000,-0x3c(%rbp)
jge    1467 <main+0x287>
movl   $0x0,-0x38(%rbp)
jmp    146c <main+0x28c>
jmp    156c <main+0x38c>
cmpl   $0x1000,-0x34(%rbp)
jge    14ec <main+0x30c>
lea    -0x380(%rbp),%rdi
lea    0xbe3(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x78(%rbp)
mov    -0x78(%rbp),%rdi
mov    -0x44(%rbp),%esi
mov    -0x4c(%rbp),%r8d
lea    -0x1c(%rbp),%r9
lea    -0x480(%rbp),%rax
mov    -0x68(%rbp),%rcx
mov    %rcx,-0x490(%rbp)
mov    -0x60(%rbp),%ecx
mov    %ecx,-0x488(%rbp)
mov    -0x490(%rbp),%rdx
mov    -0x488(%rbp),%ecx
mov    %rax,(%rsp)
call   1070 <fileRead@plt>
mov    -0x78(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x1,-0x38(%rbp)
movl   $0x0,-0x40(%rbp)
cmpl   $0x1000,-0x34(%rbp)
jl     1567 <main+0x387>
lea    -0x280(%rbp),%rdi
lea    0xb68(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x78(%rbp)
mov    -0x78(%rbp),%rdi
mov    -0x44(%rbp),%esi
mov    -0x4c(%rbp),%r8d
lea    -0x1c(%rbp),%r9
lea    -0x480(%rbp),%rax
mov    -0x68(%rbp),%rcx
mov    %rcx,-0x4a0(%rbp)
mov    -0x60(%rbp),%ecx
mov    %ecx,-0x498(%rbp)
mov    -0x4a0(%rbp),%rdx
mov    -0x498(%rbp),%ecx
mov    %rax,(%rsp)
call   1070 <fileRead@plt>
mov    -0x78(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x1,-0x38(%rbp)
movl   $0x0,-0x40(%rbp)
jmp    156c <main+0x38c>
jmp    137c <main+0x19c>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x448,%rsp
cmp    $0x2,%edi
jg     11ff <main+0x3f>
mov    0x2df3(%rip),%rax
mov    (%rax),%edi
lea    0xe1a(%rip),%rsi
call   1090 <fprintf@plt>
xor    %eax,%eax
add    $0x448,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rsi,%r14
mov    0x2ddf(%rip),%rbx
mov    (%rbx),%edi
mov    0x2dce(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10e0 <socket@plt>
mov    %eax,0x20(%rsp)
test   %eax,%eax
jns    122f <main+0x6f>
lea    0xdf9(%rip),%rdi
call   10b0 <error@plt>
mov    (%rbx),%eax
mov    %eax,0x30(%rsp)
lea    0xdfc(%rip),%rdi
call   1080 <gethostbyname@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    1255 <main+0x95>
lea    0xdf4(%rip),%rdi
call   10b0 <error@plt>
mov    0x8(%rbp),%rsi
lea    0x2c(%rsp),%rdi
mov    0x0(%rbp),%edx
call   10a0 <memcpy@plt>
mov    $0x3039,%edi
call   1050 <htons@plt>
mov    %eax,0x28(%rsp)
mov    0x8(%r14),%rdx
mov    0x10(%r14),%rcx
lea    0xdce(%rip),%rsi
lea    0x340(%rsp),%rdi
call   10d0 <sprintf@plt>
mov    0x8(%r14),%rdx
mov    0x10(%r14),%rcx
lea    0xdcc(%rip),%rsi
lea    0x240(%rsp),%rdi
call   10d0 <sprintf@plt>
mov    0x8(%r14),%rdx
mov    0x10(%r14),%rcx
lea    0xdc7(%rip),%rsi
lea    0x140(%rsp),%rdi
call   10d0 <sprintf@plt>
mov    0x8(%r14),%rdx
mov    0x10(%r14),%rcx
lea    0xdc2(%rip),%rsi
lea    0x40(%rsp),%rdi
call   10d0 <sprintf@plt>
mov    0x28(%rsp),%rax
mov    %rax,0x38(%rsp)
mov    $0x1,%r12d
mov    $0x1,%cl
mov    0x30(%rsp),%eax
mov    %eax,0x1c(%rsp)
lea    0xd67(%rip),%r13
lea    0x14(%rsp),%rbx
xor    %r14d,%r14d
jmp    134b <main+0x18b>
nopl   0x0(%rax)
testb  $0x1,0x18(%rsp)
mov    0x24(%rsp),%eax
cmovne %ebx,%eax
mov    %eax,0x24(%rsp)
cmp    $0x1000,%eax
setl   %al
setge  %cl
cmp    $0x1000,%ebx
setae  %dl
setb   %bl
or     %al,%dl
or     %cl,%bl
and    %dl,%bl
movzbl %bl,%r12d
xor    %ecx,%ecx
mov    %r15,%r13
lea    0x14(%rsp),%rbx
mov    %ecx,0x18(%rsp)
jmp    13b3 <main+0x1f3>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0x140(%rsp),%rdi
mov    %r13,%rsi
call   10c0 <fopen@plt>
mov    %rax,%rbp
lea    0x40(%rsp),%rax
mov    %rax,(%rsp)
mov    %rbp,%rdi
mov    0x20(%rsp),%esi
mov    0x38(%rsp),%rdx
mov    0x1c(%rsp),%ecx
mov    $0xc,%r8d
lea    0x14(%rsp),%rbx
mov    %rbx,%r9
call   1070 <fileRead@plt>
mov    %rbp,%rdi
call   1040 <fclose@plt>
mov    $0x1,%r12d
mov    $0x1,%al
mov    %eax,0x18(%rsp)
mov    %r14d,%ebp
lea    0x340(%rsp),%rdi
mov    %r13,%r15
mov    %r13,%rsi
call   10c0 <fopen@plt>
mov    %rax,%r13
mov    $0x4,%edx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %rax,%rcx
call   1030 <fread@plt>
mov    0x14(%rsp),%r14d
mov    %r14d,%ebx
sub    %ebp,%ebx
cmp    $0x1001,%ebx
jl     1411 <main+0x251>
lea    0xcb9(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xcd1(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14d,%ebx
and    $0x1fff,%ebx
mov    %r13,%rdi
call   1040 <fclose@plt>
cmp    $0x1,%r12d
je     1310 <main+0x150>
cmp    $0xfff,%ebx
mov    %r15,%r13
jbe    1360 <main+0x1a0>
lea    0x240(%rsp),%rdi
jmp    1368 <main+0x1a8>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.hostent = type { i32, i64 }
@stderr = global i32 0
@.str = [35 x i8] c"Usage: process id, ppout specific\0A\00"
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str.1 = [21 x i8] c"ERROR opening socket\00"
@.str.2 = [12 x i8] c"192.168.1.1\00"
@.str.3 = [13 x i8] c"Unknown host\00"
@.str.4 = [6 x i8] c"12345\00"
@.str.5 = [26 x i8] c"/proc/%s/hw/ioreg/%s_addr\00"
@.str.6 = [23 x i8] c"/proc/%s/hw/ioreg/%s_a\00"
@.str.7 = [23 x i8] c"/proc/%s/hw/ioreg/%s_b\00"
@.str.8 = [26 x i8] c"/proc/%s/hw/ioreg/%s_chan\00"
@.str.9 = [2 x i8] c"r\00"
@.str.10 = [38 x i8] c"discrepancy between subsequent addrs \00"
@.str.11 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca [4 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i64
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca %struct.sockaddr_in
%20 = alloca %struct.sockaddr_in
%21 = alloca %struct.hostent*
%22 = alloca i32*
%23 = alloca [256 x i8]
%24 = alloca [256 x i8]
%25 = alloca [256 x i8]
%26 = alloca [256 x i8]
%27 = alloca { i64, i32 }
%28 = alloca { i64, i32 }
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %10
store i64 4, i64* %11
store i32 1, i32* %13
store i32 0, i32* %15
%29 = load i32, i32* %4
%30 = icmp slt i32 %29, 3
br i1 %30, label %31, label %34
31: ; preds = %2
%32 = load i32, i32* @stderr
%33 = call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
ret i32 0
34: ; preds = %2
%35 = load i32, i32* @AF_INET
%36 = load i32, i32* @SOCK_DGRAM
%37 = call i32 @socket(i32 %35, i32 %36, i32 0)
store i32 %37, i32* %16
%38 = load i32, i32* %16
%39 = icmp slt i32 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %34
%41 = call i32 @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %42
42: ; preds = %40, %34
store i32 12, i32* %17
%43 = load i32, i32* %17
%44 = call i32 @bzero(%struct.sockaddr_in* %19, i32 %43)
%45 = load i32, i32* @AF_INET
%46 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %20, i32 0, i32 2
store i32 %45, i32* %46
%47 = call %struct.hostent* @gethostbyname(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
store %struct.hostent* %47, %struct.hostent** %21
%48 = load %struct.hostent*, %struct.hostent** %21
%49 = icmp eq %struct.hostent* %48, null
br i1 %49, label %50, label %52
50: ; preds = %42
%51 = call i32 @error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
br label %52
52: ; preds = %50, %42
%53 = load %struct.hostent*, %struct.hostent** %21
%54 = getelementptr inbounds %struct.hostent, %struct.hostent* %53, i32 0, i32 1
%55 = load i64, i64* %54
%56 = inttoptr i64 %55 to i8*
%57 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %20, i32 0, i32 1
%58 = bitcast i32* %57 to i8*
%59 = load %struct.hostent*, %struct.hostent** %21
%60 = getelementptr inbounds %struct.hostent, %struct.hostent* %59, i32 0, i32 0
%61 = load i32, i32* %60
%62 = call i32 @bcopy(i8* %56, i8* %58, i32 %61)
%63 = call i32 @atoi(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%64 = call i32 @htons(i32 %63)
%65 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %20, i32 0, i32 0
store i32 %64, i32* %65
store i32 12, i32* %18
%66 = getelementptr inbounds [256 x i8], [256 x i8]* %23, i64 0, i64 0
%67 = load i8**, i8*** %5
%68 = getelementptr inbounds i8*, i8** %67, i64 1
%69 = load i8*, i8** %68
%70 = load i8**, i8*** %5
%71 = getelementptr inbounds i8*, i8** %70, i64 2
%72 = load i8*, i8** %71
%73 = call i32 @sprintf(i8* %66, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i8* %69, i8* %72)
%74 = getelementptr inbounds [256 x i8], [256 x i8]* %24, i64 0, i64 0
%75 = load i8**, i8*** %5
%76 = getelementptr inbounds i8*, i8** %75, i64 1
%77 = load i8*, i8** %76
%78 = load i8**, i8*** %5
%79 = getelementptr inbounds i8*, i8** %78, i64 2
%80 = load i8*, i8** %79
%81 = call i32 @sprintf(i8* %74, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i8* %77, i8* %80)
%82 = getelementptr inbounds [256 x i8], [256 x i8]* %25, i64 0, i64 0
%83 = load i8**, i8*** %5
%84 = getelementptr inbounds i8*, i8** %83, i64 1
%85 = load i8*, i8** %84
%86 = load i8**, i8*** %5
%87 = getelementptr inbounds i8*, i8** %86, i64 2
%88 = load i8*, i8** %87
%89 = call i32 @sprintf(i8* %82, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i8* %85, i8* %88)
%90 = getelementptr inbounds [256 x i8], [256 x i8]* %26, i64 0, i64 0
%91 = load i8**, i8*** %5
%92 = getelementptr inbounds i8*, i8** %91, i64 1
%93 = load i8*, i8** %92
%94 = load i8**, i8*** %5
%95 = getelementptr inbounds i8*, i8** %94, i64 2
%96 = load i8*, i8** %95
%97 = call i32 @sprintf(i8* %90, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i8* %93, i8* %96)
br label %98
98: ; preds = %52, %189
%99 = getelementptr inbounds [256 x i8], [256 x i8]* %23, i64 0, i64 0
%100 = call i32* @fopen(i8* %99, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
store i32* %100, i32** %6
%101 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%102 = load i64, i64* %11
%103 = load i32*, i32** %6
%104 = call i32 @fread(i8* %101, i32 1, i64 %102, i32* %103)
store i32 %104, i32* %8
%105 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%106 = bitcast i8* %105 to i32*
%107 = load i32, i32* %106
store i32 %107, i32* %9
%108 = load i32, i32* %9
%109 = load i32, i32* %10
%110 = sub nsw i32 %108, %109
%111 = icmp sgt i32 %110, 4096
br i1 %111, label %112, label %118
112: ; preds = %98
%113 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.10, i64 0, i64 0))
%114 = load i32, i32* %9
%115 = load i32, i32* %10
%116 = sub nsw i32 %114, %115
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0), i32 %116)
br label %118
118: ; preds = %112, %98
%119 = load i32, i32* %9
store i32 %119, i32* %10
%120 = load i32, i32* %9
%121 = urem i32 %120, 8192
store i32 %121, i32* %12
%122 = load i32*, i32** %6
%123 = call i32 @fclose(i32* %122)
%124 = load i32, i32* %13
%125 = icmp eq i32 %124, 1
br i1 %125, label %126, label %148
126: ; preds = %118
%127 = load i32, i32* %15
%128 = icmp eq i32 %127, 0
br i1 %128, label %129, label %131
129: ; preds = %126
%130 = load i32, i32* %12
store i32 %130, i32* %14
store i32 1, i32* %15
br label %131
131: ; preds = %129, %126
%132 = load i32, i32* %12
%133 = icmp slt i32 %132, 4096
br i1 %133, label %134, label %139
134: ; preds = %131
%135 = load i32, i32* %14
%136 = icmp sge i32 %135, 4096
br i1 %136, label %137, label %138
137: ; preds = %134
store i32 0, i32* %13
br label %138
138: ; preds = %137, %134
br label %139
139: ; preds = %138, %131
%140 = load i32, i32* %12
%141 = icmp sge i32 %140, 4096
br i1 %141, label %142, label %147
142: ; preds = %139
%143 = load i32, i32* %14
%144 = icmp slt i32 %143, 4096
br i1 %144, label %145, label %146
145: ; preds = %142
store i32 0, i32* %13
br label %146
146: ; preds = %145, %142
br label %147
147: ; preds = %146, %139
br label %189
148: ; preds = %118
%149 = load i32, i32* %12
%150 = icmp slt i32 %149, 4096
br i1 %150, label %151, label %168
151: ; preds = %148
%152 = getelementptr inbounds [256 x i8], [256 x i8]* %25, i64 0, i64 0
%153 = call i32* @fopen(i8* %152, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
store i32* %153, i32** %22
%154 = load i32*, i32** %22
%155 = load i32, i32* %16
%156 = load i32, i32* %18
%157 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%158 = getelementptr inbounds [256 x i8], [256 x i8]* %26, i64 0, i64 0
%159 = bitcast { i64, i32 }* %27 to i8*
%160 = bitcast %struct.sockaddr_in* %20 to i8*
%161 = getelementptr inbounds { i64, i32 }, { i64, i32 }* %27, i32 0, i32 0
%162 = load i64, i64* %161
%163 = getelementptr inbounds { i64, i32 }, { i64, i32 }* %27, i32 0, i32 1
%164 = load i32, i32* %163
%165 = call i32 @fileRead(i32* %154, i32 %155, i64 %162, i32 %164, i32 %156, i8* %157, i8* %158)
%166 = load i32*, i32** %22
%167 = call i32 @fclose(i32* %166)
store i32 1, i32* %13
store i32 0, i32* %15
br label %168
168: ; preds = %151, %148
%169 = load i32, i32* %12
%170 = icmp sge i32 %169, 4096
br i1 %170, label %171, label %188
171: ; preds = %168
%172 = getelementptr inbounds [256 x i8], [256 x i8]* %24, i64 0, i64 0
%173 = call i32* @fopen(i8* %172, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
store i32* %173, i32** %22
%174 = load i32*, i32** %22
%175 = load i32, i32* %16
%176 = load i32, i32* %18
%177 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%178 = getelementptr inbounds [256 x i8], [256 x i8]* %26, i64 0, i64 0
%179 = bitcast { i64, i32 }* %28 to i8*
%180 = bitcast %struct.sockaddr_in* %20 to i8*
%181 = getelementptr inbounds { i64, i32 }, { i64, i32 }* %28, i32 0, i32 0
%182 = load i64, i64* %181
%183 = getelementptr inbounds { i64, i32 }, { i64, i32 }* %28, i32 0, i32 1
%184 = load i32, i32* %183
%185 = call i32 @fileRead(i32* %174, i32 %175, i64 %182, i32 %184, i32 %176, i8* %177, i8* %178)
%186 = load i32*, i32** %22
%187 = call i32 @fclose(i32* %186)
store i32 1, i32* %13
store i32 0, i32* %15
br label %188
188: ; preds = %171, %168
br label %189
189: ; preds = %188, %147
br label %98
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.hostent = type { i32, i64 }
@stderr = global i32 0
@.str = [35 x i8] c"Usage: process id, ppout specific\0A\00"
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@.str.1 = [21 x i8] c"ERROR opening socket\00"
@.str.2 = [12 x i8] c"192.168.1.1\00"
@.str.3 = [13 x i8] c"Unknown host\00"
@.str.5 = [26 x i8] c"/proc/%s/hw/ioreg/%s_addr\00"
@.str.6 = [23 x i8] c"/proc/%s/hw/ioreg/%s_a\00"
@.str.7 = [23 x i8] c"/proc/%s/hw/ioreg/%s_b\00"
@.str.8 = [26 x i8] c"/proc/%s/hw/ioreg/%s_chan\00"
@.str.9 = [2 x i8] c"r\00"
@.str.10 = [38 x i8] c"discrepancy between subsequent addrs \00"
@.str.11 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca %struct.sockaddr_in
%5 = alloca [256 x i8]
%6 = alloca [256 x i8]
%7 = alloca [256 x i8]
%8 = alloca [256 x i8]
%9 = bitcast i32* %3 to i8*
%10 = bitcast %struct.sockaddr_in* %4 to i8*
%11 = icmp slt i32 %0, 3
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
ret i32 0
15: ; preds = %2
%16 = load i32, i32* @AF_INET
%17 = load i32, i32* @SOCK_DGRAM
%18 = tail call i32 @socket(i32 %16, i32 %17, i32 0)
%19 = icmp slt i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %15
%21 = tail call i32 @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %22
22: ; preds = %20, %15
%23 = load i32, i32* @AF_INET
%24 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 2
store i32 %23, i32* %24
%25 = tail call %struct.hostent* @gethostbyname(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%26 = icmp eq %struct.hostent* %25, null
br i1 %26, label %27, label %29
27: ; preds = %22
%28 = tail call i32 @error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
br label %29
29: ; preds = %27, %22
%30 = getelementptr inbounds %struct.hostent, %struct.hostent* %25, i64 0, i32 1
%31 = load i64, i64* %30
%32 = inttoptr i64 %31 to i8*
%33 = getelementptr inbounds %struct.hostent, %struct.hostent* %25, i64 0, i32 0
%34 = load i32, i32* %33
%35 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 1
%36 = bitcast i32* %35 to i8*
%37 = tail call i32 @htons(i32 12345)
%38 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 0
store i32 %37, i32* %38
%39 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%40 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%41 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%42 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%43 = getelementptr inbounds i8*, i8** %1, i64 1
%44 = load i8*, i8** %43
%45 = getelementptr inbounds i8*, i8** %1, i64 2
%46 = load i8*, i8** %45
%47 = call i32 @sprintf(i8* %39, i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i8* %44, i8* %46)
%48 = load i8*, i8** %43
%49 = load i8*, i8** %45
%50 = call i32 @sprintf(i8* %40, i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i8* %48, i8* %49)
%51 = load i8*, i8** %43
%52 = load i8*, i8** %45
%53 = call i32 @sprintf(i8* %41, i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0), i8* %51, i8* %52)
%54 = load i8*, i8** %43
%55 = load i8*, i8** %45
%56 = call i32 @sprintf(i8* %42, i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i8* %54, i8* %55)
%57 = bitcast %struct.sockaddr_in* %4 to i64*
%58 = load i64, i64* %57
%59 = load i32, i32* %24
br label %60
60: ; preds = %29, %81
%61 = phi i1 [ true, %29 ], [ false, %81 ]
%62 = phi i32 [ undef, %29 ], [ %82, %81 ]
%63 = phi i32 [ 1, %29 ], [ %90, %81 ]
%64 = phi i32 [ 0, %29 ], [ %71, %81 ]
br label %65
65: ; preds = %97, %60
%66 = phi i1 [ %61, %60 ], [ true, %97 ]
%67 = phi i32 [ %63, %60 ], [ 1, %97 ]
%68 = phi i32 [ %64, %60 ], [ %71, %97 ]
%69 = call i32* @fopen(i8* %39, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%70 = call i32 @fread(i8* %9, i32 1, i64 4, i32* %69)
%71 = load i32, i32* %3
%72 = sub nsw i32 %71, %68
%73 = icmp sgt i32 %72, 4096
br i1 %73, label %74, label %77
74: ; preds = %65
%75 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.10, i64 0, i64 0))
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0), i32 %72)
br label %77
77: ; preds = %74, %65
%78 = and i32 %71, 8191
%79 = call i32 @fclose(i32* %69)
%80 = icmp eq i32 %67, 1
br i1 %80, label %81, label %91
81: ; preds = %77
%82 = select i1 %66, i32 %78, i32 %62
%83 = icmp ugt i32 %78, 4095
%84 = icmp slt i32 %82, 4096
%85 = select i1 %83, i1 true, i1 %84
%86 = icmp ult i32 %78, 4096
%87 = icmp sgt i32 %82, 4095
%88 = select i1 %86, i1 true, i1 %87
%89 = select i1 %88, i1 %85, i1 false
%90 = zext i1 %89 to i32
br label %60
91: ; preds = %77
%92 = icmp ult i32 %78, 4096
br i1 %92, label %93, label %98
93: ; preds = %91
%94 = call i32* @fopen(i8* %41, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%95 = call i32 @fileRead(i32* %94, i32 %18, i64 %58, i32 %59, i32 12, i8* %9, i8* %42)
%96 = call i32 @fclose(i32* %94)
br label %97
97: ; preds = %93, %98
br label %65
98: ; preds = %91
%99 = call i32* @fopen(i8* %40, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%100 = call i32 @fileRead(i32* %99, i32 %18, i64 %58, i32 %59, i32 12, i8* %9, i8* %42)
%101 = call i32 @fclose(i32* %99)
br label %97
}