LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: ostafen[P]Fast-Insertion-Sort/src/algo.cpp
// Function: InplaceInsertionBlock<int>::inplace_insertion_block(int*, int, int)
void inplace_insertion_block(T *A, int e, int k)
    {
        int l, r;
        r = e;
        l = e - 2 * k;

        int i = e - k;
        while (i >= 0 && l >= 0 && r > (e - k))
        {
            if (A[l] > A[r])
            {
                swap(&A[i], &A[l]);
                l--;
            }
            else
            {
                swap(&A[i], &A[r]);
                r--;
            }
            i--;
        }

        while (l >= 0)
        {
            swap(&A[i], &A[l]);
            i--;
            l--;
        }

        while (r > e - k)
        {
            swap(&A[i], &A[r]);
            i--;
            r--;
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x14(%rbp), %eax
movl -0x18(%rbp), %ecx
shll %ecx
subl %ecx, %eax
movl %eax, -0x1c(%rbp)
movl -0x14(%rbp), %eax
subl -0x18(%rbp), %eax
movl %eax, -0x24(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x24(%rbp)
movb %al, -0x25(%rbp)
jl 0x5679
xorl %eax, %eax
cmpl $0x0, -0x1c(%rbp)
movb %al, -0x25(%rbp)
jl 0x5679
movl -0x20(%rbp), %eax
movl -0x14(%rbp), %ecx
subl -0x18(%rbp), %ecx
cmpl %ecx, %eax
setg %al
movb %al, -0x25(%rbp)
movb -0x25(%rbp), %al
testb $0x1, %al
jne 0x5685
jmp 0x5705
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movq -0x10(%rbp), %rcx
movslq -0x20(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jle 0x56cb
movq -0x10(%rbp), %rdi
movslq -0x24(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rdi
movq -0x10(%rbp), %rsi
movslq -0x1c(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rsi
callq 0x5820
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x56f7
movq -0x10(%rbp), %rdi
movslq -0x24(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rdi
movq -0x10(%rbp), %rsi
movslq -0x20(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rsi
callq 0x5820
movl -0x20(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x20(%rbp)
movl -0x24(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x5652
jmp 0x5707
cmpl $0x0, -0x1c(%rbp)
jl 0x5744
movq -0x10(%rbp), %rdi
movslq -0x24(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rdi
movq -0x10(%rbp), %rsi
movslq -0x1c(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rsi
callq 0x5820
movl -0x24(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x24(%rbp)
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x5707
jmp 0x5746
movl -0x20(%rbp), %eax
movl -0x14(%rbp), %ecx
subl -0x18(%rbp), %ecx
cmpl %ecx, %eax
jle 0x578a
movq -0x10(%rbp), %rdi
movslq -0x24(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rdi
movq -0x10(%rbp), %rsi
movslq -0x20(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rsi
callq 0x5820
movl -0x24(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x24(%rbp)
movl -0x20(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x5746
addq $0x30, %rsp
popq %rbp
retq
// File: ostafen[P]Fast-Insertion-Sort/src/algo.cpp
// Function: InplaceInsertionBlock<int>::insertion(int*, int)
void insertion(T *A, int i)
    {
        int j = i - 1;
        int value = A[i];
        while (j >= 0 && A[j] > value)
        {
            A[j + 1] = A[j];
            j--;
        }
        A[j + 1] = value;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl -0x14(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x1c(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x18(%rbp)
movb %al, -0x1d(%rbp)
jl 0x57d5
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
movl (%rax,%rcx,4), %eax
cmpl -0x1c(%rbp), %eax
setg %al
movb %al, -0x1d(%rbp)
movb -0x1d(%rbp), %al
testb $0x1, %al
jne 0x57de
jmp 0x5804
movq -0x10(%rbp), %rax
movslq -0x18(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x10(%rbp), %rax
movl -0x18(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl -0x18(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x57b6
movl -0x1c(%rbp), %edx
movq -0x10(%rbp), %rax
movl -0x18(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
popq %rbp
retq
nopl (%rax)
// File: ostafen[P]Fast-Insertion-Sort/src/algo.cpp
// Function: InsertionSort<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>::sort(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, int)
void sort(T *A, int n)
    {
        for (int i = 1; i < n; i++)
        {
            int j = i - 1;
            T value = A[i];
            while (j >= 0 && A[j] > value)
            {
                A[j + 1] = A[j];
                j--;
            }
            A[j + 1] = value;
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl $0x1, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x6949
movl -0x18(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rsi
movslq -0x18(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rsi
leaq -0x40(%rbp), %rdi
callq 0x30d0
xorl %eax, %eax
cmpl $0x0, -0x1c(%rbp)
movb %al, -0x4d(%rbp)
jl 0x68cd
movq -0x10(%rbp), %rdi
movslq -0x1c(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rdi
leaq -0x40(%rbp), %rsi
callq 0x69d0
movb %al, -0x4d(%rbp)
movb -0x4d(%rbp), %al
testb $0x1, %al
jne 0x68d6
jmp 0x6916
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
shlq $0x5, %rcx
movq %rax, %rsi
addq %rcx, %rsi
leaq 0x20(%rax,%rcx), %rdi
callq 0x3050
jmp 0x68f4
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x68a7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x3120
jmp 0x694f
movq -0x10(%rbp), %rcx
movslq -0x1c(%rbp), %rax
shlq $0x5, %rax
leaq 0x20(%rax,%rcx), %rdi
leaq -0x40(%rbp), %rsi
callq 0x3050
jmp 0x6932
leaq -0x40(%rbp), %rdi
callq 0x3120
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x687a
addq $0x50, %rsp
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x3390
nopl (%rax,%rax)
// File: ostafen[P]Fast-Insertion-Sort/src/algo.cpp
// Function: QuickSort<int>::_sort(int*, int, int)
void _sort(T arr[], int low, int high)
    {
        if(low < high) {
            int pi = partition(arr, low, high);
            _sort(arr, low, pi - 1);
            _sort(arr, pi + 1, high);
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x5e08
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
callq 0x5e10
movq -0x28(%rbp), %rdi
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
callq 0x5da0
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x1c(%rbp), %edx
addl $0x1, %edx
movl -0x18(%rbp), %ecx
callq 0x5da0
addq $0x30, %rsp
popq %rbp
retq
nop
// File: ostafen[P]Fast-Insertion-Sort/src/algo.cpp
// Function: QuickSort<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>::partition(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, int, int)
int partition(T arr[], int low, int high)
    {
        T pivot = arr[high];
        int i = (low - 1);

        for (int j = low; j <= high - 1; j++)
        {
            if (arr[j] <= pivot)
            {
                i++;
                swap(&arr[i], &arr[j]);
            }
        }
        swap(&arr[i + 1], &arr[high]);
        return i + 1;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movq -0x10(%rbp), %rsi
movslq -0x18(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rsi
leaq -0x38(%rbp), %rdi
callq 0x30d0
movl -0x14(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x3c(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x40(%rbp)
movl -0x40(%rbp), %eax
movl -0x18(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jg 0x6b3a
movq -0x10(%rbp), %rdi
movslq -0x40(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rdi
leaq -0x38(%rbp), %rsi
callq 0x6b90
testb $0x1, %al
jne 0x6ae8
jmp 0x6b2d
movl -0x3c(%rbp), %eax
incl %eax
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rsi
movslq -0x3c(%rbp), %rax
shlq $0x5, %rax
movq %rsi, %rdi
addq %rax, %rdi
movslq -0x40(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rsi
callq 0x6bd0
jmp 0x6b14
jmp 0x6b2d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x3120
jmp 0x6b78
jmp 0x6b2f
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x6abd
movq -0x10(%rbp), %rsi
movslq -0x3c(%rbp), %rax
shlq $0x5, %rax
leaq 0x20(%rax,%rsi), %rdi
movslq -0x18(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rsi
callq 0x6bd0
jmp 0x6b5d
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x3120
movl -0x50(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x3390
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)
// File: ostafen[P]Fast-Insertion-Sort/src/algo.cpp
// Function: QuickInsertionSort<int>::_sort(int*, int, int)
void _sort(T arr[], int low, int high)
    {
        int size = (high - low) + 1;
        if (size <= 10)
        {
            is.sort(arr + low, size);
            return;
        }
        int pi = partition(arr, low, high);
        _sort(arr, low, pi - 1);
        _sort(arr, pi + 1, high);
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movl -0x18(%rbp), %eax
subl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
cmpl $0xa, -0x1c(%rbp)
jg 0x5fc1
movq -0x28(%rbp), %rdi
addq $0x8, %rdi
movq -0x10(%rbp), %rsi
movslq -0x14(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rsi
movl -0x1c(%rbp), %edx
callq 0x5c80
jmp 0x6003
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
callq 0x6010
movq -0x28(%rbp), %rdi
movl %eax, -0x20(%rbp)
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
movl -0x20(%rbp), %ecx
subl $0x1, %ecx
callq 0x5f70
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x20(%rbp), %edx
addl $0x1, %edx
movl -0x18(%rbp), %ecx
callq 0x5f70
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: ostafen[P]Fast-Insertion-Sort/src/algo.cpp
// Function: MergeSort<int>::_sort(int*, int, int, int*)
void _sort(T *A, int l, int r, T *X)
    {
        if (l < r)
        {
            int m = l + (r - l) / 2;
            _sort(A, l, m, X);
            _sort(A, m + 1, r, X);
            merge(A, l, m, r, X);
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movq %r8, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x6234
movq -0x30(%rbp), %rdi
movl -0x14(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x18(%rbp), %eax
subl -0x14(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x34(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
movl -0x24(%rbp), %ecx
movq -0x20(%rbp), %r8
callq 0x61a0
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x24(%rbp), %edx
addl $0x1, %edx
movl -0x18(%rbp), %ecx
movq -0x20(%rbp), %r8
callq 0x61a0
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
movl -0x24(%rbp), %ecx
movl -0x18(%rbp), %r8d
movq -0x20(%rbp), %r9
callq 0x6240
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: ostafen[P]Fast-Insertion-Sort/src/algo.cpp
// Function: HeapSort<int>::sort(int*, int)
virtual void sort(T *A, int n)
    {
        for (int i = n / 2 - 1; i >= 0; i--)
            heapify(A, n, i);

        for (int i = n - 1; i >= 0; i--)
        {
            swap(&A[0], &A[i]);
            heapify(A, i, 0);
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movl -0x14(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
subl $0x1, %eax
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
jl 0x6420
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
callq 0x64e0
movl -0x18(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x63fc
movl -0x14(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jl 0x6464
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rsi
movslq -0x1c(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rsi
callq 0x5820
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x1c(%rbp), %edx
xorl %ecx, %ecx
callq 0x64e0
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x6429
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: ostafen[P]Fast-Insertion-Sort/src/algo.cpp
// Function: HeapSort<int>::heapify(int*, int, int)
void heapify(T arr[], int n, int i)
    {
        int largest = i;
        int l = 2 * i + 1;
        int r = 2 * i + 2;

        if (l < n && arr[l] > arr[largest])
            largest = l;

        if (r < n && arr[r] > arr[largest])
            largest = r;

        if (largest != i)
        {
            swap(&arr[i], &arr[largest]);

            heapify(arr, n, largest);
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x18(%rbp), %eax
shll %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
movl -0x18(%rbp), %eax
shll %eax
addl $0x2, %eax
movl %eax, -0x24(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x6540
movq -0x10(%rbp), %rax
movslq -0x20(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movq -0x10(%rbp), %rcx
movslq -0x1c(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jle 0x6540
movl -0x20(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x6566
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movq -0x10(%rbp), %rcx
movslq -0x1c(%rbp), %rdx
cmpl (%rcx,%rdx,4), %eax
jle 0x6566
movl -0x24(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x18(%rbp), %eax
je 0x65a4
movq -0x10(%rbp), %rdi
movslq -0x18(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rdi
movq -0x10(%rbp), %rsi
movslq -0x1c(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rsi
callq 0x5820
movq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
movl -0x1c(%rbp), %ecx
callq 0x64e0
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: ostafen[P]Fast-Insertion-Sort/src/gen.cpp
// Function: IntArrayGenerator::random(int)
virtual int *random(int size)
    {
        int *v = new int[size];
        for (int i = 0; i < size; i++)
        {
            v[i] = randomInt();
        }
        return v;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movslq -0xc(%rbp), %rax
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x3030
movq %rax, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x6660
movq -0x28(%rbp), %rdi
callq 0x6670
movl %eax, %edx
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x6637
movq -0x18(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: ostafen[P]Fast-Insertion-Sort/src/gen.cpp
// Function: StringArrayGenerator::random[abi:cxx11](int)
virtual string *random(int size)
    {
        string *A = new string[size];

        for (int i = 0; i < size; i++)
        {
            int len = rand() % maxLength;
            A[i] = getRandomString(len);
        }
        return A;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
movslq -0xc(%rbp), %rax
movq %rax, -0x50(%rbp)
movl $0x20, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
addq $0x8, %rdi
setb %al
orb %al, %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x3030
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rax, (%rcx)
addq $0x8, %rcx
movq %rcx, -0x48(%rbp)
cmpq $0x0, %rax
je 0x716d
movq -0x48(%rbp), %rax
movq -0x50(%rbp), %rdx
shlq $0x5, %rdx
movq %rax, %rcx
addq %rdx, %rcx
movq %rcx, -0x68(%rbp)
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
movq %rdi, -0x70(%rbp)
callq 0x32f0
movq -0x70(%rbp), %rax
movq -0x68(%rbp), %rcx
addq $0x20, %rax
cmpq %rcx, %rax
movq %rax, -0x60(%rbp)
jne 0x714b
movq -0x48(%rbp), %rax
movq %rax, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x71cc
callq 0x3080
movq -0x58(%rbp), %rsi
cltd
idivl 0x8(%rsi)
movl %edx, -0x20(%rbp)
movl -0x20(%rbp), %edx
leaq -0x40(%rbp), %rdi
callq 0x71e0
movq -0x18(%rbp), %rdi
movslq -0x1c(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rdi
leaq -0x40(%rbp), %rsi
callq 0x32b0
leaq -0x40(%rbp), %rdi
callq 0x3120
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x717c
movq -0x18(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: ostafen[P]Fast-Insertion-Sort/src/gen.cpp
// Function: StringArrayGenerator::getRandomString[abi:cxx11](int)
string getRandomString(int len)
    {
        string s = "";
        for (int j = 0; j < len; j++)
            s += (char)(rand() % 256);
        return s;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x38(%rbp)
movq %rdi, %rax
movq %rax, -0x40(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movb $0x0, -0x15(%rbp)
leaq -0x16(%rbp), %rdi
movq %rdi, -0x30(%rbp)
callq 0x33a0
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rdx
leaq 0x4f7e(%rip), %rsi      # 0xc19c
callq 0x5850
jmp 0x7225
leaq -0x16(%rbp), %rdi
callq 0x3260
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x728b
callq 0x3080
movq -0x38(%rbp), %rdi
movsbl %al, %esi
callq 0x3130
jmp 0x7250
jmp 0x7252
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x7235
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x16(%rbp), %rdi
callq 0x3260
jmp 0x72a8
movq -0x38(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
callq 0x3120
jmp 0x72a8
movb $0x1, -0x15(%rbp)
testb $0x1, -0x15(%rbp)
jne 0x729e
movq -0x38(%rbp), %rdi
callq 0x3120
movq -0x40(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
movq -0x20(%rbp), %rdi
callq 0x3390
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)
// File: ostafen[P]Fast-Insertion-Sort/src/gen.cpp
// Function: DoubleArrayGenerator::random(int)
virtual double *random(int size)
    {

        double *v = new double[size];
        for (int i = 0; i < size; i++)
        {
            v[i] = randomDouble();
        }
        return v;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movslq -0xc(%rbp), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x3030
movq %rax, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x7af0
movq -0x28(%rbp), %rdi
callq 0x7b00
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x7ac7
movq -0x18(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: ostafen[P]Fast-Insertion-Sort/src/gen.cpp
// Function: DoubleArrayGenerator::randomDouble()
double randomDouble()
    {
        std::random_device rd;
        std::mt19937 gen(rd());
        double d = std::generate_canonical<double, 10>(gen);
        return d * (rand() % max);
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2760, %rsp           # imm = 0x2760
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x2748(%rbp)
leaq -0x1390(%rbp), %rdi
movq %rdi, -0x2740(%rbp)
callq 0x7c00
movq -0x2740(%rbp), %rdi
callq 0x7ca0
movl %eax, -0x2734(%rbp)
jmp 0x7b41
movl -0x2734(%rbp), %eax
movl %eax, %eax
movl %eax, %esi
leaq -0x2718(%rbp), %rdi
callq 0x7cc0
jmp 0x7b59
leaq -0x2718(%rbp), %rdi
callq 0x7cf0
movsd %xmm0, -0x2750(%rbp)
jmp 0x7b6f
movsd -0x2750(%rbp), %xmm0
movsd %xmm0, -0x2730(%rbp)
movsd -0x2730(%rbp), %xmm0
movsd %xmm0, -0x2760(%rbp)
callq 0x3080
movq -0x2748(%rbp), %rcx
movsd -0x2760(%rbp), %xmm0
cltd
idivl 0xc(%rcx)
cvtsi2sd %edx, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, -0x2758(%rbp)
leaq -0x1390(%rbp), %rdi
callq 0x7f10
movsd -0x2758(%rbp), %xmm0
addq $0x2760, %rsp           # imm = 0x2760
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x2720(%rbp)
movl %eax, -0x2724(%rbp)
leaq -0x1390(%rbp), %rdi
callq 0x7f10
movq -0x2720(%rbp), %rdi
callq 0x3390
nop
// File: ostafen[P]Fast-Insertion-Sort/src/algo.cpp
// Function: FastInsertionSort<int>::sort(int*, int)
virtual void sort(T *A, int n)
    {
        int i = log(log_base, n);
        float exp = (float)(i - 1) / i;
        int k_0 = pow(n, exp);
        if (k_0 <= 0)
            return;

        T b[k_0];
        _sort(A, n, i, b);
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x38(%rbp)
movss 0x18(%rdi), %xmm0
cvtsi2ssl -0x14(%rbp), %xmm1
callq 0x9590
cvttss2si %xmm0, %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
subl $0x1, %eax
cvtsi2ss %eax, %xmm0
cvtsi2ssl -0x18(%rbp), %xmm1
divss %xmm1, %xmm0
movss %xmm0, -0x1c(%rbp)
movl -0x14(%rbp), %edi
movss -0x1c(%rbp), %xmm0
callq 0x8870
cvttsd2si %xmm0, %eax
movl %eax, -0x20(%rbp)
cmpl $0x0, -0x20(%rbp)
jg 0x9485
jmp 0x94c2
movq -0x38(%rbp), %rdi
movl -0x20(%rbp), %eax
movq %rsp, %rcx
movq %rcx, -0x28(%rbp)
leaq 0xf(,%rax,4), %rcx
andq $-0x10, %rcx
movq %rsp, %r8
subq %rcx, %r8
movq %r8, %rsp
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
callq 0x95e0
movq -0x28(%rbp), %rax
movq %rax, %rsp
movq %rbp, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: ostafen[P]Fast-Insertion-Sort/src/algo.cpp
// Function: QuickBlockInsertionSort<int>::_sort(int*, int, int)
void _sort(T arr[], int low, int high)
    {
        int size = (high - low) + 1;
        if (size <= minSize)
        {
            is.sort(arr + low, size);
            return;
        }
        int pi = partition(arr, low, high);
        _sort(arr, low, pi - 1);
        _sort(arr, pi + 1, high);
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movq -0x8(%rbp), %rcx
movq %rcx, -0x28(%rbp)
movl -0x18(%rbp), %eax
subl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl 0x8(%rcx), %eax
jg 0x9b83
movq -0x28(%rbp), %rdi
addq $0x10, %rdi
movq -0x10(%rbp), %rsi
movslq -0x14(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rsi
movl -0x1c(%rbp), %edx
callq 0x9900
jmp 0x9bc5
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
callq 0x9bd0
movq -0x28(%rbp), %rdi
movl %eax, -0x20(%rbp)
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
movl -0x20(%rbp), %ecx
subl $0x1, %ecx
callq 0x9b30
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x20(%rbp), %edx
addl $0x1, %edx
movl -0x18(%rbp), %ecx
callq 0x9b30
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: ostafen[P]Fast-Insertion-Sort/src/util.cpp
// Function: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>* arrayCopy<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, int)
T *arrayCopy(T *A, int n)
{
    T *B = new T[n];
    for (int i = 0; i < n; i++)
        B[i] = A[i];
    return B;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movslq -0xc(%rbp), %rax
movq %rax, -0x30(%rbp)
movl $0x20, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
addq $0x8, %rdi
setb %al
orb %al, %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x3030
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rax, (%rcx)
addq $0x8, %rcx
movq %rcx, -0x28(%rbp)
cmpq $0x0, %rax
je 0xa975
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rdx
shlq $0x5, %rdx
movq %rax, %rcx
addq %rdx, %rcx
movq %rcx, -0x40(%rbp)
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
movq %rdi, -0x48(%rbp)
callq 0x32f0
movq -0x48(%rbp), %rax
movq -0x40(%rbp), %rcx
addq $0x20, %rax
cmpq %rcx, %rax
movq %rax, -0x38(%rbp)
jne 0xa953
movq -0x28(%rbp), %rax
movq %rax, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0xa9ba
movq -0x8(%rbp), %rsi
movslq -0x1c(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rsi
movq -0x18(%rbp), %rdi
movslq -0x1c(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rdi
callq 0x3050
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xa984
movq -0x18(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop
// File: awbrenn[P]robot-controller/Middleware.cpp
// Function: main
int main (int argc, char *argv[]) {
    /* check for valid command line arguments */
    if (argc != 2)
        stateProperUsageAndDie(0);


    /* convert the URL to a string (to make parsing easier) */
   	string URL(argv[1]);
	parseURL(URL); // then parse it

    /*set up a TCP connection to the robot*/
    setupRobotConnection();

    initializeProxyServer();
    middlewareMainLoop();

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x2, -0x8(%rbp)
je 0x3aa6
xorl %edi, %edi
callq 0x6d10
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x78(%rbp)
leaq -0x31(%rbp), %rdi
movq %rdi, -0x70(%rbp)
callq 0x34a0
movq -0x78(%rbp), %rsi
movq -0x70(%rbp), %rdx
leaq -0x30(%rbp), %rdi
callq 0x4e80
jmp 0x3ad2
leaq -0x31(%rbp), %rdi
callq 0x3320
leaq -0x68(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x3120
jmp 0x3aea
leaq -0x68(%rbp), %rdi
callq 0x3b80
jmp 0x3af5
leaq -0x68(%rbp), %rdi
callq 0x3518
callq 0x3c90
jmp 0x3b05
callq 0x3d50
jmp 0x3b0c
callq 0x3df0
jmp 0x3b13
movl $0x0, -0x4(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x3518
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x31(%rbp), %rdi
callq 0x3320
jmp 0x3b72
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x3b69
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x3518
leaq -0x30(%rbp), %rdi
callq 0x3518
movq -0x40(%rbp), %rdi
callq 0x3490
nopl (%rax,%rax)
// File: awbrenn[P]robot-controller/Middleware.cpp
// Function: parseURL(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void parseURL(string URL) {
	size_t serverName_endIndex;

	// basic checks for valid URL
   	if (URL.length() < HTTP_URL_SECTION + 1) // check if the url is long enough
	    dieWithError((char *)"parseURL() failed: URL is too short");
	else if (URL.substr(0, HTTP_URL_SECTION).compare("http://") != 0) // check if the url starts with "http://"
	    dieWithError((char *)"parseURL() failed: URL does not start with \"http://\"");

    serverName_endIndex = URL.find_first_of("/", HTTP_URL_SECTION);

    if (serverName_endIndex == URL.npos) { // no path 
        SERVER_NAME = URL.substr(HTTP_URL_SECTION, URL.length() - HTTP_URL_SECTION);
    }
    else {
        SERVER_NAME = URL.substr(HTTP_URL_SECTION, serverName_endIndex - HTTP_URL_SECTION);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x78(%rbp)
movq %rdi, -0x8(%rbp)
callq 0x3420
cmpq $0x8, %rax
jae 0x3bac
leaq 0x3504(%rip), %rdi      # 0x70a9
callq 0x6cd0
jmp 0x3bf4
movq -0x78(%rbp), %rsi
leaq -0x30(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
movl $0x7, %ecx
callq 0x32f0
leaq -0x30(%rbp), %rdi
leaq 0x3500(%rip), %rsi      # 0x70cd
callq 0x30c0
movl %eax, -0x7c(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x3518
movl -0x7c(%rbp), %eax
cmpl $0x0, %eax
je 0x3bf2
leaq 0x34e8(%rip), %rdi      # 0x70d5
callq 0x6cd0
jmp 0x3bf4
movq -0x78(%rbp), %rdi
leaq 0x34d4(%rip), %rsi      # 0x70d3
movl $0x7, %edx
callq 0x3150
movq %rax, -0x10(%rbp)
cmpq $-0x1, -0x10(%rbp)
jne 0x3c51
movq -0x78(%rbp), %rdi
callq 0x3420
movq -0x78(%rbp), %rsi
movq %rax, %rcx
subq $0x7, %rcx
leaq -0x50(%rbp), %rdi
movl $0x7, %edx
callq 0x32f0
leaq 0x667b(%rip), %rdi      # 0xa2b8
leaq -0x50(%rbp), %rsi
callq 0x3380
leaq -0x50(%rbp), %rdi
callq 0x3518
jmp 0x3c84
movq -0x78(%rbp), %rsi
movq -0x10(%rbp), %rcx
subq $0x7, %rcx
leaq -0x70(%rbp), %rdi
movl $0x7, %edx
callq 0x32f0
leaq 0x6646(%rip), %rdi      # 0xa2b8
leaq -0x70(%rbp), %rsi
callq 0x3380
leaq -0x70(%rbp), %rdi
callq 0x3518
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax)
// File: awbrenn[P]robot-controller/Middleware.cpp
// Function: setupRobotConnection()
void setupRobotConnection() {
    struct hostent *thehost; /* Hostent from gethostbyname() */
   
    /* Create a TCP socket for communication with the robot */
    if ((ROBOT_SOCKET = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
        dieWithError((char *)"socket() failed");

    /* Construct the server address structure */
    memset(&ROBOT_ADDR, 0, sizeof(ROBOT_ADDR));    /* Zero out structure */
    ROBOT_ADDR.sin_family = AF_INET;                 /* Internet addr family */
    ROBOT_ADDR.sin_addr.s_addr = inet_addr(SERVER_NAME.c_str()); /* Server IP address */
    ROBOT_ADDR.sin_port = htons(ROBOT_PORT);     /* Server port */

    /* If user gave a non dotted decimal address, we need to resolve it  */
    if ((int)ROBOT_ADDR.sin_addr.s_addr == -1) {
        thehost = gethostbyname(SERVER_NAME.c_str());
        ROBOT_ADDR.sin_addr.s_addr = *((unsigned long *) thehost->h_addr_list[0]);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x2, %edi
movl $0x1, %esi
movl $0x6, %edx
callq 0x30a0
movl %eax, 0x6706(%rip)      # 0xa3b8
cmpl $0x0, %eax
jge 0x3cc3
leaq 0x33bf(%rip), %rdi      # 0x707d
callq 0x6cd0
leaq 0x66f6(%rip), %rdi      # 0xa3c0
xorl %esi, %esi
movl $0x10, %edx
callq 0x3170
movw $0x2, 0x66e1(%rip)      # 0xa3c0
leaq 0x65d2(%rip), %rdi      # 0xa2b8
callq 0x3110
movq %rax, %rdi
callq 0x32d0
movl %eax, 0x66cb(%rip)      # 0xa3c4
movzwl 0x6598(%rip), %edi      # 0xa298
callq 0x3040
movw %ax, 0x66b6(%rip)       # 0xa3c2
cmpl $-0x1, 0x66b1(%rip)     # 0xa3c4
jne 0x3d41
leaq 0x659c(%rip), %rdi      # 0xa2b8
callq 0x3110
movq %rax, %rdi
callq 0x3360
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq (%rax), %rax
movq (%rax), %rax
movl %eax, 0x6683(%rip)      # 0xa3c4
addq $0x10, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: awbrenn[P]robot-controller/Middleware.cpp
// Function: initializeProxyServer()
void initializeProxyServer() {
    /* Create socket for sending/receiving datagrams */
    if ((PROXY_SOCKET = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
        dieWithError((char *)"socket() failed");

    /* Construct local address structure */
    memset(&PROXY_ADDR, 0, sizeof(PROXY_ADDR));   /* Zero out structure */
    PROXY_ADDR.sin_family = AF_INET;                /* Internet address family */
    PROXY_ADDR.sin_addr.s_addr = htonl(INADDR_ANY); /* Any incoming interface */
    PROXY_ADDR.sin_port = htons(PROXY_PORT);      /* Local port */

    /* Bind to the local address */
    if (bind(PROXY_SOCKET, (struct sockaddr *) &PROXY_ADDR, sizeof(PROXY_ADDR)) < 0)
        dieWithError((char *)"bind() failed");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl $0x2, %esi
movl $0x11, %edx
movl %esi, %edi
callq 0x30a0
movl %eax, 0x6651(%rip)      # 0xa3bc
cmpl $0x0, %eax
jge 0x3d7c
leaq 0x3306(%rip), %rdi      # 0x707d
callq 0x6cd0
leaq 0x664d(%rip), %rdi      # 0xa3d0
xorl %esi, %esi
movl $0x10, %edx
callq 0x3170
movw $0x2, 0x6638(%rip)      # 0xa3d0
xorl %edi, %edi
callq 0x3200
movl %eax, 0x662f(%rip)      # 0xa3d4
movzwl 0x64ee(%rip), %edi      # 0xa29a
callq 0x3040
movw %ax, 0x661a(%rip)       # 0xa3d2
movl 0x65fe(%rip), %edi      # 0xa3bc
leaq 0x660b(%rip), %rsi      # 0xa3d0
movl $0x10, %edx
callq 0x3070
cmpl $0x0, %eax
jge 0x3de0
leaq 0x32b2(%rip), %rdi      # 0x708d
callq 0x6cd0
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: awbrenn[P]robot-controller/Middleware.cpp
// Function: middlewareMainLoop()
void middlewareMainLoop() {
    while(true) {
        getCommandFromClient();
        buildRequestHeader();
        setupRobotConnection();
        sendRobotTheCommand();
        getHTTPResponse(); // get a response from the robot
        sendRobotResponseToClient();
        cleanup();
        close(ROBOT_SOCKET); // close the connection with the robot
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
jmp 0x3df6
callq 0x3e30
callq 0x3eb0
callq 0x3c90
callq 0x3fa0
callq 0x4040
callq 0x4120
callq 0x4330
movl 0x6599(%rip), %edi      # 0xa3b8
callq 0x34e0
jmp 0x3df6
nopw %cs:(%rax,%rax)
// File: awbrenn[P]robot-controller/Middleware.cpp
// Function: getCommandFromClient()
void getCommandFromClient() {
    int messageLen;
    unsigned int clientAddrLen = sizeof(CLIENT_ADDR);
    char clientRequestBuffer[1000];
    char *command;

    bzero(clientRequestBuffer, 1000);

    if ((messageLen = recvfrom(PROXY_SOCKET, clientRequestBuffer, RECV_BUFF_SIZE, 
        0, (struct sockaddr *) &CLIENT_ADDR, &clientAddrLen)) < 0)
        dieWithError((char *)"recv() failed");
    
    //parse out header
    
    command = clientRequestBuffer;
    detectCommand(command);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x400, %rsp            # imm = 0x400
movl $0x10, -0x8(%rbp)
leaq -0x3f0(%rbp), %rdi
xorl %esi, %esi
movl $0x3e8, %edx            # imm = 0x3E8
callq 0x3170
movl 0x6561(%rip), %edi      # 0xa3bc
leaq -0x3f0(%rbp), %rsi
movl $0xf4240, %edx          # imm = 0xF4240
xorl %ecx, %ecx
leaq 0x6570(%rip), %r8       # 0xa3e0
leaq -0x8(%rbp), %r9
callq 0x3210
movl %eax, -0x4(%rbp)
cmpl $0x0, %eax
jge 0x3e8d
leaq 0x31e7(%rip), %rdi      # 0x706f
callq 0x6cd0
leaq -0x3f0(%rbp), %rax
movq %rax, -0x3f8(%rbp)
movq -0x3f8(%rbp), %rdi
callq 0x4360
addq $0x400, %rsp            # imm = 0x400
popq %rbp
retq
// File: awbrenn[P]robot-controller/Middleware.cpp
// Function: buildRequestHeader()
void buildRequestHeader() {
    REQUEST_MESSAGE += FILE_PATH;
    REQUEST_MESSAGE += " HTTP/1.1\r\n";
    REQUEST_MESSAGE += "Host: " + SERVER_NAME + "\r\n";
    REQUEST_MESSAGE += "Connection: close\r\n";
    REQUEST_MESSAGE += "\r\n";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
leaq 0x6479(%rip), %rdi      # 0xa338
movq %rdi, -0x60(%rbp)
leaq 0x640e(%rip), %rsi      # 0xa2d8
callq 0x33a0
movq -0x60(%rbp), %rdi
leaq 0x3230(%rip), %rsi      # 0x710a
callq 0x32a0
leaq 0x3230(%rip), %rsi      # 0x7116
leaq 0x63cb(%rip), %rdx      # 0xa2b8
leaq -0x40(%rbp), %rdi
movq %rdi, -0x58(%rbp)
callq 0x5270
movq -0x58(%rbp), %rsi
leaq 0x322e(%rip), %rdx      # 0x7133
leaq -0x20(%rbp), %rdi
callq 0x5220
jmp 0x3f10
leaq 0x6421(%rip), %rdi      # 0xa338
leaq -0x20(%rbp), %rsi
callq 0x33a0
jmp 0x3f22
leaq -0x20(%rbp), %rdi
callq 0x3518
leaq -0x40(%rbp), %rdi
callq 0x3518
leaq 0x63fd(%rip), %rdi      # 0xa338
leaq 0x31db(%rip), %rsi      # 0x711d
callq 0x32a0
leaq 0x63ea(%rip), %rdi      # 0xa338
leaq 0x31de(%rip), %rsi      # 0x7133
callq 0x32a0
addq $0x60, %rsp
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x3f83
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x3518
leaq -0x40(%rbp), %rdi
callq 0x3518
movq -0x48(%rbp), %rdi
callq 0x3490
nopw %cs:(%rax,%rax)
// File: awbrenn[P]robot-controller/Middleware.cpp
// Function: sendRobotTheCommand()
void sendRobotTheCommand() {
    /* Establish the connection to the robot */
    if (connect(ROBOT_SOCKET, (struct sockaddr *) &ROBOT_ADDR, sizeof(ROBOT_ADDR)) < 0)
        dieWithError((char *)"connect() failed");

    /* Send the string to the robot */
    if (send(ROBOT_SOCKET, REQUEST_MESSAGE.c_str(), REQUEST_MESSAGE.length(), 0) != (int)REQUEST_MESSAGE.length())
        dieWithError((char *)"send() sent a different number of bytes than expected");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl 0x640a(%rip), %edi      # 0xa3b8
leaq 0x640b(%rip), %rsi      # 0xa3c0
movl $0x10, %edx
callq 0x3250
cmpl $0x0, %eax
jge 0x3fd0
leaq 0x305d(%rip), %rdi      # 0x7028
callq 0x6cd0
movl 0x63e2(%rip), %eax      # 0xa3b8
movl %eax, -0x14(%rbp)
leaq 0x6358(%rip), %rdi      # 0xa338
callq 0x3110
movq %rax, -0x10(%rbp)
leaq 0x6348(%rip), %rdi      # 0xa338
callq 0x3420
movl -0x14(%rbp), %edi
movq -0x10(%rbp), %rsi
movq %rax, %rdx
xorl %ecx, %ecx
callq 0x3140
movq %rax, -0x8(%rbp)
leaq 0x6327(%rip), %rdi      # 0xa338
callq 0x3420
movq %rax, %rcx
movq -0x8(%rbp), %rax
movslq %ecx, %rcx
cmpq %rcx, %rax
je 0x4031
leaq 0x300d(%rip), %rdi      # 0x7039
callq 0x6cd0
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: awbrenn[P]robot-controller/Middleware.cpp
// Function: getHTTPResponse()
void getHTTPResponse() {
    char *httpRequestBuffer = (char *) malloc(RECV_BUFF_SIZE * sizeof(char));
    int messageLen;

    if ((messageLen = recv(ROBOT_SOCKET, httpRequestBuffer, RECV_BUFF_SIZE, 0)) < 0)
        dieWithError((char *)"recv() failed");
       
     int total_bytes_recieved = 0;

     if (messageLen < 200)  {
         if ((messageLen = recv(ROBOT_SOCKET, httpRequestBuffer, RECV_BUFF_SIZE, 0)) < 0)
             dieWithError((char *)"recv() failed");

         total_bytes_recieved += messageLen;
     }
    
    cout << messageLen << endl;

    /* build the HTTP_RESPONSE as a string */
    for (int i = 0; i < messageLen; ++i) {
        HTTP_RESPONSE += httpRequestBuffer[i];
    }

    //cout << "WE GOT HERE!!\nHTTP_RESPONSE:\n" << messageLen << "\n\n" << HTTP_RESPONSE << endl;

    // int content_length = getContentLength();
    // int start_of_content = getStartOfContent();

    // cout << "Content Length: " << content_length <<
    // "\nStart of Content: " << start_of_content << "\n\n" << endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl $0xf4240, %edi          # imm = 0xF4240
callq 0x33b0
movq %rax, -0x8(%rbp)
movl 0x635c(%rip), %edi      # 0xa3b8
movq -0x8(%rbp), %rsi
movl $0xf4240, %edx          # imm = 0xF4240
xorl %ecx, %ecx
callq 0x30d0
movl %eax, -0xc(%rbp)
cmpl $0x0, %eax
jge 0x4080
leaq 0x2ff4(%rip), %rdi      # 0x706f
callq 0x6cd0
movl $0x0, -0x10(%rbp)
cmpl $0xc8, -0xc(%rbp)
jge 0x40c3
movl 0x6322(%rip), %edi      # 0xa3b8
movq -0x8(%rbp), %rsi
movl $0xf4240, %edx          # imm = 0xF4240
xorl %ecx, %ecx
callq 0x30d0
movl %eax, -0xc(%rbp)
cmpl $0x0, %eax
jge 0x40ba
leaq 0x2fba(%rip), %rdi      # 0x706f
callq 0x6cd0
movl -0xc(%rbp), %eax
addl -0x10(%rbp), %eax
movl %eax, -0x10(%rbp)
movl -0xc(%rbp), %esi
movq 0x5f03(%rip), %rdi      # 0x9fd0
callq 0x3480
movq %rax, %rdi
movq 0x5edc(%rip), %rsi      # 0x9fb8
callq 0x3300
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x4113
movq -0x8(%rbp), %rax
movslq -0x14(%rbp), %rcx
leaq 0x6219(%rip), %rdi      # 0xa318
movsbl (%rax,%rcx), %esi
callq 0x31b0
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x40e8
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: awbrenn[P]robot-controller/Middleware.cpp
// Function: fragmentHTTPResponse[abi:cxx11]()
vector<string> fragmentHTTPResponse() {
    size_t index;
    size_t size;
    vector<string> fragmented_response;

    /* split the HTTP response into 1000 byte chunks */
    for (index = 0; index < HTTP_RESPONSE.length(); index += UDP_PACKET_MAX_SIZE - 12) {
        /* get the size of the fragment */
        if ((HTTP_RESPONSE.length() - index) > UDP_PACKET_MAX_SIZE - 12)
            size = UDP_PACKET_MAX_SIZE - 12;
        else
            size = HTTP_RESPONSE.length() - index;

        fragmented_response.push_back(HTTP_RESPONSE.substr(index, size));
    }

    return fragmented_response;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x60(%rbp)
movq %rdi, %rax
movq %rax, -0x58(%rbp)
movq %rdi, -0x8(%rbp)
movb $0x0, -0x19(%rbp)
callq 0x4f30
movq $0x0, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x68(%rbp)
leaq 0x5821(%rip), %rdi      # 0xa318
callq 0x3420
movq %rax, %rcx
movq -0x68(%rbp), %rax
cmpq %rcx, %rax
jae 0x4bac
leaq 0x5805(%rip), %rdi      # 0xa318
callq 0x3420
subq -0x10(%rbp), %rax
cmpq $0x3dc, %rax            # imm = 0x3DC
jbe 0x4b2e
movq $0x3dc, -0x18(%rbp)     # imm = 0x3DC
jmp 0x4b42
leaq 0x57e3(%rip), %rdi      # 0xa318
callq 0x3420
subq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
leaq 0x57c7(%rip), %rsi      # 0xa318
leaq -0x40(%rbp), %rdi
callq 0x32f0
jmp 0x4b5c
movq -0x60(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x51f0
jmp 0x4b6b
leaq -0x40(%rbp), %rdi
callq 0x3518
movq -0x10(%rbp), %rax
addq $0x3dc, %rax            # imm = 0x3DC
movq %rax, -0x10(%rbp)
jmp 0x4ae8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x4bc9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x3518
jmp 0x4bc9
movb $0x1, -0x19(%rbp)
testb $0x1, -0x19(%rbp)
jne 0x4bbf
movq -0x60(%rbp), %rdi
callq 0x4f80
movq -0x58(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
movq -0x60(%rbp), %rdi
callq 0x4f80
movq -0x48(%rbp), %rdi
callq 0x3490
nopl (%rax,%rax)
// File: awbrenn[P]robot-controller/Middleware.cpp
// Function: convertHeaderInfoToString[abi:cxx11](unsigned int)
string convertHeaderInfoToString(uint32_t header_info) {
    string header_info_string;
    char uint4_chunk;
    int size_of_uint32_t = 4;
    int bits_in_a_byte = 8;

    for (int i = 0; i < size_of_uint32_t; ++i) {
        uint4_chunk = (char) ((header_info << (i * bits_in_a_byte)) >> (3 * bits_in_a_byte));
        header_info_string.push_back(uint4_chunk);
    }

    return header_info_string;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x40(%rbp)
movq %rdi, %rax
movq %rax, -0x38(%rbp)
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movb $0x0, -0xd(%rbp)
callq 0x33e0
movl $0x4, -0x14(%rbp)
movl $0x8, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x4e1b
movq -0x40(%rbp), %rdi
movl -0xc(%rbp), %eax
movl -0x1c(%rbp), %ecx
movl -0x18(%rbp), %edx
imull %edx, %ecx
shll %cl, %eax
movl %edx, %ecx
leal (%rcx,%rcx,2), %ecx
shrl %cl, %eax
movb %al, -0xe(%rbp)
movsbl -0xe(%rbp), %esi
callq 0x3270
jmp 0x4df7
jmp 0x4df9
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x4dc8
movq -0x40(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
callq 0x3518
jmp 0x4e38
movb $0x1, -0xd(%rbp)
testb $0x1, -0xd(%rbp)
jne 0x4e2e
movq -0x40(%rbp), %rdi
callq 0x3518
movq -0x38(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
movq -0x28(%rbp), %rdi
callq 0x3490
nopw %cs:(%rax,%rax)
// File: awbrenn[P]robot-controller/ErrorFunctions.cpp
// Function: stateProperUsageAndDie(int)
void stateProperUsageAndDie(int program_id) {
    if (program_id == 0) // middleware
        dieWithError((char *)"Improper Usage - See proper usage below\n"
                             "$> <path_to_executable> <port number>\n");
    else if (program_id == 1) // client
        dieWithError((char *)"Improper Usage - See proper usage below\n"
                             "$> <path_to_executable> <ip of middleware> <port of middleware>"
                             " <ip of robot> <id of robot> <length> <number of"
                             "edges>");
    else
        dieWithError((char *)"Improper Usage");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl %edi, -0x4(%rbp)
cmpl $0x0, -0x4(%rbp)
jne 0x6d2f
leaq 0x5e0(%rip), %rdi       # 0x7308
callq 0x6cd0
jmp 0x6d51
cmpl $0x1, -0x4(%rbp)
jne 0x6d43
leaq 0x61b(%rip), %rdi       # 0x7357
callq 0x6cd0
jmp 0x6d4f
leaq 0x6ab(%rip), %rdi       # 0x73f5
callq 0x6cd0
jmp 0x6d51
addq $0x10, %rsp
popq %rbp
retq
// File: justinpajak[P]Sum_SGX/aes.cpp
// Function: encrypt(unsigned char*, int, unsigned char*, unsigned char*, unsigned char*)
int encrypt(unsigned char *plaintext, int plaintext_len, unsigned char *key,
            unsigned char *iv, unsigned char *ciphertext)
{
    EVP_CIPHER_CTX *ctx;

    int len;

    int ciphertext_len;

    /* Create and initialise the context */
    ctx = EVP_CIPHER_CTX_new();
    EVP_EncryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, key, iv);

    EVP_EncryptUpdate(ctx, ciphertext, &len, plaintext, plaintext_len);
    ciphertext_len = len;

	EVP_EncryptFinal_ex(ctx, ciphertext + len, &len);
    ciphertext_len += len;

    /* Clean up */
    EVP_CIPHER_CTX_free(ctx);

    return ciphertext_len;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
callq 0x10c0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x40(%rbp)
callq 0x10b0
movq -0x40(%rbp), %rdi
movq %rax, %rsi
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
xorl %eax, %eax
movl %eax, %edx
callq 0x1090
movq -0x30(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x8(%rbp), %rcx
movl -0xc(%rbp), %r8d
leaq -0x34(%rbp), %rdx
callq 0x1040
movl -0x34(%rbp), %eax
movl %eax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
movq -0x28(%rbp), %rsi
movslq -0x34(%rbp), %rax
addq %rax, %rsi
leaq -0x34(%rbp), %rdx
callq 0x1140
movl -0x34(%rbp), %eax
addl -0x38(%rbp), %eax
movl %eax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
callq 0x10f0
movl -0x38(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: justinpajak[P]Sum_SGX/aes.cpp
// Function: decrypt(unsigned char*, int, unsigned char*, unsigned char*, unsigned char*)
int decrypt(unsigned char *ciphertext, int ciphertext_len, unsigned char *key,
            unsigned char *iv, unsigned char *plaintext)
{
    EVP_CIPHER_CTX *ctx;

    int len;

    int plaintext_len;

    /* Create and initialise the context */
    ctx = EVP_CIPHER_CTX_new();
    EVP_DecryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, key, iv);

    EVP_DecryptUpdate(ctx, plaintext, &len, ciphertext, ciphertext_len);
    plaintext_len = len;

    EVP_DecryptFinal_ex(ctx, plaintext + len, &len);
    plaintext_len += len;

    /* Clean up */
    EVP_CIPHER_CTX_free(ctx);

    return plaintext_len;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
callq 0x10c0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x40(%rbp)
callq 0x10b0
movq -0x40(%rbp), %rdi
movq %rax, %rsi
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %r8
xorl %eax, %eax
movl %eax, %edx
callq 0x1050
movq -0x30(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x8(%rbp), %rcx
movl -0xc(%rbp), %r8d
leaq -0x34(%rbp), %rdx
callq 0x10a0
movl -0x34(%rbp), %eax
movl %eax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
movq -0x28(%rbp), %rsi
movslq -0x34(%rbp), %rax
addq %rax, %rsi
leaq -0x34(%rbp), %rdx
callq 0x1070
movl -0x34(%rbp), %eax
addl -0x38(%rbp), %eax
movl %eax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
callq 0x10f0
movl -0x38(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq