#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 */

/* Variables and functions */
int /*<<< orphan*/ port_scanner(char *, char *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main(int argc, char *argv[]) {
  if (argc < 4) {
    printf("please enter the server IP address and range of ports to be "
           "scanned\n");
    printf("IPv4 First_Port Last_Port\n");
  }
  char tIP[16] = {0};
  strcpy(tIP, argv[1]);
  char First_Port[6] = {0};
  strcpy(First_Port, argv[2]);
  char Last_Port[6] = {0};
  strcpy(Last_Port, argv[3]);
  port_scanner(tIP, First_Port, Last_Port);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    1178 <main+0x38>
lea    0xe99(%rip),%rdi
call   1050 <printf@plt>
lea    0xed2(%rip),%rdi
call   1050 <printf@plt>
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1060 <memset@plt>
lea    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
lea    -0x26(%rbp),%rdi
xor    %esi,%esi
mov    $0x6,%edx
call   1060 <memset@plt>
lea    -0x26(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1030 <strcpy@plt>
lea    -0x2c(%rbp),%rdi
xor    %esi,%esi
mov    $0x6,%edx
call   1060 <memset@plt>
lea    -0x2c(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
call   1030 <strcpy@plt>
lea    -0x20(%rbp),%rdi
lea    -0x26(%rbp),%rsi
lea    -0x2c(%rbp),%rdx
call   1040 <port_scanner@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%rbx
cmp    $0x3,%edi
jg     1159 <main+0x29>
lea    0xeb8(%rip),%rdi
call   1040 <puts@plt>
lea    0xef0(%rip),%rdi
call   1040 <puts@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
mov    0x8(%rbx),%rsi
lea    0x10(%rsp),%r14
mov    %r14,%rdi
call   1030 <strcpy@plt>
movw   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
mov    0x10(%rbx),%rsi
lea    0x8(%rsp),%r15
mov    %r15,%rdi
call   1030 <strcpy@plt>
movw   $0x0,0x4(%rsp)
movl   $0x0,(%rsp)
mov    0x18(%rbx),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1050 <port_scanner@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [69 x i8] c"please enter the server IP address and range of ports to be scanned\0A\00"
@.str.1 = [27 x i8] c"IPv4 First_Port Last_Port\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [16 x i8]
%7 = alloca [6 x i8]
%8 = alloca [6 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 4
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = call i32 @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %11, %2
%15 = bitcast [16 x i8]* %6 to i8*
%16 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32 @strcpy(i8* %16, i8* %19)
%21 = bitcast [6 x i8]* %7 to i8*
%22 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 0
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 2
%25 = load i8*, i8** %24
%26 = call i32 @strcpy(i8* %22, i8* %25)
%27 = bitcast [6 x i8]* %8 to i8*
%28 = getelementptr inbounds [6 x i8], [6 x i8]* %8, i64 0, i64 0
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 3
%31 = load i8*, i8** %30
%32 = call i32 @strcpy(i8* %28, i8* %31)
%33 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%34 = getelementptr inbounds [6 x i8], [6 x i8]* %7, i64 0, i64 0
%35 = getelementptr inbounds [6 x i8], [6 x i8]* %8, i64 0, i64 0
%36 = call i32 @port_scanner(i8* %33, i8* %34, i8* %35)
ret i32 0
}

LLVM IR (-O2):
@str = [68 x i8] c"please enter the server IP address and range of ports to be scanned\00"
@str.2 = [26 x i8] c"IPv4 First_Port Last_Port\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [16 x i8]
%4 = alloca [6 x i8]
%5 = alloca [6 x i8]
%6 = icmp slt i32 %0, 4
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @str, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.2, i64 0, i64 0))
br label %10
10: ; preds = %7, %2
%11 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @strcpy(i8* %11, i8* %13)
%15 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 0
%16 = getelementptr inbounds i8*, i8** %1, i64 2
%17 = load i8*, i8** %16
%18 = call i32 @strcpy(i8* %15, i8* %17)
%19 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 0
%20 = getelementptr inbounds i8*, i8** %1, i64 3
%21 = load i8*, i8** %20
%22 = call i32 @strcpy(i8* %19, i8* %21)
%23 = call i32 @port_scanner(i8* %11, i8* %15, i8* %19)
ret i32 0
}