LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/lvandeve[P]lodepng/pngdetail.cpp
// Function: showHex(unsigned char const*, unsigned long, Options const&)
void showHex(const unsigned char* data, size_t size, const Options& options) {
  for(size_t i = 0; i < size; i++) {
    unsigned char c = data[i];
    if(options.hexformat == HF_BIN) {
      printf("%c", c);
    } else {
      if(c > 32 && c < 127 && options.hexformat == HF_MIX) printf(" %c ", c);
      else printf("%02x ", c);
      if(i % 32 == 31 && i + 1 != size) std::cout << std::endl;
    }
  }
  if(options.hexformat != HF_BIN) std::cout << std::endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
testq %rsi, %rsi
je 0x1aa0b
movq %rsi, %r14
movq %rdi, %r15
leaq -0x1(%rsi), %r13
leaq 0x9531(%rip), %rbp      # 0x23e90
xorl %r12d, %r12d
movq %rsi, (%rsp)
movzbl (%r15,%r12), %esi
movl 0x10(%rbx), %eax
cmpl $0x2, %eax
jne 0x1a97f
movl %esi, %edi
callq 0x22c0
jmp 0x1a9ff
cmpl $0x1, %eax
movq %rbp, %rdi
leaq 0x94ff(%rip), %rax      # 0x23e8b
cmoveq %rax, %rdi
leal -0x21(%rsi), %eax
cmpb $0x5e, %al
cmovaeq %rbp, %rdi
xorl %eax, %eax
callq 0x2060
movl %r12d, %eax
notl %eax
testb $0x1f, %al
setne %al
cmpq %r12, %r13
sete %cl
orb %al, %cl
jne 0x1a9ff
movq %rbx, %r14
movq %r15, %rbx
movq %rbp, %r15
movq %r13, %rbp
movq 0x10609(%rip), %r13     # 0x2afd0
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x2210
movsbl %al, %esi
movq %r13, %rdi
movq %rbp, %r13
movq %r15, %rbp
movq %rbx, %r15
movq %r14, %rbx
movq (%rsp), %r14
callq 0x2040
movq %rax, %rdi
callq 0x2160
incq %r12
cmpq %r12, %r14
jne 0x1a966
cmpl $0x2, 0x10(%rbx)
jne 0x1aa20
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x105a9(%rip), %rbx     # 0x2afd0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2210
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2160
// File: /workspace/github_cpp_makefile_star2_O1/lvandeve[P]lodepng/pngdetail.cpp
// Function: shortenText(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, Options const&)
std::string shortenText(const std::string& text, const Options& options) {
  if(options.expand_long_texts) return text;
  size_t maxlen = 512;
  size_t maxnl = options.verbose ? 5 : 1;
  size_t numnl = 0; // amount of newlines
  for(size_t i = 0; i < text.size(); i++) {
    if(text[i] == 10) numnl++;
    if(numnl >= maxnl) {
      maxlen = i;
      break;
    }
  }

  if(text.size() < maxlen) return text;

  return text.substr(0, maxlen) + (numnl > 1 ? "\n" : "") + "... [TEXT SNIPPED! use -t to expand long text]";
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
cmpb $0x1, 0x1(%rdx)
jne 0x1b9f7
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq (%rsi), %rax
movq 0x8(%rsi), %rdx
addq %rax, %rdx
movq %rbx, %rdi
movq %rax, %rsi
jmp 0x1ba70
movq %rdx, %rax
movq 0x8(%rsi), %rdx
testq %rdx, %rdx
je 0x1ba4f
movzbl (%rax), %eax
leaq 0x1(,%rax,4), %rdi
movq (%rsi), %r8
xorl %ecx, %ecx
xorl %eax, %eax
movq %rax, %r9
xorl %eax, %eax
cmpb $0xa, (%r8,%rcx)
sete %al
addq %r9, %rax
cmpq %rdi, %rax
jae 0x1ba37
incq %rcx
cmpq %rcx, %rdx
jne 0x1ba15
movl $0x200, %ecx            # imm = 0x200
cmpq $0x2, %rax
leaq 0x87b3(%rip), %rax      # 0x241f5
leaq 0x87ad(%rip), %r14      # 0x241f6
cmovaeq %rax, %r14
jmp 0x1ba5b
leaq 0x87a0(%rip), %r14      # 0x241f6
movl $0x200, %ecx            # imm = 0x200
cmpq %rcx, %rdx
jae 0x1ba84
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq (%rsi), %rsi
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x152f0
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x28(%rsp), %r15
movq %r15, %rdi
xorl %edx, %edx
callq 0x2250
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %rdi
callq 0x152f0
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x23b0
leaq 0x10(%rbx), %r15
movq %r15, (%rbx)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x152f0
leaq 0x8684(%rip), %rsi      # 0x24165
movq %rbx, %rdi
callq 0x23b0
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x1baf8
callq 0x2200
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1ba75
callq 0x2200
jmp 0x1ba75
movq %rax, %r14
movq (%rbx), %rdi
cmpq %r15, %rdi
je 0x1bb2b
callq 0x2200
jmp 0x1bb2b
jmp 0x1bb28
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x1bb3f
callq 0x2200
jmp 0x1bb3f
movq %rax, %r14
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1bb52
callq 0x2200
movq %r14, %rdi
callq 0x2390
// File: /workspace/github_cpp_makefile_star2_O1/lvandeve[P]lodepng/pngdetail.cpp
// Function: readExifUint32(unsigned char const*, unsigned long, unsigned long, bool)
uint32_t readExifUint32(const unsigned char* exif, size_t size, size_t pos, bool big_endian) {
  if(pos + 4 > size) return 0;
  if(big_endian) {
    return ((uint32_t)exif[pos + 0] << 24u) | ((uint32_t)exif[pos + 1] << 16u) | ((uint32_t)exif[pos + 2] << 8u) | (uint32_t)exif[pos + 3];
  } else {
    return ((uint32_t)exif[pos + 3] << 24u) | ((uint32_t)exif[pos + 2] << 16u) | ((uint32_t)exif[pos + 1] << 8u) | (uint32_t)exif[pos + 0];
  }
}

// Assembly:
leaq 0x4(%rdx), %r8
xorl %eax, %eax
cmpq %rsi, %r8
ja 0x1c794
addq %rdx, %rdi
testb %cl, %cl
je 0x1c776
movzbl (%rdi), %eax
shll $0x18, %eax
movzbl 0x1(%rdi), %edx
shll $0x10, %edx
orl %eax, %edx
movzbl 0x2(%rdi), %ecx
shll $0x8, %ecx
orl %edx, %ecx
addq $0x3, %rdi
jmp 0x1c78f
movzbl 0x3(%rdi), %eax
shll $0x18, %eax
movzbl 0x2(%rdi), %edx
shll $0x10, %edx
orl %eax, %edx
movzbl 0x1(%rdi), %ecx
shll $0x8, %ecx
orl %edx, %ecx
movzbl (%rdi), %eax
orl %ecx, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq 0x38(%rdi), %rax
cmpq 0x40(%rdi), %rax
jne 0x1d514
movq %r14, %rdi
callq 0x1e5f4
cmpl $0x0, 0x2d8(%r14)
jne 0x1d588
leaq 0x38(%r14), %r15
cmpl $0x0, 0x18(%rbx)
jne 0x1d53b
movl 0x50(%r14), %esi
movl 0x54(%r14), %edx
movl 0x1c(%rbx), %ecx
movq %r15, %rdi
callq 0x176fd
cmpl $0x1, 0x18(%rbx)
jne 0x1d553
movl 0x50(%r14), %esi
movl 0x54(%r14), %edx
movq %r15, %rdi
xorl %ecx, %ecx
callq 0x17a69
cmpl $0x2, 0x18(%rbx)
jne 0x1d56e
movl 0x50(%r14), %esi
movl 0x54(%r14), %edx
movq %r15, %rdi
movl $0x1, %ecx
callq 0x17a69
cmpl $0x3, 0x18(%rbx)
jne 0x1d588
addq $0x20, %r14
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x18177
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
cmpb $0x1, 0x2(%rsi)
jne 0x1d5a9
movq %r14, %rdi
movq %rbx, %rsi
callq 0x19176
cmpb $0x1, 0x4(%rbx)
jne 0x1d5ba
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1c63b
cmpb $0x1, 0x7(%rbx)
jne 0x1d5c8
movq %r14, %rdi
callq 0x1d2e4
cmpb $0x0, 0x3(%rbx)
jne 0x1d5e0
cmpb $0x0, 0x5(%rbx)
jne 0x1d5e0
cmpb $0x0, 0x6(%rbx)
jne 0x1d5e0
cmpb $0x1, 0x8(%rbx)
jne 0x1d5eb
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1aa5c
cmpb $0x1, 0x9(%rbx)
jne 0x1d5fc
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1c0c1
cmpb $0x1, 0xa(%rbx)
jne 0x1d60d
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1bb5a
cmpb $0x1, 0xb(%rbx)
jne 0x1d61e
movq %r14, %rdi
movq %rbx, %rsi
callq 0x17f6f
cmpb $0x0, 0x20(%rbx)
jne 0x1d62a
cmpb $0x1, 0x21(%rbx)
jne 0x1d635
movq %r14, %rdi
movq %rbx, %rsi
callq 0x165f0
cmpb $0x1, 0x22(%rbx)
jne 0x1d646
movq %r14, %rdi
movq %rbx, %rsi
callq 0x17d0b
cmpb $0x1, 0x23(%rbx)
jne 0x1d654
movq %r14, %rdi
callq 0x18504
cmpb $0x1, 0x14(%rbx)
jne 0x1d665
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1d4f7
cmpl $0x0, 0x2d8(%r14)
je 0x1d681
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x18c7d
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x20(%rdi), %r14
movq 0x20(%rdi), %rcx
xorl %eax, %eax
cmpq 0x28(%rdi), %rcx
jne 0x1e616
movq %r14, %rdi
movq %rbx, %rsi
callq 0xce6c
movl %eax, 0x2d8(%rbx)
testl %eax, %eax
jne 0x1e664
movb $0x1, 0x2dc(%rbx)
leaq 0x58(%rbx), %rcx
movabsq $0x1000000006, %rax     # imm = 0x1000000006
movq %rax, 0x100(%rbx)
leaq 0x38(%rbx), %rdi
movq 0x38(%rbx), %rax
cmpq %rax, 0x40(%rbx)
je 0x1e64e
movq %rax, 0x40(%rbx)
leaq 0x50(%rbx), %rsi
leaq 0x54(%rbx), %rdx
movq %r14, %r8
callq 0xd482
movl %eax, 0x2d8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 %rbx
movq %rdi, %rbx
callq 0x1e4d4
testb %al, %al
jne 0x1e827
movq 0x20(%rbx), %rax
movq 0x28(%rbx), %rcx
subq %rax, %rcx
cmpq $0x80, %rcx
jb 0x1e827
movzbl (%rax), %edx
shll $0x18, %edx
movzbl 0x1(%rax), %esi
shll $0x10, %esi
movslq %edx, %rdx
orq %rsi, %rdx
movzbl 0x2(%rax), %esi
shll $0x8, %esi
orq %rdx, %rsi
movzbl 0x3(%rax), %edx
orq %rsi, %rdx
cmpq %rdx, %rcx
jne 0x1e827
cmpb $0x61, 0x24(%rax)
jne 0x1e827
cmpb $0x63, 0x25(%rax)
jne 0x1e827
cmpb $0x73, 0x26(%rax)
jne 0x1e827
cmpb $0x70, 0x27(%rax)
sete %al
jmp 0x1e829
xorl %eax, %eax
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 $0xffffffff, %edx       # imm = 0xFFFFFFFF
xorl %eax, %eax
xorl %ecx, %ecx
movl $0x1, %esi
shll %cl, %esi
testl %edi, %esi
jle 0x11cd
cmpl %eax, %edx
cmovgl %edx, %eax
xorl %edx, %edx
jmp 0x11d6
movl %edx, %esi
notl %esi
shrl $0x1f, %esi
addl %esi, %edx
incl %ecx
cmpl $0x20, %ecx
jne 0x11b9
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 %r15
pushq %r14
pushq %rbx
subq $0xc0, %rsp
leaq 0x10(%rsp), %r14
movq %r14, -0x10(%r14)
movq $0x0, -0x8(%r14)
movb $0x0, (%r14)
cmpl $0x2, %edi
jl 0x28b7
movq 0x8(%rsi), %rbx
testq %rbx, %rbx
je 0x28b7
movq %rbx, %rdi
callq 0x20a0
movq %rsp, %rdi
xorl %esi, %esi
xorl %edx, %edx
movq %rbx, %rcx
movq %rax, %r8
callq 0x22e0
jmp 0x28de
movq 0x5712(%rip), %rdi      # 0x7fd0
leaq 0x273f(%rip), %rsi      # 0x5004
movl $0x14, %edx
callq 0x2210
movq 0x570a(%rip), %rdi      # 0x7fe0
movq %rsp, %rsi
callq 0x2250
leaq 0x30(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
addq %rsi, %rdx
leaq 0x20(%rsp), %rdi
callq 0x2af2
leaq 0x40(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x410c
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x2923
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x21e0
movq 0x56a6(%rip), %rbx      # 0x7fd0
leaq 0x26e8(%rip), %rsi      # 0x5019
movl $0x26, %edx
movq %rbx, %rdi
callq 0x2210
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq 0x5674(%rip), %rdi      # 0x7fd0
callq 0x2030
movq %rax, %rdi
callq 0x2130
leaq 0x40(%rsp), %rdi
callq 0x2cf5
leaq 0x40(%rsp), %rbx
cmpl $0x1, %eax
je 0x2987
movq %rbx, %rdi
callq 0x2cf5
jmp 0x2978
leaq 0xa8(%rsp), %rdi
callq 0x2a96
leaq 0x90(%rsp), %rbx
movq %rbx, %rdi
callq 0x2a96
movq -0x18(%rbx), %rdi
testq %rdi, %rdi
je 0x29bd
movq 0x88(%rsp), %rsi
subq %rdi, %rsi
callq 0x21e0
leaq 0x50(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x29d8
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x21e0
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x29ee
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21e0
xorl %eax, %eax
addq $0xc0, %rsp
popq %rbx
popq %r14
popq %r15
retq
jmp 0x2a24
movq %rax, %rbx
movq 0x20(%rsp), %rdi
cmpq %r15, %rdi
je 0x2a31
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x21e0
jmp 0x2a31
jmp 0x2a1d
movq %rax, %rbx
jmp 0x2a31
jmp 0x2a24
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x2a50
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x2a47
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21e0
movq %rbx, %rdi
callq 0x2360
nop
// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1b0, %rsp            # imm = 0x1B0
movl %edx, %ebp
movq %rdi, %rbx
leaq 0x28(%rsp), %r14
movq %r14, %rdi
movl $0x18, %edx
callq 0x22f0
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
xorl %eax, %eax
movq %rax, -0x8(%r12)
movb $0x0, (%r12)
movq %rax, 0x10(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movsbl %bpl, %ebp
leaq 0x8(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
movl %ebp, %edx
callq 0x2380
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x2bfb
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3df0
jmp 0x2bd3
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x2c12
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21e0
movq 0x538f(%rip), %rsi      # 0x7fa8
leaq 0x28(%rsp), %rdi
callq 0x2150
leaq 0xa8(%rsp), %rdi
callq 0x2070
movq %rbx, %rax
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x2a96
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x2c65
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21e0
movq 0x533c(%rip), %rsi      # 0x7fa8
leaq 0x28(%rsp), %rdi
callq 0x2150
leaq 0xa8(%rsp), %rdi
callq 0x2070
movq %r14, %rdi
callq 0x2360
// File: /workspace/github_cpp_makefile_star2_O1/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 %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movb %dil, 0x7(%rsp)
cmpb $0x2e, %dil
jne 0x2cdb
movq 0x532c(%rip), %rdi      # 0x7fd0
leaq 0x2415(%rip), %rsi      # 0x50c0
movl $0x10, %edx
callq 0x2210
movq 0x5324(%rip), %r14      # 0x7fe0
leaq 0x7(%rsp), %rsi
movq %r14, %rdi
callq 0x2270
movl $0x7fff, %esi           # imm = 0x7FFF
movq %r14, %rdi
movl $0xa, %edx
callq 0x2120
movzbl 0x7(%rsp), %esi
movl $0x200, %edx            # imm = 0x200
movq %rbx, %rdi
callq 0x20f0
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x210, %rsp            # imm = 0x210
movq %rdi, %rbx
leaq -0x228(%rbp), %r14
movq %r14, %rdi
callq 0x2330
movq %r14, %rdi
movq %rbx, %rsi
movl $0x14, %edx
callq 0x20b0
leaq -0x228(%rbp), %rdi
callq 0x2290
movq %rsp, %r12
movl 0x20(%rbx), %eax
movq %rsp, %r14
addq $0xf, %rax
andq $-0x10, %rax
subq %rax, %r14
movq %r14, %rsp
movl $0x0, -0x24(%rbp)
movslq 0x20(%rbx), %rax
testq %rax, %rax
jle 0x4572
xorl %ecx, %ecx
movl %ecx, %edx
andl $0x3, %edx
movb -0x24(%rbp,%rdx), %dl
movb %dl, (%r14,%rcx)
incq %rcx
cmpq %rcx, %rax
jne 0x455d
movl 0x2c(%rbx), %esi
testl %esi, %esi
jle 0x4595
xorl %r15d, %r15d
movq %rbx, %rdi
movl %r15d, %esi
movq %r14, %rdx
callq 0x4624
incl %r15d
movl 0x2c(%rbx), %esi
cmpl %esi, %r15d
jl 0x457c
movl $0x1, %r14d
movl 0x30(%rbx), %eax
movl 0x2c(%rbx), %ecx
addl %eax, %ecx
cmpl %ecx, %esi
jge 0x45c3
decl %eax
leal 0x1(%rsi), %r15d
cmpl %eax, %esi
movl %r15d, %edx
cmovel %r14d, %edx
movq %rbx, %rdi
callq 0x4840
movl %r15d, %esi
jmp 0x459b
movq %r12, %rsp
movq 0x39f3(%rip), %rax      # 0x7fc0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq -0x220(%rbp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, -0x228(%rbp,%rcx)
callq 0x2180
leaq -0x130(%rbp), %rdi
callq 0x2070
leaq -0x20(%rbp), %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x460d
jmp 0x460d
movq %rax, %rbx
leaq -0x228(%rbp), %rdi
callq 0x22c0
movq %rbx, %rdi
callq 0x2360
// File: /workspace/github_cpp_makefile_star2_O1/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 %r15
pushq %r14
pushq %rbx
subq $0x200, %rsp            # imm = 0x200
movq %rdx, %rbx
movq %rdi, %r14
movq %rsp, %r15
movq %r15, %rdi
callq 0x2330
movq %r15, %rdi
movq %r14, %rsi
movl $0x1c, %edx
callq 0x20b0
movq %rsp, %rdi
movq $-0x1, %rsi
xorl %edx, %edx
callq 0x2220
movslq 0x20(%r14), %rdx
movq %rsp, %rdi
movq %rbx, %rsi
callq 0x2260
movq %rsp, %rdi
callq 0x2290
movq 0x3940(%rip), %rax      # 0x7fc0
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x8(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, (%rsp,%rcx)
callq 0x2180
leaq 0xf8(%rsp), %rdi
callq 0x2070
xorl %eax, %eax
addq $0x200, %rsp            # imm = 0x200
popq %rbx
popq %r14
popq %r15
retq
jmp 0x46bb
movq %rax, %rbx
movq %rsp, %rdi
callq 0x22c0
movq %rbx, %rdi
callq 0x2360
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 %r15
pushq %r14
pushq %rbx
subq $0x210, %rsp            # imm = 0x210
movq %rdx, %rbx
movq %rdi, %r14
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x2200
movq %r15, %rdi
movq %r14, %rsi
movl $0xc, %edx
callq 0x2190
leaq 0x8(%rsp), %rdi
movq $-0x1, %rsi
xorl %edx, %edx
callq 0x2240
movslq 0x20(%r14), %rdx
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x2230
leaq 0x8(%rsp), %rdi
callq 0x2040
leaq 0x8(%rsp), %rdi
callq 0x2050
xorl %eax, %eax
addq $0x210, %rsp            # imm = 0x210
popq %rbx
popq %r14
popq %r15
retq
jmp 0x4748
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x2050
movq %rbx, %rdi
callq 0x2360
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
cmpl %esi, 0x2c(%rdi)
jle 0x47c1
cmpl %esi, 0x28(%rdi)
jle 0x480a
movq 0x3851(%rip), %rbx      # 0x7fd0
leaq 0xb8e(%rip), %rsi       # 0x5314
movl $0x1a, %edx
movq %rbx, %rdi
callq 0x2210
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2130
movl $0x2, %eax
jmp 0x4834
movq 0x3808(%rip), %rbx      # 0x7fd0
leaq 0xb27(%rip), %rsi       # 0x52f6
movl $0x1d, %edx
movq %rbx, %rdi
callq 0x2210
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2130
movl $0x3, %eax
jmp 0x4834
movq %rsp, %rbx
movl 0x20(%rdi), %r14d
movq %rsp, %r15
addq $0xf, %r14
andq $-0x10, %r14
movq %r15, %rdx
subq %r14, %rdx
movq %rdx, %rsp
negq %r14
callq 0x46d0
movl (%r15,%r14), %eax
movq %rbx, %rsp
leaq -0x18(%rbp), %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpl %esi, 0x2c(%rdi)
jle 0x4870
movq %rdi, %rbx
cmpl %esi, 0x28(%rdi)
jle 0x48b9
movq 0x376e(%rip), %rbx      # 0x7fd0
leaq 0xaab(%rip), %rsi       # 0x5314
movl $0x1a, %edx
jmp 0x4883
movq 0x3759(%rip), %rbx      # 0x7fd0
leaq 0xa78(%rip), %rsi       # 0x52f6
movl $0x1d, %edx
movq %rbx, %rdi
callq 0x2210
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2130
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x48fb
movl %edx, %r14d
movq %rsp, -0x30(%rbp)
movl 0x20(%rbx), %r13d
movq %rsp, %r12
addq $0xf, %r13
andq $-0x10, %r13
movq %r12, %r15
subq %r13, %r15
movq %r15, %rsp
negq %r13
movq %rbx, %rdi
movq %r15, %rdx
callq 0x46d0
movl %r14d, (%r12,%r13)
movq %rbx, %rdi
movq %r15, %rdx
callq 0x4624
xorl %eax, %eax
movq -0x30(%rbp), %rsp
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/sidvishnoi[P]filesystem-assignment/day3/findEmptySectors.cpp
// Function: FileSystem::findEmptySectors(int)
vector<int> FileSystem::findEmptySectors(int requiredNumber) {
    /*
    Objective: To get a list of sectors that are available to be written on
    Input Parameters:
        requiredNumber: Number of empty sectors required
    Return Value:
        list of available sectors
        if not enough available, return empty list
    */
    TypeCastInt cast;
    vector<int> availableSectors;
    int found = 0, sector = 0;
    int div = sectorSize_k/4;   // each sector contains status of this much sectors
    char buffer[sectorSize_k];
    while (found != requiredNumber && sector < reservedSectors_k) {
        readSector(sector, buffer);
        for (int s = 0; s < div; ++s) {
            for (int j = 0; j < 4; ++j) {
                cast.str[j] = buffer[4*s + j];
            }
            if (cast.num == FREE) {
                availableSectors.push_back(s + reservedSectors_k + sector*div);
                ++found;
            }
            if (found == requiredNumber) break;
        }
    ++sector;
    }

    // if still, found != requiredNumber, now try looking in DELETED sectors (DAY 4)
    // %% look in sectors marked deleted here

    if (found != requiredNumber) {
        // empty list if enough sectors are not available (failure)
        availableSectors.empty();
    }
    return availableSectors; // success
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movl 0x20(%rsi), %eax
leal 0x3(%rax), %r15d
testl %eax, %eax
cmovnsl %eax, %r15d
movq %rsp, %r12
movq %rax, -0x58(%rbp)
addq $0xf, %rax
andq $-0x10, %rax
subq %rax, %r12
movq %r12, %rsp
testl %edx, %edx
je 0x4a0e
movl %edx, %r14d
movq %rsi, %rbx
sarl $0x2, %r15d
movl %r15d, %eax
movq %rax, -0x50(%rbp)
movq $0x0, -0x38(%rbp)
xorl %r13d, %r13d
xorl %esi, %esi
movq %rdi, -0x30(%rbp)
movq %rbx, -0x48(%rbp)
cmpl 0x28(%rbx), %esi
jge 0x4a0e
movq %rbx, %rdi
movl %esi, -0x3c(%rbp)
movq %r12, %rdx
callq 0x46d0
cmpl $0x4, -0x58(%rbp)
jl 0x49ec
xorl %ebx, %ebx
cmpl $0x0, (%r12,%rbx,4)
jne 0x49df
movq -0x48(%rbp), %rax
movl 0x28(%rax), %eax
movq -0x38(%rbp), %rcx
addq %rbx, %rcx
addq %rcx, %rax
movl %eax, -0x40(%rbp)
movq -0x30(%rbp), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x49d3
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x49dc
leaq -0x40(%rbp), %rdx
callq 0x4a4a
incl %r13d
cmpl %r14d, %r13d
je 0x49ec
incq %rbx
cmpl %ebx, %r15d
jg 0x499e
movl -0x3c(%rbp), %esi
incl %esi
movq -0x38(%rbp), %rax
addq -0x50(%rbp), %rax
movq %rax, -0x38(%rbp)
cmpl %r14d, %r13d
movq -0x30(%rbp), %rdi
movq -0x48(%rbp), %rbx
jne 0x497f
movq %rdi, %rax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4a22
movq %rax, %r14
movq -0x30(%rbp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x4a41
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rsi
subq %rdi, %rsi
callq 0x21e0
movq %r14, %rdi
callq 0x2360
nop
// File: /workspace/github_cpp_makefile_star2_O1/sidvishnoi[P]filesystem-assignment/day3/alreadyExists.cpp
// Function: FileSystem::alreadyExists(char*, char)
vector<int> FileSystem::alreadyExists(char *name, char type) {
    /*
     Objective: To check whether a file/dir already exists in current working directory
     Input Parameters:
        name: dir/file name
        type: type (d = dir, f = file)
     Return value: vector<int>
        {-1,-1,0} if not found
        {sector_offset, byte_offset, 1} otherwise
     */
    TypeCastEntry cast;
    char buffer[sectorSize_k];
    int next = reservedSectors_k;
    for(int count = 0; count < sectorsForDir_k; ++count) {
        readSector(next, buffer);
        for (int i = 0; i < sectorSize_k/32; ++i) {
            for (int j = 0; j < 32; ++j) {
                cast.str[j] = buffer[32*i + j];
            }
            // %% check if file with same characteristics exists
            if (true /* %%  CONDITION */) {
                vector<int> offset = {next, 32*i, 1};
                return offset;
            }
        }
        next = getStatus(next);
    }
    vector<int> offset = {-1,-1,0};
    return offset;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movl 0x20(%rsi), %eax
movq %rsp, %r15
addq $0xf, %rax
andq $-0x10, %rax
subq %rax, %r15
movq %r15, %rsp
cmpl $0x0, 0x30(%rsi)
jle 0x4bec
movq %rsi, %r14
movl 0x28(%rsi), %r12d
xorl %r13d, %r13d
movq %r14, %rdi
movl %r12d, %esi
movq %r15, %rdx
callq 0x46d0
cmpl $0x20, 0x20(%r14)
jge 0x4c00
movq %r14, %rdi
movl %r12d, %esi
callq 0x4760
movl %eax, %r12d
incl %r13d
cmpl 0x30(%r14), %r13d
jl 0x4bc0
leaq -0x38(%rbp), %rsi
movq $-0x1, (%rsi)
movl $0x0, 0x8(%rsi)
jmp 0x4c15
leaq -0x38(%rbp), %rsi
movl %r12d, (%rsi)
movabsq $0x100000000, %rax      # imm = 0x100000000
movq %rax, 0x4(%rsi)
leaq -0x29(%rbp), %rcx
movl $0x3, %edx
movq %rbx, %rdi
callq 0x4c38
movq %rbx, %rax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/sidvishnoi[P]filesystem-assignment/day3/getEntryPosition.cpp
// Function: FileSystem::getEntryPosition()
vector<int> FileSystem::getEntryPosition() {
    /*
    Objective: return the offsets for free position for file/directory entry
    Input Parameters:
        None
    return:
        vector [sectorOffset, byteOffset] if space available
            else: [-1, -1]
    */
    char buffer[sectorSize_k];
    TypeCastEntry cast;

    // start looking from first non-reserved sector
    // (or current working directory)
    int current = reservedSectors_k;
    for (int s = 0; s < sectorsForDir_k; ++s) {
        readSector(current, buffer);
        for (int b = 0; b < sectorSize_k; b += 32) {
            for (int k = 0; k < 32; ++k) {
                cast.str[k] = buffer[b+k];
            }
            if (strlen(cast.entry.name) == 0) {
                // found free space
                vector<int> offsets = {current, b};
                return offsets;
            }
        }
        // next sector to look in
        current = getStatus(current);
    }
    // no position found
    vector<int> offsets = {-1, -1};
    return offsets;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, -0x38(%rbp)
movl 0x20(%rsi), %eax
movq %rsp, %r15
addq $0xf, %rax
andq $-0x10, %rax
subq %rax, %r15
movq %r15, %rsp
cmpl $0x0, 0x30(%rsi)
jle 0x4dbc
movq %rsi, %r14
movl 0x28(%rsi), %r13d
xorl %r12d, %r12d
movq %r14, %rdi
movl %r13d, %esi
movq %r15, %rdx
callq 0x46d0
movl 0x20(%r14), %eax
testl %eax, %eax
setg %bl
jle 0x4da5
cmpb $0x0, 0x10(%r15)
je 0x4d82
xorl %edx, %edx
leal 0x20(%rdx), %ecx
cmpl %eax, %ecx
setl %bl
jge 0x4da5
leaq 0x20(%rdx), %rcx
cmpb $0x0, 0x30(%r15,%rdx)
movq %rcx, %rdx
jne 0x4d67
jmp 0x4d84
xorl %ecx, %ecx
movl %r13d, -0x40(%rbp)
movl %ecx, -0x3c(%rbp)
movl $0x2, %edx
movq -0x38(%rbp), %rdi
leaq -0x40(%rbp), %rsi
leaq -0x29(%rbp), %rcx
callq 0x4c38
testb %bl, %bl
jne 0x4dd9
movq %r14, %rdi
movl %r13d, %esi
callq 0x4760
movl %eax, %r13d
incl %r12d
cmpl 0x30(%r14), %r12d
jl 0x4d45
leaq -0x40(%rbp), %rsi
movq $-0x1, (%rsi)
leaq -0x29(%rbp), %rcx
movl $0x2, %edx
movq -0x38(%rbp), %rdi
callq 0x4c38
movq -0x38(%rbp), %rax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl 0x20(%rdi), %eax
movq %rsp, %r15
addq $0xf, %rax
andq $-0x10, %rax
subq %rax, %r15
movq %r15, %rsp
movq (%rsi), %rax
movl (%rax), %esi
movq %r15, %rdx
callq 0x46d0
movq (%rbx), %rax
movl (%rax), %esi
movq %r14, %rdi
movq %r15, %rdx
callq 0x4624
leaq -0x18(%rbp), %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/phillip-h[P]todo/src/args.cpp
// Function: listFiles(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
vector<string> listFiles(string dir)
{
    auto list = std::vector<std::string>();

    DIR *dp;
    struct dirent *dirp;
    if ((dp = opendir(dir.c_str())) == NULL){
        cout << ANSI_RED << "Could not find directory \"";
        cout << dir << "\" !\n";
        cout << ANSI_RESET;
    }

    while ((dirp = readdir(dp)) != NULL){
        if (dirp->d_name[0] != '.'){
            string name(dirp->d_name);
            if (name.size() > extension.size()){
                name = name.substr(0, name.size() - extension.size());
            }
            if (!name.empty()){
                list.push_back(name);
            }
        }
    }
    closedir(dp);
    
    return list;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %r15
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movq (%rsi), %rdi
callq 0x3400
movq %rax, %r14
testq %rax, %rax
jne 0x5acb
movq 0xa9ad(%rip), %rsi      # 0x10410
movq 0xa9ae(%rip), %rdx      # 0x10418
movq 0xa55f(%rip), %rdi      # 0xffd0
callq 0x3310
leaq 0x6647(%rip), %rsi      # 0xc0c4
movl $0x1a, %edx
movq %rax, %rdi
callq 0x3310
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq 0xa538(%rip), %rdi      # 0xffd0
callq 0x3310
leaq 0x663b(%rip), %rsi      # 0xc0df
movl $0x4, %edx
movq %rax, %rdi
callq 0x3310
movq 0xa938(%rip), %rsi      # 0x103f0
movq 0xa939(%rip), %rdx      # 0x103f8
movq 0xa50a(%rip), %rdi      # 0xffd0
callq 0x3310
leaq 0x18(%rsp), %rbp
leaq 0x8(%rsp), %r15
leaq 0x28(%rsp), %r12
movq %r14, %rdi
callq 0x3420
movq %rax, %r13
testq %rax, %rax
je 0x5b8a
cmpb $0x2e, 0x13(%r13)
je 0x5ada
addq $0x13, %r13
movq %rbp, 0x8(%rsp)
movq %r13, %rdi
callq 0x3170
leaq (%rax,%r13), %rdx
movq %r15, %rdi
movq %r13, %rsi
callq 0x5d4c
movq 0x10(%rsp), %rcx
subq 0xa897(%rip), %rcx      # 0x103b8
jbe 0x5b57
movq %r12, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x32c0
movq %r15, %rdi
movq %r12, %rsi
callq 0x3360
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x5b57
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x32b0
cmpq $0x0, 0x10(%rsp)
je 0x5b6a
movq %rbx, %rdi
movq %r15, %rsi
callq 0x5c18
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x5ada
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x32b0
jmp 0x5ada
movq %r14, %rdi
callq 0x3490
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5bc6
jmp 0x5ba8
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x5bc9
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x32b0
jmp 0x5bc9
jmp 0x5bc6
movq %rax, %r14
movq %rbx, %rdi
callq 0x5c56
movq %r14, %rdi
callq 0x3500
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 %r14
pushq %rbx
pushq %rax
cmpq $0x0, 0x9b31(%rip)      # 0x10570
je 0x6a80
movq %rdi, %rbx
movq (%rdi), %r14
testq %r14, %r14
je 0x6a61
movq %r14, %rdi
callq 0x8f3e
movl $0x28, %esi
movq %r14, %rdi
callq 0x32b0
movl $0x28, %edi
callq 0x32a0
movq %rax, %r14
movq 0x9afb(%rip), %rsi      # 0x10570
movq %rax, %rdi
callq 0x8eb4
movq %r14, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
movl $0x28, %esi
movq %r14, %rdi
callq 0x32b0
movq %rbx, %rdi
callq 0x3500
// File: /workspace/github_cpp_makefile_star2_O1/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 %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
movq 0x9651(%rip), %rdi      # 0x10660
callq 0xb71e
movq 0x9645(%rip), %rdi      # 0x10660
xorl %esi, %esi
callq 0xb87c
movq 0x9637(%rip), %rdi      # 0x10660
movl $0x1, %esi
xorl %edx, %edx
callq 0xb8ce
movq 0x9624(%rip), %r14      # 0x10660
movq %rsp, %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x83e9
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xb8bc
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7074
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x32b0
movq 0x95e5(%rip), %rdi      # 0x10660
movl $0x1, %esi
xorl %edx, %edx
callq 0xb8e2
movq 0x95d2(%rip), %rdi      # 0x10660
xorl %esi, %esi
callq 0xb88e
movq 0x95c4(%rip), %rdi      # 0x10660
movl $0x4, %esi
movl $0x1, %edx
callq 0xb8ce
movq 0x95ae(%rip), %rdi      # 0x10660
callq 0xb734
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x70df
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x32b0
movq %rbx, %rdi
callq 0x3500
// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movl 0x34(%rsp), %eax
movl 0x38(%rsp), %ecx
leaq 0x4(%rsp), %rsi
movl %eax, (%rsi)
movq %rsp, %rdx
movl %ecx, (%rdx)
movq 0x8361(%rip), %rdi      # 0x10668
callq 0xb8f6
testb %al, %al
je 0x834a
movl 0x838a(%rip), %eax      # 0x106a0
movl (%rsp), %ecx
leal (%rax,%rcx), %r15d
decl %r15d
movq %rbx, %rdi
callq 0x95f2
cmpl %eax, %r15d
jae 0x834a
testb %bpl, %bpl
je 0x8347
movq %rbx, %rdi
movl %r15d, %esi
callq 0x9608
movq %rax, %rdi
callq 0x8924
jmp 0x834a
movl %r15d, (%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %esi, %ebx
movq %rdi, %r14
movl $0x3, %ebp
leaq 0x38(%rsp), %r13
leaq 0x3d90(%rip), %r15      # 0xc488
leaq 0x28(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x6aa0
movq %r14, %rdi
movq %r12, %rsi
callq 0x3360
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0x872d
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x32b0
decl %ebp
jne 0x86fd
jmp 0x8749
movq 0x7ec6(%rip), %rsi      # 0x10600
movq 0x7ec7(%rip), %rdx      # 0x10608
movq %r14, %rdi
callq 0x3100
movq 0x8(%r14), %rdx
movl 0x7f35(%rip), %eax      # 0x10688
addl $-0x3, %eax
cmpl %edx, %eax
jg 0x8733
movq 0x7f07(%rip), %r15      # 0x10668
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%r14), %rsi
addq %rsi, %rdx
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x5cbc
movq %r15, %rdi
movq %r14, %rsi
movl $0x1, %edx
movl %ebx, %ecx
callq 0xb8bc
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x87a7
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x32b0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x87d0
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x32b0
movq %rbx, %rdi
callq 0x3500
// File: /workspace/github_cpp_makefile_star2_O1/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 %rbx
movq 0x7e80(%rip), %rbx      # 0x10660
testq %rbx, %rbx
je 0x87fa
movq %rbx, %rdi
callq 0xb6de
movl $0x40, %esi
movq %rbx, %rdi
callq 0x32b0
movq 0x7e67(%rip), %rbx      # 0x10668
testq %rbx, %rbx
je 0x881b
movq %rbx, %rdi
callq 0xb6de
movl $0x40, %esi
movq %rbx, %rdi
callq 0x32b0
movq 0x7e4e(%rip), %rbx      # 0x10670
testq %rbx, %rbx
je 0x883c
movq %rbx, %rdi
callq 0xb6de
movl $0x40, %esi
movq %rbx, %rdi
callq 0x32b0
movq 0x7e35(%rip), %rbx      # 0x10678
testq %rbx, %rbx
je 0x885d
movq %rbx, %rdi
callq 0xb6de
movl $0x40, %esi
movq %rbx, %rdi
callq 0x32b0
callq 0x3340
movl $0x1, %edi
popq %rbx
jmp 0x3240
// File: /workspace/github_cpp_makefile_star2_O1/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 %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x10(%rdi), %r15
movq %r15, (%rdi)
leaq 0x3b49(%rip), %rdx      # 0xc490
movq %rdx, %rsi
callq 0x5d4c
leaq 0x7db2(%rip), %rax      # 0x10708
leaq 0x7d8b(%rip), %rcx      # 0x106e8
cmpb $0x0, 0x20(%r14)
cmovneq %rax, %rcx
movq (%rcx), %rsi
leaq 0x7da0(%rip), %rax      # 0x10710
leaq 0x7d79(%rip), %rcx      # 0x106f0
cmovneq %rax, %rcx
movq (%rcx), %rdx
movq %rbx, %rdi
callq 0x3100
leaq 0x3b4c(%rip), %rsi      # 0xc4d9
movq %rsp, %rdi
movq %r14, %rdx
callq 0x6aa0
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0x3100
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x89c4
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x32b0
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %r14
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x89f6
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x32b0
jmp 0x89f6
jmp 0x89f3
movq %rax, %r14
movq (%rbx), %rdi
cmpq %r15, %rdi
je 0x8a09
movq (%r15), %rsi
incq %rsi
callq 0x32b0
movq %r14, %rdi
callq 0x3500
nop
// File: /workspace/github_cpp_makefile_star2_O1/phillip-h[P]todo/src/task.cpp
// Function: Task::save[abi:cxx11]()
string Task::save()
{
    string value = "";
    
    value += name;
    value += ":";
    
    value += std::to_string(complete);
    
    return value;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x10(%rdi), %r15
movq %r15, (%rdi)
leaq 0x3a5e(%rip), %rdx      # 0xc490
movq %rdx, %rsi
callq 0x5d4c
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %rbx, %rdi
callq 0x3100
leaq 0x3bb9(%rip), %rsi      # 0xc609
movq %rbx, %rdi
callq 0x3560
movzbl 0x20(%r14), %ebp
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
movq %rsp, %rdi
movl $0x1, %esi
movl $0x2d, %edx
callq 0x3330
movq (%rsp), %rdi
movl $0x1, %esi
movl %ebp, %edx
callq 0x886d
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0x3100
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x8ab0
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x32b0
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x8ae0
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x32b0
jmp 0x8ae0
jmp 0x8add
movq %rax, %r14
movq (%rbx), %rdi
cmpq %r15, %rdi
je 0x8af3
movq (%r15), %rsi
incq %rsi
callq 0x32b0
movq %r14, %rdi
callq 0x3500
nop