#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_port;
  int /*<<< orphan*/ sin_addr;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
struct servent {
  int dummy;
};
struct hostent {
  int /*<<< orphan*/ h_length;
  int /*<<< orphan*/ h_addr;
};
typedef int /*<<< orphan*/ server;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SOCK_STREAM;
unsigned short atoi(char *);
int /*<<< orphan*/ bcopy(int /*<<< orphan*/, int /*<<< orphan*/ *,
                         int /*<<< orphan*/);
int /*<<< orphan*/ bzero(struct sockaddr_in *, int);
int /*<<< orphan*/ close(int);
int connect(int, struct sockaddr *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
struct hostent *gethostbyname(char *);
int /*<<< orphan*/ htons(unsigned short);
int /*<<< orphan*/ printf(char *);
int read(int, char *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int strlen(char *);
int /*<<< orphan*/ write(int, char *, int);
int main(int argc, char *argv[]) {
  int s;
  struct hostent *servhost;
  struct sockaddr_in server;
  struct servent *service;
  char buf[256];
  int read_size;
  char *host;
  char path[256] = "/";
  unsigned short port = 5000;
  if (argc < 3) {
    printf("usage: client [hostname] [port]\n");
    exit(1);
  }
  if (argc > 1) {
    host = (char *)argv[1];
  }
  if (argc > 2) {
    port = atoi(argv[2]);
  }
  servhost = gethostbyname(host);
  if (servhost == NULL) {
    fprintf(stderr, "[%s] から IP アドレスへの変換に失敗しました。\n", host);
    return 0;
  }
  bzero(&server, sizeof(server));
  server.sin_family = AF_INET;
  bcopy(servhost->h_addr, &server.sin_addr, servhost->h_length);
  server.sin_port = htons(port);
  if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
    fprintf(stderr, "ソケットの生成に失敗しました。\n");
    return 1;
  }
  if (connect(s, (struct sockaddr *)&server, sizeof(server)) == -1) {
    fprintf(stderr, "connect に失敗しました。\n");
    return 1;
  }
  read_size = read(s, buf, 256);
  if (read_size > 0) {
    write(1, buf, read_size);
  }
  printf("ここでサーバーからPLEASE INPUT YOUR "
         "NAMEと表示される.名前を入力してエンター");
  fgets(buf, 256, stdin);
  printf(
      "名前送信された。それと同時にyour id:とクライアント数,商品数表示された");
  write(s, buf, strlen(buf));
  read_size = read(s, buf, 256);
  if (read_size > 0) {
    write(1, buf, read_size);
  }
  printf("cccccc");
  read_size = read(s, buf, 256);
  if (read_size > 0) {
    write(1, buf, read_size);
  }
  printf("ddddddd");
  read_size = read(s, buf, 256);
  if (read_size > 0) {
    write(1, buf, read_size);
  }
  printf("ここで最初の入力待ち");
  while (1) {
    fgets(buf, 256, stdin);
    write(s, buf, strlen(buf));
    printf("ffffff");
    read_size = read(s, buf, 256);
    if (read_size > 0) {
      write(1, buf, read_size);
    }
    printf("ggggg");
    read_size = read(s, buf, 256);
    if (read_size > 0) {
      write(1, buf, read_size);
      printf("ここで次の入力待ち");
    }
  }
  close(s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x280,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x250(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1070 <memset@plt>
movb   $0x2f,-0x250(%rbp)
movw   $0x1388,-0x252(%rbp)
88 13
cmpl   $0x3,-0x8(%rbp)
jge    124c <main+0x5c>
lea    0xdc3(%rip),%rdi
call   1060 <printf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
cmpl   $0x1,-0x8(%rbp)
jle    1265 <main+0x75>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x150(%rbp)
cmpl   $0x2,-0x8(%rbp)
jle    1283 <main+0x93>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10e0 <atoi@plt>
mov    %ax,-0x252(%rbp)
mov    -0x150(%rbp),%rdi
call   10a0 <gethostbyname@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    12c8 <main+0xd8>
mov    0x2d2b(%rip),%rax
mov    (%rax),%edi
mov    -0x150(%rbp),%rdx
lea    0xd6c(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    160b <main+0x41b>
lea    -0x30(%rbp),%rdi
mov    $0xc,%esi
call   10d0 <bzero@plt>
mov    0x2d0b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    0x4(%rax),%edi
lea    -0x30(%rbp),%rsi
add    $0x4,%rsi
mov    -0x20(%rbp),%rax
mov    (%rax),%edx
call   10c0 <bcopy@plt>
movzwl -0x252(%rbp),%edi
call   1050 <htons@plt>
mov    %eax,-0x30(%rbp)
mov    0x2cd6(%rip),%rax
mov    (%rax),%edi
mov    0x2cad(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    1353 <main+0x163>
mov    0x2c99(%rip),%rax
mov    (%rax),%edi
lea    0xd22(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    160b <main+0x41b>
mov    -0x14(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0xc,%edx
call   1100 <connect@plt>
cmp    $0xffffffff,%eax
jne    1390 <main+0x1a0>
mov    0x2c5c(%rip),%rax
mov    (%rax),%edi
lea    0xd14(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    160b <main+0x41b>
mov    -0x14(%rbp),%edi
lea    -0x140(%rbp),%rsi
mov    $0x100,%edx
call   1080 <read@plt>
mov    %eax,-0x144(%rbp)
cmpl   $0x0,-0x144(%rbp)
jle    13ce <main+0x1de>
lea    -0x140(%rbp),%rsi
mov    -0x144(%rbp),%edx
mov    $0x1,%edi
call   1030 <write@plt>
lea    0xcde(%rip),%rdi
call   1060 <printf@plt>
lea    -0x140(%rbp),%rdi
mov    0x2bf8(%rip),%rax
mov    (%rax),%edx
mov    $0x100,%esi
call   1090 <fgets@plt>
lea    0xd1e(%rip),%rdi
call   1060 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x264(%rbp)
lea    -0x140(%rbp),%rax
mov    %rax,-0x260(%rbp)
lea    -0x140(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x264(%rbp),%edi
mov    -0x260(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    -0x14(%rbp),%edi
lea    -0x140(%rbp),%rsi
mov    $0x100,%edx
call   1080 <read@plt>
mov    %eax,-0x144(%rbp)
cmpl   $0x0,-0x144(%rbp)
jle    1475 <main+0x285>
lea    -0x140(%rbp),%rsi
mov    -0x144(%rbp),%edx
mov    $0x1,%edi
call   1030 <write@plt>
lea    0xd01(%rip),%rdi
call   1060 <printf@plt>
mov    -0x14(%rbp),%edi
lea    -0x140(%rbp),%rsi
mov    $0x100,%edx
call   1080 <read@plt>
mov    %eax,-0x144(%rbp)
cmpl   $0x0,-0x144(%rbp)
jle    14bf <main+0x2cf>
lea    -0x140(%rbp),%rsi
mov    -0x144(%rbp),%edx
mov    $0x1,%edi
call   1030 <write@plt>
lea    0xcbe(%rip),%rdi
call   1060 <printf@plt>
mov    -0x14(%rbp),%edi
lea    -0x140(%rbp),%rsi
mov    $0x100,%edx
call   1080 <read@plt>
mov    %eax,-0x144(%rbp)
cmpl   $0x0,-0x144(%rbp)
jle    1509 <main+0x319>
lea    -0x140(%rbp),%rsi
mov    -0x144(%rbp),%edx
mov    $0x1,%edi
call   1030 <write@plt>
lea    0xc7c(%rip),%rdi
call   1060 <printf@plt>
lea    -0x140(%rbp),%rdi
mov    0x2abd(%rip),%rax
mov    (%rax),%edx
mov    $0x100,%esi
call   1090 <fgets@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x274(%rbp)
lea    -0x140(%rbp),%rax
mov    %rax,-0x270(%rbp)
lea    -0x140(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x274(%rbp),%edi
mov    -0x270(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
lea    0xc3e(%rip),%rdi
call   1060 <printf@plt>
mov    -0x14(%rbp),%edi
lea    -0x140(%rbp),%rsi
mov    $0x100,%edx
call   1080 <read@plt>
mov    %eax,-0x144(%rbp)
cmpl   $0x0,-0x144(%rbp)
jle    15b0 <main+0x3c0>
lea    -0x140(%rbp),%rsi
mov    -0x144(%rbp),%edx
mov    $0x1,%edi
call   1030 <write@plt>
lea    0xbfb(%rip),%rdi
call   1060 <printf@plt>
mov    -0x14(%rbp),%edi
lea    -0x140(%rbp),%rsi
mov    $0x100,%edx
call   1080 <read@plt>
mov    %eax,-0x144(%rbp)
cmpl   $0x0,-0x144(%rbp)
jle    1606 <main+0x416>
lea    -0x140(%rbp),%rsi
mov    -0x144(%rbp),%edx
mov    $0x1,%edi
call   1030 <write@plt>
lea    0xbb7(%rip),%rdi
call   1060 <printf@plt>
jmp    1515 <main+0x325>
mov    -0x4(%rbp),%eax
add    $0x280,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x118,%rsp
cmp    $0x2,%edi
jle    148c <main+0x29c>
mov    0x8(%rsi),%rbp
mov    0x10(%rsi),%rdi
call   10e0 <atoi@plt>
mov    %eax,%r14d
mov    %rbp,%rdi
call   10a0 <gethostbyname@plt>
test   %rax,%rax
je     142c <main+0x23c>
mov    %rax,%rbx
mov    %rsp,%rdi
mov    $0xc,%esi
call   10d0 <bzero@plt>
mov    0x2da6(%rip),%rbp
mov    0x0(%rbp),%eax
mov    %eax,0x8(%rsp)
mov    (%rbx),%edx
mov    0x4(%rbx),%edi
lea    0x4(%rsp),%rsi
call   10c0 <bcopy@plt>
movzwl %r14w,%edi
call   1060 <htons@plt>
mov    %eax,(%rsp)
mov    0x0(%rbp),%edi
mov    0x2d5a(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
test   %eax,%eax
js     144a <main+0x25a>
mov    %eax,%ebp
mov    %rsp,%rsi
mov    %eax,%edi
mov    $0xc,%edx
call   1100 <connect@plt>
cmp    $0xffffffff,%eax
je     145c <main+0x26c>
lea    0x10(%rsp),%rsi
mov    %ebp,%edi
mov    $0x100,%edx
call   1080 <read@plt>
test   %eax,%eax
jle    12bf <main+0xcf>
lea    0x10(%rsp),%rsi
mov    $0x1,%edi
mov    %eax,%edx
call   1040 <write@plt>
lea    0xdcc(%rip),%rdi
call   1070 <printf@plt>
mov    0x2d0e(%rip),%r13
mov    0x0(%r13),%edx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x100,%esi
call   1090 <fgets@plt>
lea    0xe09(%rip),%rdi
call   1070 <printf@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x100,%edx
call   1080 <read@plt>
test   %eax,%eax
jle    132c <main+0x13c>
lea    0x10(%rsp),%rsi
mov    $0x1,%edi
mov    %eax,%edx
call   1040 <write@plt>
lea    0xe29(%rip),%rdi
call   1070 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %ebp,%edi
mov    $0x100,%edx
call   1080 <read@plt>
test   %eax,%eax
jle    135e <main+0x16e>
lea    0x10(%rsp),%rsi
mov    $0x1,%edi
mov    %eax,%edx
call   1040 <write@plt>
lea    0xdfe(%rip),%rdi
call   1070 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %ebp,%edi
mov    $0x100,%edx
call   1080 <read@plt>
lea    0xde9(%rip),%r14
test   %eax,%eax
jle    1397 <main+0x1a7>
lea    0x10(%rsp),%rsi
mov    $0x1,%edi
mov    %eax,%edx
call   1040 <write@plt>
mov    %r14,%rdi
call   1070 <printf@plt>
lea    0x10(%rsp),%rbx
lea    0xddf(%rip),%r15
lea    0xddf(%rip),%r12
lea    0xdde(%rip),%r14
jmp    13db <main+0x1eb>
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
call   1070 <printf@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x100,%edx
call   1080 <read@plt>
test   %eax,%eax
jg     1386 <main+0x196>
mov    0x0(%r13),%edx
mov    %rbx,%rdi
mov    $0x100,%esi
call   1090 <fgets@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    %r15,%rdi
call   1070 <printf@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x100,%edx
call   1080 <read@plt>
test   %eax,%eax
jle    13c0 <main+0x1d0>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
jmp    13c0 <main+0x1d0>
mov    0x2b9d(%rip),%rax
mov    (%rax),%edi
lea    0xbc4(%rip),%rsi
xor    %ebx,%ebx
mov    %rbp,%rdx
xor    %eax,%eax
call   10b0 <fprintf@plt>
jmp    1478 <main+0x288>
mov    0x2b7f(%rip),%rax
mov    (%rax),%edi
lea    0xbe7(%rip),%rsi
jmp    146c <main+0x27c>
mov    0x2b6d(%rip),%rax
mov    (%rax),%edi
lea    0xc04(%rip),%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x118,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd20(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>

LLVM IR (-O0):
%struct.hostent = type { i32, i32 }
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.servent = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [33 x i8] c"usage: client [hostname] [port]\0A\00"
@stderr = global i32 0
@.str.1 = [65 x i8] c"[%s] \E3\81\8B\E3\82\89 IP \E3\82\A2\E3\83\89\E3\83\AC\E3\82\B9\E3\81\B8\E3\81\AE\E5\A4\89\E6\8F\9B\E3\81\AB\E5\A4\B1\E6\95\97\E3\81\97\E3\81\BE\E3\81\97\E3\81\9F\E3\80\82\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.2 = [47 x i8] c"\E3\82\BD\E3\82\B1\E3\83\83\E3\83\88\E3\81\AE\E7\94\9F\E6\88\90\E3\81\AB\E5\A4\B1\E6\95\97\E3\81\97\E3\81\BE\E3\81\97\E3\81\9F\E3\80\82\0A\00"
@.str.3 = [34 x i8] c"connect \E3\81\AB\E5\A4\B1\E6\95\97\E3\81\97\E3\81\BE\E3\81\97\E3\81\9F\E3\80\82\0A\00"
@.str.4 = [102 x i8] c"\E3\81\93\E3\81\93\E3\81\A7\E3\82\B5\E3\83\BC\E3\83\90\E3\83\BC\E3\81\8B\E3\82\89PLEASE INPUT YOUR NAME\E3\81\A8\E8\A1\A8\E7\A4\BA\E3\81\95\E3\82\8C\E3\82\8B.\E5\90\8D\E5\89\8D\E3\82\92\E5\85\A5\E5\8A\9B\E3\81\97\E3\81\A6\E3\82\A8\E3\83\B3\E3\82\BF\E3\83\BC\00"
@stdin = global i32 0
@.str.5 = [100 x i8] c"\E5\90\8D\E5\89\8D\E9\80\81\E4\BF\A1\E3\81\95\E3\82\8C\E3\81\9F\E3\80\82\E3\81\9D\E3\82\8C\E3\81\A8\E5\90\8C\E6\99\82\E3\81\AByour id:\E3\81\A8\E3\82\AF\E3\83\A9\E3\82\A4\E3\82\A2\E3\83\B3\E3\83\88\E6\95\B0,\E5\95\86\E5\93\81\E6\95\B0\E8\A1\A8\E7\A4\BA\E3\81\95\E3\82\8C\E3\81\9F\00"
@.str.6 = [7 x i8] c"cccccc\00"
@.str.7 = [8 x i8] c"ddddddd\00"
@.str.8 = [31 x i8] c"\E3\81\93\E3\81\93\E3\81\A7\E6\9C\80\E5\88\9D\E3\81\AE\E5\85\A5\E5\8A\9B\E5\BE\85\E3\81\A1\00"
@.str.9 = [7 x i8] c"ffffff\00"
@.str.10 = [6 x i8] c"ggggg\00"
@.str.11 = [28 x i8] c"\E3\81\93\E3\81\93\E3\81\A7\E6\AC\A1\E3\81\AE\E5\85\A5\E5\8A\9B\E5\BE\85\E3\81\A1\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca %struct.hostent*
%8 = alloca %struct.sockaddr_in
%9 = alloca %struct.servent*
%10 = alloca [256 x i8]
%11 = alloca i32
%12 = alloca i8*
%13 = alloca [256 x i8]
%14 = alloca i16
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%15 = bitcast [256 x i8]* %13 to i8*
%16 = bitcast i8* %15 to [256 x i8]*
%17 = getelementptr inbounds [256 x i8], [256 x i8]* %16, i32 0, i32 0
store i8 47, i8* %17
store i16 5000, i16* %14
%18 = load i32, i32* %4
%19 = icmp slt i32 %18, 3
br i1 %19, label %20, label %23
20: ; preds = %2
%21 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%22 = call i32 @exit(i32 1)
unreachable
23: ; preds = %2
%24 = load i32, i32* %4
%25 = icmp sgt i32 %24, 1
br i1 %25, label %26, label %30
26: ; preds = %23
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
store i8* %29, i8** %12
br label %30
30: ; preds = %26, %23
%31 = load i32, i32* %4
%32 = icmp sgt i32 %31, 2
br i1 %32, label %33, label %38
33: ; preds = %30
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 2
%36 = load i8*, i8** %35
%37 = call zeroext i16 @atoi(i8* %36)
store i16 %37, i16* %14
br label %38
38: ; preds = %33, %30
%39 = load i8*, i8** %12
%40 = call %struct.hostent* @gethostbyname(i8* %39)
store %struct.hostent* %40, %struct.hostent** %7
%41 = load %struct.hostent*, %struct.hostent** %7
%42 = icmp eq %struct.hostent* %41, null
br i1 %42, label %43, label %47
43: ; preds = %38
%44 = load i32, i32* @stderr
%45 = load i8*, i8** %12
%46 = call i32 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0), i8* %45)
store i32 0, i32* %3
br label %163
47: ; preds = %38
%48 = call i32 @bzero(%struct.sockaddr_in* %8, i32 12)
%49 = load i32, i32* @AF_INET
%50 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 2
store i32 %49, i32* %50
%51 = load %struct.hostent*, %struct.hostent** %7
%52 = getelementptr inbounds %struct.hostent, %struct.hostent* %51, i32 0, i32 1
%53 = load i32, i32* %52
%54 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 1
%55 = load %struct.hostent*, %struct.hostent** %7
%56 = getelementptr inbounds %struct.hostent, %struct.hostent* %55, i32 0, i32 0
%57 = load i32, i32* %56
%58 = call i32 @bcopy(i32 %53, i32* %54, i32 %57)
%59 = load i16, i16* %14
%60 = call i32 @htons(i16 zeroext %59)
%61 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 0
store i32 %60, i32* %61
%62 = load i32, i32* @AF_INET
%63 = load i32, i32* @SOCK_STREAM
%64 = call i32 @socket(i32 %62, i32 %63, i32 0)
store i32 %64, i32* %6
%65 = icmp slt i32 %64, 0
br i1 %65, label %66, label %69
66: ; preds = %47
%67 = load i32, i32* @stderr
%68 = call i32 (i32, i8*, ...) @fprintf(i32 %67, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %163
69: ; preds = %47
%70 = load i32, i32* %6
%71 = bitcast %struct.sockaddr_in* %8 to %struct.sockaddr*
%72 = call i32 @connect(i32 %70, %struct.sockaddr* %71, i32 12)
%73 = icmp eq i32 %72, -1
br i1 %73, label %74, label %77
74: ; preds = %69
%75 = load i32, i32* @stderr
%76 = call i32 (i32, i8*, ...) @fprintf(i32 %75, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %3
br label %163
77: ; preds = %69
%78 = load i32, i32* %6
%79 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%80 = call i32 @read(i32 %78, i8* %79, i32 256)
store i32 %80, i32* %11
%81 = load i32, i32* %11
%82 = icmp sgt i32 %81, 0
br i1 %82, label %83, label %87
83: ; preds = %77
%84 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%85 = load i32, i32* %11
%86 = call i32 @write(i32 1, i8* %84, i32 %85)
br label %87
87: ; preds = %83, %77
%88 = call i32 @printf(i8* getelementptr inbounds ([102 x i8], [102 x i8]* @.str.4, i64 0, i64 0))
%89 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%90 = load i32, i32* @stdin
%91 = call i32 @fgets(i8* %89, i32 256, i32 %90)
%92 = call i32 @printf(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str.5, i64 0, i64 0))
%93 = load i32, i32* %6
%94 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%95 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%96 = call i32 @strlen(i8* %95)
%97 = call i32 @write(i32 %93, i8* %94, i32 %96)
%98 = load i32, i32* %6
%99 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%100 = call i32 @read(i32 %98, i8* %99, i32 256)
store i32 %100, i32* %11
%101 = load i32, i32* %11
%102 = icmp sgt i32 %101, 0
br i1 %102, label %103, label %107
103: ; preds = %87
%104 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%105 = load i32, i32* %11
%106 = call i32 @write(i32 1, i8* %104, i32 %105)
br label %107
107: ; preds = %103, %87
%108 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%109 = load i32, i32* %6
%110 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%111 = call i32 @read(i32 %109, i8* %110, i32 256)
store i32 %111, i32* %11
%112 = load i32, i32* %11
%113 = icmp sgt i32 %112, 0
br i1 %113, label %114, label %118
114: ; preds = %107
%115 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%116 = load i32, i32* %11
%117 = call i32 @write(i32 1, i8* %115, i32 %116)
br label %118
118: ; preds = %114, %107
%119 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%120 = load i32, i32* %6
%121 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%122 = call i32 @read(i32 %120, i8* %121, i32 256)
store i32 %122, i32* %11
%123 = load i32, i32* %11
%124 = icmp sgt i32 %123, 0
br i1 %124, label %125, label %129
125: ; preds = %118
%126 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%127 = load i32, i32* %11
%128 = call i32 @write(i32 1, i8* %126, i32 %127)
br label %129
129: ; preds = %125, %118
%130 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0))
br label %131
131: ; preds = %129, %162
%132 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%133 = load i32, i32* @stdin
%134 = call i32 @fgets(i8* %132, i32 256, i32 %133)
%135 = load i32, i32* %6
%136 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%137 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%138 = call i32 @strlen(i8* %137)
%139 = call i32 @write(i32 %135, i8* %136, i32 %138)
%140 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
%141 = load i32, i32* %6
%142 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%143 = call i32 @read(i32 %141, i8* %142, i32 256)
store i32 %143, i32* %11
%144 = load i32, i32* %11
%145 = icmp sgt i32 %144, 0
br i1 %145, label %146, label %150
146: ; preds = %131
%147 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%148 = load i32, i32* %11
%149 = call i32 @write(i32 1, i8* %147, i32 %148)
br label %150
150: ; preds = %146, %131
%151 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0))
%152 = load i32, i32* %6
%153 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%154 = call i32 @read(i32 %152, i8* %153, i32 256)
store i32 %154, i32* %11
%155 = load i32, i32* %11
%156 = icmp sgt i32 %155, 0
br i1 %156, label %157, label %162
157: ; preds = %150
%158 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%159 = load i32, i32* %11
%160 = call i32 @write(i32 1, i8* %158, i32 %159)
%161 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0))
br label %162
162: ; preds = %157, %150
br label %131
163: ; preds = %74, %66, %43
%164 = load i32, i32* %3
ret i32 %164
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.servent = type { i32 }
%struct.hostent = type { i32, i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str.1 = [65 x i8] c"[%s] \E3\81\8B\E3\82\89 IP \E3\82\A2\E3\83\89\E3\83\AC\E3\82\B9\E3\81\B8\E3\81\AE\E5\A4\89\E6\8F\9B\E3\81\AB\E5\A4\B1\E6\95\97\E3\81\97\E3\81\BE\E3\81\97\E3\81\9F\E3\80\82\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.2 = [47 x i8] c"\E3\82\BD\E3\82\B1\E3\83\83\E3\83\88\E3\81\AE\E7\94\9F\E6\88\90\E3\81\AB\E5\A4\B1\E6\95\97\E3\81\97\E3\81\BE\E3\81\97\E3\81\9F\E3\80\82\0A\00"
@.str.3 = [34 x i8] c"connect \E3\81\AB\E5\A4\B1\E6\95\97\E3\81\97\E3\81\BE\E3\81\97\E3\81\9F\E3\80\82\0A\00"
@.str.4 = [102 x i8] c"\E3\81\93\E3\81\93\E3\81\A7\E3\82\B5\E3\83\BC\E3\83\90\E3\83\BC\E3\81\8B\E3\82\89PLEASE INPUT YOUR NAME\E3\81\A8\E8\A1\A8\E7\A4\BA\E3\81\95\E3\82\8C\E3\82\8B.\E5\90\8D\E5\89\8D\E3\82\92\E5\85\A5\E5\8A\9B\E3\81\97\E3\81\A6\E3\82\A8\E3\83\B3\E3\82\BF\E3\83\BC\00"
@stdin = global i32 0
@.str.5 = [100 x i8] c"\E5\90\8D\E5\89\8D\E9\80\81\E4\BF\A1\E3\81\95\E3\82\8C\E3\81\9F\E3\80\82\E3\81\9D\E3\82\8C\E3\81\A8\E5\90\8C\E6\99\82\E3\81\AByour id:\E3\81\A8\E3\82\AF\E3\83\A9\E3\82\A4\E3\82\A2\E3\83\B3\E3\83\88\E6\95\B0,\E5\95\86\E5\93\81\E6\95\B0\E8\A1\A8\E7\A4\BA\E3\81\95\E3\82\8C\E3\81\9F\00"
@.str.6 = [7 x i8] c"cccccc\00"
@.str.7 = [8 x i8] c"ddddddd\00"
@.str.8 = [31 x i8] c"\E3\81\93\E3\81\93\E3\81\A7\E6\9C\80\E5\88\9D\E3\81\AE\E5\85\A5\E5\8A\9B\E5\BE\85\E3\81\A1\00"
@.str.9 = [7 x i8] c"ffffff\00"
@.str.10 = [6 x i8] c"ggggg\00"
@.str.11 = [28 x i8] c"\E3\81\93\E3\81\93\E3\81\A7\E6\AC\A1\E3\81\AE\E5\85\A5\E5\8A\9B\E5\BE\85\E3\81\A1\00"
@str = [32 x i8] c"usage: client [hostname] [port]\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca [256 x i8]
%5 = bitcast %struct.sockaddr_in* %3 to i8*
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%7 = icmp slt i32 %0, 3
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %2
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
%16 = tail call zeroext i16 @atoi(i8* %15)
%17 = tail call %struct.hostent* @gethostbyname(i8* %13)
%18 = icmp eq %struct.hostent* %17, null
br i1 %18, label %19, label %22
19: ; preds = %11
%20 = load i32, i32* @stderr
%21 = tail call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0), i8* %13)
br label %95
22: ; preds = %11
%23 = call i32 @bzero(%struct.sockaddr_in* %3, i32 12)
%24 = load i32, i32* @AF_INET
%25 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %24, i32* %25
%26 = getelementptr inbounds %struct.hostent, %struct.hostent* %17, i64 0, i32 1
%27 = load i32, i32* %26
%28 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1
%29 = getelementptr inbounds %struct.hostent, %struct.hostent* %17, i64 0, i32 0
%30 = load i32, i32* %29
%31 = call i32 @bcopy(i32 %27, i32* %28, i32 %30)
%32 = call i32 @htons(i16 zeroext %16)
%33 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
store i32 %32, i32* %33
%34 = load i32, i32* @AF_INET
%35 = load i32, i32* @SOCK_STREAM
%36 = call i32 @socket(i32 %34, i32 %35, i32 0)
%37 = icmp slt i32 %36, 0
br i1 %37, label %38, label %41
38: ; preds = %22
%39 = load i32, i32* @stderr
%40 = call i32 (i32, i8*, ...) @fprintf(i32 %39, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
br label %95
41: ; preds = %22
%42 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%43 = call i32 @connect(i32 %36, %struct.sockaddr* %42, i32 12)
%44 = icmp eq i32 %43, -1
br i1 %44, label %45, label %48
45: ; preds = %41
%46 = load i32, i32* @stderr
%47 = call i32 (i32, i8*, ...) @fprintf(i32 %46, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
br label %95
48: ; preds = %41
%49 = call i32 @read(i32 %36, i8* %6, i32 256)
%50 = icmp sgt i32 %49, 0
br i1 %50, label %51, label %53
51: ; preds = %48
%52 = call i32 @write(i32 1, i8* %6, i32 %49)
br label %53
53: ; preds = %51, %48
%54 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([102 x i8], [102 x i8]* @.str.4, i64 0, i64 0))
%55 = load i32, i32* @stdin
%56 = call i32 @fgets(i8* %6, i32 256, i32 %55)
%57 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([100 x i8], [100 x i8]* @.str.5, i64 0, i64 0))
%58 = call i32 @strlen(i8* %6)
%59 = call i32 @write(i32 %36, i8* %6, i32 %58)
%60 = call i32 @read(i32 %36, i8* %6, i32 256)
%61 = icmp sgt i32 %60, 0
br i1 %61, label %62, label %64
62: ; preds = %53
%63 = call i32 @write(i32 1, i8* %6, i32 %60)
br label %64
64: ; preds = %62, %53
%65 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%66 = call i32 @read(i32 %36, i8* %6, i32 256)
%67 = icmp sgt i32 %66, 0
br i1 %67, label %68, label %70
68: ; preds = %64
%69 = call i32 @write(i32 1, i8* %6, i32 %66)
br label %70
70: ; preds = %68, %64
%71 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%72 = call i32 @read(i32 %36, i8* %6, i32 256)
%73 = icmp sgt i32 %72, 0
br i1 %73, label %74, label %78
74: ; preds = %91, %70
%75 = phi i32 [ %72, %70 ], [ %93, %91 ]
%76 = phi i8* [ getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), %70 ], [ getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0), %91 ]
%77 = call i32 @write(i32 1, i8* %6, i32 %75)
br label %78
78: ; preds = %74, %70
%79 = phi i8* [ getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), %70 ], [ %76, %74 ]
%80 = call i32 @printf(i8* dereferenceable(1) %79)
br label %81
81: ; preds = %78, %91
%82 = load i32, i32* @stdin
%83 = call i32 @fgets(i8* %6, i32 256, i32 %82)
%84 = call i32 @strlen(i8* %6)
%85 = call i32 @write(i32 %36, i8* %6, i32 %84)
%86 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
%87 = call i32 @read(i32 %36, i8* %6, i32 256)
%88 = icmp sgt i32 %87, 0
br i1 %88, label %89, label %91
89: ; preds = %81
%90 = call i32 @write(i32 1, i8* %6, i32 %87)
br label %91
91: ; preds = %89, %81
%92 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0))
%93 = call i32 @read(i32 %36, i8* %6, i32 256)
%94 = icmp sgt i32 %93, 0
br i1 %94, label %74, label %81
95: ; preds = %45, %38, %19
%96 = phi i32 [ 0, %19 ], [ 1, %38 ], [ 1, %45 ]
ret i32 %96
}