// File: PepiJK[P]Mail-Server-Client/src/myhelper/myhelper.cpp
// Function: MyHelper::checkServerArguments(int, char**)
void MyHelper::checkServerArguments(int argc, char *argv[])
{
    if (argc < 3)
    {
        cout << "Usage: " << argv[0] << " <port> <directory>" << endl;
        exit(EXIT_FAILURE);
    }

    if (!stringIsInt(argv[1]) || stoi(argv[1]) < 1024 || stoi(argv[1]) > 65535)
    {
        cout << "Invalid port" << endl;
        exit(EXIT_FAILURE);
    }

    if (opendir(argv[2]) == NULL)
    {
        perror("directory error");
        exit(EXIT_FAILURE);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xa8(%rbp)
cmpl $0x3, -0xc(%rbp)
jge 0x38b1
movq 0xa762(%rip), %rdi      # 0xdfd0
leaq 0x678f(%rip), %rsi      # 0xa004
callq 0x3350
movq %rax, %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
callq 0x3350
movq %rax, %rdi
leaq 0x6779(%rip), %rsi      # 0xa00c
callq 0x3350
movq %rax, %rdi
movq 0xa716(%rip), %rsi      # 0xdfb8
callq 0x3390
movl $0x1, %edi
callq 0x3410
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xb8(%rbp)
leaq -0x39(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
callq 0x35d0
movq -0xb8(%rbp), %rsi
movq -0xb0(%rbp), %rdx
movb $0x0, -0x72(%rbp)
movb $0x0, -0x73(%rbp)
movb $0x0, -0x9a(%rbp)
movb $0x0, -0x9b(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x4420
jmp 0x38ff
movq -0xa8(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x3bd0
movb %al, -0xb9(%rbp)
jmp 0x3917
movb -0xb9(%rbp), %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, -0xba(%rbp)
jne 0x392f
jmp 0x3a1c
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xd0(%rbp)
leaq -0x71(%rbp), %rdi
movq %rdi, -0xc8(%rbp)
callq 0x35d0
movq -0xd0(%rbp), %rsi
movq -0xc8(%rbp), %rdx
movb $0x1, -0x72(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x4420
jmp 0x396b
movb $0x1, -0x73(%rbp)
xorl %eax, %eax
movl %eax, %esi
leaq -0x70(%rbp), %rdi
movl $0xa, %edx
callq 0x44d0
movl %eax, -0xd4(%rbp)
jmp 0x3989
movl -0xd4(%rbp), %ecx
movb $0x1, %al
cmpl $0x400, %ecx            # imm = 0x400
movb %al, -0xba(%rbp)
jl 0x3a1c
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xe8(%rbp)
leaq -0x99(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
callq 0x35d0
movq -0xe8(%rbp), %rsi
movq -0xe0(%rbp), %rdx
movb $0x1, -0x9a(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x4420
jmp 0x39e4
movb $0x1, -0x9b(%rbp)
xorl %eax, %eax
movl %eax, %esi
leaq -0x98(%rbp), %rdi
movl $0xa, %edx
callq 0x44d0
movl %eax, -0xec(%rbp)
jmp 0x3a08
movl -0xec(%rbp), %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
setg %al
movb %al, -0xba(%rbp)
movb -0xba(%rbp), %al
movb %al, -0xed(%rbp)
testb $0x1, -0x9b(%rbp)
jne 0x3a33
jmp 0x3a3f
leaq -0x98(%rbp), %rdi
callq 0x3210
testb $0x1, -0x9a(%rbp)
jne 0x3a4a
jmp 0x3a56
leaq -0x99(%rbp), %rdi
callq 0x33c0
testb $0x1, -0x73(%rbp)
jne 0x3a5e
jmp 0x3a67
leaq -0x70(%rbp), %rdi
callq 0x3210
testb $0x1, -0x72(%rbp)
jne 0x3a6f
jmp 0x3a78
leaq -0x71(%rbp), %rdi
callq 0x33c0
leaq -0x38(%rbp), %rdi
callq 0x3210
leaq -0x39(%rbp), %rdi
callq 0x33c0
movb -0xed(%rbp), %al
testb $0x1, %al
jne 0x3a99
jmp 0x3b89
movq 0xa530(%rip), %rdi      # 0xdfd0
leaq 0x6579(%rip), %rsi      # 0xa020
callq 0x3350
movq %rax, %rdi
movq 0xa502(%rip), %rsi      # 0xdfb8
callq 0x3390
movl $0x1, %edi
callq 0x3410
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x3b7e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x3b75
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x3b62
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x3b4f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x3b36
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
testb $0x1, -0x9b(%rbp)
jne 0x3b28
jmp 0x3b34
leaq -0x98(%rbp), %rdi
callq 0x3210
jmp 0x3b36
testb $0x1, -0x9a(%rbp)
jne 0x3b41
jmp 0x3b4d
leaq -0x99(%rbp), %rdi
callq 0x33c0
jmp 0x3b4f
testb $0x1, -0x73(%rbp)
jne 0x3b57
jmp 0x3b60
leaq -0x70(%rbp), %rdi
callq 0x3210
jmp 0x3b62
testb $0x1, -0x72(%rbp)
jne 0x3b6a
jmp 0x3b73
leaq -0x71(%rbp), %rdi
callq 0x33c0
jmp 0x3b75
leaq -0x38(%rbp), %rdi
callq 0x3210
leaq -0x39(%rbp), %rdi
callq 0x33c0
jmp 0x3bbb
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x34f0
cmpq $0x0, %rax
jne 0x3bb2
leaq 0x648a(%rip), %rdi      # 0xa02d
callq 0x32d0
movl $0x1, %edi
callq 0x3410
addq $0xf0, %rsp
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x35c0
nopw %cs:(%rax,%rax)