#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;
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ fd_set;
typedef int /*<<< orphan*/ address;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
scalar_t__ FD_ISSET(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_SET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_SETSIZE;
int /*<<< orphan*/ FD_ZERO(int /*<<< orphan*/ *);
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ close(int);
int connect(int, struct sockaddr *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ inet_addr(char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ read(int, char *, int);
int select(int /*<<< orphan*/, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
           int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
scalar_t__ strncmp(char *, char *, int);
int /*<<< orphan*/ write(int, char *, int);
int main(int argc, char **argv) {
  int sockfd;
  struct sockaddr_in address;
  int result;
  char message[250 + 1] = {'\0'};
  fd_set readfds, testfds;
  char name[25];
  if (argc < 2) {
    puts("Please input your name:");
    fgets(name, 25, stdin);
    name[strlen(name) - 1] = '\0';
  } else
    strcpy(name, argv[1]);
  sockfd = socket(AF_INET, SOCK_STREAM, 0);
  address.sin_family = AF_INET;
  address.sin_addr.s_addr = inet_addr("127.0.0.1");
  address.sin_port = htons(9734);
  result = connect(sockfd, (struct sockaddr *)&address, sizeof(address));
  if (result == -1) {
    perror("oops: client");
    exit(1);
  }
  FD_ZERO(&readfds);
  FD_SET(sockfd, &readfds);
  FD_SET(0, &readfds);
  FILE *record;
  char filename[50];
  sprintf(filename, "%s_%s", argv[1], "record.txt");
  record = fopen(filename, "a");
  write(sockfd, name, 250);
  while (1) {
    int quit = 0;
    testfds = readfds;
    result = select(FD_SETSIZE, &testfds, NULL, NULL, NULL);
    if (FD_ISSET(0, &testfds)) {
      fgets(message, 250, stdin);
      message[strlen(message) - 1] = '\0';
      write(sockfd, message, 250);
      if (strncmp(message, "quit", 4) == 0)
        quit = 1;
      ;
    }
    read(sockfd, message, 250);
    printf("%s\n", message);
    fprintf(record, "%s\n", message);
    fflush(record);
    if (quit)
      break;
  }
  fclose(record);
  close(sockfd);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1a0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x120(%rbp),%rdi
xor    %esi,%esi
mov    $0xfb,%edx
call   10c0 <memset@plt>
cmpl   $0x2,-0x8(%rbp)
jge    130a <main+0x7a>
lea    0xd33(%rip),%rdi
call   1050 <puts@plt>
lea    -0x150(%rbp),%rdi
mov    0x2d00(%rip),%rax
mov    (%rax),%edx
mov    $0x19,%esi
call   10f0 <fgets@plt>
lea    -0x150(%rbp),%rdi
call   1090 <strlen@plt>
sub    $0x1,%eax
cltq
movb   $0x0,-0x150(%rbp,%rax,1)
jmp    131e <main+0x8e>
lea    -0x150(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1040 <strcpy@plt>
mov    0x2cc3(%rip),%rax
mov    (%rax),%edi
mov    0x2ca2(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   11b0 <socket@plt>
mov    %eax,-0x14(%rbp)
mov    0x2ca7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
lea    0xccb(%rip),%rdi
call   1100 <inet_addr@plt>
mov    %eax,-0x1c(%rbp)
mov    $0x2606,%edi
call   10a0 <htons@plt>
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0xc,%edx
call   1190 <connect@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0xffffffff,-0x24(%rbp)
jne    1396 <main+0x106>
lea    0xc9b(%rip),%rdi
call   1160 <perror@plt>
mov    $0x1,%edi
call   1180 <exit@plt>
lea    -0x124(%rbp),%rdi
call   1120 <FD_ZERO@plt>
mov    -0x14(%rbp),%edi
lea    -0x124(%rbp),%rsi
call   11a0 <FD_SET@plt>
xor    %edi,%edi
lea    -0x124(%rbp),%rsi
call   11a0 <FD_SET@plt>
lea    -0x190(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xc5a(%rip),%rsi
lea    0xc59(%rip),%rcx
call   1170 <sprintf@plt>
lea    -0x190(%rbp),%rdi
lea    0xc51(%rip),%rsi
call   1150 <fopen@plt>
mov    %rax,-0x158(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x150(%rbp),%rsi
mov    $0xfa,%edx
call   1060 <write@plt>
movl   $0x0,-0x194(%rbp)
mov    -0x124(%rbp),%eax
mov    %eax,-0x128(%rbp)
mov    0x2b9c(%rip),%rax
mov    (%rax),%edi
lea    -0x128(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%r8d
mov    %r8,%rdx
mov    %r8,%rcx
call   1130 <select@plt>
mov    %eax,-0x24(%rbp)
xor    %edi,%edi
lea    -0x128(%rbp),%rsi
call   1070 <FD_ISSET@plt>
cmp    $0x0,%rax
je     14d8 <main+0x248>
lea    -0x120(%rbp),%rdi
mov    0x2b72(%rip),%rax
mov    (%rax),%edx
mov    $0xfa,%esi
call   10f0 <fgets@plt>
lea    -0x120(%rbp),%rdi
call   1090 <strlen@plt>
sub    $0x1,%eax
cltq
movb   $0x0,-0x120(%rbp,%rax,1)
mov    -0x14(%rbp),%edi
lea    -0x120(%rbp),%rsi
mov    $0xfa,%edx
call   1060 <write@plt>
lea    -0x120(%rbp),%rdi
lea    0xb8d(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    14d3 <main+0x243>
movl   $0x1,-0x194(%rbp)
jmp    14d8 <main+0x248>
mov    -0x14(%rbp),%edi
lea    -0x120(%rbp),%rsi
mov    $0xfa,%edx
call   10e0 <read@plt>
lea    -0x120(%rbp),%rsi
lea    0xb4d(%rip),%rdi
call   10b0 <printf@plt>
mov    -0x158(%rbp),%rdi
lea    -0x120(%rbp),%rdx
lea    0xb33(%rip),%rsi
call   1110 <fprintf@plt>
mov    -0x158(%rbp),%rdi
call   1140 <fflush@plt>
cmpl   $0x0,-0x194(%rbp)
je     1537 <main+0x2a7>
jmp    153c <main+0x2ac>
jmp    140f <main+0x17f>
mov    -0x158(%rbp),%rdi
call   1080 <fclose@plt>
mov    -0x14(%rbp),%edi
call   10d0 <close@plt>
xor    %edi,%edi
call   1180 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x178,%rsp
mov    %rsi,%rbx
xorps  %xmm0,%xmm0
movups %xmm0,0x12b(%rsp)
movaps %xmm0,0x120(%rsp)
movaps %xmm0,0x110(%rsp)
movaps %xmm0,0x100(%rsp)
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
cmp    $0x1,%edi
jg     1348 <main+0xc8>
lea    0xce9(%rip),%rdi
call   1050 <puts@plt>
mov    0x2cbd(%rip),%rax
mov    (%rax),%edx
lea    0x20(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x19,%esi
call   10e0 <fgets@plt>
mov    %rbp,%rdi
call   1090 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbp,1)
jmp    1356 <main+0xd6>
mov    0x8(%rbx),%rsi
lea    0x20(%rsp),%rdi
call   1040 <strcpy@plt>
mov    0x2c8b(%rip),%rbp
mov    0x0(%rbp),%edi
mov    0x2c69(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   11a0 <socket@plt>
mov    %eax,%r14d
mov    0x0(%rbp),%eax
mov    %eax,0x18(%rsp)
lea    0xc97(%rip),%rdi
call   10f0 <inet_addr@plt>
mov    %eax,0x14(%rsp)
mov    $0x2606,%edi
call   10a0 <htons@plt>
mov    %eax,0x10(%rsp)
lea    0x10(%rsp),%rsi
mov    %r14d,%edi
mov    $0xc,%edx
call   1180 <connect@plt>
cmp    $0xffffffff,%eax
jne    13c5 <main+0x145>
lea    0xc6c(%rip),%rdi
call   1150 <perror@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
lea    0xc(%rsp),%rbp
mov    %rbp,%rdi
call   1110 <FD_ZERO@plt>
mov    %r14d,%edi
mov    %rbp,%rsi
call   1190 <FD_SET@plt>
xor    %edi,%edi
mov    %rbp,%rsi
call   1190 <FD_SET@plt>
mov    0x8(%rbx),%rdx
lea    0xc3d(%rip),%rsi
lea    0xc3c(%rip),%rcx
lea    0x140(%rsp),%rbx
mov    %rbx,%rdi
call   1160 <sprintf@plt>
lea    0xc30(%rip),%rsi
mov    %rbx,%rdi
call   1140 <fopen@plt>
mov    %rax,%rbx
lea    0x20(%rsp),%rsi
mov    %r14d,%edi
mov    $0xfa,%edx
call   1060 <write@plt>
lea    0x8(%rsp),%r15
lea    0x40(%rsp),%rbp
lea    0xc09(%rip),%r12
jmp    1471 <main+0x1f1>
mov    %r14d,%edi
mov    %rbp,%rsi
mov    $0xfa,%edx
call   10d0 <read@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
call   10b0 <printf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %rbp,%rdx
call   1100 <fprintf@plt>
mov    %rbx,%rdi
call   1130 <fflush@plt>
mov    0xc(%rsp),%eax
mov    %eax,0x8(%rsp)
mov    0x2b48(%rip),%rax
mov    (%rax),%edi
mov    %r15,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1120 <select@plt>
xor    %edi,%edi
mov    %r15,%rsi
call   1070 <FD_ISSET@plt>
test   %rax,%rax
je     1440 <main+0x1c0>
mov    0x2b39(%rip),%rax
mov    (%rax),%edx
mov    %rbp,%rdi
mov    $0xfa,%esi
call   10e0 <fgets@plt>
mov    %rbp,%rdi
call   1090 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbp,1)
mov    %r14d,%edi
mov    %rbp,%rsi
mov    $0xfa,%edx
call   1060 <write@plt>
mov    %rbp,%rdi
lea    0xb63(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
mov    %rax,%r13
mov    %r14d,%edi
mov    %rbp,%rsi
mov    $0xfa,%edx
call   10d0 <read@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
call   10b0 <printf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %rbp,%rdx
call   1100 <fprintf@plt>
mov    %rbx,%rdi
call   1130 <fflush@plt>
test   %r13,%r13
jne    1471 <main+0x1f1>
mov    %rbx,%rdi
call   1080 <fclose@plt>
mov    %r14d,%edi
call   10c0 <close@plt>
xor    %edi,%edi
call   1170 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [24 x i8] c"Please input your name:\00"
@stdin = global i32 0
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [10 x i8] c"127.0.0.1\00"
@.str.2 = [13 x i8] c"oops: client\00"
@.str.3 = [6 x i8] c"%s_%s\00"
@.str.4 = [11 x i8] c"record.txt\00"
@.str.5 = [2 x i8] c"a\00"
@FD_SETSIZE = global i32 0
@.str.6 = [5 x i8] c"quit\00"
@.str.7 = [4 x i8] c"%s\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 i32
%9 = alloca [251 x i8]
%10 = alloca i32
%11 = alloca i32
%12 = alloca [25 x i8]
%13 = alloca i32*
%14 = alloca [50 x i8]
%15 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%16 = bitcast [251 x i8]* %9 to i8*
%17 = load i32, i32* %4
%18 = icmp slt i32 %17, 2
br i1 %18, label %19, label %29
19: ; preds = %2
%20 = call i32 @puts(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%21 = getelementptr inbounds [25 x i8], [25 x i8]* %12, i64 0, i64 0
%22 = load i32, i32* @stdin
%23 = call i32 @fgets(i8* %21, i32 25, i32 %22)
%24 = getelementptr inbounds [25 x i8], [25 x i8]* %12, i64 0, i64 0
%25 = call i32 @strlen(i8* %24)
%26 = sub nsw i32 %25, 1
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [25 x i8], [25 x i8]* %12, i64 0, i64 %27
store i8 0, i8* %28
br label %35
29: ; preds = %2
%30 = getelementptr inbounds [25 x i8], [25 x i8]* %12, i64 0, i64 0
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
%34 = call i32 @strcpy(i8* %30, i8* %33)
br label %35
35: ; preds = %29, %19
%36 = load i32, i32* @AF_INET
%37 = load i32, i32* @SOCK_STREAM
%38 = call i32 @socket(i32 %36, i32 %37, i32 0)
store i32 %38, i32* %6
%39 = load i32, i32* @AF_INET
%40 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 2
store i32 %39, i32* %40
%41 = call i32 @inet_addr(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%42 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 1
%43 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %42, i32 0, i32 0
store i32 %41, i32* %43
%44 = call i32 @htons(i32 9734)
%45 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 0
store i32 %44, i32* %45
%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)
store i32 %48, i32* %8
%49 = load i32, i32* %8
%50 = icmp eq i32 %49, -1
br i1 %50, label %51, label %54
51: ; preds = %35
%52 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%53 = call i32 @exit(i32 1)
unreachable
54: ; preds = %35
%55 = call i32 @FD_ZERO(i32* %10)
%56 = load i32, i32* %6
%57 = call i32 @FD_SET(i32 %56, i32* %10)
%58 = call i32 @FD_SET(i32 0, i32* %10)
%59 = getelementptr inbounds [50 x i8], [50 x i8]* %14, i64 0, i64 0
%60 = load i8**, i8*** %5
%61 = getelementptr inbounds i8*, i8** %60, i64 1
%62 = load i8*, i8** %61
%63 = call i32 @sprintf(i8* %59, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %62, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%64 = getelementptr inbounds [50 x i8], [50 x i8]* %14, i64 0, i64 0
%65 = call i32* @fopen(i8* %64, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %65, i32** %13
%66 = load i32, i32* %6
%67 = getelementptr inbounds [25 x i8], [25 x i8]* %12, i64 0, i64 0
%68 = call i32 @write(i32 %66, i8* %67, i32 250)
br label %69
69: ; preds = %54, %106
store i32 0, i32* %15
%70 = load i32, i32* %10
store i32 %70, i32* %11
%71 = load i32, i32* @FD_SETSIZE
%72 = call i32 @select(i32 %71, i32* %11, i32* null, i32* null, i32* null)
store i32 %72, i32* %8
%73 = call i64 @FD_ISSET(i32 0, i32* %11)
%74 = icmp ne i64 %73, 0
br i1 %74, label %75, label %92
75: ; preds = %69
%76 = getelementptr inbounds [251 x i8], [251 x i8]* %9, i64 0, i64 0
%77 = load i32, i32* @stdin
%78 = call i32 @fgets(i8* %76, i32 250, i32 %77)
%79 = getelementptr inbounds [251 x i8], [251 x i8]* %9, i64 0, i64 0
%80 = call i32 @strlen(i8* %79)
%81 = sub nsw i32 %80, 1
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds [251 x i8], [251 x i8]* %9, i64 0, i64 %82
store i8 0, i8* %83
%84 = load i32, i32* %6
%85 = getelementptr inbounds [251 x i8], [251 x i8]* %9, i64 0, i64 0
%86 = call i32 @write(i32 %84, i8* %85, i32 250)
%87 = getelementptr inbounds [251 x i8], [251 x i8]* %9, i64 0, i64 0
%88 = call i64 @strncmp(i8* %87, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 4)
%89 = icmp eq i64 %88, 0
br i1 %89, label %90, label %91
90: ; preds = %75
store i32 1, i32* %15
br label %91
91: ; preds = %90, %75
br label %92
92: ; preds = %91, %69
%93 = load i32, i32* %6
%94 = getelementptr inbounds [251 x i8], [251 x i8]* %9, i64 0, i64 0
%95 = call i32 @read(i32 %93, i8* %94, i32 250)
%96 = getelementptr inbounds [251 x i8], [251 x i8]* %9, i64 0, i64 0
%97 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %96)
%98 = load i32*, i32** %13
%99 = getelementptr inbounds [251 x i8], [251 x i8]* %9, i64 0, i64 0
%100 = call i32 @fprintf(i32* %98, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %99)
%101 = load i32*, i32** %13
%102 = call i32 @fflush(i32* %101)
%103 = load i32, i32* %15
%104 = icmp ne i32 %103, 0
br i1 %104, label %105, label %106
105: ; preds = %92
br label %107
106: ; preds = %92
br label %69
107: ; preds = %105
%108 = load i32*, i32** %13
%109 = call i32 @fclose(i32* %108)
%110 = load i32, i32* %6
%111 = call i32 @close(i32 %110)
%112 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [24 x i8] c"Please input your name:\00"
@stdin = global i32 0
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [10 x i8] c"127.0.0.1\00"
@.str.2 = [13 x i8] c"oops: client\00"
@.str.3 = [6 x i8] c"%s_%s\00"
@.str.4 = [11 x i8] c"record.txt\00"
@.str.5 = [2 x i8] c"a\00"
@FD_SETSIZE = global i32 0
@.str.6 = [5 x i8] c"quit\00"
@.str.7 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca [251 x i8]
%5 = alloca i32
%6 = alloca i32
%7 = alloca [25 x i8]
%8 = alloca [50 x i8]
%9 = bitcast %struct.sockaddr_in* %3 to i8*
%10 = getelementptr inbounds [251 x i8], [251 x i8]* %4, i64 0, i64 0
%11 = bitcast i32* %5 to i8*
%12 = bitcast i32* %6 to i8*
%13 = getelementptr inbounds [25 x i8], [25 x i8]* %7, i64 0, i64 0
%14 = icmp slt i32 %0, 2
br i1 %14, label %15, label %23
15: ; preds = %2
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%17 = load i32, i32* @stdin
%18 = call i32 @fgets(i8* %13, i32 25, i32 %17)
%19 = call i32 @strlen(i8* %13)
%20 = add nsw i32 %19, -1
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [25 x i8], [25 x i8]* %7, i64 0, i64 %21
store i8 0, i8* %22
br label %27
23: ; preds = %2
%24 = getelementptr inbounds i8*, i8** %1, i64 1
%25 = load i8*, i8** %24
%26 = call i32 @strcpy(i8* %13, i8* %25)
br label %27
27: ; preds = %23, %15
%28 = load i32, i32* @AF_INET
%29 = load i32, i32* @SOCK_STREAM
%30 = call i32 @socket(i32 %28, i32 %29, i32 0)
%31 = load i32, i32* @AF_INET
%32 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %31, i32* %32
%33 = call i32 @inet_addr(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%34 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1, i32 0
store i32 %33, i32* %34
%35 = call i32 @htons(i32 9734)
%36 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
store i32 %35, i32* %36
%37 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%38 = call i32 @connect(i32 %30, %struct.sockaddr* %37, i32 12)
%39 = icmp eq i32 %38, -1
br i1 %39, label %40, label %43
40: ; preds = %27
%41 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%42 = call i32 @exit(i32 1)
unreachable
43: ; preds = %27
%44 = call i32 @FD_ZERO(i32* %5)
%45 = call i32 @FD_SET(i32 %30, i32* %5)
%46 = call i32 @FD_SET(i32 0, i32* %5)
%47 = getelementptr inbounds [50 x i8], [50 x i8]* %8, i64 0, i64 0
%48 = getelementptr inbounds i8*, i8** %1, i64 1
%49 = load i8*, i8** %48
%50 = call i32 @sprintf(i8* %47, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %49, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%51 = call i32* @fopen(i8* %47, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%52 = call i32 @write(i32 %30, i8* %13, i32 250)
br label %58
53: ; preds = %58
%54 = call i32 @read(i32 %30, i8* %10, i32 250)
%55 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %10)
%56 = call i32 @fprintf(i32* %51, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %10)
%57 = call i32 @fflush(i32* %51)
br label %78
58: ; preds = %78, %43
%59 = load i32, i32* %5
store i32 %59, i32* %6
%60 = load i32, i32* @FD_SETSIZE
%61 = call i32 @select(i32 %60, i32* %6, i32* null, i32* null, i32* null)
%62 = call i64 @FD_ISSET(i32 0, i32* %6)
%63 = icmp eq i64 %62, 0
br i1 %63, label %53, label %64
64: ; preds = %58
%65 = load i32, i32* @stdin
%66 = call i32 @fgets(i8* %10, i32 250, i32 %65)
%67 = call i32 @strlen(i8* %10)
%68 = add nsw i32 %67, -1
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [251 x i8], [251 x i8]* %4, i64 0, i64 %69
store i8 0, i8* %70
%71 = call i32 @write(i32 %30, i8* %10, i32 250)
%72 = call i64 @strncmp(i8* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i32 4)
%73 = icmp eq i64 %72, 0
%74 = call i32 @read(i32 %30, i8* %10, i32 250)
%75 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %10)
%76 = call i32 @fprintf(i32* %51, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %10)
%77 = call i32 @fflush(i32* %51)
br i1 %73, label %79, label %78
78: ; preds = %64, %53
br label %58
79: ; preds = %64
%80 = call i32 @fclose(i32* %51)
%81 = call i32 @close(i32 %30)
%82 = call i32 @exit(i32 0)
unreachable
}