// File: /workspace/github_cpp_makefile_star2_O3/hyp1231[P]FMSS/filesystem.cpp
// Function: FileSystem::Get_file_inodeNum_from_dir(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, bool)
int FileSystem::Get_file_inodeNum_from_dir(int dir_inodeNum, const string& filename, bool isDelete) {
	char inode_buf[64], buf[BLKsize];
	
	if(!Get_inode_from_inodeNum(inode_buf, dir_inodeNum)) {
		cout << "[Error] Cannot get inode: " << dir_inodeNum << endl;
		return -1;
	}

	// if inode doesn't point to a directory
	if(byte2int(inode_buf, 0, 2) == 0) {
		cout << "[Error] Inode " << dir_inodeNum << " is not a dir" << endl;
		return -1;
	}

	// get the directory data block
	D.Getblk(buf, Get_actual_dataBLKnumber(byte2int(inode_buf, 42, 44)));

	for(int i = 0; i + 12 <= BLKsize; i += 12) {
		// check if filename EQU
		if(byteEQUstring(buf, i, i + (int)filename.size(), filename)) {
			// check if is used
			if(byte2int(buf, i + 8, i + 10) == 1) {
				// return inodeNum
                if (isDelete) {
                    Fill_byte_by_num(buf, i + 8, i + 10, 0);
                    D.Putblk(buf, Get_actual_dataBLKnumber(byte2int(inode_buf, 42, 44)));
                }
				return byte2int(buf, i + 10, i + 12);
			}
		}
	}

	// not found
	return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movl %ecx, -0x38(%rbp)
movq %rdx, -0x50(%rbp)
movl %esi, %ebx
movq %rdi, %r13
movq %rsp, %r15
movl (%rdi), %eax
movq %rsp, %r14
addq $0xf, %rax
andq $-0x10, %rax
subq %rax, %r14
movq %r14, %rsp
leaq -0xb0(%rbp), %r12
movq %r12, %rsi
movl %ebx, %edx
callq 0x3d48
movsbl (%r12), %eax
movsbl 0x1(%r12), %ecx
shll $0x8, %ecx
addl %eax, %ecx
jne 0x369d
movq 0x9994(%rip), %r14      # 0xcfd0
leaq 0x5e92(%rip), %rsi      # 0x94d5
movl $0xe, %edx
movq %r14, %rdi
callq 0x2240
movq %r14, %rdi
movl %ebx, %esi
callq 0x2330
movq %rax, %rbx
leaq 0x5e80(%rip), %rsi      # 0x94e4
movl $0xd, %edx
movq %rax, %rdi
callq 0x2240
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21e0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2120
jmp 0x3783
movsbl -0x86(%rbp), %eax
movsbl -0x85(%rbp), %ecx
shll $0x8, %ecx
leaq 0x8(%r13), %rbx
leal (%rcx,%rax), %r12d
addl $0x6, %r12d
movq %rbx, %rdi
movq %r14, %rsi
movl %r12d, %edx
callq 0x26e0
movl (%r13), %r11d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl $0xc, %r11d
jl 0x3788
movq %r13, %r10
movl %r12d, -0x34(%rbp)
movq %rbx, -0x60(%rbp)
movq %r15, -0x48(%rbp)
movl $0xc, %r8d
movq %r14, %r12
xorl %r14d, %r14d
movl $0x8, %r13d
movl $0x2, %ebx
movq %r12, -0x30(%rbp)
xorl %r15d, %r15d
movq -0x50(%rbp), %r9
movq %r10, -0x68(%rbp)
movq 0x8(%r9), %rcx
movslq %ecx, %rdx
cmpq %rcx, %rdx
jne 0x3764
testq %rcx, %rcx
je 0x3738
movq (%r9), %rdx
xorl %esi, %esi
movb (%rdx,%rsi), %dil
cmpb (%r12,%rsi), %dil
jne 0x3764
incq %rsi
cmpq %rsi, %rcx
jne 0x3726
movq %r8, -0x58(%rbp)
leal 0x8(%r15), %esi
leal 0xa(%r15), %edx
movq -0x30(%rbp), %rdi
movl %edx, -0x3c(%rbp)
callq 0x2a36
cmpl $0x1, %eax
je 0x379a
movq -0x68(%rbp), %r10
movl (%r10), %r11d
movq -0x58(%rbp), %r8
movq -0x50(%rbp), %r9
addq $0xc, %r8
addq $0xc, %r15
incl %r14d
addl $0xc, %r13d
addl $0x3, %ebx
addq $0xc, %r12
cmpl %r8d, %r11d
jge 0x3710
movq -0x48(%rbp), %r15
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %r15, %rsp
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpb $0x0, -0x38(%rbp)
movl -0x3c(%rbp), %r12d
je 0x3d2f
addl $0x8, %r15d
notl %r15d
leal (%r14,%r14,2), %eax
leal 0xa(,%rax,4), %eax
movabsq $-0xfffffffd, %rcx      # imm = 0xFFFFFFFF00000003
orq %r15, %rcx
addq %rax, %rcx
movq %rcx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
movl %r13d, %eax
shll $0x2, %ebx
subq %rbx, %rax
addq $0x11, %rax
andq $-0x10, %rax
movq -0x30(%rbp), %r8
leaq (%r8,%rbx), %rcx
addq $0xf, %rcx
xorl %r9d, %r9d
movdqa 0x58a4(%rip), %xmm3     # 0x90a0
movdqa 0x58ac(%rip), %xmm4     # 0x90b0
movdqa 0x58b4(%rip), %xmm5     # 0x90c0
movdqa 0x58bc(%rip), %xmm6     # 0x90d0
movdqa 0x58c4(%rip), %xmm7     # 0x90e0
movdqa 0x58cb(%rip), %xmm8     # 0x90f0
movdqa 0x58d2(%rip), %xmm9     # 0x9100
pcmpeqd %xmm10, %xmm10
movq -0x60(%rbp), %rdi
movl -0x34(%rbp), %edx
movq %r9, %xmm11
pshufd $0x44, %xmm11, %xmm11   # xmm11 = xmm11[0,1,0,1]
movdqa %xmm11, %xmm13
por %xmm8, %xmm13
movdqa %xmm0, %xmm12
pxor %xmm9, %xmm12
pxor %xmm9, %xmm13
movdqa %xmm13, %xmm15
pcmpgtd %xmm12, %xmm15
pshufd $0xa0, %xmm15, %xmm14   # xmm14 = xmm15[0,0,2,2]
pshuflw $0xe8, %xmm14, %xmm1    # xmm1 = xmm14[0,2,2,3,4,5,6,7]
pcmpeqd %xmm12, %xmm13
pshufd $0xf5, %xmm13, %xmm13   # xmm13 = xmm13[1,1,3,3]
pshuflw $0xe8, %xmm13, %xmm2    # xmm2 = xmm13[0,2,2,3,4,5,6,7]
pand %xmm1, %xmm2
pshufd $0xf5, %xmm15, %xmm15   # xmm15 = xmm15[1,1,3,3]
pshuflw $0xe8, %xmm15, %xmm1    # xmm1 = xmm15[0,2,2,3,4,5,6,7]
por %xmm2, %xmm1
pxor %xmm10, %xmm1
packssdw %xmm1, %xmm1
movd %xmm1, %esi
testb $0x1, %sil
je 0x38b2
movb $0x0, -0xf(%rcx,%r9)
pand %xmm14, %xmm13
por %xmm15, %xmm13
packssdw %xmm13, %xmm13
pxor %xmm10, %xmm13
packssdw %xmm13, %xmm13
packsswb %xmm13, %xmm13
movd %xmm13, %esi
shrl $0x8, %esi
testb $0x1, %sil
je 0x38e4
movb $0x0, -0xe(%rcx,%r9)
movdqa %xmm11, %xmm1
por %xmm7, %xmm1
pxor %xmm9, %xmm1
movdqa %xmm1, %xmm2
pcmpgtd %xmm12, %xmm2
pshufd $0xa0, %xmm2, %xmm13    # xmm13 = xmm2[0,0,2,2]
pcmpeqd %xmm12, %xmm1
pshufd $0xf5, %xmm1, %xmm14    # xmm14 = xmm1[1,1,3,3]
movdqa %xmm14, %xmm1
pand %xmm13, %xmm1
pshufd $0xf5, %xmm2, %xmm15    # xmm15 = xmm2[1,1,3,3]
por %xmm15, %xmm1
packssdw %xmm1, %xmm1
pxor %xmm10, %xmm1
packssdw %xmm1, %xmm1
packsswb %xmm1, %xmm1
movd %xmm1, %esi
shrl $0x10, %esi
testb $0x1, %sil
je 0x3945
movb $0x0, -0xd(%rcx,%r9)
pshufhw $0x84, %xmm13, %xmm1    # xmm1 = xmm13[0,1,2,3,4,5,4,6]
pshufhw $0x84, %xmm14, %xmm2    # xmm2 = xmm14[0,1,2,3,4,5,4,6]
pand %xmm1, %xmm2
pshufhw $0x84, %xmm15, %xmm1    # xmm1 = xmm15[0,1,2,3,4,5,4,6]
por %xmm2, %xmm1
pxor %xmm10, %xmm1
packssdw %xmm1, %xmm1
packsswb %xmm1, %xmm1
movd %xmm1, %esi
shrl $0x18, %esi
testb $0x1, %sil
je 0x397f
movb $0x0, -0xc(%rcx,%r9)
movdqa %xmm11, %xmm1
por %xmm6, %xmm1
pxor %xmm9, %xmm1
movdqa %xmm1, %xmm2
pcmpgtd %xmm12, %xmm2
pshufd $0xa0, %xmm2, %xmm14    # xmm14 = xmm2[0,0,2,2]
pshuflw $0xe8, %xmm14, %xmm15   # xmm15 = xmm14[0,2,2,3,4,5,6,7]
pcmpeqd %xmm12, %xmm1
pshufd $0xf5, %xmm1, %xmm13    # xmm13 = xmm1[1,1,3,3]
pshuflw $0xe8, %xmm13, %xmm1    # xmm1 = xmm13[0,2,2,3,4,5,6,7]
pand %xmm15, %xmm1
pshufd $0xf5, %xmm2, %xmm15    # xmm15 = xmm2[1,1,3,3]
pshuflw $0xe8, %xmm15, %xmm2    # xmm2 = xmm15[0,2,2,3,4,5,6,7]
por %xmm1, %xmm2
pxor %xmm10, %xmm2
packssdw %xmm2, %xmm1
packsswb %xmm1, %xmm1
pextrw $0x2, %xmm1, %esi
testb $0x1, %sil
je 0x39e6
movb $0x0, -0xb(%rcx,%r9)
pand %xmm14, %xmm13
por %xmm15, %xmm13
packssdw %xmm13, %xmm13
pxor %xmm10, %xmm13
packssdw %xmm13, %xmm1
packsswb %xmm1, %xmm1
pextrw $0x2, %xmm1, %esi
shrl $0x8, %esi
testb $0x1, %sil
je 0x3a17
movb $0x0, -0xa(%rcx,%r9)
movdqa %xmm11, %xmm1
por %xmm5, %xmm1
pxor %xmm9, %xmm1
movdqa %xmm1, %xmm2
pcmpgtd %xmm12, %xmm2
pshufd $0xa0, %xmm2, %xmm13    # xmm13 = xmm2[0,0,2,2]
pcmpeqd %xmm12, %xmm1
pshufd $0xf5, %xmm1, %xmm14    # xmm14 = xmm1[1,1,3,3]
movdqa %xmm14, %xmm1
pand %xmm13, %xmm1
pshufd $0xf5, %xmm2, %xmm15    # xmm15 = xmm2[1,1,3,3]
por %xmm15, %xmm1
packssdw %xmm1, %xmm1
pxor %xmm10, %xmm1
packssdw %xmm1, %xmm1
packsswb %xmm1, %xmm1
pextrw $0x3, %xmm1, %esi
testb $0x1, %sil
je 0x3a76
movb $0x0, -0x9(%rcx,%r9)
pshufhw $0x84, %xmm13, %xmm1    # xmm1 = xmm13[0,1,2,3,4,5,4,6]
pshufhw $0x84, %xmm14, %xmm2    # xmm2 = xmm14[0,1,2,3,4,5,4,6]
pand %xmm1, %xmm2
pshufhw $0x84, %xmm15, %xmm1    # xmm1 = xmm15[0,1,2,3,4,5,4,6]
por %xmm2, %xmm1
pxor %xmm10, %xmm1
packssdw %xmm1, %xmm1
packsswb %xmm1, %xmm1
pextrw $0x3, %xmm1, %esi
shrl $0x8, %esi
testb $0x1, %sil
je 0x3ab1
movb $0x0, -0x8(%rcx,%r9)
movdqa %xmm11, %xmm1
por %xmm4, %xmm1
pxor %xmm9, %xmm1
movdqa %xmm1, %xmm2
pcmpgtd %xmm12, %xmm2
pshufd $0xa0, %xmm2, %xmm14    # xmm14 = xmm2[0,0,2,2]
pshuflw $0xe8, %xmm14, %xmm15   # xmm15 = xmm14[0,2,2,3,4,5,6,7]
pcmpeqd %xmm12, %xmm1
pshufd $0xf5, %xmm1, %xmm13    # xmm13 = xmm1[1,1,3,3]
pshuflw $0xe8, %xmm13, %xmm1    # xmm1 = xmm13[0,2,2,3,4,5,6,7]
pand %xmm15, %xmm1
pshufd $0xf5, %xmm2, %xmm15    # xmm15 = xmm2[1,1,3,3]
pshuflw $0xe8, %xmm15, %xmm2    # xmm2 = xmm15[0,2,2,3,4,5,6,7]
por %xmm1, %xmm2
pxor %xmm10, %xmm2
packssdw %xmm2, %xmm2
packsswb %xmm2, %xmm1
pextrw $0x4, %xmm1, %esi
testb $0x1, %sil
je 0x3b18
movb $0x0, -0x7(%rcx,%r9)
pand %xmm14, %xmm13
por %xmm15, %xmm13
packssdw %xmm13, %xmm13
pxor %xmm10, %xmm13
packssdw %xmm13, %xmm13
packsswb %xmm13, %xmm1
pextrw $0x4, %xmm1, %esi
shrl $0x8, %esi
testb $0x1, %sil
je 0x3b4a
movb $0x0, -0x6(%rcx,%r9)
movdqa %xmm11, %xmm1
por %xmm3, %xmm1
pxor %xmm9, %xmm1
movdqa %xmm1, %xmm2
pcmpgtd %xmm12, %xmm2
pshufd $0xa0, %xmm2, %xmm13    # xmm13 = xmm2[0,0,2,2]
pcmpeqd %xmm12, %xmm1
pshufd $0xf5, %xmm1, %xmm14    # xmm14 = xmm1[1,1,3,3]
movdqa %xmm14, %xmm1
pand %xmm13, %xmm1
pshufd $0xf5, %xmm2, %xmm15    # xmm15 = xmm2[1,1,3,3]
por %xmm15, %xmm1
packssdw %xmm1, %xmm1
pxor %xmm10, %xmm1
packssdw %xmm1, %xmm1
packsswb %xmm1, %xmm1
pextrw $0x5, %xmm1, %esi
testb $0x1, %sil
je 0x3ba9
movb $0x0, -0x5(%rcx,%r9)
pshufhw $0x84, %xmm13, %xmm1    # xmm1 = xmm13[0,1,2,3,4,5,4,6]
pshufhw $0x84, %xmm14, %xmm2    # xmm2 = xmm14[0,1,2,3,4,5,4,6]
pand %xmm1, %xmm2
pshufhw $0x84, %xmm15, %xmm1    # xmm1 = xmm15[0,1,2,3,4,5,4,6]
por %xmm2, %xmm1
pxor %xmm10, %xmm1
packssdw %xmm1, %xmm1
packsswb %xmm1, %xmm1
pextrw $0x5, %xmm1, %esi
shrl $0x8, %esi
testb $0x1, %sil
je 0x3be4
movb $0x0, -0x4(%rcx,%r9)
movdqa %xmm11, %xmm1
por 0x549f(%rip), %xmm1     # 0x9090
pxor %xmm9, %xmm1
movdqa %xmm1, %xmm2
pcmpgtd %xmm12, %xmm2
pshufd $0xa0, %xmm2, %xmm14    # xmm14 = xmm2[0,0,2,2]
pshuflw $0xe8, %xmm14, %xmm15   # xmm15 = xmm14[0,2,2,3,4,5,6,7]
pcmpeqd %xmm12, %xmm1
pshufd $0xf5, %xmm1, %xmm13    # xmm13 = xmm1[1,1,3,3]
pshuflw $0xe8, %xmm13, %xmm1    # xmm1 = xmm13[0,2,2,3,4,5,6,7]
pand %xmm15, %xmm1
pshufd $0xf5, %xmm2, %xmm15    # xmm15 = xmm2[1,1,3,3]
pshuflw $0xe8, %xmm15, %xmm2    # xmm2 = xmm15[0,2,2,3,4,5,6,7]
por %xmm1, %xmm2
pxor %xmm10, %xmm2
packssdw %xmm2, %xmm1
packsswb %xmm1, %xmm1
pextrw $0x6, %xmm1, %esi
testb $0x1, %sil
je 0x3c4f
movb $0x0, -0x3(%rcx,%r9)
pand %xmm14, %xmm13
por %xmm15, %xmm13
packssdw %xmm13, %xmm13
pxor %xmm10, %xmm13
packssdw %xmm13, %xmm1
packsswb %xmm1, %xmm1
pextrw $0x6, %xmm1, %esi
shrl $0x8, %esi
testb $0x1, %sil
je 0x3c80
movb $0x0, -0x2(%rcx,%r9)
por 0x53f7(%rip), %xmm11    # 0x9080
pxor %xmm9, %xmm11
movdqa %xmm11, %xmm1
pcmpgtd %xmm12, %xmm1
pshufd $0xa0, %xmm1, %xmm13    # xmm13 = xmm1[0,0,2,2]
pcmpeqd %xmm12, %xmm11
pshufd $0xf5, %xmm11, %xmm11   # xmm11 = xmm11[1,1,3,3]
movdqa %xmm11, %xmm2
pand %xmm13, %xmm2
pshufd $0xf5, %xmm1, %xmm12    # xmm12 = xmm1[1,1,3,3]
por %xmm12, %xmm2
packssdw %xmm2, %xmm1
pxor %xmm10, %xmm1
packssdw %xmm1, %xmm1
packsswb %xmm1, %xmm1
pextrw $0x7, %xmm1, %esi
testb $0x1, %sil
je 0x3ce0
movb $0x0, -0x1(%rcx,%r9)
pshufhw $0x84, %xmm13, %xmm1    # xmm1 = xmm13[0,1,2,3,4,5,4,6]
pshufhw $0x84, %xmm11, %xmm2    # xmm2 = xmm11[0,1,2,3,4,5,4,6]
pand %xmm1, %xmm2
pshufhw $0x84, %xmm12, %xmm1    # xmm1 = xmm12[0,1,2,3,4,5,4,6]
por %xmm2, %xmm1
pxor %xmm10, %xmm1
packssdw %xmm1, %xmm1
packsswb %xmm1, %xmm1
pextrw $0x7, %xmm1, %esi
shrl $0x8, %esi
testb $0x1, %sil
je 0x3d1a
movb $0x0, (%rcx,%r9)
addq $0x10, %r9
cmpq %r9, %rax
jne 0x383a
movq %r8, %rsi
callq 0x27e6
movq -0x30(%rbp), %rdi
movl %r12d, %esi
movq -0x58(%rbp), %rdx
callq 0x2a36
movq -0x48(%rbp), %r15
jmp 0x3788