LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/tstword[P]MIPSAssemblerC/src/tokenizer.c
// Function: report_fsm
void report_fsm(struct tokenizer *tokenizer, const char *fmt, ...) {
    va_list vargs;
    size_t bufsize = 0;

    va_start(vargs, fmt);
    bufsize = vsnprintf(NULL, 0, fmt, vargs) + 1;
    va_end(vargs);

    if(bufsize > tokenizer->errsize) {
        char *realloc_ptr = (char *)realloc(tokenizer->errmsg, bufsize);

        if(realloc_ptr == NULL) {
            perror("CRITICAL ERROR: Failed to allocated more memory for tokenizer error buffer: ");
            exit(EXIT_FAILURE);
        }

        tokenizer->errsize = bufsize;
        tokenizer->errmsg = realloc_ptr;
    }

    va_start(vargs, fmt);
    vsnprintf(tokenizer->errmsg, bufsize, fmt, vargs);
    va_end(vargs);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
testb %al, %al
je 0x828b
movaps %xmm0, -0xc0(%rbp)
movaps %xmm1, -0xb0(%rbp)
movaps %xmm2, -0xa0(%rbp)
movaps %xmm3, -0x90(%rbp)
movaps %xmm4, -0x80(%rbp)
movaps %xmm5, -0x70(%rbp)
movaps %xmm6, -0x60(%rbp)
movaps %xmm7, -0x50(%rbp)
movq %r9, -0xc8(%rbp)
movq %r8, -0xd0(%rbp)
movq %rcx, -0xd8(%rbp)
movq %rdx, -0xe0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x38(%rbp)
leaq -0x30(%rbp), %rax
leaq -0xf0(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x10(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl $0x30, 0x4(%rax)
movl $0x10, (%rax)
movq -0x10(%rbp), %rdx
leaq -0x30(%rbp), %rcx
xorl %eax, %eax
movl %eax, %esi
movq %rsi, %rdi
callq 0x3040
addl $0x1, %eax
cltq
movq %rax, -0x38(%rbp)
leaq -0x30(%rbp), %rax
movq -0x38(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x48(%rcx), %rax
jbe 0x8354
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x38(%rbp), %rsi
callq 0x3100
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x833c
leaq 0x3475(%rip), %rdi      # 0xb7a2
callq 0x3120
movl $0x1, %edi
callq 0x3140
movq -0x38(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x40(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x18(%rax)
leaq -0xf0(%rbp), %rax
movq %rax, -0x20(%rbp)
leaq 0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movl $0x30, -0x2c(%rbp)
movl $0x10, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x38(%rbp), %rsi
movq -0x10(%rbp), %rdx
leaq -0x30(%rbp), %rcx
callq 0x3040
addq $0xf0, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/tstword[P]MIPSAssemblerC/src/tokenizer.c
// Function: integer_fsm
state_fsm integer_fsm(struct tokenizer *tokenizer) {
    int ch = tgetc(tokenizer);

    switch(ch) {
        /* To comply with Microsoft's C++ compiler... */
        case '0': case '1': case '2': case '3':
        case '4': case '5': case '6': case '7':
        case '8': case '9':
            return integer_state;

        default:
            tungetc(ch, tokenizer);
            return integer_accept;
    }

    return invalid_state;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x8100
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
addl $-0x30, %eax
subl $0x9, %eax
ja 0x85ee
jmp 0x85e5
movl $0x7, -0x4(%rbp)
jmp 0x8601
movl -0x14(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x81c0
movl $0x8, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/tstword[P]MIPSAssemblerC/src/tokenizer.c
// Function: zero_fsm
state_fsm zero_fsm(struct tokenizer *tokenizer) {
    int ch = tgetc(tokenizer);

    switch(ch) {
        case 'x':
        case 'X':
            // Check if next character is digit
            if(isxdigit(tpeekc(tokenizer))) return hex_state;
            tungetc(ch, tokenizer);
            return integer_accept;

        /* To comply with Microsoft's C++ compiler... */
        case '0': case '1': case '2': case '3':
        case '4': case '5': case '6': case '7':
        case '8': case '9':
            return integer_state;

        default:
            tungetc(ch, tokenizer);
            return integer_accept;
    }

    return invalid_state;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x8100
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x18(%rbp)
addl $-0x30, %eax
subl $0xa, %eax
jb 0x8696
jmp 0x8638
movl -0x18(%rbp), %eax
subl $0x58, %eax
je 0x864c
jmp 0x8642
movl -0x18(%rbp), %eax
subl $0x78, %eax
jne 0x869f
jmp 0x864c
callq 0x3170
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
callq 0x8210
movl %eax, %ecx
movq -0x20(%rbp), %rax
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x1000, %eax           # imm = 0x1000
cmpl $0x0, %eax
je 0x8681
movl $0x9, -0x4(%rbp)
jmp 0x86b2
movl -0x14(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x81c0
movl $0x8, -0x4(%rbp)
jmp 0x86b2
movl $0x7, -0x4(%rbp)
jmp 0x86b2
movl -0x14(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x81c0
movl $0x8, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/tstword[P]MIPSAssemblerC/src/tokenizer.c
// Function: hex_fsm
state_fsm hex_fsm(struct tokenizer *tokenizer) {
    int ch = tgetc(tokenizer);

    switch(ch) {
        /* To comply with Microsoft's C++ compiler... */
        case 'A': case 'B': case 'C': case 'D':
        case 'E': case 'F':
        /* To comply with Microsoft's C++ compiler... */
        case 'a': case 'b': case 'c': case 'd':
        case 'e': case 'f':
        /* To comply with Microsoft's C++ compiler... */
        case '0': case '1': case '2': case '3':
        case '4': case '5': case '6': case '7':
        case '8': case '9':
            return hex_state;
        default:
            tungetc(ch, tokenizer);
            return integer_accept;
    }

    return invalid_state;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x8100
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x18(%rbp)
addl $-0x30, %eax
subl $0xa, %eax
jb 0x8702
jmp 0x86e8
movl -0x18(%rbp), %eax
addl $-0x41, %eax
subl $0x6, %eax
jb 0x8702
jmp 0x86f5
movl -0x18(%rbp), %eax
addl $-0x61, %eax
subl $0x5, %eax
ja 0x870b
jmp 0x8702
movl $0x9, -0x4(%rbp)
jmp 0x871e
movl -0x14(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x81c0
movl $0x8, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/tstword[P]MIPSAssemblerC/src/tokenizer.c
// Function: comment_fsm
state_fsm comment_fsm(struct tokenizer *tokenizer) {
    int ch = tgetc(tokenizer);

    switch(ch) {
        case EOF:
            tungetc(ch, tokenizer);
            return comment_accept;
        case '\n':
            tungetc(ch, tokenizer);
            return comment_accept;
        default:
            return comment_state;
    }

    return invalid_state;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x8100
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x18(%rbp)
subl $-0x1, %eax
je 0x875f
jmp 0x8755
movl -0x18(%rbp), %eax
subl $0xa, %eax
je 0x8774
jmp 0x8789
movl -0x14(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x81c0
movl $0xf, -0x4(%rbp)
jmp 0x8790
movl -0x14(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x81c0
movl $0xf, -0x4(%rbp)
jmp 0x8790
movl $0xe, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/tstword[P]MIPSAssemblerC/src/tokenizer.c
// Function: negative_fsm
state_fsm negative_fsm(struct tokenizer *tokenizer) {
    int ch = tgetc(tokenizer);

    switch(ch) {
        case '0':
            return zero_state;
        /* To comply with Microsoft's C++ compiler... */
        case '1': case '2': case '3':
        case '4': case '5': case '6': case '7':
        case '8': case '9':
            return integer_state;
        default:
            tungetc(ch, tokenizer);
            report_fsm(tokenizer, "Expected integer value to be specified on line %ld, col %ld", tokenizer->lineno, tokenizer->colno);
            return invalid_state;
    }

    return invalid_state;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x8100
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x18(%rbp)
subl $0x30, %eax
je 0x87d2
jmp 0x87c5
movl -0x18(%rbp), %eax
addl $-0x31, %eax
subl $0x9, %eax
jb 0x87db
jmp 0x87e4
movl $0xa, -0x4(%rbp)
jmp 0x8819
movl $0x7, -0x4(%rbp)
jmp 0x8819
movl -0x14(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x81c0
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdx
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rcx
leaq 0x304a(%rip), %rsi      # 0xb855
movb $0x0, %al
callq 0x8250
movl $0x16, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/tstword[P]MIPSAssemblerC/src/tokenizer.c
// Function: string_fsm
state_fsm string_fsm(struct tokenizer *tokenizer) {
    int ch = tgetc(tokenizer);

    switch(ch) {
        case '"':
            /* Ignore " character */
            --tokenizer->bufpos;
            return string_accept;
        case '\\':
            return string_escape;
        case EOF:
        case '\n':
            tungetc(ch, tokenizer);
            report_fsm(tokenizer, "Non-terminated string, expected '\"' on line %ld, col %ld", tokenizer->lineno, tokenizer->colno);
            return invalid_state;
        default:
            return string_state;
    }

    return invalid_state;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x8100
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x18(%rbp)
subl $-0x1, %eax
je 0x8895
jmp 0x8855
movl -0x18(%rbp), %eax
subl $0xa, %eax
je 0x8895
jmp 0x885f
movl -0x18(%rbp), %eax
subl $0x22, %eax
je 0x8873
jmp 0x8869
movl -0x18(%rbp), %eax
subl $0x5c, %eax
je 0x888c
jmp 0x88cc
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x28(%rax)
movl $0x12, -0x4(%rbp)
jmp 0x88d3
movl $0x17, -0x4(%rbp)
jmp 0x88d3
movl -0x14(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x81c0
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdx
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rcx
leaq 0x2fd5(%rip), %rsi      # 0xb891
movb $0x0, %al
callq 0x8250
movl $0x16, -0x4(%rbp)
jmp 0x88d3
movl $0x11, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/tstword[P]MIPSAssemblerC/src/tokenizer.c
// Function: character_fsm
state_fsm character_fsm(struct tokenizer *tokenizer) {
    int ch = tgetc(tokenizer);

    switch(ch) {
        case '\\':
            return escape_state;
        default:
            if(isprint(ch)) return quote_state;
            tungetc(ch, tokenizer);
            report_fsm(tokenizer, "Expected C-style character on line %ld, col %ld", tokenizer->lineno, tokenizer->colno);
            return invalid_state;
    }

    return invalid_state;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x8100
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
subl $0x5c, %eax
jne 0x890b
jmp 0x8902
movl $0x14, -0x4(%rbp)
jmp 0x8963
callq 0x3170
movq (%rax), %rax
movslq -0x14(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x4000, %eax           # imm = 0x4000
cmpl $0x0, %eax
je 0x892e
movl $0x13, -0x4(%rbp)
jmp 0x8963
movl -0x14(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x81c0
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdx
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rcx
leaq 0x2f75(%rip), %rsi      # 0xb8ca
movb $0x0, %al
callq 0x8250
movl $0x16, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/tstword[P]MIPSAssemblerC/src/tokenizer.c
// Function: string_escape_fsm
state_fsm string_escape_fsm(struct tokenizer *tokenizer) {
    int ch = tgetc(tokenizer);

    switch(ch) {
        case 't':
        case 'b':
        case 'n':
        case 'r':
        case '0':
        case 'a':
        case 'f':
        case 'v':
        case '\'':
        case '"':
        case '?':
        case '\\':
            return string_state;
        default:
            tungetc(ch, tokenizer);
            report_fsm(tokenizer, "Unrecognized escape character on line %ld, col %ld", tokenizer->lineno, tokenizer->colno);
            return invalid_state;
    }

    return string_state;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x8100
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
addl $-0x22, %eax
movl %eax, %ecx
movq %rcx, -0x20(%rbp)
subl $0x54, %eax
ja 0x89b6
movq -0x20(%rbp), %rax
leaq 0x26b0(%rip), %rcx      # 0xb054
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x11, -0x4(%rbp)
jmp 0x89eb
movl -0x14(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x81c0
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdx
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rcx
leaq 0x2f1d(%rip), %rsi      # 0xb8fa
movb $0x0, %al
callq 0x8250
movl $0x16, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/tstword[P]MIPSAssemblerC/src/tokenizer.c
// Function: quote_fsm
state_fsm quote_fsm(struct tokenizer *tokenizer) {
    int ch = tgetc(tokenizer);

    switch(ch) {
        case '\'':
            return character_accept;
        default:
            tungetc(ch, tokenizer);
            report_fsm(tokenizer, "Expected end single quote on line %ld, col %ld", tokenizer->lineno, tokenizer->colno);
            return invalid_state;
    }

    return invalid_state;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x8100
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
subl $0x27, %eax
jne 0x8abb
jmp 0x8ab2
movl $0xc, -0x4(%rbp)
jmp 0x8af0
movl -0x14(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x81c0
movq -0x10(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdx
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rcx
leaq 0x2e4b(%rip), %rsi      # 0xb92d
movb $0x0, %al
callq 0x8250
movl $0x16, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/tstword[P]MIPSAssemblerC/src/tokenizer.c
// Function: create_tokenizer
struct tokenizer *create_tokenizer(const char *file) {
    /* Create the tokenizer struct */
    struct tokenizer *tokenizer = (struct tokenizer *)malloc(sizeof(struct tokenizer));
    
    /* Failed to allocate space */
    if(tokenizer == NULL) { return NULL; }

    /* Open file for reading */
    tokenizer->fstream = fopen_wrap(file, "r");
    
    /* Failed to open file */
    if(tokenizer->fstream == NULL) { 
        free(tokenizer);
        return NULL; 
    }

    /* Create string buffer */
    tokenizer->lexbuf = (char *)malloc(32);
    
    /* Failed to allocate space */
    if(tokenizer->lexbuf == NULL) { 
        fclose(tokenizer->fstream);
        free(tokenizer);
        return NULL; 
    }

    /* Set the buffer parameters */
    tokenizer->bufsize = 32;
    tokenizer->bufpos = 0;

    /* Set the file parameters */
    tokenizer->colno = 1;
    tokenizer->lineno = 1;

    /* Set the error mesage parameters */
    tokenizer->errmsg = NULL;
    tokenizer->errsize = 0;

    /* Set NULL attribute */
    tokenizer->attrptr = NULL;

    /* Store filename */
    tokenizer->filename = strdup_wrap(file);

    return tokenizer;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movl $0x50, %edi
callq 0x30e0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x8e8e
movq $0x0, -0x8(%rbp)
jmp 0x8f79
movq -0x10(%rbp), %rdi
leaq 0x2b32(%rip), %rsi      # 0xb9cb
callq 0x7170
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x8eca
movq -0x18(%rbp), %rdi
callq 0x3030
movq $0x0, -0x8(%rbp)
jmp 0x8f79
movl $0x20, %edi
callq 0x30e0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x8f0a
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x3050
movq -0x18(%rbp), %rdi
callq 0x3030
movq $0x0, -0x8(%rbp)
jmp 0x8f79
movq -0x18(%rbp), %rax
movq $0x20, 0x30(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x28(%rax)
movq -0x18(%rbp), %rax
movq $0x1, 0x40(%rax)
movq -0x18(%rbp), %rax
movq $0x1, 0x38(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x48(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x20(%rax)
movq -0x10(%rbp), %rdi
callq 0x71a0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/tstword[P]MIPSAssemblerC/src/tokenizer.c
// Function: destroy_tokenizer
void destroy_tokenizer(struct tokenizer **tokenizer) {
    if(*tokenizer == NULL) return;

    /* Close reading file stream */
    fclose((*tokenizer)->fstream);
    free((*tokenizer)->filename);

    /* Destory dynamically allocated data */
    free((*tokenizer)->lexbuf);
    free((*tokenizer)->errmsg);
    free(*tokenizer);

    /* Redirect pointer to NULL */
    *tokenizer = NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x9198
jmp 0x91ee
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rdi
callq 0x3050
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rdi
callq 0x3030
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rdi
callq 0x3030
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x18(%rax), %rdi
callq 0x3030
movq -0x8(%rbp), %rax
movq (%rax), %rdi
callq 0x3030
movq -0x8(%rbp), %rax
movq $0x0, (%rax)
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/tstword[P]MIPSAssemblerC/src/tokenizer.c
// Function: get_token_str
const char *get_token_str(token_t token) {
    switch(token) {
        case TOK_IDENTIFIER:
            return "identififer";
        case TOK_COLON:
            return "':'";
        case TOK_REGISTER:
            return "register";
        case TOK_STRING:
            return "string";
        case TOK_MNEMONIC:
            return "mnemonic";
        case TOK_COMMA:
            return "','";
        case TOK_INTEGER:
            return "integer";
        case TOK_LPAREN:
            return "'('";
        case TOK_RPAREN:
            return "')'";
        case TOK_EOL:
            return "end of line";
        case TOK_DIRECTIVE:
            return "directive";
    }
    
    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, -0xc(%rbp)
movl -0xc(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x18(%rbp)
subl $0xb, %eax
ja 0x92c1
movq -0x18(%rbp), %rax
leaq 0x228a(%rip), %rcx      # 0xb4b0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x278b(%rip), %rax      # 0xb9c1
movq %rax, -0x8(%rbp)
jmp 0x92c9
leaq 0x2787(%rip), %rax      # 0xb9cd
movq %rax, -0x8(%rbp)
jmp 0x92c9
leaq 0x277e(%rip), %rax      # 0xb9d1
movq %rax, -0x8(%rbp)
jmp 0x92c9
leaq 0x277a(%rip), %rax      # 0xb9da
movq %rax, -0x8(%rbp)
jmp 0x92c9
leaq 0x143c(%rip), %rax      # 0xa6a9
movq %rax, -0x8(%rbp)
jmp 0x92c9
leaq 0x2767(%rip), %rax      # 0xb9e1
movq %rax, -0x8(%rbp)
jmp 0x92c9
leaq 0x275e(%rip), %rax      # 0xb9e5
movq %rax, -0x8(%rbp)
jmp 0x92c9
leaq 0x2759(%rip), %rax      # 0xb9ed
movq %rax, -0x8(%rbp)
jmp 0x92c9
leaq 0x2750(%rip), %rax      # 0xb9f1
movq %rax, -0x8(%rbp)
jmp 0x92c9
leaq 0x2747(%rip), %rax      # 0xb9f5
movq %rax, -0x8(%rbp)
jmp 0x92c9
leaq 0x13e4(%rip), %rax      # 0xa69f
movq %rax, -0x8(%rbp)
jmp 0x92c9
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/JavieW[P]CSCC69_Ext2_File-System/utilities.c
// Function: getBitmap
char unsigned *getBitmap(int bitmapNum) {
    struct ext2_group_desc *gd = getGroupDesc();
    if (bitmapNum == INODE_BITMAP)
        return (char unsigned *)(disk+gd->bg_inode_bitmap*EXT2_BLOCK_SIZE);
    else if (bitmapNum == BLOCK_BITMAP)
        return (char unsigned *)(disk+gd->bg_block_bitmap*EXT2_BLOCK_SIZE);
    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0xc(%rbp)
callq 0x17f0
movq %rax, -0x18(%rbp)
cmpl $0x1, -0xc(%rbp)
jne 0x1849
leaq 0x3867(%rip), %rax      # 0x5098
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movl 0x4(%rcx), %ecx
shll $0xa, %ecx
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, -0x8(%rbp)
jmp 0x1877
cmpl $0x0, -0xc(%rbp)
jne 0x186d
leaq 0x3842(%rip), %rax      # 0x5098
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movl (%rcx), %ecx
shll $0xa, %ecx
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, -0x8(%rbp)
jmp 0x1877
jmp 0x186f
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/JavieW[P]CSCC69_Ext2_File-System/utilities.c
// Function: getFirstEmptyBitIndex
int getFirstEmptyBitIndex(int bitmapNum) {
    int index, maxLength;
    unsigned char *bitmap;
    if (bitmapNum == INODE_BITMAP) {
        index = EXT2_GOOD_OLD_FIRST_INO;
        maxLength = getSuperblock()->s_inodes_count;
        bitmap = getBitmap(INODE_BITMAP);
    } else {
        index = 0;
        maxLength = getSuperblock()->s_blocks_count;
        bitmap = getBitmap(BLOCK_BITMAP);
    }
    while (index < maxLength) {
        if (getBit(bitmap, index) == 0) {
            return index;
        }
        index++;
    }
    return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x8(%rbp)
cmpl $0x1, -0x8(%rbp)
jne 0x1912
movl $0xb, -0xc(%rbp)
callq 0x17d0
movl (%rax), %eax
movl %eax, -0x10(%rbp)
movl $0x1, %edi
callq 0x1810
movq %rax, -0x18(%rbp)
jmp 0x192f
movl $0x0, -0xc(%rbp)
callq 0x17d0
movl 0x4(%rax), %eax
movl %eax, -0x10(%rbp)
xorl %edi, %edi
callq 0x1810
movq %rax, -0x18(%rbp)
jmp 0x1931
movl -0xc(%rbp), %eax
cmpl -0x10(%rbp), %eax
jge 0x195d
movq -0x18(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x1890
cmpl $0x0, %eax
jne 0x1952
movl -0xc(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1964
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x1931
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/JavieW[P]CSCC69_Ext2_File-System/utilities.c
// Function: changeBitmap
void changeBitmap(char unsigned *bitmap, int idx, char mode) {

    int turn_on = 00000001;
    int turn_off = 00000001;

    turn_on = turn_on << idx%8;
    turn_off = ~(turn_off << idx%8);

    if (mode == 'a'){
        // turning on the bit
        bitmap[idx/8] = bitmap[idx/8] | turn_on;
    }else{
        // turning off the bit
        bitmap[idx/8] = bitmap[idx/8] & turn_off;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movb %dl, %al
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movb %al, -0xd(%rbp)
movl $0x1, -0x14(%rbp)
movl $0x1, -0x18(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0xc(%rbp), %eax
movl $0x8, %ecx
cltd
idivl %ecx
movl -0x20(%rbp), %eax
movl %edx, %ecx
shll %cl, %eax
movl %eax, -0x14(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x1c(%rbp)
movl -0xc(%rbp), %eax
movl $0x8, %ecx
cltd
idivl %ecx
movl -0x1c(%rbp), %eax
movl %edx, %ecx
shll %cl, %eax
xorl $-0x1, %eax
movl %eax, -0x18(%rbp)
movsbl -0xd(%rbp), %eax
cmpl $0x61, %eax
jne 0x1a1a
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
movl -0xc(%rbp), %eax
movl $0x8, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0x38(%rbp), %rax
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
orl -0x14(%rbp), %eax
movb %al, -0x29(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movl -0xc(%rbp), %eax
movl $0x8, %ecx
cltd
idivl %ecx
movb -0x29(%rbp), %dl
movl %eax, %ecx
movq -0x28(%rbp), %rax
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
jmp 0x1a62
movq -0x8(%rbp), %rax
movq %rax, -0x50(%rbp)
movl -0xc(%rbp), %eax
movl $0x8, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0x50(%rbp), %rax
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
andl -0x18(%rbp), %eax
movb %al, -0x41(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movl -0xc(%rbp), %eax
movl $0x8, %ecx
cltd
idivl %ecx
movb -0x41(%rbp), %dl
movl %eax, %ecx
movq -0x40(%rbp), %rax
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/JavieW[P]CSCC69_Ext2_File-System/utilities.c
// Function: initInode
int initInode(unsigned short mode) {

    // find the first free inode
    int index = getFirstEmptyBitIndex(INODE_BITMAP);
    
    // change its bitmap and update field in gd
    char unsigned *bitmap = getBitmap(INODE_BITMAP);
    changeBitmap(bitmap, index, 'a');
    getGroupDesc()->bg_free_inodes_count--;

    // initialize inode attribute
    struct ext2_inode *inode_table = getInodeTable();
    inode_table[index].i_mode = mode;
    inode_table[index].i_size = 1024;
    inode_table[index].i_links_count = 1;
    inode_table[index].i_blocks = 2;
    for(int i=0; i<15; i++) {
        inode_table[index].i_block[i] = 0;
    }

    // set creation time for this inode
    inode_table[index].i_ctime = time(NULL);
    return index+1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movw %di, %ax
movw %ax, -0x2(%rbp)
movl $0x1, %edi
callq 0x18e0
movl %eax, -0x8(%rbp)
movl $0x1, %edi
callq 0x1810
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movl -0x8(%rbp), %esi
movl $0x61, %edx
callq 0x1970
callq 0x17f0
movw 0xe(%rax), %cx
addw $-0x1, %cx
movw %cx, 0xe(%rax)
callq 0x1a70
movq %rax, -0x18(%rbp)
movw -0x2(%rbp), %cx
movq -0x18(%rbp), %rax
movslq -0x8(%rbp), %rdx
shlq $0x7, %rdx
addq %rdx, %rax
movw %cx, (%rax)
movq -0x18(%rbp), %rax
movslq -0x8(%rbp), %rcx
shlq $0x7, %rcx
addq %rcx, %rax
movl $0x400, 0x4(%rax)       # imm = 0x400
movq -0x18(%rbp), %rax
movslq -0x8(%rbp), %rcx
shlq $0x7, %rcx
addq %rcx, %rax
movw $0x1, 0x1a(%rax)
movq -0x18(%rbp), %rax
movslq -0x8(%rbp), %rcx
shlq $0x7, %rcx
addq %rcx, %rax
movl $0x2, 0x1c(%rax)
movl $0x0, -0x1c(%rbp)
cmpl $0xf, -0x1c(%rbp)
jge 0x1baf
movq -0x18(%rbp), %rax
movslq -0x8(%rbp), %rcx
shlq $0x7, %rcx
addq %rcx, %rax
movslq -0x1c(%rbp), %rcx
movl $0x0, 0x28(%rax,%rcx,4)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x1b83
xorl %eax, %eax
movl %eax, %edi
callq 0x10b0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movslq -0x8(%rbp), %rdx
shlq $0x7, %rdx
addq %rdx, %rax
movl %ecx, 0xc(%rax)
movl -0x8(%rbp), %eax
addl $0x1, %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/JavieW[P]CSCC69_Ext2_File-System/utilities.c
// Function: allocateNewBlock
int allocateNewBlock() {
    int index = getFirstEmptyBitIndex(BLOCK_BITMAP);
    changeBitmap(getBitmap(BLOCK_BITMAP), index, 'a');
    getGroupDesc()->bg_free_blocks_count--;
    return index+1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
xorl %edi, %edi
callq 0x18e0
movl %eax, -0x4(%rbp)
xorl %edi, %edi
callq 0x1810
movq %rax, %rdi
movl -0x4(%rbp), %esi
movl $0x61, %edx
callq 0x1970
callq 0x17f0
movw 0xc(%rax), %cx
addw $-0x1, %cx
movw %cx, 0xc(%rax)
movl -0x4(%rbp), %eax
addl $0x1, %eax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/JavieW[P]CSCC69_Ext2_File-System/utilities.c
// Function: searchFileInDir
int searchFileInDir(struct ext2_inode *parentInode, char *childFileName) {
    /**
     * return inode num if childFile is found, o/w 0
     */
    struct ext2_dir_entry_2 *cur_dir_entry = NULL;
    struct ext2_dir_entry_2 *pre_dir_entry = getPreDirent(parentInode, childFileName);
    if (strcmp(childFileName, ".") == 0) {
        return ((struct ext2_dir_entry_2 *)getBlock(parentInode->i_block[0]))->inode;
    }
    else if (pre_dir_entry != NULL) {
        cur_dir_entry = (void *)pre_dir_entry + pre_dir_entry->rec_len;
        return cur_dir_entry->inode;
    } 
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x1e60
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x13c6(%rip), %rsi      # 0x31ca
callq 0x1090
cmpl $0x0, %eax
jne 0x1e21
movq -0x10(%rbp), %rax
movl 0x28(%rax), %edi
callq 0x1d60
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x1e52
cmpq $0x0, -0x28(%rbp)
je 0x1e49
movq -0x28(%rbp), %rax
movq -0x28(%rbp), %rcx
movzwl 0x4(%rcx), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
jmp 0x1e52
jmp 0x1e4b
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/JavieW[P]CSCC69_Ext2_File-System/utilities.c
// Function: getPreDirent
struct ext2_dir_entry_2 *getPreDirent(struct ext2_inode *parentInode, char *childFileName) {
    struct ext2_dir_entry_2 * pre_dir_entry;
    struct ext2_dir_entry_2 * cur_dir_entry;
    int total_rec_len;

    // search in direct block
    for (int i=0; i<12; i++) {
        if (parentInode->i_block[i] == 0) {
            continue;
        } else {
            pre_dir_entry = (struct ext2_dir_entry_2 *)getBlock(parentInode->i_block[i]);
            total_rec_len = pre_dir_entry->rec_len;
            cur_dir_entry = (void *) pre_dir_entry + pre_dir_entry->rec_len;
        }

        // for each dir entry in the block
        while (total_rec_len < EXT2_BLOCK_SIZE) {
            if(strcmp(cur_dir_entry->name, childFileName)==0) {
                return pre_dir_entry;
            }
            total_rec_len = total_rec_len + cur_dir_entry->rec_len;
            pre_dir_entry = cur_dir_entry;
            cur_dir_entry = (void *) cur_dir_entry + cur_dir_entry->rec_len;
        }
    }
    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x30(%rbp)
cmpl $0xc, -0x30(%rbp)
jge 0x1f36
movq -0x10(%rbp), %rax
movslq -0x30(%rbp), %rcx
cmpl $0x0, 0x28(%rax,%rcx,4)
jne 0x1e95
jmp 0x1f28
movq -0x10(%rbp), %rax
movslq -0x30(%rbp), %rcx
movl 0x28(%rax,%rcx,4), %edi
callq 0x1d60
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movzwl 0x4(%rax), %eax
movl %eax, -0x2c(%rbp)
movq -0x20(%rbp), %rax
movq -0x20(%rbp), %rcx
movzwl 0x4(%rcx), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
jmp 0x1ecd
cmpl $0x400, -0x2c(%rbp)     # imm = 0x400
jge 0x1f26
movq -0x28(%rbp), %rdi
addq $0x8, %rdi
movq -0x18(%rbp), %rsi
callq 0x1090
cmpl $0x0, %eax
jne 0x1ef6
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1f3e
movl -0x2c(%rbp), %eax
movq -0x28(%rbp), %rcx
movzwl 0x4(%rcx), %ecx
addl %ecx, %eax
movl %eax, -0x2c(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x28(%rbp), %rax
movq -0x28(%rbp), %rcx
movzwl 0x4(%rcx), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
jmp 0x1ecd
jmp 0x1f28
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x1e77
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/JavieW[P]CSCC69_Ext2_File-System/utilities.c
// Function: allocateDirentHelper
struct ext2_dir_entry_2 *allocateDirentHelper(int blockNum, int size) {
    /*
    * Helper function for initDirent
    */
    struct ext2_dir_entry_2 *dir_entry, *new_dir_entry;
    int total_rec_len, actural_len, residue_len;

    dir_entry = (struct ext2_dir_entry_2 *)getBlock(blockNum);
    total_rec_len = 0;
    while (total_rec_len < EXT2_BLOCK_SIZE) {
        // calculate residue
        actural_len = calculateActuralSize(dir_entry);
        residue_len = dir_entry->rec_len - actural_len;
        if (residue_len >= size) {
            new_dir_entry = (void *)dir_entry+actural_len;
            dir_entry->rec_len=actural_len;
            new_dir_entry->rec_len=residue_len;
            return new_dir_entry;
        }
        total_rec_len = total_rec_len + dir_entry->rec_len;
        dir_entry = (void *) dir_entry + dir_entry->rec_len;
    }
    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0xc(%rbp)
movl %esi, -0x10(%rbp)
movl -0xc(%rbp), %edi
callq 0x1d60
movq %rax, -0x18(%rbp)
movl $0x0, -0x24(%rbp)
cmpl $0x400, -0x24(%rbp)     # imm = 0x400
jge 0x2180
movq -0x18(%rbp), %rdi
callq 0x1f50
movl %eax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movzwl 0x4(%rax), %eax
subl -0x28(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x10(%rbp), %eax
jl 0x2155
movq -0x18(%rbp), %rax
movslq -0x28(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movl -0x28(%rbp), %eax
movw %ax, %cx
movq -0x18(%rbp), %rax
movw %cx, 0x4(%rax)
movl -0x2c(%rbp), %eax
movw %ax, %cx
movq -0x20(%rbp), %rax
movw %cx, 0x4(%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x2188
movl -0x24(%rbp), %eax
movq -0x18(%rbp), %rcx
movzwl 0x4(%rcx), %ecx
addl %ecx, %eax
movl %eax, -0x24(%rbp)
movq -0x18(%rbp), %rax
movq -0x18(%rbp), %rcx
movzwl 0x4(%rcx), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
jmp 0x20f1
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/JavieW[P]CSCC69_Ext2_File-System/utilities.c
// Function: initNewDirent
struct ext2_dir_entry_2 *initNewDirent(struct ext2_inode *parentInode, int childInodeNum, int type, char *fileName) {
    int name_len, size;
    struct ext2_dir_entry_2 *newDirent; 

    // calculate actual size required for new dir_entry
    name_len = strlen(fileName);
    size = sizeof(struct ext2_dir_entry_2) + ((name_len+4)/4)*4;

    // allocate new dir_entry in parent directory
    newDirent = allocateNewDirent(parentInode, size);
    
    // initialize new dir_entry
    newDirent->inode = childInodeNum;
    newDirent->file_type = type;
    newDirent->name_len = (unsigned char) name_len;
    strcpy(newDirent->name, fileName);
    return newDirent;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x1040
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
addl $0x4, %eax
movl $0x4, %ecx
cltd
idivl %ecx
shll $0x2, %eax
cltq
addq $0x8, %rax
movl %eax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movl -0x20(%rbp), %esi
callq 0x1f80
movq %rax, -0x28(%rbp)
movl -0xc(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movl -0x10(%rbp), %eax
movb %al, %cl
movq -0x28(%rbp), %rax
movb %cl, 0x7(%rax)
movl -0x1c(%rbp), %eax
movb %al, %cl
movq -0x28(%rbp), %rax
movb %cl, 0x6(%rax)
movq -0x28(%rbp), %rdi
addq $0x8, %rdi
movq -0x18(%rbp), %rsi
callq 0x1030
movq -0x28(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/JavieW[P]CSCC69_Ext2_File-System/utilities.c
// Function: initSingleIndirect
unsigned int *initSingleIndirect(int blockNum) {
    unsigned int *singleIndirect = (unsigned int *)getBlock(blockNum);
    for (int i=0; i<(EXT2_BLOCK_SIZE/4); i++) {
        singleIndirect[i] = 0;
    }
    return singleIndirect;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x4(%rbp)
movl -0x4(%rbp), %edi
callq 0x1d60
movq %rax, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
cmpl $0x100, -0x14(%rbp)     # imm = 0x100
jge 0x2271
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movl $0x0, (%rax,%rcx,4)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x224e
movq -0x10(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/JavieW[P]CSCC69_Ext2_File-System/utilities.c
// Function: getInodeFromPath
int getInodeFromPath(char *path) {
    /*
    * return: inodeNum of the path, 0 if path is not found or invalid
    */
    struct ext2_inode *inodeTable = getInodeTable();
    int inode_num = EXT2_ROOT_INO;
    struct ext2_inode *cur_inode = &inodeTable[inode_num-1];
    char *next_file;
    int endWithDir = path[strlen(path)-1] == '/'; // is path endwith '/' ?

    if (path[0] != '/') {
        // invalid path: absolute path startwith 
        return 0;
    }

    // travel through path
    next_file = strtok(path, "/");
    while(next_file != NULL) {
        // cannot have a non-directory type file in the middle of path
        if (!(cur_inode->i_mode & EXT2_S_IFDIR)) {
            // Invalid path; non-dir type file inside path
            return 0;
        }

        // get next inode from current directory
        inode_num = searchFileInDir(cur_inode, next_file);
        // update inode to next file with next_file
        if (inode_num != 0) {
            cur_inode = &inodeTable[inode_num-1];
        } else {
            // invalid path: file name not found
            return 0;
        }

        next_file = strtok(NULL, "/");
    }

    if (!(cur_inode->i_mode & EXT2_S_IFDIR) && endWithDir) {
        // invalid path: path endwith '/' but have a non-dir type file at the end
        return 0;
    }
    return inode_num;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
callq 0x1a70
movq %rax, -0x18(%rbp)
movl $0x2, -0x1c(%rbp)
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
shlq $0x7, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1040
movq %rax, %rcx
movq -0x40(%rbp), %rax
subq $0x1, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x2f, %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
je 0x22fa
movl $0x0, -0x4(%rbp)
jmp 0x23a4
movq -0x10(%rbp), %rdi
leaq 0xe83(%rip), %rsi       # 0x3188
callq 0x10e0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x237e
movq -0x28(%rbp), %rax
movzwl (%rax), %eax
andl $0x4000, %eax           # imm = 0x4000
cmpl $0x0, %eax
jne 0x232f
movl $0x0, -0x4(%rbp)
jmp 0x23a4
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x1dd0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x235f
movq -0x18(%rbp), %rax
movl -0x1c(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
shlq $0x7, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
jmp 0x2368
movl $0x0, -0x4(%rbp)
jmp 0x23a4
xorl %eax, %eax
movl %eax, %edi
leaq 0xe15(%rip), %rsi       # 0x3188
callq 0x10e0
movq %rax, -0x30(%rbp)
jmp 0x230e
movq -0x28(%rbp), %rax
movzwl (%rax), %eax
andl $0x4000, %eax           # imm = 0x4000
cmpl $0x0, %eax
jne 0x239e
cmpl $0x0, -0x34(%rbp)
je 0x239e
movl $0x0, -0x4(%rbp)
jmp 0x23a4
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/JavieW[P]CSCC69_Ext2_File-System/utilities.c
// Function: getFileNameFromPath
void getFileNameFromPath(char *fileName, char *path) {
    /*
    * return the last section of path into fileName
    */
    char *curr = strtok(path, "/");
    while (curr != NULL) {
        strcpy(fileName, curr);
        curr = strtok(NULL, "/");
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
leaq 0xdbd(%rip), %rsi       # 0x3188
callq 0x10e0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x23fe
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x1030
xorl %eax, %eax
movl %eax, %edi
leaq 0xd95(%rip), %rsi       # 0x3188
callq 0x10e0
movq %rax, -0x18(%rbp)
jmp 0x23d4
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/JavieW[P]CSCC69_Ext2_File-System/utilities.c
// Function: getParentDirPath
void getParentDirPath(char *path) {
    /*
    * modify input path
    */
    assert (strcmp(path, "/")!=0);

    int len = strlen(path);
    if (path[len-1]=='/')
        path[len-1] = '\0';
    char *target = strrchr(path, '/');
    *(target+1) = '\0';
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
leaq 0xd61(%rip), %rsi       # 0x3188
callq 0x1090
cmpl $0x0, %eax
je 0x2433
jmp 0x2452
leaq 0xd50(%rip), %rdi       # 0x318a
leaq 0xd5e(%rip), %rsi       # 0x319f
movl $0x153, %edx            # imm = 0x153
leaq 0xd5e(%rip), %rcx       # 0x31ab
callq 0x1080
movq -0x8(%rbp), %rdi
callq 0x1040
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rax
movl -0xc(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x2f, %eax
jne 0x2485
movq -0x8(%rbp), %rax
movl -0xc(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movb $0x0, (%rax,%rcx)
movq -0x8(%rbp), %rdi
movl $0x2f, %esi
callq 0x1070
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movb $0x0, 0x1(%rax)
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/opencoff[P]crypto-rand/t_aesrand.c
// Function: main
int
main(int argc, const char *argv[])
{
    crypto_rand_state st;

    int r = crypto_rand_init(&st, CRYPTO_RAND_AES, getentropy);
    assert(r == 0);

    int n = 1024;

    if (argc > 1) {
        int z = atoi(argv[1]);
        if (z <= 0) error(1, 0, "invalid size %s", argv[1]);
        n = z;
    }

    uint8_t *buf = malloc(n);
    assert(buf);

    crypto_rand_buf(&st, buf, n);

    fwrite(buf, 1, n, stdout);
    free(buf);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x560, %rsp            # imm = 0x560
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x540(%rbp), %rdi
movl $0x1, %esi
leaq 0x2804(%rip), %rdx      # 0x3a50
callq 0x1370
movl %eax, -0x544(%rbp)
cmpl $0x0, -0x544(%rbp)
jne 0x1262
jmp 0x1281
leaq 0x2d9b(%rip), %rdi      # 0x4004
leaq 0x2d9b(%rip), %rsi      # 0x400b
movl $0x17, %edx
leaq 0x2d9b(%rip), %rcx      # 0x4017
callq 0x1050
movl $0x400, -0x548(%rbp)    # imm = 0x400
cmpl $0x1, -0x8(%rbp)
jle 0x12d6
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x10e0
movl %eax, -0x54c(%rbp)
cmpl $0x0, -0x54c(%rbp)
jg 0x12ca
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
movl $0x1, %edi
xorl %esi, %esi
leaq 0x2d71(%rip), %rdx      # 0x4034
movb $0x0, %al
callq 0x3930
movl -0x54c(%rbp), %eax
movl %eax, -0x548(%rbp)
movslq -0x548(%rbp), %rdi
callq 0x10a0
movq %rax, -0x558(%rbp)
cmpq $0x0, -0x558(%rbp)
je 0x12f5
jmp 0x1314
leaq 0x2d48(%rip), %rdi      # 0x4044
leaq 0x2d08(%rip), %rsi      # 0x400b
movl $0x22, %edx
leaq 0x2d08(%rip), %rcx      # 0x4017
callq 0x1050
movq -0x558(%rbp), %rsi
movslq -0x548(%rbp), %rdx
leaq -0x540(%rbp), %rdi
callq 0x1640
movq -0x558(%rbp), %rdi
movslq -0x548(%rbp), %rdx
movq 0x4c95(%rip), %rax      # 0x5fd8
movq (%rax), %rcx
movl $0x1, %esi
callq 0x1100
movq -0x558(%rbp), %rdi
callq 0x1030
xorl %eax, %eax
addq $0x560, %rsp            # imm = 0x560
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/opencoff[P]crypto-rand/cryptorand.c
// Function: crypto_rand_init
int
crypto_rand_init(crypto_rand_state *st, int algo, crypto_rand_entropy_t entropy)
{
    if (!entropy) return -EINVAL;


    memset(st, 0, sizeof *st);
    st->entropy = entropy;

    switch (algo) {
        case CRYPTO_RAND_AES:
            _aes_setup(st);
            __aes_init(st);
            break;

        case CRYPTO_RAND_CHACHA20:
            _chacha_setup(st);
            __chacha_init(st);
            break;

        default:
            return -EINVAL;
    }

    // When we startup, st->buf is zero so, we're encrypting a
    // zero-buf with a random key & IV.
    _rs_rekey(st, 0, 0);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x1393
movl $0xffffffea, -0x4(%rbp) # imm = 0xFFFFFFEA
jmp 0x1411
movq -0x10(%rbp), %rdi
xorl %esi, %esi
movl $0x530, %edx            # imm = 0x530
callq 0x1060
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x510(%rax)
movl -0x14(%rbp), %eax
movl %eax, -0x24(%rbp)
subl $0x1, %eax
je 0x13c9
jmp 0x13bf
movl -0x24(%rbp), %eax
subl $0x2, %eax
je 0x13dd
jmp 0x13f1
movq -0x10(%rbp), %rdi
callq 0x1420
movq -0x10(%rbp), %rdi
callq 0x1460
jmp 0x13fa
movq -0x10(%rbp), %rdi
callq 0x14d0
movq -0x10(%rbp), %rdi
callq 0x1510
jmp 0x13fa
movl $0xffffffea, -0x4(%rbp) # imm = 0xFFFFFFEA
jmp 0x1411
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
movq %rdx, %rsi
callq 0x1580
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/opencoff[P]crypto-rand/cryptorand.c
// Function: rs_rekey
static inline void
_rs_rekey(crypto_rand_state* st, uint8_t *dat, size_t datlen)
{
    st->crypt_buf(st);

    /* mix in optional user provided data */
    if (dat) {
        size_t i, m;

        m = minimum(datlen, sizeof st->buf);
        for (i = 0; i < m; i++)
            st->buf[i] ^= dat[i];

        memset(dat, 0, datlen);
    }

    /* immediately reinit for backtracking resistance */
    st->crypt_reinit(st);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x518(%rax), %rax
movq -0x8(%rbp), %rdi
callq *%rax
cmpq $0x0, -0x10(%rbp)
je 0x161f
cmpq $0x400, -0x18(%rbp)     # imm = 0x400
jae 0x15c0
movq -0x18(%rbp), %rax
movq %rax, -0x30(%rbp)
jmp 0x15cb
movl $0x400, %eax            # imm = 0x400
movq %rax, -0x30(%rbp)
jmp 0x15cb
movq -0x30(%rbp), %rax
movq %rax, -0x28(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x28(%rbp), %rax
jae 0x1610
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movzbl (%rax,%rcx), %esi
movq -0x8(%rbp), %rax
movq -0x20(%rbp), %rcx
movzbl (%rax,%rcx), %edx
xorl %esi, %edx
movb %dl, (%rax,%rcx)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x15db
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rdx
xorl %esi, %esi
callq 0x1060
movq -0x8(%rbp), %rax
movq 0x520(%rax), %rax
movq -0x8(%rbp), %rdi
callq *%rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/opencoff[P]crypto-rand/cryptorand.c
// Function: crypto_rand_buf
void
crypto_rand_buf(crypto_rand_state* st, void *buf, size_t n)
{
    uint8_t *end = st->buf + sizeof st->buf;

    _rs_stir_if_needed(st, n);
    while (n > 0) {
        size_t avail = end - st->ptr;
        if (avail > 0) {
            size_t m = minimum(n, avail);

            memcpy(buf, st->ptr, m);

            buf     += m;
            n       -= m;
            st->ptr += m;
        } else 
            _rs_rekey(st, NULL, 0);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
addq $0x400, %rax            # imm = 0x400
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x1730
cmpq $0x0, -0x18(%rbp)
jbe 0x171b
movq -0x20(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x400(%rcx), %rcx
subq %rcx, %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jbe 0x1706
movq -0x18(%rbp), %rax
cmpq -0x28(%rbp), %rax
jae 0x16ab
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0x16b3
movq -0x28(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x400(%rax), %rsi
movq -0x30(%rbp), %rdx
callq 0x1090
movq -0x30(%rbp), %rax
addq -0x10(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x30(%rbp), %rcx
movq -0x18(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x18(%rbp)
movq -0x30(%rbp), %rcx
movq -0x8(%rbp), %rax
addq 0x400(%rax), %rcx
movq %rcx, 0x400(%rax)
jmp 0x1716
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
movq %rdx, %rsi
callq 0x1580
jmp 0x166f
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)