LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/mbitsnbites[P]SoftFP/softfloat.c
// Function: float64_to_uint32_round_to_zero
uint32 float64_to_uint32_round_to_zero(float64 a, float_status *status)
{
    uint64_t v;
    uint32 res;
    int old_exc_flags = get_float_exception_flags(status);

    v = float64_to_uint64_round_to_zero(a, status);
    if (v > 0xffffffff) {
        res = 0xffffffff;
    } else {
        return v;
    }
    set_float_exception_flags(old_exc_flags, status);
    float_raise(float_flag_invalid, status);
    return res;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movb 0x1(%rsi), %r14b
movb 0x2(%rsi), %bpl
movb $0x3, 0x1(%rsi)
callq 0x142e5
movb %r14b, 0x1(%rbx)
movq %rax, %rcx
shrq $0x20, %rcx
je 0x1441e
orb $0x1, %bpl
movb %bpl, 0x2(%rbx)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/mbitsnbites[P]SoftFP/softfloat.c
// Function: float64_to_uint64_round_to_zero
uint64_t float64_to_uint64_round_to_zero(float64 a, float_status *status)
{
    signed char current_rounding_mode = status->float_rounding_mode;
    set_float_rounding_mode(float_round_to_zero, status);
    int64_t v = float64_to_uint64(a, status);
    set_float_rounding_mode(current_rounding_mode, status);
    return v;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rsi, %rbx
movb 0x1(%rsi), %bpl
movb $0x3, 0x1(%rsi)
callq 0x142e5
movb %bpl, 0x1(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/mbitsnbites[P]SoftFP/softfloat.c
// Function: float64_to_int16
int_fast16_t float64_to_int16(float64 a, float_status *status)
{
    int64_t v;
    int_fast16_t res;
    int old_exc_flags = get_float_exception_flags(status);

    v = float64_to_int32(a, status);
    if (v < -0x8000) {
        res = -0x8000;
    } else if (v > 0x7fff) {
        res = 0x7fff;
    } else {
        return v;
    }

    set_float_exception_flags(old_exc_flags, status);
    float_raise(float_flag_invalid, status);
    return res;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rsi, %rbx
movb 0x2(%rsi), %bpl
callq 0xcded
movl %eax, %ecx
movq $-0x8000, %rax          # imm = 0x8000
cmpl $0xffff8000, %ecx       # imm = 0xFFFF8000
jl 0x1446e
movl $0x7fff, %eax           # imm = 0x7FFF
cmpl $0x8000, %ecx           # imm = 0x8000
jl 0x14478
orb $0x1, %bpl
movb %bpl, 0x2(%rbx)
jmp 0x1447b
movslq %ecx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/mbitsnbites[P]SoftFP/softfloat.c
// Function: float64_to_uint16
uint_fast16_t float64_to_uint16(float64 a, float_status *status)
{
    int64_t v;
    uint_fast16_t res;
    int old_exc_flags = get_float_exception_flags(status);

    v = float64_to_int32(a, status);
    if (v < 0) {
        res = 0;
    } else if (v > 0xffff) {
        res = 0xffff;
    } else {
        return v;
    }

    set_float_exception_flags(old_exc_flags, status);
    float_raise(float_flag_invalid, status);
    return res;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rsi, %rbx
movb 0x2(%rsi), %bpl
callq 0xcded
testl %eax, %eax
js 0x144a8
movl %eax, %ecx
movl $0xffff, %eax           # imm = 0xFFFF
cmpl $0x10000, %ecx          # imm = 0x10000
jge 0x144aa
movl %ecx, %eax
jmp 0x144b2
xorl %eax, %eax
orb $0x1, %bpl
movb %bpl, 0x2(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/mbitsnbites[P]SoftFP/softfloat.c
// Function: float64_to_uint16_round_to_zero
uint_fast16_t float64_to_uint16_round_to_zero(float64 a, float_status *status)
{
    int64_t v;
    uint_fast16_t res;
    int old_exc_flags = get_float_exception_flags(status);

    v = float64_to_int64_round_to_zero(a, status);
    if (v < 0) {
        res = 0;
    } else if (v > 0xffff) {
        res = 0xffff;
    } else {
        return v;
    }
    set_float_exception_flags(old_exc_flags, status);
    float_raise(float_flag_invalid, status);
    return res;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rsi, %rbx
movb 0x2(%rsi), %bpl
callq 0xd116
testq %rax, %rax
js 0x144dc
movl $0xffff, %ecx           # imm = 0xFFFF
cmpq $0x10000, %rax          # imm = 0x10000
jge 0x144de
jmp 0x144e9
xorl %ecx, %ecx
orb $0x1, %bpl
movb %bpl, 0x2(%rbx)
movq %rcx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/mbitsnbites[P]SoftFP/softfloat.c
// Function: float64_compare_quiet
static inline int floatx80_compare_internal(floatx80 a, floatx80 b,
                                            int is_quiet, float_status *status)
{
    flag aSign, bSign;

    if (( ( extractFloatx80Exp( a ) == 0x7fff ) &&
          ( extractFloatx80Frac( a )<<1 ) ) ||
        ( ( extractFloatx80Exp( b ) == 0x7fff ) &&
          ( extractFloatx80Frac( b )<<1 ) )) {
        if (!is_quiet ||
            floatx80_is_signaling_nan( a ) ||
            floatx80_is_signaling_nan( b ) ) {
            float_raise(float_flag_invalid, status);
        }
        return float_relation_unordered;
    }
    aSign = extractFloatx80Sign( a );
    bSign = extractFloatx80Sign( b );
    if ( aSign != bSign ) {

        if ( ( ( (uint16_t) ( ( a.high | b.high ) << 1 ) ) == 0) &&
             ( ( a.low | b.low ) == 0 ) ) {
            /* zero case */
            return float_relation_equal;
        } else {
            return 1 - (2 * aSign);
        }
    } else {
        if (a.low == b.low && a.high == b.high) {
            return float_relation_equal;
        } else {
            return 1 - 2 * (aSign ^ ( lt128( a.high, a.low, b.high, b.low ) ));
        }
    }
}

// Assembly:
movabsq $0x7ff0000000000000, %rax # imm = 0x7FF0000000000000
movabsq $0xfffffffffffff, %rcx  # imm = 0xFFFFFFFFFFFFF
movb 0x5(%rdx), %r8b
testb %r8b, %r8b
je 0x147d0
testq %rax, %rdi
setne %r9b
testq %rcx, %rdi
sete %r10b
orb %r9b, %r10b
jne 0x147d0
orb $0x40, 0x2(%rdx)
movabsq $-0x8000000000000000, %r9 # imm = 0x8000000000000000
andq %r9, %rdi
testb %r8b, %r8b
je 0x147f9
testq %rax, %rsi
setne %r8b
testq %rcx, %rsi
sete %r9b
orb %r8b, %r9b
jne 0x147f9
orb $0x40, 0x2(%rdx)
movabsq $-0x8000000000000000, %r8 # imm = 0x8000000000000000
andq %r8, %rsi
movq %rdi, %r8
notq %r8
testq %r8, %rax
sete %r8b
testq %rcx, %rdi
setne %r9b
testb %r9b, %r8b
jne 0x1484e
movq %rsi, %r8
notq %r8
testq %r8, %rax
setne %r8b
testq %rcx, %rsi
sete %cl
orb %r8b, %cl
je 0x1484e
movq %rdi, %rax
shrq $0x3f, %rax
movq %rsi, %rcx
shrq $0x3f, %rcx
cmpq %rcx, %rax
jne 0x1489e
cmpq %rsi, %rdi
je 0x148be
setb %cl
movzbl %cl, %ecx
xorl %eax, %ecx
addl %ecx, %ecx
jmp 0x148b6
movabsq $0x7ff8000000000000, %rcx # imm = 0x7FF8000000000000
movq %rdi, %r8
andq %rcx, %r8
cmpq %rax, %r8
sete %r8b
shlq $0xd, %rdi
setne %dil
testb %dil, %r8b
jne 0x14894
movabsq $0x7ffffffffffff, %rdi  # imm = 0x7FFFFFFFFFFFF
andq %rsi, %rcx
cmpq %rax, %rcx
setne %al
testq %rdi, %rsi
sete %cl
orb %al, %cl
movl $0x2, %eax
jne 0x148bd
orb $0x1, 0x2(%rdx)
movl $0x2, %eax
retq
orq %rdi, %rsi
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
decq %rcx
testq %rcx, %rsi
je 0x148be
leal (%rax,%rax), %ecx
movl $0x1, %eax
subl %ecx, %eax
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/mbitsnbites[P]SoftFP/softfloat.c
// Function: float32_scalbn
float32 float32_scalbn(float32 a, int n, float_status *status)
{
    flag aSign;
    int16_t aExp;
    uint32_t aSig;

    a = float32_squash_input_denormal(a, status);
    aSig = extractFloat32Frac( a );
    aExp = extractFloat32Exp( a );
    aSign = extractFloat32Sign( a );

    if ( aExp == 0xFF ) {
        if ( aSig ) {
            return propagateFloat32NaN(a, a, status);
        }
        return a;
    }
    if (aExp != 0) {
        aSig |= 0x00800000;
    } else if (aSig == 0) {
        return a;
    } else {
        aExp++;
    }

    if (n > 0x200) {
        n = 0x200;
    } else if (n < -0x200) {
        n = -0x200;
    }

    aExp += n - 1;
    aSig <<= 7;
    return normalizeRoundAndPackFloat32(aSign, aExp, aSig, status);
}

// Assembly:
movq %rdx, %rax
cmpb $0x0, 0x5(%rdx)
je 0x155fb
testl $0x7f800000, %edi       # imm = 0x7F800000
setne %cl
testl $0x7fffff, %edi         # imm = 0x7FFFFF
sete %dl
orb %cl, %dl
jne 0x155fb
orb $0x40, 0x2(%rax)
andl $0x80000000, %edi       # imm = 0x80000000
movl %edi, %edx
andl $0x7fffff, %edx         # imm = 0x7FFFFF
movl %edi, %ecx
shrl $0x17, %ecx
testb %cl, %cl
je 0x15627
movzbl %cl, %r8d
cmpl $0xff, %r8d
jne 0x15633
testl %edx, %edx
je 0x15630
movl %edi, %esi
movq %rax, %rdx
jmp 0xaeae
movl $0x1, %ecx
testl %edx, %edx
jne 0x1563c
movl %edi, %eax
retq
movzbl %cl, %ecx
orl $0x800000, %edx         # imm = 0x800000
shrl $0x1f, %edi
cmpl $0xfffffe01, %esi       # imm = 0xFFFFFE01
movl $0xfffffe00, %r8d       # imm = 0xFFFFFE00
cmovgel %esi, %r8d
decl %r8d
cmpl $0x201, %esi            # imm = 0x201
movl $0x1ff, %esi            # imm = 0x1FF
cmovll %r8d, %esi
addl %ecx, %esi
shll $0x7, %edx
movswq %si, %rsi
bsrl %edx, %ecx
xorl $0x1f, %ecx
decb %cl
movzbl %cl, %ecx
subq %rcx, %rsi
shll %cl, %edx
movzbl %dil, %edi
movq %rax, %rcx
jmp 0x9e9b
// File: /workspace/github_c_makefile_star2_O1/mbitsnbites[P]SoftFP/softfloat.c
// Function: float64_scalbn
float64 float64_scalbn(float64 a, int n, float_status *status)
{
    flag aSign;
    int16_t aExp;
    uint64_t aSig;

    a = float64_squash_input_denormal(a, status);
    aSig = extractFloat64Frac( a );
    aExp = extractFloat64Exp( a );
    aSign = extractFloat64Sign( a );

    if ( aExp == 0x7FF ) {
        if ( aSig ) {
            return propagateFloat64NaN(a, a, status);
        }
        return a;
    }
    if (aExp != 0) {
        aSig |= LIT64( 0x0010000000000000 );
    } else if (aSig == 0) {
        return a;
    } else {
        aExp++;
    }

    if (n > 0x1000) {
        n = 0x1000;
    } else if (n < -0x1000) {
        n = -0x1000;
    }

    aExp += n - 1;
    aSig <<= 10;
    return normalizeRoundAndPackFloat64(aSign, aExp, aSig, status);
}

// Assembly:
movq %rdx, %rax
movabsq $0xfffffffffffff, %rcx  # imm = 0xFFFFFFFFFFFFF
cmpb $0x0, 0x5(%rdx)
je 0x156c6
movabsq $0x7ff0000000000000, %rdx # imm = 0x7FF0000000000000
testq %rdx, %rdi
setne %dl
testq %rcx, %rdi
sete %r8b
orb %dl, %r8b
jne 0x156c6
orb $0x40, 0x2(%rax)
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
andq %rdx, %rdi
movq %rdi, %rdx
andq %rcx, %rdx
movq %rdi, %r8
shrq $0x34, %r8
andq $0x7ff, %r8             # imm = 0x7FF
je 0x156f5
cmpl $0x7ff, %r8d            # imm = 0x7FF
jne 0x15704
testq %rdx, %rdx
je 0x15700
movq %rdi, %rsi
movq %rax, %rdx
jmp 0xdb26
movl $0x1, %r8d
testq %rdx, %rdx
jne 0x1570a
movq %rdi, %rax
retq
addq %rcx, %rdx
incq %rdx
shrq $0x3f, %rdi
cmpl $0xfffff001, %esi       # imm = 0xFFFFF001
movl $0xfffff000, %ecx       # imm = 0xFFFFF000
cmovgel %esi, %ecx
decl %ecx
cmpl $0x1001, %esi           # imm = 0x1001
movl $0xfff, %esi            # imm = 0xFFF
cmovll %ecx, %esi
addl %r8d, %esi
shlq $0xa, %rdx
movswq %si, %rsi
bsrq %rdx, %rcx
xorq $0x3f, %rcx
decq %rcx
subq %rcx, %rsi
shlq %cl, %rdx
movzbl %dil, %edi
movq %rax, %rcx
jmp 0xa1a9
// File: /workspace/github_c_makefile_star2_O1/mbitsnbites[P]SoftFP/softfloat.c
// Function: floatx80_scalbn
floatx80 floatx80_scalbn(floatx80 a, int n, float_status *status)
{
    flag aSign;
    int32_t aExp;
    uint64_t aSig;

    aSig = extractFloatx80Frac( a );
    aExp = extractFloatx80Exp( a );
    aSign = extractFloatx80Sign( a );

    if ( aExp == 0x7FFF ) {
        if ( aSig<<1 ) {
            return propagateFloatx80NaN(a, a, status);
        }
        return a;
    }

    if (aExp == 0) {
        if (aSig == 0) {
            return a;
        }
        aExp++;
    }

    if (n > 0x10000) {
        n = 0x10000;
    } else if (n < -0x10000) {
        n = -0x10000;
    }

    aExp += n;
    return normalizeRoundAndPackFloatx80(status->floatx80_rounding_precision,
                                         aSign, aExp, aSig, 0, status);
}

// Assembly:
pushq %rax
movq %rcx, %r9
movq %rdi, %rax
movl %esi, %edi
andl $0x7fff, %edi           # imm = 0x7FFF
je 0x1578c
cmpl $0x7fff, %edi           # imm = 0x7FFF
jne 0x15796
leaq (,%rax,2), %rcx
testq %rcx, %rcx
je 0x157ce
movq %rax, %rdi
movq %rax, %rdx
movl %esi, %ecx
movq %r9, %r8
callq 0xfecb
jmp 0x157cc
movl $0x1, %edi
testq %rax, %rax
je 0x157ce
movzwl %si, %esi
shrl $0xf, %esi
cmpl $0xffff0001, %edx       # imm = 0xFFFF0001
movl $0xffff0000, %ecx       # imm = 0xFFFF0000
cmovgel %edx, %ecx
movl $0x10000, %edx          # imm = 0x10000
cmpl %edx, %ecx
cmovgel %edx, %ecx
addl %edi, %ecx
movsbl 0x3(%r9), %edi
movzbl %sil, %esi
movl %ecx, %edx
movq %rax, %rcx
xorl %r8d, %r8d
callq 0x11055
movl %edx, %esi
movl %esi, %edx
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/mbitsnbites[P]SoftFP/softfloat.c
// Function: float128_scalbn
float128 float128_scalbn(float128 a, int n, float_status *status)
{
    flag aSign;
    int32_t aExp;
    uint64_t aSig0, aSig1;

    aSig1 = extractFloat128Frac1( a );
    aSig0 = extractFloat128Frac0( a );
    aExp = extractFloat128Exp( a );
    aSign = extractFloat128Sign( a );
    if ( aExp == 0x7FFF ) {
        if ( aSig0 | aSig1 ) {
            return propagateFloat128NaN(a, a, status);
        }
        return a;
    }
    if (aExp != 0) {
        aSig0 |= LIT64( 0x0001000000000000 );
    } else if (aSig0 == 0 && aSig1 == 0) {
        return a;
    } else {
        aExp++;
    }

    if (n > 0x10000) {
        n = 0x10000;
    } else if (n < -0x10000) {
        n = -0x10000;
    }

    aExp += n - 1;
    return normalizeRoundAndPackFloat128( aSign, aExp, aSig0, aSig1
                                         , status);

}

// Assembly:
pushq %rax
movq %rcx, %r8
movl %edx, %ecx
movq %rsi, %r9
movq %rdi, %rax
movabsq $0xffffffffffff, %rsi   # imm = 0xFFFFFFFFFFFF
movq %r9, %rdx
andq %rsi, %rdx
movq %r9, %rdi
shrq $0x30, %rdi
andl $0x7fff, %edi           # imm = 0x7FFF
je 0x1581d
cmpl $0x7fff, %edi           # imm = 0x7FFF
jne 0x1582c
orq %rax, %rdx
je 0x15869
movq %rax, %rdi
movq %r9, %rsi
movq %rax, %rdx
movq %r9, %rcx
callq 0x12261
jmp 0x15866
movl $0x1, %edi
movq %rdx, %rsi
orq %rax, %rsi
jne 0x15832
jmp 0x15869
addq %rsi, %rdx
incq %rdx
shrq $0x3f, %r9
cmpl $0xffff0001, %ecx       # imm = 0xFFFF0001
movl $0xffff0000, %r10d      # imm = 0xFFFF0000
cmovgel %ecx, %r10d
decl %r10d
cmpl $0x10001, %ecx          # imm = 0x10001
movl $0xffff, %esi           # imm = 0xFFFF
cmovll %r10d, %esi
addl %edi, %esi
movzbl %r9b, %edi
movq %rax, %rcx
callq 0xa33b
movq %rdx, %r9
movq %r9, %rdx
popq %rcx
retq
nop
// File: /workspace/github_c_makefile_star2_O1/simh[P]simtools/converters/noff/noff.c
// Function: main
int main (int argc, char *argv[])
{
int i, c, ffc;
char *ppos, oline[256], oname[256];
FILE *ifile, *ofile;

if ((argc < 2) || (argv[0] == NULL)) {
	printf ("Usage is: asc file [file...]\n");
	exit (0);  }

for (i = 1; i < argc; i++) {
	strcpy (oname, argv[i]);
        if (ppos = strrchr (oname, '.')) strcpy (ppos, ".new");
            else strcat (oname, ".new");
	ifile = fopen (argv[i], "ra");
	if (ifile == NULL) {
	    printf ("Error opening file: %s\n", argv[i]);
	    exit (0);  }
	ofile = fopen (oname, "wa");
	if (ofile == NULL) {
	    printf ("Error opening file: %s\n", oname);
	    exit (0);  }

	printf ("Processing file %s\n", argv[i]);
	for (ffc = 0; (c = fgetc (ifile)) != EOF; ) {
	    if (c == '\f') ffc++;
	    else fputc (c, ofile);
	    }
	if (ffc) printf ("Form feeds removed: %d\n", ffc);
	fclose (ifile);
	fclose (ofile);
	}
return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
cmpl $0x2, %edi
jl 0x1322
movq %rsi, %rbx
cmpq $0x0, (%rsi)
je 0x1322
movl %edi, %eax
movq %rax, 0x8(%rsp)
movl $0x1, %r13d
leaq 0x10(%rsp), %r14
movq (%rbx,%r13,8), %rsi
movq %r14, %rdi
callq 0x1030
movq %r14, %rdi
movl $0x2e, %esi
callq 0x1080
testq %rax, %rax
je 0x122f
movb $0x0, 0x4(%rax)
movl $0x77656e2e, (%rax)     # imm = 0x77656E2E
jmp 0x1244
movq %r14, %rdi
callq 0x1060
movl $0x77656e2e, 0x10(%rsp,%rax) # imm = 0x77656E2E
movb $0x0, 0x14(%rsp,%rax)
movq (%rbx,%r13,8), %rdi
leaq 0xdba(%rip), %rsi       # 0x2009
callq 0x10b0
testq %rax, %rax
je 0x12fb
movq %rax, %rbp
movq %r14, %rdi
leaq 0xdba(%rip), %rsi       # 0x2024
callq 0x10b0
testq %rax, %rax
je 0x1308
movq %rax, %r15
movq (%rbx,%r13,8), %rsi
xorl %r12d, %r12d
leaq 0xd9e(%rip), %rdi       # 0x2027
xorl %eax, %eax
callq 0x1070
movq %rbp, %rdi
callq 0x1090
cmpl $-0x1, %eax
je 0x12b3
cmpl $0xc, %eax
je 0x12ae
movl %eax, %edi
movq %r15, %rsi
callq 0x10a0
jmp 0x1290
incl %r12d
jmp 0x1290
testl %r12d, %r12d
je 0x12c9
leaq 0xd7c(%rip), %rdi       # 0x203b
movl %r12d, %esi
xorl %eax, %eax
callq 0x1070
movq %rbp, %rdi
callq 0x1050
movq %r15, %rdi
callq 0x1050
incq %r13
cmpq 0x8(%rsp), %r13
jne 0x1205
xorl %eax, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rbx,%r13,8), %rsi
leaq 0xd06(%rip), %rdi       # 0x200c
jmp 0x1314
leaq 0xcfd(%rip), %rdi       # 0x200c
leaq 0x10(%rsp), %rsi
xorl %eax, %eax
callq 0x1070
xorl %edi, %edi
callq 0x10c0
leaq 0xd2a(%rip), %rdi       # 0x2053
callq 0x1040
jmp 0x131b
// File: /workspace/github_c_makefile_star2_O1/vanhauser-thc[P]vulntest/strcpy2.c
// Function: main
int main(int argc, char *argv[]) {
  char buf[16] = "";
  char *in = argv[1], *out = buf;

  if (argc > 1) {
    while (*in != 0) {
      *out++ = *in++;
    }
    *out = 0;
  }
  (void)printf(buf);

  return 0;
}

// Assembly:
subq $0x18, %rsp
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
cmpl $0x2, %edi
jl 0x1172
movq 0x8(%rsi), %rax
movb (%rax), %dl
testb %dl, %dl
je 0x116c
incq %rax
movq %rsp, %rcx
movb %dl, (%rcx)
incq %rcx
movb (%rax), %dl
incq %rax
testb %dl, %dl
jne 0x115c
jmp 0x116f
movq %rsp, %rcx
movb $0x0, (%rcx)
movq %rsp, %rdi
xorl %eax, %eax
callq 0x1030
xorl %eax, %eax
addq $0x18, %rsp
retq
// File: /workspace/github_c_makefile_star2_O1/giometti[P]mastering_UNIX_programming/chapter_04/access.c
// Function: main
int main(int argc, char *argv[])
{
	int ret;

	if (argc < 2) {
		fprintf(stderr, "usage: %s <file>\n", argv[0]);
		return -1;
	}

	printf("%s: ", argv[1]);
	ret = access(argv[1], F_OK);
	if (ret < 0) {
		perror("access");
		return -1;
	}
	ret = access(argv[1], R_OK);
	if (ret == 0)
		printf("r");
	ret = access(argv[1], W_OK);
	if (ret == 0)
		printf("w");
	ret = access(argv[1], X_OK);
	if (ret == 0)
		printf("x");
	printf("\n");

	return 0;
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
cmpl $0x1, %edi
jle 0x122c
movq 0x8(%rbx), %rsi
leaq 0xe62(%rip), %rdi       # 0x2016
xorl %eax, %eax
callq 0x1040
movq 0x8(%rbx), %rdi
xorl %esi, %esi
callq 0x1060
testl %eax, %eax
js 0x1236
movq 0x8(%rbx), %rdi
movl $0x4, %esi
callq 0x1060
testl %eax, %eax
jne 0x11e6
movl $0x72, %edi
callq 0x1030
movq 0x8(%rbx), %rdi
movl $0x2, %esi
callq 0x1060
testl %eax, %eax
jne 0x1202
movl $0x77, %edi
callq 0x1030
movq 0x8(%rbx), %rdi
movl $0x1, %esi
callq 0x1060
testl %eax, %eax
jne 0x121e
movl $0x78, %edi
callq 0x1030
movl $0xa, %edi
callq 0x1030
xorl %eax, %eax
popq %rbx
retq
movq %rbx, %rdi
callq 0x1090
jmp 0x1242
leaq 0xdde(%rip), %rdi       # 0x201b
callq 0x1070
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x122a
// File: /workspace/github_c_makefile_star2_O1/antonblanchard[P]will-it-scale/tests/mmap2.c
// Function: testcase
void testcase(unsigned long long *iterations, unsigned long nr)
{
	char tmpfile[] = "/tmp/willitscale.XXXXXX";
	int fd = mkstemp(tmpfile);

	assert(ftruncate(fd, MEMSIZE) == 0);
	unlink(tmpfile);

	while (1) {
		char *c = mmap(NULL, MEMSIZE, PROT_READ|PROT_WRITE,
			       MAP_PRIVATE, fd, 0);
		assert(c != MAP_FAILED);
		munmap(c, MEMSIZE);

		(*iterations)++;
	}
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movaps 0x714(%rip), %xmm0      # 0x3300
movq %rsp, %rdi
movaps %xmm0, (%rdi)
movabsq $0x5858585858582e, %rax # imm = 0x5858585858582E
movq %rax, 0x10(%rdi)
callq 0x21c0
movl %eax, %ebp
movl $0x8000000, %esi        # imm = 0x8000000
movl %eax, %edi
callq 0x2110
testl %eax, %eax
jne 0x2c53
movq %rsp, %rdi
callq 0x2080
movl $0x8000000, %esi        # imm = 0x8000000
xorl %edi, %edi
movl $0x3, %edx
movl $0x2, %ecx
movl %ebp, %r8d
xorl %r9d, %r9d
callq 0x20e0
cmpq $-0x1, %rax
je 0x2c72
movl $0x8000000, %esi        # imm = 0x8000000
movq %rax, %rdi
callq 0x21d0
incq (%rbx)
jmp 0x2c1f
leaq 0x631(%rip), %rdi       # 0x328b
leaq 0x646(%rip), %rsi       # 0x32a7
leaq 0x64d(%rip), %rcx       # 0x32b5
movl $0x10, %edx
callq 0x2120
leaq 0x66f(%rip), %rdi       # 0x32e8
leaq 0x627(%rip), %rsi       # 0x32a7
leaq 0x62e(%rip), %rcx       # 0x32b5
movl $0x16, %edx
callq 0x2120
// File: /workspace/github_c_makefile_star2_O1/Sidd0107[P]EXT2-File-System/a3helper.c
// Function: combine_path_and_file
char *combine_path_and_file(char *path, char *file_name){
	int copy_location = 0;
	if(path[strlen(path) - 1] != '/'){
		copy_location = 1;
	}
	char *string = malloc((strlen(path) + strlen(file_name) + 1 + copy_location) * sizeof(char));
	if(!string){
		perror("malloc");
		exit(1);
	}
	memcpy(string, path, strlen(path));
	string[strlen(path)] = '/';
	memcpy(string + strlen(path) + copy_location, file_name, strlen(file_name));
	string[strlen(path) + strlen(file_name) + copy_location] = '\0';
	return string;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x1070
movq %rax, %r12
xorl %r13d, %r13d
cmpb $0x2f, -0x1(%r14,%rax)
setne %r13b
movq %rbx, %rdi
callq 0x1070
addq %r12, %rax
leaq (%rax,%r13), %rdi
incq %rdi
callq 0x10f0
testq %rax, %rax
je 0x156d
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x10e0
movq %r14, %rdi
callq 0x1070
movb $0x2f, (%r15,%rax)
leaq (%rax,%r13), %r12
addq %r15, %r12
movq %rbx, %rdi
callq 0x1070
movq %r12, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x10e0
movq %r14, %rdi
callq 0x1070
movq %rax, %r14
movq %rbx, %rdi
callq 0x1070
addq %r14, %rax
addq %r15, %rax
movb $0x0, (%r13,%rax)
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1150
// File: /workspace/github_c_makefile_star2_O1/Sidd0107[P]EXT2-File-System/a3helper.c
// Function: file_exists
int file_exists(char *path, char *inode_base, char *file_name){
	char *string = combine_path_and_file(path, file_name);
	struct basic_fileinfo fileinfo = find_file(string, inode_base);
	free(string);
	return fileinfo.inode;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdx, %rsi
callq 0x14bc
movq %rax, %r14
movq %rax, %rdi
movq %rbx, %rsi
callq 0x15a8
movq %rax, %rbx
shrq $0x20, %rbx
movq %r14, %rdi
callq 0x1030
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Sidd0107[P]EXT2-File-System/a3helper.c
// Function: find_file
struct basic_fileinfo find_file(char *path, char *inode_base){
	struct basic_fileinfo file_info;
	file_info.type = '\0'; //default
	file_info.inode = 0;
	if(path[0] == '\0'){
		return file_info; //perhaps an error goes here?
	}
	else if (path[0] == '/' && path[1] == '\0'){
		file_info.type = 'd';
		file_info.inode = 2;
		return file_info;
	}
	struct parsed_filename *directory_linked_list = parse_directory(path);
	if(!directory_linked_list){
		return file_info;
	}
	return search_directory(inode_base, 2, directory_linked_list);
}

// Assembly:
movzbl (%rdi), %eax
testl %eax, %eax
je 0x15f8
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rsi, %rbx
cmpl $0x2f, %eax
jne 0x15c3
cmpb $0x0, 0x1(%rdi)
je 0x1606
callq 0x1624
testq %rax, %rax
je 0x1600
movq %rbx, %rdi
movl $0x2, %esi
movq %rax, %rdx
callq 0x16e8
movq %rax, %rcx
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
andq %rax, %rdx
movzbl %cl, %eax
andl $0xffffff00, %ecx       # imm = 0xFFFFFF00
jmp 0x1617
movq %rax, %rdx
movq %rax, %rcx
jmp 0x161d
xorl %eax, %eax
xorl %edx, %edx
jmp 0x1615
movabsq $0x200000000, %rdx      # imm = 0x200000000
movl $0x64, %eax
xorl %ecx, %ecx
addq $0x8, %rsp
popq %rbx
popq %rbp
orq %rdx, %rax
orq %rcx, %rax
retq
// File: /workspace/github_c_makefile_star2_O1/Sidd0107[P]EXT2-File-System/a3helper.c
// Function: parse_directory
struct parsed_filename *parse_directory(char *path){
	if (path[0] != '/' || path[1] == '\0'){
		return NULL;
	}
	
	int i = 1;
	while (path[i] != '\0' && path[i] != '/'){
		i++;
	}
	
	struct parsed_filename *current_directory_filename = malloc(sizeof(struct parsed_filename));
	
	if(!current_directory_filename){
		perror("malloc for current directory filename");
   	}
	
	current_directory_filename -> file_name = malloc((i)*sizeof(char));
	if(!current_directory_filename -> file_name){
		perror("malloc for string in current directory struct");
		exit(1);
	}
	
	strncpy(current_directory_filename -> file_name, path + 1, i-1);
	current_directory_filename -> file_name[i-1] = '\0';
	
	current_directory_filename -> next = parse_directory(path + i);
	
	return current_directory_filename;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpb $0x2f, (%rdi)
jne 0x1671
movq %rdi, %rbx
cmpb $0x0, 0x1(%rdi)
je 0x1671
leaq 0x1(%rbx), %rax
movq %rax, -0x30(%rbp)
movl $0x1, %r12d
xorl %r14d, %r14d
movabsq $0x100000000, %rax      # imm = 0x100000000
movzbl (%rbx,%r12), %ecx
testl %ecx, %ecx
je 0x1676
cmpl $0x2f, %ecx
je 0x1676
incq %r12
addq %rax, %r14
jmp 0x165b
xorl %r13d, %r13d
jmp 0x16c3
movl $0x10, %edi
callq 0x10f0
movq %rax, %r13
testq %rax, %rax
je 0x16d5
movq %r12, %rdi
callq 0x10f0
movq %rax, (%r13)
testq %rax, %rax
je 0x16e3
movq %rax, %r15
addq %r12, %rbx
sarq $0x20, %r14
movq %rax, %rdi
movq -0x30(%rbp), %rsi
movq %r14, %rdx
callq 0x1050
movb $0x0, (%r15,%r14)
movq %rbx, %rdi
callq 0x1624
movq %rax, 0x8(%r13)
movq %r13, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x192f(%rip), %rdi      # 0x300b
callq 0x1110
jmp 0x1688
callq 0x1168
// File: /workspace/github_c_makefile_star2_O1/Sidd0107[P]EXT2-File-System/a3helper.c
// Function: get_block_from_inode
char *get_block_from_inode(char *inode_base, unsigned int inode_num, unsigned int inode_index){
	struct ext2_inode *current_inode;
	current_inode = get_inode(inode_base, inode_num);
	if (inode_index < 12){
		return get_block(disk, current_inode -> i_block[inode_index], 1024);
	}
	//assuming up to single indirect pointers!
	else{
		unsigned int *indirect_pointer_block = (unsigned int*) get_block(disk, current_inode -> i_block[12], 1024);
		return get_block(disk, indirect_pointer_block[inode_index - 12], 1024);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
decl %esi
shlq $0x7, %rsi
addq %rdi, %rsi
leaq 0x378c(%rip), %rax      # 0x50b8
movq (%rax), %rax
cmpl $0xb, %edx
ja 0x1940
movl %edx, %ecx
leaq (%rsi,%rcx,4), %rcx
addq $0x28, %rcx
jmp 0x1951
movl 0x58(%rsi), %ecx
shlq $0xa, %rcx
addq %rax, %rcx
addl $-0xc, %edx
leaq (%rcx,%rdx,4), %rcx
movl (%rcx), %ecx
shlq $0xa, %rcx
addq %rcx, %rax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Sidd0107[P]EXT2-File-System/a3helper.c
// Function: add_block_in_inode
int add_block_in_inode(struct ext2_inode *current_inode, char *block_bitmap, unsigned int inode_num){
	unsigned int new_inode_block_index = (current_inode -> i_size > 0)? ((((current_inode -> i_size) - 1) >> 10) + 1) : 0;
	if (new_inode_block_index >= 1024+12) {
		return -1;
	}
	int new_block = find_last_free_bit(block_bitmap, 128);
	if(new_block == -1){
		return -1;
	}
	set_bit(block_bitmap, new_block);
	if (new_inode_block_index <= 12) {
		current_inode -> i_block[new_inode_block_index] = new_block + 1;
		set_bit(block_bitmap, new_block);
	}
	if(new_inode_block_index == 12) {
		new_block = find_first_free_bit(block_bitmap, 0, 128);
		if(new_block == -1){
			unset_bit(block_bitmap, current_inode -> i_block[12] - 1);
			return -1;
		}
	}
	if(new_inode_block_index >= 12) {
		unsigned int *indirect_pointer_block = (unsigned int*) get_block(disk, current_inode -> i_block[12], 1024);
		indirect_pointer_block[new_inode_block_index - 12] = new_block + 1;
		set_bit(block_bitmap, new_block);
	}
	current_inode -> i_size += 1024;
	current_inode -> i_blocks += 2;
	return new_block + 1;
}

// Assembly:
movl 0x4(%rdi), %eax
leal -0x1(%rax), %ecx
shrl $0xa, %ecx
incl %ecx
xorl %r8d, %r8d
cmpl $0x1, %eax
cmovael %ecx, %r8d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl $0x40b, %r8d            # imm = 0x40B
ja 0x1a6d
movl $0x80, %edx
movl %edx, %ecx
shrl $0x3, %ecx
movzbl (%rsi,%rcx), %ecx
movl %edx, %r9d
andl $0x7, %r9d
btl %r9d, %ecx
jae 0x19a8
addl $-0x1, %edx
jb 0x1988
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
cmpl $-0x1, %edx
je 0x1a6d
leal 0x7(%rdx), %ecx
testl %edx, %edx
cmovnsl %edx, %ecx
sarl $0x3, %ecx
movslq %ecx, %r9
movl %edx, %ecx
andb $0x7, %cl
movl $0x1, %r10d
shll %cl, %r10d
orb %r10b, (%rsi,%r9)
cmpl $0xc, %r8d
ja 0x19e6
leal 0x1(%rdx), %ecx
movl %r8d, %r11d
movl %ecx, 0x28(%rdi,%r11,4)
orb %r10b, (%rsi,%r9)
cmpl $0xc, %r8d
jne 0x1a18
xorl %edx, %edx
movl %edx, %ecx
shrl $0x3, %ecx
movzbl (%rsi,%rcx), %ecx
movl %edx, %r9d
andl $0x7, %r9d
btl %r9d, %ecx
jae 0x1a13
incl %edx
cmpl $0x80, %edx
jne 0x19ee
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
cmpl $-0x1, %edx
je 0x1a6e
cmpl $0xc, %r8d
jb 0x1a5e
pushq %rbp
movq %rsp, %rbp
leaq 0x368f(%rip), %rax      # 0x50b8
movl 0x58(%rdi), %ecx
shlq $0xa, %rcx
addq (%rax), %rcx
leal 0x1(%rdx), %eax
movl %r8d, %r8d
movl %eax, -0x30(%rcx,%r8,4)
leal 0x7(%rdx), %eax
testl %edx, %edx
cmovnsl %edx, %eax
sarl $0x3, %eax
movl %edx, %ecx
andb $0x7, %cl
movl $0x1, %r8d
shll %cl, %r8d
cltq
orb %r8b, (%rsi,%rax)
popq %rbp
addl $0x400, 0x4(%rdi)       # imm = 0x400
addl $0x2, 0x1c(%rdi)
incl %edx
movl %edx, %eax
retq
movl 0x58(%rdi), %edx
leal -0x1(%rdx), %ecx
addl $0x6, %edx
testl %ecx, %ecx
cmovnsl %ecx, %edx
sarl $0x3, %edx
movslq %edx, %rdx
andb $0x7, %cl
movl $0x1, %edi
shll %cl, %edi
notb %dil
andb %dil, (%rsi,%rdx)
retq
// File: /workspace/github_c_makefile_star2_O1/Sidd0107[P]EXT2-File-System/a3helper.c
// Function: find_last_free_bit
int find_last_free_bit(char *bitmap, int num_bits){
	int i;
	for(i = num_bits; i >= 0; i--){
		if (!(*(bitmap+(i/8)) & (1<<(i%8)))){
			return i;
		}
	}
	return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %esi, %esi
js 0x1ac1
movl %esi, %ecx
shrl $0x3, %ecx
movzbl (%rdi,%rcx), %ecx
movl %esi, %edx
andl $0x7, %edx
btl %edx, %ecx
jae 0x1abf
leal -0x1(%rsi), %ecx
testl %esi, %esi
movl %ecx, %esi
jg 0x1aa1
jmp 0x1ac1
movl %esi, %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Sidd0107[P]EXT2-File-System/a3helper.c
// Function: find_first_free_bit
int find_first_free_bit(char *bitmap, int startbit, int bitmap_num_bits){
	int i;
	for (i = startbit; i < bitmap_num_bits; i++){
		if (!(*(bitmap+(i/8)) & (1<<(i%8)))){
			return i;
		}
	}
	return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %edx, %esi
jge 0x1b1b
leal 0x7(%rsi), %ecx
testl %esi, %esi
cmovnsl %esi, %ecx
sarl $0x3, %ecx
movslq %ecx, %rcx
movzbl (%rdi,%rcx), %ecx
movl %esi, %r8d
andl $0x7, %r8d
btl %r8d, %ecx
jae 0x1b19
incl %esi
cmpl %esi, %edx
jne 0x1af2
jmp 0x1b1b
movl %esi, %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Sidd0107[P]EXT2-File-System/a3helper.c
// Function: set_inode
void set_inode(struct ext2_inode *inode, unsigned int inode_num, unsigned int size, unsigned *blocks, int num_blocks, char *block_bitmap, char *inode_bitmap, unsigned int mode){
	set_bit(inode_bitmap, inode_num);
	unsigned int i;
	inode -> i_size = size;
	inode -> i_blocks = (inode -> i_size > 0)? 2*((inode -> i_size - 1)/ 1024) + 2: 0;
	if(inode -> i_blocks >= 25){
		inode -> i_blocks += 2;
	}
	inode -> i_mode = 0x1ff | mode;
	if(num_blocks > 12){
		inode -> i_block[12] = blocks[num_blocks - 1] + 1;
		set_bit(block_bitmap, blocks[num_blocks - 1]);
	}
	for(i = 0; i < ((num_blocks <= 12)? num_blocks : num_blocks - 1); i++){
		set_block_in_inode(inode, blocks[i] + 1, i, block_bitmap);
	}
	inode -> i_links_count = 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
movq %rcx, %rax
movl %esi, %ecx
leal -0x1(%rdx), %esi
shrl $0xa, %esi
xorl %r11d, %r11d
cmpl $0x1, %edx
leal 0x2(%rsi,%rsi), %r10d
cmovbl %r11d, %r10d
leal 0x7(%rcx), %esi
testl %ecx, %ecx
cmovnsl %ecx, %esi
movq 0x10(%rbp), %r11
sarl $0x3, %esi
andb $0x7, %cl
movl $0x1, %ebx
shll %cl, %ebx
movslq %esi, %rcx
orb %bl, (%r11,%rcx)
movl $0x1, %esi
movl %edx, 0x4(%rdi)
leal 0x2(%r10), %ecx
cmpl $0x19, %r10d
cmovbl %r10d, %ecx
movl %ecx, 0x1c(%rdi)
movl $0x1ff, %ecx            # imm = 0x1FF
orl 0x18(%rbp), %ecx
movw %cx, (%rdi)
cmpl $0xd, %r8d
jl 0x1bd3
movl %r8d, %ecx
movl -0x4(%rax,%rcx,4), %edx
incl %edx
movl %edx, 0x58(%rdi)
movl -0x4(%rax,%rcx,4), %ecx
leal 0x7(%rcx), %edx
testl %ecx, %ecx
cmovnsl %ecx, %edx
sarl $0x3, %edx
andb $0x7, %cl
shll %cl, %esi
movslq %edx, %rcx
orb %sil, (%r9,%rcx)
xorl %ecx, %ecx
cmpl $0xd, %r8d
setge %cl
subl %ecx, %r8d
je 0x1c49
leaq 0x28(%rdi), %rdx
movl %r8d, %esi
movq $-0x30, %r8
xorl %r10d, %r10d
leaq 0x34bf(%rip), %r11      # 0x50b8
cmpq $0xb, %r10
ja 0x1c05
leaq (%rdx,%r10,4), %rbx
jmp 0x1c12
movl 0x58(%rdi), %ebx
shlq $0xa, %rbx
addq (%r11), %rbx
addq %r8, %rbx
movl 0x30(%rax,%r8), %ecx
leal 0x1(%rcx), %r14d
leal 0x7(%rcx), %r15d
testl %ecx, %ecx
cmovnsl %ecx, %r15d
movl %r14d, (%rbx)
sarl $0x3, %r15d
andb $0x7, %cl
movl $0x1, %ebx
shll %cl, %ebx
movslq %r15d, %rcx
orb %bl, (%r9,%rcx)
incq %r10
addq $0x4, %r8
cmpq %r10, %rsi
jne 0x1bf9
movw $0x1, 0x1a(%rdi)
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Sidd0107[P]EXT2-File-System/a3helper.c
// Function: set_block_in_inode
void set_block_in_inode(struct ext2_inode* inode, unsigned block_number, unsigned inode_index, char *block_bitmap){
	if(inode_index < 12){
		inode -> i_block[inode_index] = block_number;
	}
	else{
		unsigned int* indirect_pointer_block = (unsigned int *) get_block(disk, inode -> i_block[12], 1024);
		indirect_pointer_block [inode_index - 12] = block_number;
	}
	set_bit(block_bitmap, block_number - 1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rcx, %rax
cmpl $0xb, %edx
ja 0x1c6e
movl %edx, %ecx
leaq (%rdi,%rcx,4), %rcx
addq $0x28, %rcx
jmp 0x1c86
leaq 0x3443(%rip), %rcx      # 0x50b8
movl 0x58(%rdi), %edi
shlq $0xa, %rdi
addq (%rcx), %rdi
addl $-0xc, %edx
leaq (%rdi,%rdx,4), %rcx
movl %esi, (%rcx)
leal -0x1(%rsi), %ecx
addl $0x6, %esi
testl %ecx, %ecx
cmovnsl %ecx, %esi
sarl $0x3, %esi
andb $0x7, %cl
movl $0x1, %edx
shll %cl, %edx
movslq %esi, %rcx
orb %dl, (%rax,%rcx)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Sidd0107[P]EXT2-File-System/a3helper.c
// Function: extract_filename
char *extract_filename(char *filename){
	int i = 0, last_separator = 0;
	while(filename[i] != '\0'){
		if(filename[i] == '/'){
			last_separator = i + 1;
		}
		i++;
	}
	char *file_name = malloc(strlen(filename + last_separator) + 1);
	if(!file_name){
		perror("malloc");
		exit(1);
	}
	memcpy(file_name, filename + last_separator, strlen(filename + last_separator) + 1);
	return file_name;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %eax, %eax
xorl %ecx, %ecx
movzbl (%rbx,%rax), %edx
cmpl $0x2f, %edx
je 0x1e8b
testl %edx, %edx
jne 0x1e8e
jmp 0x1e93
leal 0x1(%rax), %ecx
incq %rax
jmp 0x1e7c
movslq %ecx, %rax
addq %rax, %rbx
movq %rbx, %rdi
callq 0x1070
movq %rax, %r14
incq %r14
movq %r14, %rdi
callq 0x10f0
testq %rax, %rax
je 0x1ec6
movq %rax, %rdi
movq %rbx, %rsi
movq %r14, %rdx
popq %rbx
popq %r14
popq %rbp
jmp 0x10e0
callq 0x1180
// File: /workspace/github_c_makefile_star2_O1/Sidd0107[P]EXT2-File-System/a3helper.c
// Function: print_directory_contents
void print_directory_contents(char *inode_base, unsigned int inode_num){
	int i;
	struct ext2_inode *current_inode = get_inode(inode_base, inode_num);
	unsigned int block_num = current_inode->i_block[0];
	unsigned int cur_index_serviced = 0, cur_inode_index = 0;
	char *current_block = get_block(disk, block_num, 1024);
	struct ext2_dir_entry_2 *current = (struct ext2_dir_entry_2 *)current_block;

	while(cur_index_serviced < current_inode -> i_size){
		current = (struct ext2_dir_entry_2 *) (current_block + (cur_index_serviced % 1024));
		for(i = 0; i < current -> name_len; i++){
			printf("%c", current -> name[i]);
		}
		printf("\n");
		cur_index_serviced += current -> rec_len;
		if (cur_index_serviced < current_inode->i_size && cur_index_serviced % 1024 == 0){
			cur_inode_index++;
			current_block = get_block_from_inode(inode_base, inode_num, cur_inode_index);
		}
	}
}

// Assembly:
decl %esi
shlq $0x7, %rsi
cmpl $0x0, 0x4(%rdi,%rsi)
je 0x1fc7
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
leaq (%rdi,%rsi), %r12
leaq 0x28(%rdi,%rsi), %rax
movq %rax, -0x30(%rbp)
leaq 0x31b7(%rip), %rax      # 0x50b8
movl 0x28(%r12), %esi
shlq $0xa, %rsi
addq (%rax), %rsi
xorl %ebx, %ebx
xorl %r13d, %r13d
movl %r13d, %eax
andl $0x3ff, %eax            # imm = 0x3FF
leaq (%rsi,%rax), %r15
movq %rsi, -0x38(%rbp)
cmpb $0x0, 0x6(%rsi,%rax)
je 0x1f44
xorl %r14d, %r14d
movsbl 0x8(%r15,%r14), %edi
callq 0x1040
incq %r14
movzbl 0x6(%r15), %eax
cmpq %rax, %r14
jb 0x1f2c
movl $0xa, %edi
callq 0x1040
movzwl 0x4(%r15), %eax
addl %eax, %r13d
cmpl 0x4(%r12), %r13d
setae %al
testl $0x3ff, %r13d           # imm = 0x3FF
setne %cl
orb %al, %cl
jne 0x1f8a
leal 0x1(%rbx), %eax
leaq 0x3142(%rip), %rcx      # 0x50b8
movq (%rcx), %rsi
cmpl $0xb, %eax
ja 0x1f90
movl %eax, %ecx
movq -0x30(%rbp), %rdx
leaq (%rdx,%rcx,4), %rcx
jmp 0x1fa3
movq -0x38(%rbp), %rsi
jmp 0x1fae
movl 0x58(%r12), %ecx
shlq $0xa, %rcx
addq %rsi, %rcx
addl $-0xb, %ebx
leaq (%rcx,%rbx,4), %rcx
movl (%rcx), %ecx
shlq $0xa, %rcx
addq %rcx, %rsi
movl %eax, %ebx
cmpl 0x4(%r12), %r13d
jb 0x1f12
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Sidd0107[P]EXT2-File-System/a3helper.c
// Function: free_inode
void free_inode(struct ext2_inode *current_inode, void *disk, char *blockbitmap){
    unsigned int i_size = current_inode->i_size;
    unsigned int blocks = (i_size > 0)? ((i_size-1) / 1024) + 1: 0;
    int block = 0;
    for(block=0; block<blocks; block++){
        //free's indirect blocks
        if(block>=12){
            unsigned int* indirect_pointer_block = (unsigned int *) get_block(disk, current_inode->i_block[12], 1024);
            //indirect_pointer_block [inode_index - 12] = block_number;
            
             unset_bit(blockbitmap, indirect_pointer_block[block - 12] - 1);
             //free(indirect_pointer_block[block - 12]);
            
        }else{
            //free's direct blocks
            unset_bit(blockbitmap, current_inode->i_block[block] - 1);
            //free(current_inode->i_block[block-1]);
        }
        
    }
	if(blocks > 12){
		unset_bit(blockbitmap, current_inode->i_block[12] - 1);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
movl 0x4(%rdi), %ecx
leal -0x1(%rcx), %r8d
shrl $0xa, %r8d
incl %r8d
xorl %eax, %eax
cmpl $0x1, %ecx
cmovael %r8d, %eax
jb 0x2046
leaq 0x28(%rdi), %r8
cmpl $0x1, %eax
movl %eax, %r9d
adcl $0x0, %r9d
xorl %r10d, %r10d
movq %r8, %rcx
cmpq $0xc, %r10
jb 0x2012
movl 0x58(%rdi), %ecx
shlq $0xa, %rcx
addq %rsi, %rcx
leaq (%rcx,%r10,4), %rcx
addq $-0x30, %rcx
movl (%rcx), %r11d
leal -0x1(%r11), %ecx
addl $0x6, %r11d
testl %ecx, %ecx
cmovnsl %ecx, %r11d
sarl $0x3, %r11d
movslq %r11d, %r11
andb $0x7, %cl
movl $0x1, %ebx
shll %cl, %ebx
notb %bl
andb %bl, (%rdx,%r11)
incq %r10
addq $0x4, %r8
cmpq %r10, %r9
jne 0x1ff7
cmpl $0xd, %eax
jb 0x206f
movl 0x58(%rdi), %eax
leal -0x1(%rax), %ecx
addl $0x6, %eax
testl %ecx, %ecx
cmovnsl %ecx, %eax
sarl $0x3, %eax
cltq
andb $0x7, %cl
movl $0x1, %esi
shll %cl, %esi
notb %sil
andb %sil, (%rdx,%rax)
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O1/vampirefrog[P]x68ksjis/sjisstat.c
// Function: main
int main(int argc, char **argv) {
	FILE *in = stdin;

	uint8_t buf[1024];
	int last_byte = 0;
	int l;
	while((l = fread(buf, 1, 1024, in)) > 0) {
		for(int i = 0; i < l; i++) {
			uint8_t b = buf[i];
			if(last_byte == 0 && SJIS_FIRST_CHAR(b)) {
				last_byte = b;
			} else {
				push_charstat((last_byte << 8) | b);
				last_byte = 0;
			}
		}
	}

	qsort(stats, sizeof(stats) / sizeof(stats[0]), sizeof(stats[0]), cmpstatfn);

	for(int i = 0; i < 65536; i++) {
		if(stats[i].cnt == 0) break;
		int chr = stats[i].chr;
		char utfbuf[5];
		if(chr < 0x20) {
			snprintf(utfbuf, 5, "0x%02x", chr);
		} else {
			int l = utf8_encode(sjis_char_to_unicode(chr), utfbuf);
			utfbuf[l] = 0;
		}
		if(chr > 0xff)
			printf("0x%02x 0x%02x %d %s\n", chr >> 8, chr & 0xff, stats[i].cnt, utfbuf);
		else
			printf("     0x%02x %d %s\n", chr & 0xff, stats[i].cnt, utfbuf);
	}

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x418, %rsp            # imm = 0x418
movq 0x15e03(%rip), %rax     # 0x16fe0
movq (%rax), %rbx
leaq 0x10(%rsp), %rdi
movl $0x1, %esi
movl $0x400, %edx            # imm = 0x400
movq %rbx, %rcx
callq 0x1050
testl %eax, %eax
jle 0x129c
xorl %r12d, %r12d
leaq 0x10(%rsp), %r14
leaq 0x15e72(%rip), %r15     # 0x17080
cmpl $0x1, %eax
adcl $0x0, %eax
xorl %ecx, %ecx
movl %r12d, %edx
movzbl 0x10(%rsp,%rcx), %r12d
testl %edx, %edx
jne 0x125f
cmpb $-0x7b, %r12b
setl %sil
leal 0x78(%r12), %edi
cmpb $0x18, %dil
setb %dil
leal 0x20(%r12), %r8d
cmpb $0xc, %r8b
setb %r8b
orb %dil, %r8b
movl %r12d, %edi
andb $-0x4, %dil
cmpb $-0x10, %dil
sete %dil
orb %sil, %dil
orb %r8b, %dil
jne 0x1274
shll $0x8, %edx
movzwl %dx, %edx
orl %r12d, %edx
movl %edx, (%r15,%rdx,8)
incl 0x4(%r15,%rdx,8)
xorl %r12d, %r12d
incq %rcx
movl %r12d, %edx
cmpq %rcx, %rax
jne 0x1219
movl $0x1, %esi
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
movq %rbx, %rcx
callq 0x1050
testl %eax, %eax
jg 0x120e
leaq 0x15ddd(%rip), %rbx     # 0x17080
leaq -0xec(%rip), %rcx       # 0x11be
movl $0x10000, %esi          # imm = 0x10000
movl $0x8, %edx
movq %rbx, %rdi
callq 0x1040
leaq 0xb(%rsp), %r15
leaq 0x1d43(%rip), %r12      # 0x300b
leaq 0x1d51(%rip), %r13      # 0x3020
xorl %r14d, %r14d
cmpl $0x0, 0x4(%rbx,%r14,8)
je 0x136c
leaq (,%r14,8), %rax
movl (%rax,%rbx), %ebp
cmpl $0x1f, %ebp
jg 0x1308
movl $0x5, %esi
movq %r15, %rdi
leaq 0x1d07(%rip), %rdx      # 0x3004
movl %ebp, %ecx
xorl %eax, %eax
callq 0x1070
jmp 0x1321
movzwl %bp, %edi
callq 0x175c
movl %eax, %edi
movq %r15, %rsi
callq 0x2760
cltq
movb $0x0, 0xb(%rsp,%rax)
cmpl $0x100, %ebp            # imm = 0x100
jl 0x1346
movl %ebp, %esi
shrl $0x8, %esi
movzbl %bpl, %edx
movl 0x4(%rbx,%r14,8), %ecx
movq %r12, %rdi
movq %r15, %r8
xorl %eax, %eax
callq 0x1060
jmp 0x135c
movzbl %bpl, %esi
movl 0x4(%rbx,%r14,8), %edx
movq %r13, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x1060
incq %r14
cmpq $0x10000, %r14          # imm = 0x10000
jne 0x12d2
xorl %eax, %eax
addq $0x418, %rsp            # imm = 0x418
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/vampirefrog[P]x68ksjis/sjis.c
// Function: sjis_strlen
int sjis_strlen(uint8_t *data, int len) {
	int l = 0;
	for(int i = 0; i < len; i++) {
		l++;
		if(data[i] >= 0x80) {
			l++;
			i++;
		}
	}
	return l;
}

// Assembly:
testl %esi, %esi
jle 0x13ab
xorl %ecx, %ecx
xorl %eax, %eax
movslq %ecx, %rcx
movzbl (%rdi,%rcx), %edx
movl %edx, %r8d
shrb $0x7, %r8b
movzbl %r8b, %r8d
addl %r8d, %eax
incl %eax
shrl $0x7, %edx
addl %edx, %ecx
incl %ecx
cmpl %esi, %ecx
jl 0x1388
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/vampirefrog[P]x68ksjis/sjis.c
// Function: sjis_to_utf8
int sjis_to_utf8(uint8_t *sjis_data, int sjis_len, uint8_t *utf8_data, int utf8_len) {
	if(sjis_len < 1) return 0;
	if(utf8_len < 1) return -1;

	int j = 0, last_byte = 0;
	for(int i = 0; i < sjis_len; i++) {
		uint8_t b = sjis_data[i];
		if(last_byte == 0 && SJIS_FIRST_CHAR(b)) {
			last_byte = b;
		} else {
			char buf[4];
			int l = utf8_encode(sjis_char_to_unicode((last_byte << 8) | b), buf);
			if(j + l >= utf8_len - 1)
				return j;
			strcpy((char *)utf8_data + j, buf);
			j += l;
			last_byte = 0;
		}
	}
	return j;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, 0x10(%rsp)
movq %rdi, 0x20(%rsp)
testl %esi, %esi
jle 0x1492
movl %ecx, %ebx
testl %ecx, %ecx
jle 0x1496
decl %ebx
movl %esi, %eax
movq %rax, 0x18(%rsp)
xorl %r12d, %r12d
leaq 0xc(%rsp), %r13
xorl %ebp, %ebp
xorl %r14d, %r14d
movq 0x20(%rsp), %rax
movzbl (%rax,%r12), %eax
testl %r14d, %r14d
jne 0x1433
cmpb $-0x7b, %al
setl %cl
leal 0x78(%rax), %edx
cmpb $0x18, %dl
setb %dl
leal 0x20(%rax), %esi
cmpb $0xc, %sil
setb %sil
orb %dl, %sil
movl %eax, %edx
andb $-0x4, %dl
cmpb $-0x10, %dl
sete %dl
orb %cl, %dl
orb %sil, %dl
movb $0x1, %r15b
je 0x1433
movl %eax, %r14d
jmp 0x147d
movl %r14d, %ecx
shll $0x8, %ecx
orl %eax, %ecx
movzwl %cx, %edi
callq 0x175c
movl %eax, %edi
movq %r13, %rsi
callq 0x2760
movq %r13, %rsi
movl %eax, %r13d
addl %ebp, %r13d
cmpl %ebx, %r13d
setl %r15b
jge 0x1474
movslq %ebp, %rdi
addq 0x10(%rsp), %rdi
callq 0x1030
xorl %r14d, %r14d
movl %r13d, %ebp
jmp 0x1478
movl %ebp, 0x8(%rsp)
leaq 0xc(%rsp), %r13
testb %r15b, %r15b
je 0x149d
incq %r12
cmpq %r12, 0x18(%rsp)
jne 0x13ee
jmp 0x14a1
xorl %ebp, %ebp
jmp 0x14a1
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x14a1
movl 0x8(%rsp), %ebp
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/vampirefrog[P]x68ksjis/sjis.c
// Function: sjis_write_utf8
int sjis_write_utf8(FILE *f, uint8_t *sjis_data, int sjis_len) {
	if(sjis_len < 1) return 0;

	int j = 0, last_byte = 0;
	for(int i = 0; i < sjis_len; i++) {
		uint8_t b = sjis_data[i];
		if(last_byte == 0 && SJIS_FIRST_CHAR(b)) {
			last_byte = b;
		} else {
			char buf[4];
			int l = utf8_encode(sjis_char_to_unicode((last_byte << 8) | b), buf);
			if(l) fwrite(buf, l, 1, f);
			j += l;
			last_byte = 0;
		}
	}

	return j;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, 0x8(%rsp)
testl %edx, %edx
jle 0x1574
movq %rsi, %rbx
movl %edx, %r13d
xorl %r14d, %r14d
leaq 0x14(%rsp), %r15
xorl %ebp, %ebp
xorl %ecx, %ecx
movzbl (%rbx,%r14), %eax
testl %ecx, %ecx
jne 0x1530
cmpb $-0x7b, %al
setl %dl
leal 0x78(%rax), %esi
cmpb $0x18, %sil
setb %sil
leal 0x20(%rax), %edi
cmpb $0xc, %dil
setb %dil
orb %sil, %dil
movl %eax, %esi
andb $-0x4, %sil
cmpb $-0x10, %sil
sete %sil
orb %dl, %sil
orb %dil, %sil
jne 0x1568
shll $0x8, %ecx
orl %eax, %ecx
movzwl %cx, %edi
callq 0x175c
movl %eax, %edi
movq %r15, %rsi
callq 0x2760
movl %eax, %r12d
testl %eax, %eax
je 0x1563
movslq %r12d, %rsi
movl $0x1, %edx
movq %r15, %rdi
movq 0x8(%rsp), %rcx
callq 0x10a0
addl %r12d, %ebp
xorl %eax, %eax
incq %r14
movl %eax, %ecx
cmpq %r14, %r13
jne 0x14f3
jmp 0x1576
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/vampirefrog[P]x68ksjis/sjis.c
// Function: sjis_fputc
int sjis_fputc(int sjis, FILE *f) {
	uint8_t b = (sjis >> 8) & 0xff;
	if(SJIS_FIRST_CHAR(b))
		fputc(b, f); // TODO: error check
	return fputc(sjis & 0xff, f);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movl %edi, %ebx
movzbl %bh, %edi
movl %ebx, %eax
andl $0xfc00, %eax           # imm = 0xFC00
cmpl $0xf000, %eax           # imm = 0xF000
je 0x15bf
leal -0x80(%rdi), %eax
cmpl $0x5, %eax
jb 0x15bf
leal -0x88(%rdi), %eax
cmpl $0x18, %eax
jb 0x15bf
leal -0xe0(%rdi), %eax
cmpl $0xb, %eax
ja 0x15c7
movq %r14, %rsi
callq 0x1090
movzbl %bl, %edi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x1090
// File: /workspace/github_c_makefile_star2_O1/vampirefrog[P]x68ksjis/sjis.c
// Function: sjis_fgetc
int sjis_fgetc(FILE *f) {
	int b = fgetc(f);
	if(b == EOF) return EOF;
	if(!SJIS_FIRST_CHAR(b))
		return b;

	int b2 = fgetc(f);
	if(b2 == EOF) return EOF;
	return b << 8 | b2;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
callq 0x1080
cmpl $-0x1, %eax
je 0x1623
movl %eax, %ebx
andl $-0x4, %eax
cmpl $0xf0, %eax
je 0x1614
leal -0xe0(%rbx), %eax
cmpl $0xc, %eax
jb 0x1614
leal -0x80(%rbx), %eax
cmpl $0x5, %eax
jb 0x1614
leal -0x88(%rbx), %eax
cmpl $0x17, %eax
ja 0x1628
movq %r14, %rdi
callq 0x1080
shll $0x8, %ebx
orl %eax, %ebx
jmp 0x1628
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq