#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;
};
struct hostent {
  scalar_t__ h_addr;
};

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ close(int);
int connect(int, struct sockaddr *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
struct hostent *gethostbyname(char *);
int /*<<< orphan*/ herror(char *);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ inet_addr(char *);
scalar_t__ isdigit(char);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strncpy(char *, char *, int);
int main(int argc, char **argv) {
  struct hostent *host;
  int err, i, sock, start, end;
  char hostname[100];
  struct sockaddr_in sa;
  printf("Enter hostname or IP : ");
  scanf("%s", &hostname);
  printf("\nEnter start port number : ");
  scanf("%d", &start);
  printf("\nEnter end port number : ");
  scanf("%d", &end);
  strncpy((char *)&sa, "", sizeof sa);
  sa.sin_family = AF_INET;
  if (isdigit(hostname[0])) {
    printf("\nDoing inet_addr..");
    sa.sin_addr.s_addr = inet_addr(hostname);
    printf("Done\n");
  } else if ((host = gethostbyname(hostname)) != 0) {
    printf("\nDoing gethostbyname ..");
    strncpy((char *)&sa.sin_addr, (char *)host->h_addr, sizeof sa.sin_addr);
    printf("\nDone\n");
  } else {
    herror(hostname);
    exit(2);
  }
  printf("Starting the portscan loop : \n");
  for (i = start; i <= end; i++) {
    sa.sin_port = htons(i);
    sock = socket(AF_INET, SOCK_STREAM, 0);
    if (sock < 0) {
      perror("\nSocket");
      exit(1);
    }
    err = connect(sock, (struct sockaddr *)&sa, sizeof sa);
    if (err < 0) {
      fflush(stdout);
    } else {
      printf("%-5d open\n", i);
    }
    close(sock);
  }
  printf("\r");
  fflush(stdout);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe00(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe0a(%rip),%rdi
lea    -0x90(%rbp),%rsi
mov    $0x0,%al
call   10c0 <scanf@plt>
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe06(%rip),%rdi
lea    -0x28(%rbp),%rsi
mov    $0x0,%al
call   10c0 <scanf@plt>
lea    0xdf7(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xde6(%rip),%rdi
lea    -0x2c(%rbp),%rsi
mov    $0x0,%al
call   10c0 <scanf@plt>
lea    -0xa0(%rbp),%rdi
lea    0xe3a(%rip),%rsi
mov    $0xc,%edx
call   1030 <strncpy@plt>
mov    0x2d6d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x98(%rbp)
movsbl -0x90(%rbp),%edi
call   1040 <isdigit@plt>
cmp    $0x0,%rax
je     12cc <main+0xec>
lea    0xdb4(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x90(%rbp),%rdi
call   1080 <inet_addr@plt>
mov    %eax,-0x9c(%rbp)
lea    0xdc0(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    133e <main+0x15e>
lea    -0x90(%rbp),%rdi
call   1090 <gethostbyname@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1323 <main+0x143>
lea    0xd7a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0xa0(%rbp),%rdi
add    $0x4,%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
mov    $0x4,%edx
call   1030 <strncpy@plt>
lea    0xd68(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1339 <main+0x159>
lea    -0x90(%rbp),%rdi
call   10b0 <herror@plt>
mov    $0x2,%edi
call   10e0 <exit@plt>
jmp    133e <main+0x15e>
lea    0xd41(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x28(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jg     1403 <main+0x223>
mov    -0x20(%rbp),%edi
call   1050 <htons@plt>
mov    %eax,-0xa0(%rbp)
mov    0x2c75(%rip),%rax
mov    (%rax),%edi
mov    0x2c5c(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1100 <socket@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    13a8 <main+0x1c8>
lea    0xd0c(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x24(%rbp),%edi
lea    -0xa0(%rbp),%rsi
mov    $0xc,%edx
call   10f0 <connect@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    13dc <main+0x1fc>
mov    0x2c00(%rip),%rax
mov    (%rax),%edi
call   10a0 <fflush@plt>
jmp    13ed <main+0x20d>
mov    -0x20(%rbp),%esi
lea    0xcc7(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x24(%rbp),%edi
call   1070 <close@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1352 <main+0x172>
lea    0xcae(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    0x2bb8(%rip),%rax
mov    (%rax),%edi
call   10a0 <fflush@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
lea    0xde8(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xdf2(%rip),%rdi
lea    0x20(%rsp),%rsi
xor    %eax,%eax
call   10e0 <scanf@plt>
lea    0xde2(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xdf0(%rip),%rbx
lea    0x1c(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   10e0 <scanf@plt>
lea    0xddd(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   10e0 <scanf@plt>
lea    0xe17(%rip),%rsi
lea    0x10(%rsp),%rdi
mov    $0xc,%edx
call   1040 <strncpy@plt>
mov    0x2d58(%rip),%r12
mov    (%r12),%eax
mov    %eax,0x18(%rsp)
movsbl 0x20(%rsp),%edi
call   1050 <isdigit@plt>
test   %rax,%rax
je     12cc <main+0xcc>
lea    0xda6(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0x20(%rsp),%rdi
call   10a0 <inet_addr@plt>
mov    %eax,0x14(%rsp)
lea    0xdc9(%rip),%rdi
jmp    1309 <main+0x109>
lea    0x20(%rsp),%rdi
call   10b0 <gethostbyname@plt>
test   %rax,%rax
je     13e7 <main+0x1e7>
mov    %rax,%rbx
lea    0xd7e(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0x14(%rsp),%rdi
mov    (%rbx),%rsi
mov    $0x4,%edx
call   1040 <strncpy@plt>
lea    0xd89(%rip),%rdi
call   1060 <puts@plt>
lea    0xd83(%rip),%rdi
call   1060 <puts@plt>
mov    0x1c(%rsp),%ebx
cmp    0xc(%rsp),%ebx
jle    1350 <main+0x150>
mov    $0xd,%edi
call   1030 <putchar@plt>
mov    0x2c9b(%rip),%rax
mov    (%rax),%edi
call   10c0 <fflush@plt>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c81(%rip),%r13
lea    0x10(%rsp),%r14
lea    0xd24(%rip),%r15
jmp    1390 <main+0x190>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x2c59(%rip),%rax
mov    (%rax),%edi
call   10c0 <fflush@plt>
mov    %ebp,%edi
call   1090 <close@plt>
lea    0x1(%rbx),%eax
cmp    0xc(%rsp),%ebx
mov    %eax,%ebx
jge    1324 <main+0x124>
mov    %ebx,%edi
call   1070 <htons@plt>
mov    %eax,0x10(%rsp)
mov    (%r12),%edi
mov    0x0(%r13),%esi
xor    %edx,%edx
call   1120 <socket@plt>
test   %eax,%eax
js     13d1 <main+0x1d1>
mov    %eax,%ebp
mov    %eax,%edi
mov    %r14,%rsi
mov    $0xc,%edx
call   1110 <connect@plt>
test   %eax,%eax
js     1370 <main+0x170>
mov    %r15,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1080 <printf@plt>
jmp    137e <main+0x17e>
lea    0xca7(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
lea    0x20(%rsp),%rdi
call   10d0 <herror@plt>
mov    $0x2,%edi
call   1100 <exit@plt>

LLVM IR (-O0):
%struct.hostent = type { i64 }
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [24 x i8] c"Enter hostname or IP : \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [28 x i8] c"\0AEnter start port number : \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [26 x i8] c"\0AEnter end port number : \00"
@.str.5 = [1 x i8] zeroinitializer
@AF_INET = global i32 0
@.str.6 = [19 x i8] c"\0ADoing inet_addr..\00"
@.str.7 = [6 x i8] c"Done\0A\00"
@.str.8 = [24 x i8] c"\0ADoing gethostbyname ..\00"
@.str.9 = [7 x i8] c"\0ADone\0A\00"
@.str.10 = [31 x i8] c"Starting the portscan loop : \0A\00"
@SOCK_STREAM = global i32 0
@.str.11 = [8 x i8] c"\0ASocket\00"
@stdout = global i32 0
@.str.12 = [11 x i8] c"%-5d open\0A\00"
@.str.13 = [2 x i8] c"\0D\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.hostent*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca [100 x i8]
%13 = alloca %struct.sockaddr_in
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), [100 x i8]* %12)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %10)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %11)
%20 = bitcast %struct.sockaddr_in* %13 to i8*
%21 = call i32 @strncpy(i8* %20, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0), i32 12)
%22 = load i32, i32* @AF_INET
%23 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %13, i32 0, i32 2
store i32 %22, i32* %23
%24 = getelementptr inbounds [100 x i8], [100 x i8]* %12, i64 0, i64 0
%25 = load i8, i8* %24
%26 = call i64 @isdigit(i8 signext %25)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %35
28: ; preds = %2
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%30 = getelementptr inbounds [100 x i8], [100 x i8]* %12, i64 0, i64 0
%31 = call i32 @inet_addr(i8* %30)
%32 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %13, i32 0, i32 1
%33 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %32, i32 0, i32 0
store i32 %31, i32* %33
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
br label %54
35: ; preds = %2
%36 = getelementptr inbounds [100 x i8], [100 x i8]* %12, i64 0, i64 0
%37 = call %struct.hostent* @gethostbyname(i8* %36)
store %struct.hostent* %37, %struct.hostent** %6
%38 = icmp ne %struct.hostent* %37, null
br i1 %38, label %39, label %49
39: ; preds = %35
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0))
%41 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %13, i32 0, i32 1
%42 = bitcast %struct.TYPE_2__* %41 to i8*
%43 = load %struct.hostent*, %struct.hostent** %6
%44 = getelementptr inbounds %struct.hostent, %struct.hostent* %43, i32 0, i32 0
%45 = load i64, i64* %44
%46 = inttoptr i64 %45 to i8*
%47 = call i32 @strncpy(i8* %42, i8* %46, i32 4)
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
br label %53
49: ; preds = %35
%50 = getelementptr inbounds [100 x i8], [100 x i8]* %12, i64 0, i64 0
%51 = call i32 @herror(i8* %50)
%52 = call i32 @exit(i32 2)
unreachable
53: ; preds = %39
br label %54
54: ; preds = %53, %28
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.10, i64 0, i64 0))
%56 = load i32, i32* %10
store i32 %56, i32* %8
br label %57
57: ; preds = %88, %54
%58 = load i32, i32* %8
%59 = load i32, i32* %11
%60 = icmp sle i32 %58, %59
br i1 %60, label %61, label %91
61: ; preds = %57
%62 = load i32, i32* %8
%63 = call i32 @htons(i32 %62)
%64 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %13, i32 0, i32 0
store i32 %63, i32* %64
%65 = load i32, i32* @AF_INET
%66 = load i32, i32* @SOCK_STREAM
%67 = call i32 @socket(i32 %65, i32 %66, i32 0)
store i32 %67, i32* %9
%68 = load i32, i32* %9
%69 = icmp slt i32 %68, 0
br i1 %69, label %70, label %73
70: ; preds = %61
%71 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0))
%72 = call i32 @exit(i32 1)
unreachable
73: ; preds = %61
%74 = load i32, i32* %9
%75 = bitcast %struct.sockaddr_in* %13 to %struct.sockaddr*
%76 = call i32 @connect(i32 %74, %struct.sockaddr* %75, i32 12)
store i32 %76, i32* %7
%77 = load i32, i32* %7
%78 = icmp slt i32 %77, 0
br i1 %78, label %79, label %82
79: ; preds = %73
%80 = load i32, i32* @stdout
%81 = call i32 @fflush(i32 %80)
br label %85
82: ; preds = %73
%83 = load i32, i32* %8
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i32 %83)
br label %85
85: ; preds = %82, %79
%86 = load i32, i32* %9
%87 = call i32 @close(i32 %86)
br label %88
88: ; preds = %85
%89 = load i32, i32* %8
%90 = add nsw i32 %89, 1
store i32 %90, i32* %8
br label %57
91: ; preds = %57
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0))
%93 = load i32, i32* @stdout
%94 = call i32 @fflush(i32 %93)
ret i32 0
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.hostent = type { i64 }
%struct.sockaddr = type { i32 }
@.str = [24 x i8] c"Enter hostname or IP : \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [28 x i8] c"\0AEnter start port number : \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [26 x i8] c"\0AEnter end port number : \00"
@.str.5 = [1 x i8] zeroinitializer
@AF_INET = global i32 0
@.str.6 = [19 x i8] c"\0ADoing inet_addr..\00"
@.str.8 = [24 x i8] c"\0ADoing gethostbyname ..\00"
@SOCK_STREAM = global i32 0
@.str.11 = [8 x i8] c"\0ASocket\00"
@stdout = global i32 0
@.str.12 = [11 x i8] c"%-5d open\0A\00"
@str = [6 x i8] c"\0ADone\00"
@str.14 = [30 x i8] c"Starting the portscan loop : \00"
@str.15 = [5 x i8] c"Done\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [100 x i8]
%6 = alloca %struct.sockaddr_in
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%10 = bitcast %struct.sockaddr_in* %6 to i8*
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), [100 x i8]* %5)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %3)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %4)
%17 = call i32 @strncpy(i8* %10, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0), i32 12)
%18 = load i32, i32* @AF_INET
%19 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i64 0, i32 2
store i32 %18, i32* %19
%20 = load i8, i8* %9
%21 = call i64 @isdigit(i8 signext %20)
%22 = icmp eq i64 %21, 0
br i1 %22, label %27, label %23
23: ; preds = %2
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%25 = call i32 @inet_addr(i8* %9)
%26 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i64 0, i32 1, i32 0
store i32 %25, i32* %26
br label %41
27: ; preds = %2
%28 = call %struct.hostent* @gethostbyname(i8* %9)
%29 = icmp eq %struct.hostent* %28, null
br i1 %29, label %38, label %30
30: ; preds = %27
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0))
%32 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i64 0, i32 1
%33 = bitcast %struct.TYPE_2__* %32 to i8*
%34 = getelementptr inbounds %struct.hostent, %struct.hostent* %28, i64 0, i32 0
%35 = load i64, i64* %34
%36 = inttoptr i64 %35 to i8*
%37 = call i32 @strncpy(i8* %33, i8* %36, i32 4)
br label %41
38: ; preds = %27
%39 = call i32 @herror(i8* %9)
%40 = call i32 @exit(i32 2)
unreachable
41: ; preds = %30, %23
%42 = phi i8* [ getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0), %30 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @str.15, i64 0, i64 0), %23 ]
%43 = call i32 @puts(i8* dereferenceable(1) %42)
%44 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.14, i64 0, i64 0))
%45 = load i32, i32* %3
%46 = load i32, i32* %4
%47 = icmp sgt i32 %45, %46
br i1 %47, label %74, label %48
48: ; preds = %41
%49 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i64 0, i32 0
%50 = bitcast %struct.sockaddr_in* %6 to %struct.sockaddr*
br label %51
51: ; preds = %48, %69
%52 = phi i32 [ %45, %48 ], [ %71, %69 ]
%53 = call i32 @htons(i32 %52)
store i32 %53, i32* %49
%54 = load i32, i32* @AF_INET
%55 = load i32, i32* @SOCK_STREAM
%56 = call i32 @socket(i32 %54, i32 %55, i32 0)
%57 = icmp slt i32 %56, 0
br i1 %57, label %58, label %61
58: ; preds = %51
%59 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0))
%60 = call i32 @exit(i32 1)
unreachable
61: ; preds = %51
%62 = call i32 @connect(i32 %56, %struct.sockaddr* %50, i32 12)
%63 = icmp slt i32 %62, 0
br i1 %63, label %64, label %67
64: ; preds = %61
%65 = load i32, i32* @stdout
%66 = call i32 @fflush(i32 %65)
br label %69
67: ; preds = %61
%68 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i32 %52)
br label %69
69: ; preds = %67, %64
%70 = call i32 @close(i32 %56)
%71 = add nsw i32 %52, 1
%72 = load i32, i32* %4
%73 = icmp slt i32 %52, %72
br i1 %73, label %51, label %74
74: ; preds = %69, %41
%75 = call i32 @putchar(i32 13)
%76 = load i32, i32* @stdout
%77 = call i32 @fflush(i32 %76)
ret i32 0
}