LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/weaslepalace[P]FreeRTOS_Posix_Sim/AsyncIO/PosixMessageQueueIPC.c
// Function: prvPosixIPCInterruptHandler
void prvPosixIPCInterruptHandler( int signal, siginfo_t * data, void * pvParam )
{
union sigval xParameters = data->si_value;
xPipeAndFunction *pxPipes = ( xPipeAndFunction *)xParameters.sival_ptr;
mqd_t hPipeHandle = 0;
void (*vMessageInterruptHandler)(xMessageObject,void*) = NULL;
xMessageObject xRxMessage;
portLONG lMessagesReceived = 0;

	if ( NULL != pxPipes )
	{
		hPipeHandle = pxPipes->hPipe;
		vMessageInterruptHandler = pxPipes->pvFunction;

		memset( &xRxMessage, 0, sizeof( xMessageObject ) );

		if ( NULL != vMessageInterruptHandler )
		{
			while ( ( pdTRUE == lPosixIPCReceiveMessage( hPipeHandle, &xRxMessage ) ) && ( lMessagesReceived++ < MAX_NUMBER_OF_MESSAGES ) )
			{
				vMessageInterruptHandler( xRxMessage, pxPipes->pvContext );
			}
		}

		/* Re-register the notification. */
		if ( 0 != mq_notify( hPipeHandle, &xMessageEvent ) )
		{
			printf( "Failed to install Rx interrupt handler: %d.\n", errno );
		}
	}
	else
	{
		printf( "NULL parameter: Failed to install Rx interrupt handler: %d.\n", errno );
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
movq 0x18(%rsi), %r12
testq %r12, %r12
je 0x7ec3
movl (%r12), %ebx
movq 0x8(%r12), %r13
leaq -0x228(%rbp), %rdi
xorl %r15d, %r15d
movl $0x200, %edx            # imm = 0x200
xorl %esi, %esi
callq 0x4200
testq %r13, %r13
je 0x7ea8
leaq -0x228(%rbp), %r14
movl %ebx, %edi
movq %r14, %rsi
callq 0x43b0
testl %eax, %eax
je 0x7ea8
cmpl $0x9, %r15d
ja 0x7ea8
incl %r15d
movq 0x10(%r12), %rax
pushq $0x40
popq %rcx
movq %rsp, %rdi
movq %r14, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq %rax, %rdi
callq *%r13
jmp 0x7e78
leaq 0x3ee9(%rip), %rsi      # 0xbd98
movl %ebx, %edi
callq 0x4640
testl %eax, %eax
je 0x7eec
leaq 0x3e6(%rip), %rbx       # 0x82a7
jmp 0x7eca
leaq 0x3cd(%rip), %rbx       # 0x8297
callq 0x40a0
movl (%rax), %esi
movq %rbx, %rdi
xorl %eax, %eax
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4190
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/weaslepalace[P]FreeRTOS_Posix_Sim/AsyncIO/PosixMessageQueueIPC.c
// Function: lPosixIPCSendMessage
portLONG lPosixIPCSendMessage( mqd_t hPipeHandle, xMessageObject xMessage )
{
portLONG lReturn = pdFALSE;

	if ( 0 != hPipeHandle )
	{
		if ( 0 == mq_send( hPipeHandle, (const char *)&xMessage, sizeof( xMessageObject ), 1 ) )
		{
			lReturn = pdTRUE;
		}
		else
		{
			printf( "Message Sending error.\n" );
		}
	}
	return lReturn;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
xorl %ebx, %ebx
testl %edi, %edi
je 0x7f57
leaq 0x10(%rbp), %rsi
pushq $0x1
popq %rbx
movl $0x200, %edx            # imm = 0x200
movl %ebx, %ecx
callq 0x4260
testl %eax, %eax
je 0x7f57
leaq 0x3c0(%rip), %rdi       # 0x8310
callq 0x40c0
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/weaslepalace[P]FreeRTOS_Posix_Sim/AsyncIO/PosixMessageQueueIPC.c
// Function: lPosixIPCReceiveMessage
portLONG lPosixIPCReceiveMessage( mqd_t hPipeHandle, xMessageObject *pxMessage )
{
static char pcBuffer[ MAX_MESSAGE_SIZE ];
unsigned int uiPriority;
portLONG lBytesReceived = 0;
portLONG lBytesToProcess;
portLONG lReturn = pdFALSE;

	lBytesReceived = mq_receive( hPipeHandle, pcBuffer, MAX_MESSAGE_SIZE, &uiPriority );
	for ( lBytesToProcess = 0; lBytesToProcess < lBytesReceived; lBytesToProcess += sizeof( xMessageObject ) )
	{
		memcpy( pxMessage, pcBuffer, sizeof( xMessageObject ) );
		lReturn = pdTRUE;

		/* Only receiving one message at the moment. */
		break;
	}
	return lReturn;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rsi, %rbx
leaq 0x3e70(%rip), %rsi      # 0xbde0
leaq -0xc(%rbp), %rcx
movl $0x2000, %edx           # imm = 0x2000
callq 0x45c0
testl %eax, %eax
jle 0x7f9b
leaq 0x3e57(%rip), %rsi      # 0xbde0
movl $0x200, %edx            # imm = 0x200
movq %rbx, %rdi
callq 0x4370
pushq $0x1
popq %rax
jmp 0x7f9d
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/lb3361[P]dosfs/dosfs.c
// Function: fatal
void fatal(const char *fmt, ...)
{
  va_list ap;
  va_start(ap, fmt);
  fprintf(stderr,"dosfs: ");
  vfprintf(stderr, fmt, ap);
  va_end(ap);
  exit(EXIT_FAILURE);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0xd0, %rsp
movq %rdi, %rbx
leaq 0x20(%rsp), %rdi
movq %rsi, 0x8(%rdi)
movq %rdx, 0x10(%rdi)
movq %rcx, 0x18(%rdi)
movq %r8, 0x20(%rdi)
movq %r9, 0x28(%rdi)
testb %al, %al
je 0x23af
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
movq %rsp, %r14
movq %rdi, 0x10(%r14)
leaq 0xf0(%rsp), %rax
movq %rax, 0x8(%r14)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%r14)
movq 0xec22(%rip), %r15      # 0x10ff8
movq (%r15), %rcx
leaq 0x8c88(%rip), %rdi      # 0xb068
pushq $0x7
popq %rsi
pushq $0x1
popq %rdx
callq 0x2230
movq (%r15), %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x2200
pushq $0x1
popq %rdi
callq 0x2220
// File: /workspace/github_c_makefile_star2_O2/lb3361[P]dosfs/dosfs.c
// Function: fatal_code
void fatal_code(FRESULT code)
{
  switch(code)
    {
    case FR_OK: break;
    case FR_NO_FILESYSTEM: fatal("Cannot find fat or exfat filesystem\n");
    case FR_DISK_ERR: fatal("I/O error\n");
    case FR_NO_FILE: fatal("File not found\n");
    case FR_NO_PATH: fatal("Path not found\n");
    case FR_INVALID_NAME: fatal("Invalid file name\n");
    case FR_DENIED: fatal("Permission denied\n");
    case FR_WRITE_PROTECTED: fatal("Write protected\n");
    case FR_INVALID_PARAMETER: fatal("Invalid parameter\n");
    case FR_EXIST: fatal("File already exists\n");
    case FR_MKFS_ABORTED: fatal("Formatting failed\n");
    default: fatal("Internal error %d\n", (int)code);
    }
  exit(EXIT_FAILURE);
}

// Assembly:
pushq %rax
movl %edi, %esi
cmpl $0x13, %edi
ja 0x253c
movl %esi, %eax
leaq 0x8b38(%rip), %rcx      # 0xb004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
pushq $0x1
popq %rdi
callq 0x2220
leaq 0x8c23(%rip), %rdi      # 0xb107
jmp 0x2535
leaq 0x8be3(%rip), %rdi      # 0xb0d0
jmp 0x2535
leaq 0x8bed(%rip), %rdi      # 0xb0e3
jmp 0x2535
leaq 0x8bc1(%rip), %rdi      # 0xb0c0
jmp 0x2535
leaq 0x8ba8(%rip), %rdi      # 0xb0b0
jmp 0x2535
leaq 0x8b94(%rip), %rdi      # 0xb0a5
jmp 0x2535
leaq 0x8c00(%rip), %rdi      # 0xb11a
jmp 0x2535
leaq 0x8bd3(%rip), %rdi      # 0xb0f6
jmp 0x2535
leaq 0x8c03(%rip), %rdi      # 0xb12f
jmp 0x2535
leaq 0x8b4b(%rip), %rdi      # 0xb080
xorl %eax, %eax
callq 0x234c
leaq 0x8bff(%rip), %rdi      # 0xb142
xorl %eax, %eax
callq 0x234c
// File: /workspace/github_c_makefile_star2_O2/lb3361[P]dosfs/dosfs.c
// Function: disk_initialize
DSTATUS disk_initialize (BYTE pdrv)
{
  if ((fd = open(fn, O_RDWR)) < 0) {
    wp = 1;
    if ((fd = open(fn, O_RDONLY)) < 0) {
      fatal("Cannot open file \"%s\"\n", fn);
      return STA_NOINIT;
    }
  }
  return disk_status(pdrv);
}

// Assembly:
pushq %rax
movq 0xea51(%rip), %rdi      # 0x11230
pushq $0x2
popq %rsi
xorl %eax, %eax
callq 0x21f0
movl %eax, 0xe951(%rip)      # 0x11140
testl %eax, %eax
jns 0x2817
movl $0x1, 0xea43(%rip)      # 0x11240
movq 0xea2c(%rip), %rdi      # 0x11230
xorl %esi, %esi
xorl %eax, %eax
callq 0x21f0
movl %eax, 0xe92d(%rip)      # 0x11140
testl %eax, %eax
js 0x2826
cmpl $0x0, 0xea22(%rip)      # 0x11240
setne %al
shlb $0x2, %al
popq %rcx
retq
movq 0xea03(%rip), %rsi      # 0x11230
leaq 0x89c8(%rip), %rdi      # 0xb1fc
xorl %eax, %eax
callq 0x234c
// File: /workspace/github_c_makefile_star2_O2/lb3361[P]dosfs/dosfs.c
// Function: disk_read
DRESULT disk_read (BYTE pdrv, BYTE *buff, LBA_t sector,	UINT count)
{
  (void) pdrv;
  size_t sz = (size_t)count * 512;
  ssize_t rsz;

  if (! fd)
    return RES_NOTRDY;
  if (lseek(fd, (off_t)(sector * 512), SEEK_SET)  == (off_t)(-1))
    return RES_PARERR;
  while (sz > 0) {
    rsz = read(fd, buff, sz);
    if (rsz < 0)
      return RES_ERROR;
    if (rsz == 0)
      return RES_PARERR;
    sz -= rsz;
    buff += rsz;
  }
  return RES_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl 0xe8f8(%rip), %edi      # 0x11140
testl %edi, %edi
je 0x2897
movl %ecx, %ebp
movq %rsi, %r14
shlq $0x9, %rdx
movq %rdx, %rsi
xorl %edx, %edx
callq 0x2100
pushq $0x4
popq %rbx
cmpq $-0x1, %rax
je 0x28a2
movl %ebp, %r15d
shlq $0x9, %r15
pushq $0x1
popq %rbp
testq %r15, %r15
je 0x289c
movl 0xe8c3(%rip), %edi      # 0x11140
movq %r14, %rsi
movq %r15, %rdx
callq 0x2140
testq %rax, %rax
js 0x28a0
je 0x28a2
subq %rax, %r15
addq %rax, %r14
jmp 0x2872
pushq $0x3
popq %rbx
jmp 0x28a2
xorl %ebx, %ebx
jmp 0x28a2
movl %ebp, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/lb3361[P]dosfs/dosfs.c
// Function: disk_write
DRESULT disk_write (BYTE pdrv, const BYTE *buff, LBA_t sector, UINT count)
{
  (void) pdrv;
  size_t sz = (size_t)count * 512;
  ssize_t rsz;

  if (! fd)
    return RES_NOTRDY;
  if (wp)
    return RES_WRPRT;
  if (lseek(fd, (off_t)(sector * 512), SEEK_SET) == (off_t)(-1))
    return RES_PARERR;
  while (sz > 0) {
    rsz = write(fd, buff, sz);
    if (rsz < 0)
      return RES_ERROR;
    if (rsz == 0)
      return RES_PARERR;
    sz -= rsz;
    buff += rsz;
  }
  return RES_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl 0xe884(%rip), %edi      # 0x11140
testl %edi, %edi
je 0x28cd
cmpl $0x0, 0xe979(%rip)      # 0x11240
je 0x28dd
pushq $0x2
jmp 0x28cf
pushq $0x3
popq %rbx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl %ecx, %ebp
movq %rsi, %r14
shlq $0x9, %rdx
movq %rdx, %rsi
xorl %edx, %edx
callq 0x2100
pushq $0x4
popq %rbx
cmpq $-0x1, %rax
je 0x28d0
movl %ebp, %r15d
shlq $0x9, %r15
pushq $0x1
popq %rbp
testq %r15, %r15
je 0x2928
movl 0xe832(%rip), %edi      # 0x11140
movq %r14, %rsi
movq %r15, %rdx
callq 0x20c0
testq %rax, %rax
js 0x292c
je 0x28d0
subq %rax, %r15
addq %rax, %r14
jmp 0x2903
xorl %ebx, %ebx
jmp 0x28d0
movl %ebp, %ebx
jmp 0x28d0
// File: /workspace/github_c_makefile_star2_O2/lb3361[P]dosfs/dosfs.c
// Function: disk_ioctl
DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void *buff)
{
  (void) pdrv;
  switch(cmd)
    {
    case CTRL_TRIM:
    case CTRL_SYNC:
      {
        return RES_OK;
      }
    case GET_SECTOR_SIZE:
      {
        *(WORD*)buff = 512;
        return RES_OK;
      }
    case GET_SECTOR_COUNT:
      {
        off_t sz;
        if (fd < 0)
          return RES_NOTRDY;
        sz = lseek(fd, 0, SEEK_END);
        if (sz == (off_t)-1)
          return RES_ERROR;
        *(LBA_t*)buff = (LBA_t)sz / 512;
        return RES_OK;
      }
    default:
      {
        break;
      }
    }
  return RES_PARERR;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpl $0x4, %esi
ja 0x297d
movq %rdx, %r14
xorl %ebx, %ebx
movl %esi, %eax
leaq 0x870d(%rip), %rcx      # 0xb054
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0xe7ea(%rip), %edi      # 0x11140
testl %edi, %edi
js 0x2981
xorl %ebx, %ebx
pushq $0x2
popq %rdx
xorl %esi, %esi
callq 0x2100
cmpq $-0x1, %rax
je 0x2985
shrq $0x9, %rax
movq %rax, (%r14)
jmp 0x2988
movw $0x200, (%r14)          # imm = 0x200
jmp 0x2988
pushq $0x4
jmp 0x2987
pushq $0x3
jmp 0x2987
pushq $0x1
popq %rbx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/lb3361[P]dosfs/dosfs.c
// Function: strconcat
char *strconcat(const char *str1, ...)
{
  va_list ap;
  const char *s;
  char *res, *d;
  int l = strlen(str1);

  va_start(ap, str1);
  while ((s = va_arg(ap, const char*)))
    l += strlen(s);
  va_end(ap);
  if (! (res = malloc(l + 1)))
    fatal("out of memory\n");
  strcpy(res, str1);
  d = res + strlen(res);
  va_start(ap, str1);
  while ((s = va_arg(ap, const char*))) {
    strcpy(d, s);
    d += strlen(d);
  }
  va_end(ap);
  return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rdi, %rbx
leaq 0x20(%rsp), %r15
movq %rsi, 0x8(%r15)
movq %rdx, 0x10(%r15)
movq %rcx, 0x18(%r15)
movq %r8, 0x20(%r15)
movq %r9, 0x28(%r15)
testb %al, %al
je 0x2a58
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
callq 0x20d0
movq %rax, %r14
movabsq $0x3000000008, %r12     # imm = 0x3000000008
movq %r12, (%rsp)
leaq 0x110(%rsp), %rax
movq %rax, 0x8(%rsp)
movq %r15, 0x10(%rsp)
pushq $0x8
popq %rbp
cmpl $0x28, %ebp
ja 0x2a98
movq %rax, %r13
movl %ebp, %eax
addq %r15, %rax
addl $0x8, %ebp
movl %ebp, (%rsp)
jmp 0x2aa1
leaq 0x8(%rax), %r13
movq %r13, 0x8(%rsp)
movq (%rax), %rdi
shlq $0x20, %r14
testq %rdi, %rdi
je 0x2abe
callq 0x20d0
sarq $0x20, %r14
addq %rax, %r14
movq %r13, %rax
jmp 0x2a83
movabsq $0x100000000, %rax      # imm = 0x100000000
addq %rax, %r14
sarq $0x20, %r14
movq %r14, %rdi
callq 0x21a0
testq %rax, %rax
je 0x2b68
movq %rax, %r14
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2080
movq %r14, %rdi
callq 0x20d0
movq %rax, %rbx
addq %r14, %rbx
movq %r12, (%rsp)
leaq 0x110(%rsp), %rax
movq %rax, 0x8(%rsp)
movq %r15, 0x10(%rsp)
pushq $0x8
popq %rbp
cmpl $0x28, %ebp
ja 0x2b2a
movq %rax, %r12
movl %ebp, %eax
addq %r15, %rax
addl $0x8, %ebp
movl %ebp, (%rsp)
jmp 0x2b33
leaq 0x8(%rax), %r12
movq %r12, 0x8(%rsp)
movq (%rax), %rsi
testq %rsi, %rsi
je 0x2b53
movq %rbx, %rdi
callq 0x2080
movq %rbx, %rdi
callq 0x20d0
addq %rax, %rbx
movq %r12, %rax
jmp 0x2b15
movq %r14, %rax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x86a4(%rip), %rdi      # 0xb213
xorl %eax, %eax
callq 0x234c
// File: /workspace/github_c_makefile_star2_O2/lb3361[P]dosfs/dosfs.c
// Function: fix_path
char *fix_path(const char *path)
{
  char *s, *np;

  while (*path == '/' || *path == '\\')
    path += 1;
  if (! (np = strdup(path)))
    fatal("out of memory\n");
  for (s = np; *s; s++)
    if (*s == '\\')
      *s = '/';
  while (s > np && s[-1] == '/')
    *--s = 0;
  return np;
}

// Assembly:
pushq %rax
movzbl (%rdi), %eax
cmpl $0x5c, %eax
je 0x2b84
cmpl $0x2f, %eax
jne 0x2b89
incq %rdi
jmp 0x2b77
callq 0x2240
testq %rax, %rax
je 0x2bbf
movq %rax, %rcx
movzbl (%rcx), %edx
cmpl $0x5c, %edx
je 0x2ba4
testl %edx, %edx
jne 0x2ba7
jmp 0x2bb8
movb $0x2f, (%rcx)
incq %rcx
jmp 0x2b96
cmpb $0x2f, -0x1(%rcx)
jne 0x2bbd
decq %rcx
movb $0x0, (%rcx)
cmpq %rax, %rcx
ja 0x2bac
popq %rcx
retq
leaq 0x864d(%rip), %rdi      # 0xb213
xorl %eax, %eax
callq 0x234c
// File: /workspace/github_c_makefile_star2_O2/lb3361[P]dosfs/dosfs.c
// Function: rmkdir
FRESULT rmkdir(char *path, int qflag)
{
  if (qflag) {
    char *s = strrchr(path,'/');
    if (dir_p(path))
      return FR_OK;
    if (s) {
      *s = 0;
      rmkdir(path, qflag);
      *s = '/';
    }
  }
  return f_mkdir(path);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
testl %esi, %esi
je 0x2c9d
movl %esi, %ebp
pushq $0x2f
popq %rsi
movq %rbx, %rdi
callq 0x20f0
movq %rax, %r14
movq %rbx, %rdi
callq 0x2c11
testl %eax, %eax
setne %cl
testq %r14, %r14
sete %dl
orb %cl, %dl
je 0x2c8b
testl %eax, %eax
je 0x2c9d
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
movb $0x0, (%r14)
movq %rbx, %rdi
movl %ebp, %esi
callq 0x2c4e
movb $0x2f, (%r14)
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x7b0d
// File: /workspace/github_c_makefile_star2_O2/lb3361[P]dosfs/dosfs.c
// Function: format_time
const char *format_time(WORD time)
{
  static char buffer[12];
  int hour = (time >> 11) & 0x1f;
  const char *ampm = (hour >= 12) ? "PM" : "AM";

  if (hour >= 12)
    hour -= 12;
  if (hour == 0)
    hour = 12;
  sprintf(buffer, "%02d:%02d %2s",
          hour, (time >> 5) & 0x3f, ampm);
  return buffer;
}

// Assembly:
pushq %rbx
movl %edi, %ecx
movl %edi, %eax
shrl $0xb, %eax
leal -0xc(%rax), %esi
cmpw $0x6000, %cx            # imm = 0x6000
leaq 0x853c(%rip), %rdx      # 0xb234
leaq 0x8538(%rip), %r8       # 0xb237
cmovaeq %rdx, %r8
cmovbl %eax, %esi
testl %esi, %esi
pushq $0xc
popq %rdx
cmovnel %esi, %edx
shrl $0x5, %ecx
andl $0x3f, %ecx
leaq 0xe535(%rip), %rbx      # 0x11250
leaq 0x8518(%rip), %rsi      # 0xb23a
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2210
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/lb3361[P]dosfs/dosfs.c
// Function: print_filinfo
void print_filinfo(FILINFO *inf, int xflag)
{
  printf("%s %s %8s %8lld ",
         format_date(inf->fdate), format_time(inf->ftime),
         (inf->fattrib & AM_DIR) ? "<DIR>" : "",
         (long long)(inf->fsize) );
#if FF_USE_LFN
  if (xflag)
    printf("%-12s ",
           (inf->altname[0] && strcasecmp(inf->fname, inf->altname))
           ? inf->altname : "");
  printf("%s\n", inf->fname);
#else
  printf("%s\n", inf->fname);
#endif
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
movzwl 0x8(%rdi), %edi
callq 0x2ca9
movzwl 0xa(%rbx), %edi
callq 0x2ce1
testb $0x10, 0xc(%rbx)
leaq 0x8745(%rip), %r14      # 0xb49f
leaq 0x84f8(%rip), %rcx      # 0xb259
cmoveq %r14, %rcx
movq (%rbx), %r8
leaq 0x84d9(%rip), %rdi      # 0xb248
leaq 0xe4ce(%rip), %rsi      # 0x11244
leaq 0xe4d3(%rip), %rdx      # 0x11250
xorl %eax, %eax
callq 0x20e0
testl %ebp, %ebp
je 0x2dbc
cmpb $0x0, 0xd(%rbx)
je 0x2dab
leaq 0xd(%rbx), %r15
leaq 0x1a(%rbx), %rdi
movq %r15, %rsi
callq 0x2050
testl %eax, %eax
leaq 0x86f8(%rip), %r14      # 0xb49f
cmovneq %r15, %r14
leaq 0x84ad(%rip), %rdi      # 0xb25f
movq %r14, %rsi
xorl %eax, %eax
callq 0x20e0
addq $0x1a, %rbx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x2090
// File: /workspace/github_c_makefile_star2_O2/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 0x33a5
pushq $0x1
popq %r14
movq 0xdd39(%rip), %rbp      # 0x10fd0
leaq 0x10(%rsp), %r12
leaq 0x270(%rsp), %r13
leaq 0x4(%rsp), %r15
cmpl (%rsp), %r14d
jge 0x339d
movslq %r14d, %rax
movq 0x8(%rsp), %rcx
movq (%rcx,%rax,8), %rdi
cmpb $0x2d, (%rdi)
jne 0x330b
cmpb $0x6f, 0x1(%rdi)
jne 0x33a5
cmpb $0x0, 0x2(%rdi)
jne 0x33a5
incl %r14d
cmpl (%rsp), %r14d
jge 0x33a5
movslq %r14d, %rbx
movq 0x8(%rsp), %rax
movq (%rax,%rbx,8), %rdi
movq (%rbp), %rdx
leaq 0x82de(%rip), %rsi      # 0xb5da
callq 0x2120
testq %rax, %rax
jne 0x336c
jmp 0x33b2
callq 0x2b76
movq %r12, %rdi
movq %rax, %rsi
pushq $0x1
popq %rdx
callq 0x4cea
testl %eax, %eax
jne 0x33a1
movq %r12, %rdi
movq %r13, %rsi
movl $0x1000, %edx           # imm = 0x1000
movq %r15, %rcx
callq 0x5e40
testl %eax, %eax
jne 0x3374
movl 0x4(%rsp), %edx
testq %rdx, %rdx
je 0x335b
movq (%rbp), %rcx
movq %r13, %rdi
pushq $0x1
popq %rsi
callq 0x2230
cmpl $0x1000, 0x4(%rsp)      # imm = 0x1000
je 0x3322
movq (%rbp), %rdi
callq 0x21c0
movq %r12, %rdi
callq 0x6983
incl %r14d
jmp 0x32a9
movl %eax, %ebx
movq (%rbp), %rdi
callq 0x21c0
leaq 0x10(%rsp), %rdi
callq 0x6983
movl %ebx, %eax
addq $0x1278, %rsp           # imm = 0x1278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebx, %ebx
jmp 0x3389
movl %eax, %ebx
jmp 0x3389
callq 0x3224
pushq $0x1
popq %rdi
callq 0x2220
movq 0x8(%rsp), %rax
movq (%rax,%rbx,8), %rsi
leaq 0x821b(%rip), %rdi      # 0xb5dd
xorl %eax, %eax
callq 0x234c
// File: /workspace/github_c_makefile_star2_O2/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 %r12
pushq %rbx
movq %rsi, %rbx
movslq %edi, %r15
xorl %r14d, %r14d
pushq $0x1
popq %r12
pushq $0x1
popq %rbp
xorl %eax, %eax
cmpq %r15, %r12
jge 0x3698
movq (%rbx,%r12,8), %rdi
cmpb $0x2d, (%rdi)
jne 0x3689
cmpb $0x71, 0x1(%rdi)
jne 0x36b0
cmpb $0x0, 0x2(%rdi)
movl %ebp, %r14d
je 0x3693
jmp 0x36b0
testq %rax, %rax
jne 0x36b0
callq 0x2b76
incq %r12
jmp 0x366a
testq %rax, %rax
je 0x36b0
movq %rax, %rdi
movl %r14d, %esi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x2c4e
callq 0x360a
pushq $0x1
popq %rdi
callq 0x2220
// File: /workspace/github_c_makefile_star2_O2/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
callq 0x2bcd
testl %eax, %eax
je 0x3746
cmpl $0x1, %ebx
adcl $0x0, %ebx
pushq $0x2f
popq %rsi
movq %r15, %rdi
callq 0x20f0
testq %rax, %rax
je 0x3761
movb $0x0, (%rax)
incq %rax
movq %r15, %r14
movq %rax, %r15
jmp 0x3768
movq %r15, %rdi
movl %ebx, %esi
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3826
leaq 0x7d37(%rip), %r14      # 0xb49f
leaq 0x8(%rsp), %rdi
leaq 0x68(%rsp), %rsi
movq %r14, %rdx
movq %r15, %rcx
callq 0x75e1
movl %eax, %ebp
testl $0xfffffffb, %eax       # imm = 0xFFFFFFFB
jne 0x37eb
leaq 0x8(%rsp), %r13
leaq 0x68(%rsp), %r15
testl %ebp, %ebp
jne 0x37e1
cmpb $0x0, 0x82(%rsp)
je 0x37e1
movq %r14, %rdi
leaq 0x7cf8(%rip), %rsi      # 0xb4a0
leaq 0x82(%rsp), %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x29f0
movq %rax, %r12
movq %rax, %rdi
movl %ebx, %esi
callq 0x3826
testl %eax, %eax
jne 0x37ff
movq %r12, %rdi
callq 0x2030
movq %r13, %rdi
movq %r15, %rsi
callq 0x7470
movl %eax, %ebp
jmp 0x3790
leaq 0x8(%rsp), %rdi
callq 0x6e38
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 0xd7f0(%rip), %rax      # 0x10ff8
movq (%rax), %rdi
leaq 0x8281(%rip), %rsi      # 0xba93
movq %r12, %rdx
xorl %eax, %eax
callq 0x2180
movq %r12, %rdi
callq 0x2030
jmp 0x37eb
// File: /workspace/github_c_makefile_star2_O2/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 0x2c11
testl %eax, %eax
je 0x388a
testl %ebp, %ebp
js 0x3858
movq 0xd9f5(%rip), %rsi      # 0x11238
leaq 0x826b(%rip), %rdi      # 0xbab5
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2568
testl %eax, %eax
je 0x38b6
leaq 0x7c41(%rip), %rsi      # 0xb4a0
leaq 0x7c3c(%rip), %rdx      # 0xb4a2
movq %rbx, %rdi
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x29f0
movq %rax, %r14
pushq $-0x1
popq %rsi
movq %rax, %rdi
callq 0x3703
movq %r14, %rdi
callq 0x2030
jmp 0x38aa
testl %ebp, %ebp
jle 0x38aa
movq 0xd9a3(%rip), %rsi      # 0x11238
leaq 0x8238(%rip), %rdi      # 0xbad4
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2568
testl %eax, %eax
je 0x38b6
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x793d
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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
movq %rsi, %rbx
movslq %edi, %r12
pushq $0x8
popq %rax
xorl %ebp, %ebp
pushq $0x1
popq %r15
pushq $-0x1
popq %r13
cmpq %r12, %r15
jge 0x3929
movq (%rbx,%r15,8), %rdi
cmpb $0x2d, (%rdi)
jne 0x3906
cmpb $0x69, 0x1(%rdi)
jne 0x38f5
cmpb $0x0, 0x2(%rdi)
je 0x3924
cmpb $0x71, 0x1(%rdi)
jne 0x3960
cmpb $0x0, 0x2(%rdi)
movl %r13d, %ebp
je 0x391f
jmp 0x3960
callq 0x2b76
movq %rax, %rdi
movl %ebp, %esi
callq 0x3703
movl %eax, %r14d
xorl %eax, %eax
testl %r14d, %r14d
jne 0x3942
incq %r15
jmp 0x38db
pushq $0x1
popq %rbp
jmp 0x391f
xorl %r14d, %r14d
testl %eax, %eax
jne 0x3960
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xd6af(%rip), %rax      # 0x10ff8
movq (%rax), %rdi
movq (%rbx,%r15,8), %rdx
leaq 0x818d(%rip), %rsi      # 0xbae4
xorl %eax, %eax
callq 0x2180
jmp 0x3930
callq 0x36bd
pushq $0x1
popq %rdi
callq 0x2220
// File: /workspace/github_c_makefile_star2_O2/lb3361[P]dosfs/dosfs.c
// Function: common_usage
void common_usage()
{
  int i;

  fprintf(stderr,
          "Usage: dosfs --<subcmd> <options> <..args..>\n"
          "Usage: dos<subcmd> <options> <..args..>\n"
          "Valid subcommands are:");
  for (i=0; commands[i].cmd; i++)
    fprintf(stderr, " %s", commands[i].cmd);
  fprintf(stderr, "\n");
  fprintf(stderr,
          "Common options:\n");
  common_options();
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq 0xccc3(%rip), %r14      # 0x10ff8
movq (%r14), %rcx
leaq 0x7ec3(%rip), %rdi      # 0xc202
pushq $0x6b
popq %rsi
pushq $0x1
popq %rdx
callq 0x2230
leaq 0xcdff(%rip), %r15      # 0x11150
leaq 0x7f16(%rip), %rbx      # 0xc26e
movq (%r15), %rdx
movq (%r14), %rsi
testq %rdx, %rdx
je 0x4376
movq %rsi, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2180
addq $0x18, %r15
jmp 0x4358
pushq $0xa
popq %rdi
callq 0x2130
movq (%r14), %rcx
leaq 0x7eea(%rip), %rdi      # 0xc272
pushq $0x10
popq %rsi
pushq $0x1
popq %rdx
callq 0x2230
popq %rbx
popq %r14
popq %r15
jmp 0x254a
// File: /workspace/github_c_makefile_star2_O2/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:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq 0x18(%rdi), %r14
movl 0x34(%r14), %eax
movl %eax, 0xc(%rsi)
leaq 0x38(%r14), %rdi
callq 0x9f79
movq %rax, 0x10(%rbx)
movb 0x21(%r14), %al
andb $0x2, %al
movb %al, 0xb(%rbx)
andl $0x0, 0x1c(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rax
movq 0x18(%rax), %r14
movq %r14, %rdi
callq 0xa891
movw %ax, 0x2(%r14)
movzbl 0x1(%r14), %r15d
movl 0x54(%rbx), %esi
movq %rbx, %rdi
callq 0x6d3b
pushq $0x20
popq %rbp
testl %eax, %eax
jne 0x5a49
movq (%rbx), %rdi
movq 0x38(%rbx), %rsi
callq 0x5bf6
testl %eax, %eax
jne 0x5a49
movq 0x40(%rbx), %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x60c7
movq (%rbx), %rax
movb $0x1, 0x3(%rax)
subl $0x1, %r15d
jb 0x5a47
addq $0x20, %r14
movq %rbx, %rdi
xorl %esi, %esi
callq 0x7336
jmp 0x5a08
xorl %eax, %eax
cmpl $0x2, %eax
pushq $0x2
popq %rcx
cmovbl %eax, %ecx
movl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x5c47
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
callq 0xaad2
testl %eax, %eax
je 0x5c16
pushq $0x1
popq %rax
jmp 0x5c40
movzbl 0x1(%rbx), %edi
leaq 0x60(%rbx), %rsi
pushq $0x1
popq %rcx
movq %r14, %rdx
callq 0x283b
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_O2/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 0x685b
movq %rdi, %r14
movl 0xc(%rdi), %esi
movl 0x18(%rdi), %r15d
subl $0x1, %r15d
jb 0x6856
movq (%r14), %rdi
leal 0x1(%rsi), %ebp
movl %ebp, %edx
callq 0xa8cc
movl %ebp, %esi
testl %eax, %eax
je 0x6839
movl %eax, %ebx
jmp 0x685b
movb $0x0, 0xb(%r14)
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r14
pushq %rbx
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %r14
movl 0x1c(%rdi), %eax
testl %eax, %eax
je 0x68a2
movq (%r14), %rdi
movl %ebp, %edx
subl %eax, %edx
leal 0x1(%rdx), %esi
addl $0x2, %edx
cmpl $0x1, %eax
cmovel %ebx, %edx
callq 0xa8cc
testl %eax, %eax
jne 0x68a4
movl 0x1c(%r14), %eax
decl %eax
movl %eax, 0x1c(%r14)
jmp 0x6876
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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)
andl $0x0, 0x1c(%rdi)
movl 0x28(%rsi), %esi
movl %esi, 0x54(%rdi)
callq 0x6d3b
testl %eax, %eax
je 0x68dd
popq %rbx
retq
movq %rbx, %rdi
popq %rbx
jmp 0xab38
// File: /workspace/github_c_makefile_star2_O2/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 0xaad2
testl %eax, %eax
je 0x68ff
pushq $0x1
popq %rax
jmp 0x697b
cmpb $0x3, (%rbx)
jne 0x6965
cmpb $0x1, 0x4(%rbx)
jne 0x6965
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
pushq $0x1
popq %rcx
movq %r14, %rsi
callq 0x28af
movb $0x0, 0x4(%rbx)
movzbl 0x1(%rbx), %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2930
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_O2/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 %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x1a(%rsi), %r15
pushq $0x4
popq %rbp
movq %r14, %rdi
movq %rbx, %rsi
callq 0x6e58
movl %eax, %r12d
testq %rbx, %rbx
je 0x74b7
testl %r12d, %r12d
jne 0x74b7
cmpb $0x0, (%r15)
je 0x74b7
movq 0x58(%r14), %rdi
movq %r15, %rsi
xorl %edx, %edx
movl %ebp, %ecx
callq 0x74c3
testl %eax, %eax
je 0x7485
movl %r12d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/lb3361[P]dosfs/ff.c
// Function: pattern_match
static int pattern_match (	/* 0:mismatched, 1:matched */
	const TCHAR* pat,	/* Matching pattern */
	const TCHAR* nam,	/* String to be tested */
	UINT skip,			/* Number of pre-skip chars (number of ?s, b8:infinite (* specified)) */
	UINT recur			/* Recursion count */
)
{
	const TCHAR *pptr, *nptr;
	DWORD pchr, nchr;
	UINT sk;


	while ((skip & 0xFF) != 0) {		/* Pre-skip name chars */
		if (!get_achar(&nam)) return 0;	/* Branch mismatched if less name chars */
		skip--;
	}
	if (*pat == 0 && skip) return 1;	/* Matched? (short circuit) */

	do {
		pptr = pat; nptr = nam;			/* Top of pattern and name to match */
		for (;;) {
			if (*pptr == '?' || *pptr == '*') {	/* Wildcard term? */
				if (recur == 0) return 0;	/* Too many wildcard terms? */
				sk = 0;
				do {	/* Analyze the wildcard term */
					if (*pptr++ == '?') sk++; else sk |= 0x100;
				} while (*pptr == '?' || *pptr == '*');
				if (pattern_match(pptr, nptr, sk, recur - 1)) return 1;	/* Test new branch (recursive call) */
				nchr = *nptr; break;	/* Branch mismatched */
			}
			pchr = get_achar(&pptr);	/* Get a pattern char */
			nchr = get_achar(&nptr);	/* Get a name char */
			if (pchr != nchr) break;	/* Branch mismatched? */
			if (pchr == 0) return 1;	/* Branch matched? (matched at end of both strings) */
		}
		get_achar(&nam);			/* nam++ */
	} while (skip && nchr);		/* Retry until end of name if infinite search is specified */

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %ecx, %r12d
movl %edx, %ebp
movq %rdi, %r14
leaq 0x18(%rsp), %r15
movq %rsi, (%r15)
movl %edx, %ebx
testb %bl, %bl
je 0x74fc
movq %r15, %rdi
callq 0xac91
decl %ebx
testl %eax, %eax
jne 0x74e3
xorl %eax, %eax
jmp 0x75d2
pushq $0x1
popq %rax
cmpl $0x100, %ebp            # imm = 0x100
jb 0x7511
cmpb $0x0, (%r14)
je 0x75d2
movq %r12, 0x20(%rsp)
leal -0x1(%r12), %eax
movl %eax, 0xc(%rsp)
movq %rsp, %r13
leaq 0x10(%rsp), %r12
movq %r14, (%rsp)
movq 0x18(%rsp), %rax
movq %rax, 0x10(%rsp)
movq (%rsp), %rdi
movzbl (%rdi), %eax
cmpl $0x3f, %eax
je 0x7562
cmpl $0x2a, %eax
je 0x7562
movq %r13, %rdi
callq 0xac91
movl %eax, %ebx
movq %r12, %rdi
callq 0xac91
cmpl %eax, %ebx
jne 0x75ad
testl %ebx, %ebx
jne 0x7535
jmp 0x75cf
cmpl $0x0, 0x20(%rsp)
je 0x74f5
incq %rdi
xorl %edx, %edx
leal 0x1(%rdx), %ecx
orl $0x100, %edx            # imm = 0x100
cmpb $0x3f, %al
cmovel %ecx, %edx
movzbl (%rdi), %eax
cmpl $0x3f, %eax
je 0x7589
cmpl $0x2a, %eax
jne 0x758e
incq %rdi
jmp 0x756e
movq %rdi, (%rsp)
movq 0x10(%rsp), %r15
movq %r15, %rsi
movl 0xc(%rsp), %ecx
callq 0x74c3
testl %eax, %eax
jne 0x75cf
movsbl (%r15), %r15d
jmp 0x75b0
movl %eax, %r15d
leaq 0x18(%rsp), %rdi
callq 0xac91
xorl %eax, %eax
cmpl $0x100, %ebp            # imm = 0x100
jb 0x75d2
testl %r15d, %r15d
jne 0x7527
jmp 0x75d2
pushq $0x1
popq %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 0x6c4a
testl %eax, %eax
je 0x7603
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x7470
// File: /workspace/github_c_makefile_star2_O2/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 0x473a
testl %eax, %eax
jne 0x7667
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 0x50b1
testl %eax, %eax
je 0x7675
movl %eax, %ebp
movl %ebp, %eax
addq $0x4d8, %rsp            # imm = 0x4D8
popq %rbx
popq %rbp
retq
cmpb $0x0, 0x63(%rsp)
js 0x7692
xorl %ebp, %ebp
testq %rbx, %rbx
je 0x7669
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x70a6
jmp 0x7669
pushq $0x6
popq %rbp
jmp 0x7669
// File: /workspace/github_c_makefile_star2_O2/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 0x7ae9
movq %rbx, %rdi
callq 0x6d3b
movl %eax, %ecx
testl %eax, %eax
jne 0x7b06
jmp 0x7ae9
cmpb $0x4, (%r14)
movq 0x40(%rbx), %rax
movb $-0x1b, %cl
jne 0x7acf
movb (%rax), %cl
andb $0x7f, %cl
movb %cl, (%rax)
movb $0x1, 0x3(%r14)
cmpl %ebp, 0x30(%rbx)
jae 0x7b04
movq %rbx, %rdi
xorl %esi, %esi
callq 0x7336
testl %eax, %eax
jne 0x7af9
movq 0x38(%rbx), %rsi
movq %r14, %rdi
callq 0x5bf6
testl %eax, %eax
je 0x7abe
cmpl $0x4, %eax
pushq $0x2
popq %rcx
cmovnel %eax, %ecx
jmp 0x7b06
xorl %ecx, %ecx
movl %ecx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq $0x2
popq %rdx
movq %rax, %rdi
callq 0x473a
testl %eax, %eax
jne 0x8136
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 0x50b1
movl %eax, %ecx
xorl %edx, %edx
testb $-0x60, 0x53(%r15)
sete %sil
pushq $0x6
popq %rax
cmovel %edx, %eax
testl %ecx, %ecx
sete %dl
cmovnel %ecx, %eax
andb %sil, %dl
cmpb $0x1, %dl
jne 0x8136
andb $0x27, %bl
andb %bl, %bpl
cmpb $0x4, (%r14)
jne 0x8119
movq 0x18(%r14), %rax
notb %bl
andb 0x4(%rax), %bl
orb %bpl, %bl
movb %bl, 0x4(%rax)
leaq 0x10(%rsp), %rdi
callq 0x59d7
testl %eax, %eax
jne 0x8136
jmp 0x812e
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 0x68ea
addq $0x4d8, %rsp            # imm = 0x4D8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq