#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 in_addr {
  int dummy;
};
struct sockaddr_in {
  struct in_addr sin_addr;
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
struct hostent {
  char **h_addr_list;
  int /*<<< orphan*/ h_addrtype;
};
typedef scalar_t__ ssize_t;
typedef int /*<<< orphan*/ addr;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INET6_ADDRSTRLEN;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ close(int);
scalar_t__ connect(int, struct sockaddr *, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
struct hostent *gethostbyname(char *);
int /*<<< orphan*/ h_errno;
char *hstrerror(int /*<<< orphan*/);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ memset(struct sockaddr_in *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
scalar_t__ read(int, char *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strlen(char *);
scalar_t__ strncmp(char *, char *, int);
int /*<<< orphan*/ weather_filter_weather(int, unsigned char *);
int /*<<< orphan*/ weather_nextline(int);
int /*<<< orphan*/ write(int, char *, int /*<<< orphan*/);
int weather_child_getinfo(unsigned char *weatherinfo) {
  struct hostent *h;
  char **p;
  char ip_address_string[INET6_ADDRSTRLEN + 1];
  int fd;
  struct sockaddr_in addr;
  char *hostname = "www.weather.com.cn";
  ssize_t n;
  char *request;
  char buf[128];
  h = gethostbyname(hostname);
  if (h == NULL) {
    fprintf(stderr, "Failed to resolv domain name %s: %s\n", hostname,
            hstrerror(h_errno));
    return -1;
  }
  p = h->h_addr_list;
  if ((fd = socket(h->h_addrtype, SOCK_STREAM, 0)) < 0) {
    perror("socket failed");
    return -1;
  }
  while (p && *p) {
    memset(&addr, 0, sizeof(addr));
    addr.sin_family = AF_INET;
    addr.sin_port = htons(80);
    addr.sin_addr = *((struct in_addr *)(*p));
    if (connect(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
      perror("connect failed");
      return -1;
    } else {
      fprintf(stdout, "connect successful\n");
      break;
    }
    p++;
  }
  request = "GET /weather/101010100.shtml\n";
  write(fd, request, strlen(request));
  while ((n = read(fd, buf, 7))) {
    if (n < 0) {
      perror("read failed");
      return -1;
    } else if (n == 0) {
      break;
    } else {
      if (strncmp(buf, "<title>", 7) == 0) {
        weather_filter_weather(fd, weatherinfo);
      } else {
        weather_nextline(fd);
      }
    }
  }
  close(fd);
  return 0;
}


x86 assembly (clang, -O0):
<weather_child_getinfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %rdi,-0x10(%rbp)
mov    0x2de2(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
mov    %eax,%eax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,-0x30(%rbp)
lea    0xde1(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
call   10a0 <gethostbyname@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1297 <weather_child_getinfo+0xa7>
mov    0x2d86(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xf4(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,-0xf0(%rbp)
mov    0x2d7c(%rip),%rax
mov    (%rax),%edi
call   10e0 <hstrerror@plt>
mov    -0xf4(%rbp),%edi
mov    -0xf0(%rbp),%rdx
mov    %rax,%rcx
lea    0xd99(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0xe4(%rbp)
jmp    14aa <weather_child_getinfo+0x2ba>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%edi
mov    0x2d10(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
mov    %eax,-0x34(%rbp)
cmp    $0x0,%eax
jge    12e7 <weather_child_getinfo+0xf7>
lea    0xd6c(%rip),%rdi
call   10d0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0xe4(%rbp)
jmp    14aa <weather_child_getinfo+0x2ba>
jmp    12ec <weather_child_getinfo+0xfc>
xor    %eax,%eax
cmpq   $0x0,-0x20(%rbp)
mov    %al,-0xf5(%rbp)
je     1310 <weather_child_getinfo+0x120>
mov    -0x20(%rbp),%rax
cmpq   $0x0,(%rax)
setne  %al
mov    %al,-0xf5(%rbp)
mov    -0xf5(%rbp),%al
test   $0x1,%al
jne    1323 <weather_child_getinfo+0x133>
jmp    13ac <weather_child_getinfo+0x1bc>
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1070 <memset@plt>
mov    0x2ca6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    $0x50,%edi
call   1060 <htons@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
mov    -0x34(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    $0xc,%edx
call   10f0 <connect@plt>
cmp    $0x0,%rax
jge    1395 <weather_child_getinfo+0x1a5>
lea    0xccc(%rip),%rdi
call   10d0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0xe4(%rbp)
jmp    14aa <weather_child_getinfo+0x2ba>
mov    0x2c1c(%rip),%rax
mov    (%rax),%edi
lea    0xcb0(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
lea    0xcb6(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x104(%rbp)
mov    -0x58(%rbp),%rax
mov    %rax,-0x100(%rbp)
mov    -0x58(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x104(%rbp),%edi
mov    -0x100(%rbp),%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    -0x34(%rbp),%edi
lea    -0xe0(%rbp),%rsi
mov    $0x7,%edx
call   1090 <read@plt>
mov    %rax,-0x50(%rbp)
cmp    $0x0,%rax
je     1491 <weather_child_getinfo+0x2a1>
cmpq   $0x0,-0x50(%rbp)
jge    1437 <weather_child_getinfo+0x247>
lea    0xc6b(%rip),%rdi
call   10d0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0xe4(%rbp)
jmp    14aa <weather_child_getinfo+0x2ba>
cmpq   $0x0,-0x50(%rbp)
jne    1447 <weather_child_getinfo+0x257>
jmp    1491 <weather_child_getinfo+0x2a1>
lea    -0xe0(%rbp),%rdi
lea    0xc3e(%rip),%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    147a <weather_child_getinfo+0x28a>
mov    -0x34(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   10c0 <weather_filter_weather@plt>
jmp    1482 <weather_child_getinfo+0x292>
mov    -0x34(%rbp),%edi
call   1100 <weather_nextline@plt>
jmp    1487 <weather_child_getinfo+0x297>
jmp    148c <weather_child_getinfo+0x29c>
jmp    13e8 <weather_child_getinfo+0x1f8>
mov    -0x34(%rbp),%edi
call   1080 <close@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xe4(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<weather_child_getinfo>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x98,%rsp
mov    %rdi,%r14
lea    0xdf9(%rip),%rdi
call   10a0 <gethostbyname@plt>
test   %rax,%rax
je     133a <weather_child_getinfo+0x14a>
mov    (%rax),%rbx
mov    0x8(%rax),%edi
mov    0x2da6(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
test   %eax,%eax
js     137e <weather_child_getinfo+0x18e>
mov    %eax,%ebp
test   %rbx,%rbx
je     12a4 <weather_child_getinfo+0xb4>
cmpq   $0x0,(%rbx)
je     12a4 <weather_child_getinfo+0xb4>
mov    %rsp,%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1070 <memset@plt>
mov    0x2d8f(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x8(%rsp)
mov    $0x50,%edi
call   1060 <htons@plt>
mov    %eax,0x4(%rsp)
mov    (%rbx),%rax
mov    (%rax),%eax
mov    %eax,(%rsp)
mov    %ebp,%edi
mov    %r15,%rsi
mov    $0xc,%edx
call   10f0 <connect@plt>
test   %rax,%rax
js     1390 <weather_child_getinfo+0x1a0>
mov    0x2d2c(%rip),%rax
mov    (%rax),%edi
lea    0xdb8(%rip),%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
lea    0xdbe(%rip),%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
lea    0x10(%rsp),%rsi
mov    %ebp,%edi
mov    $0x7,%edx
call   1090 <read@plt>
test   %rax,%rax
je     132f <weather_child_getinfo+0x13f>
lea    0xdb7(%rip),%r15
lea    0x10(%rsp),%rbx
jmp    1309 <weather_child_getinfo+0x119>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
call   1100 <weather_nextline@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x7,%edx
call   1090 <read@plt>
test   %rax,%rax
je     132f <weather_child_getinfo+0x13f>
test   %rax,%rax
js     1387 <weather_child_getinfo+0x197>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
mov    %ebp,%edi
test   %rax,%rax
jne    12f0 <weather_child_getinfo+0x100>
mov    %r14,%rsi
call   10c0 <weather_filter_weather@plt>
jmp    12f5 <weather_child_getinfo+0x105>
mov    %ebp,%edi
call   1080 <close@plt>
xor    %eax,%eax
jmp    1370 <weather_child_getinfo+0x180>
mov    0x2c8f(%rip),%rax
mov    (%rax),%ebx
mov    0x2c96(%rip),%rax
mov    (%rax),%edi
call   10e0 <hstrerror@plt>
lea    0xcbb(%rip),%rsi
lea    0xca1(%rip),%rdx
mov    %ebx,%edi
mov    %rax,%rcx
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    $0xffffffff,%eax
add    $0x98,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xcb3(%rip),%rdi
jmp    1397 <weather_child_getinfo+0x1a7>
lea    0xcf9(%rip),%rdi
jmp    1397 <weather_child_getinfo+0x1a7>
lea    0xcaf(%rip),%rdi
call   10d0 <perror@plt>
jmp    136b <weather_child_getinfo+0x17b>

LLVM IR (-O0):
%struct.hostent = type { i8**, i32 }
%struct.sockaddr_in = type { %struct.in_addr, i32, i32 }
%struct.in_addr = type { i32 }
%struct.sockaddr = type { i32 }
@INET6_ADDRSTRLEN = global i32 0
@.str = [19 x i8] c"www.weather.com.cn\00"
@stderr = global i32 0
@.str.1 = [37 x i8] c"Failed to resolv domain name %s: %s\0A\00"
@h_errno = global i32 0
@SOCK_STREAM = global i32 0
@.str.2 = [14 x i8] c"socket failed\00"
@AF_INET = global i32 0
@.str.3 = [15 x i8] c"connect failed\00"
@stdout = global i32 0
@.str.4 = [20 x i8] c"connect successful\0A\00"
@.str.5 = [30 x i8] c"GET /weather/101010100.shtml\0A\00"
@.str.6 = [12 x i8] c"read failed\00"
@.str.7 = [8 x i8] c"<title>\00"
define i32 @weather_child_getinfo(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.hostent*
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
%9 = alloca %struct.sockaddr_in
%10 = alloca i8*
%11 = alloca i64
%12 = alloca i8*
%13 = alloca [128 x i8]
%14 = alloca i32
store i8* %0, i8** %3
%15 = load i32, i32* @INET6_ADDRSTRLEN
%16 = add nsw i32 %15, 1
%17 = zext i32 %16 to i64
%18 = call i8* @llvm.stacksave()
store i8* %18, i8** %6
%19 = alloca i8, i64 %17
store i64 %17, i64* %7
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8** %10
%20 = load i8*, i8** %10
%21 = call %struct.hostent* @gethostbyname(i8* %20)
store %struct.hostent* %21, %struct.hostent** %4
%22 = load %struct.hostent*, %struct.hostent** %4
%23 = icmp eq %struct.hostent* %22, null
br i1 %23, label %24, label %30
24: ; preds = %1
%25 = load i32, i32* @stderr
%26 = load i8*, i8** %10
%27 = load i32, i32* @h_errno
%28 = call i8* @hstrerror(i32 %27)
%29 = call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* %26, i8* %28)
store i32 -1, i32* %2
store i32 1, i32* %14
br label %110
30: ; preds = %1
%31 = load %struct.hostent*, %struct.hostent** %4
%32 = getelementptr inbounds %struct.hostent, %struct.hostent* %31, i32 0, i32 0
%33 = load i8**, i8*** %32
store i8** %33, i8*** %5
%34 = load %struct.hostent*, %struct.hostent** %4
%35 = getelementptr inbounds %struct.hostent, %struct.hostent* %34, i32 0, i32 1
%36 = load i32, i32* %35
%37 = load i32, i32* @SOCK_STREAM
%38 = call i32 @socket(i32 %36, i32 %37, i32 0)
store i32 %38, i32* %8
%39 = icmp slt i32 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %30
%41 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %2
store i32 1, i32* %14
br label %110
42: ; preds = %30
br label %43
43: ; preds = %42
%44 = load i8**, i8*** %5
%45 = icmp ne i8** %44, null
br i1 %45, label %46, label %50
46: ; preds = %43
%47 = load i8**, i8*** %5
%48 = load i8*, i8** %47
%49 = icmp ne i8* %48, null
br label %50
50: ; preds = %46, %43
%51 = phi i1 [ false, %43 ], [ %49, %46 ]
br i1 %51, label %52, label %73
52: ; preds = %50
%53 = call i32 @memset(%struct.sockaddr_in* %9, i32 0, i32 12)
%54 = load i32, i32* @AF_INET
%55 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 2
store i32 %54, i32* %55
%56 = call i32 @htons(i32 80)
%57 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 1
store i32 %56, i32* %57
%58 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 0
%59 = load i8**, i8*** %5
%60 = load i8*, i8** %59
%61 = bitcast i8* %60 to %struct.in_addr*
%62 = bitcast %struct.in_addr* %58 to i8*
%63 = bitcast %struct.in_addr* %61 to i8*
%64 = load i32, i32* %8
%65 = bitcast %struct.sockaddr_in* %9 to %struct.sockaddr*
%66 = call i64 @connect(i32 %64, %struct.sockaddr* %65, i32 12)
%67 = icmp slt i64 %66, 0
br i1 %67, label %68, label %70
68: ; preds = %52
%69 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %2
store i32 1, i32* %14
br label %110
70: ; preds = %52
%71 = load i32, i32* @stdout
%72 = call i32 (i32, i8*, ...) @fprintf(i32 %71, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
br label %73
73: ; preds = %70, %50
store i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i8** %12
%74 = load i32, i32* %8
%75 = load i8*, i8** %12
%76 = load i8*, i8** %12
%77 = call i32 @strlen(i8* %76)
%78 = call i32 @write(i32 %74, i8* %75, i32 %77)
br label %79
79: ; preds = %106, %73
%80 = load i32, i32* %8
%81 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
%82 = call i64 @read(i32 %80, i8* %81, i32 7)
store i64 %82, i64* %11
%83 = icmp ne i64 %82, 0
br i1 %83, label %84, label %107
84: ; preds = %79
%85 = load i64, i64* %11
%86 = icmp slt i64 %85, 0
br i1 %86, label %87, label %89
87: ; preds = %84
%88 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
store i32 -1, i32* %2
store i32 1, i32* %14
br label %110
89: ; preds = %84
%90 = load i64, i64* %11
%91 = icmp eq i64 %90, 0
br i1 %91, label %92, label %93
92: ; preds = %89
br label %107
93: ; preds = %89
%94 = getelementptr inbounds [128 x i8], [128 x i8]* %13, i64 0, i64 0
%95 = call i64 @strncmp(i8* %94, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i32 7)
%96 = icmp eq i64 %95, 0
br i1 %96, label %97, label %101
97: ; preds = %93
%98 = load i32, i32* %8
%99 = load i8*, i8** %3
%100 = call i32 @weather_filter_weather(i32 %98, i8* %99)
br label %104
101: ; preds = %93
%102 = load i32, i32* %8
%103 = call i32 @weather_nextline(i32 %102)
br label %104
104: ; preds = %101, %97
br label %105
105: ; preds = %104
br label %106
106: ; preds = %105
br label %79
107: ; preds = %92, %79
%108 = load i32, i32* %8
%109 = call i32 @close(i32 %108)
store i32 0, i32* %2
store i32 1, i32* %14
br label %110
110: ; preds = %107, %87, %68, %40, %24
%111 = load i8*, i8** %6
%112 = load i32, i32* %2
ret i32 %112
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.in_addr, i32, i32 }
%struct.in_addr = type { i32 }
%struct.hostent = type { i8**, i32 }
%struct.sockaddr = type { i32 }
@INET6_ADDRSTRLEN = global i32 0
@.str = [19 x i8] c"www.weather.com.cn\00"
@stderr = global i32 0
@.str.1 = [37 x i8] c"Failed to resolv domain name %s: %s\0A\00"
@h_errno = global i32 0
@SOCK_STREAM = global i32 0
@.str.2 = [14 x i8] c"socket failed\00"
@AF_INET = global i32 0
@.str.3 = [15 x i8] c"connect failed\00"
@stdout = global i32 0
@.str.4 = [20 x i8] c"connect successful\0A\00"
@.str.5 = [30 x i8] c"GET /weather/101010100.shtml\0A\00"
@.str.6 = [12 x i8] c"read failed\00"
@.str.7 = [8 x i8] c"<title>\00"
define i32 @weather_child_getinfo(i8* %0) {
%2 = alloca %struct.sockaddr_in
%3 = alloca [128 x i8]
%4 = bitcast %struct.sockaddr_in* %2 to i8*
%5 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%6 = tail call %struct.hostent* @gethostbyname(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq %struct.hostent* %6, null
br i1 %7, label %8, label %13
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = load i32, i32* @h_errno
%11 = tail call i8* @hstrerror(i32 %10)
%12 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %11)
br label %68
13: ; preds = %1
%14 = getelementptr inbounds %struct.hostent, %struct.hostent* %6, i64 0, i32 0
%15 = load i8**, i8*** %14
%16 = getelementptr inbounds %struct.hostent, %struct.hostent* %6, i64 0, i32 1
%17 = load i32, i32* %16
%18 = load i32, i32* @SOCK_STREAM
%19 = tail call i32 @socket(i32 %17, i32 %18, i32 0)
%20 = icmp slt i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %13
%22 = tail call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %68
23: ; preds = %13
%24 = icmp eq i8** %15, null
br i1 %24, label %46, label %25
25: ; preds = %23
%26 = load i8*, i8** %15
%27 = icmp eq i8* %26, null
br i1 %27, label %46, label %28
28: ; preds = %25
%29 = call i32 @memset(%struct.sockaddr_in* %2, i32 0, i32 12)
%30 = load i32, i32* @AF_INET
%31 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 2
store i32 %30, i32* %31
%32 = call i32 @htons(i32 80)
%33 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 1
store i32 %32, i32* %33
%34 = bitcast i8** %15 to i32**
%35 = load i32*, i32** %34
%36 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 0, i32 0
%37 = load i32, i32* %35
store i32 %37, i32* %36
%38 = bitcast %struct.sockaddr_in* %2 to %struct.sockaddr*
%39 = call i64 @connect(i32 %19, %struct.sockaddr* %38, i32 12)
%40 = icmp slt i64 %39, 0
br i1 %40, label %41, label %43
41: ; preds = %28
%42 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %68
43: ; preds = %28
%44 = load i32, i32* @stdout
%45 = call i32 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
br label %46
46: ; preds = %23, %43, %25
%47 = call i32 @strlen(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
%48 = call i32 @write(i32 %19, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i32 %47)
%49 = call i64 @read(i32 %19, i8* %5, i32 7)
%50 = icmp eq i64 %49, 0
br i1 %50, label %66, label %51
51: ; preds = %46, %63
%52 = phi i64 [ %64, %63 ], [ %49, %46 ]
%53 = icmp slt i64 %52, 0
br i1 %53, label %54, label %56
54: ; preds = %51
%55 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
br label %68
56: ; preds = %51
%57 = call i64 @strncmp(i8* %5, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i32 7)
%58 = icmp eq i64 %57, 0
br i1 %58, label %59, label %61
59: ; preds = %56
%60 = call i32 @weather_filter_weather(i32 %19, i8* %0)
br label %63
61: ; preds = %56
%62 = call i32 @weather_nextline(i32 %19)
br label %63
63: ; preds = %61, %59
%64 = call i64 @read(i32 %19, i8* %5, i32 7)
%65 = icmp eq i64 %64, 0
br i1 %65, label %66, label %51
66: ; preds = %63, %46
%67 = call i32 @close(i32 %19)
br label %68
68: ; preds = %66, %54, %41, %21, %8
%69 = phi i32 [ -1, %8 ], [ -1, %21 ], [ -1, %41 ], [ -1, %54 ], [ 0, %66 ]
ret i32 %69
}