#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*/ VMISSL_CheckAlive(char *, int);
scalar_t__ VMISSL_Init(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ VMISSL_Release(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int strtoull(char *, int /*<<< orphan*/ *, int /*<<< orphan*/);
int main(int argc, char **argv) {
  if (argc < 2) {
    printf("%s servip [servport]\n", argv[0]);
    return 0;
  }
  int port = 443;
  if (argc > 2) {
    port = strtoull(argv[2], NULL, 0);
    if (port < 1)
      port = 443;
  }
  if (VMISSL_Init(NULL, NULL) != 0) {
    printf("init failed\n");
  } else {
    printf("init ok\n");
  }
  VMISSL_CheckAlive(argv[1], port);
  VMISSL_Release(NULL, NULL);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1191 <main+0x41>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1228 <main+0xd8>
movl   $0x1bb,-0x14(%rbp)
cmpl   $0x2,-0x8(%rbp)
jle    11ce <main+0x7e>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1050 <strtoull@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jge    11c9 <main+0x79>
movl   $0x1bb,-0x14(%rbp)
jmp    11ce <main+0x7e>
xor    %eax,%eax
mov    %eax,%esi
mov    %rsi,%rdi
call   1040 <VMISSL_Init@plt>
cmp    $0x0,%rax
je     11f7 <main+0xa7>
lea    0xe2b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1205 <main+0xb5>
lea    0xe25(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x14(%rbp),%esi
call   1060 <VMISSL_CheckAlive@plt>
xor    %eax,%eax
mov    %eax,%esi
mov    %rsi,%rdi
call   1070 <VMISSL_Release@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x1,%edi
jg     117e <main+0x1e>
mov    (%rbx),%rsi
lea    0xe8b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11d6 <main+0x76>
mov    $0x1bb,%ebp
cmp    $0x2,%edi
je     119f <main+0x3f>
mov    0x10(%rbx),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <strtoull@plt>
test   %eax,%eax
mov    $0x1bb,%ebp
cmovg  %eax,%ebp
xor    %edi,%edi
xor    %esi,%esi
call   1050 <VMISSL_Init@plt>
test   %rax,%rax
lea    0xe64(%rip),%rax
lea    0xe65(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
mov    0x8(%rbx),%rdi
mov    %ebp,%esi
call   1070 <VMISSL_CheckAlive@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1080 <VMISSL_Release@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"%s servip [servport]\0A\00"
@.str.1 = [13 x i8] c"init failed\0A\00"
@.str.2 = [9 x i8] c"init ok\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %12)
store i32 0, i32* %3
br label %40
14: ; preds = %2
store i32 443, i32* %6
%15 = load i32, i32* %4
%16 = icmp sgt i32 %15, 2
br i1 %16, label %17, label %26
17: ; preds = %14
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 2
%20 = load i8*, i8** %19
%21 = call i32 @strtoull(i8* %20, i32* null, i32 0)
store i32 %21, i32* %6
%22 = load i32, i32* %6
%23 = icmp slt i32 %22, 1
br i1 %23, label %24, label %25
24: ; preds = %17
store i32 443, i32* %6
br label %25
25: ; preds = %24, %17
br label %26
26: ; preds = %25, %14
%27 = call i64 @VMISSL_Init(i32* null, i32* null)
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %33
31: ; preds = %26
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %33
33: ; preds = %31, %29
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 1
%36 = load i8*, i8** %35
%37 = load i32, i32* %6
%38 = call i32 @VMISSL_CheckAlive(i8* %36, i32 %37)
%39 = call i32 @VMISSL_Release(i32* null, i32* null)
store i32 0, i32* %3
br label %40
40: ; preds = %33, %9
%41 = load i32, i32* %3
ret i32 %41
}

LLVM IR (-O2):
@.str = [22 x i8] c"%s servip [servport]\0A\00"
@str = [8 x i8] c"init ok\00"
@str.3 = [12 x i8] c"init failed\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %25
7: ; preds = %2
%8 = icmp eq i32 %0, 2
br i1 %8, label %15, label %9
9: ; preds = %7
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = tail call i32 @strtoull(i8* nocapture %11, i32* null, i32 0)
%13 = icmp slt i32 %12, 1
%14 = select i1 %13, i32 443, i32 %12
br label %15
15: ; preds = %9, %7
%16 = phi i32 [ %14, %9 ], [ 443, %7 ]
%17 = tail call i64 @VMISSL_Init(i32* null, i32* null)
%18 = icmp eq i64 %17, 0
%19 = select i1 %18, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @str.3, i64 0, i64 0)
%20 = tail call i32 @puts(i8* dereferenceable(1) %19)
%21 = getelementptr inbounds i8*, i8** %1, i64 1
%22 = load i8*, i8** %21
%23 = tail call i32 @VMISSL_CheckAlive(i8* %22, i32 %16)
%24 = tail call i32 @VMISSL_Release(i32* null, i32* null)
br label %25
25: ; preds = %15, %4
ret i32 0
}