LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/ef-gy[P]libefgy/include/ef.gy/exponential.h
// Function: efgy::math::exponentiate::integral<efgy::math::numeric::fractional<long long>, 0l>::raise(efgy::math::numeric::fractional<long long> const&, long long const&)
constexpr static Q raise(
      const Q &base, const typename numeric::traits<Q>::integral &exponent) {
    return exponent == typename numeric::traits<Q>::integral(0)
               ? Q(1)
               : exponent == typename numeric::traits<Q>::integral(-1)
                     ? Q(1) / base
                     : exponent == typename numeric::traits<Q>::integral(1)
                           ? base
                           : exponent % typename numeric::traits<Q>::integral(
                                            2) ==
                                     typename numeric::traits<Q>::integral(0)
                                 ? raise(base * base, exponent >> 1)
                                 : base * raise(base * base,
                                                (exponent -
                                                 typename numeric::traits<
                                                     Q>::integral(1)) >>
                                                    1);
  }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x30, %rsp
movq %rdi, %rbx
movq (%rsi), %rax
cmpq $0x1, %rax
je 0x119c9
testq %rax, %rax
je 0x1190e
cmpq $-0x1, %rax
jne 0x1191d
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
leaq 0x8(%rsp), %rbx
movq %rcx, (%rbx)
movq %rax, 0x8(%rbx)
jmp 0x119c1
movl $0x1, %eax
movl $0x1, %edx
jmp 0x119d0
movq %rsi, %r14
testb $0x1, %al
jne 0x11967
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
imulq %rax, %rax
imulq %rcx, %rcx
leaq 0x8(%rsp), %rbx
movq %rax, (%rbx)
movq %rcx, 0x8(%rbx)
movq %rbx, %rdi
callq 0x115b6
movups (%rbx), %xmm0
movups %xmm0, (%rbx)
movq (%r14), %rax
sarq %rax
leaq 0x20(%rsp), %rsi
movq %rax, (%rsi)
leaq 0x8(%rsp), %rdi
callq 0x118d2
jmp 0x119d0
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
imulq %rax, %rax
imulq %rcx, %rcx
leaq 0x8(%rsp), %r15
movq %rax, (%r15)
movq %rcx, 0x8(%r15)
movq %r15, %rdi
callq 0x115b6
movups (%r15), %xmm0
leaq 0x20(%rsp), %rdi
movups %xmm0, (%rdi)
movq (%r14), %rax
decq %rax
sarq %rax
leaq 0x18(%rsp), %rsi
movq %rax, (%rsi)
callq 0x118d2
imulq (%rbx), %rax
imulq 0x8(%rbx), %rdx
movq %rax, (%r15)
movq %rdx, 0x8(%r15)
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x115b6
movq (%rbx), %rax
movq 0x8(%rbx), %rdx
addq $0x30, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/Sooryakiran[P]dotV/src/main.cpp
// Function: generate_file(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 generate_file(string file_name, string contents){
    /*------------------------------------------------------------------------------------------
    Writes/Rewrites the given contents to the given file. 

    Param : file_name (string), file_name of the output file.
    Param : contents (string), contents of the file to be written.

    Return : 1 if successful, 0 if not.
    ------------------------------------------------------------------------------------------*/
    ofstream fout; 
    fout.open(file_name);
    if(fout){
        fout << contents << endl; 
        fout.close();
        cout<<"[INFO] Code "<<file_name<<" written successfully!"<<endl;
    }
    else{
        cout<<"[ERROR] Unable to write file!"<<endl;
        return 0;
    } 
    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movq %rsi, %r14
movq %rdi, %rbx
leaq -0x218(%rbp), %r15
movq %r15, %rdi
callq 0x2260
movq %r15, %rdi
movq %rbx, %rsi
movl $0x10, %edx
callq 0x20c0
movq -0x218(%rbp), %rax
movq -0x18(%rax), %rax
testb $0x5, -0x1f8(%rbp,%rax)
je 0x2493
movq 0x3b8b(%rip), %rbx      # 0x5fd8
leaq 0x1bd4(%rip), %rsi      # 0x4028
movl $0x1d, %edx
movq %rbx, %rdi
callq 0x21a0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq 0x3b59(%rip), %rdi      # 0x5fd8
callq 0x2030
xorl %ebx, %ebx
movq %rax, %rdi
callq 0x20f0
jmp 0x254a
movq (%r14), %rsi
movq 0x8(%r14), %rdx
leaq -0x218(%rbp), %rdi
callq 0x21a0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20f0
leaq -0x218(%rbp), %rdi
callq 0x21f0
movq 0x3af5(%rip), %rdi      # 0x5fd8
leaq 0x1b1a(%rip), %rsi      # 0x4004
movl $0xc, %edx
callq 0x21a0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq 0x3ad6(%rip), %rdi      # 0x5fd8
callq 0x21a0
movq %rax, %rbx
leaq 0x1b00(%rip), %rsi      # 0x4011
movl $0x16, %edx
movq %rax, %rdi
callq 0x21a0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movl $0x1, %ebx
movq %rax, %rdi
callq 0x20f0
movq 0x3a77(%rip), %rax      # 0x5fc8
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq -0x210(%rbp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, -0x218(%rbp,%rcx)
callq 0x2130
leaq -0x120(%rbp), %rdi
callq 0x2080
movl %ebx, %eax
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x218(%rbp), %rdi
callq 0x2220
movq %rbx, %rdi
callq 0x2270
// File: /workspace/github_cpp_makefile_star2_O1/Sooryakiran[P]dotV/src/main.cpp
// Function: invalid_args(char*)
void invalid_args(char* name){
    /*------------------------------------------------------------------------------------------
    Displays the error message and usage format.
    ------------------------------------------------------------------------------------------*/
    cout<<"Invalid arguments\n  Usage "<<name<<" [-n num_bits] [-k pipeline_steps] \n  Example: "<<name<<" -n 64 -k 4\n";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x3a20(%rip), %r14      # 0x5fd8
leaq 0x1a87(%rip), %rsi      # 0x4046
movl $0x1a, %edx
movq %r14, %rdi
callq 0x21a0
testq %rbx, %rbx
je 0x25ed
movq %rbx, %rdi
callq 0x20b0
movq 0x39f8(%rip), %rdi      # 0x5fd8
movq %rbx, %rsi
movq %rax, %rdx
callq 0x21a0
jmp 0x2605
movq (%r14), %rax
movq -0x18(%rax), %rax
leaq (%r14,%rax), %rdi
movl 0x20(%r14,%rax), %esi
orl $0x1, %esi
callq 0x2250
movq 0x39cc(%rip), %r14      # 0x5fd8
leaq 0x1a4e(%rip), %rsi      # 0x4061
movl $0x2f, %edx
movq %r14, %rdi
callq 0x21a0
testq %rbx, %rbx
je 0x2641
movq %rbx, %rdi
callq 0x20b0
movq 0x39a4(%rip), %rdi      # 0x5fd8
movq %rbx, %rsi
movq %rax, %rdx
callq 0x21a0
jmp 0x2659
movq (%r14), %rax
movq -0x18(%rax), %rax
leaq (%r14,%rax), %rdi
movl 0x20(%r14,%rax), %esi
orl $0x1, %esi
callq 0x2250
movq 0x3978(%rip), %rdi      # 0x5fd8
leaq 0x1a2a(%rip), %rsi      # 0x4091
movl $0xc, %edx
popq %rbx
popq %r14
popq %rbp
jmp 0x21a0
// File: /workspace/github_cpp_makefile_star2_O1/CYLMos[P]Read_the_tar_file/main.cpp
// Function: main
int main(int argc, char *argv[])
{
    /// If the number of the params is wrong
    if(argc >= 3){
        cout << "Too many params" << endl;
        exit(0);
    }
    else if(argc <= 1){
        cout << "Too less params" << endl;
        exit(0);
    }

    MyTar myTar(argv[1]);

    if(!myTar.startRead()){
	cout << "Not USTART file!" << endl;
	exit(0);
    }
    myTar.showContent();

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
cmpl $0x3, %edi
jge 0x2475
cmpl $0x2, %edi
jne 0x2485
movq 0x8(%rsi), %rsi
leaq -0x230(%rbp), %rbx
movq %rbx, %rdi
callq 0x24e4
movq %rbx, %rdi
callq 0x26c8
testl %eax, %eax
je 0x24a7
leaq -0x230(%rbp), %rdi
callq 0x2914
leaq -0x230(%rbp), %rdi
callq 0x25a4
xorl %eax, %eax
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %rbp
retq
movq 0x3b5c(%rip), %rdi      # 0x5fd8
leaq 0x1b81(%rip), %rsi      # 0x4004
jmp 0x2493
movq 0x3b4c(%rip), %rdi      # 0x5fd8
leaq 0x1b81(%rip), %rsi      # 0x4014
callq 0x2190
movq %rax, %rdi
callq 0x20e0
xorl %edi, %edi
callq 0x21e0
movq 0x3b2a(%rip), %rdi      # 0x5fd8
leaq 0x1b6f(%rip), %rsi      # 0x4024
movl $0x10, %edx
callq 0x21d0
movq 0x3b12(%rip), %rdi      # 0x5fd8
callq 0x20e0
jmp 0x24a0
movq %rax, %rbx
leaq -0x230(%rbp), %rdi
callq 0x25a4
movq %rbx, %rdi
callq 0x2270
// File: /workspace/github_cpp_makefile_star2_O1/CYLMos[P]Read_the_tar_file/MyTar.cpp
// Function: MyTar::MyTar(char const*)
MyTar::MyTar(const char *file){
    this->usBlockSize = 512;  /// Every block in USTAR format is 512 bytes.
    this->fileNum = -1;
    this->inputStream.open(file, ifstream::in | ifstream::binary);

    /// If failed, close the program.
    if(!this->inputStream.is_open()){
        cout << "Open failed!" << endl;
        exit(0);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
callq 0x21c0
leaq 0x208(%rbx), %r15
xorps %xmm0, %xmm0
movups %xmm0, 0x208(%rbx)
movq $0x0, 0x218(%rbx)
movabsq $-0xfffffe00, %rax      # imm = 0xFFFFFFFF00000200
movq %rax, 0x220(%rbx)
movq %rbx, %rdi
movq %r14, %rsi
movl $0xc, %edx
callq 0x2100
leaq 0x78(%rbx), %rdi
callq 0x2060
testb %al, %al
je 0x254e
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x3a83(%rip), %rdi      # 0x5fd8
leaq 0x1aec(%rip), %rsi      # 0x4048
movl $0xc, %edx
callq 0x21d0
movq 0x3a6b(%rip), %rdi      # 0x5fd8
callq 0x20e0
xorl %edi, %edi
callq 0x21e0
movq %rax, %r14
movq (%r15), %rdi
testq %rdi, %rdi
je 0x2593
movq 0x218(%rbx), %rsi
subq %rdi, %rsi
callq 0x21b0
movq %rbx, %rdi
callq 0x2070
movq %r14, %rdi
callq 0x2270
nop
// File: /workspace/github_cpp_makefile_star2_O1/CYLMos[P]Read_the_tar_file/MyTar.cpp
// Function: MyTar::isUStar()
int MyTar::isUStar(){
    this->inputStream.seekg(0, ios::end);
    int fileSize = this->inputStream.tellg();

    /// If the file is not the mutiple of 512, the file is not USTAR format.
    if(fileSize % this->usBlockSize == 0){
        this->inputStream.seekg(257, ios::beg);
        char buffer[6];

        /// If the USTAR_id != "ustar ", the file is not USTAR format.
        if(this->inputStream.read(buffer, 6)){
            string str(buffer);
            if(str == "ustar "){
                return MyTar::USTAR;
            }
        }
    }

    return MyTar::NO_USTAR;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
movq %rdi, %r14
xorl %ebx, %ebx
xorl %esi, %esi
movl $0x2, %edx
callq 0x2200
movq %r14, %rdi
callq 0x2260
cltd
idivl 0x220(%r14)
testl %edx, %edx
jne 0x26b8
xorl %ebx, %ebx
movl $0x101, %esi            # imm = 0x101
movq %r14, %rdi
xorl %edx, %edx
callq 0x2200
leaq -0x26(%rbp), %rsi
movl $0x6, %edx
movq %r14, %rdi
callq 0x21f0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x26b8
leaq -0x38(%rbp), %r12
movq %r12, -0x10(%r12)
leaq -0x26(%rbp), %r14
movq %r14, %rdi
callq 0x20d0
leaq (%rax,%rbp), %rdx
addq $-0x26, %rdx
leaq -0x48(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x314e
leaq 0x19c6(%rip), %rsi      # 0x4055
movq %r15, %rdi
callq 0x2090
movl %eax, %r14d
movq (%r15), %rdi
cmpq %r12, %rdi
je 0x26ae
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x21b0
testl %r14d, %r14d
jne 0x26b8
movl $0x1, %ebx
movl %ebx, %eax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/CYLMos[P]Read_the_tar_file/MyTar.cpp
// Function: MyTar::startRead()
int MyTar::startRead(){

    /// If the file is not the mutiple of 512, the file is not USTAR format.
    if(MyTar::USTAR != this->isUStar()){
        return MyTar::NO_USTAR;
    }

    /// Make pointer to the first of the tar file.
    this->inputStream.seekg(0, ios::beg);

    while(this->inputStream){
        struct TarHeader buffer;

        if(this->inputStream.read((char*)&buffer, this->usBlockSize)){
            this->tarVector.push_back(buffer);

            int fileSize = this->hex2Dec(buffer.filesize, sizeof(buffer.filesize));

            /* After the header data is the content of the file in tar file.
             * So we need to ignore the block of the content.
             * jumpBock represents how many blocks we need to ignore.
             */
            int jumpBlock = ceil((double)fileSize / (double)this->usBlockSize);
            this->inputStream.seekg(jumpBlock * this->usBlockSize, ios::cur);
        }
    }

    /// If the size of tarVector > 0, the operation of reading successed.
    return this->tarVector.size() > 0 ? MyTar::USTAR : MyTar::NO_USTAR;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
movq %rdi, %rbx
callq 0x25f4
testl %eax, %eax
je 0x285a
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2200
movq (%rbx), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x20(%rbx,%rax)
jne 0x2845
leaq 0x208(%rbx), %rax
movq %rax, -0x30(%rbp)
leaq -0x240(%rbp), %r15
movslq 0x220(%rbx), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x21f0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x2833
movq 0x210(%rbx), %rsi
cmpq 0x218(%rbx), %rsi
je 0x276d
movl $0x200, %edx            # imm = 0x200
movq %rsi, %rdi
movq %r15, %rsi
callq 0x2140
addq $0x200, 0x210(%rbx) # imm = 0x200
jmp 0x2779
movq -0x30(%rbp), %rdi
movq %r15, %rdx
callq 0x31e8
xorl %r13d, %r13d
xorpd %xmm1, %xmm1
movl $0xb, %r14d
leaq -0x1ba(%rbp), %r12
movsd %xmm1, -0x40(%rbp)
movsbl (%r12), %eax
leal -0x61(%rax), %ecx
leal -0x30(%rax), %edx
addl $-0x57, %eax
cmpb $0x6, %cl
cmovael %edx, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x38(%rbp)
movapd %xmm1, %xmm0
mulsd 0x187a(%rip), %xmm0     # 0x4038
callq 0x2170
xorps %xmm1, %xmm1
cvtsi2sd %r13d, %xmm1
mulsd -0x38(%rbp), %xmm0
addsd %xmm1, %xmm0
movsd -0x40(%rbp), %xmm1
cvttsd2si %xmm0, %r13d
addsd 0x185a(%rip), %xmm1     # 0x4040
decq %r12
decl %r14d
jne 0x278d
leal 0x7(%r13), %eax
testl %r13d, %r13d
cmovnsl %r13d, %eax
sarl $0x3, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movl 0x220(%rbx), %r14d
xorps %xmm1, %xmm1
cvtsi2sd %r14d, %xmm1
divsd %xmm1, %xmm0
callq 0x2040
cvttsd2si %xmm0, %eax
imull %r14d, %eax
movslq %eax, %rsi
movq %rbx, %rdi
movl $0x1, %edx
callq 0x2200
movq (%rbx), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x20(%rbx,%rax)
je 0x271c
movq 0x210(%rbx), %rcx
xorl %eax, %eax
cmpq 0x208(%rbx), %rcx
setne %al
jmp 0x285c
xorl %eax, %eax
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/CYLMos[P]Read_the_tar_file/MyTar.cpp
// Function: MyTar::hex2Dec(char const*, int)
int MyTar::hex2Dec(const char* sizeArray, int length){
    int n = 0;
    int ans = 0;

    /* i = length - 2 beacuse the last char in sizeArray is null.
     * So we need to ignore it.
     */
    for(int i = length - 2; i > -1; i--){
        int num = sizeArray[i] >= 'a' && sizeArray[i] <= 'f' ? sizeArray[i] - 'a' + 10 : sizeArray[i] - '0';

        ans += num * pow(16, n);
        ++n;
    }

    /// return bytes, not bits.
    return ans /= 8;
}

// Assembly:
xorl %eax, %eax
cmpl $0x2, %edx
jl 0x2912
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movl %edx, %ebx
movq %rsi, %r14
leal -0x2(%rbx), %eax
addq %rax, %r14
decl %ebx
xorl %r15d, %r15d
xorpd %xmm0, %xmm0
movsd %xmm0, -0x20(%rbp)
movsbl (%r14), %eax
leal -0x61(%rax), %ecx
leal -0x30(%rax), %edx
addl $-0x57, %eax
cmpb $0x6, %cl
cmovael %edx, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x28(%rbp)
movsd -0x20(%rbp), %xmm0
mulsd 0x176d(%rip), %xmm0     # 0x4038
callq 0x2170
xorps %xmm1, %xmm1
cvtsi2sd %r15d, %xmm1
mulsd -0x28(%rbp), %xmm0
addsd %xmm1, %xmm0
cvttsd2si %xmm0, %r15d
movsd -0x20(%rbp), %xmm0
addsd 0x174d(%rip), %xmm0     # 0x4040
decq %r14
decl %ebx
jne 0x289a
leal 0x7(%r15), %eax
testl %r15d, %r15d
cmovnsl %r15d, %eax
sarl $0x3, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/CYLMos[P]Read_the_tar_file/MyTar.cpp
// Function: MyTar::getFileNum()
int MyTar::getFileNum(){

    /// If fileNum > -1, return it directly.
    if(this->fileNum >= 0){
        return this->fileNum;
    }

    /* If the checksum is NULL, the block is NULL.
     * Check until the checksum is not NULL.
     * And return the number of files.
    */
    for(int i = this->tarVector.size() - 1; i > -1; i--){
        bool zeroFlag = true;
        struct TarHeader buffer = this->tarVector.at(i);

        for(int j = 0; j < (int)sizeof(buffer.checksum); j++){
            if(buffer.checksum[j] != 0x00){
                zeroFlag = false;

                break;
            }
        }

        if(!zeroFlag){
            /// Assign the value to the fileNum.
            this->fileNum = i + 1;
            break;
        }
    }

    return this->fileNum;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movl 0x224(%rdi), %eax
testl %eax, %eax
jns 0x2ebb
movq %rdi, %rbx
movq 0x208(%rdi), %rcx
movq 0x210(%rdi), %r14
subq %rcx, %r14
sarq $0x9, %r14
movl %r14d, %eax
decl %eax
js 0x2eb5
leaq -0x230(%rbp), %rdi
movl %r14d, %r13d
movq %rcx, -0x30(%rbp)
movl %eax, %r12d
cmpq %r12, %r14
jbe 0x2ecd
movl %eax, %r15d
movq %r12, %rsi
shlq $0x9, %rsi
addq %rcx, %rsi
movl $0x200, %edx            # imm = 0x200
callq 0x2140
movl $0x94, %eax
cmpb $0x0, -0x230(%rbp,%rax)
jne 0x2eae
incq %rax
cmpq $0x9c, %rax
jne 0x2e7f
leal -0x1(%r12), %eax
movl %r15d, %r13d
testl %r12d, %r12d
movq -0x30(%rbp), %rcx
leaq -0x230(%rbp), %rdi
jg 0x2e5b
jmp 0x2eb5
movl %r13d, 0x224(%rbx)
movl 0x224(%rbx), %eax
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x120a(%rip), %rdi      # 0x40de
movq %r12, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2210
nop
// File: /workspace/github_cpp_makefile_star2_O1/rthoelen[P]NXCore_Icom/main.cc
// Function: timing_thread(void*)
void *timing_thread(void *t_id)
{
	int i;
	unsigned int seconds = 0;
	char h_buf[20];
	
	
        memset((char *)&h_buf[0], 0, sizeof(h_buf));
	h_buf[0] = 'N';
	h_buf[1] = 'X';
	h_buf[2] = 'D';
	h_buf[3] = 'N';
	h_buf[4] = 0x00;
	h_buf[5] = 0x99;
	h_buf[6] = 0x00;
	h_buf[7] = 'N';
	h_buf[8] = '1';
	h_buf[9] = 'X';
	h_buf[10] = 'D';
	h_buf[11] = 'N';

	for(;;)
	{
		for( i = 0; i < repeater_count; i++)
		{
			repeater[i].time_since_rx++;
			repeater[i].time_since_tx++;

			if(repeater[i].time_since_rx > repeater[i].hold_time)
			{
				repeater[i].time_since_rx = repeater[i].hold_time;
				repeater[i].rx_activity = 0;
			}

			while(tx_busy_sem == 1)
				usleep(1);
			if(repeater[i].time_since_tx > repeater[i].tx_hold_time)
			{
				repeater[i].time_since_tx = repeater[i].tx_hold_time;
				repeater[i].tx_busy = 0;
			}


		}	
		if((++seconds % 30) == 0)
		{
			for( i = 0; i < repeater_count; i++)
				{
					if(repeater[i].stealth)
						sendto(socket_00, h_buf, sizeof(h_buf), 0, (struct sockaddr *)&repeater[i].rpt_addr_00,
							sizeof(repeater[i].rpt_addr_00));
				}
		}


		sleep(1);
	}

	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
xorps %xmm0, %xmm0
leaq -0x40(%rbp), %rbx
movaps %xmm0, (%rbx)
movl $0x0, 0x10(%rbx)
movabsq $0x4e0099004e44584e, %rax # imm = 0x4E0099004E44584E
movq %rax, (%rbx)
movl $0x4e445831, 0x8(%rbx)  # imm = 0x4E445831
xorl %r14d, %r14d
cmpl $0x0, 0xf6a2(%rip)      # 0x15378
jle 0x5d57
xorl %r15d, %r15d
movq 0xf676(%rip), %rax      # 0x15358
imulq $0x70, %r15, %r12
movl 0x18(%rax,%r12), %edx
movl 0x20(%rax,%r12), %ecx
incl %edx
movl %edx, 0x18(%rax,%r12)
incl 0x1c(%rax,%r12)
cmpl %ecx, %edx
jle 0x5d1c
leaq (%rax,%r12), %rdx
movl %ecx, 0x18(%rdx)
movl $0x0, 0x28(%rax,%r12)
jmp 0x5d1c
movl $0x1, %edi
callq 0x4400
cmpl $0x1, 0xf661(%rip)      # 0x15384
je 0x5d12
movq 0xf62c(%rip), %rax      # 0x15358
movl 0x24(%rax,%r12), %ecx
cmpl %ecx, 0x1c(%rax,%r12)
jle 0x5d48
leaq (%rax,%r12), %rdx
movl %ecx, 0x1c(%rdx)
movl $0x0, 0x2c(%rax,%r12)
incq %r15
movslq 0xf626(%rip), %rax      # 0x15378
cmpq %rax, %r15
jl 0x5cdb
incl %r14d
imull $0xeeeeeeef, %r14d, %eax # imm = 0xEEEEEEEF
rorl %eax
cmpl $0x8888888, %eax        # imm = 0x8888888
ja 0x5db9
cmpl $0x0, 0xf607(%rip)      # 0x15378
jle 0x5db9
xorl %r15d, %r15d
xorl %r12d, %r12d
movq 0xf5d8(%rip), %r8       # 0x15358
cmpl $0x0, 0x58(%r8,%r15)
je 0x5da6
addq %r15, %r8
movl 0xf5ef(%rip), %edi      # 0x15380
movl $0x14, %edx
movq %rbx, %rsi
xorl %ecx, %ecx
movl $0x10, %r9d
callq 0x4060
incq %r12
movslq 0xf5c8(%rip), %rax      # 0x15378
addq $0x70, %r15
cmpq %rax, %r12
jl 0x5d79
movl $0x1, %edi
callq 0x4240
jmp 0x5ccf
// File: /workspace/github_cpp_makefile_star2_O1/gty980218[P]ee450/./scheduler.h
// Function: Scheduler::init_info(int, int, int, sockaddr_in)
void Scheduler::init_info(int i,int cpblt,int ocpt,sockaddr_in addr){
    this->hspt_info[i].cpblt=cpblt;
    this->hspt_info[i].ocpt=ocpt;
    this->hspt_info[i].addr=addr;
    this->hspt_info[i].score=-1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movslq %esi, %rax
leaq (%rax,%rax,4), %rax
movl %edx, 0x10(%rdi,%rax,8)
movl %ecx, 0x14(%rdi,%rax,8)
movq %r8, (%rdi,%rax,8)
movq %r9, 0x8(%rdi,%rax,8)
movabsq $-0x4010000000000000, %rcx # imm = 0xBFF0000000000000
movq %rcx, 0x18(%rdi,%rax,8)
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/gty980218[P]ee450/scheduler.cpp
// Function: tcp_conn(int, int)
void tcp_conn(int sock_tcp,int sock_udp){
    struct sockaddr_in peeraddr;
    socklen_t peerlen=sizeof(peeraddr);
    int conn;
    pid_t pid;

    while(1){
        if((conn=accept(sock_tcp,(struct sockaddr*)&peeraddr,&peerlen))<0){
            fprintf(stderr,"Connetc failed!");
            exit(1);
        }
        reinit();
        pid=fork();                                                     //fork() will copy everything from its parents' process
        if(pid==-1){
            fprintf(stderr,"Child process error!");
        }else if(pid==0){
            close(sock_tcp);
            serve(conn,sock_udp);
            exit(1);
        }else{
            close(conn);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, -0x2c(%rbp)
movl %edi, %r14d
leaq -0x30(%rbp), %rdx
movl $0x10, (%rdx)
leaq -0x40(%rbp), %rsi
callq 0x20a0
testl %eax, %eax
jns 0x299c
movq 0x3657(%rip), %rax      # 0x5fd8
movq (%rax), %rcx
leaq 0x1753(%rip), %rdi      # 0x40de
movl $0xf, %esi
movl $0x1, %edx
callq 0x22c0
jmp 0x2a0d
movl %eax, %ebx
leaq 0x1749(%rip), %r15      # 0x40ee
leaq -0x40(%rbp), %r12
leaq -0x30(%rbp), %r13
callq 0x2a17
callq 0x2090
cmpl $-0x1, %eax
je 0x29dd
testl %eax, %eax
je 0x29fb
movl %ebx, %edi
callq 0x22d0
movl %r14d, %edi
movq %r12, %rsi
movq %r13, %rdx
callq 0x20a0
movl %eax, %ebx
testl %eax, %eax
jns 0x29ad
jmp 0x297a
movq 0x35f4(%rip), %rax      # 0x5fd8
movq (%rax), %rcx
movl $0x14, %esi
movl $0x1, %edx
movq %r15, %rdi
callq 0x22c0
jmp 0x29c7
movl %r14d, %edi
callq 0x22d0
movl %ebx, %edi
movl -0x2c(%rbp), %esi
callq 0x2b43
movl $0x1, %edi
callq 0x21d0
// File: /workspace/github_cpp_makefile_star2_O1/gty980218[P]ee450/scheduler.cpp
// Function: reinit()
void reinit(){
    ifstream infile; 
    infile.open("info.txt");  //"info.txt" used for storing changed occupancy info
    assert(infile.is_open());

    string str;
    int i=0;
    while(getline(infile,str)){
        int ocpt=atoi(str.c_str());
        scheduler.hspt_info[i].ocpt=ocpt;
        i++;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x230, %rsp            # imm = 0x230
leaq -0x248(%rbp), %rbx
movq %rbx, %rdi
callq 0x21b0
leaq 0x16c4(%rip), %rsi      # 0x4103
movq %rbx, %rdi
movl $0x8, %edx
callq 0x20e0
leaq -0x1d0(%rbp), %rdi
callq 0x2060
testb %al, %al
je 0x2af3
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
movq $0x0, -0x8(%r15)
movb $0x0, (%r15)
leaq 0x3731(%rip), %r12      # 0x61ac
leaq -0x40(%rbp), %r14
movq -0x248(%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2170
movsbl %al, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x22b0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
movq -0x40(%rbp), %rdi
jne 0x2ac6
callq 0x2250
movl %eax, (%r12)
addq $0x28, %r12
jmp 0x2a7f
cmpq %r15, %rdi
je 0x2ad7
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x2180
leaq -0x248(%rbp), %rdi
callq 0x2080
addq $0x230, %rsp            # imm = 0x230
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1612(%rip), %rdi      # 0x410c
leaq 0x161c(%rip), %rsi      # 0x411d
leaq 0x1623(%rip), %rcx      # 0x412b
movl $0x5c, %edx
callq 0x20f0
movq %rax, %rbx
jmp 0x2b2f
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0x2b2f
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x2180
leaq -0x248(%rbp), %rdi
callq 0x2080
movq %rbx, %rdi
callq 0x2290
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::Init()
void ConstructLayer::Init()
{
    if(__type == LayerType::input) 
    {
        InitNeurons();
        InitFilters(); // input layer need to init filters, make all neurons active
    }
    else if(__type == LayerType::output) // output layer, reserved
    {
        InitNeurons();
        InitWeightsAndBias();
    }
    else  // other layer
    {
        InitNeurons();
        InitWeightsAndBias();
    }

    // setup drop out pool
    InitFilters();
    if(__use_drop_out)
    {
        SetupDropOutFilterPool();
    }

    // init batch normalization
    if(__use_batch_normalization)
    {
        InitBatchNormalizationParameters();
    }
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0xc(%rdi), %ebp
movq (%rdi), %rax
callq *0xb8(%rax)
movq (%rbx), %rax
cmpl $0x3, %ebp
movl $0x90, %ecx
movl $0xc0, %edx
cmoveq %rcx, %rdx
movq %rbx, %rdi
callq *(%rax,%rdx)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x90(%rax)
cmpb $0x1, 0x3c8(%rbx)
jne 0x5cf7
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x208(%rax)
cmpb $0x1, 0x210(%rbx)
jne 0x5d0e
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x5d16
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::SetNumberOfNeuronsFC(unsigned long)
void  ConstructLayer::SetNumberOfNeuronsFC(size_t n)
{
    if(__type == LayerType::fullyConnected || __type == LayerType::output) {
        __n_neurons_fc = n;
    }
    else {
        std::cout<<"Error: needs to set layer type before setting number of neurons."
            <<std::endl;
        exit(0);
    }
}

// Assembly:
testl $0xfffffffb, 0xc(%rdi)  # imm = 0xFFFFFFFB
jne 0x6264
movq %rsi, 0x10(%rdi)
retq
pushq %rax
movq 0x30d6c(%rip), %rdi     # 0x36fd8
leaq 0x213c3(%rip), %rsi     # 0x27636
callq 0x4260
movq %rax, %rdi
callq 0x4100
xorl %edi, %edi
callq 0x4290
nop
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::SetNumberOfKernelsCNN(unsigned long)
void  ConstructLayer::SetNumberOfKernelsCNN(size_t n)
{
    if(__type != LayerType::cnn && __type != LayerType::pooling)
    {
        std::cout<<"Error: needs to set layer type before setting number of kernels."
            <<std::endl;
        exit(0);
    }
    __n_kernels_cnn = n;
}

// Assembly:
movl 0xc(%rdi), %eax
decl %eax
cmpl $0x2, %eax
jae 0x6297
movq %rsi, 0x18(%rdi)
retq
pushq %rax
movq 0x30d39(%rip), %rdi     # 0x36fd8
leaq 0x213d1(%rip), %rsi     # 0x27677
callq 0x4260
movq %rax, %rdi
callq 0x4100
xorl %edi, %edi
callq 0x4290
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::SetKernelSizeCNN(std::pair<unsigned long, unsigned long>)
void  ConstructLayer::SetKernelSizeCNN(std::pair<size_t, size_t> s)
{
    // pooling layer also borrowed this function
    if(__type != LayerType::cnn && __type != LayerType::pooling)
    {
        std::cout<<__func__<<" Error: needs to set layer type before setting kernel size."
            <<std::endl;
        exit(0);
    }

    __kernelDim.first = s.first;
    __kernelDim.second = s.second;
}

// Assembly:
movl 0xc(%rdi), %eax
decl %eax
cmpl $0x2, %eax
jae 0x62cd
movq %rsi, 0x20(%rdi)
movq %rdx, 0x28(%rdi)
retq
pushq %rax
movq 0x30d03(%rip), %rdi     # 0x36fd8
leaq 0x213dc(%rip), %rsi     # 0x276b8
callq 0x4260
leaq 0x213e1(%rip), %rsi     # 0x276c9
movq %rax, %rdi
callq 0x4260
movq %rax, %rdi
callq 0x4100
xorl %edi, %edi
callq 0x4290
nop
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::InitNeuronsFC()
void ConstructLayer::InitNeuronsFC()
{
    __neurons.clear();
    assert(__n_neurons_fc >= 1);
    Pixel2D<Neuron*> image(__n_neurons_fc, 1);
    for(size_t i=0;i<__n_neurons_fc;i++)
    {
        Neuron *n = new Neuron();
        n->SetCoord(i, 0, 0);
        n->SetActuationFuncType(__neuron_actuation_func_type);
        image[i][0] = n;
    }
    __neurons.push_back(image);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x40(%rdi), %r15
movq 0x48(%rdi), %r12
cmpq %r15, %r12
je 0x6a93
movq %r15, %r14
movq %r14, %rdi
callq 0x146fc
addq $0x18, %r14
cmpq %r12, %r14
jne 0x6a7e
movq %r15, 0x48(%rbx)
movq 0x10(%rbx), %rsi
testq %rsi, %rsi
je 0x6b24
movq %rsp, %rdi
movl $0x1, %edx
callq 0x1387a
cmpq $0x0, 0x10(%rbx)
je 0x6b01
xorl %r12d, %r12d
xorl %r14d, %r14d
movl $0xa0, %edi
callq 0x4270
movq %rax, %r15
movq %rax, %rdi
callq 0x201f4
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x21e58
movl 0x58(%rbx), %esi
movq %r15, %rdi
callq 0x20a3a
movq (%rsp), %rax
movq (%rax,%r12), %rax
movq %r15, (%rax)
incq %r14
addq $0x18, %r12
cmpq 0x10(%rbx), %r14
jb 0x6aba
addq $0x40, %rbx
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x1390c
movq %rsp, %rdi
callq 0x146fc
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x20d0e(%rip), %rdi     # 0x27839
leaq 0x20c18(%rip), %rsi     # 0x2774a
leaq 0x20d14(%rip), %rcx     # 0x2784d
movl $0x1b6, %edx            # imm = 0x1B6
callq 0x4160
jmp 0x6b52
movq %rax, %rbx
movq %r15, %rdi
callq 0x4230
jmp 0x6b55
movq %rax, %rbx
movq %rsp, %rdi
callq 0x146fc
movq %rbx, %rdi
callq 0x43e0
nop
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::ForwardPropagate_Z_ForSample(int)
void ConstructLayer::ForwardPropagate_Z_ForSample(int sample_index)
{
    // forward propagation: 
    //     ---) compute Z, A, A'(Z) for this layer
    //          these works are done neuron by neuron (neuron level)

    // layers needs to finish all z's first 
    // this special treatment is for softmax actuation functions in output layer
    // b/c in softmax, one need all Z's already calculated before updating A and sigma^\prime
    // step 1) finish z
    for(size_t k=0;k<__neurons.size();k++)
    {
        auto dim = __neurons[k].Dimension();
        for(size_t i=0;i<dim.first;i++)
        {
            for(size_t j=0;j<dim.second;j++)
            {
                //cout<<"coord (i, j, k): ("<<i<<", "<<j<<", "<<k<<")"<<endl;
                if(!__neurons[k][i][j]->IsActive()) continue;
                __neurons[k][i][j] -> UpdateZ(sample_index);
            }
        }
    }
    UpdateImagesZ(sample_index);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, 0x4(%rsp)
movq %rdi, %r14
movq 0x40(%rdi), %rax
cmpq %rax, 0x48(%rdi)
je 0x7577
xorl %edx, %edx
leaq (%rdx,%rdx,2), %r13
movq (%rax,%r13,8), %rcx
movq 0x8(%rax,%r13,8), %rsi
subq %rcx, %rsi
movq %rdx, 0x8(%rsp)
je 0x74e5
sarq $0x3, %rsi
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rsi
movq 0x8(%rcx), %r12
subq (%rcx), %r12
sarq $0x3, %r12
jmp 0x74ea
xorl %esi, %esi
xorl %r12d, %r12d
testq %rsi, %rsi
je 0x7549
xorl %r15d, %r15d
movq %rsi, 0x10(%rsp)
testq %r12, %r12
je 0x753c
leaq (%r15,%r15,2), %rbp
xorl %ebx, %ebx
movq 0x40(%r14), %rax
movq (%rax,%r13,8), %rax
movq (%rax,%rbp,8), %rax
movq (%rax,%rbx,8), %rdi
callq 0x2097e
testb %al, %al
je 0x7534
movq 0x40(%r14), %rax
movq (%rax,%r13,8), %rax
movq (%rax,%rbp,8), %rax
movq (%rax,%rbx,8), %rdi
movl 0x4(%rsp), %esi
callq 0x202b8
incq %rbx
cmpq %rbx, %r12
jne 0x7502
incq %r15
movq 0x10(%rsp), %rsi
cmpq %rsi, %r15
jne 0x74f7
movq 0x8(%rsp), %rdx
incq %rdx
movq 0x40(%r14), %rax
movq 0x48(%r14), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
movabsq $-0x5555555555555555, %rsi # imm = 0xAAAAAAAAAAAAAAAB
imulq %rsi, %rcx
cmpq %rcx, %rdx
jb 0x74af
movq %r14, %rdi
movl 0x4(%rsp), %esi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x7592
nop
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::BackwardPropagateForSample(int)
void ConstructLayer::BackwardPropagateForSample(int sample_index)
{
    // backward propagation:
    //     ---) compute delta for this layer
    //     ---) only after all samples in this batch finished forward propagation, one can do this backward propagation

    if(__type == LayerType::output)
    {
        ComputeCostInOutputLayerForCurrentSample(sample_index);
    } 
    else 
    {
        for(size_t k=0;k<__neurons.size();k++)
        {
            auto dim = __neurons[k].Dimension();
            for(size_t i=0;i<dim.first;i++)  {
                for(size_t j=0;j<dim.second;j++) {
                    if(__neurons[k][i][j]->IsActive())
                    {
                        __neurons[k][i][j] -> BackwardPropagateForSample(sample_index);
                        /*
                           if(__type == LayerType::fullyConnected)
                           {
                           cout<<__func__<<" fc layer neuron coord: "<<__neurons[k][i][j]->GetCoord()<<endl;
                           }
                           else if(__type == LayerType::cnn)
                           {
                           cout<<__func__<<" cnn layer neuron coord: "<<__neurons[k][i][j]->GetCoord()<<endl;
                           }
                           */
                    }
                }
            }
        }
        // when propagation for this layer is done, update the Delta matrices
        UpdateImagesDelta(sample_index);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r14
cmpl $0x4, 0xc(%rdi)
jne 0x83fd
movq (%r14), %rax
movq 0x58(%rax), %rax
movq %r14, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax
movl %esi, 0x4(%rsp)
movq 0x40(%r14), %rax
cmpq %rax, 0x48(%r14)
je 0x84d9
xorl %edx, %edx
leaq (%rdx,%rdx,2), %r13
movq (%rax,%r13,8), %rcx
movq 0x8(%rax,%r13,8), %rsi
subq %rcx, %rsi
movq %rdx, 0x8(%rsp)
je 0x8447
sarq $0x3, %rsi
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rsi
movq 0x8(%rcx), %r12
subq (%rcx), %r12
sarq $0x3, %r12
jmp 0x844c
xorl %esi, %esi
xorl %r12d, %r12d
testq %rsi, %rsi
je 0x84ab
xorl %r15d, %r15d
movq %rsi, 0x10(%rsp)
testq %r12, %r12
je 0x849e
leaq (%r15,%r15,2), %rbp
xorl %ebx, %ebx
movq 0x40(%r14), %rax
movq (%rax,%r13,8), %rax
movq (%rax,%rbp,8), %rax
movq (%rax,%rbx,8), %rdi
callq 0x2097e
testb %al, %al
je 0x8496
movq 0x40(%r14), %rax
movq (%rax,%r13,8), %rax
movq (%rax,%rbp,8), %rax
movq (%rax,%rbx,8), %rdi
movl 0x4(%rsp), %esi
callq 0x20722
incq %rbx
cmpq %rbx, %r12
jne 0x8464
incq %r15
movq 0x10(%rsp), %rsi
cmpq %rsi, %r15
jne 0x8459
movq 0x8(%rsp), %rdx
incq %rdx
movq 0x40(%r14), %rax
movq 0x48(%r14), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
movabsq $-0x5555555555555555, %rsi # imm = 0xAAAAAAAAAAAAAAAB
imulq %rsi, %rcx
cmpq %rcx, %rdx
jb 0x8411
movq %r14, %rdi
movl 0x4(%rsp), %esi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x84f4
nop
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::BatchNormalization_GetGradientOnParameters()
void ConstructLayer::BatchNormalization_GetGradientOnParameters()
{
    // 
    // gradients of \partial{C}/\partial{\sigma_B^2}, \partial{C}/\partial{\mu_B}, \partial{C}/\partial{\gamma}, \partial{C}/\partial{\beta}
    // Eq. (16), (17), (19), (20) in notes by Xinzhan Bai
    // This one needs to be done before updating batch normalization deltas

    // clear previous batch
    __v_partial_C_over_partial_sigma_square.clear();
    __v_partial_C_over_partial_mu.clear();
    __v_partial_C_over_partial_gamma.clear();
    __v_partial_C_over_partial_beta.clear();

    if(GetLayerDimension() == LayerDimension::_1D)
        BatchNormalization_GetGradientOnParameters_1DLayer();
    else if(GetLayerDimension() == LayerDimension::_2D)
        BatchNormalization_GetGradientOnParameters_2DLayer();
    else
    {
        std::cout<<"Error: "<<__func__<<" unsupported layer dimension."
            <<std::endl;
        exit(0);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x338(%rdi), %r15
movq 0x340(%rdi), %r12
cmpq %r15, %r12
je 0x9219
movq %r15, %r14
movq %r14, %rdi
callq 0x1acb6
addq $0x18, %r14
cmpq %r12, %r14
jne 0x9201
movq %r15, 0x340(%rbx)
movq 0x350(%rbx), %r15
movq 0x358(%rbx), %r12
cmpq %r15, %r12
je 0x9247
movq %r15, %r14
movq %r14, %rdi
callq 0x1acb6
addq $0x18, %r14
cmpq %r12, %r14
jne 0x922f
movq %r15, 0x358(%rbx)
movq 0x368(%rbx), %r15
movq 0x370(%rbx), %r12
cmpq %r15, %r12
je 0x9275
movq %r15, %r14
movq %r14, %rdi
callq 0x1acb6
addq $0x18, %r14
cmpq %r12, %r14
jne 0x925d
movq %r15, 0x370(%rbx)
movq 0x380(%rbx), %r15
movq 0x388(%rbx), %r12
cmpq %r15, %r12
je 0x92a3
movq %r15, %r14
movq %r14, %rdi
callq 0x1acb6
addq $0x18, %r14
cmpq %r12, %r14
jne 0x928b
movq %r15, 0x388(%rbx)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x258(%rax)
testl %eax, %eax
je 0x92d7
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x258(%rax)
cmpl $0x1, %eax
jne 0x92ea
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x99fc
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x932a
movq 0x2dce7(%rip), %rdi     # 0x36fd8
leaq 0x1e7fc(%rip), %rsi     # 0x27af4
callq 0x4260
leaq 0x1e7f8(%rip), %rsi     # 0x27afc
movq %rax, %rdi
callq 0x4260
leaq 0x1ebde(%rip), %rsi     # 0x27ef1
movq %rax, %rdi
callq 0x4260
movq %rax, %rdi
callq 0x4100
xorl %edi, %edi
callq 0x4290
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: inverse_half_cubic(double)
static double inverse_half_cubic(double x)
{
    // a helper: get x^{-3/2}
    assert(x > 0);
    double square_root = sqrt(x);
    return  1./(square_root * square_root * square_root);
}

// Assembly:
pushq %rax
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0xa31c
jb 0xa2fd
sqrtsd %xmm0, %xmm0
jmp 0xa302
callq 0x4438
movapd %xmm0, %xmm1
mulsd %xmm0, %xmm1
mulsd %xmm0, %xmm1
movsd 0x1d26a(%rip), %xmm0    # 0x27580
divsd %xmm1, %xmm0
popq %rax
retq
leaq 0x1f248(%rip), %rdi     # 0x2956b
leaq 0x1d420(%rip), %rsi     # 0x2774a
leaq 0x1f240(%rip), %rcx     # 0x29571
movl $0x428, %edx            # imm = 0x428
callq 0x4160
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: inverse_square_root(double)
static double inverse_square_root(double x)
{
    // a helper: get x^{-1/2}
    assert(x > 0);
    double square_root = sqrt(x);
    return 1./square_root;
}

// Assembly:
pushq %rax
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0xa365
jb 0xa34e
sqrtsd %xmm0, %xmm0
jmp 0xa353
callq 0x4438
movsd 0x1d225(%rip), %xmm1    # 0x27580
divsd %xmm0, %xmm1
movapd %xmm1, %xmm0
popq %rax
retq
leaq 0x1f1ff(%rip), %rdi     # 0x2956b
leaq 0x1d3d7(%rip), %rsi     # 0x2774a
leaq 0x1f219(%rip), %rcx     # 0x29593
movl $0x430, %edx            # imm = 0x430
callq 0x4160
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::BatchNormalization_RestoreDelta_ForSample(int)
void ConstructLayer::BatchNormalization_RestoreDelta_ForSample(int sample_id)
{
    if(__layerDimension == LayerDimension::_1D)
    {
        BatchNormalization_RestoreDelta_ForSample_1DLayer(sample_id);
    }
    else if(__layerDimension == LayerDimension::_2D)
    {
        BatchNormalization_RestoreDelta_ForSample_2DLayer(sample_id);
    }
    else
    {
        std::cout<<"Error: "<<__func__<<" undefined layer dimension."
            <<std::endl;
        exit(0);
    }
}

// Assembly:
movl 0x408(%rdi), %eax
cmpl $0x1, %eax
je 0xa656
testl %eax, %eax
jne 0xa39c
jmp 0xa3de
pushq %rax
movq 0x2cc34(%rip), %rdi     # 0x36fd8
leaq 0x1d749(%rip), %rsi     # 0x27af4
callq 0x4260
leaq 0x1d770(%rip), %rsi     # 0x27b27
movq %rax, %rdi
callq 0x4260
leaq 0x1d78b(%rip), %rsi     # 0x27b51
movq %rax, %rdi
callq 0x4260
movq %rax, %rdi
callq 0x4100
xorl %edi, %edi
callq 0x4290
nop
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::FillBatchDataToInputLayerA()
void ConstructLayer::FillBatchDataToInputLayerA()
{
    // if this layer is input layer, then fill the 'a' matrix directly with input image data
    std::vector<Matrix> & input_data = __p_data_interface->GetCurrentBatchData();
    //cout<<">>>: "<<input_data.size()<<" samples in current batch from data interface"<<endl;

    // input data whitening
    if(__input_data_batch_whitening)
        Matrix::BatchNormalization(input_data);

    // first clear the previous batch
    __imageA.clear(); // input layer dropout is not used
    __imageAFull.clear();

    // load all batch data to memory, this should be faster
    for(auto &i: input_data)
    {
        Images image_a; // one image

        // input layer only has one kernel
        image_a.OutputImageFromKernel.push_back(i);

        // push this image to images of this batch
        __imageA.push_back(image_a);
        __imageAFull.push_back(image_a);
    }

    std::cout<<">>>: "<<__imageA.size()<<" samples in current batch."<<std::endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x400(%rdi), %r15
cmpb $0x1, 0x488(%rdi)
jne 0xaf98
leaq 0x10(%r15), %rdi
callq 0x1e484
movq 0x138(%rbx), %r12
movq 0x140(%rbx), %r13
cmpq %r12, %r13
je 0xafc6
movq %r12, %r14
movq %r14, %rdi
callq 0x136aa
addq $0x18, %r14
cmpq %r13, %r14
jne 0xafae
movq %r12, 0x140(%rbx)
movq 0x198(%rbx), %r12
movq 0x1a0(%rbx), %r13
cmpq %r12, %r13
je 0xaff4
movq %r12, %r14
movq %r14, %rdi
callq 0x136aa
addq $0x18, %r14
cmpq %r13, %r14
jne 0xafdc
movq %r12, 0x1a0(%rbx)
movq 0x10(%r15), %r14
movq 0x18(%r15), %rbp
cmpq %rbp, %r14
je 0xb054
leaq 0x138(%rbx), %r15
leaq 0x198(%rbx), %r12
movq %rsp, %r13
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movq %r13, %rdi
movq %r14, %rsi
callq 0x13a14
movq %r15, %rdi
movq %r13, %rsi
callq 0x13a74
movq %r12, %rdi
movq %r13, %rsi
callq 0x13a74
movq %r13, %rdi
callq 0x136aa
addq $0x18, %r14
cmpq %rbp, %r14
jne 0xb012
movq 0x2bf7d(%rip), %r14     # 0x36fd8
leaq 0x1cc6d(%rip), %rsi     # 0x27ccf
movl $0x5, %edx
movq %r14, %rdi
callq 0x4280
movq 0x140(%rbx), %rax
subq 0x138(%rbx), %rax
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rsi # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rsi
movq %r14, %rdi
callq 0x4180
movq %rax, %rbx
leaq 0x1cc34(%rip), %rsi     # 0x27cd5
movl $0x1a, %edx
movq %rax, %rdi
callq 0x4280
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4250
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4190
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x136aa
movq %rbx, %rdi
callq 0x43e0
nop
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::ClearUsedSampleForInputLayer_obsolete()
void ConstructLayer::ClearUsedSampleForInputLayer_obsolete()
{
    // this function not needed anymore
    if(__type != LayerType::input)
    {
        std::cout<<"Error: Clear used sample for input layer only works for input layer..."<<std::endl;
        exit(0);
    }
    if(__imageA.size() <= 0)
    {
        std::cout<<"Error: ClearUsedSampleForInputLayer(): __imageA already empty."<<std::endl;
        exit(0);
    }

    __imageA.pop_back();
}

// Assembly:
pushq %rax
cmpl $0x3, 0xc(%rdi)
jne 0xb123
movq 0x140(%rdi), %rax
cmpq 0x138(%rdi), %rax
je 0xb133
addq $-0x18, %rax
movq %rax, 0x140(%rdi)
movq %rax, %rdi
popq %rax
jmp 0x136aa
movq 0x2beae(%rip), %rdi     # 0x36fd8
leaq 0x1cbbf(%rip), %rsi     # 0x27cf0
jmp 0xb141
movq 0x2be9e(%rip), %rdi     # 0x36fd8
leaq 0x1cbf6(%rip), %rsi     # 0x27d37
callq 0x4260
movq %rax, %rdi
callq 0x4100
xorl %edi, %edi
callq 0x4290
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::BatchNormalization_UpdateZ()
void ConstructLayer::BatchNormalization_UpdateZ()
{
    // Refer to : https://arxiv.org/pdf/1502.03167v3.pdf
    // for detailed algorithm

    // only apply for cnn, fc and output layer, no need for pooling and input layers
    if( (GetType() != LayerType::cnn) &&
            ( GetType() != LayerType::fullyConnected) &&
            (GetType() != LayerType::output))
    {
        return; 
    }

    // 1D layers
    if(GetLayerDimension() == LayerDimension::_1D)
        BatchNormalization_UpdateZ_1DLayer();

    // 2D layers
    else if(GetLayerDimension() == LayerDimension::_2D)
        BatchNormalization_UpdateZ_2DLayer();

    // unsupported layers
    else
    {
        std::cout<<"Error in batch normalization: Unsupported layer dimension."<<std::endl;
        std::cout<<"         only 1D and 2D layers are supported."<<std::endl;
        exit(0);
    }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rax
callq *0x250(%rax)
cmpl $0x1, %eax
je 0xc9d3
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x250(%rax)
testl %eax, %eax
je 0xc9d3
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x250(%rax)
cmpl $0x4, %eax
jne 0xca0b
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x258(%rax)
movq (%rbx), %rcx
testl %eax, %eax
je 0xc9fe
movq %rbx, %rdi
callq *0x258(%rcx)
cmpl $0x1, %eax
jne 0xca0d
movl $0x1a0, %ecx            # imm = 0x1A0
addq (%rbx), %rcx
jmp 0xca05
addq $0x198, %rcx            # imm = 0x198
movq %rbx, %rdi
popq %rbx
jmpq *(%rcx)
popq %rbx
retq
movq 0x2a5c4(%rip), %rbx     # 0x36fd8
leaq 0x1b7c7(%rip), %rsi     # 0x281e2
movq %rbx, %rdi
callq 0x4260
movq %rax, %rdi
callq 0x4100
leaq 0x1b7eb(%rip), %rsi     # 0x2821d
movq %rbx, %rdi
callq 0x4260
movq %rax, %rdi
callq 0x4100
xorl %edi, %edi
callq 0x4290
nop
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::UpdateActiveWeightsAndBias()
void ConstructLayer::UpdateActiveWeightsAndBias()
{
    // clear active weights and bias from previous batch
    __weightMatrixActive.clear();
    __biasVectorActive.clear();

    // update active weights and bias for this batch
    TransferValueFromOriginalToActive_WB();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0xd8(%rdi), %r15
movq 0xe0(%rdi), %r12
cmpq %r15, %r12
je 0xce47
movq %r15, %r14
movq %r14, %rdi
callq 0x1acb6
addq $0x18, %r14
cmpq %r12, %r14
jne 0xce2f
movq %r15, 0xe0(%rbx)
movq 0xf0(%rbx), %r15
movq 0xf8(%rbx), %r12
cmpq %r15, %r12
je 0xce75
movq %r15, %r14
movq %r14, %rdi
callq 0x1acb6
addq $0x18, %r14
cmpq %r12, %r14
jne 0xce5d
movq %r15, 0xf8(%rbx)
movq (%rbx), %rax
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmpq *0x150(%rax)
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::DropOut()
void ConstructLayer::DropOut()
{
    if(__type == LayerType::fullyConnected)
        __UpdateActiveFlagFC();
    else if(__type == LayerType::cnn || __type == LayerType::pooling)
        __UpdateActiveFlagCNN();
    else 
    {
        std::cout<<"Error: drop out, un-recongnized layer type."<<std::endl;
        exit(0);
    }
}

// Assembly:
movl 0xc(%rdi), %eax
leal -0x1(%rax), %ecx
cmpl $0x2, %ecx
jb 0xd1cc
testl %eax, %eax
jne 0xd14a
jmp 0xd16e
pushq %rax
movq 0x29e86(%rip), %rdi     # 0x36fd8
leaq 0x1b2b4(%rip), %rsi     # 0x2840d
callq 0x4260
movq %rax, %rdi
callq 0x4100
xorl %edi, %edi
callq 0x4290
nop