#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;
};
struct addrinfo {
  int /*<<< orphan*/ ai_addrlen;
  scalar_t__ ai_addr;
  struct addrinfo *ai_next;
  int /*<<< orphan*/ ai_socktype;
  int /*<<< orphan*/ ai_family;
};

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ gai_strerror(int);
int getaddrinfo(char *, char *, struct addrinfo *, struct addrinfo **);
int getnameinfo(scalar_t__, int /*<<< orphan*/, char *, int, int /*<<< orphan*/,
                int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ inet_ntoa(int /*<<< orphan*/);
int /*<<< orphan*/ memset(struct addrinfo *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int sockfd;
  struct addrinfo hints, *servinfo, *p;
  struct sockaddr_in *h;
  int rc, ctr;
  if (argc < 3) {
    printf("Error: Missing Hostname/IP Address or flag to decide IP->Hostname "
           "or Hostname->IP\n");
    exit(1);
  }
  if (strcmp(argv[1], "-h") == 0) {
    char *hostname = argv[2];
    char ip[100];
    memset(&hints, 0, sizeof hints);
    hints.ai_family = AF_INET;
    hints.ai_socktype = SOCK_STREAM;
    if ((rc = getaddrinfo(hostname, "http", &hints, &servinfo)) != 0) {
      perror(gai_strerror(rc));
      exit(-1);
    }
    ctr = 1;
    for (p = servinfo; p != NULL; p = p->ai_next) {
      h = (struct sockaddr_in *)p->ai_addr;
      strcpy(ip, inet_ntoa(h->sin_addr));
      printf("%s - IPv4 address #%d: %s\n", hostname, ctr, ip);
      ctr++;
    }
  } else if (strcmp(argv[1], "-i") == 0) {
    struct addrinfo *res = 0;
    int rc;
    char *ip = argv[2];
    char hostname[1000];
    printf("Command line input: %s\n", ip);
    rc = getaddrinfo(ip, 0, 0, &res);
    if (rc != 0) {
      perror(gai_strerror(rc));
      exit(-1);
    }
    rc = getnameinfo(res->ai_addr, res->ai_addrlen, hostname, 1000, 0, 0, 0);
    if (rc != 0) {
      perror(gai_strerror(rc));
      exit(-1);
    }
    printf("Hostname found: %s\n", hostname);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4e0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    11db <main+0x3b>
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe69(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    12f2 <main+0x152>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x60(%rbp)
lea    -0x38(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1070 <memset@plt>
mov    0x2dcc(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    0x2db0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x60(%rbp),%rdi
lea    0xe1e(%rip),%rsi
lea    -0x38(%rbp),%rdx
lea    -0x40(%rbp),%rcx
call   10c0 <getaddrinfo@plt>
mov    %eax,-0x54(%rbp)
cmp    $0x0,%eax
je     126a <main+0xca>
mov    -0x54(%rbp),%edi
call   1060 <gai_strerror@plt>
mov    %eax,%edi
call   10a0 <perror@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
movl   $0x1,-0x58(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
je     12ed <main+0x14d>
mov    -0x48(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x50(%rbp)
lea    -0xd0(%rbp),%rax
mov    %rax,-0x4d8(%rbp)
mov    -0x50(%rbp),%rax
mov    (%rax),%edi
call   1040 <inet_ntoa@plt>
mov    -0x4d8(%rbp),%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
mov    -0x60(%rbp),%rsi
mov    -0x58(%rbp),%edx
lea    -0xd0(%rbp),%rcx
lea    0xd8f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
mov    -0x48(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x48(%rbp)
jmp    1279 <main+0xd9>
jmp    1403 <main+0x263>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd75(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    13fe <main+0x25e>
movq   $0x0,-0xd8(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0xe8(%rbp)
mov    -0xe8(%rbp),%rsi
lea    0xd41(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xe8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%edx
lea    -0xd8(%rbp),%rcx
mov    %rdx,%rsi
call   10c0 <getaddrinfo@plt>
mov    %eax,-0xdc(%rbp)
cmpl   $0x0,-0xdc(%rbp)
je     1388 <main+0x1e8>
mov    -0xdc(%rbp),%edi
call   1060 <gai_strerror@plt>
mov    %eax,%edi
call   10a0 <perror@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
mov    -0xd8(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0xd8(%rbp),%rax
mov    (%rax),%esi
lea    -0x4d0(%rbp),%rdx
mov    $0x3e8,%ecx
xor    %r9d,%r9d
mov    %r9d,%r8d
movl   $0x0,(%rsp)
call   1080 <getnameinfo@plt>
mov    %eax,-0xdc(%rbp)
cmpl   $0x0,-0xdc(%rbp)
je     13e9 <main+0x249>
mov    -0xdc(%rbp),%edi
call   1060 <gai_strerror@plt>
mov    %eax,%edi
call   10a0 <perror@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
lea    -0x4d0(%rbp),%rsi
lea    0xc9a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1403 <main+0x263>
mov    -0x4(%rbp),%eax
add    $0x4e0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x420,%rsp
cmp    $0x2,%edi
jle    1335 <main+0x185>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xe2a(%rip),%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     127b <main+0xcb>
mov    0x8(%rbx),%rdi
lea    0xe34(%rip),%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
jne    1323 <main+0x173>
movq   $0x0,0x10(%rsp)
mov    0x10(%rbx),%rbx
lea    0xe15(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x10(%rsp),%rcx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   10d0 <getaddrinfo@plt>
test   %eax,%eax
jne    134b <main+0x19b>
mov    0x10(%rsp),%rax
mov    0x8(%rax),%rdi
mov    (%rax),%esi
movl   $0x0,(%rsp)
lea    0x30(%rsp),%rdx
mov    $0x3e8,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1090 <getnameinfo@plt>
test   %eax,%eax
jne    134b <main+0x19b>
lea    0xdd4(%rip),%rdi
lea    0x30(%rsp),%rsi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    1323 <main+0x173>
mov    0x10(%rbx),%r14
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1080 <memset@plt>
mov    0x2d4e(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x2c(%rsp)
mov    0x2d31(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x28(%rsp)
lea    0xd4f(%rip),%rsi
lea    0x8(%rsp),%rcx
mov    %r14,%rdi
mov    %rbx,%rdx
call   10d0 <getaddrinfo@plt>
test   %eax,%eax
jne    134b <main+0x19b>
mov    0x8(%rsp),%rbx
test   %rbx,%rbx
je     1323 <main+0x173>
mov    $0x1,%ebp
lea    0x30(%rsp),%r12
lea    0xd21(%rip),%r15
nopw   0x0(%rax,%rax,1)
mov    0x8(%rbx),%rax
mov    (%rax),%edi
call   1050 <inet_ntoa@plt>
mov    %r12,%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
mov    %r12,%rcx
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%ebp
mov    0x10(%rbx),%rbx
test   %rbx,%rbx
jne    12f0 <main+0x140>
xor    %eax,%eax
add    $0x420,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd16(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    %eax,%edi
call   1070 <gai_strerror@plt>
mov    %eax,%edi
call   10b0 <perror@plt>
mov    $0xffffffff,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
%struct.addrinfo = type { i32, i64, %struct.addrinfo*, i32, i32 }
%struct.sockaddr_in = type { i32 }
@.str = [83 x i8] c"Error: Missing Hostname/IP Address or flag to decide IP->Hostname or Hostname->IP\0A\00"
@.str.1 = [3 x i8] c"-h\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.2 = [5 x i8] c"http\00"
@.str.3 = [27 x i8] c"%s - IPv4 address #%d: %s\0A\00"
@.str.4 = [3 x i8] c"-i\00"
@.str.5 = [24 x i8] c"Command line input: %s\0A\00"
@.str.6 = [20 x i8] c"Hostname found: %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.addrinfo
%8 = alloca %struct.addrinfo*
%9 = alloca %struct.addrinfo*
%10 = alloca %struct.sockaddr_in*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8*
%14 = alloca [100 x i8]
%15 = alloca %struct.addrinfo*
%16 = alloca i32
%17 = alloca i8*
%18 = alloca [1000 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%19 = load i32, i32* %4
%20 = icmp slt i32 %19, 3
br i1 %20, label %21, label %24
21: ; preds = %2
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([83 x i8], [83 x i8]* @.str, i64 0, i64 0))
%23 = call i32 @exit(i32 1)
unreachable
24: ; preds = %2
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call i64 @strcmp(i8* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %74
30: ; preds = %24
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 2
%33 = load i8*, i8** %32
store i8* %33, i8** %13
%34 = call i32 @memset(%struct.addrinfo* %7, i32 0, i32 32)
%35 = load i32, i32* @AF_INET
%36 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %7, i32 0, i32 4
store i32 %35, i32* %36
%37 = load i32, i32* @SOCK_STREAM
%38 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %7, i32 0, i32 3
store i32 %37, i32* %38
%39 = load i8*, i8** %13
%40 = call i32 @getaddrinfo(i8* %39, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), %struct.addrinfo* %7, %struct.addrinfo** %8)
store i32 %40, i32* %11
%41 = icmp ne i32 %40, 0
br i1 %41, label %42, label %47
42: ; preds = %30
%43 = load i32, i32* %11
%44 = call i32 @gai_strerror(i32 %43)
%45 = call i32 @perror(i32 %44)
%46 = call i32 @exit(i32 -1)
unreachable
47: ; preds = %30
store i32 1, i32* %12
%48 = load %struct.addrinfo*, %struct.addrinfo** %8
store %struct.addrinfo* %48, %struct.addrinfo** %9
br label %49
49: ; preds = %69, %47
%50 = load %struct.addrinfo*, %struct.addrinfo** %9
%51 = icmp ne %struct.addrinfo* %50, null
br i1 %51, label %52, label %73
52: ; preds = %49
%53 = load %struct.addrinfo*, %struct.addrinfo** %9
%54 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %53, i32 0, i32 1
%55 = load i64, i64* %54
%56 = inttoptr i64 %55 to %struct.sockaddr_in*
store %struct.sockaddr_in* %56, %struct.sockaddr_in** %10
%57 = getelementptr inbounds [100 x i8], [100 x i8]* %14, i64 0, i64 0
%58 = load %struct.sockaddr_in*, %struct.sockaddr_in** %10
%59 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %58, i32 0, i32 0
%60 = load i32, i32* %59
%61 = call i32 @inet_ntoa(i32 %60)
%62 = call i32 @strcpy(i8* %57, i32 %61)
%63 = load i8*, i8** %13
%64 = load i32, i32* %12
%65 = getelementptr inbounds [100 x i8], [100 x i8]* %14, i64 0, i64 0
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %63, i32 %64, i8* %65)
%67 = load i32, i32* %12
%68 = add nsw i32 %67, 1
store i32 %68, i32* %12
br label %69
69: ; preds = %52
%70 = load %struct.addrinfo*, %struct.addrinfo** %9
%71 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %70, i32 0, i32 2
%72 = load %struct.addrinfo*, %struct.addrinfo** %71
store %struct.addrinfo* %72, %struct.addrinfo** %9
br label %49
73: ; preds = %49
br label %115
74: ; preds = %24
%75 = load i8**, i8*** %5
%76 = getelementptr inbounds i8*, i8** %75, i64 1
%77 = load i8*, i8** %76
%78 = call i64 @strcmp(i8* %77, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%79 = icmp eq i64 %78, 0
br i1 %79, label %80, label %114
80: ; preds = %74
store %struct.addrinfo* null, %struct.addrinfo** %15
%81 = load i8**, i8*** %5
%82 = getelementptr inbounds i8*, i8** %81, i64 2
%83 = load i8*, i8** %82
store i8* %83, i8** %17
%84 = load i8*, i8** %17
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* %84)
%86 = load i8*, i8** %17
%87 = call i32 @getaddrinfo(i8* %86, i8* null, %struct.addrinfo* null, %struct.addrinfo** %15)
store i32 %87, i32* %16
%88 = load i32, i32* %16
%89 = icmp ne i32 %88, 0
br i1 %89, label %90, label %95
90: ; preds = %80
%91 = load i32, i32* %16
%92 = call i32 @gai_strerror(i32 %91)
%93 = call i32 @perror(i32 %92)
%94 = call i32 @exit(i32 -1)
unreachable
95: ; preds = %80
%96 = load %struct.addrinfo*, %struct.addrinfo** %15
%97 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %96, i32 0, i32 1
%98 = load i64, i64* %97
%99 = load %struct.addrinfo*, %struct.addrinfo** %15
%100 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %99, i32 0, i32 0
%101 = load i32, i32* %100
%102 = getelementptr inbounds [1000 x i8], [1000 x i8]* %18, i64 0, i64 0
%103 = call i32 @getnameinfo(i64 %98, i32 %101, i8* %102, i32 1000, i32 0, i32 0, i32 0)
store i32 %103, i32* %16
%104 = load i32, i32* %16
%105 = icmp ne i32 %104, 0
br i1 %105, label %106, label %111
106: ; preds = %95
%107 = load i32, i32* %16
%108 = call i32 @gai_strerror(i32 %107)
%109 = call i32 @perror(i32 %108)
%110 = call i32 @exit(i32 -1)
unreachable
111: ; preds = %95
%112 = getelementptr inbounds [1000 x i8], [1000 x i8]* %18, i64 0, i64 0
%113 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i8* %112)
br label %114
114: ; preds = %111, %74
br label %115
115: ; preds = %114, %73
%116 = load i32, i32* %3
ret i32 %116
}

LLVM IR (-O2):
%struct.addrinfo = type { i32, i64, %struct.addrinfo*, i32, i32 }
%struct.sockaddr_in = type { i32 }
@.str.1 = [3 x i8] c"-h\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.2 = [5 x i8] c"http\00"
@.str.3 = [27 x i8] c"%s - IPv4 address #%d: %s\0A\00"
@.str.4 = [3 x i8] c"-i\00"
@.str.5 = [24 x i8] c"Command line input: %s\0A\00"
@.str.6 = [20 x i8] c"Hostname found: %s\0A\00"
@str = [82 x i8] c"Error: Missing Hostname/IP Address or flag to decide IP->Hostname or Hostname->IP\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.addrinfo
%4 = alloca %struct.addrinfo*
%5 = alloca [100 x i8]
%6 = alloca %struct.addrinfo*
%7 = alloca [1000 x i8]
%8 = bitcast %struct.addrinfo* %3 to i8*
%9 = bitcast %struct.addrinfo** %4 to i8*
%10 = icmp slt i32 %0, 3
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([82 x i8], [82 x i8]* @str, i64 0, i64 0))
%13 = tail call i32 @exit(i32 1)
unreachable
14: ; preds = %2
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = tail call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %53
19: ; preds = %14
%20 = getelementptr inbounds i8*, i8** %1, i64 2
%21 = load i8*, i8** %20
%22 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%23 = call i32 @memset(%struct.addrinfo* %3, i32 0, i32 32)
%24 = load i32, i32* @AF_INET
%25 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 4
store i32 %24, i32* %25
%26 = load i32, i32* @SOCK_STREAM
%27 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %3, i64 0, i32 3
store i32 %26, i32* %27
%28 = call i32 @getaddrinfo(i8* %21, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), %struct.addrinfo* %3, %struct.addrinfo** %4)
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %19
%31 = load %struct.addrinfo*, %struct.addrinfo** %4
%32 = icmp eq %struct.addrinfo* %31, null
br i1 %32, label %52, label %37
33: ; preds = %19
%34 = call i32 @gai_strerror(i32 %28)
%35 = call i32 @perror(i32 %34)
%36 = call i32 @exit(i32 -1)
unreachable
37: ; preds = %30, %37
%38 = phi %struct.addrinfo* [ %50, %37 ], [ %31, %30 ]
%39 = phi i32 [ %48, %37 ], [ 1, %30 ]
%40 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %38, i64 0, i32 1
%41 = load i64, i64* %40
%42 = inttoptr i64 %41 to %struct.sockaddr_in*
%43 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %42, i64 0, i32 0
%44 = load i32, i32* %43
%45 = call i32 @inet_ntoa(i32 %44)
%46 = call i32 @strcpy(i8* %22, i32 %45)
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %21, i32 %39, i8* %22)
%48 = add nuw nsw i32 %39, 1
%49 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %38, i64 0, i32 2
%50 = load %struct.addrinfo*, %struct.addrinfo** %49
%51 = icmp eq %struct.addrinfo* %50, null
br i1 %51, label %52, label %37
52: ; preds = %37, %30
br label %83
53: ; preds = %14
%54 = load i8*, i8** %15
%55 = tail call i64 @strcmp(i8* %54, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%56 = icmp eq i64 %55, 0
br i1 %56, label %57, label %83
57: ; preds = %53
%58 = bitcast %struct.addrinfo** %6 to i8*
store %struct.addrinfo* null, %struct.addrinfo** %6
%59 = getelementptr inbounds i8*, i8** %1, i64 2
%60 = load i8*, i8** %59
%61 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 0
%62 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* %60)
%63 = call i32 @getaddrinfo(i8* %60, i8* null, %struct.addrinfo* null, %struct.addrinfo** %6)
%64 = icmp eq i32 %63, 0
br i1 %64, label %69, label %65
65: ; preds = %57
%66 = call i32 @gai_strerror(i32 %63)
%67 = call i32 @perror(i32 %66)
%68 = call i32 @exit(i32 -1)
unreachable
69: ; preds = %57
%70 = load %struct.addrinfo*, %struct.addrinfo** %6
%71 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %70, i64 0, i32 1
%72 = load i64, i64* %71
%73 = getelementptr inbounds %struct.addrinfo, %struct.addrinfo* %70, i64 0, i32 0
%74 = load i32, i32* %73
%75 = call i32 @getnameinfo(i64 %72, i32 %74, i8* %61, i32 1000, i32 0, i32 0, i32 0)
%76 = icmp eq i32 %75, 0
br i1 %76, label %81, label %77
77: ; preds = %69
%78 = call i32 @gai_strerror(i32 %75)
%79 = call i32 @perror(i32 %78)
%80 = call i32 @exit(i32 -1)
unreachable
81: ; preds = %69
%82 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i8* %61)
br label %83
83: ; preds = %53, %81, %52
ret i32 0
}