#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_addr;
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
struct sigaction {
  int /*<<< orphan*/ sa_mask;
  scalar_t__ sa_flags;
  int /*<<< orphan*/ sa_handler;
};
typedef int /*<<< orphan*/ addr;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SIGPIPE;
int /*<<< orphan*/ SIG_IGN;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ close(int);
int connect(int, struct sockaddr *, int);
int /*<<< orphan*/ echo_cli(int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int, char *,
                           char *);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ inet_aton(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ memset(struct sockaddr_in *, int, int);
int sigaction(int /*<<< orphan*/, struct sigaction *, int /*<<< orphan*/ *);
int /*<<< orphan*/ sigemptyset(int /*<<< orphan*/ *);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int main(void) {
  int i;
  int cfd[5];
  struct sockaddr_in addr;
  struct sigaction sa;
  sa.sa_handler = SIG_IGN;
  sa.sa_flags = 0;
  sigemptyset(&sa.sa_mask);
  if (sigaction(SIGPIPE, &sa, NULL) == -1)
    do {
      fprintf(stderr, "[%s][%d]:%s %s\n",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/drsin/linuxCoreLearn/refs/heads/"
              "master/apue/day12/cli.c",
              101, "sigaction", strerror(errno));
      exit(EXIT_FAILURE);
    } while (0);
  memset(&addr, 0x00, sizeof(addr));
  for (i = 0; i < 5; i++) {
    if ((cfd[i] = socket(PF_INET, SOCK_STREAM, 0)) == -1)
      do {
        fprintf(stderr, "[%s][%d]:%s %s\n",
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/drsin/linuxCoreLearn/refs/"
                "heads/master/apue/day12/cli.c",
                107, "socket", strerror(errno));
        exit(EXIT_FAILURE);
      } while (0);
    addr.sin_family = AF_INET;
    addr.sin_port = htons(9999);
    inet_aton("192.168.0.200", &addr.sin_addr);
    if (connect(cfd[i], (struct sockaddr *)&addr, sizeof(addr)) == -1)
      do {
        fprintf(stderr, "[%s][%d]:%s %s\n",
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/drsin/linuxCoreLearn/refs/"
                "heads/master/apue/day12/cli.c",
                112, "connect", strerror(errno));
        exit(EXIT_FAILURE);
      } while (0);
  }
  echo_cli(cfd[0]);
  close(cfd[0]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e0a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
lea    -0x48(%rbp),%rdi
call   1080 <sigemptyset@plt>
mov    0x2dcd(%rip),%rax
mov    (%rax),%edi
lea    -0x48(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <sigaction@plt>
cmp    $0xffffffff,%eax
jne    125d <main+0x9d>
jmp    1210 <main+0x50>
mov    0x2db9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
mov    0x2d95(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x4c(%rbp),%edi
mov    %rax,%r9
lea    0xdc9(%rip),%rsi
lea    0xdd2(%rip),%rdx
mov    $0x65,%ecx
lea    0xe58(%rip),%r8
call   1070 <fprintf@plt>
mov    0x2d52(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1050 <memset@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    13a7 <main+0x1e7>
mov    0x2d2b(%rip),%rax
mov    (%rax),%edi
mov    0x2d3a(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10e0 <socket@plt>
movslq -0x8(%rbp),%rcx
mov    %eax,-0x20(%rbp,%rcx,4)
cmp    $0xffffffff,%eax
jne    12fa <main+0x13a>
jmp    12ad <main+0xed>
mov    0x2d1c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x50(%rbp)
mov    0x2cf8(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x50(%rbp),%edi
mov    %rax,%r9
lea    0xd2c(%rip),%rsi
lea    0xd35(%rip),%rdx
mov    $0x6b,%ecx
lea    0xdc5(%rip),%r8
call   1070 <fprintf@plt>
mov    0x2cb5(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    0x2ce7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    $0x270f,%edi
call   1040 <htons@plt>
mov    %eax,-0x2c(%rbp)
lea    -0x30(%rbp),%rsi
lea    0xd95(%rip),%rdi
call   1090 <inet_aton@plt>
movslq -0x8(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%edi
lea    -0x30(%rbp),%rsi
mov    $0xc,%edx
call   10c0 <connect@plt>
cmp    $0xffffffff,%eax
jne    1394 <main+0x1d4>
jmp    1347 <main+0x187>
mov    0x2c82(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x54(%rbp)
mov    0x2c5e(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x54(%rbp),%edi
mov    %rax,%r9
lea    0xc92(%rip),%rsi
lea    0xc9b(%rip),%rdx
mov    $0x70,%ecx
lea    0xd40(%rip),%r8
call   1070 <fprintf@plt>
mov    0x2c1b(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
jmp    1399 <main+0x1d9>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1274 <main+0xb4>
mov    -0x20(%rbp),%edi
call   10a0 <echo_cli@plt>
mov    -0x20(%rbp),%edi
call   1060 <close@plt>
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    0x2e0b(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x20(%rsp)
movq   $0x0,0x18(%rsp)
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1080 <sigemptyset@plt>
mov    0x2dc8(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
xor    %edx,%edx
call   1030 <sigaction@plt>
cmp    $0xffffffff,%eax
je     1487 <main+0x2c7>
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1050 <memset@plt>
mov    0x2d8d(%rip),%r15
mov    (%r15),%edi
mov    0x2d9b(%rip),%r12
mov    (%r12),%esi
xor    %edx,%edx
call   10e0 <socket@plt>
cmp    $0xffffffff,%eax
je     1409 <main+0x249>
mov    %eax,%r14d
mov    0x2d9d(%rip),%r13
mov    0x0(%r13),%eax
mov    %eax,0x8(%rsp)
mov    $0x270f,%edi
call   1040 <htons@plt>
mov    %eax,0x4(%rsp)
lea    0xe4b(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1090 <inet_aton@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    $0xc,%edx
call   10c0 <connect@plt>
cmp    $0xffffffff,%eax
je     143e <main+0x27e>
mov    (%r15),%edi
mov    (%r12),%esi
xor    %edx,%edx
call   10e0 <socket@plt>
cmp    $0xffffffff,%eax
je     1409 <main+0x249>
mov    %eax,%ebp
mov    0x0(%r13),%eax
mov    %eax,0x8(%rsp)
mov    $0x270f,%edi
call   1040 <htons@plt>
mov    %eax,0x4(%rsp)
lea    0xdf1(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1090 <inet_aton@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0xc,%edx
call   10c0 <connect@plt>
cmp    $0xffffffff,%eax
je     143e <main+0x27e>
mov    (%r15),%edi
mov    (%r12),%esi
xor    %edx,%edx
call   10e0 <socket@plt>
cmp    $0xffffffff,%eax
je     1409 <main+0x249>
mov    %eax,%ebp
mov    0x0(%r13),%eax
mov    %eax,0x8(%rsp)
mov    $0x270f,%edi
call   1040 <htons@plt>
mov    %eax,0x4(%rsp)
lea    0xd98(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1090 <inet_aton@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0xc,%edx
call   10c0 <connect@plt>
cmp    $0xffffffff,%eax
je     143e <main+0x27e>
mov    (%r15),%edi
mov    (%r12),%esi
xor    %edx,%edx
call   10e0 <socket@plt>
cmp    $0xffffffff,%eax
je     1409 <main+0x249>
mov    %eax,%ebp
mov    0x0(%r13),%eax
mov    %eax,0x8(%rsp)
mov    $0x270f,%edi
call   1040 <htons@plt>
mov    %eax,0x4(%rsp)
lea    0xd3f(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1090 <inet_aton@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0xc,%edx
call   10c0 <connect@plt>
cmp    $0xffffffff,%eax
je     143e <main+0x27e>
mov    (%r15),%edi
mov    (%r12),%esi
xor    %edx,%edx
call   10e0 <socket@plt>
cmp    $0xffffffff,%eax
je     1409 <main+0x249>
mov    %eax,%ebp
mov    0x0(%r13),%eax
mov    %eax,0x8(%rsp)
mov    $0x270f,%edi
call   1040 <htons@plt>
mov    %eax,0x4(%rsp)
lea    0xcea(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1090 <inet_aton@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0xc,%edx
call   10c0 <connect@plt>
cmp    $0xffffffff,%eax
je     143e <main+0x27e>
mov    %r14d,%edi
call   10a0 <echo_cli@plt>
mov    %r14d,%edi
call   1060 <close@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2bc0(%rip),%rax
mov    (%rax),%ebx
mov    0x2b9f(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
lea    0xbd9(%rip),%rsi
lea    0xbe2(%rip),%rdx
lea    0xc77(%rip),%r8
mov    %ebx,%edi
mov    $0x6b,%ecx
jmp    1471 <main+0x2b1>
mov    0x2b8b(%rip),%rax
mov    (%rax),%ebx
mov    0x2b6a(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
lea    0xba4(%rip),%rsi
lea    0xbad(%rip),%rdx
lea    0xc57(%rip),%r8
mov    %ebx,%edi
mov    $0x70,%ecx
mov    %rax,%r9
call   1070 <fprintf@plt>
mov    0x2b28(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    0x2b42(%rip),%rax
mov    (%rax),%ebx
mov    0x2b21(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
lea    0xb5b(%rip),%rsi
lea    0xb64(%rip),%rdx
lea    0xbef(%rip),%r8
mov    %ebx,%edi
mov    $0x65,%ecx
jmp    1471 <main+0x2b1>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.sigaction = type { i32, i64, i32 }
%struct.sockaddr = type { i32 }
@SIG_IGN = global i32 0
@SIGPIPE = global i32 0
@stderr = global i32 0
@.str = [16 x i8] c"[%s][%d]:%s %s\0A\00"
@.str.1 = [146 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/drsin/linuxCoreLearn/refs/heads/master/apue/day12/cli.c\00"
@.str.2 = [10 x i8] c"sigaction\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.3 = [7 x i8] c"socket\00"
@AF_INET = global i32 0
@.str.4 = [14 x i8] c"192.168.0.200\00"
@.str.5 = [8 x i8] c"connect\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [5 x i32]
%4 = alloca %struct.sockaddr_in
%5 = alloca %struct.sigaction
store i32 0, i32* %1
%6 = load i32, i32* @SIG_IGN
%7 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %5, i32 0, i32 2
store i32 %6, i32* %7
%8 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %5, i32 0, i32 1
store i64 0, i64* %8
%9 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %5, i32 0, i32 0
%10 = call i32 @sigemptyset(i32* %9)
%11 = load i32, i32* @SIGPIPE
%12 = call i32 @sigaction(i32 %11, %struct.sigaction* %5, i32* null)
%13 = icmp eq i32 %12, -1
br i1 %13, label %14, label %23
14: ; preds = %0
br label %15
15: ; preds = %14
%16 = load i32, i32* @stderr
%17 = load i32, i32* @errno
%18 = call i8* @strerror(i32 %17)
%19 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([146 x i8], [146 x i8]* @.str.1, i64 0, i64 0), i32 101, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %18)
%20 = load i32, i32* @EXIT_FAILURE
%21 = call i32 @exit(i32 %20)
unreachable
22: ; No predecessors!
br label %23
23: ; preds = %22, %0
%24 = call i32 @memset(%struct.sockaddr_in* %4, i32 0, i32 12)
store i32 0, i32* %2
br label %25
25: ; preds = %69, %23
%26 = load i32, i32* %2
%27 = icmp slt i32 %26, 5
br i1 %27, label %28, label %72
28: ; preds = %25
%29 = load i32, i32* @PF_INET
%30 = load i32, i32* @SOCK_STREAM
%31 = call i32 @socket(i32 %29, i32 %30, i32 0)
%32 = load i32, i32* %2
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 %33
store i32 %31, i32* %34
%35 = icmp eq i32 %31, -1
br i1 %35, label %36, label %45
36: ; preds = %28
br label %37
37: ; preds = %36
%38 = load i32, i32* @stderr
%39 = load i32, i32* @errno
%40 = call i8* @strerror(i32 %39)
%41 = call i32 @fprintf(i32 %38, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([146 x i8], [146 x i8]* @.str.1, i64 0, i64 0), i32 107, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %40)
%42 = load i32, i32* @EXIT_FAILURE
%43 = call i32 @exit(i32 %42)
unreachable
44: ; No predecessors!
br label %45
45: ; preds = %44, %28
%46 = load i32, i32* @AF_INET
%47 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 2
store i32 %46, i32* %47
%48 = call i32 @htons(i32 9999)
%49 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 1
store i32 %48, i32* %49
%50 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 0
%51 = call i32 @inet_aton(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32* %50)
%52 = load i32, i32* %2
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 %53
%55 = load i32, i32* %54
%56 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%57 = call i32 @connect(i32 %55, %struct.sockaddr* %56, i32 12)
%58 = icmp eq i32 %57, -1
br i1 %58, label %59, label %68
59: ; preds = %45
br label %60
60: ; preds = %59
%61 = load i32, i32* @stderr
%62 = load i32, i32* @errno
%63 = call i8* @strerror(i32 %62)
%64 = call i32 @fprintf(i32 %61, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([146 x i8], [146 x i8]* @.str.1, i64 0, i64 0), i32 112, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* %63)
%65 = load i32, i32* @EXIT_FAILURE
%66 = call i32 @exit(i32 %65)
unreachable
67: ; No predecessors!
br label %68
68: ; preds = %67, %45
br label %69
69: ; preds = %68
%70 = load i32, i32* %2
%71 = add nsw i32 %70, 1
store i32 %71, i32* %2
br label %25
72: ; preds = %25
%73 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%74 = load i32, i32* %73
%75 = call i32 @echo_cli(i32 %74)
%76 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%77 = load i32, i32* %76
%78 = call i32 @close(i32 %77)
%79 = load i32, i32* %1
ret i32 %79
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.sigaction = type { i32, i64, i32 }
%struct.sockaddr = type { i32 }
@SIG_IGN = global i32 0
@SIGPIPE = global i32 0
@stderr = global i32 0
@.str = [16 x i8] c"[%s][%d]:%s %s\0A\00"
@.str.1 = [146 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/drsin/linuxCoreLearn/refs/heads/master/apue/day12/cli.c\00"
@.str.2 = [10 x i8] c"sigaction\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.3 = [7 x i8] c"socket\00"
@AF_INET = global i32 0
@.str.4 = [14 x i8] c"192.168.0.200\00"
@.str.5 = [8 x i8] c"connect\00"
define i32 @main() {
%1 = alloca %struct.sockaddr_in
%2 = alloca %struct.sigaction
%3 = bitcast %struct.sockaddr_in* %1 to i8*
%4 = bitcast %struct.sigaction* %2 to i8*
%5 = load i32, i32* @SIG_IGN
%6 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %2, i64 0, i32 2
store i32 %5, i32* %6
%7 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %2, i64 0, i32 1
store i64 0, i64* %7
%8 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %2, i64 0, i32 0
%9 = call i32 @sigemptyset(i32* %8)
%10 = load i32, i32* @SIGPIPE
%11 = call i32 @sigaction(i32 %10, %struct.sigaction* %2, i32* null)
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %20
13: ; preds = %0
%14 = load i32, i32* @stderr
%15 = load i32, i32* @errno
%16 = call i8* @strerror(i32 %15)
%17 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([146 x i8], [146 x i8]* @.str.1, i64 0, i64 0), i32 101, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %16)
%18 = load i32, i32* @EXIT_FAILURE
%19 = call i32 @exit(i32 %18)
unreachable
20: ; preds = %0
%21 = call i32 @memset(%struct.sockaddr_in* %1, i32 0, i32 12)
%22 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 2
%23 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 1
%24 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 0
%25 = bitcast %struct.sockaddr_in* %1 to %struct.sockaddr*
%26 = load i32, i32* @PF_INET
%27 = load i32, i32* @SOCK_STREAM
%28 = call i32 @socket(i32 %26, i32 %27, i32 0)
%29 = icmp eq i32 %28, -1
br i1 %29, label %77, label %84
30: ; preds = %84
%31 = load i32, i32* @PF_INET
%32 = load i32, i32* @SOCK_STREAM
%33 = call i32 @socket(i32 %31, i32 %32, i32 0)
%34 = icmp eq i32 %33, -1
br i1 %34, label %77, label %35
35: ; preds = %30
%36 = load i32, i32* @AF_INET
store i32 %36, i32* %22
%37 = call i32 @htons(i32 9999)
store i32 %37, i32* %23
%38 = call i32 @inet_aton(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32* %24)
%39 = call i32 @connect(i32 %33, %struct.sockaddr* %25, i32 12)
%40 = icmp eq i32 %39, -1
br i1 %40, label %90, label %41
41: ; preds = %35
%42 = load i32, i32* @PF_INET
%43 = load i32, i32* @SOCK_STREAM
%44 = call i32 @socket(i32 %42, i32 %43, i32 0)
%45 = icmp eq i32 %44, -1
br i1 %45, label %77, label %46
46: ; preds = %41
%47 = load i32, i32* @AF_INET
store i32 %47, i32* %22
%48 = call i32 @htons(i32 9999)
store i32 %48, i32* %23
%49 = call i32 @inet_aton(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32* %24)
%50 = call i32 @connect(i32 %44, %struct.sockaddr* %25, i32 12)
%51 = icmp eq i32 %50, -1
br i1 %51, label %90, label %52
52: ; preds = %46
%53 = load i32, i32* @PF_INET
%54 = load i32, i32* @SOCK_STREAM
%55 = call i32 @socket(i32 %53, i32 %54, i32 0)
%56 = icmp eq i32 %55, -1
br i1 %56, label %77, label %57
57: ; preds = %52
%58 = load i32, i32* @AF_INET
store i32 %58, i32* %22
%59 = call i32 @htons(i32 9999)
store i32 %59, i32* %23
%60 = call i32 @inet_aton(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32* %24)
%61 = call i32 @connect(i32 %55, %struct.sockaddr* %25, i32 12)
%62 = icmp eq i32 %61, -1
br i1 %62, label %90, label %63
63: ; preds = %57
%64 = load i32, i32* @PF_INET
%65 = load i32, i32* @SOCK_STREAM
%66 = call i32 @socket(i32 %64, i32 %65, i32 0)
%67 = icmp eq i32 %66, -1
br i1 %67, label %77, label %68
68: ; preds = %63
%69 = load i32, i32* @AF_INET
store i32 %69, i32* %22
%70 = call i32 @htons(i32 9999)
store i32 %70, i32* %23
%71 = call i32 @inet_aton(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32* %24)
%72 = call i32 @connect(i32 %66, %struct.sockaddr* %25, i32 12)
%73 = icmp eq i32 %72, -1
br i1 %73, label %90, label %74
74: ; preds = %68
%75 = call i32 @echo_cli(i32 %28)
%76 = call i32 @close(i32 %28)
ret i32 0
77: ; preds = %63, %52, %41, %30, %20
%78 = load i32, i32* @stderr
%79 = load i32, i32* @errno
%80 = call i8* @strerror(i32 %79)
%81 = call i32 @fprintf(i32 %78, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([146 x i8], [146 x i8]* @.str.1, i64 0, i64 0), i32 107, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %80)
%82 = load i32, i32* @EXIT_FAILURE
%83 = call i32 @exit(i32 %82)
unreachable
84: ; preds = %20
%85 = load i32, i32* @AF_INET
store i32 %85, i32* %22
%86 = call i32 @htons(i32 9999)
store i32 %86, i32* %23
%87 = call i32 @inet_aton(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32* %24)
%88 = call i32 @connect(i32 %28, %struct.sockaddr* %25, i32 12)
%89 = icmp eq i32 %88, -1
br i1 %89, label %90, label %30
90: ; preds = %68, %57, %46, %35, %84
%91 = load i32, i32* @stderr
%92 = load i32, i32* @errno
%93 = call i8* @strerror(i32 %92)
%94 = call i32 @fprintf(i32 %91, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([146 x i8], [146 x i8]* @.str.1, i64 0, i64 0), i32 112, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* %93)
%95 = load i32, i32* @EXIT_FAILURE
%96 = call i32 @exit(i32 %95)
unreachable
}