LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: lvandeve[P]lodepng/pngdetail.cpp
// Function: showRender(Data&, Options const&)
void showRender(Data& data, const Options& options) {
  data.loadPixels();
  if(data.error) return;
  if(options.rendermode == RM_ASCII) {
    displayAsciiArt(data.pixels, data.w, data.h, options.rendersize);
  }

  if(options.rendermode == RM_HEX) {
    displayColorsHex(data.pixels, data.w, data.h, false);
  }

  if(options.rendermode == RM_HEX16) {
    displayColorsHex(data.pixels, data.w, data.h, true);
  }

  if(options.rendermode == RM_PAL) {
    displayPalettePixels(data.buffer, options);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0x326c0
movq -0x8(%rbp), %rax
cmpl $0x0, 0x2d8(%rax)
je 0x308bb
jmp 0x30953
movq -0x10(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jne 0x308e7
movq -0x8(%rbp), %rdi
addq $0x38, %rdi
movq -0x8(%rbp), %rax
movl 0x50(%rax), %esi
movq -0x8(%rbp), %rax
movl 0x54(%rax), %edx
movq -0x10(%rbp), %rax
movl 0x1c(%rax), %ecx
callq 0x298c0
movq -0x10(%rbp), %rax
cmpl $0x1, 0x18(%rax)
jne 0x3090e
movq -0x8(%rbp), %rdi
addq $0x38, %rdi
movq -0x8(%rbp), %rax
movl 0x50(%rax), %esi
movq -0x8(%rbp), %rax
movl 0x54(%rax), %edx
xorl %ecx, %ecx
callq 0x29d00
movq -0x10(%rbp), %rax
cmpl $0x2, 0x18(%rax)
jne 0x30938
movq -0x8(%rbp), %rdi
addq $0x38, %rdi
movq -0x8(%rbp), %rax
movl 0x50(%rax), %esi
movq -0x8(%rbp), %rax
movl 0x54(%rax), %edx
movl $0x1, %ecx
callq 0x29d00
movq -0x10(%rbp), %rax
cmpl $0x3, 0x18(%rax)
jne 0x30953
movq -0x8(%rbp), %rdi
addq $0x20, %rdi
movq -0x10(%rbp), %rsi
callq 0x2a790
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: lvandeve[P]lodepng/pngdetail.cpp
// Function: showInfos(Data&, Options const&)
void showInfos(Data& data, const Options& options) {
  if(options.show_one_line_summary) showSingleLineSummary(data, options);
  if(options.show_errors) showErrors(data, options);
  if(options.show_exif) showExif(data);
  if(options.show_header || options.show_icc_details || options.show_icc_hex || options.show_exif_hex) showHeaderInfo(data, options);
  if(options.show_color_stats) showColorStats(data, options);
  if(options.show_png_info) showPNGInfo(data, options);
  if(options.show_palette) displayPalette(data, options);
  if(options.show_chunks || options.show_chunks2) displayChunkNames(data, options);
  if(options.show_filters) displayFilterTypes(data, options);
  if(options.show_zlib_info) printZlibInfo(data);
  if(options.show_render) showRender(data, options);

  if(data.error) showError(data, options);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
testb $0x1, 0x2(%rax)
je 0x30987
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x2bfe0
movq -0x10(%rbp), %rax
testb $0x1, 0x4(%rax)
je 0x3099e
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x2f950
movq -0x10(%rbp), %rax
testb $0x1, 0x7(%rax)
je 0x309b1
movq -0x8(%rbp), %rdi
callq 0x30650
movq -0x10(%rbp), %rax
testb $0x1, 0x3(%rax)
jne 0x309d9
movq -0x10(%rbp), %rax
testb $0x1, 0x5(%rax)
jne 0x309d9
movq -0x10(%rbp), %rax
testb $0x1, 0x6(%rax)
jne 0x309d9
movq -0x10(%rbp), %rax
testb $0x1, 0x8(%rax)
je 0x309e6
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x2de50
movq -0x10(%rbp), %rax
testb $0x1, 0x9(%rax)
je 0x309fd
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x2f300
movq -0x10(%rbp), %rax
testb $0x1, 0xa(%rax)
je 0x30a14
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x2ed80
movq -0x10(%rbp), %rax
testb $0x1, 0xb(%rax)
je 0x30a2b
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x2a520
movq -0x10(%rbp), %rax
testb $0x1, 0x20(%rax)
jne 0x30a3f
movq -0x10(%rbp), %rax
testb $0x1, 0x21(%rax)
je 0x30a4c
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x27e00
movq -0x10(%rbp), %rax
testb $0x1, 0x22(%rax)
je 0x30a63
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x2a1a0
movq -0x10(%rbp), %rax
testb $0x1, 0x23(%rax)
je 0x30a76
movq -0x8(%rbp), %rdi
callq 0x2aca0
movq -0x10(%rbp), %rax
testb $0x1, 0x14(%rax)
je 0x30a8d
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x30890
movq -0x8(%rbp), %rax
cmpl $0x0, 0x2d8(%rax)
je 0x30aa7
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x2bb20
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: lvandeve[P]lodepng/pngdetail.cpp
// Function: Data::loadFile()
void loadFile() {
    if(buffer.empty()) {
      error = lodepng::load_file(buffer, filename); //load the image file with given filename
    } else {
      error = 0; // for reloadpixels, reset error if file was already successfully loaded
    }
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x10(%rbp)
addq $0x20, %rdi
callq 0x19310
testb $0x1, %al
jne 0x31c13
jmp 0x31c31
movq -0x10(%rbp), %rsi
movq %rsi, %rdi
addq $0x20, %rdi
callq 0x10520
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x2d8(%rax)
jmp 0x31c3f
movq -0x10(%rbp), %rax
movl $0x0, 0x2d8(%rax)
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop
// File: lvandeve[P]lodepng/pngdetail.cpp
// Function: Data::reloadPixels()
void reloadPixels() {
    loadFile();
    if(error) return;
    inspected = true;
    state.info_raw.colortype = LCT_RGBA;
    state.info_raw.bitdepth = 16;
    pixels.clear();
    error = lodepng::decode(pixels, w, h, state, buffer);
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x10(%rbp)
callq 0x31bf0
movq -0x10(%rbp), %rax
cmpl $0x0, 0x2d8(%rax)
je 0x32728
jmp 0x32785
movq -0x10(%rbp), %rdi
movb $0x1, 0x2dc(%rdi)
movl $0x6, 0x100(%rdi)
movl $0x10, 0x104(%rdi)
addq $0x38, %rdi
callq 0x33700
movq -0x10(%rbp), %r8
movq %r8, %rdi
addq $0x38, %rdi
movq %r8, %rsi
addq $0x50, %rsi
movq %r8, %rdx
addq $0x54, %rdx
movq %r8, %rcx
addq $0x58, %rcx
addq $0x20, %r8
callq 0x10da0
movl %eax, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x2d8(%rax)
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: lvandeve[P]lodepng/pngdetail.cpp
// Function: Data::isIcc()
bool isIcc() {
    if(isPng()) return false;
    if(buffer.size() < 128) return false;
    size_t size = (buffer[0] << 24) + (buffer[1] << 16) + (buffer[2] << 8) + buffer[3];
    if(size != buffer.size()) return false;
    if(buffer[36] != 'a') return false;
    if(buffer[37] != 'c') return false;
    if(buffer[38] != 's') return false;
    if(buffer[39] != 'p') return false;
    return true;
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x20(%rbp)
callq 0x32360
testb $0x1, %al
jne 0x32baf
jmp 0x32bb8
movb $0x0, -0x1(%rbp)
jmp 0x32d07
movq -0x20(%rbp), %rdi
addq $0x20, %rdi
callq 0x19370
cmpq $0x80, %rax
jae 0x32bd6
movb $0x0, -0x1(%rbp)
jmp 0x32d07
movq -0x20(%rbp), %rdi
addq $0x20, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x19560
movq -0x20(%rbp), %rdi
movzbl (%rax), %eax
shll $0x18, %eax
movl %eax, -0x34(%rbp)
addq $0x20, %rdi
movl $0x1, %esi
callq 0x19560
movq -0x20(%rbp), %rdi
movq %rax, %rcx
movl -0x34(%rbp), %eax
movzbl (%rcx), %ecx
shll $0x10, %ecx
addl %ecx, %eax
movl %eax, -0x30(%rbp)
addq $0x20, %rdi
movl $0x2, %esi
callq 0x19560
movq -0x20(%rbp), %rdi
movq %rax, %rcx
movl -0x30(%rbp), %eax
movzbl (%rcx), %ecx
shll $0x8, %ecx
addl %ecx, %eax
movl %eax, -0x2c(%rbp)
addq $0x20, %rdi
movl $0x3, %esi
callq 0x19560
movq -0x20(%rbp), %rdi
movq %rax, %rcx
movl -0x2c(%rbp), %eax
movzbl (%rcx), %ecx
addl %ecx, %eax
cltq
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
addq $0x20, %rdi
callq 0x19370
movq %rax, %rcx
movq -0x28(%rbp), %rax
cmpq %rcx, %rax
je 0x32c83
movb $0x0, -0x1(%rbp)
jmp 0x32d07
movq -0x20(%rbp), %rdi
addq $0x20, %rdi
movl $0x24, %esi
callq 0x19560
movzbl (%rax), %eax
cmpl $0x61, %eax
je 0x32ca3
movb $0x0, -0x1(%rbp)
jmp 0x32d07
movq -0x20(%rbp), %rdi
addq $0x20, %rdi
movl $0x25, %esi
callq 0x19560
movzbl (%rax), %eax
cmpl $0x63, %eax
je 0x32cc3
movb $0x0, -0x1(%rbp)
jmp 0x32d07
movq -0x20(%rbp), %rdi
addq $0x20, %rdi
movl $0x26, %esi
callq 0x19560
movzbl (%rax), %eax
cmpl $0x73, %eax
je 0x32ce3
movb $0x0, -0x1(%rbp)
jmp 0x32d07
movq -0x20(%rbp), %rdi
addq $0x20, %rdi
movl $0x27, %esi
callq 0x19560
movzbl (%rax), %eax
cmpl $0x70, %eax
je 0x32d03
movb $0x0, -0x1(%rbp)
jmp 0x32d07
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: lvandeve[P]lodepng/pngdetail.cpp
// Function: Data::isExif()
bool isExif() {
    if(buffer.size() < 8) return false;
    if(buffer[0] == 'M' && buffer[1] == 'M' && buffer[2] == 0 && buffer[3] == 42) return true;
    if(buffer[0] == 'I' && buffer[1] == 'I' && buffer[2] == 42 && buffer[3] == 0) return true;
    return false;
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x18(%rbp)
addq $0x20, %rdi
callq 0x19370
cmpq $0x8, %rax
jae 0x32d4c
movb $0x0, -0x1(%rbp)
jmp 0x32e2a
movq -0x18(%rbp), %rdi
addq $0x20, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x19560
movzbl (%rax), %eax
cmpl $0x4d, %eax
jne 0x32db9
movq -0x18(%rbp), %rdi
addq $0x20, %rdi
movl $0x1, %esi
callq 0x19560
movzbl (%rax), %eax
cmpl $0x4d, %eax
jne 0x32db9
movq -0x18(%rbp), %rdi
addq $0x20, %rdi
movl $0x2, %esi
callq 0x19560
movzbl (%rax), %eax
cmpl $0x0, %eax
jne 0x32db9
movq -0x18(%rbp), %rdi
addq $0x20, %rdi
movl $0x3, %esi
callq 0x19560
movzbl (%rax), %eax
cmpl $0x2a, %eax
jne 0x32db9
movb $0x1, -0x1(%rbp)
jmp 0x32e2a
movq -0x18(%rbp), %rdi
addq $0x20, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x19560
movzbl (%rax), %eax
cmpl $0x49, %eax
jne 0x32e26
movq -0x18(%rbp), %rdi
addq $0x20, %rdi
movl $0x1, %esi
callq 0x19560
movzbl (%rax), %eax
cmpl $0x49, %eax
jne 0x32e26
movq -0x18(%rbp), %rdi
addq $0x20, %rdi
movl $0x2, %esi
callq 0x19560
movzbl (%rax), %eax
cmpl $0x2a, %eax
jne 0x32e26
movq -0x18(%rbp), %rdi
addq $0x20, %rdi
movl $0x3, %esi
callq 0x19560
movzbl (%rax), %eax
cmpl $0x0, %eax
jne 0x32e26
movb $0x1, -0x1(%rbp)
jmp 0x32e2a
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop
// File: zengfenfei[P]codility/src/BinaryGap.cpp
// Function: solution(int)
int solution(int N) {
	int len = sizeof(N) * 8;
	int max0s = 0, cur0s = -1;
	for (int i = 0; i < len; ++i) {
		int bit = N & (1 << i);
		if (bit > 0) {	// bit is 1
			if (cur0s > max0s) {
				max0s = cur0s;
			}
			cur0s = 0;
		} else if (cur0s > -1) {
			cur0s++;
		}
	}
	return max0s;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, -0x4(%rbp)
movl $0x20, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movl $0xffffffff, -0x10(%rbp) # imm = 0xFFFFFFFF
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x122a
movl -0x4(%rbp), %eax
movl -0x14(%rbp), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
andl %ecx, %eax
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
jle 0x120c
movl -0x10(%rbp), %eax
cmpl -0xc(%rbp), %eax
jle 0x1203
movl -0x10(%rbp), %eax
movl %eax, -0xc(%rbp)
movl $0x0, -0x10(%rbp)
jmp 0x121d
cmpl $-0x1, -0x10(%rbp)
jle 0x121b
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x121d
jmp 0x121f
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x11d3
movl -0xc(%rbp), %eax
popq %rbp
retq
nop
// File: sidvishnoi[P]filesystem-assignment/main.cpp
// Function: main
int main(int argc, char const *argv[])
{
    string diskTitle;
    int diskSizeBytes;

    // get disk title
    if (argc > 1 && argv[1]) {
        diskTitle = argv[1];
    } else {
        cout << "Enter path to disk: ";
        cin >> diskTitle;
    }

    // initialize disk
    FileSystem disk(diskTitle);

    cout << "Type `help` to see available commands." << endl;

    int response = handleInput(disk);
    while (response != 1) {
        response = handleInput(disk);
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x3370
cmpl $0x1, -0x8(%rbp)
jle 0x3bb9
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x3bb9
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
leaq -0x30(%rbp), %rdi
callq 0x3360
jmp 0x3ba6
jmp 0x3be2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x3ced
movq 0xd410(%rip), %rdi      # 0x10fd0
leaq 0x843d(%rip), %rsi      # 0xc004
callq 0x3230
jmp 0x3bce
movq 0xd40b(%rip), %rdi      # 0x10fe0
leaq -0x30(%rbp), %rsi
callq 0x3320
jmp 0x3be0
jmp 0x3be2
leaq -0xe8(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x30c0
jmp 0x3bf4
leaq -0xc8(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x74a0
jmp 0x3c09
leaq -0xe8(%rbp), %rdi
callq 0x3150
movq 0xd3b4(%rip), %rdi      # 0x10fd0
leaq 0x83f6(%rip), %rsi      # 0xc019
callq 0x3230
movq %rax, -0xf8(%rbp)
jmp 0x3c31
movq -0xf8(%rbp), %rdi
movq 0xd381(%rip), %rsi      # 0x10fc0
callq 0x3260
jmp 0x3c46
leaq -0xc8(%rbp), %rdi
callq 0x43c0
movl %eax, -0xfc(%rbp)
jmp 0x3c5a
movl -0xfc(%rbp), %eax
movl %eax, -0xec(%rbp)
cmpl $0x1, -0xec(%rbp)
je 0x3cc5
leaq -0xc8(%rbp), %rdi
callq 0x43c0
movl %eax, -0x100(%rbp)
jmp 0x3c83
movl -0x100(%rbp), %eax
movl %eax, -0xec(%rbp)
jmp 0x3c66
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x3150
jmp 0x3ced
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x3d00
jmp 0x3ced
movl $0x0, -0x4(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x3d00
leaq -0x30(%rbp), %rdi
callq 0x3150
movl -0x4(%rbp), %eax
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
leaq -0x30(%rbp), %rdi
callq 0x3150
movq -0x40(%rbp), %rdi
callq 0x3450
nop
// File: sidvishnoi[P]filesystem-assignment/handleInput.cpp
// Function: split(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, char)
vector<string> split(const string &s, const char delim) {
    /*
    castective: to split a string by given delimitter
    input:
        s: given string
        delim: delimitter
    return: vector of strings split at given delimitter
    */
    stringstream ss(s);
    string item;
    vector<string> tokens;
    while (getline(ss, item, delim)) {
        tokens.push_back(item);
    }
    return tokens;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x200, %rsp            # imm = 0x200
movq %rdi, -0x1e0(%rbp)
movb %dl, %al
movq %rdi, %rcx
movq %rcx, -0x1f0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb %al, -0x11(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x1e8(%rbp)
movl $0x10, %edi
movl $0x8, %esi
callq 0x62a0
movq -0x1e8(%rbp), %rsi
movl %eax, %edx
leaq -0x1a0(%rbp), %rdi
callq 0x33d0
leaq -0x1c0(%rbp), %rdi
callq 0x3370
movq -0x1e0(%rbp), %rdi
movb $0x0, -0x1c1(%rbp)
callq 0x62c0
movsbl -0x11(%rbp), %edx
leaq -0x1a0(%rbp), %rdi
leaq -0x1c0(%rbp), %rsi
callq 0x3480
movq %rax, -0x1f8(%rbp)
jmp 0x4267
movq -0x1f8(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x32f0
movb %al, -0x1f9(%rbp)
jmp 0x4285
movb -0x1f9(%rbp), %al
testb $0x1, %al
jne 0x4291
jmp 0x42e0
movq -0x1e0(%rbp), %rdi
leaq -0x1c0(%rbp), %rsi
callq 0x62e0
jmp 0x42a6
jmp 0x4247
movq -0x1e0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1d0(%rbp)
movl %eax, -0x1d4(%rbp)
callq 0x3d50
leaq -0x1c0(%rbp), %rdi
callq 0x3150
leaq -0x1a0(%rbp), %rdi
callq 0x31b0
jmp 0x4324
movb $0x1, -0x1c1(%rbp)
testb $0x1, -0x1c1(%rbp)
jne 0x42fc
movq -0x1e0(%rbp), %rdi
callq 0x3d50
leaq -0x1c0(%rbp), %rdi
callq 0x3150
leaq -0x1a0(%rbp), %rdi
callq 0x31b0
movq -0x1f0(%rbp), %rax
addq $0x200, %rsp            # imm = 0x200
popq %rbp
retq
movq -0x1d0(%rbp), %rdi
callq 0x3450
// File: sidvishnoi[P]filesystem-assignment/handleInput.cpp
// Function: createBuffer(char, char*)
void createBuffer(char temp, char* buf) {
    // creates a buffer based on a char
    if (temp == '.') {
        cout << "Enter alphabet: ";
        cin >> temp;
        cin.ignore(32767, '\n');
    }
    for (int i = 0; i < kSectorSize_g; i++) {
        buf[i] = temp;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movb %dil, %al
movb %al, -0x1(%rbp)
movq %rsi, -0x10(%rbp)
movsbl -0x1(%rbp), %eax
cmpl $0x2e, %eax
jne 0x4384
movq 0xcc7e(%rip), %rdi      # 0x10fd0
leaq 0x7d27(%rip), %rsi      # 0xc080
callq 0x3230
movq 0xcc7b(%rip), %rdi      # 0x10fe0
leaq -0x1(%rbp), %rsi
callq 0x3350
movq 0xcc6b(%rip), %rdi      # 0x10fe0
movl $0x7fff, %esi           # imm = 0x7FFF
movl $0xa, %edx
callq 0x3170
movl $0x0, -0x14(%rbp)
cmpl $0x200, -0x14(%rbp)     # imm = 0x200
jge 0x43ad
movb -0x1(%rbp), %dl
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x438b
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: sidvishnoi[P]filesystem-assignment/day1/createDisk.cpp
// Function: FileSystem::createDisk()
void FileSystem::createDisk()
{
    /*
    objective: reserves disk space by writing numberOfSectors_k sectors of size sectorSize_k each
    */
    ofstream fp;
    fp.open(diskTitle_k, ios::binary | ios::out);
    fp.close();
    char buffer[sectorSize_k];

    TypeCastInt cast;
    cast.num = 0;

    // create a buffer of size sectorSize_k
    for (int i = 0; i < sectorSize_k; ++i)
    {
        buffer[i] = cast.str[i % 4];
    }

    // reserve disk space by writing numberOfSectors_k sectors
    for (int i = 0; i < numberOfSectors_k; ++i)
    {
        writeSector(i, buffer);
    }

    // reserve space for root directory
    for (int i = numberOfSectors_k; i < numberOfSectors_k + sectorsForDir_k; ++i)
    {
        int s = (i == sectorsForDir_k - 1) ? 1 : i+1;
        setStatus(i, s);
    }

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x260, %rsp            # imm = 0x260
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x250(%rbp)
movq %rax, -0x248(%rbp)
leaq -0x208(%rbp), %rdi
callq 0x3420
movl $0x4, %edi
movl $0x10, %esi
callq 0x62a0
movl %eax, -0x240(%rbp)
jmp 0x7f74
movl -0x240(%rbp), %edx
movq -0x250(%rbp), %rsi
leaq -0x208(%rbp), %rdi
callq 0x3100
jmp 0x7f8f
leaq -0x208(%rbp), %rdi
callq 0x3390
jmp 0x7f9d
movq -0x248(%rbp), %rax
movl 0x20(%rax), %eax
movq %rsp, %rcx
movq %rcx, -0x220(%rbp)
movq %rax, %rdx
addq $0xf, %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x258(%rbp)
movq %rcx, %rsp
movq %rax, -0x228(%rbp)
movl $0x0, -0x22c(%rbp)
movl $0x0, -0x230(%rbp)
movq -0x248(%rbp), %rcx
movl -0x230(%rbp), %eax
cmpl 0x20(%rcx), %eax
jge 0x8056
movl -0x230(%rbp), %eax
movl $0x4, %ecx
cltd
idivl %ecx
movq -0x258(%rbp), %rax
movslq %edx, %rcx
movb -0x22c(%rbp,%rcx), %dl
movslq -0x230(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x230(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x230(%rbp)
jmp 0x7fe7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x210(%rbp)
movl %eax, -0x214(%rbp)
leaq -0x208(%rbp), %rdi
callq 0x33b0
jmp 0x8151
movl $0x0, -0x234(%rbp)
movq -0x248(%rbp), %rcx
movl -0x234(%rbp), %eax
cmpl 0x2c(%rcx), %eax
jge 0x80a0
movq -0x258(%rbp), %rdx
movq -0x248(%rbp), %rdi
movl -0x234(%rbp), %esi
callq 0x8160
jmp 0x808d
jmp 0x808f
movl -0x234(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x234(%rbp)
jmp 0x8060
movq -0x248(%rbp), %rax
movl 0x2c(%rax), %eax
movl %eax, -0x238(%rbp)
movq -0x248(%rbp), %rdx
movl -0x238(%rbp), %eax
movl 0x2c(%rdx), %ecx
addl 0x30(%rdx), %ecx
cmpl %ecx, %eax
jge 0x8136
movq -0x248(%rbp), %rcx
movl -0x238(%rbp), %eax
movl 0x30(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x80eb
movl $0x1, %eax
movl %eax, -0x25c(%rbp)
jmp 0x80fa
movl -0x238(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x25c(%rbp)
movq -0x248(%rbp), %rdi
movl -0x25c(%rbp), %eax
movl %eax, -0x23c(%rbp)
movl -0x238(%rbp), %esi
movl -0x23c(%rbp), %edx
callq 0x84b0
jmp 0x8120
jmp 0x8122
movl -0x238(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x238(%rbp)
jmp 0x80b0
movq -0x220(%rbp), %rax
movq %rax, %rsp
leaq -0x208(%rbp), %rdi
callq 0x33b0
movq %rbp, %rsp
popq %rbp
retq
movq -0x210(%rbp), %rdi
callq 0x3450
nopl (%rax)
// File: sidvishnoi[P]filesystem-assignment/day1/writeSector.cpp
// Function: FileSystem::writeSector(int, char*)
int FileSystem::writeSector(int sector_no, char *buf)
{
    /*
    objective: to write a sector in disk
    input:
        sector_no: sector number to write in
        buf: a buffer of size sectorSize_k bytes, which is to be written in the sector
    return:
        0: success
        1: failure (%% handle errors)
    */

    ofstream fp;
    // open disk file in edit mode
    fp.open(diskTitle_k, ios::binary | ios::in | ios::out);

    /* %%
    at which byte position the buf be written?
    >> put that expression by replacing -1 below
    */
    int byteOffset = -1;
    fp.seekp(byteOffset);

    fp.write(buf, sectorSize_k);
    fp.close();

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x260, %rsp            # imm = 0x260
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x250(%rbp)
movq %rax, -0x248(%rbp)
leaq -0x218(%rbp), %rdi
callq 0x3420
movl $0x4, %edi
movl $0x8, %esi
callq 0x62a0
movl %eax, -0x23c(%rbp)
jmp 0x81ab
movl -0x23c(%rbp), %edi
movl $0x10, %esi
callq 0x62a0
movl %eax, -0x254(%rbp)
jmp 0x81c3
movl -0x254(%rbp), %edx
movq -0x250(%rbp), %rsi
leaq -0x218(%rbp), %rdi
callq 0x3100
jmp 0x81de
movl $0xffffffff, -0x228(%rbp) # imm = 0xFFFFFFFF
movslq -0x228(%rbp), %rsi
leaq -0x238(%rbp), %rdi
callq 0x6570
jmp 0x81fd
movq -0x238(%rbp), %rsi
movq -0x230(%rbp), %rdx
leaq -0x218(%rbp), %rdi
callq 0x32d0
jmp 0x8219
movq -0x248(%rbp), %rax
movq -0x18(%rbp), %rsi
movslq 0x20(%rax), %rdx
leaq -0x218(%rbp), %rdi
callq 0x3340
jmp 0x8236
leaq -0x218(%rbp), %rdi
callq 0x3390
jmp 0x8244
leaq -0x218(%rbp), %rdi
callq 0x33b0
xorl %eax, %eax
addq $0x260, %rsp            # imm = 0x260
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x220(%rbp)
movl %eax, -0x224(%rbp)
leaq -0x218(%rbp), %rdi
callq 0x33b0
movq -0x220(%rbp), %rdi
callq 0x3450
nopw %cs:(%rax,%rax)
nop
// File: sidvishnoi[P]filesystem-assignment/day1/readSector.cpp
// Function: FileSystem::readSector(int, char*)
int FileSystem::readSector(int sector_no, char *buf)
{
    /*
    objective: to read a sector from disk into buf
    input:
        sector_no: sector number to read
        buf: a buffer of size sectorSize_k bytes, into which the content of sector are to be read
    return:
        0: success
        1: failure (%% handle errors)
    */
    ifstream fin;
    fin.open(diskTitle_k, ios::binary | ios::in);

    /* %%
    at which byte position the buf be read from?
    >> put that expression by replacing -1 below
    (hint: same as in writeSector())
    */
    int byteOffset = -1;
    fin.seekg(byteOffset);

    fin.read(buf, sectorSize_k);
    fin.close();
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x260, %rsp            # imm = 0x260
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x258(%rbp)
movq %rax, -0x250(%rbp)
leaq -0x220(%rbp), %rdi
callq 0x32b0
movl $0x4, %edi
movl $0x8, %esi
callq 0x62a0
movl %eax, -0x244(%rbp)
jmp 0x82db
movl -0x244(%rbp), %edx
movq -0x258(%rbp), %rsi
leaq -0x220(%rbp), %rdi
callq 0x31f0
jmp 0x82f6
movl $0xffffffff, -0x230(%rbp) # imm = 0xFFFFFFFF
movslq -0x230(%rbp), %rsi
leaq -0x240(%rbp), %rdi
callq 0x6570
jmp 0x8315
movq -0x240(%rbp), %rsi
movq -0x238(%rbp), %rdx
leaq -0x220(%rbp), %rdi
callq 0x3310
jmp 0x8331
movq -0x250(%rbp), %rax
movq -0x18(%rbp), %rsi
movslq 0x20(%rax), %rdx
leaq -0x220(%rbp), %rdi
callq 0x3300
jmp 0x834e
leaq -0x220(%rbp), %rdi
callq 0x3060
jmp 0x835c
leaq -0x220(%rbp), %rdi
callq 0x3070
xorl %eax, %eax
addq $0x260, %rsp            # imm = 0x260
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x228(%rbp)
movl %eax, -0x22c(%rbp)
leaq -0x220(%rbp), %rdi
callq 0x3070
movq -0x228(%rbp), %rdi
callq 0x3450
nopl (%rax)
// File: sidvishnoi[P]filesystem-assignment/day2/getStatus.cpp
// Function: FileSystem::getStatus(int)
int FileSystem::getStatus(int sector_no) {
    /*
    objective: to get status of a given sector
    input:
        sector_no = sector number
    return:
        status of a sector
    */

    if (sector_no > numberOfSectors_k - 1) {
        cout << "ERROR: Sector does not exist." << endl;
        return NOT_FOUND;
    }
      if (sector_no < reservedSectors_k) {
        cout << "ERROR: Sector is reserved." << endl;
        return RESERVED;
    }

    // cast will convert a char[4] array to an int, using type-punning
    TypeCastInt cast;

    /* %%
    Compute which to sector read from, as minimum unit of read/write is a sector
    >> based on sector_no, computer a <sectorOffset> which should have the status for sector_no
    >> also, compute a <byteOffset> which shows starting from which byte in <sectorOffset>, next 4 bytes need to be read
    (hint: same as in setStatus())
    */
    int sectorOffset, byteOffset;
    // compute here

    char buffer[sectorSize_k];
    readSector(sectorOffset, buffer);

    // edit buffer
    for (int i = byteOffset, j = 0; j < 4; ++i, ++j) {
        cast.str[j] = buffer[i];
    }

    return cast.num;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rcx
movq %rcx, -0x40(%rbp)
movl -0x14(%rbp), %eax
movl 0x2c(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jle 0x83f2
movq 0x8c05(%rip), %rdi      # 0x10fd0
leaq 0x3f28(%rip), %rsi      # 0xc2fa
callq 0x3230
movq %rax, %rdi
movq 0x8bdf(%rip), %rsi      # 0x10fc0
callq 0x3260
movl $0x3, -0x4(%rbp)
jmp 0x84a2
movq -0x40(%rbp), %rcx
movl -0x14(%rbp), %eax
cmpl 0x28(%rcx), %eax
jge 0x8429
movq 0x8bcb(%rip), %rdi      # 0x10fd0
leaq 0x3f0c(%rip), %rsi      # 0xc318
callq 0x3230
movq %rax, %rdi
movq 0x8ba5(%rip), %rsi      # 0x10fc0
callq 0x3260
movl $0x2, -0x4(%rbp)
jmp 0x84a2
movq -0x40(%rbp), %rdi
movl 0x20(%rdi), %eax
movq %rsp, %rcx
movq %rcx, -0x28(%rbp)
movq %rax, %rcx
addq $0xf, %rcx
andq $-0x10, %rcx
movq %rsp, %rdx
subq %rcx, %rdx
movq %rdx, -0x48(%rbp)
movq %rdx, %rsp
movq %rax, -0x30(%rbp)
movl -0x1c(%rbp), %esi
callq 0x8290
movl -0x20(%rbp), %eax
movl %eax, -0x34(%rbp)
movl $0x0, -0x38(%rbp)
cmpl $0x4, -0x38(%rbp)
jge 0x8495
movq -0x48(%rbp), %rax
movslq -0x34(%rbp), %rcx
movb (%rax,%rcx), %cl
movslq -0x38(%rbp), %rax
movb %cl, -0x18(%rbp,%rax)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x8468
movl -0x18(%rbp), %eax
movl %eax, -0x4(%rbp)
movq -0x28(%rbp), %rax
movq %rax, %rsp
movl -0x4(%rbp), %eax
movq %rbp, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: sidvishnoi[P]filesystem-assignment/day2/setStatus.cpp
// Function: FileSystem::setStatus(int, int)
int FileSystem::setStatus(int sector_no, int x) {
    /*
    objective: to update status of a given sector
    input:
        sector_no = sector number
        x = status (0 = FREE, 1 = BUSY, other: continuation sector number)
    return:
        (failure) -1
        (success) 0
    effect: a sector is marked in disk
    */

    if (sector_no > numberOfSectors_k - 1) {
        cout << "ERROR: Sector does not exist." << endl;
        return -1;
    }
    if (sector_no < reservedSectors_k) {
        cout << "ERROR: Sector is reserved." << endl;
        return -1;
    }

    // cast will convert an int <x> to a char[4] array, using type-punning
    TypeCastInt cast;
    cast.num = x;

    /* %%
    Compute which to sector update, as minimum unit of read/write is a sector
    >> based on sector_no, computer a <sectorOffset> which should have the status for sector_no
    >> also, compute a <byteOffset> which shows starting from which byte in <sectorOffset>, next 4 bytes need to be updated
    */
    int sectorOffset, byteOffset;
    // compute here

    char buffer[sectorSize_k];
    readSector(sectorOffset, buffer);

    // edit buffer
    for (int i = byteOffset, j = 0; j < 4; ++i, ++j) {
        buffer[i] = cast.str[j];
    }

    writeSector(sectorOffset, buffer);

    return 0;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movq -0x10(%rbp), %rcx
movq %rcx, -0x48(%rbp)
movl -0x14(%rbp), %eax
movl 0x2c(%rcx), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jle 0x8505
movq 0x8af2(%rip), %rdi      # 0x10fd0
leaq 0x3e15(%rip), %rsi      # 0xc2fa
callq 0x3230
movq %rax, %rdi
movq 0x8acc(%rip), %rsi      # 0x10fc0
callq 0x3260
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x85cf
movq -0x48(%rbp), %rcx
movl -0x14(%rbp), %eax
cmpl 0x28(%rcx), %eax
jge 0x853f
movq 0x8ab8(%rip), %rdi      # 0x10fd0
leaq 0x3df9(%rip), %rsi      # 0xc318
callq 0x3230
movq %rax, %rdi
movq 0x8a92(%rip), %rsi      # 0x10fc0
callq 0x3260
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x85cf
movq -0x48(%rbp), %rdi
movl -0x18(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl 0x20(%rdi), %eax
movq %rsp, %rcx
movq %rcx, -0x30(%rbp)
movq %rax, %rcx
addq $0xf, %rcx
andq $-0x10, %rcx
movq %rsp, %rdx
subq %rcx, %rdx
movq %rdx, -0x50(%rbp)
movq %rdx, %rsp
movq %rax, -0x38(%rbp)
movl -0x20(%rbp), %esi
callq 0x8290
movl -0x24(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl $0x0, -0x40(%rbp)
cmpl $0x4, -0x40(%rbp)
jge 0x85b1
movq -0x50(%rbp), %rax
movslq -0x40(%rbp), %rcx
movb -0x1c(%rbp,%rcx), %dl
movslq -0x3c(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x8584
movq -0x50(%rbp), %rdx
movq -0x48(%rbp), %rdi
movl -0x20(%rbp), %esi
callq 0x8160
movl $0x0, -0x4(%rbp)
movq -0x30(%rbp), %rax
movq %rax, %rsp
movl -0x4(%rbp), %eax
movq %rbp, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: sidvishnoi[P]filesystem-assignment/day3/writeEntry.cpp
// Function: FileSystem::writeEntry(std::vector<int, std::allocator<int>>, char const*)
void FileSystem::writeEntry(vector<int> offset, const char * buffer) {
    /*
     Objective: to write a file/dir entry at right offset
     Input Parameters:
        offset (sectorOffset, byteOffset) to write at
        buffer: 32 bytes from cast.str
     return: None
     effect: 32 bytes of new entry are written in disk
     */
    char buf[sectorSize_k];
    readSector(offset[0],buf);

    // %% modify correct 32 bytes of 'buf' starting from byte offset

    // write updated buf
    writeSector(offset[0], buf);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rsi, -0x48(%rbp)
movq %rdi, %rax
movq -0x48(%rbp), %rdi
movq %rdi, -0x40(%rbp)
movq %rax, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
movl 0x20(%rax), %eax
movq %rsp, %rcx
movq %rcx, -0x20(%rbp)
movq %rax, %rdx
addq $0xf, %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x30(%rbp)
movq %rcx, %rsp
movq %rax, -0x28(%rbp)
xorl %eax, %eax
movl %eax, %esi
callq 0x9c20
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rdx
movl (%rax), %esi
callq 0x8290
movq -0x40(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x9c20
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rdx
movl (%rax), %esi
callq 0x8160
movq -0x20(%rbp), %rax
movq %rax, %rsp
movq %rbp, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)
// File: sidvishnoi[P]filesystem-assignment/day3/readFile.cpp
// Function: FileSystem::readFile(char const*)
int FileSystem::readFile(const char *title) {
    /*
    Objective: To a read a file
    Input parameters:
        title: File name
    Return:
        0: success
        1: error
    Output: contents of file
    */
    TypeCastEntry entry;
    if (strlen(title) == 0) {
        // %% get file name from user in entry.entry.name
    } else {
        strcpy(entry.entry.name, title);
    }

    vector<int>position = alreadyExists(entry.entry.name, 'f');
    // %% use position to check if given file exists
    bool exists;
    if(!exists) {
        // %% display error message
        return 1;
    }

    char buffer[sectorSize_k];
    // %% read sector offset returned by alreadyExists() in "buffer"

    //reading file entry in entry.str
    for( int i = 0 ; i < 32 ; ++i) entry.str[i] = buffer[position[1] + i];

    int sector = entry.entry.startsAt;
    while (sector != 1) {
        // %% Display content of sector
        sector = getStatus(sector);
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x18(%rbp), %rdi
callq 0x30d0
cmpq $0x0, %rax
jne 0xa4af
jmp 0xa4c0
leaq -0x3c(%rbp), %rdi
addq $0x10, %rdi
movq -0x18(%rbp), %rsi
callq 0x3220
movq -0x90(%rbp), %rsi
leaq -0x3c(%rbp), %rdx
addq $0x10, %rdx
leaq -0x58(%rbp), %rdi
movl $0x66, %ecx
callq 0x90d0
testb $0x1, -0x59(%rbp)
jne 0xa4f6
movl $0x1, -0x4(%rbp)
movl $0x1, -0x60(%rbp)
jmp 0xa5c6
movq -0x90(%rbp), %rax
movl 0x20(%rax), %eax
movq %rsp, %rcx
movq %rcx, -0x68(%rbp)
movq %rax, %rdx
addq $0xf, %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x98(%rbp)
movq %rcx, %rsp
movq %rax, -0x70(%rbp)
movl $0x0, -0x74(%rbp)
cmpl $0x20, -0x74(%rbp)
jge 0xa569
leaq -0x58(%rbp), %rdi
movl $0x1, %esi
callq 0x9c20
movq %rax, %rcx
movq -0x98(%rbp), %rax
movl (%rcx), %ecx
addl -0x74(%rbp), %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %cl
movslq -0x74(%rbp), %rax
movb %cl, -0x3c(%rbp,%rax)
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0xa52d
movl -0x3c(%rbp), %eax
movl %eax, -0x78(%rbp)
cmpl $0x1, -0x78(%rbp)
je 0xa5b1
movq -0x90(%rbp), %rdi
movl -0x78(%rbp), %esi
callq 0x83a0
movl %eax, -0x9c(%rbp)
jmp 0xa58c
movl -0x9c(%rbp), %eax
movl %eax, -0x78(%rbp)
jmp 0xa56f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x3db0
jmp 0xa5d7
movl $0x0, -0x4(%rbp)
movl $0x1, -0x60(%rbp)
movq -0x68(%rbp), %rax
movq %rax, %rsp
leaq -0x58(%rbp), %rdi
callq 0x3db0
movl -0x4(%rbp), %eax
movq %rbp, %rsp
popq %rbp
retq
movq -0x80(%rbp), %rdi
callq 0x3450
// File: sidvishnoi[P]filesystem-assignment/day4/undeleteFile.cpp
// Function: FileSystem::undeleteFile(char const*)
int FileSystem::undeleteFile(const char *title) {
    /*
     Objective: To a undelete a file
     Input parameters:
     title: File name
     Return:
     0: success
     1: error
     */
    TypeCastEntry entry;
    if (strlen(title) == 0) {
        // %% get file name from user in entry.entry.name
    } else {
        strcpy(entry.entry.name, title);
    }
    
    vector<int>position = alreadyExists(entry.entry.name, 'F');
    // %% use position to check if given file exists
    bool exists;
    if (!exists) {
        // %% display error message
        return 1;
    }
    
    char buffer[sectorSize_k];
    // %% read sector offset returned by alreadyExists() in "buffer"
    
    //reading file entry in entry.str
    for (int i = 0; i < 32; ++i) {
        entry.str[i] = buffer[position[1] + i];
    }
    
    int pos = entry.entry.startsAt;
    do {
        // reset status from deleted (negative) to normal (positive)
        int temp = (-1)*getStatus(pos);
        // %% change the status of "pos" to temp
        pos = temp;
    } while(pos != 1);
    
    //file marked undeleted
    entry.entry.type = 'f';
    
    // %% write the new updated entry at sector offset
    
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x18(%rbp), %rdi
callq 0x30d0
cmpq $0x0, %rax
jne 0xaa4f
jmp 0xaa60
leaq -0x3c(%rbp), %rdi
addq $0x10, %rdi
movq -0x18(%rbp), %rsi
callq 0x3220
movq -0x98(%rbp), %rsi
leaq -0x3c(%rbp), %rdx
addq $0x10, %rdx
leaq -0x58(%rbp), %rdi
movl $0x46, %ecx
callq 0x90d0
testb $0x1, -0x59(%rbp)
jne 0xaa96
movl $0x1, -0x4(%rbp)
movl $0x1, -0x60(%rbp)
jmp 0xab79
movq -0x98(%rbp), %rax
movl 0x20(%rax), %eax
movq %rsp, %rcx
movq %rcx, -0x68(%rbp)
movq %rax, %rdx
addq $0xf, %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0xa0(%rbp)
movq %rcx, %rsp
movq %rax, -0x70(%rbp)
movl $0x0, -0x74(%rbp)
cmpl $0x20, -0x74(%rbp)
jge 0xab09
leaq -0x58(%rbp), %rdi
movl $0x1, %esi
callq 0x9c20
movq %rax, %rcx
movq -0xa0(%rbp), %rax
movl (%rcx), %ecx
addl -0x74(%rbp), %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %cl
movslq -0x74(%rbp), %rax
movb %cl, -0x3c(%rbp,%rax)
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0xaacd
movl -0x3c(%rbp), %eax
movl %eax, -0x78(%rbp)
movq -0x98(%rbp), %rdi
movl -0x78(%rbp), %esi
callq 0x83a0
movl %eax, -0xa4(%rbp)
jmp 0xab26
movl -0xa4(%rbp), %eax
imull $0xffffffff, %eax, %eax # imm = 0xFFFFFFFF
movl %eax, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
movl %eax, -0x78(%rbp)
cmpl $0x1, -0x78(%rbp)
jne 0xab0f
movb $0x66, -0x34(%rbp)
movl $0x0, -0x4(%rbp)
movl $0x1, -0x60(%rbp)
movq -0x68(%rbp), %rax
movq %rax, %rsp
jmp 0xab79
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x3db0
jmp 0xab8a
leaq -0x58(%rbp), %rdi
callq 0x3db0
movl -0x4(%rbp), %eax
movq %rbp, %rsp
popq %rbp
retq
movq -0x88(%rbp), %rdi
callq 0x3450
nopw %cs:(%rax,%rax)
// File: phillip-h[P]todo/src/args.cpp
// Function: removeList()
void removeList()
{
    TodoList *list = Core::list(name());
    if (!list->exists()){
        cout << ANSI_RED << "Todo List '" << list->name;
        cout << "' does not exist!\n" << ANSI_RESET;
        return;
    }

    string choice;
    cout << "Remove list? [Y/n] > ";
    cin >> choice;
    if (choice != "Y"){
        cout << "Not removing.\n";
        return;
    }

    if (remove(list->getPath().c_str()) != 0){
        cout << ANSI_RED << "Failed to remove list!\n" << ANSI_RESET;
        return;
    }
    cout << "List removed.\n";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
leaq -0x28(%rbp), %rdi
movq %rdi, -0x90(%rbp)
callq 0x82a0
movq -0x90(%rbp), %rdi
callq 0x9820
movq %rax, -0x88(%rbp)
jmp 0x7c00
leaq -0x28(%rbp), %rdi
callq 0x4738
movq -0x88(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0xdd20
testb $0x1, %al
jne 0x7c94
movq 0x103a0(%rip), %rdi     # 0x17fc8
leaq 0x108b9(%rip), %rsi     # 0x184e8
callq 0x4300
movq %rax, %rdi
leaq 0xa6a8(%rip), %rsi      # 0x122e6
callq 0x4340
movq %rax, %rdi
movq -0x8(%rbp), %rsi
addq $0x8, %rsi
callq 0x4300
movq 0x1036e(%rip), %rdi     # 0x17fc8
leaq 0xa4a5(%rip), %rsi      # 0x12106
callq 0x4340
movq %rax, %rdi
leaq 0x10858(%rip), %rsi     # 0x184c8
callq 0x4300
jmp 0x7dd8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x4738
jmp 0x7de1
leaq -0x58(%rbp), %rdi
callq 0x4500
movq 0x10324(%rip), %rdi     # 0x17fc8
leaq 0xa647(%rip), %rsi      # 0x122f2
callq 0x4340
jmp 0x7cb2
movq 0x10327(%rip), %rdi     # 0x17fe0
leaq -0x58(%rbp), %rsi
callq 0x44a0
jmp 0x7cc4
leaq 0xa63d(%rip), %rsi      # 0x12308
leaq -0x58(%rbp), %rdi
callq 0x8860
movb %al, -0x91(%rbp)
jmp 0x7cdc
movb -0x91(%rbp), %al
testb $0x1, %al
jne 0x7ce8
jmp 0x7d23
movq 0x102d9(%rip), %rdi     # 0x17fc8
leaq 0xa614(%rip), %rsi      # 0x1230a
callq 0x4340
jmp 0x7cfd
movl $0x1, -0x5c(%rbp)
jmp 0x7dcf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x4738
jmp 0x7de1
movq -0x8(%rbp), %rsi
leaq -0x80(%rbp), %rdi
callq 0xd7b0
jmp 0x7d32
leaq -0x80(%rbp), %rdi
callq 0x41b0
movq %rax, %rdi
callq 0x46b0
movl %eax, -0x98(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x4738
movl -0x98(%rbp), %eax
cmpl $0x0, %eax
je 0x7db3
movq 0x10264(%rip), %rdi     # 0x17fc8
leaq 0x1077d(%rip), %rsi     # 0x184e8
callq 0x4300
movq %rax, -0xa0(%rbp)
jmp 0x7d79
movq -0xa0(%rbp), %rdi
leaq 0xa592(%rip), %rsi      # 0x12319
callq 0x4340
movq %rax, -0xa8(%rbp)
jmp 0x7d95
movq -0xa8(%rbp), %rdi
leaq 0x10725(%rip), %rsi     # 0x184c8
callq 0x4300
jmp 0x7daa
movl $0x1, -0x5c(%rbp)
jmp 0x7dcf
movq 0x1020e(%rip), %rdi     # 0x17fc8
leaq 0xa570(%rip), %rsi      # 0x12331
callq 0x4340
jmp 0x7dc8
movl $0x0, -0x5c(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x4738
addq $0xb0, %rsp
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x4680
nopw (%rax,%rax)
// File: phillip-h[P]todo/src/core.cpp
// Function: restore(TodoList*&)
void restore(TodoList *&list)
{
    if (!backup_)
        return;
    delete list;
    list = new TodoList(backup_);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, 0xe204(%rip)      # 0x18648
jne 0xa448
jmp 0xa49d
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
je 0xa470
movq -0x20(%rbp), %rdi
callq 0xd430
movq -0x20(%rbp), %rdi
movl $0x28, %esi
callq 0x4360
movl $0x28, %edi
callq 0x4350
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x28(%rbp)
movq 0xe1bd(%rip), %rsi      # 0x18648
callq 0xd380
jmp 0xa492
movq -0x28(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
addq $0x30, %rsp
popq %rbp
retq
movq -0x28(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
movl $0x28, %esi
callq 0x4360
movq -0x10(%rbp), %rdi
callq 0x4680
nopw %cs:(%rax,%rax)
// File: phillip-h[P]todo/src/draw.cpp
// Function: drawTitle(TodoList*)
void drawTitle(TodoList* list)
{
    titleWin->clear();
    titleWin->inverse();
    titleWin->color(TITLE_COLOR_PAIR);
    titleWin->print(buildTitle(list), 0, 0);
    titleWin->colorOff(TITLE_COLOR_PAIR);
    titleWin->inverseOff();
    titleWin->color(BORDER_COLOR_PAIR, true);
    titleWin->draw();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq 0xd915(%rip), %rdi      # 0x18738
callq 0x11ad0
movq 0xd909(%rip), %rdi      # 0x18738
xorl %esi, %esi
movl %esi, -0x38(%rbp)
callq 0x11c00
movl -0x38(%rbp), %edx
movq 0xd8f5(%rip), %rdi      # 0x18738
movl $0x1, %esi
callq 0x11d90
movq 0xd8e4(%rip), %rax      # 0x18738
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rsi
leaq -0x28(%rbp), %rdi
movq %rdi, -0x40(%rbp)
callq 0xc1f0
movq -0x48(%rbp), %rdi
movq -0x40(%rbp), %rsi
movl -0x38(%rbp), %ecx
movl %ecx, %edx
callq 0x11d30
jmp 0xae7d
leaq -0x28(%rbp), %rdi
callq 0x4738
movq 0xd8ab(%rip), %rdi      # 0x18738
movl $0x1, %esi
xorl %edx, %edx
callq 0x11e00
movq 0xd898(%rip), %rdi      # 0x18738
xorl %esi, %esi
callq 0x11c60
movq 0xd88a(%rip), %rdi      # 0x18738
movl $0x4, %esi
movl $0x1, %edx
callq 0x11d90
movq 0xd874(%rip), %rdi      # 0x18738
callq 0x11b00
addq $0x50, %rsp
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x4738
movq -0x30(%rbp), %rdi
callq 0x4680
nopl (%rax)
// File: phillip-h[P]todo/src/draw.cpp
// Function: Draw::mouse(MEVENT, TodoList*, unsigned int&, bool)
void Draw::mouse(MEVENT event, TodoList *list,
                 unsigned &selected, bool button)
{
    int x = event.x;
    int y = event.y;
    if (taskWin->mouse(x, y)){
        unsigned pos = listOff + y - 1;
        if (pos < list->size()){
            if (!button){
                selected = pos;
            } else{
                list->at(pos).toggleComplete();
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movb %dl, %cl
leaq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
andb $0x1, %cl
movb %cl, -0x11(%rbp)
movl 0x4(%rax), %ecx
movl %ecx, -0x18(%rbp)
movl 0x8(%rax), %eax
movl %eax, -0x1c(%rbp)
movq 0xc641(%rip), %rdi      # 0x18740
leaq -0x18(%rbp), %rsi
leaq -0x1c(%rbp), %rdx
callq 0x11e70
testb $0x1, %al
jne 0xc112
jmp 0xc162
movl 0xc660(%rip), %eax      # 0x18778
addl -0x1c(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rdi
callq 0xd9c0
movl %eax, %ecx
movl -0x24(%rbp), %eax
cmpl %ecx, %eax
jae 0xc160
testb $0x1, -0x11(%rbp)
jne 0xc14a
movl -0x20(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
jmp 0xc15e
movq -0x8(%rbp), %rdi
movl -0x20(%rbp), %esi
callq 0xd9e0
movq %rax, %rdi
callq 0xcae0
jmp 0xc160
jmp 0xc162
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: phillip-h[P]todo/src/draw.cpp
// Function: drawDivider(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int)
void drawDivider(string div, int ypos)
{
    if (showNumbers) {
        for (unsigned i = 0; i < 3; i++) {
            div = "=" + div;
        }
    }
    while ((int) div.size() < width - 3){
        div += division;
    }
    taskWin->print(div, 1, ypos);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x68(%rbp)
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl $0x0, -0x10(%rbp)
cmpl $0x3, -0x10(%rbp)
jae 0xc4f8
movq -0x68(%rbp), %rdx
leaq -0x30(%rbp), %rdi
leaq 0x5b3e(%rip), %rsi      # 0x12010
callq 0xa580
movq -0x68(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x4470
leaq -0x30(%rbp), %rdi
callq 0x4738
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0xc4bd
jmp 0xc4fa
movq -0x68(%rbp), %rdi
callq 0x4270
movl 0xc257(%rip), %ecx      # 0x18760
subl $0x3, %ecx
cmpl %ecx, %eax
jge 0xc522
movq -0x68(%rbp), %rdi
leaq 0xc1bd(%rip), %rsi      # 0x186d8
callq 0x44c0
jmp 0xc4fa
movq -0x68(%rbp), %rsi
movq 0xc213(%rip), %rax      # 0x18740
movq %rax, -0x78(%rbp)
leaq -0x50(%rbp), %rdi
movq %rdi, -0x70(%rbp)
callq 0x41c0
movq -0x78(%rbp), %rdi
movq -0x70(%rbp), %rsi
movl -0xc(%rbp), %ecx
movl $0x1, %edx
callq 0x11d30
jmp 0xc555
leaq -0x50(%rbp), %rdi
callq 0x4738
addq $0x80, %rsp
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x4738
movq -0x58(%rbp), %rdi
callq 0x4680
nopw %cs:(%rax,%rax)
// File: phillip-h[P]todo/src/draw.cpp
// Function: Draw::stop()
void Draw::stop()
{
    delete titleWin;
    delete taskWin;
    delete controlWin;
    delete inputWin;

    endwin();

    curs_set(1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq 0xc199(%rip), %rax      # 0x18738
movq %rax, -0x8(%rbp)
cmpq $0x0, %rax
je 0xc5c0
movq -0x8(%rbp), %rdi
callq 0x11a60
movq -0x8(%rbp), %rdi
movl $0x40, %esi
callq 0x4360
movq 0xc179(%rip), %rax      # 0x18740
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
je 0xc5e8
movq -0x10(%rbp), %rdi
callq 0x11a60
movq -0x10(%rbp), %rdi
movl $0x40, %esi
callq 0x4360
movq 0xc159(%rip), %rax      # 0x18748
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
je 0xc610
movq -0x18(%rbp), %rdi
callq 0x11a60
movq -0x18(%rbp), %rdi
movl $0x40, %esi
callq 0x4360
movq 0xc139(%rip), %rax      # 0x18750
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
je 0xc638
movq -0x20(%rbp), %rdi
callq 0x11a60
movq -0x20(%rbp), %rdi
movl $0x40, %esi
callq 0x4360
callq 0x4450
movl $0x1, %edi
callq 0x42d0
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: phillip-h[P]todo/src/task.cpp
// Function: Task::task[abi:cxx11]()
string Task::task()
{
    string value = "";
    
    if (complete){
        value += STRING_COMPLETE;
    } else{
        value += STRING_NOT_COMPLETE;
    }
    
    value += " " + name;
    
    return value;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x58(%rbp)
movq %rdi, %rax
movq %rax, -0x68(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x60(%rbp)
movb $0x0, -0x11(%rbp)
leaq -0x12(%rbp), %rdi
movq %rdi, -0x50(%rbp)
callq 0x4690
movq -0x58(%rbp), %rdi
movq -0x50(%rbp), %rdx
leaq 0x58f7(%rip), %rsi      # 0x1244a
callq 0x85c0
jmp 0xcb5a
leaq -0x12(%rbp), %rdi
callq 0x43d0
movq -0x60(%rbp), %rax
testb $0x1, 0x20(%rax)
je 0xcba9
movq -0x58(%rbp), %rdi
leaq 0xbc68(%rip), %rsi      # 0x187e0
callq 0x44c0
jmp 0xcb7f
jmp 0xcbbd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x12(%rbp), %rdi
callq 0x43d0
jmp 0xcc2a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0xcc21
movq -0x58(%rbp), %rdi
leaq 0xbc0c(%rip), %rsi      # 0x187c0
callq 0x44c0
jmp 0xcbbb
jmp 0xcbbd
movq -0x60(%rbp), %rdx
leaq 0x58cb(%rip), %rsi      # 0x12493
leaq -0x48(%rbp), %rdi
callq 0xa580
jmp 0xcbd3
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x44c0
jmp 0xcbe2
leaq -0x48(%rbp), %rdi
callq 0x4738
movb $0x1, -0x11(%rbp)
testb $0x1, -0x11(%rbp)
jne 0xcc17
jmp 0xcc0e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x4738
jmp 0xcc21
movq -0x58(%rbp), %rdi
callq 0x4738
movq -0x68(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x4738
movq -0x20(%rbp), %rdi
callq 0x4680
nopw %cs:(%rax,%rax)