// File: /workspace/github_cpp_makefile_star2_O3/hyp1231[P]FMSS/generate_disk.cpp
// Function: main
int main() {
    ofstream ofile("./diskdata");				// create a new file

    // super block
    short basic_size = 1024;					// basic size of a block
    ofile.write((char*)&basic_size, sizeof(basic_size));

    char tmp = 0;

    // inode number of '/'
    ofile.write((char*)&tmp, sizeof(tmp));

    // inode bitmap[0] = 1
    tmp = 1;
    ofile.write((char*)&tmp, sizeof(tmp));
    tmp = 0;
    for(int i = 0; i < 9; ++i) {
    	ofile.write((char*)&tmp, sizeof(tmp));
    }

    // data block bitmap[0] = 1
    tmp = 1;
    ofile.write((char*)&tmp, sizeof(tmp));
    tmp = 0;

    // rest of super block
    for(int i = 0; i < 1024 - 2 - 1 - 10 - 1; ++i) {
	    ofile.write((char*)&tmp, sizeof(tmp));	// fill the file with '\0'
	}

	// first inode
	short num = 1;
	ofile.write((char*)&num, sizeof(num));
	tmp = '/';
	ofile.write((char*)&tmp, sizeof(tmp));
	tmp = 0;
	for(int i = 0; i < 7; ++i) {
		ofile.write((char*)&tmp, sizeof(tmp));
	}
	
	// rest of inode table
	for(int i = 0; i < 5 * 1024 - 10; ++i) {
		ofile.write((char*)&tmp, sizeof(tmp));
	}

	// first data block
	tmp = '.';
	ofile.write((char*)&tmp, sizeof(tmp));
	tmp = 0;
	for(int i = 0; i < 7; ++i) {
		ofile.write((char*)&tmp, sizeof(tmp));
	}

	ofile.write((char*)&num, sizeof(num));

	for(int i = 0; i < 2; ++i) {
		ofile.write((char*)&tmp, sizeof(tmp));
	}
	tmp = '.';
	for(int i = 0; i < 2; ++i) {
		ofile.write((char*)&tmp, sizeof(tmp));
	}
	tmp = 0;
	for(int i = 0; i < 6; ++i) {
		ofile.write((char*)&tmp, sizeof(tmp));
	}

	ofile.write((char*)&num, sizeof(num));

	// rest of data block
	for(int i = 0; i < 1024 - 12 - 10 + (1024 - 7) * 1024; ++i) {
		ofile.write((char*)&tmp, sizeof(tmp));
	}

	ofile.close();

    return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x210, %rsp            # imm = 0x210
leaq 0xe06(%rip), %rsi       # 0x2004
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
movl $0x10, %edx
callq 0x1060
leaq 0xe(%rsp), %rsi
movw $0x400, (%rsi)          # imm = 0x400
movl $0x2, %edx
movq %rbx, %rdi
callq 0x1070
leaq 0xb(%rsp), %rsi
movb $0x0, (%rsi)
leaq 0x10(%rsp), %rdi
movl $0x1, %edx
callq 0x1070
leaq 0xb(%rsp), %rsi
movb $0x1, (%rsi)
leaq 0x10(%rsp), %rdi
movl $0x1, %edx
callq 0x1070
leaq 0xb(%rsp), %rbx
movb $0x0, (%rbx)
movl $0x9, %ebp
leaq 0x10(%rsp), %r14
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1070
decl %ebp
jne 0x1267
leaq 0xb(%rsp), %rsi
movb $0x1, (%rsi)
leaq 0x10(%rsp), %rdi
movl $0x1, %edx
callq 0x1070
leaq 0xb(%rsp), %rbx
movb $0x0, (%rbx)
movl $0x3f2, %ebp            # imm = 0x3F2
leaq 0x10(%rsp), %r14
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1070
decl %ebp
jne 0x12a4
leaq 0xc(%rsp), %rsi
movw $0x1, (%rsi)
leaq 0x10(%rsp), %rdi
movl $0x2, %edx
callq 0x1070
leaq 0xb(%rsp), %rsi
movb $0x2f, (%rsi)
leaq 0x10(%rsp), %rdi
movl $0x1, %edx
callq 0x1070
leaq 0xb(%rsp), %rbx
movb $0x0, (%rbx)
movl $0x7, %ebp
leaq 0x10(%rsp), %r14
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1070
decl %ebp
jne 0x12fa
movl $0x13f6, %ebp           # imm = 0x13F6
leaq 0x10(%rsp), %rbx
leaq 0xb(%rsp), %r14
movl $0x1, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1070
decl %ebp
jne 0x131d
leaq 0xb(%rsp), %rsi
movb $0x2e, (%rsi)
leaq 0x10(%rsp), %rdi
movl $0x1, %edx
callq 0x1070
leaq 0xb(%rsp), %rbx
movb $0x0, (%rbx)
movl $0x7, %ebp
leaq 0x10(%rsp), %r14
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1070
decl %ebp
jne 0x135a
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rsi
movl $0x2, %edx
callq 0x1070
movb $0x1, %bpl
leaq 0x10(%rsp), %rbx
leaq 0xb(%rsp), %r14
movl $0x1, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1070
testb $0x1, %bpl
movl $0x0, %ebp
jne 0x138f
leaq 0xb(%rsp), %rbx
movb $0x2e, (%rbx)
movb $0x1, %bpl
leaq 0x10(%rsp), %r14
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1070
testb $0x1, %bpl
movl $0x0, %ebp
jne 0x13ba
leaq 0xb(%rsp), %rbx
movb $0x0, (%rbx)
movl $0x6, %ebp
leaq 0x10(%rsp), %r14
movl $0x1, %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1070
decl %ebp
jne 0x13e7
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rsi
movl $0x2, %edx
callq 0x1070
movl $0xfe7ea, %ebp          # imm = 0xFE7EA
leaq 0x10(%rsp), %rbx
leaq 0xb(%rsp), %r14
movl $0x1, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1070
decl %ebp
jne 0x141e
leaq 0x10(%rsp), %rdi
callq 0x1080
movq 0x2b95(%rip), %rax      # 0x3fd8
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x18(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x10(%rsp,%rcx)
callq 0x1040
leaq 0x108(%rsp), %rdi
callq 0x1030
xorl %eax, %eax
addq $0x210, %rsp            # imm = 0x210
popq %rbx
popq %r14
popq %rbp
retq
jmp 0x1492
jmp 0x1492
jmp 0x1492
jmp 0x1492
jmp 0x1492
jmp 0x1492
jmp 0x1492
jmp 0x1492
jmp 0x1492
jmp 0x1492
jmp 0x1492
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x1090
movq %rbx, %rdi
callq 0x10b0