#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;
};
typedef int /*<<< orphan*/ servaddr;
typedef int /*<<< orphan*/ sendletter;
typedef int /*<<< orphan*/ recvletter;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ close(int);
int connect(int, struct sockaddr *, int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ htons(int);
scalar_t__ inet_pton(int /*<<< orphan*/, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ memset(struct sockaddr_in *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int recv(int, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ scanf(char *, char *);
int send(int, char *, int, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
char *strerror(int /*<<< orphan*/);
scalar_t__ strncmp(char *, char *, int);
int main(int argc, char **argv) {
  int sockfd;
  struct sockaddr_in servaddr;
  char sendletter;
  char recvletter;
  if (argc != 2) {
    printf("usage: ./client <server_ip>\n");
    return -1;
  }
  if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
    printf("socket error: %s\n", strerror(errno));
    return -1;
  }
  memset(&servaddr, 0, sizeof(servaddr));
  servaddr.sin_family = AF_INET;
  servaddr.sin_port = htons(8000);
  if (inet_pton(AF_INET, argv[1], &servaddr.sin_addr) <= 0) {
    printf("inet_pton error: %s, ip is %s\n", strerror(errno), argv[1]);
    close(sockfd);
    return -1;
  }
  if (connect(sockfd, (struct sockaddr *)&servaddr, sizeof(servaddr)) == -1) {
    printf("connect error: %s\n", strerror(errno));
    close(sockfd);
    return -1;
  }
  while (1) {
    printf("\ninput a character:\n\talphabet - convert between upper and "
           "lower\n\tdigit 0 - quit\n");
    printf("\n\tyour characer: ");
    scanf("%c", &sendletter);
    getchar();
    if (strncmp(&sendletter, "0", 1) == 0) {
      printf("quit\n");
      break;
    }
    if (send(sockfd, &sendletter, sizeof(sendletter), 0) == -1) {
      printf("send error: %s\n", strerror(errno));
      break;
    }
    if (recv(sockfd, &recvletter, sizeof(recvletter), 0) == -1) {
      printf("recv error: %s\n", strerror(errno));
      break;
    }
    printf("\tfrom [%c] to [%c]\n", sendletter, recvletter);
  }
  close(sockfd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     120a <main+0x3a>
lea    0xe09(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1443 <main+0x273>
mov    0x2dd7(%rip),%rax
mov    (%rax),%edi
mov    0x2dbe(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10f0 <socket@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    125a <main+0x8a>
mov    0x2d9a(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    %rax,%rsi
lea    0xdd6(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1443 <main+0x273>
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1080 <memset@plt>
mov    0x2d77(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    $0x1f40,%edi
call   1050 <htons@plt>
mov    %eax,-0x1c(%rbp)
mov    0x2d5e(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    -0x20(%rbp),%rdx
call   10b0 <inet_pton@plt>
cmp    $0x0,%rax
jg     12e2 <main+0x112>
mov    0x2d22(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    %rax,%rsi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xd68(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x14(%rbp),%edi
call   1090 <close@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1443 <main+0x273>
mov    -0x14(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0xc,%edx
call   10d0 <connect@plt>
cmp    $0xffffffff,%eax
jne    132f <main+0x15f>
mov    0x2ccd(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    %rax,%rsi
lea    0xd3a(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x14(%rbp),%edi
call   1090 <close@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1443 <main+0x273>
jmp    1334 <main+0x164>
lea    0xd26(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xd69(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xd6d(%rip),%rdi
lea    -0x21(%rbp),%rsi
call   10c0 <scanf@plt>
mov    $0x0,%al
call   10a0 <getchar@plt>
lea    -0x21(%rbp),%rdi
lea    0xd55(%rip),%rsi
mov    $0x1,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1399 <main+0x1c9>
lea    0xd1f(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1434 <main+0x264>
mov    -0x14(%rbp),%edi
lea    -0x21(%rbp),%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
cmp    $0xffffffff,%eax
jne    13d9 <main+0x209>
mov    0x2c14(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    %rax,%rsi
lea    0xcfc(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1434 <main+0x264>
mov    -0x14(%rbp),%edi
lea    -0x22(%rbp),%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
cmp    $0xffffffff,%eax
jne    1419 <main+0x249>
mov    0x2bd4(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    %rax,%rsi
lea    0xccc(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1434 <main+0x264>
movsbl -0x21(%rbp),%esi
movsbl -0x22(%rbp),%edx
lea    0xcc1(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1334 <main+0x164>
mov    -0x14(%rbp),%edi
call   1090 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
cmp    $0x2,%edi
jne    1390 <main+0x1b0>
mov    %rsi,%rbx
mov    0x2de7(%rip),%rbp
mov    0x0(%rbp),%edi
mov    0x2dcd(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1100 <socket@plt>
test   %eax,%eax
js     13a6 <main+0x1c6>
mov    %eax,%r13d
lea    0x8(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1090 <memset@plt>
mov    0x0(%rbp),%eax
mov    %eax,0x10(%rsp)
mov    $0x1f40,%edi
call   1060 <htons@plt>
mov    %eax,0xc(%rsp)
mov    0x0(%rbp),%edi
mov    0x8(%rbx),%rsi
mov    %r14,%rdx
call   10c0 <inet_pton@plt>
test   %rax,%rax
jle    13cf <main+0x1ef>
lea    0x8(%rsp),%rsi
mov    %r13d,%edi
mov    $0xc,%edx
call   10e0 <connect@plt>
cmp    $0xffffffff,%eax
je     13f4 <main+0x214>
lea    0xe0d(%rip),%rdi
call   1050 <puts@plt>
lea    0xdb6(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xdba(%rip),%rdi
lea    0x6(%rsp),%rbx
mov    %rbx,%rsi
call   10d0 <scanf@plt>
xor    %eax,%eax
call   10b0 <getchar@plt>
lea    0xda2(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     137f <main+0x19f>
lea    0x6(%rsp),%rbx
lea    0x7(%rsp),%r14
lea    0xd66(%rip),%rbp
lea    0xd71(%rip),%r15
lea    0xd6d(%rip),%r12
nopl   0x0(%rax)
mov    %r13d,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1070 <send@plt>
cmp    $0xffffffff,%eax
je     1422 <main+0x242>
mov    %r13d,%edi
mov    %r14,%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
cmp    $0xffffffff,%eax
je     1439 <main+0x259>
movsbl 0x6(%rsp),%esi
movsbl 0x7(%rsp),%edx
lea    0xd44(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xd4a(%rip),%rdi
call   1050 <puts@plt>
mov    %rbp,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   10d0 <scanf@plt>
xor    %eax,%eax
call   10b0 <getchar@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0x1,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
jne    12f0 <main+0x110>
lea    0xd54(%rip),%rdi
call   1050 <puts@plt>
jmp    1458 <main+0x278>
lea    0xd48(%rip),%rdi
call   1050 <puts@plt>
mov    $0xffffffff,%eax
jmp    1462 <main+0x282>
mov    0x2c23(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
lea    0xc45(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0xffffffff,%eax
jmp    1462 <main+0x282>
mov    0x2bfa(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    0x8(%rbx),%rdx
lea    0xc2a(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
jmp    1413 <main+0x233>
mov    0x2bd5(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
lea    0xc28(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r13d,%edi
call   10a0 <close@plt>
mov    $0xffffffff,%eax
jmp    1462 <main+0x282>
mov    0x2ba7(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
lea    0xc24(%rip),%rdi
jmp    144e <main+0x26e>
mov    0x2b90(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
lea    0xc1d(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r13d,%edi
call   10a0 <close@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.sockaddr = type { i32 }
@.str = [29 x i8] c"usage: ./client <server_ip>\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [18 x i8] c"socket error: %s\0A\00"
@errno = global i32 0
@.str.2 = [31 x i8] c"inet_pton error: %s, ip is %s\0A\00"
@.str.3 = [19 x i8] c"connect error: %s\0A\00"
@.str.4 = [81 x i8] c"\0Ainput a character:\0A\09alphabet - convert between upper and lower\0A\09digit 0 - quit\0A\00"
@.str.5 = [18 x i8] c"\0A\09your characer: \00"
@.str.6 = [3 x i8] c"%c\00"
@.str.7 = [2 x i8] c"0\00"
@.str.8 = [6 x i8] c"quit\0A\00"
@.str.9 = [16 x i8] c"send error: %s\0A\00"
@.str.10 = [16 x i8] c"recv error: %s\0A\00"
@.str.11 = [20 x i8] c"\09from [%c] to [%c]\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca %struct.sockaddr_in
%8 = alloca i8
%9 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 2
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %91
14: ; preds = %2
%15 = load i32, i32* @AF_INET
%16 = load i32, i32* @SOCK_STREAM
%17 = call i32 @socket(i32 %15, i32 %16, i32 0)
store i32 %17, i32* %6
%18 = icmp slt i32 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %14
%20 = load i32, i32* @errno
%21 = call i8* @strerror(i32 %20)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %21)
store i32 -1, i32* %3
br label %91
23: ; preds = %14
%24 = call i32 @memset(%struct.sockaddr_in* %7, i32 0, i32 12)
%25 = load i32, i32* @AF_INET
%26 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 2
store i32 %25, i32* %26
%27 = call i32 @htons(i32 8000)
%28 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 1
store i32 %27, i32* %28
%29 = load i32, i32* @AF_INET
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 1
%32 = load i8*, i8** %31
%33 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 0
%34 = call i64 @inet_pton(i32 %29, i8* %32, i32* %33)
%35 = icmp sle i64 %34, 0
br i1 %35, label %36, label %45
36: ; preds = %23
%37 = load i32, i32* @errno
%38 = call i8* @strerror(i32 %37)
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 1
%41 = load i8*, i8** %40
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8* %38, i8* %41)
%43 = load i32, i32* %6
%44 = call i32 @close(i32 %43)
store i32 -1, i32* %3
br label %91
45: ; preds = %23
%46 = load i32, i32* %6
%47 = bitcast %struct.sockaddr_in* %7 to %struct.sockaddr*
%48 = call i32 @connect(i32 %46, %struct.sockaddr* %47, i32 12)
%49 = icmp eq i32 %48, -1
br i1 %49, label %50, label %56
50: ; preds = %45
%51 = load i32, i32* @errno
%52 = call i8* @strerror(i32 %51)
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %52)
%54 = load i32, i32* %6
%55 = call i32 @close(i32 %54)
store i32 -1, i32* %3
br label %91
56: ; preds = %45
br label %57
57: ; preds = %56, %82
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str.4, i64 0, i64 0))
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%60 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %8)
%61 = call i32 (...) @getchar()
%62 = call i64 @strncmp(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i32 1)
%63 = icmp eq i64 %62, 0
br i1 %63, label %64, label %66
64: ; preds = %57
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
br label %88
66: ; preds = %57
%67 = load i32, i32* %6
%68 = call i32 @send(i32 %67, i8* %8, i32 1, i32 0)
%69 = icmp eq i32 %68, -1
br i1 %69, label %70, label %74
70: ; preds = %66
%71 = load i32, i32* @errno
%72 = call i8* @strerror(i32 %71)
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), i8* %72)
br label %88
74: ; preds = %66
%75 = load i32, i32* %6
%76 = call i32 @recv(i32 %75, i8* %9, i32 1, i32 0)
%77 = icmp eq i32 %76, -1
br i1 %77, label %78, label %82
78: ; preds = %74
%79 = load i32, i32* @errno
%80 = call i8* @strerror(i32 %79)
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0), i8* %80)
br label %88
82: ; preds = %74
%83 = load i8, i8* %8
%84 = sext i8 %83 to i32
%85 = load i8, i8* %9
%86 = sext i8 %85 to i32
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0), i32 %84, i32 %86)
br label %57
88: ; preds = %78, %70, %64
%89 = load i32, i32* %6
%90 = call i32 @close(i32 %89)
store i32 0, i32* %3
br label %91
91: ; preds = %88, %50, %36, %19, %12
%92 = load i32, i32* %3
ret i32 %92
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [18 x i8] c"socket error: %s\0A\00"
@errno = global i32 0
@.str.2 = [31 x i8] c"inet_pton error: %s, ip is %s\0A\00"
@.str.3 = [19 x i8] c"connect error: %s\0A\00"
@.str.5 = [18 x i8] c"\0A\09your characer: \00"
@.str.6 = [3 x i8] c"%c\00"
@.str.7 = [2 x i8] c"0\00"
@.str.9 = [16 x i8] c"send error: %s\0A\00"
@.str.10 = [16 x i8] c"recv error: %s\0A\00"
@.str.11 = [20 x i8] c"\09from [%c] to [%c]\0A\00"
@str = [80 x i8] c"\0Ainput a character:\0A\09alphabet - convert between upper and lower\0A\09digit 0 - quit\00"
@str.12 = [5 x i8] c"quit\00"
@str.13 = [28 x i8] c"usage: ./client <server_ip>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca i8
%5 = alloca i8
%6 = bitcast %struct.sockaddr_in* %3 to i8*
%7 = icmp eq i32 %0, 2
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.13, i64 0, i64 0))
br label %83
10: ; preds = %2
%11 = load i32, i32* @AF_INET
%12 = load i32, i32* @SOCK_STREAM
%13 = tail call i32 @socket(i32 %11, i32 %12, i32 0)
%14 = icmp slt i32 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %10
%16 = load i32, i32* @errno
%17 = tail call i8* @strerror(i32 %16)
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %17)
br label %83
19: ; preds = %10
%20 = call i32 @memset(%struct.sockaddr_in* %3, i32 0, i32 12)
%21 = load i32, i32* @AF_INET
%22 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %21, i32* %22
%23 = call i32 @htons(i32 8000)
%24 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1
store i32 %23, i32* %24
%25 = load i32, i32* @AF_INET
%26 = getelementptr inbounds i8*, i8** %1, i64 1
%27 = load i8*, i8** %26
%28 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
%29 = call i64 @inet_pton(i32 %25, i8* %27, i32* %28)
%30 = icmp slt i64 %29, 1
br i1 %30, label %31, label %37
31: ; preds = %19
%32 = load i32, i32* @errno
%33 = call i8* @strerror(i32 %32)
%34 = load i8*, i8** %26
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8* %33, i8* %34)
%36 = call i32 @close(i32 %13)
br label %83
37: ; preds = %19
%38 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%39 = call i32 @connect(i32 %13, %struct.sockaddr* %38, i32 12)
%40 = icmp eq i32 %39, -1
br i1 %40, label %48, label %41
41: ; preds = %37
%42 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([80 x i8], [80 x i8]* @str, i64 0, i64 0))
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%44 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %4)
%45 = call i32 (...) @getchar()
%46 = call i64 @strncmp(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i32 1)
%47 = icmp eq i64 %46, 0
br i1 %47, label %53, label %55
48: ; preds = %37
%49 = load i32, i32* @errno
%50 = call i8* @strerror(i32 %49)
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %50)
%52 = call i32 @close(i32 %13)
br label %83
53: ; preds = %69, %41
%54 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.12, i64 0, i64 0))
br label %81
55: ; preds = %41, %69
%56 = call i32 @send(i32 %13, i8* %4, i32 1, i32 0)
%57 = icmp eq i32 %56, -1
br i1 %57, label %58, label %62
58: ; preds = %55
%59 = load i32, i32* @errno
%60 = call i8* @strerror(i32 %59)
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), i8* %60)
br label %81
62: ; preds = %55
%63 = call i32 @recv(i32 %13, i8* %5, i32 1, i32 0)
%64 = icmp eq i32 %63, -1
br i1 %64, label %65, label %69
65: ; preds = %62
%66 = load i32, i32* @errno
%67 = call i8* @strerror(i32 %66)
%68 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0), i8* %67)
br label %81
69: ; preds = %62
%70 = load i8, i8* %4
%71 = sext i8 %70 to i32
%72 = load i8, i8* %5
%73 = sext i8 %72 to i32
%74 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0), i32 %71, i32 %73)
%75 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([80 x i8], [80 x i8]* @str, i64 0, i64 0))
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%77 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %4)
%78 = call i32 (...) @getchar()
%79 = call i64 @strncmp(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i32 1)
%80 = icmp eq i64 %79, 0
br i1 %80, label %53, label %55
81: ; preds = %65, %58, %53
%82 = call i32 @close(i32 %13)
br label %83
83: ; preds = %81, %48, %31, %15, %8
%84 = phi i32 [ -1, %8 ], [ -1, %15 ], [ -1, %31 ], [ -1, %48 ], [ 0, %81 ]
ret i32 %84
}