#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 addrinfo {
  int /*<<< orphan*/ ai_addrlen;
  int /*<<< orphan*/ ai_addr;
  int /*<<< orphan*/ ai_protocol;
  int /*<<< orphan*/ ai_socktype;
  int /*<<< orphan*/ ai_family;
};
typedef int /*<<< orphan*/ hints;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ AF_INET6;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ bzero(char *, int);
int connect(int, int /*<<< orphan*/, int /*<<< orphan*/);
int getaddrinfo(char const *, char *, struct addrinfo *, struct addrinfo **);
int /*<<< orphan*/ memset(struct addrinfo *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *);
int read(int, char *, int);
int /*<<< orphan*/ send(int, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strcpy(char *, char const *);
int write(int, char *, int);
int main() {
  const char *addr = "127.0.0.1";
  int sfd, rv;
  char _port[6];
  struct addrinfo hints, *servinfo, *p;
  snprintf(_port, 6, "%d", 6379);
  memset(&hints, 0, sizeof(hints));
  hints.ai_family = AF_INET;
  hints.ai_socktype = SOCK_STREAM;
  if ((rv = getaddrinfo(addr, _port, &hints, &servinfo)) != 0) {
    hints.ai_family = AF_INET6;
    if ((rv = getaddrinfo(addr, _port, &hints, &servinfo)) != 0) {
      printf("error address\n");
      return -1;
    }
  }
  p = servinfo;
  if ((sfd = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) == -1) {
    printf("error create socket\n");
    return -1;
  }
  if (connect(sfd, p->ai_addr, p->ai_addrlen) == -1) {
    printf("connect error\n");
    return -1;
  }
  const char *command = "*3\r\n$3\r\nSET\r\n$5\r\nmykey\r\n$7\r\nmyvalue\r\n";
  char buffer[1024] = "";
  strcpy(buffer, command);
  send(sfd, buffer, 1024, 0);
  bzero(buffer, 1024);
  int length = 0;
  length = read(sfd, buffer, 1024);
  while (length) {
    if (length < 0) {
      printf("error receiving data\n");
      break;
    }
    int write_len = write(1, buffer, length);
    if (write_len < length) {
      printf("write Failed\n");
      break;
    }
    length = read(sfd, buffer, 1024);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x460,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe37(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x1e(%rbp),%rdi
mov    $0x6,%esi
lea    0xe2d(%rip),%rdx
mov    $0x18eb,%ecx
call   1070 <snprintf@plt>
lea    -0x38(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1080 <memset@plt>
mov    0x2dea(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    0x2dc6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x1e(%rbp),%rsi
lea    -0x38(%rbp),%rdx
lea    -0x40(%rbp),%rcx
call   10c0 <getaddrinfo@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
je     127a <main+0xca>
mov    0x2da9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x1e(%rbp),%rsi
lea    -0x38(%rbp),%rdx
lea    -0x40(%rbp),%rcx
call   10c0 <getaddrinfo@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
je     1275 <main+0xc5>
lea    0xda9(%rip),%rdi
call   1060 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1400 <main+0x250>
jmp    127a <main+0xca>
mov    -0x40(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
mov    0x10(%rax),%edi
mov    -0x48(%rbp),%rax
mov    0xc(%rax),%esi
mov    -0x48(%rbp),%rax
mov    0x8(%rax),%edx
call   10d0 <socket@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
jne    12c0 <main+0x110>
lea    0xd6d(%rip),%rdi
call   1060 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1400 <main+0x250>
mov    -0x14(%rbp),%edi
mov    -0x48(%rbp),%rax
mov    0x4(%rax),%esi
mov    -0x48(%rbp),%rax
mov    (%rax),%edx
call   10b0 <connect@plt>
cmp    $0xffffffff,%eax
jne    12f6 <main+0x146>
lea    0xd4c(%rip),%rdi
call   1060 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1400 <main+0x250>
lea    0xd43(%rip),%rax
mov    %rax,-0x50(%rbp)
lea    -0x450(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1080 <memset@plt>
lea    -0x450(%rbp),%rdi
mov    -0x50(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x14(%rbp),%edi
lea    -0x450(%rbp),%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1050 <send@plt>
lea    -0x450(%rbp),%rdi
mov    $0x400,%esi
call   10a0 <bzero@plt>
movl   $0x0,-0x454(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x450(%rbp),%rsi
mov    $0x400,%edx
call   1090 <read@plt>
mov    %eax,-0x454(%rbp)
cmpl   $0x0,-0x454(%rbp)
je     13f9 <main+0x249>
cmpl   $0x0,-0x454(%rbp)
jge    139a <main+0x1ea>
lea    0xcd6(%rip),%rdi
call   1060 <printf@plt>
jmp    13f9 <main+0x249>
lea    -0x450(%rbp),%rsi
mov    -0x454(%rbp),%edx
mov    $0x1,%edi
call   1040 <write@plt>
mov    %eax,-0x458(%rbp)
mov    -0x458(%rbp),%eax
cmp    -0x454(%rbp),%eax
jge    13da <main+0x22a>
lea    0xcac(%rip),%rdi
call   1060 <printf@plt>
jmp    13f9 <main+0x249>
mov    -0x14(%rbp),%edi
lea    -0x450(%rbp),%rsi
mov    $0x400,%edx
call   1090 <read@plt>
mov    %eax,-0x454(%rbp)
jmp    136f <main+0x1bf>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x460,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x438,%rsp
lea    0xe42(%rip),%rdx
lea    0x12(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x6,%esi
mov    $0x18eb,%ecx
call   1070 <snprintf@plt>
lea    0x18(%rsp),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1080 <memset@plt>
mov    0x2dee(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x28(%rsp)
mov    0x2dc9(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x24(%rsp)
lea    0xdec(%rip),%rdi
lea    0x8(%rsp),%rcx
mov    %rbx,%rsi
mov    %rbp,%rdx
call   10c0 <getaddrinfo@plt>
test   %eax,%eax
je     1260 <main+0xb0>
mov    0x2db1(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x28(%rsp)
lea    0xdc4(%rip),%rdi
lea    0x12(%rsp),%rsi
lea    0x18(%rsp),%rdx
lea    0x8(%rsp),%rcx
call   10c0 <getaddrinfo@plt>
test   %eax,%eax
je     1260 <main+0xb0>
lea    0xe1c(%rip),%rdi
jmp    133e <main+0x18e>
mov    0x8(%rsp),%rbx
mov    0x10(%rbx),%edi
mov    0x8(%rbx),%edx
mov    0xc(%rbx),%esi
call   10d0 <socket@plt>
cmp    $0xffffffff,%eax
je     132e <main+0x17e>
mov    %eax,%ebp
mov    (%rbx),%edx
mov    0x4(%rbx),%esi
mov    %eax,%edi
call   10b0 <connect@plt>
cmp    $0xffffffff,%eax
je     1337 <main+0x187>
lea    0x30(%rsp),%rbx
xor    %r15d,%r15d
mov    $0x400,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1080 <memset@plt>
lea    0xd5c(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
mov    %rbx,%rdi
mov    $0x400,%esi
call   10a0 <bzero@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x400,%edx
call   1090 <read@plt>
test   %eax,%eax
je     1349 <main+0x199>
mov    %eax,%ebx
lea    0xd4d(%rip),%r14
lea    0x30(%rsp),%r12
lea    0xd34(%rip),%r13
nop
test   %ebx,%ebx
js     1361 <main+0x1b1>
mov    $0x1,%edi
mov    %r12,%rsi
mov    %ebx,%edx
call   1050 <write@plt>
cmp    %ebx,%eax
jl     135e <main+0x1ae>
mov    %ebp,%edi
mov    %r12,%rsi
mov    $0x400,%edx
call   1090 <read@plt>
mov    %eax,%ebx
test   %eax,%eax
jne    1300 <main+0x150>
jmp    1349 <main+0x199>
lea    0xd2e(%rip),%rdi
jmp    133e <main+0x18e>
lea    0xd17(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%r15d
mov    %r15d,%eax
add    $0x438,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r13,%r14
mov    %r14,%rdi
call   1040 <puts@plt>
jmp    1349 <main+0x199>

LLVM IR (-O0):
%struct.addrinfo = type { i32, i32, i32, i32, i32 }
@.str = [10 x i8] c"127.0.0.1\00"
@.str.1 = [3 x i8] c"%d\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@AF_INET6 = global i32 0
@.str.2 = [15 x i8] c"error address\0A\00"
@.str.3 = [21 x i8] c"error create socket\0A\00"
@.str.4 = [15 x i8] c"connect error\0A\00"
@.str.5 = [38 x i8] c"*3\0D\0A$3\0D\0ASET\0D\0A$5\0D\0Amykey\0D\0A$7\0D\0Amyvalue\0D\0A\00"
@.str.6 = [22 x i8] c"error receiving data\0A\00"
@.str.7 = [14 x i8] c"write Failed\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca [6 x i8]
%6 = alloca %struct.addrinfo
%7 = alloca %struct.addrinfo*
%8 = alloca %struct.addrinfo*
%9 = alloca i8*
%10 = alloca [1024 x i8]
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %2
%13 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 0
%14 = call i32 @snprintf(i8* %13, i32 6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 6379)
%15 = call i32 @memset(%struct.addrinfo* %6, i32 0, i32 20)
%16 = load i32, i32* @AF_INET
%17 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %6, i32 0, i32 4
store i32 %16, i32* %17
%18 = load i32, i32* @SOCK_STREAM
%19 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %6, i32 0, i32 3
store i32 %18, i32* %19
%20 = load i8*, i8** %2
%21 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 0
%22 = call i32 @getaddrinfo(i8* %20, i8* %21, %struct.addrinfo* %6, %struct.addrinfo** %7)
store i32 %22, i32* %4
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %34
24: ; preds = %0
%25 = load i32, i32* @AF_INET6
%26 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %6, i32 0, i32 4
store i32 %25, i32* %26
%27 = load i8*, i8** %2
%28 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 0
%29 = call i32 @getaddrinfo(i8* %27, i8* %28, %struct.addrinfo* %6, %struct.addrinfo** %7)
store i32 %29, i32* %4
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %24
%32 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %1
br label %96
33: ; preds = %24
br label %34
34: ; preds = %33, %0
%35 = load %struct.addrinfo*, %struct.addrinfo** %7
store %struct.addrinfo* %35, %struct.addrinfo** %8
%36 = load %struct.addrinfo*, %struct.addrinfo** %8
%37 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %36, i32 0, i32 4
%38 = load i32, i32* %37
%39 = load %struct.addrinfo*, %struct.addrinfo** %8
%40 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %39, i32 0, i32 3
%41 = load i32, i32* %40
%42 = load %struct.addrinfo*, %struct.addrinfo** %8
%43 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %42, i32 0, i32 2
%44 = load i32, i32* %43
%45 = call i32 @socket(i32 %38, i32 %41, i32 %44)
store i32 %45, i32* %3
%46 = icmp eq i32 %45, -1
br i1 %46, label %47, label %49
47: ; preds = %34
%48 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %1
br label %96
49: ; preds = %34
%50 = load i32, i32* %3
%51 = load %struct.addrinfo*, %struct.addrinfo** %8
%52 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %51, i32 0, i32 1
%53 = load i32, i32* %52
%54 = load %struct.addrinfo*, %struct.addrinfo** %8
%55 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %54, i32 0, i32 0
%56 = load i32, i32* %55
%57 = call i32 @connect(i32 %50, i32 %53, i32 %56)
%58 = icmp eq i32 %57, -1
br i1 %58, label %59, label %61
59: ; preds = %49
%60 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
store i32 -1, i32* %1
br label %96
61: ; preds = %49
store i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i8** %9
%62 = bitcast [1024 x i8]* %10 to i8*
%63 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%64 = load i8*, i8** %9
%65 = call i32 @strcpy(i8* %63, i8* %64)
%66 = load i32, i32* %3
%67 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%68 = call i32 @send(i32 %66, i8* %67, i32 1024, i32 0)
%69 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%70 = call i32 @bzero(i8* %69, i32 1024)
store i32 0, i32* %11
%71 = load i32, i32* %3
%72 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%73 = call i32 @read(i32 %71, i8* %72, i32 1024)
store i32 %73, i32* %11
br label %74
74: ; preds = %91, %61
%75 = load i32, i32* %11
%76 = icmp ne i32 %75, 0
br i1 %76, label %77, label %95
77: ; preds = %74
%78 = load i32, i32* %11
%79 = icmp slt i32 %78, 0
br i1 %79, label %80, label %82
80: ; preds = %77
%81 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0))
br label %95
82: ; preds = %77
%83 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%84 = load i32, i32* %11
%85 = call i32 @write(i32 1, i8* %83, i32 %84)
store i32 %85, i32* %12
%86 = load i32, i32* %12
%87 = load i32, i32* %11
%88 = icmp slt i32 %86, %87
br i1 %88, label %89, label %91
89: ; preds = %82
%90 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0))
br label %95
91: ; preds = %82
%92 = load i32, i32* %3
%93 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%94 = call i32 @read(i32 %92, i8* %93, i32 1024)
store i32 %94, i32* %11
br label %74
95: ; preds = %89, %80, %74
store i32 0, i32* %1
br label %96
96: ; preds = %95, %59, %47, %31
%97 = load i32, i32* %1
ret i32 %97
}

LLVM IR (-O2):
%struct.addrinfo = type { i32, i32, i32, i32, i32 }
@.str = [10 x i8] c"127.0.0.1\00"
@.str.1 = [3 x i8] c"%d\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@AF_INET6 = global i32 0
@.str.5 = [38 x i8] c"*3\0D\0A$3\0D\0ASET\0D\0A$5\0D\0Amykey\0D\0A$7\0D\0Amyvalue\0D\0A\00"
@str = [13 x i8] c"write Failed\00"
@str.8 = [21 x i8] c"error receiving data\00"
@str.9 = [14 x i8] c"connect error\00"
@str.10 = [20 x i8] c"error create socket\00"
@str.11 = [14 x i8] c"error address\00"
define i32 @main() {
%1 = alloca [6 x i8]
%2 = alloca %struct.addrinfo
%3 = alloca %struct.addrinfo*
%4 = alloca [1024 x i8]
%5 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%6 = bitcast %struct.addrinfo* %2 to i8*
%7 = bitcast %struct.addrinfo** %3 to i8*
%8 = call i32 @snprintf(i8* %5, i32 6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 6379)
%9 = call i32 @memset(%struct.addrinfo* %2, i32 0, i32 20)
%10 = load i32, i32* @AF_INET
%11 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %2, i64 0, i32 4
store i32 %10, i32* %11
%12 = load i32, i32* @SOCK_STREAM
%13 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %2, i64 0, i32 3
store i32 %12, i32* %13
%14 = call i32 @getaddrinfo(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %5, %struct.addrinfo* %2, %struct.addrinfo** %3)
%15 = icmp eq i32 %14, 0
br i1 %15, label %22, label %16
16: ; preds = %0
%17 = load i32, i32* @AF_INET6
store i32 %17, i32* %11
%18 = call i32 @getaddrinfo(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %5, %struct.addrinfo* %2, %struct.addrinfo** %3)
%19 = icmp eq i32 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %16
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.11, i64 0, i64 0))
br label %63
22: ; preds = %16, %0
%23 = load %struct.addrinfo*, %struct.addrinfo** %3
%24 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %23, i64 0, i32 4
%25 = load i32, i32* %24
%26 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %23, i64 0, i32 3
%27 = load i32, i32* %26
%28 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %23, i64 0, i32 2
%29 = load i32, i32* %28
%30 = call i32 @socket(i32 %25, i32 %27, i32 %29)
%31 = icmp eq i32 %30, -1
br i1 %31, label %32, label %34
32: ; preds = %22
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.10, i64 0, i64 0))
br label %63
34: ; preds = %22
%35 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %23, i64 0, i32 1
%36 = load i32, i32* %35
%37 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %23, i64 0, i32 0
%38 = load i32, i32* %37
%39 = call i32 @connect(i32 %30, i32 %36, i32 %38)
%40 = icmp eq i32 %39, -1
br i1 %40, label %41, label %43
41: ; preds = %34
%42 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.9, i64 0, i64 0))
br label %63
43: ; preds = %34
%44 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%45 = call i32 @strcpy(i8* %44, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0))
%46 = call i32 @send(i32 %30, i8* %44, i32 1024, i32 0)
%47 = call i32 @bzero(i8* %44, i32 1024)
%48 = call i32 @read(i32 %30, i8* %44, i32 1024)
%49 = icmp eq i32 %48, 0
br i1 %49, label %62, label %50
50: ; preds = %43, %56
%51 = phi i32 [ %57, %56 ], [ %48, %43 ]
%52 = icmp slt i32 %51, 0
br i1 %52, label %59, label %53
53: ; preds = %50
%54 = call i32 @write(i32 1, i8* %44, i32 %51)
%55 = icmp slt i32 %54, %51
br i1 %55, label %59, label %56
56: ; preds = %53
%57 = call i32 @read(i32 %30, i8* %44, i32 1024)
%58 = icmp eq i32 %57, 0
br i1 %58, label %62, label %50
59: ; preds = %53, %50
%60 = phi i8* [ getelementptr inbounds ([21 x i8], [21 x i8]* @str.8, i64 0, i64 0), %50 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0), %53 ]
%61 = call i32 @puts(i8* dereferenceable(1) %60)
br label %62
62: ; preds = %56, %59, %43
br label %63
63: ; preds = %62, %41, %32, %20
%64 = phi i32 [ -1, %20 ], [ -1, %32 ], [ -1, %41 ], [ 0, %62 ]
ret i32 %64
}