LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/weaslepalace[P]FreeRTOS_Posix_Sim/AsyncIO/AsyncIO.c
// Function: prvSignalHandler
void prvSignalHandler( int signal, siginfo_t * data, void * pvParam )
{
int iSocket = 0, iReturn;
xAsyncIOCallback *pxIterator;
struct pollfd xFileDescriptorPollEvents;
	if ( SIG_MSG_RX == signal )	/* Are we in the correct signal handler. */
	{
		if ( data->si_code == SI_SIGIO )	/* Do we know which socket caused the signal? */
		{
			iSocket = data->si_fd;	/* Yes we do. Find the owner. */

			for ( pxIterator = &xHead; ( pxIterator->pxNext != NULL ) && ( pxIterator->iFileHandle != iSocket ); pxIterator = pxIterator->pxNext );

			if ( pxIterator->iFileHandle == iSocket )
			{
				( pxIterator->pvFunction )( iSocket, pxIterator->pvContext );
			}
			else
			{
				printf( "No socket owner.\n" );
			}
		}
		else
		{
			/* We don't know which socket cause the signal. Use poll to find the socket. */
			for ( pxIterator = &xHead; pxIterator != NULL; pxIterator = pxIterator->pxNext )
			{
				xFileDescriptorPollEvents.fd = pxIterator->iFileHandle;
				xFileDescriptorPollEvents.events = POLLIN;
				xFileDescriptorPollEvents.revents = 0;
				if ( xFileDescriptorPollEvents.fd != 0 )
				{
					iReturn = poll( &xFileDescriptorPollEvents, 1, 0 );	/* Need to kick off the signal handling. */

					if ( ( 1 == iReturn ) && ( POLLIN == xFileDescriptorPollEvents.revents ) )
					{
						if ( pxIterator->pvFunction != NULL )
						{
							( pxIterator->pvFunction )( xFileDescriptorPollEvents.fd, pxIterator->pvContext );
						}
					}
				}
			}
			/* Note that poll should really be passed all of the sockets in one go and then iterate over the results. */
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
cmpl $0x1d, %edi
jne 0x7c48
cmpl $-0x5, 0x8(%rsi)
jne 0x7bf6
movl 0x18(%rsi), %edi
leaq 0x4d68(%rip), %rcx      # 0xc938
movq %rcx, %rax
movq 0x18(%rcx), %rcx
testq %rcx, %rcx
je 0x7be0
cmpl %edi, (%rax)
jne 0x7bd0
cmpl %edi, (%rax)
jne 0x7c51
movq 0x8(%rax), %rcx
movq 0x10(%rax), %rsi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmpq *%rcx
leaq 0x4d3b(%rip), %r14      # 0xc938
leaq -0x18(%rbp), %rbx
movl (%r14), %eax
movl %eax, -0x18(%rbp)
movl $0x1, -0x14(%rbp)
testl %eax, %eax
je 0x7c3f
movl $0x1, %esi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x4510
cmpl $0x1, %eax
jne 0x7c3f
cmpw $0x1, -0x12(%rbp)
jne 0x7c3f
movq 0x8(%r14), %rax
testq %rax, %rax
je 0x7c3f
movl -0x18(%rbp), %edi
movq 0x10(%r14), %rsi
callq *%rax
movq 0x18(%r14), %r14
testq %r14, %r14
jne 0x7c01
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x15d2(%rip), %rdi      # 0x922a
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x40c0
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/weaslepalace[P]FreeRTOS_Posix_Sim/AsyncIO/AsyncIOSerial.c
// Function: lAsyncIOSerialOpen
long lAsyncIOSerialOpen( const char *pcDevice, int *piDeviceDescriptor )
{
int iSerialDevice = 0;
struct termios xTerminalSettings;
long lReturn = pdFALSE;

	/* Open the port that was passed in. */
	iSerialDevice = open( pcDevice, O_RDWR | O_NOCTTY | O_NONBLOCK );
	if ( iSerialDevice < 0 )
	{
		lReturn = pdFALSE;
	}
	else
	{
		/* Grab a copy of the current terminal settings. */
		if ( 0 == tcgetattr( iSerialDevice, &xTerminalSettings ) )
		{
			/* Configure the port to the Hard-coded values. */
			cfmakeraw( &xTerminalSettings );
			cfsetspeed( &xTerminalSettings, B38400 );
			/* Set the terminal settings. */
			lReturn = ( 0 == tcsetattr(iSerialDevice, TCSANOW, &xTerminalSettings) );

			/* Pass out the device descriptor for subsequent calls to AsyncIORegisterCallback() */
			*piDeviceDescriptor = iSerialDevice;
		}
	}

	return lReturn;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x48, %rsp
movq %rsi, %rbx
xorl %r15d, %r15d
movl $0x902, %esi            # imm = 0x902
xorl %eax, %eax
callq 0x45b0
testl %eax, %eax
js 0x7cd4
movl %eax, %r14d
leaq -0x54(%rbp), %rsi
movl %eax, %edi
callq 0x4570
testl %eax, %eax
je 0x7ca2
xorl %r15d, %r15d
jmp 0x7cd4
leaq -0x54(%rbp), %r15
movq %r15, %rdi
callq 0x44f0
movq %r15, %rdi
movl $0xf, %esi
callq 0x41f0
movl %r14d, %edi
xorl %esi, %esi
movq %r15, %rdx
callq 0x4580
xorl %r15d, %r15d
testl %eax, %eax
sete %r15b
movl %r14d, (%rbx)
movq %r15, %rax
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/weaslepalace[P]FreeRTOS_Posix_Sim/AsyncIO/AsyncIOSerial.c
// Function: vAsyncSerialIODataAvailableISR
void vAsyncSerialIODataAvailableISR( int iFileDescriptor, void *pContext )
{
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
ssize_t iReadResult = -1;
unsigned char ucRx;

	/* This handler only processes a single byte/character at a time. */
	iReadResult = read( iFileDescriptor, &ucRx, 1 );
	if ( 1 == iReadResult )
	{
		if ( NULL != pContext )
		{
			/* Send the received byte to the queue. */
			if ( pdTRUE != xQueueSendFromISR( (xQueueHandle)pContext, &ucRx, &xHigherPriorityTaskWoken ) )
			{
				/* the queue is full. */
			}
		}
	}
	portEND_SWITCHING_ISR( xHigherPriorityTaskWoken );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq $0x0, -0x18(%rbp)
leaq -0x9(%rbp), %rsi
movl $0x1, %edx
callq 0x4290
testq %rbx, %rbx
je 0x7d21
cmpq $0x1, %rax
jne 0x7d21
leaq -0x9(%rbp), %rsi
leaq -0x18(%rbp), %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x4100
cmpq $0x0, -0x18(%rbp)
je 0x7d2d
callq 0x4440
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/weaslepalace[P]FreeRTOS_Posix_Sim/AsyncIO/AsyncIOSocket.c
// Function: iSocketOpenUDP
int iSocketOpenUDP( void (*vSocketCallback)( int, void * ), void *pvContext, struct sockaddr_in *pxBindAddress )
{
int iSocket = 0;

	taskENTER_CRITICAL();
	{
		/* Open a new socket. */
		iSocket = socket( PF_INET, SOCK_DGRAM, IPPROTO_UDP );
		if ( 0 != iSocket )
		{
			/* Have we been passed a call back function that will deal with received messages? */
			if ( pdTRUE == lAsyncIORegisterCallback( iSocket, vSocketCallback, pvContext ) )
			{
				/* This is UDP so bind it passed listen address. */
				if ( NULL != pxBindAddress )
				{
					if ( 0 != bind( iSocket, ( struct sockaddr *)pxBindAddress, sizeof( struct sockaddr_in ) ) )
					{
						printf("Bind error: %d\n", errno );
					}
				}
			}
			else
			{
				/* Socket is being used as polled IO or for sending data. */
			}
		}
		else
		{
			printf( "Failed to open socket: %d.\n", errno );
		}
	}
	taskEXIT_CRITICAL();
	return iSocket;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
callq 0x4320
movl $0x2, %edi
movl $0x2, %esi
movl $0x11, %edx
callq 0x4790
movl %eax, %ebx
testl %eax, %eax
je 0x7d9b
movl %ebx, %edi
movq %r12, %rsi
movq %r15, %rdx
callq 0x4420
testq %r14, %r14
je 0x7db3
cmpq $0x1, %rax
jne 0x7db3
movl %ebx, %edi
movq %r14, %rsi
movl $0x10, %edx
callq 0x4520
testl %eax, %eax
je 0x7db3
leaq 0x14a2(%rip), %r14      # 0x923b
jmp 0x7da2
leaq 0x14a9(%rip), %r14      # 0x924b
callq 0x40a0
movl (%rax), %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x4170
callq 0x4480
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/weaslepalace[P]FreeRTOS_Posix_Sim/AsyncIO/AsyncIOSocket.c
// Function: iSocketUDPSendTo
int iSocketUDPSendTo( int iSocket, xUDPPacket *pxPacket, struct sockaddr_in *pxSendAddress )
{
int iBytesSent = 0;
	if ( ( 0 != iSocket ) && ( NULL != pxPacket ) )
	{
		taskENTER_CRITICAL();
			iBytesSent = sendto( iSocket, pxPacket, sizeof( xUDPPacket ), 0, ( struct sockaddr *)pxSendAddress, sizeof( struct sockaddr_in ) );
		taskEXIT_CRITICAL();
	}
	return iBytesSent;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
testl %edi, %edi
sete %al
testq %rsi, %rsi
sete %cl
xorl %r12d, %r12d
orb %al, %cl
jne 0x7e2b
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %r15d
callq 0x4320
movl $0x400, %edx            # imm = 0x400
movl %r15d, %edi
movq %r14, %rsi
xorl %ecx, %ecx
movq %rbx, %r8
movl $0x10, %r9d
callq 0x4200
movq %rax, %r12
callq 0x4480
movl %r12d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/weaslepalace[P]FreeRTOS_Posix_Sim/AsyncIO/AsyncIOSocket.c
// Function: iSocketUDPReceiveISR
int iSocketUDPReceiveISR( int iSocket, xUDPPacket *pxPacket, struct sockaddr_in *pxReceiveAddress )
{
int iBytesReceived = 0;
socklen_t xSocketLength = sizeof( struct sockaddr_in );

	if ( 0 != iSocket )
	{
		iBytesReceived = recvfrom( iSocket, pxPacket, sizeof( xUDPPacket ), 0, ( struct sockaddr *)pxReceiveAddress, &xSocketLength );
		pxPacket->ucNull = 0;
	}
	return iBytesReceived;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl $0x10, -0xc(%rbp)
testl %edi, %edi
je 0x7e67
movq %rdx, %r8
movq %rsi, %rbx
leaq -0xc(%rbp), %r9
movl $0x400, %edx            # imm = 0x400
xorl %ecx, %ecx
callq 0x4450
movb $0x0, 0x3ff(%rbx)
jmp 0x7e69
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/weaslepalace[P]FreeRTOS_Posix_Sim/AsyncIO/AsyncIOSocket.c
// Function: iSocketUDPReceiveFrom
int iSocketUDPReceiveFrom( int iSocket, xUDPPacket *pxPacket, struct sockaddr_in *pxReceiveAddress )
{
int iBytesReceived = 0;
socklen_t xSocketLength = sizeof( struct sockaddr_in );

	if ( 0 != iSocket )
	{
		taskENTER_CRITICAL();
			iBytesReceived = recvfrom( iSocket, pxPacket, sizeof( xUDPPacket ), 0, ( struct sockaddr *)pxReceiveAddress, &xSocketLength );
			pxPacket->ucNull = 0;
		taskEXIT_CRITICAL();
	}
	return iBytesReceived;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl $0x10, -0x1c(%rbp)
testl %edi, %edi
je 0x7ebd
movq %rdx, %r14
movq %rsi, %rbx
movl %edi, %r15d
callq 0x4320
leaq -0x1c(%rbp), %r9
movl $0x400, %edx            # imm = 0x400
movl %r15d, %edi
movq %rbx, %rsi
xorl %ecx, %ecx
movq %r14, %r8
callq 0x4450
movq %rax, %r14
movb $0x0, 0x3ff(%rbx)
callq 0x4480
jmp 0x7ec0
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/weaslepalace[P]FreeRTOS_Posix_Sim/AsyncIO/AsyncIOSocket.c
// Function: vUDPReceiveAndDeliverCallback
void vUDPReceiveAndDeliverCallback( int iSocket, void *pvContext )
{
portBASE_TYPE xHigherTaskWoken = pdFALSE;
static xUDPPacket xPacket;
struct sockaddr_in xReceiveAddress;

	if ( sizeof( xUDPPacket ) == iSocketUDPReceiveISR( iSocket, &xPacket, &xReceiveAddress ) )
	{
		if ( pdPASS != xQueueSendFromISR( (xQueueHandle)pvContext, &xPacket, &xHigherTaskWoken ) )
		{
			printf( "UDP Rx failed\n" );
		}
	}
	else
	{
		printf( "UDP Rx failed: %d\n", errno );
	}
	portEND_SWITCHING_ISR( xHigherTaskWoken );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x28, %rsp
movq $0x0, -0x18(%rbp)
movl $0x10, -0xc(%rbp)
testl %edi, %edi
je 0x7f3f
movq %rsi, %rbx
leaq 0x4a68(%rip), %rsi      # 0xc95c
leaq -0x28(%rbp), %r8
leaq -0xc(%rbp), %r9
movl $0x400, %edx            # imm = 0x400
xorl %ecx, %ecx
callq 0x4450
movb $0x0, 0x4e4c(%rip)      # 0xcd5b
cmpl $0x400, %eax            # imm = 0x400
jne 0x7f3f
leaq 0x4a3f(%rip), %rsi      # 0xc95c
leaq -0x18(%rbp), %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x4100
cmpq $0x1, %rax
je 0x7f54
leaq 0x1342(%rip), %rdi      # 0x927a
callq 0x40c0
jmp 0x7f54
callq 0x40a0
movl (%rax), %esi
leaq 0x131a(%rip), %rdi      # 0x9267
xorl %eax, %eax
callq 0x4170
cmpq $0x0, -0x18(%rbp)
je 0x7f60
callq 0x4440
addq $0x28, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O1/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), %r15
testq %r15, %r15
je 0x817a
movl (%r15), %eax
movl %eax, -0x2c(%rbp)
movq 0x8(%r15), %r14
leaq -0x230(%rbp), %rdi
xorl %r12d, %r12d
movl $0x200, %edx            # imm = 0x200
xorl %esi, %esi
callq 0x41e0
testq %r14, %r14
je 0x815e
leaq 0x4cbe(%rip), %rbx      # 0xcdc0
movl $0x2000, %edx           # imm = 0x2000
movl -0x2c(%rbp), %edi
movq %rbx, %rsi
leaq -0x30(%rbp), %rcx
callq 0x4590
movq %rax, %r13
testl %r13d, %r13d
jle 0x8132
movl $0x200, %edx            # imm = 0x200
leaq -0x230(%rbp), %rdi
movq %rbx, %rsi
callq 0x4350
testl %r13d, %r13d
jle 0x815e
cmpl $0x9, %r12d
ja 0x815e
incl %r12d
movq 0x10(%r15), %rax
movl $0x40, %ecx
movq %rsp, %rdi
leaq -0x230(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movq %rax, %rdi
callq *%r14
jmp 0x8102
leaq 0x4c13(%rip), %rsi      # 0xcd78
movl -0x2c(%rbp), %edi
callq 0x4610
testl %eax, %eax
je 0x8192
leaq 0x112f(%rip), %rbx      # 0x92a7
jmp 0x8181
leaq 0x1116(%rip), %rbx      # 0x9297
callq 0x40a0
movl (%rax), %esi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x4170
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x8202
leaq 0x10(%rbp), %rsi
movl $0x1, %ebx
movl $0x200, %edx            # imm = 0x200
movl $0x1, %ecx
callq 0x4240
testl %eax, %eax
je 0x8202
leaq 0x1115(%rip), %rdi      # 0x9310
callq 0x40c0
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x4ba5(%rip), %rsi      # 0xcdc0
leaq -0xc(%rbp), %rcx
movl $0x2000, %edx           # imm = 0x2000
callq 0x4590
testl %eax, %eax
jle 0x8248
leaq 0x4b8c(%rip), %rsi      # 0xcdc0
movl $0x200, %edx            # imm = 0x200
movq %rbx, %rdi
callq 0x4350
movl $0x1, %eax
jmp 0x824a
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0xe7bb(%rip), %r14      # 0x10ff8
movq (%r14), %rcx
leaq 0xa9d6(%rip), %rdi      # 0xd21d
pushq $0x6b
popq %rsi
pushq $0x1
popq %rdx
callq 0x2240
movq 0xe8f7(%rip), %rdx      # 0x11150
testq %rdx, %rdx
je 0x2885
leaq 0xe903(%rip), %r15      # 0x11168
leaq 0xaa1d(%rip), %rbx      # 0xd289
movq (%r14), %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x2190
movq (%r15), %rdx
addq $0x18, %r15
testq %rdx, %rdx
jne 0x286c
movq (%r14), %rsi
pushq $0xa
popq %rdi
callq 0x2140
movq (%r14), %rcx
leaq 0xa9f3(%rip), %rdi      # 0xd28d
pushq $0x10
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
callq 0x2240
movq (%r14), %rcx
leaq 0x98a3(%rip), %rdi      # 0xc155
movl $0x92, %esi
movq %rbx, %rdx
popq %rbx
popq %r14
popq %r15
jmp 0x2240
// File: /workspace/github_c_makefile_star2_O1/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 0x2b4f
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 0xe482(%rip), %r15      # 0x10ff8
movq (%r15), %rcx
leaq 0x94e8(%rip), %rdi      # 0xc068
movl $0x7, %esi
movl $0x1, %edx
callq 0x2240
movq (%r15), %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x2210
movl $0x1, %edi
callq 0x2230
// File: /workspace/github_c_makefile_star2_O1/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 0x2c2a
movl %esi, %eax
leaq 0x944c(%rip), %rcx      # 0xc004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x1, %edi
callq 0x2230
leaq 0x9535(%rip), %rdi      # 0xc107
jmp 0x2c23
leaq 0x94f5(%rip), %rdi      # 0xc0d0
jmp 0x2c23
leaq 0x94ff(%rip), %rdi      # 0xc0e3
jmp 0x2c23
leaq 0x94d3(%rip), %rdi      # 0xc0c0
jmp 0x2c23
leaq 0x94ba(%rip), %rdi      # 0xc0b0
jmp 0x2c23
leaq 0x94a6(%rip), %rdi      # 0xc0a5
jmp 0x2c23
leaq 0x9512(%rip), %rdi      # 0xc11a
jmp 0x2c23
leaq 0x94e5(%rip), %rdi      # 0xc0f6
jmp 0x2c23
leaq 0x9515(%rip), %rdi      # 0xc12f
jmp 0x2c23
leaq 0x945d(%rip), %rdi      # 0xc080
xorl %eax, %eax
callq 0x2aec
leaq 0x9511(%rip), %rdi      # 0xc142
xorl %eax, %eax
callq 0x2aec
// File: /workspace/github_c_makefile_star2_O1/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 0xe5d0(%rip), %rdi      # 0x11230
movl $0x2, %esi
xorl %eax, %eax
callq 0x2200
movl %eax, 0xe4ce(%rip)      # 0x11140
testl %eax, %eax
jns 0x2c9a
movl $0x1, 0xe5c0(%rip)      # 0x11240
movq 0xe5a9(%rip), %rdi      # 0x11230
xorl %esi, %esi
xorl %eax, %eax
callq 0x2200
movl %eax, 0xe4aa(%rip)      # 0x11140
testl %eax, %eax
js 0x2cbb
cmpl $0x0, 0xe59f(%rip)      # 0x11240
setne %al
shlb $0x2, %al
cmpl $0x0, 0xe492(%rip)      # 0x11140
movzbl %al, %ecx
movl $0x1, %eax
cmovnsl %ecx, %eax
popq %rcx
retq
movq 0xe56e(%rip), %rsi      # 0x11230
leaq 0x9533(%rip), %rdi      # 0xc1fc
xorl %eax, %eax
callq 0x2aec
// File: /workspace/github_c_makefile_star2_O1/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 0xe463(%rip), %edi      # 0x11140
testl %edi, %edi
je 0x2d2e
movl %ecx, %ebp
movq %rsi, %r14
shlq $0x9, %rdx
movq %rdx, %rsi
xorl %edx, %edx
callq 0x2110
movl $0x4, %ebx
cmpq $-0x1, %rax
je 0x2d33
testl %ebp, %ebp
je 0x2d2a
movl %ebp, %r15d
shlq $0x9, %r15
movl 0xe430(%rip), %edi      # 0x11140
movq %r14, %rsi
movq %r15, %rdx
callq 0x2150
testq %rax, %rax
js 0x2d40
je 0x2d33
addq %rax, %r14
subq %rax, %r15
jne 0x2d0a
xorl %ebx, %ebx
jmp 0x2d33
movl $0x3, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, %ebx
jmp 0x2d33
// File: /workspace/github_c_makefile_star2_O1/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 0xe3ec(%rip), %edi      # 0x11140
testl %edi, %edi
je 0x2db3
movl $0x2, %ebx
cmpl $0x0, 0xe4dc(%rip)      # 0x11240
jne 0x2db8
movl %ecx, %ebp
movq %rsi, %r14
shlq $0x9, %rdx
movq %rdx, %rsi
xorl %edx, %edx
callq 0x2110
movl $0x4, %ebx
cmpq $-0x1, %rax
je 0x2db8
testl %ebp, %ebp
je 0x2daf
movl %ebp, %r15d
shlq $0x9, %r15
movl 0xe3ab(%rip), %edi      # 0x11140
movq %r14, %rsi
movq %r15, %rdx
callq 0x20d0
testq %rax, %rax
js 0x2dc5
je 0x2db8
addq %rax, %r14
subq %rax, %r15
jne 0x2d8f
xorl %ebx, %ebx
jmp 0x2db8
movl $0x3, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, %ebx
jmp 0x2db8
// File: /workspace/github_c_makefile_star2_O1/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 0x2e1b
movq %rdx, %r14
xorl %ebx, %ebx
movl %esi, %eax
leaq 0x9271(%rip), %rcx      # 0xc054
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0xe34e(%rip), %edi      # 0x11140
testl %edi, %edi
js 0x2e22
xorl %ebx, %ebx
xorl %esi, %esi
movl $0x2, %edx
callq 0x2110
cmpq $-0x1, %rax
je 0x2e29
shrq $0x9, %rax
movq %rax, (%r14)
jmp 0x2e2e
movw $0x200, (%r14)          # imm = 0x200
jmp 0x2e2e
movl $0x4, %ebx
jmp 0x2e2e
movl $0x3, %ebx
jmp 0x2e2e
movl $0x1, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/lb3361[P]dosfs/dosfs.c
// Function: get_fattime
DWORD get_fattime (void)
{
  DWORD res = 0;
  time_t tim = time(NULL);
  struct tm *tm = localtime(&tim);

  res |= ((tm->tm_year - 80) & 0x7f ) << 25;
  res |= ((tm->tm_mon + 1) & 0xf) << 21;
  res |= ((tm->tm_mday) & 0x1f) << 16;
  res |= ((tm->tm_hour) & 0x1f) << 11;
  res |= ((tm->tm_min) & 0x3f) << 5;
  res |= ((tm->tm_sec) & 0x3f) >> 1;
  return res;
}

// Assembly:
pushq %rax
xorl %edi, %edi
callq 0x21a0
movq %rsp, %rdi
movq %rax, (%rdi)
callq 0x2060
movl 0x14(%rax), %ecx
shll $0x19, %ecx
movl 0x10(%rax), %edx
shll $0x15, %edx
addl $0x200000, %edx         # imm = 0x200000
andl $0x1e00000, %edx        # imm = 0x1E00000
orl %ecx, %edx
movl 0xc(%rax), %ecx
andl $0x1f, %ecx
shll $0x10, %ecx
orl %edx, %ecx
movl 0x8(%rax), %edx
shll $0xb, %edx
movzwl %dx, %edx
orl %ecx, %edx
movl (%rax), %ecx
movl 0x4(%rax), %eax
andl $0x3f, %eax
shll $0x5, %eax
orl %edx, %eax
shrl %ecx
andl $0x1f, %ecx
addl %ecx, %eax
addl $0x60000000, %eax       # imm = 0x60000000
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x2efe
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 0x20e0
movq %rax, %r14
movabsq $0x3000000008, %r12     # imm = 0x3000000008
movq %r12, (%rsp)
leaq 0x110(%rsp), %rax
movq %rax, 0x8(%rsp)
movq %r15, 0x10(%rsp)
movl $0x8, %ebp
cmpl $0x28, %ebp
ja 0x2f40
movq %rax, %r13
movl %ebp, %eax
addq %r15, %rax
addl $0x8, %ebp
movl %ebp, (%rsp)
jmp 0x2f49
leaq 0x8(%rax), %r13
movq %r13, 0x8(%rsp)
movq (%rax), %rdi
shlq $0x20, %r14
testq %rdi, %rdi
je 0x2f66
callq 0x20e0
sarq $0x20, %r14
addq %rax, %r14
movq %r13, %rax
jmp 0x2f2b
movabsq $0x100000000, %rax      # imm = 0x100000000
addq %rax, %r14
sarq $0x20, %r14
movq %r14, %rdi
callq 0x21b0
testq %rax, %rax
je 0x3012
movq %rax, %r14
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2090
movq %r14, %rdi
callq 0x20e0
movq %rax, %rbx
addq %r14, %rbx
movq %r12, (%rsp)
leaq 0x110(%rsp), %rax
movq %rax, 0x8(%rsp)
movq %r15, 0x10(%rsp)
movl $0x8, %ebp
cmpl $0x28, %ebp
ja 0x2fd4
movq %rax, %r12
movl %ebp, %eax
addq %r15, %rax
addl $0x8, %ebp
movl %ebp, (%rsp)
jmp 0x2fdd
leaq 0x8(%rax), %r12
movq %r12, 0x8(%rsp)
movq (%rax), %rsi
testq %rsi, %rsi
je 0x2ffd
movq %rbx, %rdi
callq 0x2090
movq %rbx, %rdi
callq 0x20e0
addq %rax, %rbx
movq %r12, %rax
jmp 0x2fbf
movq %r14, %rax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x91fa(%rip), %rdi      # 0xc213
xorl %eax, %eax
callq 0x2aec
// File: /workspace/github_c_makefile_star2_O1/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 0x302e
cmpl $0x2f, %eax
jne 0x3033
incq %rdi
jmp 0x3021
callq 0x2250
testq %rax, %rax
je 0x3069
movq %rax, %rcx
movzbl (%rcx), %edx
cmpl $0x5c, %edx
je 0x304e
testl %edx, %edx
jne 0x3051
jmp 0x3062
movb $0x2f, (%rcx)
incq %rcx
jmp 0x3040
cmpb $0x2f, -0x1(%rcx)
jne 0x3067
decq %rcx
movb $0x0, (%rcx)
cmpq %rax, %rcx
ja 0x3056
popq %rcx
retq
leaq 0x91a3(%rip), %rdi      # 0xc213
xorl %eax, %eax
callq 0x2aec
// File: /workspace/github_c_makefile_star2_O1/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 %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
testl %esi, %esi
je 0x3158
movl %esi, %ebp
movq %rbx, %rdi
movl $0x2f, %esi
callq 0x2100
movq %rax, %r14
movq %rbx, %rdi
callq 0x30bb
movl %eax, %r15d
testl %eax, %eax
setne %al
testq %r14, %r14
sete %cl
orb %al, %cl
jne 0x3146
movb $0x0, (%r14)
movq %rbx, %rdi
movl %ebp, %esi
callq 0x30fa
movb $0x2f, (%r14)
testl %r15d, %r15d
je 0x3158
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x8515
// File: /workspace/github_c_makefile_star2_O1/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
cmpl $0x6000, %edi           # imm = 0x6000
leaq 0x907a(%rip), %rdx      # 0xc234
leaq 0x9076(%rip), %r8       # 0xc237
cmovaeq %rdx, %r8
cmovbl %eax, %esi
testl %esi, %esi
movl $0xc, %edx
cmovnel %esi, %edx
shrl $0x5, %ecx
andl $0x3f, %ecx
leaq 0xe071(%rip), %rbx      # 0x11250
leaq 0x9054(%rip), %rsi      # 0xc23a
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2220
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/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 %r12
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
movzwl 0x8(%rdi), %r8d
movl %r8d, %edx
shrl $0x5, %edx
andl $0xf, %edx
movl %r8d, %ecx
andl $0x1f, %ecx
shrl $0x9, %r8d
andl $0x3f, %r8d
addl $0x7bc, %r8d            # imm = 0x7BC
leaq 0xe018(%rip), %r14      # 0x11244
leaq 0x8ff2(%rip), %rsi      # 0xc225
movq %r14, %rdi
xorl %eax, %eax
callq 0x2220
movzwl 0xa(%rbx), %ecx
movl %ecx, %eax
shrl $0xb, %eax
leal -0xc(%rax), %esi
cmpl $0x6000, %ecx           # imm = 0x6000
leaq 0x8fde(%rip), %rdx      # 0xc234
leaq 0x8fda(%rip), %r8       # 0xc237
cmovaeq %rdx, %r8
cmovbl %eax, %esi
testl %esi, %esi
movl $0xc, %edx
cmovnel %esi, %edx
shrl $0x5, %ecx
andl $0x3f, %ecx
leaq 0xdfd5(%rip), %r12      # 0x11250
leaq 0x8fb8(%rip), %rsi      # 0xc23a
movq %r12, %rdi
xorl %eax, %eax
callq 0x2220
testb $0x10, 0xc(%rbx)
leaq 0x9208(%rip), %r15      # 0xc49f
leaq 0x8fbb(%rip), %rcx      # 0xc259
cmoveq %r15, %rcx
movq (%rbx), %r8
leaq 0x8f9c(%rip), %rdi      # 0xc248
movq %r14, %rsi
movq %r12, %rdx
xorl %eax, %eax
callq 0x20f0
testl %ebp, %ebp
je 0x32f1
cmpb $0x0, 0xd(%rbx)
je 0x32e0
leaq 0xd(%rbx), %r14
leaq 0x1a(%rbx), %rdi
movq %r14, %rsi
callq 0x2050
testl %eax, %eax
leaq 0x91c3(%rip), %r15      # 0xc49f
cmovneq %r14, %r15
leaq 0x8f78(%rip), %rdi      # 0xc25f
movq %r15, %rsi
xorl %eax, %eax
callq 0x20f0
addq $0x1a, %rbx
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x20a0
// File: /workspace/github_c_makefile_star2_O1/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 $0x1288, %rsp           # imm = 0x1288
movq %rsi, 0x18(%rsp)
movl %edi, 0x10(%rsp)
cmpl $0x2, %edi
jl 0x38d2
movl $0x1, %ebx
movq 0xd811(%rip), %rbp      # 0x10fd0
leaq 0x20(%rsp), %r12
leaq 0x280(%rsp), %r13
leaq 0x14(%rsp), %r15
movslq %ebx, %rax
movq 0x18(%rsp), %rcx
movq (%rcx,%rax,8), %r14
movq %r14, %rdi
leaq 0x8dfc(%rip), %rsi      # 0xc5e3
callq 0x2170
testl %eax, %eax
je 0x3863
cmpb $0x2d, (%r14)
je 0x38d2
movq %r14, %rdi
callq 0x3020
movq %r12, %rdi
movq %rax, %rsi
movl $0x1, %edx
callq 0x531a
testl %eax, %eax
je 0x3822
xorl %r14d, %r14d
movl %eax, 0xc(%rsp)
jmp 0x38a3
movq %r12, %rdi
movq %r13, %rsi
movl $0x1000, %edx           # imm = 0x1000
movq %r15, %rcx
callq 0x657a
testl %eax, %eax
sete %r14b
jne 0x388e
movl 0x14(%rsp), %edx
testq %rdx, %rdx
je 0x3857
movq (%rbp), %rcx
movl $0x1, %esi
movq %r13, %rdi
callq 0x2240
cmpl $0x1000, 0x14(%rsp)     # imm = 0x1000
je 0x3822
jmp 0x3892
incl %ebx
cmpl 0x10(%rsp), %ebx
jge 0x38d2
movslq %ebx, %r14
movq 0x18(%rsp), %rax
movq (%rax,%r14,8), %rdi
movq (%rbp), %rdx
leaq 0x8d64(%rip), %rsi      # 0xc5e6
callq 0x2130
testq %rax, %rax
jne 0x38a8
jmp 0x38d7
movl %eax, 0xc(%rsp)
movq (%rbp), %rdi
callq 0x21d0
movq %r12, %rdi
callq 0x719a
testb %r14b, %r14b
je 0x38bc
incl %ebx
cmpl 0x10(%rsp), %ebx
jl 0x37d1
movl $0x0, 0xc(%rsp)
movl 0xc(%rsp), %eax
addq $0x1288, %rsp           # imm = 0x1288
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x28d2
movq 0x18(%rsp), %rax
movq (%rax,%r14,8), %rsi
leaq 0x8d02(%rip), %rdi      # 0xc5e9
xorl %eax, %eax
callq 0x2aec
// File: /workspace/github_c_makefile_star2_O1/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 %r13
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x2, %edi
jl 0x3b9d
movq %rsi, %rbx
movl %edi, %ebp
xorl %r15d, %r15d
movl $0x1, %r14d
leaq 0x8bf6(%rip), %r12      # 0xc74c
movq $0x0, (%rsp)
movq (%rbx,%r14,8), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x2170
testl %eax, %eax
je 0x3b8a
cmpb $0x2d, (%r13)
je 0x3bc7
testq %r15, %r15
jne 0x3bc7
movq %r13, %rdi
callq 0x3020
movq %rax, %r15
jmp 0x3b93
movl $0x1, %eax
movq %rax, (%rsp)
incq %r14
cmpq %r14, %rbp
jne 0x3b5e
jmp 0x3ba8
movq $0x0, (%rsp)
xorl %r15d, %r15d
testq %r15, %r15
je 0x3bc7
movq %r15, %rdi
movq (%rsp), %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x30fa
callq 0x28ee
// File: /workspace/github_c_makefile_star2_O1/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 0x8639(%rip), %rsi      # 0xc222
callq 0x21e0
testq %rax, %rax
je 0x3c19
cmpl $0x1, %ebx
adcl $0x0, %ebx
movq %r15, %rdi
movl $0x2f, %esi
callq 0x2100
testq %rax, %rax
je 0x3c34
movb $0x0, (%rax)
incq %rax
movq %r15, %r14
movq %rax, %r15
jmp 0x3c3b
movq %r15, %rdi
movl %ebx, %esi
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3cef
leaq 0x8864(%rip), %r14      # 0xc49f
leaq 0x8(%rsp), %rdi
leaq 0x68(%rsp), %rsi
movq %r14, %rdx
movq %r15, %rcx
callq 0x7f6a
movl %eax, %ebp
testl $0xfffffffb, %eax       # imm = 0xFFFFFFFB
jne 0x3cd5
leaq 0x82(%rsp), %r15
leaq 0x8838(%rip), %r12      # 0xc4a0
testl %ebp, %ebp
jne 0x3ccb
cmpb $0x0, 0x82(%rsp)
je 0x3ccb
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x2e96
movq %rax, %rbp
movq %rax, %rdi
movl %ebx, %esi
callq 0x3cef
movl %eax, %r13d
movq %rbp, %rdi
testl %eax, %eax
jne 0x3cbc
callq 0x2030
leaq 0x8(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x7dad
movl %eax, %ebp
testl %r13d, %r13d
je 0x3c68
jmp 0x3cd9
callq 0x28fc
movl %r13d, %ebp
movl %r13d, 0x4(%rsp)
jmp 0x3cb5
leaq 0x8(%rsp), %rdi
callq 0x7653
movl %ebp, 0x4(%rsp)
movl 0x4(%rsp), %eax
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x30bb
testl %eax, %eax
je 0x3d39
testl %ebp, %ebp
jns 0x3d49
leaq 0x8794(%rip), %rsi      # 0xc4a0
leaq 0x878f(%rip), %rdx      # 0xc4a2
movq %rbx, %rdi
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x2e96
movq %rax, %r14
movq %rax, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x3bcc
movq %r14, %rdi
callq 0x2030
jmp 0x3d3d
testl %ebp, %ebp
jg 0x3d67
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x82fc
movq 0xd4e8(%rip), %rsi      # 0x11238
leaq 0x8d76(%rip), %rdi      # 0xcacd
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2348
testl %eax, %eax
jne 0x3d05
jmp 0x3d83
movq 0xd4ca(%rip), %rsi      # 0x11238
leaq 0x8d77(%rip), %rdi      # 0xcaec
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2348
testl %eax, %eax
jne 0x3d3d
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x3e4d
movq %rsi, %rbx
movl %edi, %r15d
xorl %ebp, %ebp
movl $0x8, %r14d
movl $0x1, %r13d
movq (%rbx,%r13,8), %r12
movq %r12, %rdi
leaq 0x898f(%rip), %rsi      # 0xc74f
callq 0x2170
testl %eax, %eax
je 0x3dfe
movq %r12, %rdi
leaq 0x8979(%rip), %rsi      # 0xc74c
callq 0x2170
testl %eax, %eax
je 0x3e05
cmpb $0x2d, (%r12)
je 0x3e4d
movq %r12, %rdi
callq 0x3020
movq %rax, %rdi
movl %ebp, %esi
callq 0x3bcc
xorl %r14d, %r14d
testl %eax, %eax
je 0x3e0a
jmp 0x3e2c
movl $0x1, %ebp
jmp 0x3e0a
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
incq %r13
cmpq %r13, %r15
jne 0x3db2
xorl %r12d, %r12d
testl %r14d, %r14d
jne 0x3e4d
movl %r12d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %r12d
movq 0xd1c2(%rip), %rax      # 0x10ff8
movq (%rax), %rdi
movq (%rbx,%r13,8), %rdx
leaq 0x8cb8(%rip), %rsi      # 0xcafc
xorl %eax, %eax
callq 0x2190
jmp 0x3e1a
callq 0x2925
// File: /workspace/github_c_makefile_star2_O1/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 %rdi, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
testq %rsi, %rsi
je 0x4bea
xorl %eax, %eax
movb (%rsi,%rax), %r8b
incq %rax
cmpb $0x20, %r8b
jb 0x4bcc
cmpb $0x3a, %r8b
jne 0x4bb9
xorl %ecx, %ecx
cmpb $0x3a, %r8b
jne 0x4bef
cmpq $0x2, %rax
setne %al
cmpb $0x30, (%rsi)
setne %cl
orb %al, %cl
movzbl %cl, %ecx
negl %ecx
jmp 0x4bef
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testl %ecx, %ecx
js 0x4c2b
movl %ecx, %eax
leaq 0xc8c4(%rip), %rcx      # 0x114c0
movq (%rcx,%rax,8), %rsi
testq %rsi, %rsi
je 0x4c08
movb $0x0, (%rsi)
testq %rdi, %rdi
je 0x4c10
movb $0x0, (%rdi)
movq %rdi, (%rcx,%rax,8)
testb %dl, %dl
je 0x4c32
leaq 0x8(%rsp), %rdi
leaq 0x10(%rsp), %rsi
xorl %edx, %edx
callq 0x4c82
jmp 0x4c34
movl $0xb, %eax
jmp 0x4c34
xorl %eax, %eax
addq $0x18, %rsp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0xaded
movq %rax, 0x10(%rbx)
movb 0x21(%r14), %al
andb $0x2, %al
movb %al, 0xb(%rbx)
movl $0x0, 0x1c(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x6114
movl %esi, %edx
jmp 0x6126
rorw %cx
movl %edx, %esi
movzbl (%r14,%rsi), %edi
addl %ecx, %edi
incl %edx
movl %edx, %esi
movl %edi, %ecx
cmpl %eax, %esi
jb 0x6106
movw %cx, 0x2(%r14)
movl 0x54(%rbx), %esi
movq %rbx, %rdi
callq 0x7545
testl %eax, %eax
je 0x6150
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 0x6314
testl %eax, %eax
jne 0x613e
movq 0x40(%rbx), %rax
xorl %ecx, %ecx
movb (%r14,%rcx), %dl
movb %dl, (%rax,%rcx)
incq %rcx
cmpl $0x20, %ecx
jne 0x6168
movq (%rbx), %rax
movb $0x1, 0x3(%rax)
decl %ebp
je 0x6196
addq $0x20, %r14
movq %rbx, %rdi
xorl %esi, %esi
callq 0x7c47
testl %eax, %eax
je 0x6152
jmp 0x613e
xorl %eax, %eax
jmp 0x613e
// File: /workspace/github_c_makefile_star2_O1/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 0x6362
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
callq 0xbbd2
testl %eax, %eax
jne 0x635b
movzbl 0x1(%rbx), %edi
leaq 0x60(%rbx), %rsi
movq %r14, %rdx
movl $0x1, %ecx
callq 0x2cd0
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_O1/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 0x705f
movq %rdi, %r14
movl 0x18(%rdi), %r15d
testl %r15d, %r15d
je 0x7056
movl 0xc(%r14), %ebp
movl %ebp, %esi
movq (%r14), %rdi
leal 0x1(%rsi), %ebp
movl %ebp, %edx
callq 0xb9ca
testl %eax, %eax
jne 0x705d
decl %r15d
jne 0x703e
movb $0x0, 0xb(%r14)
jmp 0x705f
movl %eax, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq