#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
typedef int uint64_t;
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
struct hostent {
  int /*<<< orphan*/ h_length;
  scalar_t__ h_addr;
};
typedef int /*<<< orphan*/ serveraddr;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int ApplyIndexFunc(int, int);
int /*<<< orphan*/ SOCK_STREAM;
int StartEndpointSearch(int, int, int);
int /*<<< orphan*/ bcopy(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ bzero(char *, int);
scalar_t__ connect(int, struct sockaddr *, int);
int /*<<< orphan*/ error(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
struct hostent *gethostbyname(char *);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ load_idx();
int /*<<< orphan*/ printf(char *, int);
int read(int, int *, int);
int /*<<< orphan*/ sleep(int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strcpy(int *, char *);
int strlen(int *);
int write(int, ...);
void main(int argc, char **argv) {
  int sockfd, portno, n;
  struct sockaddr_in serveraddr;
  struct hostent *server;
  uint64_t buf[140000];
  sockfd = socket(AF_INET, SOCK_STREAM, 0);
  if (sockfd < 0)
    error("ERROR opening socket");
  server = gethostbyname("localhost");
  if (server == NULL) {
    fprintf(stderr, "ERROR, no such host as\n");
    exit(0);
  }
  bzero((char *)&serveraddr, sizeof(serveraddr));
  serveraddr.sin_family = AF_INET;
  bcopy((char *)server->h_addr, (char *)&serveraddr.sin_addr.s_addr,
        server->h_length);
  serveraddr.sin_port = htons(6666);
  if (connect(sockfd, (struct sockaddr *)&serveraddr, sizeof(serveraddr)) < 0)
    error("ERROR connecting");
  strcpy(buf, "getdps\n");
  n = write(sockfd, buf, strlen(buf));
  if (n < 0)
    error("ERROR writing to socket");
  for (int iter = 0; iter < 1000; iter++) {
    printf("DELTA: PASS: %i\n", iter);
    int tot = 0;
    while (tot < 130568) {
      n = read(sockfd, buf + tot / 8, 4096);
      tot += n;
      printf("rx tot=%i\n", tot);
      fflush(stdout);
    }
    if (iter == 0) {
      load_idx();
    }
    uint64_t bnum = buf[0];
    printf("bnum=%i\n", bnum);
    for (int tbl = 0; tbl < 40; tbl++) {
      for (int i = 1; i < 408; i++) {
        uint64_t sta = 0;
        uint64_t re = 0;
        int j = i + (tbl * 408);
        uint64_t tg = buf[j];
        re = StartEndpointSearch(tg, sta, tbl);
        if (re) {
          re = ApplyIndexFunc(re, 34);
        }
        buf[j] = re;
      }
    }
    n = write(sockfd, "retsta", 6);
    tot = 0;
    while (tot < 130568) {
      n = write(sockfd, buf + tot / 8, (130568 - tot));
      tot += n;
      printf("tx tot=%i\n", tot);
      fflush(stdout);
    }
    sleep(1);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x88bf0,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2d9f(%rip),%rax
mov    (%rax),%edi
mov    0x2d7e(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1150 <socket@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1274 <main+0x44>
lea    0xd91(%rip),%rdi
call   10f0 <error@plt>
lea    0xd9a(%rip),%rdi
call   10a0 <gethostbyname@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    12ab <main+0x7b>
mov    0x2d42(%rip),%rax
mov    (%rax),%edi
lea    0xd80(%rip),%rsi
call   10b0 <fprintf@plt>
xor    %edi,%edi
call   1120 <exit@plt>
lea    -0x28(%rbp),%rdi
mov    $0xc,%esi
call   1100 <bzero@plt>
mov    0x2d28(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x30(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x28(%rbp),%rsi
add    $0x4,%rsi
mov    -0x30(%rbp),%rax
mov    (%rax),%edx
call   10e0 <bcopy@plt>
mov    $0x1a0a,%edi
call   1070 <htons@plt>
mov    %eax,-0x28(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0xc,%edx
call   1130 <connect@plt>
cmp    $0x0,%rax
jge    1314 <main+0xe4>
lea    0xd28(%rip),%rdi
call   10f0 <error@plt>
lea    -0x88bb0(%rbp),%rdi
lea    0xd26(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x88be4(%rbp)
lea    -0x88bb0(%rbp),%rax
mov    %rax,-0x88be0(%rbp)
lea    -0x88bb0(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x88be4(%rbp),%edi
mov    -0x88be0(%rbp),%rsi
mov    %eax,%edx
mov    $0x0,%al
call   1040 <write@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    1379 <main+0x149>
lea    0xcdc(%rip),%rdi
call   10f0 <error@plt>
movl   $0x0,-0x88bb4(%rbp)
cmpl   $0x3e8,-0x88bb4(%rbp)
jge    1600 <main+0x3d0>
mov    -0x88bb4(%rbp),%esi
lea    0xcc8(%rip),%rdi
call   1080 <printf@plt>
movl   $0x0,-0x88bb8(%rbp)
cmpl   $0x1fe08,-0x88bb8(%rbp)
jge    1421 <main+0x1f1>
mov    -0x14(%rbp),%edi
lea    -0x88bb0(%rbp),%rsi
mov    -0x88bb8(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cltq
shl    $0x2,%rax
add    %rax,%rsi
mov    $0x1000,%edx
call   1090 <read@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    -0x88bb8(%rbp),%eax
mov    %eax,-0x88bb8(%rbp)
mov    -0x88bb8(%rbp),%esi
lea    0xc70(%rip),%rdi
call   1080 <printf@plt>
mov    0x2bb3(%rip),%rax
mov    (%rax),%edi
call   10d0 <fflush@plt>
jmp    13af <main+0x17f>
cmpl   $0x0,-0x88bb4(%rbp)
jne    1435 <main+0x205>
mov    $0x0,%al
call   1110 <load_idx@plt>
mov    -0x88bb0(%rbp),%eax
mov    %eax,-0x88bbc(%rbp)
mov    -0x88bbc(%rbp),%esi
lea    0xc36(%rip),%rdi
call   1080 <printf@plt>
movl   $0x0,-0x88bc0(%rbp)
cmpl   $0x28,-0x88bc0(%rbp)
jge    1545 <main+0x315>
movl   $0x1,-0x88bc4(%rbp)
cmpl   $0x198,-0x88bc4(%rbp)
jge    152c <main+0x2fc>
movl   $0x0,-0x88bc8(%rbp)
movl   $0x0,-0x88bcc(%rbp)
mov    -0x88bc4(%rbp),%eax
imul   $0x198,-0x88bc0(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x88bd0(%rbp)
movslq -0x88bd0(%rbp),%rax
mov    -0x88bb0(%rbp,%rax,4),%eax
mov    %eax,-0x88bd4(%rbp)
mov    -0x88bd4(%rbp),%edi
mov    -0x88bc8(%rbp),%esi
mov    -0x88bc0(%rbp),%edx
call   10c0 <StartEndpointSearch@plt>
mov    %eax,-0x88bcc(%rbp)
cmpl   $0x0,-0x88bcc(%rbp)
je     1504 <main+0x2d4>
mov    -0x88bcc(%rbp),%edi
mov    $0x22,%esi
call   1050 <ApplyIndexFunc@plt>
mov    %eax,-0x88bcc(%rbp)
mov    -0x88bcc(%rbp),%ecx
movslq -0x88bd0(%rbp),%rax
mov    %ecx,-0x88bb0(%rbp,%rax,4)
mov    -0x88bc4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88bc4(%rbp)
jmp    1474 <main+0x244>
jmp    1531 <main+0x301>
mov    -0x88bc0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88bc0(%rbp)
jmp    145d <main+0x22d>
mov    -0x14(%rbp),%edi
lea    0xb3e(%rip),%rsi
mov    $0x6,%edx
mov    $0x0,%al
call   1040 <write@plt>
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x88bb8(%rbp)
cmpl   $0x1fe08,-0x88bb8(%rbp)
jge    15e2 <main+0x3b2>
mov    -0x14(%rbp),%edi
lea    -0x88bb0(%rbp),%rsi
mov    -0x88bb8(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cltq
shl    $0x2,%rax
add    %rax,%rsi
mov    $0x1fe08,%edx
sub    -0x88bb8(%rbp),%edx
mov    $0x0,%al
call   1040 <write@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    -0x88bb8(%rbp),%eax
mov    %eax,-0x88bb8(%rbp)
mov    -0x88bb8(%rbp),%esi
lea    0xaca(%rip),%rdi
call   1080 <printf@plt>
mov    0x29f2(%rip),%rax
mov    (%rax),%edi
call   10d0 <fflush@plt>
jmp    1568 <main+0x338>
mov    $0x1,%edi
call   1140 <sleep@plt>
mov    -0x88bb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88bb4(%rbp)
jmp    1383 <main+0x153>
add    $0x88bf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88ba8,%rsp
mov    0x2da0(%rip),%rbx
mov    (%rbx),%edi
mov    0x2d7f(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1150 <socket@plt>
mov    %eax,%r15d
test   %eax,%eax
jns    126d <main+0x3d>
lea    0xd98(%rip),%rdi
call   10f0 <error@plt>
lea    0xda1(%rip),%rdi
call   10a0 <gethostbyname@plt>
test   %rax,%rax
je     14d0 <main+0x2a0>
mov    %rax,%rbp
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    $0xc,%esi
call   1100 <bzero@plt>
mov    (%rbx),%eax
mov    %eax,0x18(%rsp)
mov    0x8(%rbp),%rsi
lea    0x14(%rsp),%rdi
mov    0x0(%rbp),%edx
call   10e0 <memmove@plt>
mov    $0x1a0a,%edi
call   1070 <htons@plt>
mov    %eax,0x10(%rsp)
mov    %r15d,%edi
mov    %r14,%rsi
mov    $0xc,%edx
call   1130 <connect@plt>
test   %rax,%rax
jns    12dd <main+0xad>
lea    0xd5f(%rip),%rdi
call   10f0 <error@plt>
lea    0xd64(%rip),%rsi
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <write@plt>
test   %eax,%eax
jns    1318 <main+0xe8>
lea    0xd3d(%rip),%rdi
call   10f0 <error@plt>
lea    0xd5a(%rip),%r14
mov    0x2ca2(%rip),%r12
xor    %r13d,%r13d
nopl   0x0(%rax)
lea    0xd31(%rip),%rdi
mov    %r13d,%esi
call   1080 <printf@plt>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0x7(%rbx),%eax
test   %ebx,%ebx
cmovns %ebx,%eax
sar    $0x3,%eax
cltq
lea    (%rsp,%rax,4),%rsi
add    $0x20,%rsi
mov    %r15d,%edi
mov    $0x1000,%edx
call   1090 <read@plt>
mov    %eax,%ebp
add    %ebx,%ebp
mov    %r14,%rdi
mov    %ebp,%esi
call   1080 <printf@plt>
mov    (%r12),%edi
call   10d0 <fflush@plt>
mov    %ebp,%ebx
cmp    $0x1fe08,%ebp
jl     1350 <main+0x120>
mov    %r13d,0xc(%rsp)
test   %r13d,%r13d
jne    13a4 <main+0x174>
xor    %eax,%eax
call   1110 <load_idx@plt>
mov    0x20(%rsp),%esi
lea    0xcd5(%rip),%rdi
call   1080 <printf@plt>
lea    0x20(%rsp),%r12
xor    %r13d,%r13d
jmp    13d1 <main+0x1a1>
xchg   %ax,%ax
add    $0x1,%r13
add    $0x660,%r12
cmp    $0x28,%r13
je     1420 <main+0x1f0>
mov    $0x1,%r14d
jmp    13f1 <main+0x1c1>
nopl   0x0(%rax)
mov    %ebp,(%r12,%r14,4)
add    $0x1,%r14
cmp    $0x198,%r14
je     13c0 <main+0x190>
mov    (%r12,%r14,4),%edi
xor    %ebp,%ebp
xor    %esi,%esi
mov    %r13d,%edx
call   10c0 <StartEndpointSearch@plt>
test   %eax,%eax
je     13e0 <main+0x1b0>
mov    %eax,%edi
mov    $0x22,%esi
call   1050 <ApplyIndexFunc@plt>
mov    %eax,%ebp
jmp    13e0 <main+0x1b0>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %ebx,%ebx
mov    %r15d,%edi
lea    0xc61(%rip),%rsi
mov    $0x6,%edx
xor    %eax,%eax
call   1040 <write@plt>
mov    0x2b89(%rip),%r12
lea    0xc4e(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
lea    0x7(%rbx),%eax
test   %ebx,%ebx
cmovns %ebx,%eax
sar    $0x3,%eax
cltq
lea    (%rsp,%rax,4),%rsi
add    $0x20,%rsi
mov    $0x1fe08,%edx
sub    %ebx,%edx
mov    %r15d,%edi
xor    %eax,%eax
call   1040 <write@plt>
mov    %eax,%ebp
add    %ebx,%ebp
mov    %r14,%rdi
mov    %ebp,%esi
call   1080 <printf@plt>
mov    (%r12),%edi
call   10d0 <fflush@plt>
mov    %ebp,%ebx
cmp    $0x1fe08,%ebp
jl     1450 <main+0x220>
mov    $0x1,%edi
call   1140 <sleep@plt>
mov    0xc(%rsp),%r13d
add    $0x1,%r13d
cmp    $0x3e8,%r13d
lea    0xbc1(%rip),%r14
jne    1330 <main+0x100>
add    $0x88ba8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2b01(%rip),%rax
mov    (%rax),%edi
lea    0xb3f(%rip),%rsi
call   10b0 <fprintf@plt>
xor    %edi,%edi
call   1120 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.hostent = type { i32, i64 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [21 x i8] c"ERROR opening socket\00"
@.str.1 = [10 x i8] c"localhost\00"
@stderr = global i32 0
@.str.2 = [24 x i8] c"ERROR, no such host as\0A\00"
@.str.3 = [17 x i8] c"ERROR connecting\00"
@.str.4 = [8 x i8] c"getdps\0A\00"
@.str.5 = [24 x i8] c"ERROR writing to socket\00"
@.str.6 = [17 x i8] c"DELTA: PASS: %i\0A\00"
@.str.7 = [11 x i8] c"rx tot=%i\0A\00"
@stdout = global i32 0
@.str.8 = [9 x i8] c"bnum=%i\0A\00"
@.str.9 = [7 x i8] c"retsta\00"
@.str.10 = [11 x i8] c"tx tot=%i\0A\00"
define void @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.sockaddr_in
%9 = alloca %struct.hostent*
%10 = alloca [140000 x 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
store i32 %0, i32* %3
store i8** %1, i8*** %4
%20 = load i32, i32* @AF_INET
%21 = load i32, i32* @SOCK_STREAM
%22 = call i32 @socket(i32 %20, i32 %21, i32 0)
store i32 %22, i32* %5
%23 = load i32, i32* %5
%24 = icmp slt i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %2
%26 = call i32 @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %27
27: ; preds = %25, %2
%28 = call %struct.hostent* @gethostbyname(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
store %struct.hostent* %28, %struct.hostent** %9
%29 = load %struct.hostent*, %struct.hostent** %9
%30 = icmp eq %struct.hostent* %29, null
br i1 %30, label %31, label %35
31: ; preds = %27
%32 = load i32, i32* @stderr
%33 = call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%34 = call i32 @exit(i32 0)
unreachable
35: ; preds = %27
%36 = bitcast %struct.sockaddr_in* %8 to i8*
%37 = call i32 @bzero(i8* %36, i32 12)
%38 = load i32, i32* @AF_INET
%39 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 2
store i32 %38, i32* %39
%40 = load %struct.hostent*, %struct.hostent** %9
%41 = getelementptr inbounds %struct.hostent, %struct.hostent* %40, i32 0, i32 1
%42 = load i64, i64* %41
%43 = inttoptr i64 %42 to i8*
%44 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 1
%45 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %44, i32 0, i32 0
%46 = bitcast i32* %45 to i8*
%47 = load %struct.hostent*, %struct.hostent** %9
%48 = getelementptr inbounds %struct.hostent, %struct.hostent* %47, i32 0, i32 0
%49 = load i32, i32* %48
%50 = call i32 @bcopy(i8* %43, i8* %46, i32 %49)
%51 = call i32 @htons(i32 6666)
%52 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 0
store i32 %51, i32* %52
%53 = load i32, i32* %5
%54 = bitcast %struct.sockaddr_in* %8 to %struct.sockaddr*
%55 = call i64 @connect(i32 %53, %struct.sockaddr* %54, i32 12)
%56 = icmp slt i64 %55, 0
br i1 %56, label %57, label %59
57: ; preds = %35
%58 = call i32 @error(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
br label %59
59: ; preds = %57, %35
%60 = getelementptr inbounds [140000 x i32], [140000 x i32]* %10, i64 0, i64 0
%61 = call i32 @strcpy(i32* %60, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%62 = load i32, i32* %5
%63 = getelementptr inbounds [140000 x i32], [140000 x i32]* %10, i64 0, i64 0
%64 = getelementptr inbounds [140000 x i32], [140000 x i32]* %10, i64 0, i64 0
%65 = call i32 @strlen(i32* %64)
%66 = call i32 (i32, ...) @write(i32 %62, i32* %63, i32 %65)
store i32 %66, i32* %7
%67 = load i32, i32* %7
%68 = icmp slt i32 %67, 0
br i1 %68, label %69, label %71
69: ; preds = %59
%70 = call i32 @error(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
br label %71
71: ; preds = %69, %59
store i32 0, i32* %11
br label %72
72: ; preds = %168, %71
%73 = load i32, i32* %11
%74 = icmp slt i32 %73, 1000
br i1 %74, label %75, label %171
75: ; preds = %72
%76 = load i32, i32* %11
%77 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), i32 %76)
store i32 0, i32* %12
br label %78
78: ; preds = %81, %75
%79 = load i32, i32* %12
%80 = icmp slt i32 %79, 130568
br i1 %80, label %81, label %96
81: ; preds = %78
%82 = load i32, i32* %5
%83 = getelementptr inbounds [140000 x i32], [140000 x i32]* %10, i64 0, i64 0
%84 = load i32, i32* %12
%85 = sdiv i32 %84, 8
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds i32, i32* %83, i64 %86
%88 = call i32 @read(i32 %82, i32* %87, i32 4096)
store i32 %88, i32* %7
%89 = load i32, i32* %7
%90 = load i32, i32* %12
%91 = add nsw i32 %90, %89
store i32 %91, i32* %12
%92 = load i32, i32* %12
%93 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i32 %92)
%94 = load i32, i32* @stdout
%95 = call i32 @fflush(i32 %94)
br label %78
96: ; preds = %78
%97 = load i32, i32* %11
%98 = icmp eq i32 %97, 0
br i1 %98, label %99, label %101
99: ; preds = %96
%100 = call i32 (...) @load_idx()
br label %101
101: ; preds = %99, %96
%102 = getelementptr inbounds [140000 x i32], [140000 x i32]* %10, i64 0, i64 0
%103 = load i32, i32* %102
store i32 %103, i32* %13
%104 = load i32, i32* %13
%105 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), i32 %104)
store i32 0, i32* %14
br label %106
106: ; preds = %140, %101
%107 = load i32, i32* %14
%108 = icmp slt i32 %107, 40
br i1 %108, label %109, label %143
109: ; preds = %106
store i32 1, i32* %15
br label %110
110: ; preds = %136, %109
%111 = load i32, i32* %15
%112 = icmp slt i32 %111, 408
br i1 %112, label %113, label %139
113: ; preds = %110
store i32 0, i32* %16
store i32 0, i32* %17
%114 = load i32, i32* %15
%115 = load i32, i32* %14
%116 = mul nsw i32 %115, 408
%117 = add nsw i32 %114, %116
store i32 %117, i32* %18
%118 = load i32, i32* %18
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds [140000 x i32], [140000 x i32]* %10, i64 0, i64 %119
%121 = load i32, i32* %120
store i32 %121, i32* %19
%122 = load i32, i32* %19
%123 = load i32, i32* %16
%124 = load i32, i32* %14
%125 = call i32 @StartEndpointSearch(i32 %122, i32 %123, i32 %124)
store i32 %125, i32* %17
%126 = load i32, i32* %17
%127 = icmp ne i32 %126, 0
br i1 %127, label %128, label %131
128: ; preds = %113
%129 = load i32, i32* %17
%130 = call i32 @ApplyIndexFunc(i32 %129, i32 34)
store i32 %130, i32* %17
br label %131
131: ; preds = %128, %113
%132 = load i32, i32* %17
%133 = load i32, i32* %18
%134 = sext i32 %133 to i64
%135 = getelementptr inbounds [140000 x i32], [140000 x i32]* %10, i64 0, i64 %134
store i32 %132, i32* %135
br label %136
136: ; preds = %131
%137 = load i32, i32* %15
%138 = add nsw i32 %137, 1
store i32 %138, i32* %15
br label %110
139: ; preds = %110
br label %140
140: ; preds = %139
%141 = load i32, i32* %14
%142 = add nsw i32 %141, 1
store i32 %142, i32* %14
br label %106
143: ; preds = %106
%144 = load i32, i32* %5
%145 = call i32 (i32, ...) @write(i32 %144, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i32 6)
store i32 %145, i32* %7
store i32 0, i32* %12
br label %146
146: ; preds = %149, %143
%147 = load i32, i32* %12
%148 = icmp slt i32 %147, 130568
br i1 %148, label %149, label %166
149: ; preds = %146
%150 = load i32, i32* %5
%151 = getelementptr inbounds [140000 x i32], [140000 x i32]* %10, i64 0, i64 0
%152 = load i32, i32* %12
%153 = sdiv i32 %152, 8
%154 = sext i32 %153 to i64
%155 = getelementptr inbounds i32, i32* %151, i64 %154
%156 = load i32, i32* %12
%157 = sub nsw i32 130568, %156
%158 = call i32 (i32, ...) @write(i32 %150, i32* %155, i32 %157)
store i32 %158, i32* %7
%159 = load i32, i32* %7
%160 = load i32, i32* %12
%161 = add nsw i32 %160, %159
store i32 %161, i32* %12
%162 = load i32, i32* %12
%163 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i32 %162)
%164 = load i32, i32* @stdout
%165 = call i32 @fflush(i32 %164)
br label %146
166: ; preds = %146
%167 = call i32 @sleep(i32 1)
br label %168
168: ; preds = %166
%169 = load i32, i32* %11
%170 = add nsw i32 %169, 1
store i32 %170, i32* %11
br label %72
171: ; preds = %72
ret void
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.hostent = type { i32, i64 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [21 x i8] c"ERROR opening socket\00"
@.str.1 = [10 x i8] c"localhost\00"
@stderr = global i32 0
@.str.2 = [24 x i8] c"ERROR, no such host as\0A\00"
@.str.3 = [17 x i8] c"ERROR connecting\00"
@.str.4 = [8 x i8] c"getdps\0A\00"
@.str.5 = [24 x i8] c"ERROR writing to socket\00"
@.str.6 = [17 x i8] c"DELTA: PASS: %i\0A\00"
@.str.7 = [11 x i8] c"rx tot=%i\0A\00"
@stdout = global i32 0
@.str.8 = [9 x i8] c"bnum=%i\0A\00"
@.str.9 = [7 x i8] c"retsta\00"
@.str.10 = [11 x i8] c"tx tot=%i\0A\00"
define void @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca [140000 x i32]
%5 = bitcast %struct.sockaddr_in* %3 to i8*
%6 = bitcast [140000 x i32]* %4 to i8*
%7 = load i32, i32* @AF_INET
%8 = load i32, i32* @SOCK_STREAM
%9 = tail call i32 @socket(i32 %7, i32 %8, i32 0)
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = tail call i32 @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %2
%14 = tail call %struct.hostent* @gethostbyname(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq %struct.hostent* %14, null
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = load i32, i32* @stderr
%18 = tail call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%19 = tail call i32 @exit(i32 0)
unreachable
20: ; preds = %13
%21 = call i32 @bzero(i8* %5, i32 12)
%22 = load i32, i32* @AF_INET
%23 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %22, i32* %23
%24 = getelementptr inbounds %struct.hostent, %struct.hostent* %14, i64 0, i32 1
%25 = load i64, i64* %24
%26 = inttoptr i64 %25 to i8*
%27 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1, i32 0
%28 = bitcast i32* %27 to i8*
%29 = getelementptr inbounds %struct.hostent, %struct.hostent* %14, i64 0, i32 0
%30 = load i32, i32* %29
%31 = tail call i32 @htons(i32 6666)
%32 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
store i32 %31, i32* %32
%33 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%34 = call i64 @connect(i32 %9, %struct.sockaddr* %33, i32 12)
%35 = icmp slt i64 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %20
%37 = call i32 @error(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
br label %38
38: ; preds = %36, %20
%39 = getelementptr inbounds [140000 x i32], [140000 x i32]* %4, i64 0, i64 0
%40 = call i32 @strcpy(i32* %39, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%41 = call i32 @strlen(i32* %39)
%42 = call i32 (i32, ...) @write(i32 %9, i32* %39, i32 %41)
%43 = icmp slt i32 %42, 0
br i1 %43, label %45, label %44
44: ; preds = %45, %38
br label %48
45: ; preds = %38
%46 = call i32 @error(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
br label %44
47: ; preds = %103
ret void
48: ; preds = %44, %103
%49 = phi i32 [ %105, %103 ], [ 0, %44 ]
%50 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), i32 %49)
br label %51
51: ; preds = %48, %51
%52 = phi i32 [ 0, %48 ], [ %57, %51 ]
%53 = sdiv i32 %52, 8
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [140000 x i32], [140000 x i32]* %4, i64 0, i64 %54
%56 = call i32 @read(i32 %9, i32* %55, i32 4096)
%57 = add nsw i32 %56, %52
%58 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i32 %57)
%59 = load i32, i32* @stdout
%60 = call i32 @fflush(i32 %59)
%61 = icmp slt i32 %57, 130568
br i1 %61, label %51, label %62
62: ; preds = %51
%63 = icmp eq i32 %49, 0
br i1 %63, label %64, label %66
64: ; preds = %62
%65 = call i32 (...) @load_idx()
br label %66
66: ; preds = %64, %62
%67 = load i32, i32* %39
%68 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), i32 %67)
br label %69
69: ; preds = %66, %75
%70 = phi i64 [ 0, %66 ], [ %76, %75 ]
%71 = mul nuw nsw i64 %70, 408
%72 = trunc i64 %70 to i32
br label %78
73: ; preds = %75
%74 = call i32 (i32, ...) @write(i32 %9, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i32 6)
br label %91
75: ; preds = %87
%76 = add nuw nsw i64 %70, 1
%77 = icmp eq i64 %76, 40
br i1 %77, label %73, label %69
78: ; preds = %69, %87
%79 = phi i64 [ 1, %69 ], [ %89, %87 ]
%80 = add nuw nsw i64 %79, %71
%81 = getelementptr inbounds [140000 x i32], [140000 x i32]* %4, i64 0, i64 %80
%82 = load i32, i32* %81
%83 = call i32 @StartEndpointSearch(i32 %82, i32 0, i32 %72)
%84 = icmp eq i32 %83, 0
br i1 %84, label %87, label %85
85: ; preds = %78
%86 = call i32 @ApplyIndexFunc(i32 %83, i32 34)
br label %87
87: ; preds = %85, %78
%88 = phi i32 [ %86, %85 ], [ 0, %78 ]
store i32 %88, i32* %81
%89 = add nuw nsw i64 %79, 1
%90 = icmp eq i64 %89, 408
br i1 %90, label %75, label %78
91: ; preds = %73, %91
%92 = phi i32 [ 0, %73 ], [ %98, %91 ]
%93 = sdiv i32 %92, 8
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds [140000 x i32], [140000 x i32]* %4, i64 0, i64 %94
%96 = sub nsw i32 130568, %92
%97 = call i32 (i32, ...) @write(i32 %9, i32* %95, i32 %96)
%98 = add nsw i32 %97, %92
%99 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), i32 %98)
%100 = load i32, i32* @stdout
%101 = call i32 @fflush(i32 %100)
%102 = icmp slt i32 %98, 130568
br i1 %102, label %91, label %103
103: ; preds = %91
%104 = call i32 @sleep(i32 1)
%105 = add nuw nsw i32 %49, 1
%106 = icmp eq i32 %105, 1000
br i1 %106, label %47, label %48
}