LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/lb3361[P]dosfs/dosfs.c
// Function: dosread
FRESULT dosread(int argc, const char **argv)
{
  int i;
  FRESULT res;
  
  if (argc < 2) {
  usage:
    dosreadhelp();
    exit(EXIT_FAILURE);
  }
#ifdef WIN32
  fflush(stdout);
  _setmode(_fileno(stdout), O_BINARY);
#endif
  for (i=1; i<argc; i++)
    {
      if (! strcmp(argv[i], "-o")) {
        if (++i >= argc)
          goto usage;
        if (! freopen(argv[i], "wb", stdout))
          fatal("Cannot open '%s' for writing\n", argv[i]);
      } else if (argv[i][0] == '-') {
        goto usage;
      } else {
        FIL fil;
        char *path = fix_path(argv[i]);
        char buffer[4096];
        UINT nread;
        res = f_open(&fil, path, FA_READ);
        if (res != FR_OK)
          return res;
        do {
          res = f_read(&fil, buffer, (UINT)sizeof(buffer), &nread);
          if (res != FR_OK)
            break;
          if (nread > 0)
            fwrite(buffer, 1, nread, stdout);
        } while (nread == (UINT)sizeof(buffer));
        fflush(stdout);
        f_close(&fil);
        if (res != FR_OK)
          return res;
      }
    }
  return FR_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1278, %rsp           # imm = 0x1278
movq %rsi, 0x8(%rsp)
movl %edi, (%rsp)
cmpl $0x2, %edi
jl 0x3895
movl $0x1, %ebp
movq 0xd848(%rip), %rbx      # 0x10fd0
leaq 0x10(%rsp), %r15
leaq 0x270(%rsp), %r12
leaq 0x4(%rsp), %r13
movslq %ebp, %rax
movq 0x8(%rsp), %rcx
movq (%rcx,%rax,8), %rdi
cmpb $0x2d, (%rdi)
jne 0x37ef
cmpb $0x6f, 0x1(%rdi)
jne 0x3895
cmpb $0x0, 0x2(%rdi)
jne 0x3895
incl %ebp
cmpl (%rsp), %ebp
jge 0x3895
movslq %ebp, %r14
movq 0x8(%rsp), %rax
movq (%rax,%r14,8), %rdi
movq (%rbx), %rdx
leaq 0x8dfa(%rip), %rsi      # 0xc5da
callq 0x2120
testq %rax, %rax
jne 0x3856
jmp 0x389a
callq 0x304e
movq %r15, %rdi
movq %rax, %rsi
movl $0x1, %edx
callq 0x5115
testl %eax, %eax
jne 0x3890
movq %r15, %rdi
movq %r12, %rsi
movl $0x1000, %edx           # imm = 0x1000
movq %r13, %rcx
callq 0x6351
testl %eax, %eax
jne 0x3866
movl 0x4(%rsp), %edx
testq %rdx, %rdx
je 0x3846
movq (%rbx), %rcx
movl $0x1, %esi
movq %r12, %rdi
callq 0x2230
cmpl $0x1000, 0x4(%rsp)      # imm = 0x1000
je 0x380c
movq (%rbx), %rdi
callq 0x21c0
movq %r15, %rdi
callq 0x6f40
incl %ebp
cmpl (%rsp), %ebp
jl 0x379a
xorl %r14d, %r14d
jmp 0x387b
movl %eax, %r14d
movq (%rbx), %rdi
callq 0x21c0
leaq 0x10(%rsp), %rdi
callq 0x6f40
movl %r14d, %eax
addq $0x1278, %rsp           # imm = 0x1278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %r14d
jmp 0x387b
callq 0x28ee
movq 0x8(%rsp), %rax
movq (%rax,%r14,8), %rsi
leaq 0x8d33(%rip), %rdi      # 0xc5dd
xorl %eax, %eax
callq 0x2b2c
// File: /workspace/github_c_makefile_star2_O3/lb3361[P]dosfs/dosfs.c
// Function: dosmkdir
FRESULT dosmkdir(int argc, const char **argv)
{
  FRESULT res;
  int qflag = 0;
  char *path = 0;
  int i;

  for (i=1; i<argc; i++)
    if (!strcmp(argv[i], "-q"))
      qflag = 1;
    else if (argv[i][0] == '-')
      goto usage;
    else if (!path)
      path = fix_path(argv[i]);
    else
      goto usage;
  if (!path) {
  usage:
    dosmkdirhelp();
    exit(EXIT_FAILURE);
  }
  return rmkdir(path, qflag);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
cmpl $0x2, %edi
jl 0x3b0d
movq %rsi, %rbx
movl %edi, %r14d
xorl %eax, %eax
movl $0x1, %r15d
xorl %ebp, %ebp
movq (%rbx,%r15,8), %rdi
cmpb $0x2d, (%rdi)
jne 0x3ae2
cmpb $0x71, 0x1(%rdi)
jne 0x3b0d
movl $0x1, %ebp
cmpb $0x0, 0x2(%rdi)
je 0x3aec
jmp 0x3b0d
testq %rax, %rax
jne 0x3b0d
callq 0x304e
incq %r15
cmpq %r15, %r14
jne 0x3ac6
testq %rax, %rax
je 0x3b0d
movq %rax, %rdi
movl %ebp, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x3128
callq 0x290a
// File: /workspace/github_c_makefile_star2_O3/lb3361[P]dosfs/dosfs.c
// Function: rdelmany
FRESULT rdelmany(char *path, int verbose)
{
  DIR dir;
  FILINFO info;
  FRESULT res;
  char *pattern;

  if (! pattern_p(path))
    return rdelone(path, verbose);
  else if (! verbose)
    verbose += 1;
  pattern = strrchr(path,'/');    
  if (pattern) {
    *pattern = 0;
    pattern += 1;
  } else {
    pattern = path;
    path = "";
  }
  res = f_findfirst(&dir, &info, path, pattern);
  if (res != FR_OK && res != FR_NO_FILE)
    return res;
  while (res == FR_OK && info.fname[0])
    {
      char *npath = strconcat(path, "/", info.fname, 0);
      res = rdelone(npath, verbose);
      if (res != FR_OK) {
        fprintf(stderr, "dosfs: error while processing %s\n", npath);
        free(npath);
        return res;
      }
      free(npath);
      res = f_findnext(&dir, &info);
    }
  f_closedir(&dir);
  return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movl %esi, %ebx
movq %rdi, %r15
leaq 0x86f3(%rip), %rsi      # 0xc222
callq 0x21d0
testq %rax, %rax
je 0x3b5f
cmpl $0x1, %ebx
adcl $0x0, %ebx
movq %r15, %rdi
movl $0x2f, %esi
callq 0x20f0
testq %rax, %rax
je 0x3b7a
movb $0x0, (%rax)
incq %rax
movq %r15, %r14
movq %rax, %r15
jmp 0x3b81
movq %r15, %rdi
movl %ebx, %esi
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3c30
leaq 0x891e(%rip), %r14      # 0xc49f
leaq 0x8(%rsp), %rdi
leaq 0x68(%rsp), %rsi
movq %r14, %rdx
movq %r15, %rcx
callq 0x7c69
movl %eax, %ebp
testl $0xfffffffb, %eax       # imm = 0xFFFFFFFB
jne 0x3c10
testl %ebp, %ebp
jne 0x3c06
cmpb $0x0, 0x82(%rsp)
je 0x3c06
leaq 0x8(%rsp), %r13
leaq 0x68(%rsp), %r15
movq %r14, %rdi
leaq 0x88df(%rip), %rsi      # 0xc4a0
leaq 0x82(%rsp), %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x2ec4
movq %rax, %r12
movq %rax, %rdi
movl %ebx, %esi
callq 0x3c30
testl %eax, %eax
jne 0x3c24
movq %r12, %rdi
callq 0x2030
movq %r13, %rdi
movq %r15, %rsi
callq 0x7ab2
movl %eax, %ebp
testl %eax, %eax
jne 0x3c06
cmpb $0x0, 0x82(%rsp)
jne 0x3bb7
leaq 0x8(%rsp), %rdi
callq 0x73f8
movl %ebp, %eax
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %ebp
movq %r12, %rdi
callq 0x2918
jmp 0x3c10
// File: /workspace/github_c_makefile_star2_O3/lb3361[P]dosfs/dosfs.c
// Function: rdelone
FRESULT rdelone(char *path, int verbose)
{
  if (dir_p(path)) {
    char *npath;
    if (verbose >= 0 && !prompt("[%s]:%s, Delete entire subtree", sfn, path))
      return FR_OK;
    npath = strconcat(path, "/", "*", 0);
    rdelmany(npath, -1);
    free(npath);
  } else if (verbose > 0 && ! prompt("[%s]:%s, Delete", sfn, path))
    return FR_OK;
  return f_unlink(path);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
callq 0x30e9
testl %eax, %eax
je 0x3c7a
testl %ebp, %ebp
jns 0x3c8a
leaq 0x8853(%rip), %rsi      # 0xc4a0
leaq 0x884e(%rip), %rdx      # 0xc4a2
movq %rbx, %rdi
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x2ec4
movq %rax, %r14
movq %rax, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x3b12
movq %r14, %rdi
callq 0x2030
jmp 0x3c7e
testl %ebp, %ebp
jg 0x3ca8
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x800d
movq 0xd5a7(%rip), %rsi      # 0x11238
leaq 0x8e1d(%rip), %rdi      # 0xcab5
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2338
testl %eax, %eax
jne 0x3c46
jmp 0x3cc4
movq 0xd589(%rip), %rsi      # 0x11238
leaq 0x8e1e(%rip), %rdi      # 0xcad4
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2338
testl %eax, %eax
jne 0x3c7e
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/lb3361[P]dosfs/dosfs.c
// Function: dosdel
FRESULT dosdel(int argc, const char **argv)
{
  int i;
  int verbose = 0;
  FRESULT res = FR_EXIST;
  
  for (i=1; i<argc; i++)
    if (!strcmp(argv[i], "-i"))
      verbose = +1;
    else if (!strcmp(argv[i], "-q"))
      verbose = -1;
    else if (argv[i][0] == '-')
      goto usage;
    else if ((res = rdelmany(fix_path(argv[i]), verbose)) != FR_OK) {
      fprintf(stderr, "dosfs: error while processing '%s'\n", argv[i]);
      return res;
    }
  if (res != FR_OK) {
  usage:
    dosdelhelp();
    exit(EXIT_FAILURE);
  }
  return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x2, %edi
jl 0x3d89
movq %rsi, %rbx
movl %edi, %r12d
leaq -0x1(%r12), %r13
xorl %eax, %eax
movl $0x1, %r15d
xorl %ebp, %ebp
movq (%rbx,%r15,8), %rdi
cmpb $0x2d, (%rdi)
jne 0x3d30
cmpb $0x69, 0x1(%rdi)
jne 0x3d09
cmpb $0x0, 0x2(%rdi)
je 0x3d29
cmpb $0x71, 0x1(%rdi)
jne 0x3d89
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpb $0x0, 0x2(%rdi)
jne 0x3d89
cmpq %r15, %r13
je 0x3d4f
movq 0x8(%rbx,%r15,8), %rdi
incq %r15
jmp 0x3cf8
movl $0x1, %ebp
jmp 0x3d1a
callq 0x304e
movq %rax, %rdi
movl %ebp, %esi
callq 0x3b12
testl %eax, %eax
jne 0x3d68
incq %r15
movb $0x1, %al
cmpq %r12, %r15
jne 0x3cf4
jmp 0x3d53
testb $0x1, %al
je 0x3d89
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %r14d
movq 0xd286(%rip), %rax      # 0x10ff8
movq (%rax), %rdi
movq (%rbx,%r15,8), %rdx
leaq 0x8d64(%rip), %rsi      # 0xcae4
xorl %eax, %eax
callq 0x2180
jmp 0x3d56
callq 0x2941
// File: /workspace/github_c_makefile_star2_O3/lb3361[P]dosfs/ff.c
// Function: f_mount
FRESULT f_mount (
	FATFS* fs,			/* Pointer to the filesystem object (NULL:unmount)*/
	const TCHAR* path,	/* Logical drive number to be mounted/unmounted */
	BYTE opt			/* Mode option 0:Do not mount (delayed mount), 1:Mount immediately */
)
{
	FATFS *cfs;
	int vol;
	FRESULT res;
	const TCHAR *rp = path;


	/* Get logical drive number */
	vol = get_ldnumber(&rp);
	if (vol < 0) return FR_INVALID_DRIVE;
	cfs = FatFs[vol];					/* Pointer to fs object */

	if (cfs) {
#if FF_FS_LOCK != 0
		clear_lock(cfs);
#endif
#if FF_FS_REENTRANT						/* Discard sync object of the current volume */
		if (!ff_del_syncobj(cfs->sobj)) return FR_INT_ERR;
#endif
		cfs->fs_type = 0;				/* Clear old fs object */
	}

	if (fs) {
		fs->fs_type = 0;				/* Clear new fs object */
#if FF_FS_REENTRANT						/* Create sync object for the new volume */
		if (!ff_cre_syncobj((BYTE)vol, &fs->sobj)) return FR_INT_ERR;
#endif
	}
	FatFs[vol] = fs;					/* Register new fs object */

	if (opt == 0) return FR_OK;			/* Do not mount now, it will be mounted later */

	res = mount_volume(&path, &fs, 0);	/* Force mounted the volume */
	LEAVE_FF(fs, res);
}

// Assembly:
subq $0x18, %rsp
movq %rsi, 0x8(%rsp)
movl $0xb, %eax
testq %rsi, %rsi
je 0x4a8c
xorl %ecx, %ecx
movb (%rsi,%rcx), %r8b
incq %rcx
cmpb $0x20, %r8b
jb 0x4a38
cmpb $0x3a, %r8b
jne 0x4a25
cmpb $0x3a, %r8b
jne 0x4a55
cmpq $0x2, %rcx
sete %cl
cmpb $0x30, (%rsi)
sete %sil
andb %cl, %sil
cmpb $0x1, %sil
jne 0x4a8c
movq 0xca64(%rip), %rax      # 0x114c0
testq %rax, %rax
je 0x4a64
movb $0x0, (%rax)
testq %rdi, %rdi
je 0x4a6c
movb $0x0, (%rdi)
movq %rdi, 0xca4d(%rip)      # 0x114c0
testb %dl, %dl
je 0x4a8a
leaq 0x8(%rsp), %rdi
leaq 0x10(%rsp), %rsi
xorl %edx, %edx
callq 0x4ada
jmp 0x4a8c
xorl %eax, %eax
addq $0x18, %rsp
retq
// File: /workspace/github_c_makefile_star2_O3/lb3361[P]dosfs/ff.c
// Function: init_alloc_info
static void init_alloc_info (
	FATFS* fs,		/* Filesystem object */
	FFOBJID* obj	/* Object allocation information to be initialized */
)
{
	obj->sclust = ld_dword(fs->dirbuf + XDIR_FstClus);		/* Start cluster */
	obj->objsize = ld_qword(fs->dirbuf + XDIR_FileSize);	/* Size */
	obj->stat = fs->dirbuf[XDIR_GenFlags] & 2;				/* Allocation status */
	obj->n_frag = 0;										/* No last fragment info */
}

// Assembly:
movl 0x34(%rdi), %eax
movl %eax, 0xc(%rsi)
movq 0x38(%rdi), %rax
movq %rax, 0x10(%rsi)
movb 0x21(%rdi), %al
andb $0x2, %al
movb %al, 0xb(%rsi)
movl $0x0, 0x1c(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/lb3361[P]dosfs/ff.c
// Function: store_xdir
static FRESULT store_xdir (
	DIR* dp				/* Pointer to the direcotry object */
)
{
	FRESULT res;
	UINT nent;
	BYTE* dirb = dp->obj.fs->dirbuf;	/* Pointer to the direcotry entry block 85+C0+C1s */

	/* Create set sum */
	st_word(dirb + XDIR_SetSum, xdir_sum(dirb));
	nent = dirb[XDIR_NumSec] + 1;

	/* Store the direcotry entry block to the directory */
	res = dir_sdi(dp, dp->blk_ofs);
	while (res == FR_OK) {
		res = move_window(dp->obj.fs, dp->sect);
		if (res != FR_OK) break;
		mem_cpy(dp->dir, dirb, SZDIRE);
		dp->obj.fs->wflag = 1;
		if (--nent == 0) break;
		dirb += SZDIRE;
		res = dir_next(dp, 0);
	}
	return (res == FR_OK || res == FR_DISK_ERR) ? res : FR_INT_ERR;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rax
movq 0x18(%rax), %r14
movzbl 0x1(%r14), %ebp
movl %ebp, %eax
shll $0x5, %eax
addl $0x20, %eax
xorl %ecx, %ecx
xorl %edx, %edx
movl $0x4, %esi
cmpl $0x2, %edx
jne 0x5f14
movl %esi, %edx
jmp 0x5f26
rorw %cx
movl %edx, %esi
movzbl (%r14,%rsi), %edi
addl %ecx, %edi
incl %edx
movl %edx, %esi
movl %edi, %ecx
cmpl %eax, %esi
jb 0x5f06
movw %cx, 0x2(%r14)
movl 0x54(%rbx), %esi
movq %rbx, %rdi
callq 0x72ea
testl %eax, %eax
je 0x5f50
cmpl $0x2, %eax
movl $0x2, %ecx
cmovbl %eax, %ecx
movl %ecx, %eax
popq %rbx
popq %r14
popq %rbp
retq
incl %ebp
movq (%rbx), %rdi
movq 0x38(%rbx), %rsi
callq 0x6114
testl %eax, %eax
jne 0x5f3e
movq 0x40(%rbx), %rax
xorl %ecx, %ecx
movb (%r14,%rcx), %dl
movb %dl, (%rax,%rcx)
incq %rcx
cmpl $0x20, %ecx
jne 0x5f68
movq (%rbx), %rax
movb $0x1, 0x3(%rax)
decl %ebp
je 0x5f96
addq $0x20, %r14
movq %rbx, %rdi
xorl %esi, %esi
callq 0x7952
testl %eax, %eax
je 0x5f52
jmp 0x5f3e
xorl %eax, %eax
jmp 0x5f3e
// File: /workspace/github_c_makefile_star2_O3/lb3361[P]dosfs/ff.c
// Function: move_window
static FRESULT move_window (	/* Returns FR_OK or FR_DISK_ERR */
	FATFS* fs,		/* Filesystem object */
	LBA_t sect		/* Sector LBA to make appearance in the fs->win[] */
)
{
	FRESULT res = FR_OK;


	if (sect != fs->winsect) {	/* Window offset changed? */
#if !FF_FS_READONLY
		res = sync_window(fs);		/* Flush the window */
#endif
		if (res == FR_OK) {			/* Fill sector window with new data */
			if (disk_read(fs->pdrv, fs->win, sect, 1) != RES_OK) {
				sect = (LBA_t)0 - 1;	/* Invalidate window if read data is not valid */
				res = FR_DISK_ERR;
			}
			fs->winsect = sect;
		}
	}
	return res;
}

// Assembly:
xorl %eax, %eax
cmpq %rsi, 0x58(%rdi)
je 0x6169
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
callq 0xb836
movl %eax, %ecx
movl $0x1, %eax
testl %ecx, %ecx
jne 0x6162
movzbl 0x1(%rbx), %edi
leaq 0x60(%rbx), %rsi
movq %r14, %rdx
movl $0x1, %ecx
callq 0x2cfe
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
setne %al
xorl %edx, %edx
negl %ecx
sbbq %rdx, %rdx
orq %r14, %rdx
movq %rdx, 0x58(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/lb3361[P]dosfs/ff.c
// Function: fill_first_frag
static FRESULT fill_first_frag (
	FFOBJID* obj	/* Pointer to the corresponding object */
)
{
	FRESULT res;
	DWORD cl, n;


	if (obj->stat == 3) {	/* Has the object been changed 'fragmented' in this session? */
		for (cl = obj->sclust, n = obj->n_cont; n; cl++, n--) {	/* Create cluster chain on the FAT */
			res = put_fat(obj->fs, cl, cl + 1);
			if (res != FR_OK) return res;
		}
		obj->stat = 0;	/* Change status 'FAT chain is valid' */
	}
	return FR_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
xorl %ebx, %ebx
cmpb $0x3, 0xb(%rdi)
jne 0x6e04
movq %rdi, %r14
movl 0x18(%rdi), %r15d
testl %r15d, %r15d
je 0x6dfb
movl 0xc(%r14), %ebp
movl %ebp, %esi
movq (%r14), %rdi
leal 0x1(%rsi), %ebp
movl %ebp, %edx
callq 0xb61f
testl %eax, %eax
jne 0x6e02
decl %r15d
jne 0x6de3
movb $0x0, 0xb(%r14)
jmp 0x6e04
movl %eax, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/lb3361[P]dosfs/ff.c
// Function: fill_last_frag
static FRESULT fill_last_frag (
	FFOBJID* obj,	/* Pointer to the corresponding object */
	DWORD lcl,		/* Last cluster of the fragment */
	DWORD term		/* Value to set the last FAT entry */
)
{
	FRESULT res;


	while (obj->n_frag > 0) {	/* Create the chain of last fragment */
		res = put_fat(obj->fs, lcl - obj->n_frag + 1, (obj->n_frag > 1) ? lcl - obj->n_frag + 2 : term);
		if (res != FR_OK) return res;
		obj->n_frag--;
	}
	return FR_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl 0x1c(%rdi), %eax
xorl %ebx, %ebx
testl %eax, %eax
je 0x6e56
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %r15
movq (%r15), %rdi
movl %r14d, %edx
subl %eax, %edx
leal 0x1(%rdx), %esi
addl $0x2, %edx
cmpl $0x1, %eax
cmovel %ebp, %edx
callq 0xb61f
testl %eax, %eax
jne 0x6e54
movl 0x1c(%r15), %eax
decl %eax
movl %eax, 0x1c(%r15)
jne 0x6e29
jmp 0x6e56
movl %eax, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/lb3361[P]dosfs/ff.c
// Function: load_obj_xdir
static FRESULT load_obj_xdir (
	DIR* dp,			/* Blank directory object to be used to access containing direcotry */
	const FFOBJID* obj	/* Object with its containing directory information */
)
{
	FRESULT res;

	/* Open object containing directory */
	dp->obj.fs = obj->fs;
	dp->obj.sclust = obj->c_scl;
	dp->obj.stat = (BYTE)obj->c_size;
	dp->obj.objsize = obj->c_size & 0xFFFFFF00;
	dp->obj.n_frag = 0;
	dp->blk_ofs = obj->c_ofs;

	res = dir_sdi(dp, dp->blk_ofs);	/* Goto object's entry block */
	if (res == FR_OK) {
		res = load_xdir(dp);		/* Load the object's entry block */
	}
	return res;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rsi), %rax
movq %rax, (%rdi)
movl 0x20(%rsi), %eax
movl %eax, 0xc(%rdi)
movl 0x24(%rsi), %eax
movb %al, 0xb(%rdi)
andl $0xffffff00, %eax       # imm = 0xFFFFFF00
movq %rax, 0x10(%rdi)
movl $0x0, 0x1c(%rdi)
movl 0x28(%rsi), %esi
movl %esi, 0x54(%rdi)
callq 0x72ea
testl %eax, %eax
je 0x6e9a
popq %rbx
retq
movq %rbx, %rdi
popq %rbx
jmp 0xb89f
// File: /workspace/github_c_makefile_star2_O3/lb3361[P]dosfs/ff.c
// Function: sync_fs
static FRESULT sync_fs (	/* Returns FR_OK or FR_DISK_ERR */
	FATFS* fs		/* Filesystem object */
)
{
	FRESULT res;


	res = sync_window(fs);
	if (res == FR_OK) {
		if (fs->fs_type == FS_FAT32 && fs->fsi_flag == 1) {	/* FAT32: Update FSInfo sector if needed */
			/* Create FSInfo structure */
			mem_set(fs->win, 0, sizeof fs->win);
			st_word(fs->win + BS_55AA, 0xAA55);					/* Boot signature */
			st_dword(fs->win + FSI_LeadSig, 0x41615252);		/* Leading signature */
			st_dword(fs->win + FSI_StrucSig, 0x61417272);		/* Structure signature */
			st_dword(fs->win + FSI_Free_Count, fs->free_clst);	/* Number of free clusters */
			st_dword(fs->win + FSI_Nxt_Free, fs->last_clst);	/* Last allocated culuster */
			fs->winsect = fs->volbase + 1;						/* Write it into the FSInfo sector (Next to VBR) */
			disk_write(fs->pdrv, fs->win, fs->winsect, 1);
			fs->fsi_flag = 0;
		}
		/* Make sure that no pending write process in the lower layer */
		if (disk_ioctl(fs->pdrv, CTRL_SYNC, 0) != RES_OK) res = FR_DISK_ERR;
	}

	return res;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0xb836
movl %eax, %ecx
movl $0x1, %eax
testl %ecx, %ecx
jne 0x6f38
cmpb $0x3, (%rbx)
jne 0x6f22
cmpb $0x1, 0x4(%rbx)
jne 0x6f22
leaq 0x60(%rbx), %r14
leaq 0x64(%rbx), %rdi
movl $0x1fa, %edx            # imm = 0x1FA
xorl %esi, %esi
callq 0x2110
movw $0xaa55, 0x25e(%rbx)    # imm = 0xAA55
movl $0x41615252, 0x60(%rbx) # imm = 0x41615252
movl $0x61417272, 0x244(%rbx) # imm = 0x61417272
movq 0x20(%rbx), %rax
movq 0x30(%rbx), %rdx
rolq $0x20, %rax
movq %rax, 0x248(%rbx)
incq %rdx
movq %rdx, 0x58(%rbx)
movzbl 0x1(%rbx), %edi
movq %r14, %rsi
movl $0x1, %ecx
callq 0x2d75
movb $0x0, 0x4(%rbx)
movzbl 0x1(%rbx), %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2dfa
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
setne %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/lb3361[P]dosfs/ff.c
// Function: f_opendir
FRESULT f_opendir (
	DIR* dp,			/* Pointer to directory object to create */
	const TCHAR* path	/* Pointer to the directory path */
)
{
	FRESULT res;
	FATFS *fs;
	DEF_NAMBUF


	if (!dp) return FR_INVALID_OBJECT;

	/* Get logical drive */
	res = mount_volume(&path, &fs, 0);
	if (res == FR_OK) {
		dp->obj.fs = fs;
		INIT_NAMBUF(fs);
		res = follow_path(dp, path);			/* Follow the path to the directory */
		if (res == FR_OK) {						/* Follow completed */
			if (!(dp->fn[NSFLAG] & NS_NONAME)) {	/* It is not the origin directory itself */
				if (dp->obj.attr & AM_DIR) {		/* This object is a sub-directory */
#if FF_FS_EXFAT
					if (fs->fs_type == FS_EXFAT) {
						dp->obj.c_scl = dp->obj.sclust;							/* Get containing directory inforamation */
						dp->obj.c_size = ((DWORD)dp->obj.objsize & 0xFFFFFF00) | dp->obj.stat;
						dp->obj.c_ofs = dp->blk_ofs;
						init_alloc_info(fs, &dp->obj);	/* Get object allocation info */
					} else
#endif
					{
						dp->obj.sclust = ld_clust(fs, dp->dir);	/* Get object allocation info */
					}
				} else {						/* This object is a file */
					res = FR_NO_PATH;
				}
			}
			if (res == FR_OK) {
				dp->obj.id = fs->id;
				res = dir_sdi(dp, 0);			/* Rewind directory */
#if FF_FS_LOCK != 0
				if (res == FR_OK) {
					if (dp->obj.sclust != 0) {
						dp->obj.lockid = inc_lock(dp, 0);	/* Lock the sub directory */
						if (!dp->obj.lockid) res = FR_TOO_MANY_OPEN_FILES;
					} else {
						dp->obj.lockid = 0;	/* Root directory need not to be locked */
					}
				}
#endif
			}
		}
		FREE_NAMBUF();
		if (res == FR_NO_FILE) res = FR_NO_PATH;
	}
	if (res != FR_OK) dp->obj.fs = 0;		/* Invalidate the directory object if function faild */

	LEAVE_FF(fs, res);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x470, %rsp            # imm = 0x470
movq %rsi, (%rsp)
testq %rdi, %rdi
je 0x721f
movq %rdi, %rbx
movq %rsp, %rdi
leaq 0x8(%rsp), %rsi
xorl %edx, %edx
callq 0x4ada
testl %eax, %eax
je 0x7226
movl %eax, %ebp
jmp 0x725e
movl $0x9, %ebp
jmp 0x7265
movq 0x8(%rsp), %r14
movq %r14, (%rbx)
leaq 0x10(%rsp), %rax
movq %rax, 0x10(%r14)
leaq 0x210(%rsp), %rax
movq %rax, 0x18(%r14)
movq (%rsp), %rsi
movq %rbx, %rdi
callq 0x554e
testl %eax, %eax
je 0x7273
cmpl $0x4, %eax
movl $0x5, %ebp
cmovnel %eax, %ebp
movq $0x0, (%rbx)
movl %ebp, %eax
addq $0x470, %rsp            # imm = 0x470
popq %rbx
popq %r14
popq %rbp
retq
cmpb $0x0, 0x53(%rbx)
js 0x72c8
movl $0x5, %ebp
testb $0x10, 0xa(%rbx)
je 0x725e
movb (%r14), %cl
cmpb $0x4, %cl
jne 0x72af
movl 0xc(%rbx), %eax
movl %eax, 0x20(%rbx)
movl 0x10(%rbx), %eax
movb 0xb(%rbx), %al
movl %eax, 0x24(%rbx)
movl 0x54(%rbx), %eax
movl %eax, 0x28(%rbx)
movq 0x18(%r14), %rdi
movq %rbx, %rsi
callq 0x5ec9
jmp 0x72c8
movq 0x40(%rbx), %rdx
movzwl 0x1a(%rdx), %eax
cmpb $0x3, %cl
jne 0x72c5
movzwl 0x14(%rdx), %ecx
shll $0x10, %ecx
orl %ecx, %eax
movl %eax, 0xc(%rbx)
movzwl 0x6(%r14), %eax
movw %ax, 0x8(%rbx)
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %esi, %esi
callq 0x72ea
testl %eax, %eax
jne 0x721b
jmp 0x7265
// File: /workspace/github_c_makefile_star2_O3/lb3361[P]dosfs/ff.c
// Function: f_findnext
FRESULT f_findnext (
	DIR* dp,		/* Pointer to the open directory object */
	FILINFO* fno	/* Pointer to the file information structure */
)
{
	FRESULT res;


	for (;;) {
		res = f_readdir(dp, fno);		/* Get a directory item */
		if (res != FR_OK || !fno || !fno->fname[0]) break;	/* Terminate if any error or end of directory */
		if (pattern_match(dp->pat, fno->fname, 0, FIND_RECURS)) break;		/* Test for the file name */
#if FF_USE_LFN && FF_USE_FIND == 2
		if (pattern_match(dp->pat, fno->altname, 0, FIND_RECURS)) break;	/* Test for alternative name if exist */
#endif
	}
	return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x1a(%rsi), %r15
movq %r14, %rdi
movq %rbx, %rsi
callq 0x741b
movl %eax, %ebp
testq %rbx, %rbx
je 0x7af6
testl %ebp, %ebp
jne 0x7af6
cmpb $0x0, (%r15)
je 0x7af6
movq 0x58(%r14), %rdi
movq %r15, %rsi
xorl %edx, %edx
movl $0x4, %ecx
callq 0x7b03
testl %eax, %eax
je 0x7ac3
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/lb3361[P]dosfs/ff.c
// Function: f_findfirst
FRESULT f_findfirst (
	DIR* dp,				/* Pointer to the blank directory object */
	FILINFO* fno,			/* Pointer to the file information structure */
	const TCHAR* path,		/* Pointer to the directory to open */
	const TCHAR* pattern	/* Pointer to the matching pattern */
)
{
	FRESULT res;


	dp->pat = pattern;		/* Save pointer to pattern string */
	res = f_opendir(dp, path);		/* Open the target directory */
	if (res == FR_OK) {
		res = f_findnext(dp, fno);	/* Find the first item */
	}
	return res;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq %rcx, 0x58(%rdi)
movq %rdx, %rsi
callq 0x71f1
testl %eax, %eax
je 0x7c8b
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x7ab2
// File: /workspace/github_c_makefile_star2_O3/lb3361[P]dosfs/ff.c
// Function: f_stat
FRESULT f_stat (
	const TCHAR* path,	/* Pointer to the file path */
	FILINFO* fno		/* Pointer to file information to return */
)
{
	FRESULT res;
	DIR dj;
	DEF_NAMBUF


	/* Get logical drive */
	res = mount_volume(&path, &dj.obj.fs, 0);
	if (res == FR_OK) {
		INIT_NAMBUF(dj.obj.fs);
		res = follow_path(&dj, path);	/* Follow the file path */
		if (res == FR_OK) {				/* Follow completed */
			if (dj.fn[NSFLAG] & NS_NONAME) {	/* It is origin directory */
				res = FR_INVALID_NAME;
			} else {							/* Found an object */
				if (fno) get_fileinfo(&dj, fno);
			}
		}
		FREE_NAMBUF();
	}

	LEAVE_FF(dj.obj.fs, res);
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x4d8, %rsp            # imm = 0x4D8
movq %rsi, %rbx
leaq 0x8(%rsp), %rax
movq %rdi, (%rax)
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
xorl %edx, %edx
callq 0x4ada
testl %eax, %eax
jne 0x7cef
leaq 0x10(%rsp), %rdi
movq (%rdi), %rax
leaq 0x70(%rsp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x270(%rsp), %rcx
movq %rcx, 0x18(%rax)
movq 0x8(%rsp), %rsi
callq 0x554e
testl %eax, %eax
je 0x7cfd
movl %eax, %ebp
movl %ebp, %eax
addq $0x4d8, %rsp            # imm = 0x4D8
popq %rbx
popq %rbp
retq
cmpb $0x0, 0x63(%rsp)
js 0x7d1a
xorl %ebp, %ebp
testq %rbx, %rbx
je 0x7cf1
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x768f
jmp 0x7cf1
movl $0x6, %ebp
jmp 0x7cf1
// File: /workspace/github_c_makefile_star2_O3/lb3361[P]dosfs/ff.c
// Function: dir_remove
static FRESULT dir_remove (	/* FR_OK:Succeeded, FR_DISK_ERR:A disk error */
	DIR* dp					/* Directory object pointing the entry to be removed */
)
{
	FRESULT res;
	FATFS *fs = dp->obj.fs;
#if FF_USE_LFN		/* LFN configuration */
	DWORD last = dp->dptr;

	res = (dp->blk_ofs == 0xFFFFFFFF) ? FR_OK : dir_sdi(dp, dp->blk_ofs);	/* Goto top of the entry block if LFN is exist */
	if (res == FR_OK) {
		do {
			res = move_window(fs, dp->sect);
			if (res != FR_OK) break;
			if (FF_FS_EXFAT && fs->fs_type == FS_EXFAT) {	/* On the exFAT volume */
				dp->dir[XDIR_Type] &= 0x7F;	/* Clear the entry InUse flag. */
			} else {									/* On the FAT/FAT32 volume */
				dp->dir[DIR_Name] = DDEM;	/* Mark the entry 'deleted'. */
			}
			fs->wflag = 1;
			if (dp->dptr >= last) break;	/* If reached last entry then all entries of the object has been deleted. */
			res = dir_next(dp, 0);	/* Next entry */
		} while (res == FR_OK);
		if (res == FR_NO_FILE) res = FR_INT_ERR;
	}
#else			/* Non LFN configuration */

	res = move_window(fs, dp->sect);
	if (res == FR_OK) {
		dp->dir[DIR_Name] = DDEM;	/* Mark the entry 'deleted'.*/
		fs->wflag = 1;
	}
#endif

	return res;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %r14
movl 0x30(%rdi), %ebp
movl 0x54(%rdi), %esi
cmpl $-0x1, %esi
je 0x81c9
movq %rbx, %rdi
callq 0x72ea
movl %eax, %ecx
testl %eax, %eax
jne 0x81e8
jmp 0x81c9
cmpb $0x4, (%r14)
movq 0x40(%rbx), %rax
movb $-0x1b, %cl
jne 0x81af
movb (%rax), %cl
andb $0x7f, %cl
movb %cl, (%rax)
movb $0x1, 0x3(%r14)
cmpl %ebp, 0x30(%rbx)
jae 0x81e6
movq %rbx, %rdi
xorl %esi, %esi
callq 0x7952
testl %eax, %eax
jne 0x81d9
movq 0x38(%rbx), %rsi
movq %r14, %rdi
callq 0x6114
testl %eax, %eax
je 0x819e
cmpl $0x4, %eax
movl $0x2, %ecx
cmovnel %eax, %ecx
jmp 0x81e8
xorl %ecx, %ecx
movl %ecx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/lb3361[P]dosfs/ff.c
// Function: f_chmod
FRESULT f_chmod (
	const TCHAR* path,	/* Pointer to the file path */
	BYTE attr,			/* Attribute bits */
	BYTE mask			/* Attribute mask to change */
)
{
	FRESULT res;
	DIR dj;
	FATFS *fs;
	DEF_NAMBUF


	res = mount_volume(&path, &fs, FA_WRITE);	/* Get logical drive */
	if (res == FR_OK) {
		dj.obj.fs = fs;
		INIT_NAMBUF(fs);
		res = follow_path(&dj, path);	/* Follow the file path */
		if (res == FR_OK && (dj.fn[NSFLAG] & (NS_DOT | NS_NONAME))) res = FR_INVALID_NAME;	/* Check object validity */
		if (res == FR_OK) {
			mask &= AM_RDO|AM_HID|AM_SYS|AM_ARC;	/* Valid attribute mask */
#if FF_FS_EXFAT
			if (fs->fs_type == FS_EXFAT) {
				fs->dirbuf[XDIR_Attr] = (attr & mask) | (fs->dirbuf[XDIR_Attr] & (BYTE)~mask);	/* Apply attribute change */
				res = store_xdir(&dj);
			} else
#endif
			{
				dj.dir[DIR_Attr] = (attr & mask) | (dj.dir[DIR_Attr] & (BYTE)~mask);	/* Apply attribute change */
				fs->wflag = 1;
			}
			if (res == FR_OK) {
				res = sync_fs(fs);
			}
		}
		FREE_NAMBUF();
	}

	LEAVE_FF(fs, res);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x4d8, %rsp            # imm = 0x4D8
movl %edx, %ebx
movl %esi, %ebp
leaq 0x8(%rsp), %rax
movq %rdi, (%rax)
movq %rsp, %rsi
movq %rax, %rdi
movl $0x2, %edx
callq 0x4ada
testl %eax, %eax
jne 0x89a7
movq (%rsp), %r14
leaq 0x10(%rsp), %r15
movq %r14, (%r15)
leaq 0x70(%rsp), %rax
movq %rax, 0x10(%r14)
leaq 0x270(%rsp), %rax
movq %rax, 0x18(%r14)
movq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0x554e
movl %eax, %ecx
xorl %edx, %edx
testb $-0x60, 0x53(%r15)
sete %sil
movl $0x6, %eax
cmovel %edx, %eax
testl %ecx, %ecx
sete %dl
cmovnel %ecx, %eax
andb %sil, %dl
cmpb $0x1, %dl
jne 0x89a7
andb $0x27, %bl
andb %bl, %bpl
cmpb $0x4, (%r14)
jne 0x898a
movq 0x18(%r14), %rax
notb %bl
andb 0x4(%rax), %bl
orb %bpl, %bl
movb %bl, 0x4(%rax)
leaq 0x10(%rsp), %rdi
callq 0x5ee7
testl %eax, %eax
jne 0x89a7
jmp 0x899f
movq 0x50(%rsp), %rax
notb %bl
andb 0xb(%rax), %bl
orb %bpl, %bl
movb %bl, 0xb(%rax)
movb $0x1, 0x3(%r14)
movq %r14, %rdi
callq 0x6ea3
addq $0x4d8, %rsp            # imm = 0x4D8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/lb3361[P]dosfs/ff.c
// Function: f_utime
FRESULT f_utime (
	const TCHAR* path,	/* Pointer to the file/directory name */
	const FILINFO* fno	/* Pointer to the timestamp to be set */
)
{
	FRESULT res;
	DIR dj;
	FATFS *fs;
	DEF_NAMBUF


	res = mount_volume(&path, &fs, FA_WRITE);	/* Get logical drive */
	if (res == FR_OK) {
		dj.obj.fs = fs;
		INIT_NAMBUF(fs);
		res = follow_path(&dj, path);	/* Follow the file path */
		if (res == FR_OK && (dj.fn[NSFLAG] & (NS_DOT | NS_NONAME))) res = FR_INVALID_NAME;	/* Check object validity */
		if (res == FR_OK) {
#if FF_FS_EXFAT
			if (fs->fs_type == FS_EXFAT) {
				st_dword(fs->dirbuf + XDIR_ModTime, (DWORD)fno->fdate << 16 | fno->ftime);
				res = store_xdir(&dj);
			} else
#endif
			{
				st_dword(dj.dir + DIR_ModTime, (DWORD)fno->fdate << 16 | fno->ftime);
				fs->wflag = 1;
			}
			if (res == FR_OK) {
				res = sync_fs(fs);
			}
		}
		FREE_NAMBUF();
	}

	LEAVE_FF(fs, res);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x4d0, %rsp            # imm = 0x4D0
movq %rsi, %r14
leaq 0x8(%rsp), %rax
movq %rdi, (%rax)
movq %rsp, %rsi
movq %rax, %rdi
movl $0x2, %edx
callq 0x4ada
testl %eax, %eax
jne 0x8a8d
movq (%rsp), %rbx
leaq 0x10(%rsp), %r15
movq %rbx, (%r15)
leaq 0x70(%rsp), %rax
movq %rax, 0x10(%rbx)
leaq 0x270(%rsp), %rax
movq %rax, 0x18(%rbx)
movq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0x554e
movl %eax, %ecx
xorl %edx, %edx
testb $-0x60, 0x53(%r15)
sete %sil
movl $0x6, %eax
cmovel %edx, %eax
testl %ecx, %ecx
sete %dl
cmovnel %ecx, %eax
andb %sil, %dl
cmpb $0x1, %dl
jne 0x8a8d
cmpb $0x4, (%rbx)
jne 0x8a66
movq 0x18(%rbx), %rcx
movzwl 0x8(%r14), %eax
movzwl 0xa(%r14), %edx
movb %dl, 0xc(%rcx)
movb %dh, 0xd(%rcx)
movb %al, 0xe(%rcx)
movb %ah, 0xf(%rcx)
leaq 0x10(%rsp), %rdi
callq 0x5ee7
testl %eax, %eax
jne 0x8a8d
jmp 0x8a85
movq 0x50(%rsp), %rcx
movzwl 0x8(%r14), %eax
movzwl 0xa(%r14), %edx
movb %dl, 0x16(%rcx)
movb %dh, 0x17(%rcx)
movb %al, 0x18(%rcx)
movb %ah, 0x19(%rcx)
movb $0x1, 0x3(%rbx)
movq %rbx, %rdi
callq 0x6ea3
addq $0x4d0, %rsp            # imm = 0x4D0
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/lb3361[P]dosfs/ff.c
// Function: test_gpt_header
static int test_gpt_header (	/* 0:Invalid, 1:Valid */
	const BYTE* gpth			/* Pointer to the GPT header */
)
{
	UINT i;
	DWORD bcc;


	if (mem_cmp(gpth + GPTH_Sign, "EFI PART" "\0\0\1\0" "\x5C\0\0", 16)) return 0;	/* Check sign, version (1.0) and length (92) */
	for (i = 0, bcc = 0xFFFFFFFF; i < 92; i++) {		/* Check header BCC */
		bcc = crc32(bcc, i - GPTH_Bcc < 4 ? 0 : gpth[i]);
	}
	if (~bcc != ld_dword(gpth + GPTH_Bcc)) return 0;
	if (ld_dword(gpth + GPTH_PteSize) != SZ_GPTE) return 0;	/* Table entry size (must be SZ_GPTE bytes) */
	if (ld_dword(gpth + GPTH_PtNum) > 128) return 0;	/* Table size (must be 128 entries or less) */

	return 1;
}

// Assembly:
xorl %eax, %eax
leaq 0x2a74(%rip), %rcx      # 0xd4a0
movb (%rdi,%rax), %dl
movb (%rax,%rcx), %sil
cmpl $0xf, %eax
je 0xaa40
incq %rax
cmpb %sil, %dl
je 0xaa2c
xorl %eax, %eax
cmpb %sil, %dl
jne 0xaa9b
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
xorl %eax, %eax
movl %eax, %edx
andl $0x7c, %edx
cmpl $0x10, %edx
jne 0xaa5c
xorl %edx, %edx
jmp 0xaa5f
movb (%rdi,%rax), %dl
movb $0x1, %sil
testb %dl, %sil
sete %r8b
xorb %cl, %r8b
movl %ecx, %r9d
shrl %r9d
movl %r9d, %ecx
xorl $0xedb88320, %ecx       # imm = 0xEDB88320
testb $0x1, %r8b
cmovnel %r9d, %ecx
addb %sil, %sil
jne 0xaa62
incq %rax
cmpq $0x5c, %rax
jne 0xaa4e
xorl 0x10(%rdi), %ecx
xorl %eax, %eax
cmpl $-0x1, %ecx
je 0xaa9c
retq
cmpl $0x80, 0x54(%rdi)
jne 0xaa9b
xorl %eax, %eax
cmpl $0x81, 0x50(%rdi)
setb %al
retq
// File: /workspace/github_c_makefile_star2_O3/lb3361[P]dosfs/ff.c
// Function: f_fdisk
FRESULT f_fdisk (
	BYTE pdrv,			/* Physical drive number */
	const LBA_t ptbl[],	/* Pointer to the size table for each partitions */
	void* work			/* Pointer to the working buffer (null: use heap memory) */
)
{
	BYTE *buf = (BYTE*)work;
	DSTATUS stat;


	stat = disk_initialize(pdrv);
	if (stat & STA_NOINIT) return FR_NOT_READY;
	if (stat & STA_PROTECT) return FR_WRITE_PROTECTED;
#if FF_USE_LFN == 3
	if (!buf) buf = ff_memalloc(FF_MAX_SS);	/* Use heap memory for working buffer */
#endif
	if (!buf) return FR_NOT_ENOUGH_CORE;

	LEAVE_MKFS(create_partition(pdrv, ptbl, 0x07, buf));
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %ebp
callq 0x2c98
movl %eax, %ecx
movl $0x3, %eax
testb $0x1, %cl
jne 0xb225
movl $0xa, %eax
testb $0x4, %cl
jne 0xb225
testq %rbx, %rbx
je 0xb220
movzbl %bpl, %edi
movq %r14, %rsi
movl $0x7, %edx
movq %rbx, %rcx
popq %rbx
popq %r14
popq %rbp
jmp 0xaab6
movl $0x11, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/lb3361[P]dosfs/ff.c
// Function: check_fs
static UINT check_fs (	/* 0:FAT VBR, 1:exFAT VBR, 2:Not FAT and valid BS, 3:Not FAT and invalid BS, 4:Disk error */
	FATFS* fs,			/* Filesystem object */
	LBA_t sect			/* Sector to load and check if it is an FAT-VBR or not */
)
{
	WORD w, sign;
	BYTE b;


	fs->wflag = 0; fs->winsect = (LBA_t)0 - 1;		/* Invaidate window */
	if (move_window(fs, sect) != FR_OK) return 4;	/* Load the boot sector */
	sign = ld_word(fs->win + BS_55AA);
#if FF_FS_EXFAT
	if (sign == 0xAA55 && !mem_cmp(fs->win + BS_JmpBoot, "\xEB\x76\x90" "EXFAT   ", 11)) return 1;	/* It is an exFAT VBR */
#endif
	b = fs->win[BS_JmpBoot];
	if (b == 0xEB || b == 0xE9 || b == 0xE8) {	/* Valid JumpBoot code? (short jump, near jump or near call) */
		if (sign == 0xAA55 && !mem_cmp(fs->win + BS_FilSysType32, "FAT32   ", 8)) return 0;	/* It is an FAT32 VBR */
		/* FAT volumes formatted with early MS-DOS lack boot signature and FAT string, so that we need to identify the FAT VBR without them. */
		w = ld_word(fs->win + BPB_BytsPerSec);
		if ((w & (w - 1)) == 0 && w >= FF_MIN_SS && w <= FF_MAX_SS) {	/* Properness of sector size */
			b = fs->win[BPB_SecPerClus];
			if (b != 0 && (b & (b - 1)) == 0						/* Properness of cluster size */
			&& (fs->win[BPB_NumFATs] == 1 || fs->win[BPB_NumFATs] == 2)	/* Properness of number of FATs */
			&& ld_word(fs->win + BPB_RootEntCnt) != 0				/* Properness of root entry count */
			&& ld_word(fs->win + BPB_FATSz16) != 0) {				/* Properness of FAT size */
				return 0;	/* Sector can be presumed an FAT VBR */
			}
		}
	}
	return sign == 0xAA55 ? 2 : 3;	/* Not an FAT VBR (valid or invalid BS) */
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movb $0x0, 0x3(%rdi)
movq $-0x1, 0x58(%rdi)
callq 0x6114
movl %eax, %ecx
movl $0x4, %eax
testl %ecx, %ecx
jne 0xb30c
movzwl 0x25e(%rbx), %ecx
cmpl $0xaa55, %ecx           # imm = 0xAA55
jne 0xb28a
xorl %eax, %eax
leaq 0x225a(%rip), %rdx      # 0xd4c0
movb 0x60(%rbx,%rax), %sil
movb (%rax,%rdx), %dil
cmpl $0xa, %eax
je 0xb27c
incq %rax
cmpb %dil, %sil
je 0xb266
movl $0x1, %eax
cmpb %dil, %sil
je 0xb30c
movzbl 0x60(%rbx), %eax
addl $0xffffff18, %eax       # imm = 0xFFFFFF18
movzwl %cx, %ecx
cmpl $0x3, %eax
ja 0xb2fe
cmpl $0x2, %eax
je 0xb2fe
cmpl $0xaa55, %ecx           # imm = 0xAA55
jne 0xb2d3
xorl %eax, %eax
leaq 0x2232(%rip), %rdx      # 0xd4e3
movb 0xb2(%rbx,%rax), %sil
movb (%rax,%rdx), %dil
cmpl $0x7, %eax
je 0xb2ca
incq %rax
cmpb %dil, %sil
je 0xb2b1
cmpb %dil, %sil
jne 0xb2d3
xorl %eax, %eax
jmp 0xb30c
cmpw $0x200, 0x6b(%rbx)      # imm = 0x200
jne 0xb2fe
movb 0x6d(%rbx), %al
leal -0x1(%rax), %edx
xorb %dl, %al
cmpb %dl, %al
jbe 0xb2fe
movb 0x70(%rbx), %al
decb %al
cmpb $0x1, %al
ja 0xb2fe
cmpw $0x0, 0x71(%rbx)
je 0xb2fe
cmpw $0x0, 0x76(%rbx)
jne 0xb2cf
xorl %eax, %eax
cmpl $0xaa55, %ecx           # imm = 0xAA55
sete %al
xorl $0x3, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/lb3361[P]dosfs/ff.c
// Function: xname_sum
static WORD xname_sum (	/* Get check sum (to be used as hash) of the file name */
	const WCHAR* name	/* File name to be calculated */
)
{
	WCHAR chr;
	WORD sum = 0;


	while ((chr = *name++) != 0) {
		chr = (WCHAR)ff_wtoupper(chr);		/* File name needs to be up-case converted */
		sum = ((sum & 1) ? 0x8000 : 0) + (sum >> 1) + (chr & 0xFF);
		sum = ((sum & 1) ? 0x8000 : 0) + (sum >> 1) + (chr >> 8);
	}
	return sum;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movzwl (%rdi), %eax
xorl %ebp, %ebp
testw %ax, %ax
je 0xb618
movq %rdi, %rbx
addq $0x2, %rbx
movl $0xff, %r14d
movzwl %ax, %edi
callq 0xbab9
movzwl %bp, %ecx
movl %ecx, %edx
shll $0xf, %edx
shrl %ecx
orl %edx, %ecx
movl %eax, %edx
andl %r14d, %edx
addl %ecx, %edx
movl %edx, %ecx
shll $0xf, %ecx
shrl %edx
andl $0x7fff, %edx           # imm = 0x7FFF
shrl $0x8, %eax
andl %r14d, %eax
orl %ecx, %eax
movl %eax, %ebp
addl %edx, %ebp
movzwl (%rbx), %eax
addq $0x2, %rbx
testw %ax, %ax
jne 0xb5d8
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/lb3361[P]dosfs/ff.c
// Function: change_bitmap
static FRESULT change_bitmap (
	FATFS* fs,	/* Filesystem object */
	DWORD clst,	/* Cluster number to change from */
	DWORD ncl,	/* Number of clusters to be changed */
	int bv		/* bit value to be set (0 or 1) */
)
{
	BYTE bm;
	UINT i;
	LBA_t sect;


	clst -= 2;	/* The first bit corresponds to cluster #2 */
	sect = fs->bitbase + clst / 8 / SS(fs);	/* Sector address */
	i = clst / 8 % SS(fs);					/* Byte offset in the sector */
	bm = 1 << (clst % 8);					/* Bit mask in the byte */
	for (;;) {
		if (move_window(fs, sect++) != FR_OK) return FR_DISK_ERR;
		do {
			do {
				if (bv == (int)((fs->win[i] & bm) != 0)) return FR_INT_ERR;	/* Is the bit expected value? */
				fs->win[i] ^= bm;	/* Flip the bit */
				fs->wflag = 1;
				if (--ncl == 0) return FR_OK;	/* All bits processed? */
			} while (bm <<= 1);		/* Next bit */
			bm = 1;
		} while (++i < SS(fs));		/* Next byte */
		i = 0;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %ebx
movl %edx, %ebp
movl %esi, %r12d
movq %rdi, %r14
addl $-0x2, %r12d
movl %r12d, %r15d
shrl $0xc, %r15d
addq 0x50(%rdi), %r15
movq %r15, %rsi
callq 0x6114
movl %eax, %ecx
movl $0x1, %eax
testl %ecx, %ecx
jne 0xb82d
movl %r12d, %ecx
andb $0x7, %cl
shll %cl, %eax
shrl $0x3, %r12d
andl $0x1ff, %r12d           # imm = 0x1FF
incq %r15
movb 0x60(%r14,%r12), %cl
movzbl %cl, %edx
xorl %esi, %esi
testl %edx, %eax
setne %sil
cmpl %ebx, %esi
je 0xb824
xorb %al, %cl
movb %cl, 0x60(%r14,%r12)
movb $0x1, 0x3(%r14)
decl %ebp
je 0xb82b
movzbl %al, %edx
leal (%rdx,%rdx), %eax
testb $0x7f, %dl
jne 0xb7cb
incq %r12
movl $0x1, %eax
cmpq $0x200, %r12            # imm = 0x200
jne 0xb7c6
movq %r14, %rdi
movq %r15, %rsi
callq 0x6114
movl %eax, %ecx
movl $0x1, %eax
movl $0x0, %r12d
testl %ecx, %ecx
je 0xb7c3
jmp 0xb82d
movl $0x2, %eax
jmp 0xb82d
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/lb3361[P]dosfs/ff.c
// Function: sync_window
static FRESULT sync_window (	/* Returns FR_OK or FR_DISK_ERR */
	FATFS* fs			/* Filesystem object */
)
{
	FRESULT res = FR_OK;


	if (fs->wflag) {	/* Is the disk access window dirty? */
		if (disk_write(fs->pdrv, fs->win, fs->winsect, 1) == RES_OK) {	/* Write it back into the volume */
			fs->wflag = 0;	/* Clear window dirty flag */
			if (fs->winsect - fs->fatbase < fs->fsize) {	/* Is it in the 1st FAT? */
				if (fs->n_fats == 2) disk_write(fs->pdrv, fs->win, fs->winsect + fs->fsize, 1);	/* Reflect it to 2nd FAT if needed */
			}
		} else {
			res = FR_DISK_ERR;
		}
	}
	return res;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
cmpb $0x0, 0x3(%rdi)
je 0xb896
movq %rdi, %rbx
movzbl 0x1(%rdi), %edi
leaq 0x60(%rbx), %r14
movq 0x58(%rbx), %rdx
movl $0x1, %ebp
movq %r14, %rsi
movl $0x1, %ecx
callq 0x2d75
testl %eax, %eax
jne 0xb898
movb $0x0, 0x3(%rbx)
movq 0x58(%rbx), %rdx
movq %rdx, %rcx
subq 0x38(%rbx), %rcx
movl 0x2c(%rbx), %eax
cmpq %rax, %rcx
jae 0xb896
cmpb $0x2, 0x2(%rbx)
jne 0xb896
movzbl 0x1(%rbx), %edi
addq %rax, %rdx
movq %r14, %rsi
movl $0x1, %ecx
callq 0x2d75
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/lb3361[P]dosfs/ffunicode.c
// Function: ff_uni2oem
WCHAR ff_uni2oem (	/* Returns OEM code character, zero on error */
	DWORD	uni,	/* UTF-16 encoded character to be converted */
	WORD	cp		/* Code page for the conversion */
)
{
	WCHAR c = 0;
	const WCHAR *p = CVTBL(uc, FF_CODE_PAGE);


	if (uni < 0x80) {	/* ASCII? */
		c = (WCHAR)uni;

	} else {			/* Non-ASCII */
		if (uni < 0x10000 && cp == FF_CODE_PAGE) {	/* Is it in BMP and valid code page? */
			for (c = 0; c < 0x80 && uni != p[c]; c++) ;
			c = (c + 0x80) & 0xFF;
		}
	}

	return c;
}

// Assembly:
movl %edi, %eax
cmpl $0x7f, %edi
jbe 0xba75
cmpl $0x10000, %eax          # imm = 0x10000
setae %cl
movzwl %si, %edx
cmpl $0x1b5, %edx            # imm = 0x1B5
setne %dl
orb %cl, %dl
jne 0xba73
leaq 0x1ae6(%rip), %rdx      # 0xd540
xorl %ecx, %ecx
movzwl (%rdx), %esi
cmpl %eax, %esi
je 0xba76
incq %rcx
addq $0x2, %rdx
cmpq $0x80, %rcx
jne 0xba5c
xorl %eax, %eax
retq
xorl $0x80, %ecx
movl %ecx, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/stickyPiston[P]ti-basic-compiler/src/main.c
// Function: openHelp
void openHelp(char *command) {
  puts("tic: TI-BASIC compiler");
  puts("Command line interface usage:");
  printf("%s <input file> <flags>\n", command);
  puts("\nAvailable flags:");
  puts(" -o: Specify the output file path");
  puts(" -i: Ignore whitespace characters, tabs and whitespaces will not be added to the final binary");
  puts(" -d: Enable disassembly mode");
  puts(" -n: Specify the name of the program when sent to the calculator");
  puts(" -h, --help: Show the help page");
  puts(" -l, --lang: Select a language, choices are: nl, en, se");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0xab4(%rip), %rdi       # 0xf031
callq 0xe070
leaq 0xabf(%rip), %rdi       # 0xf048
callq 0xe070
leaq 0xad1(%rip), %rdi       # 0xf066
movq %rbx, %rsi
xorl %eax, %eax
callq 0xe0b0
leaq 0xad9(%rip), %rdi       # 0xf07f
callq 0xe070
leaq 0xadf(%rip), %rdi       # 0xf091
callq 0xe070
leaq 0xaf5(%rip), %rdi       # 0xf0b3
callq 0xe070
leaq 0xb47(%rip), %rdi       # 0xf111
callq 0xe070
leaq 0xb58(%rip), %rdi       # 0xf12e
callq 0xe070
leaq 0xb8d(%rip), %rdi       # 0xf16f
callq 0xe070
leaq 0xba1(%rip), %rdi       # 0xf18f
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xe070
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/stickyPiston[P]ti-basic-compiler/src/tic.c
// Function: readFile
int readFile(char **out) {
  FILE *fp = fopen(inputFile, "r");
  if (fp == NULL) {
    fprintf(stderr, "Could not open %s\n", inputFile);
    abort();
  } 

  // Read all bytes from the source file
  fseek(fp, 0, SEEK_END);
  int filesize = ftell(fp);
  fseek(fp, 0, SEEK_SET);

  *out = malloc(filesize);
  fread(*out, filesize, 1, fp);

  fclose(fp);
  
  return filesize;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
leaq 0xb5e0(%rip), %rax      # 0x19bf0
movq (%rax), %rdi
leaq 0xfa9(%rip), %rsi       # 0xf5c3
callq 0xe130
testq %rax, %rax
je 0xe684
movq %rax, %rbx
movq %rax, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0xe110
movq %rbx, %rdi
callq 0xe0f0
movq %rax, %r15
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0xe110
movslq %r15d, %r15
movq %r15, %rdi
callq 0xe100
movq %rax, (%r14)
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
movq %rbx, %rcx
callq 0xe080
movq %rbx, %rdi
callq 0xe090
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0xe160
// File: /workspace/github_c_makefile_star2_O3/stickyPiston[P]ti-basic-compiler/src/tic.c
// Function: disassemble
void disassemble() {
  unsigned char *bytes = NULL;
  int filesize = readFile((char **)&bytes);

  for (int i = 74; i < filesize - 2; i++) {
    for (int j = 0; stringTable[j][lang] != NULL; j++) {
      if (bytes[i] == 0x5c || bytes[i] == 0x5d || bytes[i] == 0x5e || bytes[i] == 0x60 || bytes[i] == 0x61 || bytes[i] == 0xaa || bytes[i] == 0xef || bytes[i] == 0x62 || bytes[i] == 0x63 || bytes[i] == 0x7e || bytes[i] == 0xbb) {
        uint16_t twobytevalue = bytes[i] << 8;
        twobytevalue |= bytes[++i];
        if (functionTable[j].opcode == twobytevalue) {
          printf("%s", stringTable[j][lang]);
        }
      } else {
        if (functionTable[j].opcode == bytes[i]) {
          if (strcmp(stringTable[j][lang], "\n") != 0)
            printf("%s", stringTable[j][lang]);
        }
      }
    }
  }

  puts("");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
leaq -0x38(%rbp), %rdi
movq $0x0, (%rdi)
callq 0xe5fc
movl %eax, -0x2c(%rbp)
cmpl $0x4d, %eax
jl 0xeb9e
addl $-0x2, -0x2c(%rbp)
movq -0x38(%rbp), %r11
leaq 0xb11e(%rip), %rdi      # 0x19be8
movl (%rdi), %eax
movl $0x4a, %r14d
leaq 0x6997(%rip), %r15      # 0x15470
leaq 0x45e0(%rip), %r13      # 0x130c0
movl %eax, %ecx
movq (%r15,%rcx,8), %rsi
testq %rsi, %rsi
je 0xeb91
xorl %r12d, %r12d
movslq %r14d, %rax
movzbl (%r11,%rax), %ecx
cmpl $0xa9, %ecx
jg 0xeb65
leal -0x5c(%rcx), %edx
cmpl $0x22, %edx
ja 0xeb7d
movabsq $0x4000000f7, %r8       # imm = 0x4000000F7
btq %rdx, %r8
jae 0xeb7d
shll $0x8, %ecx
movzbl 0x1(%r11,%rax), %edx
incq %rax
orl %ecx, %edx
movzwl (%r12,%r13), %ecx
movl %eax, %r14d
cmpl %ecx, %edx
jne 0xeb4f
leaq 0x270a(%rip), %rdi      # 0x11245
xorl %eax, %eax
movq %r11, %rbx
callq 0xe0b0
movq %rbx, %r11
leaq 0xb099(%rip), %rdi      # 0x19be8
movl (%rdi), %eax
leaq (%r15,%rax,8), %rcx
movq 0x18(%rcx,%r12,2), %rsi
addq $0xc, %r12
testq %rsi, %rsi
jne 0xeaf2
jmp 0xeb91
cmpl $0xaa, %ecx
je 0xeb1a
cmpl $0xef, %ecx
je 0xeb1a
cmpl $0xbb, %ecx
je 0xeb1a
cmpw %cx, (%r12,%r13)
jne 0xeb4f
cmpb $0xa, (%rsi)
jne 0xeb34
cmpb $0x0, 0x1(%rsi)
jne 0xeb34
jmp 0xeb4f
incl %r14d
cmpl -0x2c(%rbp), %r14d
jl 0xeae0
movl $0xa, %edi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xe030
// File: /workspace/github_c_makefile_star2_O3/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_4/exercise_4_01/strindex.c
// Function: main
int main(void)
{
  char line[MAXLEN];
  char pattern[MAXLEN] = "example";

  get_line(line, MAXLEN);
  printf("%s\n", line);

  printf("Pattern found at index %d\n", strindex(line, pattern));

  return 0;
}

// Assembly:
pushq %rbx
subq $0x3f0, %rsp            # imm = 0x3F0
movq %rsp, %rbx
movq %rbx, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x11b6
movq %rbx, %rdi
callq 0x1030
leaq 0xe7d(%rip), %rsi       # 0x2010
movq %rbx, %rdi
callq 0x1207
leaq 0x1256(%rip), %rdi      # 0x23f8
movl %eax, %esi
xorl %eax, %eax
callq 0x1050
xorl %eax, %eax
addq $0x3f0, %rsp            # imm = 0x3F0
popq %rbx
retq