#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 */
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
  TYPE_1__ sin_addr;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ server;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int atoi(char *);
scalar_t__ connect(int, struct sockaddr *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int getpid();
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ inet_addr(char *);
int /*<<< orphan*/ isdigit(char);
int /*<<< orphan*/ printf(char *, char *, ...);
int recv(int, int *, int, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int strlen(char *);
int main(int argc, char **argv) {
  if (argc != 3) {
    printf("Usage: %s [ port # ] [ # ].\n", argv[0]);
    return (-1);
  }
  int pid = getpid();
  printf("%s process [%d]: starting.\n", argv[0], pid);
  for (int i = 1; i < 3; ++i) {
    int str_size = strlen(argv[i]);
    for (int o = 0; o < str_size; ++o) {
      if (!(isdigit(argv[i][o]))) {
        fprintf(stderr, "%s process [%d]: %s is not a valid input.\n", argv[0],
                pid, argv[i]);
        return (2);
      }
    }
  }
  int nbytes = 0;
  int port_v = atoi(argv[1]);
  int buf = -1;
  int sock = socket(AF_INET, SOCK_STREAM, 0);
  struct sockaddr_in server;
  if (port_v < 100 || port_v > 65000) {
    fprintf(stderr, "error: invalid port.\n");
    exit(1);
  }
  server.sin_addr.s_addr = inet_addr("127.0.0.1");
  server.sin_family = AF_INET;
  server.sin_port = htons(port_v);
  printf("%s process [%d]: connecting to %s on port %d\n", argv[0], pid,
         "127.0.0.1", port_v);
  if (connect(sock, (struct sockaddr *)&server, sizeof(server)) < 0) {
    fprintf(stderr, "error: connect failed\n");
    return 2;
  }
  nbytes = recv(sock, &buf, sizeof(int), 0);
  if (nbytes < 0) {
    fprintf(stderr, "error: recv failed.\n");
    return 2;
  }
  printf("%s process [%d]: read %d bytes containing value: %d\n", argv[0], pid,
         nbytes, buf);
  int one = atoi(argv[2]);
  int result = ((one * buf) & 1);
  if (result) {
    printf("%s process [%d]: %d *IS NOT* even.\n", argv[0], pid, one * buf);
  } else {
    printf("%s process [%d]: %d *IS* even.\n", argv[0], pid, one * buf);
  }
  printf("%s: exiting.\n", argv[0]);
  return (result);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1201 <main+0x41>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe12(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14bc <main+0x2fc>
mov    $0x0,%al
call   1050 <getpid@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    -0x14(%rbp),%edx
lea    0xe01(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movl   $0x1,-0x18(%rbp)
cmpl   $0x3,-0x18(%rbp)
jge    12dc <main+0x11c>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    12c9 <main+0x109>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <isdigit@plt>
cmp    $0x0,%eax
jne    12b6 <main+0xf6>
mov    0x2d54(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rsi
mov    (%rax,%rsi,8),%r8
lea    0xd96(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
movl   $0x2,-0x4(%rbp)
jmp    14bc <main+0x2fc>
jmp    12bb <main+0xfb>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    124f <main+0x8f>
jmp    12ce <main+0x10e>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    122a <main+0x6a>
movl   $0x0,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0x28(%rbp)
movl   $0xffffffff,-0x2c(%rbp)
mov    0x2ce7(%rip),%rax
mov    (%rax),%edi
mov    0x2cc6(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10e0 <socket@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x64,-0x28(%rbp)
jl     132d <main+0x16d>
cmpl   $0xfde8,-0x28(%rbp)
jle    134e <main+0x18e>
mov    0x2ca4(%rip),%rax
mov    (%rax),%edi
lea    0xd27(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
lea    0xd25(%rip),%rdi
call   1090 <inet_addr@plt>
mov    %eax,-0x38(%rbp)
mov    0x2c84(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x28(%rbp),%edi
call   1070 <htons@plt>
mov    %eax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    -0x14(%rbp),%edx
mov    -0x28(%rbp),%r8d
lea    0xcfb(%rip),%rdi
lea    0xcea(%rip),%rcx
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x30(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    $0xc,%edx
call   10d0 <connect@plt>
cmp    $0x0,%rax
jge    13d5 <main+0x215>
mov    0x2c1f(%rip),%rax
mov    (%rax),%edi
lea    0xcf0(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
movl   $0x2,-0x4(%rbp)
jmp    14bc <main+0x2fc>
mov    -0x30(%rbp),%edi
lea    -0x2c(%rbp),%rsi
mov    $0x4,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    1418 <main+0x258>
mov    0x2bdc(%rip),%rax
mov    (%rax),%edi
lea    0xcc4(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
movl   $0x2,-0x4(%rbp)
jmp    14bc <main+0x2fc>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    -0x14(%rbp),%edx
mov    -0x24(%rbp),%ecx
mov    -0x2c(%rbp),%r8d
lea    0xcae(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
imul   -0x2c(%rbp),%eax
and    $0x1,%eax
mov    %eax,-0x48(%rbp)
cmpl   $0x0,-0x48(%rbp)
je     1482 <main+0x2c2>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    -0x14(%rbp),%edx
mov    -0x44(%rbp),%ecx
imul   -0x2c(%rbp),%ecx
lea    0xc9d(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
jmp    14a1 <main+0x2e1>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    -0x14(%rbp),%edx
mov    -0x44(%rbp),%ecx
imul   -0x2c(%rbp),%ecx
lea    0xc9d(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xca8(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x48(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r13
cmp    $0x3,%edi
jne    1388 <main+0x1c8>
xor    %eax,%eax
call   1050 <getpid@plt>
mov    %eax,%r14d
mov    0x0(%r13),%rsi
lea    0xe2e(%rip),%rdi
mov    %eax,%edx
xor    %eax,%eax
call   1080 <printf@plt>
lea    0x8(%r13),%r15
mov    0x8(%r13),%rdi
call   1060 <strlen@plt>
test   %eax,%eax
jle    122d <main+0x6d>
mov    %eax,%ebp
xor    %ebx,%ebx
nopl   (%rax)
mov    (%r15),%rax
movsbl (%rax,%rbx,1),%edi
call   1040 <isdigit@plt>
test   %eax,%eax
je     13a4 <main+0x1e4>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1210 <main+0x50>
mov    0x10(%r13),%rdi
call   1060 <strlen@plt>
test   %eax,%eax
jle    126e <main+0xae>
lea    0x10(%r13),%rbp
mov    %eax,%r12d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x0(%rbp),%rax
movsbl (%rax,%rbx,1),%edi
call   1040 <isdigit@plt>
test   %eax,%eax
je     13a1 <main+0x1e1>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1250 <main+0x90>
mov    (%r15),%rdi
call   10b0 <atoi@plt>
mov    %eax,%ebp
movl   $0xffffffff,0x4(%rsp)
ff
mov    0x2d61(%rip),%rbx
mov    (%rbx),%edi
mov    0x2d40(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10e0 <socket@plt>
mov    %eax,%r15d
lea    -0xfde9(%rbp),%eax
cmp    $0xffff027b,%eax
jb     1406 <main+0x246>
lea    0xdc6(%rip),%r12
mov    %r12,%rdi
call   1090 <inet_addr@plt>
mov    %eax,0x10(%rsp)
mov    (%rbx),%eax
mov    %eax,0xc(%rsp)
mov    %ebp,%edi
call   1070 <htons@plt>
mov    %eax,0x8(%rsp)
mov    0x0(%r13),%rsi
lea    0xda8(%rip),%rdi
mov    %r14d,%edx
mov    %r12,%rcx
mov    %ebp,%r8d
xor    %eax,%eax
call   1080 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %r15d,%edi
mov    $0xc,%edx
call   10d0 <connect@plt>
test   %rax,%rax
js     13c7 <main+0x207>
lea    0x4(%rsp),%rsi
mov    %r15d,%edi
mov    $0x4,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
test   %eax,%eax
js     13d9 <main+0x219>
mov    0x0(%r13),%rsi
mov    0x4(%rsp),%r8d
lea    0xdab(%rip),%rdi
mov    %r14d,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x10(%r13),%rdi
call   10b0 <atoi@plt>
imul   0x4(%rsp),%eax
mov    %eax,%ebp
and    $0x1,%ebp
mov    0x0(%r13),%rsi
lea    0xdda(%rip),%rcx
lea    0xdaf(%rip),%rdi
cmove  %rcx,%rdi
mov    %r14d,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x0(%r13),%rsi
lea    0xdd8(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
jmp    13f5 <main+0x235>
mov    0x0(%r13),%rsi
lea    0xc6d(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0xffffffff,%ebp
jmp    13f5 <main+0x235>
mov    %rbp,%r15
mov    0x2c2d(%rip),%rax
mov    (%rax),%edi
mov    0x0(%r13),%rdx
mov    (%r15),%r8
lea    0xc7e(%rip),%rsi
mov    %r14d,%ecx
xor    %eax,%eax
call   10a0 <fprintf@plt>
jmp    13f0 <main+0x230>
mov    0x2c0a(%rip),%rax
mov    (%rax),%edi
lea    0xcdb(%rip),%rsi
jmp    13e9 <main+0x229>
mov    0x2bf8(%rip),%rax
mov    (%rax),%edi
lea    0xce0(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x2,%ebp
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2bcb(%rip),%rax
mov    (%rax),%edi
lea    0xc4e(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, i32, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [29 x i8] c"Usage: %s [ port # ] [ # ].\0A\00"
@.str.1 = [28 x i8] c"%s process [%d]: starting.\0A\00"
@stderr = global i32 0
@.str.2 = [43 x i8] c"%s process [%d]: %s is not a valid input.\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.3 = [22 x i8] c"error: invalid port.\0A\00"
@.str.4 = [10 x i8] c"127.0.0.1\00"
@.str.5 = [46 x i8] c"%s process [%d]: connecting to %s on port %d\0A\00"
@.str.6 = [23 x i8] c"error: connect failed\0A\00"
@.str.7 = [21 x i8] c"error: recv failed.\0A\00"
@.str.8 = [53 x i8] c"%s process [%d]: read %d bytes containing value: %d\0A\00"
@.str.9 = [36 x i8] c"%s process [%d]: %d *IS NOT* even.\0A\00"
@.str.10 = [32 x i8] c"%s process [%d]: %d *IS* even.\0A\00"
@.str.11 = [14 x i8] c"%s: exiting.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca %struct.sockaddr_in
%15 = alloca i32
%16 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = load i32, i32* %4
%18 = icmp ne i32 %17, 3
br i1 %18, label %19, label %24
19: ; preds = %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 0
%22 = load i8*, i8** %21
%23 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %22)
store i32 -1, i32* %3
br label %166
24: ; preds = %2
%25 = call i32 (...) @getpid()
store i32 %25, i32* %6
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 0
%28 = load i8*, i8** %27
%29 = load i32, i32* %6
%30 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %28, i32 %29)
store i32 1, i32* %7
br label %31
31: ; preds = %74, %24
%32 = load i32, i32* %7
%33 = icmp slt i32 %32, 3
br i1 %33, label %34, label %77
34: ; preds = %31
%35 = load i8**, i8*** %5
%36 = load i32, i32* %7
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8*, i8** %35, i64 %37
%39 = load i8*, i8** %38
%40 = call i32 @strlen(i8* %39)
store i32 %40, i32* %8
store i32 0, i32* %9
br label %41
41: ; preds = %70, %34
%42 = load i32, i32* %9
%43 = load i32, i32* %8
%44 = icmp slt i32 %42, %43
br i1 %44, label %45, label %73
45: ; preds = %41
%46 = load i8**, i8*** %5
%47 = load i32, i32* %7
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8*, i8** %46, i64 %48
%50 = load i8*, i8** %49
%51 = load i32, i32* %9
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i8, i8* %50, i64 %52
%54 = load i8, i8* %53
%55 = call i32 @isdigit(i8 signext %54)
%56 = icmp ne i32 %55, 0
br i1 %56, label %69, label %57
57: ; preds = %45
%58 = load i32, i32* @stderr
%59 = load i8**, i8*** %5
%60 = getelementptr inbounds i8*, i8** %59, i64 0
%61 = load i8*, i8** %60
%62 = load i32, i32* %6
%63 = load i8**, i8*** %5
%64 = load i32, i32* %7
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i8*, i8** %63, i64 %65
%67 = load i8*, i8** %66
%68 = call i32 (i32, i8*, ...) @fprintf(i32 %58, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0), i8* %61, i32 %62, i8* %67)
store i32 2, i32* %3
br label %166
69: ; preds = %45
br label %70
70: ; preds = %69
%71 = load i32, i32* %9
%72 = add nsw i32 %71, 1
store i32 %72, i32* %9
br label %41
73: ; preds = %41
br label %74
74: ; preds = %73
%75 = load i32, i32* %7
%76 = add nsw i32 %75, 1
store i32 %76, i32* %7
br label %31
77: ; preds = %31
store i32 0, i32* %10
%78 = load i8**, i8*** %5
%79 = getelementptr inbounds i8*, i8** %78, i64 1
%80 = load i8*, i8** %79
%81 = call i32 @atoi(i8* %80)
store i32 %81, i32* %11
store i32 -1, i32* %12
%82 = load i32, i32* @AF_INET
%83 = load i32, i32* @SOCK_STREAM
%84 = call i32 @socket(i32 %82, i32 %83, i32 0)
store i32 %84, i32* %13
%85 = load i32, i32* %11
%86 = icmp slt i32 %85, 100
br i1 %86, label %90, label %87
87: ; preds = %77
%88 = load i32, i32* %11
%89 = icmp sgt i32 %88, 65000
br i1 %89, label %90, label %94
90: ; preds = %87, %77
%91 = load i32, i32* @stderr
%92 = call i32 (i32, i8*, ...) @fprintf(i32 %91, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%93 = call i32 @exit(i32 1)
unreachable
94: ; preds = %87
%95 = call i32 @inet_addr(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%96 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %14, i32 0, i32 2
%97 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %96, i32 0, i32 0
store i32 %95, i32* %97
%98 = load i32, i32* @AF_INET
%99 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %14, i32 0, i32 1
store i32 %98, i32* %99
%100 = load i32, i32* %11
%101 = call i32 @htons(i32 %100)
%102 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %14, i32 0, i32 0
store i32 %101, i32* %102
%103 = load i8**, i8*** %5
%104 = getelementptr inbounds i8*, i8** %103, i64 0
%105 = load i8*, i8** %104
%106 = load i32, i32* %6
%107 = load i32, i32* %11
%108 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.5, i64 0, i64 0), i8* %105, i32 %106, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %107)
%109 = load i32, i32* %13
%110 = bitcast %struct.sockaddr_in* %14 to %struct.sockaddr*
%111 = call i64 @connect(i32 %109, %struct.sockaddr* %110, i32 12)
%112 = icmp slt i64 %111, 0
br i1 %112, label %113, label %116
113: ; preds = %94
%114 = load i32, i32* @stderr
%115 = call i32 (i32, i8*, ...) @fprintf(i32 %114, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0))
store i32 2, i32* %3
br label %166
116: ; preds = %94
%117 = load i32, i32* %13
%118 = call i32 @recv(i32 %117, i32* %12, i32 4, i32 0)
store i32 %118, i32* %10
%119 = load i32, i32* %10
%120 = icmp slt i32 %119, 0
br i1 %120, label %121, label %124
121: ; preds = %116
%122 = load i32, i32* @stderr
%123 = call i32 (i32, i8*, ...) @fprintf(i32 %122, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
store i32 2, i32* %3
br label %166
124: ; preds = %116
%125 = load i8**, i8*** %5
%126 = getelementptr inbounds i8*, i8** %125, i64 0
%127 = load i8*, i8** %126
%128 = load i32, i32* %6
%129 = load i32, i32* %10
%130 = load i32, i32* %12
%131 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.8, i64 0, i64 0), i8* %127, i32 %128, i32 %129, i32 %130)
%132 = load i8**, i8*** %5
%133 = getelementptr inbounds i8*, i8** %132, i64 2
%134 = load i8*, i8** %133
%135 = call i32 @atoi(i8* %134)
store i32 %135, i32* %15
%136 = load i32, i32* %15
%137 = load i32, i32* %12
%138 = mul nsw i32 %136, %137
%139 = and i32 %138, 1
store i32 %139, i32* %16
%140 = load i32, i32* %16
%141 = icmp ne i32 %140, 0
br i1 %141, label %142, label %151
142: ; preds = %124
%143 = load i8**, i8*** %5
%144 = getelementptr inbounds i8*, i8** %143, i64 0
%145 = load i8*, i8** %144
%146 = load i32, i32* %6
%147 = load i32, i32* %15
%148 = load i32, i32* %12
%149 = mul nsw i32 %147, %148
%150 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.9, i64 0, i64 0), i8* %145, i32 %146, i32 %149)
br label %160
151: ; preds = %124
%152 = load i8**, i8*** %5
%153 = getelementptr inbounds i8*, i8** %152, i64 0
%154 = load i8*, i8** %153
%155 = load i32, i32* %6
%156 = load i32, i32* %15
%157 = load i32, i32* %12
%158 = mul nsw i32 %156, %157
%159 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.10, i64 0, i64 0), i8* %154, i32 %155, i32 %158)
br label %160
160: ; preds = %151, %142
%161 = load i8**, i8*** %5
%162 = getelementptr inbounds i8*, i8** %161, i64 0
%163 = load i8*, i8** %162
%164 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i8* %163)
%165 = load i32, i32* %16
store i32 %165, i32* %3
br label %166
166: ; preds = %160, %121, %113, %57, %19
%167 = load i32, i32* %3
ret i32 %167
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, i32, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [29 x i8] c"Usage: %s [ port # ] [ # ].\0A\00"
@.str.1 = [28 x i8] c"%s process [%d]: starting.\0A\00"
@stderr = global i32 0
@.str.2 = [43 x i8] c"%s process [%d]: %s is not a valid input.\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.3 = [22 x i8] c"error: invalid port.\0A\00"
@.str.4 = [10 x i8] c"127.0.0.1\00"
@.str.5 = [46 x i8] c"%s process [%d]: connecting to %s on port %d\0A\00"
@.str.6 = [23 x i8] c"error: connect failed\0A\00"
@.str.7 = [21 x i8] c"error: recv failed.\0A\00"
@.str.8 = [53 x i8] c"%s process [%d]: read %d bytes containing value: %d\0A\00"
@.str.9 = [36 x i8] c"%s process [%d]: %d *IS NOT* even.\0A\00"
@.str.10 = [32 x i8] c"%s process [%d]: %d *IS* even.\0A\00"
@.str.11 = [14 x i8] c"%s: exiting.\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca %struct.sockaddr_in
%5 = icmp eq i32 %0, 3
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = load i8*, i8** %1
%8 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %104
9: ; preds = %2
%10 = tail call i32 (...) @getpid()
%11 = load i8*, i8** %1
%12 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %11, i32 %10)
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = tail call i32 @strlen(i8* %14)
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %29
17: ; preds = %9
%18 = zext i32 %15 to i64
br label %21
19: ; preds = %21
%20 = icmp eq i64 %28, %18
br i1 %20, label %29, label %21
21: ; preds = %17, %19
%22 = phi i64 [ 0, %17 ], [ %28, %19 ]
%23 = load i8*, i8** %13
%24 = getelementptr inbounds i8, i8* %23, i64 %22
%25 = load i8, i8* %24
%26 = tail call i32 @isdigit(i8 signext %25)
%27 = icmp eq i32 %26, 0
%28 = add nuw nsw i64 %22, 1
br i1 %27, label %56, label %19
29: ; preds = %19, %9
%30 = getelementptr inbounds i8*, i8** %1, i64 2
%31 = load i8*, i8** %30
%32 = tail call i32 @strlen(i8* %31)
%33 = icmp sgt i32 %32, 0
br i1 %33, label %34, label %46
34: ; preds = %29
%35 = zext i32 %32 to i64
br label %36
36: ; preds = %44, %34
%37 = phi i64 [ 0, %34 ], [ %43, %44 ]
%38 = load i8*, i8** %30
%39 = getelementptr inbounds i8, i8* %38, i64 %37
%40 = load i8, i8* %39
%41 = tail call i32 @isdigit(i8 signext %40)
%42 = icmp eq i32 %41, 0
%43 = add nuw nsw i64 %37, 1
br i1 %42, label %56, label %44
44: ; preds = %36
%45 = icmp eq i64 %43, %35
br i1 %45, label %46, label %36
46: ; preds = %44, %29
%47 = load i8*, i8** %13
%48 = tail call i32 @atoi(i8* %47)
%49 = bitcast i32* %3 to i8*
store i32 -1, i32* %3
%50 = load i32, i32* @AF_INET
%51 = load i32, i32* @SOCK_STREAM
%52 = tail call i32 @socket(i32 %50, i32 %51, i32 0)
%53 = bitcast %struct.sockaddr_in* %4 to i8*
%54 = add i32 %48, -65001
%55 = icmp ult i32 %54, -64901
br i1 %55, label %62, label %66
56: ; preds = %21, %36
%57 = phi i8** [ %30, %36 ], [ %13, %21 ]
%58 = load i32, i32* @stderr
%59 = load i8*, i8** %1
%60 = load i8*, i8** %57
%61 = tail call i32 (i32, i8*, ...) @fprintf(i32 %58, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0), i8* %59, i32 %10, i8* %60)
br label %104
62: ; preds = %46
%63 = load i32, i32* @stderr
%64 = tail call i32 (i32, i8*, ...) @fprintf(i32 %63, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%65 = tail call i32 @exit(i32 1)
unreachable
66: ; preds = %46
%67 = tail call i32 @inet_addr(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%68 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 2, i32 0
store i32 %67, i32* %68
%69 = load i32, i32* @AF_INET
%70 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 1
store i32 %69, i32* %70
%71 = tail call i32 @htons(i32 %48)
%72 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 0
store i32 %71, i32* %72
%73 = load i8*, i8** %1
%74 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.5, i64 0, i64 0), i8* %73, i32 %10, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %48)
%75 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%76 = call i64 @connect(i32 %52, %struct.sockaddr* %75, i32 12)
%77 = icmp slt i64 %76, 0
br i1 %77, label %78, label %81
78: ; preds = %66
%79 = load i32, i32* @stderr
%80 = call i32 (i32, i8*, ...) @fprintf(i32 %79, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0))
br label %102
81: ; preds = %66
%82 = call i32 @recv(i32 %52, i32* %3, i32 4, i32 0)
%83 = icmp slt i32 %82, 0
br i1 %83, label %84, label %87
84: ; preds = %81
%85 = load i32, i32* @stderr
%86 = call i32 (i32, i8*, ...) @fprintf(i32 %85, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
br label %102
87: ; preds = %81
%88 = load i8*, i8** %1
%89 = load i32, i32* %3
%90 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.8, i64 0, i64 0), i8* %88, i32 %10, i32 %82, i32 %89)
%91 = load i8*, i8** %30
%92 = call i32 @atoi(i8* %91)
%93 = load i32, i32* %3
%94 = mul nsw i32 %93, %92
%95 = and i32 %94, 1
%96 = icmp eq i32 %95, 0
%97 = load i8*, i8** %1
%98 = select i1 %96, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.9, i64 0, i64 0)
%99 = call i32 (i8*, i8*, ...) @printf(i8* %98, i8* %97, i32 %10, i32 %94)
%100 = load i8*, i8** %1
%101 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i8* %100)
br label %102
102: ; preds = %87, %84, %78
%103 = phi i32 [ 2, %78 ], [ 2, %84 ], [ %95, %87 ]
br label %104
104: ; preds = %56, %102, %6
%105 = phi i32 [ -1, %6 ], [ %103, %102 ], [ 2, %56 ]
ret i32 %105
}