#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 /*<<< orphan*/ yourName;
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*/ serv_addr;
typedef int /*<<< orphan*/ myName;
typedef int /*<<< orphan*/ messageSend;
typedef int /*<<< orphan*/ messageRec;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int atoi(char *);
int /*<<< orphan*/ bcopy(char *, char *, int /*<<< orphan*/);
scalar_t__ checker(char *, char *);
int /*<<< orphan*/ close(int);
scalar_t__ connect(int, struct sockaddr *, int);
int /*<<< orphan*/ error(char *, int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
struct hostent *gethostbyname(char *);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ reset(char *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ stripper(char *, int);
int /*<<< orphan*/ toReceive(int, char *, int);
int /*<<< orphan*/ toSend(int, char *, int);
int main(int argc, char **argv) {
  char messageSend[500];
  char messageRec[500];
  int truth = 1;
  char myName[10];
  char yourName[10];
  char ender[5] = {'\\', 'q', 'u', 'i', 't'};
  int flip;
  if (argc < 3) {
    error("Usage wrong:  client [flip #] [port#].", 2);
  }
  printf("User name: ");
  fgets(myName, 10, stdin);
  stripper(myName, 10);
  int sockfd, portno;
  struct sockaddr_in serv_addr;
  struct hostent *server;
  portno = atoi(argv[2]);
  sockfd = socket(AF_INET, SOCK_STREAM, 0);
  if (sockfd < 0) {
    error("Socket error\n", 3);
  }
  flip = atoi(argv[1]);
  if (flip == 1) {
    server = gethostbyname("flip1.engr.oregonstate.edu");
  } else if (flip == 2) {
    server = gethostbyname("flip2.engr.oregonstate.edu");
  } else if (flip == 3) {
    server = gethostbyname("flip3.engr.oregonstate.edu");
  } else {
    error("Error with Flip number\n", 4);
  }
  if (server == NULL) {
    error("Host problems.\n", 5);
  }
  memset((char *)&serv_addr, 0, sizeof(serv_addr));
  serv_addr.sin_family = AF_INET;
  bcopy((char *)server->h_addr, (char *)&serv_addr.sin_addr.s_addr,
        server->h_length);
  serv_addr.sin_port = htons(portno);
  if (connect(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) {
    error("Error in connecting, client.\n", 6);
  }
  toSend(sockfd, myName, sizeof(myName));
  toReceive(sockfd, yourName, sizeof(yourName));
  stripper(myName, 10);
  stripper(yourName, 10);
  while (truth) {
    printf("%s:  ", myName);
    fflush(stdout);
    fgets(messageSend, 500, stdin);
    if (checker(messageSend, ender)) {
      toSend(sockfd, messageSend, sizeof(messageSend));
      truth = 0;
    } else {
      toSend(sockfd, messageSend, sizeof(messageSend));
      toReceive(sockfd, messageRec, sizeof(messageRec));
      if (checker(messageRec, ender)) {
        truth = 0;
      }
      printf("%s:  %s", yourName, messageRec);
      reset(messageSend, 500);
      reset(messageRec, 500);
    }
  }
  close(sockfd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x450,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x414(%rbp)
mov    0xdc7(%rip),%eax
mov    %eax,-0x42d(%rbp)
mov    0xdbf(%rip),%al
mov    %al,-0x429(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1266 <main+0x56>
lea    0xda9(%rip),%rdi
mov    $0x2,%esi
call   1100 <error@plt>
lea    0xdbf(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x41e(%rbp),%rdi
mov    0x2d5e(%rip),%rax
mov    (%rax),%edx
mov    $0xa,%esi
call   10a0 <fgets@plt>
lea    -0x41e(%rbp),%rdi
mov    $0xa,%esi
call   1030 <stripper@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1110 <atoi@plt>
mov    %eax,-0x43c(%rbp)
mov    0x2d2f(%rip),%rax
mov    (%rax),%edi
mov    0x2d0e(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1130 <socket@plt>
mov    %eax,-0x438(%rbp)
cmpl   $0x0,-0x438(%rbp)
jge    12ef <main+0xdf>
lea    0xd53(%rip),%rdi
mov    $0x3,%esi
call   1100 <error@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1110 <atoi@plt>
mov    %eax,-0x434(%rbp)
cmpl   $0x1,-0x434(%rbp)
jne    1327 <main+0x117>
lea    0xd30(%rip),%rdi
call   10b0 <gethostbyname@plt>
mov    %rax,-0x450(%rbp)
jmp    138c <main+0x17c>
cmpl   $0x2,-0x434(%rbp)
jne    134c <main+0x13c>
lea    0xd26(%rip),%rdi
call   10b0 <gethostbyname@plt>
mov    %rax,-0x450(%rbp)
jmp    1387 <main+0x177>
cmpl   $0x3,-0x434(%rbp)
jne    1371 <main+0x161>
lea    0xd1c(%rip),%rdi
call   10b0 <gethostbyname@plt>
mov    %rax,-0x450(%rbp)
jmp    1382 <main+0x172>
lea    0xd1f(%rip),%rdi
mov    $0x4,%esi
call   1100 <error@plt>
jmp    1387 <main+0x177>
jmp    138c <main+0x17c>
cmpq   $0x0,-0x450(%rbp)
jne    13ab <main+0x19b>
lea    0xd0e(%rip),%rdi
mov    $0x5,%esi
call   1100 <error@plt>
lea    -0x448(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1070 <memset@plt>
mov    0x2c23(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x440(%rbp)
mov    -0x450(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x448(%rbp),%rsi
add    $0x4,%rsi
mov    -0x450(%rbp),%rax
mov    (%rax),%edx
call   10f0 <bcopy@plt>
mov    -0x43c(%rbp),%edi
call   1040 <htons@plt>
mov    %eax,-0x448(%rbp)
mov    -0x438(%rbp),%edi
lea    -0x448(%rbp),%rsi
mov    $0xc,%edx
call   1120 <connect@plt>
cmp    $0x0,%rax
jge    1434 <main+0x224>
lea    0xc95(%rip),%rdi
mov    $0x6,%esi
call   1100 <error@plt>
mov    -0x438(%rbp),%edi
lea    -0x41e(%rbp),%rsi
mov    $0xa,%edx
call   1090 <toSend@plt>
mov    -0x438(%rbp),%edi
lea    -0x428(%rbp),%rsi
mov    $0xa,%edx
call   1060 <toReceive@plt>
lea    -0x41e(%rbp),%rdi
mov    $0xa,%esi
call   1030 <stripper@plt>
lea    -0x428(%rbp),%rdi
mov    $0xa,%esi
call   1030 <stripper@plt>
cmpl   $0x0,-0x414(%rbp)
je     15a9 <main+0x399>
lea    -0x41e(%rbp),%rsi
lea    0xc3e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2b1b(%rip),%rax
mov    (%rax),%edi
call   10c0 <fflush@plt>
lea    -0x210(%rbp),%rdi
mov    0x2b1e(%rip),%rax
mov    (%rax),%edx
mov    $0x1f4,%esi
call   10a0 <fgets@plt>
lea    -0x210(%rbp),%rdi
lea    -0x42d(%rbp),%rsi
call   10e0 <checker@plt>
cmp    $0x0,%rax
je     1511 <main+0x301>
mov    -0x438(%rbp),%edi
lea    -0x210(%rbp),%rsi
mov    $0x1f4,%edx
call   1090 <toSend@plt>
movl   $0x0,-0x414(%rbp)
jmp    15a4 <main+0x394>
mov    -0x438(%rbp),%edi
lea    -0x210(%rbp),%rsi
mov    $0x1f4,%edx
call   1090 <toSend@plt>
mov    -0x438(%rbp),%edi
lea    -0x410(%rbp),%rsi
mov    $0x1f4,%edx
call   1060 <toReceive@plt>
lea    -0x410(%rbp),%rdi
lea    -0x42d(%rbp),%rsi
call   10e0 <checker@plt>
cmp    $0x0,%rax
je     1566 <main+0x356>
movl   $0x0,-0x414(%rbp)
lea    -0x428(%rbp),%rsi
lea    -0x410(%rbp),%rdx
lea    0xb68(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x210(%rbp),%rdi
mov    $0x1f4,%esi
call   10d0 <reset@plt>
lea    -0x410(%rbp),%rdi
mov    $0x1f4,%esi
call   10d0 <reset@plt>
jmp    1484 <main+0x274>
mov    -0x438(%rbp),%edi
call   1080 <close@plt>
xor    %eax,%eax
add    $0x450,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x428,%rsp
mov    %rsi,%rbx
movb   $0x74,0xc(%rsp)
movl   $0x6975715c,0x8(%rsp)
69
cmp    $0x2,%edi
jg     1247 <main+0x37>
lea    0xdd7(%rip),%rdi
mov    $0x2,%esi
call   1100 <error@plt>
lea    0xded(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2d84(%rip),%rax
mov    (%rax),%edx
lea    0x1c(%rsp),%rbp
mov    %rbp,%rdi
mov    $0xa,%esi
call   10a0 <fgets@plt>
mov    %rbp,%rdi
mov    $0xa,%esi
call   1030 <stripper@plt>
mov    0x10(%rbx),%rdi
call   1110 <atoi@plt>
mov    %eax,%r14d
mov    0x2d58(%rip),%r15
mov    (%r15),%edi
mov    0x2d36(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1130 <socket@plt>
mov    %eax,%r13d
test   %eax,%eax
jns    12bb <main+0xab>
lea    0xd96(%rip),%rdi
mov    $0x3,%esi
call   1100 <error@plt>
mov    0x8(%rbx),%rdi
call   1110 <atoi@plt>
add    $0xffffffff,%eax
cmp    $0x3,%eax
jae    12eb <main+0xdb>
cltq
lea    0xd33(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
call   10b0 <gethostbyname@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    130f <main+0xff>
jmp    12fc <main+0xec>
lea    0xdb4(%rip),%rdi
mov    $0x4,%esi
call   1100 <error@plt>
lea    0xdbb(%rip),%rdi
mov    $0x5,%esi
call   1100 <error@plt>
xor    %ebx,%ebx
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1070 <memset@plt>
mov    (%r15),%eax
mov    %eax,0x18(%rsp)
mov    0x8(%rbx),%rsi
lea    0x14(%rsp),%rdi
mov    (%rbx),%edx
call   10f0 <memmove@plt>
mov    %r14d,%edi
call   1040 <htons@plt>
mov    %eax,0x10(%rsp)
mov    %r13d,%edi
mov    %rbp,%rsi
mov    $0xc,%edx
call   1120 <connect@plt>
test   %rax,%rax
jns    136c <main+0x15c>
lea    0xd6c(%rip),%rdi
mov    $0x6,%esi
call   1100 <error@plt>
lea    0x1c(%rsp),%rbx
mov    %r13d,%edi
mov    %rbx,%rsi
mov    $0xa,%edx
call   1090 <toSend@plt>
lea    0x26(%rsp),%rbp
mov    %r13d,%edi
mov    %rbp,%rsi
mov    $0xa,%edx
call   1060 <toReceive@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <stripper@plt>
mov    %rbp,%rdi
mov    $0xa,%esi
call   1030 <stripper@plt>
lea    0x230(%rsp),%rbp
lea    0x8(%rsp),%r15
lea    0x30(%rsp),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0xd15(%rip),%rdi
lea    0x1c(%rsp),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2bde(%rip),%rax
mov    (%rax),%edi
call   10c0 <fflush@plt>
mov    0x2be8(%rip),%rax
mov    (%rax),%edx
mov    %rbp,%rdi
mov    $0x1f4,%esi
call   10a0 <fgets@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
call   10e0 <checker@plt>
mov    %rax,%r12
mov    %r13d,%edi
mov    %rbp,%rsi
mov    $0x1f4,%edx
call   1090 <toSend@plt>
test   %r12,%r12
jne    1481 <main+0x271>
mov    %r13d,%edi
mov    %r14,%rsi
mov    $0x1f4,%edx
call   1060 <toReceive@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   10e0 <checker@plt>
mov    %rax,%rbx
lea    0xca3(%rip),%rdi
lea    0x26(%rsp),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbp,%rdi
mov    $0x1f4,%esi
call   10d0 <reset@plt>
mov    %r14,%rdi
mov    $0x1f4,%esi
call   10d0 <reset@plt>
test   %rbx,%rbx
je     13d0 <main+0x1c0>
mov    %r13d,%edi
call   1080 <close@plt>
xor    %eax,%eax
add    $0x428,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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 }
@__const.main.ender = [5 x i8] c"\\quit"
@.str = [39 x i8] c"Usage wrong: client [flip #] [port#].\00"
@.str.1 = [12 x i8] c"User name: \00"
@stdin = global i32 0
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.2 = [14 x i8] c"Socket error\0A\00"
@.str.3 = [27 x i8] c"flip1.engr.oregonstate.edu\00"
@.str.4 = [27 x i8] c"flip2.engr.oregonstate.edu\00"
@.str.5 = [27 x i8] c"flip3.engr.oregonstate.edu\00"
@.str.6 = [24 x i8] c"Error with Flip number\0A\00"
@.str.7 = [16 x i8] c"Host problems.\0A\00"
@.str.8 = [30 x i8] c"Error in connecting, client.\0A\00"
@.str.9 = [6 x i8] c"%s: \00"
@stdout = global i32 0
@.str.10 = [8 x i8] c"%s: %s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [500 x i8]
%7 = alloca [500 x i8]
%8 = alloca i32
%9 = alloca [10 x i8]
%10 = alloca [10 x i8]
%11 = alloca [5 x i8]
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca %struct.sockaddr_in
%16 = alloca %struct.hostent*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %8
%17 = bitcast [5 x i8]* %11 to i8*
%18 = load i32, i32* %4
%19 = icmp slt i32 %18, 3
br i1 %19, label %20, label %22
20: ; preds = %2
%21 = call i32 @error(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 2)
br label %22
22: ; preds = %20, %2
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%24 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
%25 = load i32, i32* @stdin
%26 = call i32 @fgets(i8* %24, i32 10, i32 %25)
%27 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
%28 = call i32 @stripper(i8* %27, i32 10)
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 2
%31 = load i8*, i8** %30
%32 = call i32 @atoi(i8* %31)
store i32 %32, i32* %14
%33 = load i32, i32* @AF_INET
%34 = load i32, i32* @SOCK_STREAM
%35 = call i32 @socket(i32 %33, i32 %34, i32 0)
store i32 %35, i32* %13
%36 = load i32, i32* %13
%37 = icmp slt i32 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %22
%39 = call i32 @error(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 3)
br label %40
40: ; preds = %38, %22
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 1
%43 = load i8*, i8** %42
%44 = call i32 @atoi(i8* %43)
store i32 %44, i32* %12
%45 = load i32, i32* %12
%46 = icmp eq i32 %45, 1
br i1 %46, label %47, label %49
47: ; preds = %40
%48 = call %struct.hostent* @gethostbyname(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
store %struct.hostent* %48, %struct.hostent** %16
br label %63
49: ; preds = %40
%50 = load i32, i32* %12
%51 = icmp eq i32 %50, 2
br i1 %51, label %52, label %54
52: ; preds = %49
%53 = call %struct.hostent* @gethostbyname(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
store %struct.hostent* %53, %struct.hostent** %16
br label %62
54: ; preds = %49
%55 = load i32, i32* %12
%56 = icmp eq i32 %55, 3
br i1 %56, label %57, label %59
57: ; preds = %54
%58 = call %struct.hostent* @gethostbyname(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
store %struct.hostent* %58, %struct.hostent** %16
br label %61
59: ; preds = %54
%60 = call i32 @error(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), i32 4)
br label %61
61: ; preds = %59, %57
br label %62
62: ; preds = %61, %52
br label %63
63: ; preds = %62, %47
%64 = load %struct.hostent*, %struct.hostent** %16
%65 = icmp eq %struct.hostent* %64, null
br i1 %65, label %66, label %68
66: ; preds = %63
%67 = call i32 @error(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i32 5)
br label %68
68: ; preds = %66, %63
%69 = bitcast %struct.sockaddr_in* %15 to i8*
%70 = call i32 @memset(i8* %69, i32 0, i32 12)
%71 = load i32, i32* @AF_INET
%72 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %15, i32 0, i32 2
store i32 %71, i32* %72
%73 = load %struct.hostent*, %struct.hostent** %16
%74 = getelementptr inbounds %struct.hostent, %struct.hostent* %73, i32 0, i32 1
%75 = load i64, i64* %74
%76 = inttoptr i64 %75 to i8*
%77 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %15, i32 0, i32 1
%78 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %77, i32 0, i32 0
%79 = bitcast i32* %78 to i8*
%80 = load %struct.hostent*, %struct.hostent** %16
%81 = getelementptr inbounds %struct.hostent, %struct.hostent* %80, i32 0, i32 0
%82 = load i32, i32* %81
%83 = call i32 @bcopy(i8* %76, i8* %79, i32 %82)
%84 = load i32, i32* %14
%85 = call i32 @htons(i32 %84)
%86 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %15, i32 0, i32 0
store i32 %85, i32* %86
%87 = load i32, i32* %13
%88 = bitcast %struct.sockaddr_in* %15 to %struct.sockaddr*
%89 = call i64 @connect(i32 %87, %struct.sockaddr* %88, i32 12)
%90 = icmp slt i64 %89, 0
br i1 %90, label %91, label %93
91: ; preds = %68
%92 = call i32 @error(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0), i32 6)
br label %93
93: ; preds = %91, %68
%94 = load i32, i32* %13
%95 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
%96 = call i32 @toSend(i32 %94, i8* %95, i32 10)
%97 = load i32, i32* %13
%98 = getelementptr inbounds [10 x i8], [10 x i8]* %10, i64 0, i64 0
%99 = call i32 @toReceive(i32 %97, i8* %98, i32 10)
%100 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
%101 = call i32 @stripper(i8* %100, i32 10)
%102 = getelementptr inbounds [10 x i8], [10 x i8]* %10, i64 0, i64 0
%103 = call i32 @stripper(i8* %102, i32 10)
br label %104
104: ; preds = %143, %93
%105 = load i32, i32* %8
%106 = icmp ne i32 %105, 0
br i1 %106, label %107, label %144
107: ; preds = %104
%108 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
%109 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i8* %108)
%110 = load i32, i32* @stdout
%111 = call i32 @fflush(i32 %110)
%112 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%113 = load i32, i32* @stdin
%114 = call i32 @fgets(i8* %112, i32 500, i32 %113)
%115 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%116 = getelementptr inbounds [5 x i8], [5 x i8]* %11, i64 0, i64 0
%117 = call i64 @checker(i8* %115, i8* %116)
%118 = icmp ne i64 %117, 0
br i1 %118, label %119, label %123
119: ; preds = %107
%120 = load i32, i32* %13
%121 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%122 = call i32 @toSend(i32 %120, i8* %121, i32 500)
store i32 0, i32* %8
br label %143
123: ; preds = %107
%124 = load i32, i32* %13
%125 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%126 = call i32 @toSend(i32 %124, i8* %125, i32 500)
%127 = load i32, i32* %13
%128 = getelementptr inbounds [500 x i8], [500 x i8]* %7, i64 0, i64 0
%129 = call i32 @toReceive(i32 %127, i8* %128, i32 500)
%130 = getelementptr inbounds [500 x i8], [500 x i8]* %7, i64 0, i64 0
%131 = getelementptr inbounds [5 x i8], [5 x i8]* %11, i64 0, i64 0
%132 = call i64 @checker(i8* %130, i8* %131)
%133 = icmp ne i64 %132, 0
br i1 %133, label %134, label %135
134: ; preds = %123
store i32 0, i32* %8
br label %135
135: ; preds = %134, %123
%136 = getelementptr inbounds [10 x i8], [10 x i8]* %10, i64 0, i64 0
%137 = getelementptr inbounds [500 x i8], [500 x i8]* %7, i64 0, i64 0
%138 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), i8* %136, i8* %137)
%139 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%140 = call i32 @reset(i8* %139, i32 500)
%141 = getelementptr inbounds [500 x i8], [500 x i8]* %7, i64 0, i64 0
%142 = call i32 @reset(i8* %141, i32 500)
br label %143
143: ; preds = %135, %119
br label %104
144: ; preds = %104
%145 = load i32, i32* %13
%146 = call i32 @close(i32 %145)
ret i32 0
}

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 }
@__const.main.ender = [5 x i8] c"\\quit"
@.str = [39 x i8] c"Usage wrong: client [flip #] [port#].\00"
@.str.1 = [12 x i8] c"User name: \00"
@stdin = global i32 0
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.2 = [14 x i8] c"Socket error\0A\00"
@.str.3 = [27 x i8] c"flip1.engr.oregonstate.edu\00"
@.str.4 = [27 x i8] c"flip2.engr.oregonstate.edu\00"
@.str.5 = [27 x i8] c"flip3.engr.oregonstate.edu\00"
@.str.6 = [24 x i8] c"Error with Flip number\0A\00"
@.str.7 = [16 x i8] c"Host problems.\0A\00"
@.str.8 = [30 x i8] c"Error in connecting, client.\0A\00"
@.str.9 = [6 x i8] c"%s: \00"
@stdout = global i32 0
@.str.10 = [8 x i8] c"%s: %s\00"
@reltable.main = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([27 x i8]* @.str.3 to i64), i64 ptrtoint ([3 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([27 x i8]* @.str.4 to i64), i64 ptrtoint ([3 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([27 x i8]* @.str.5 to i64), i64 ptrtoint ([3 x i32]* @reltable.main to i64)) to i32)]
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [500 x i8]
%4 = alloca [500 x i8]
%5 = alloca [10 x i8]
%6 = alloca [10 x i8]
%7 = alloca [5 x i8]
%8 = alloca %struct.sockaddr_in
%9 = getelementptr inbounds [500 x i8], [500 x i8]* %3, i64 0, i64 0
%10 = getelementptr inbounds [500 x i8], [500 x i8]* %4, i64 0, i64 0
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%12 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 0
%13 = getelementptr inbounds [5 x i8], [5 x i8]* %7, i64 0, i64 0
%14 = icmp slt i32 %0, 3
br i1 %14, label %15, label %17
15: ; preds = %2
%16 = tail call i32 @error(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 2)
br label %17
17: ; preds = %15, %2
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%19 = load i32, i32* @stdin
%20 = call i32 @fgets(i8* %11, i32 10, i32 %19)
%21 = call i32 @stripper(i8* %11, i32 10)
%22 = bitcast %struct.sockaddr_in* %8 to i8*
%23 = getelementptr inbounds i8*, i8** %1, i64 2
%24 = load i8*, i8** %23
%25 = call i32 @atoi(i8* %24)
%26 = load i32, i32* @AF_INET
%27 = load i32, i32* @SOCK_STREAM
%28 = call i32 @socket(i32 %26, i32 %27, i32 0)
%29 = icmp slt i32 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %17
%31 = call i32 @error(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 3)
br label %32
32: ; preds = %30, %17
%33 = getelementptr inbounds i8*, i8** %1, i64 1
%34 = load i8*, i8** %33
%35 = call i32 @atoi(i8* %34)
%36 = add i32 %35, -1
%37 = icmp ult i32 %36, 3
br i1 %37, label %40, label %38
38: ; preds = %32
%39 = call i32 @error(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0), i32 4)
br label %46
40: ; preds = %32
%41 = sext i32 %36 to i64
%42 = shl i64 %41, 2
%43 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.main to i8*), i64 %42)
%44 = call %struct.hostent* @gethostbyname(i8* %43)
%45 = icmp eq %struct.hostent* %44, null
br i1 %45, label %46, label %48
46: ; preds = %38, %40
%47 = call i32 @error(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i32 5)
br label %48
48: ; preds = %46, %40
%49 = phi %struct.hostent* [ null, %46 ], [ %44, %40 ]
%50 = call i32 @memset(i8* %22, i32 0, i32 12)
%51 = load i32, i32* @AF_INET
%52 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i64 0, i32 2
store i32 %51, i32* %52
%53 = getelementptr inbounds %struct.hostent, %struct.hostent* %49, i64 0, i32 1
%54 = load i64, i64* %53
%55 = inttoptr i64 %54 to i8*
%56 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i64 0, i32 1, i32 0
%57 = bitcast i32* %56 to i8*
%58 = getelementptr inbounds %struct.hostent, %struct.hostent* %49, i64 0, i32 0
%59 = load i32, i32* %58
%60 = call i32 @htons(i32 %25)
%61 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i64 0, i32 0
store i32 %60, i32* %61
%62 = bitcast %struct.sockaddr_in* %8 to %struct.sockaddr*
%63 = call i64 @connect(i32 %28, %struct.sockaddr* %62, i32 12)
%64 = icmp slt i64 %63, 0
br i1 %64, label %65, label %67
65: ; preds = %48
%66 = call i32 @error(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0), i32 6)
br label %67
67: ; preds = %65, %48
%68 = call i32 @toSend(i32 %28, i8* %11, i32 10)
%69 = call i32 @toReceive(i32 %28, i8* %12, i32 10)
%70 = call i32 @stripper(i8* %11, i32 10)
%71 = call i32 @stripper(i8* %12, i32 10)
br label %72
72: ; preds = %67, %81
%73 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i8* %11)
%74 = load i32, i32* @stdout
%75 = call i32 @fflush(i32 %74)
%76 = load i32, i32* @stdin
%77 = call i32 @fgets(i8* %9, i32 500, i32 %76)
%78 = call i64 @checker(i8* %9, i8* %13)
%79 = icmp eq i64 %78, 0
%80 = call i32 @toSend(i32 %28, i8* %9, i32 500)
br i1 %79, label %81, label %88
81: ; preds = %72
%82 = call i32 @toReceive(i32 %28, i8* %10, i32 500)
%83 = call i64 @checker(i8* %10, i8* %13)
%84 = icmp eq i64 %83, 0
%85 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), i8* %12, i8* %10)
%86 = call i32 @reset(i8* %9, i32 500)
%87 = call i32 @reset(i8* %10, i32 500)
br i1 %84, label %72, label %88
88: ; preds = %81, %72
%89 = call i32 @close(i32 %28)
ret i32 0
}