LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/Joy-Division[P]tools-zoe/mdx-parser.c
// Function: snap0
unsigned int snap0(unsigned int data) {
	if(data < 26) return 5*data+0x80;
	else if(data < 52) return 5*data+0x8100;
	else if(data < 76) return 5*data+0x8180;
	else if(data < 102) return 5*data+0x8200;
	else if(data < 127) return 5*data+0x8280;
	else if(data < 153) return 5*data+0x8300;
	else if(data < 179) return 5*data+0x8380;
	else if(data < 205) return 5*data+0x8400;
	else if(data < 283) return 5*data+0x8480;
	else {
		printf("snap0: data is %d\n", data);
		return 0;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl %edi, -0x8(%rbp)
cmpl $0x1a, -0x8(%rbp)
jae 0x25d2
imull $0x5, -0x8(%rbp), %eax
addl $0x80, %eax
movl %eax, -0x4(%rbp)
jmp 0x269f
cmpl $0x34, -0x8(%rbp)
jae 0x25e9
imull $0x5, -0x8(%rbp), %eax
addl $0x8100, %eax           # imm = 0x8100
movl %eax, -0x4(%rbp)
jmp 0x269f
cmpl $0x4c, -0x8(%rbp)
jae 0x2600
imull $0x5, -0x8(%rbp), %eax
addl $0x8180, %eax           # imm = 0x8180
movl %eax, -0x4(%rbp)
jmp 0x269f
cmpl $0x66, -0x8(%rbp)
jae 0x2617
imull $0x5, -0x8(%rbp), %eax
addl $0x8200, %eax           # imm = 0x8200
movl %eax, -0x4(%rbp)
jmp 0x269f
cmpl $0x7f, -0x8(%rbp)
jae 0x262b
imull $0x5, -0x8(%rbp), %eax
addl $0x8280, %eax           # imm = 0x8280
movl %eax, -0x4(%rbp)
jmp 0x269f
cmpl $0x99, -0x8(%rbp)
jae 0x2642
imull $0x5, -0x8(%rbp), %eax
addl $0x8300, %eax           # imm = 0x8300
movl %eax, -0x4(%rbp)
jmp 0x269f
cmpl $0xb3, -0x8(%rbp)
jae 0x2659
imull $0x5, -0x8(%rbp), %eax
addl $0x8380, %eax           # imm = 0x8380
movl %eax, -0x4(%rbp)
jmp 0x269f
cmpl $0xcd, -0x8(%rbp)
jae 0x2670
imull $0x5, -0x8(%rbp), %eax
addl $0x8400, %eax           # imm = 0x8400
movl %eax, -0x4(%rbp)
jmp 0x269f
cmpl $0x11b, -0x8(%rbp)      # imm = 0x11B
jae 0x2687
imull $0x5, -0x8(%rbp), %eax
addl $0x8480, %eax           # imm = 0x8480
movl %eax, -0x4(%rbp)
jmp 0x269f
movl -0x8(%rbp), %esi
leaq 0x1c44(%rip), %rdi      # 0x42d5
movb $0x0, %al
callq 0x2060
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/serge-404[P]CPM32/./conio.h
// Function: reset_terminal_mode_ex
void reset_terminal_mode_ex()
{
	reset_terminal_mode();
	printf("\x1b[0m");                               // Reset colors
	fflush(stdout);
	printf("\n");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
callq 0x2500
leaq 0x15eb0(%rip), %rdi     # 0x183e0
movb $0x0, %al
callq 0x2110
movq 0x18a92(%rip), %rax     # 0x1afd0
movq (%rax), %rdi
callq 0x22c0
leaq 0x16029(%rip), %rdi     # 0x18576
movb $0x0, %al
callq 0x2110
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/serge-404[P]CPM32/./conio.h
// Function: set_conio_terminal_mode
void set_conio_terminal_mode()
{
    struct termios new_termios;

    /* take two copies - one for now, one for later */
    tcgetattr(0, &orig_termios);
    memcpy(&new_termios, &orig_termios, sizeof(new_termios));

    /* register cleanup handler, and set the new terminal mode */
    atexit(reset_terminal_mode_ex);
    cfmakeraw(&new_termios);
    tcsetattr(0, TCSANOW, &new_termios);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
xorl %edi, %edi
leaq 0x18e8f(%rip), %rsi     # 0x1b400
callq 0x2320
leaq -0x3c(%rbp), %rdi
leaq 0x18e7f(%rip), %rsi     # 0x1b400
movl $0x3c, %edx
callq 0x2260
leaq -0x72(%rip), %rdi       # 0x2520
callq 0x13780
leaq -0x3c(%rbp), %rdi
callq 0x2310
xorl %esi, %esi
leaq -0x3c(%rbp), %rdx
movl %esi, %edi
callq 0x2330
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/serge-404[P]CPM32/./conio.h
// Function: kbhit
int kbhit()
{
    struct timeval tv = { 0L, 0L };
    fd_set fds;
    FD_ZERO(&fds);
    FD_SET(0, &fds);
    return select(1, &fds, NULL, NULL, &tv);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
leaq -0x10(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x2160
leaq -0x90(%rbp), %rax
movq %rax, -0xa0(%rbp)
movl $0x0, -0x94(%rbp)
movl -0x94(%rbp), %eax
cmpq $0x10, %rax
jae 0x2625
movq -0xa0(%rbp), %rax
movl -0x94(%rbp), %ecx
movq $0x0, (%rax,%rcx,8)
movl -0x94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x94(%rbp)
jmp 0x25f3
jmp 0x2627
movq -0x90(%rbp), %rax
orq $0x1, %rax
movq %rax, -0x90(%rbp)
movl $0x1, %edi
leaq -0x90(%rbp), %rsi
xorl %eax, %eax
movl %eax, %ecx
leaq -0x10(%rbp), %r8
movq %rcx, %rdx
callq 0x2290
addq $0xa0, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/serge-404[P]CPM32/./conio.h
// Function: getch
int getch()
{
    int r;
    unsigned char c;
    fflush(stdout);
    if ((r = read(0, &c, sizeof(c))) < 0) {
        return r;
    } else {
        if (r==0) 
		return -1;
	else
		return c;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq 0x18961(%rip), %rax     # 0x1afd0
movq (%rax), %rdi
callq 0x22c0
xorl %edi, %edi
leaq -0x9(%rbp), %rsi
movl $0x1, %edx
callq 0x21c0
movl %eax, -0x8(%rbp)
cmpl $0x0, %eax
jge 0x2697
movl -0x8(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x26ad
cmpl $0x0, -0x8(%rbp)
jne 0x26a6
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x26ad
movzbl -0x9(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/serge-404[P]CPM32/./cpu.h
// Function: Z80reset
void Z80reset(void) {
	PC = 0;
	IFF = 0;
	IR = 0;
	Status = 0;
	Debug = 0;
	Break = -1;
	Step = -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl $0x0, 0x118c96(%rip)    # 0x11b464
movl $0x0, 0x118c90(%rip)    # 0x11b468
movl $0x0, 0x118c8a(%rip)    # 0x11b46c
movl $0x0, 0x118c6c(%rip)    # 0x11b458
movl $0x0, 0x118c66(%rip)    # 0x11b45c
movl $0xffffffff, 0x18a20(%rip) # imm = 0xFFFFFFFF
movl $0xffffffff, 0x18a1a(%rip) # imm = 0xFFFFFFFF
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/serge-404[P]CPM32/cpm.c
// Function: setup_disk_vct
void setup_disk_vct( void)
{
    int i;
    char envname[ 8];

    cpm_disk_vct = 3;
    for ( i = 2; i < MAXDRV; i++) {
	if ( cpm_drive[ i]) continue;
	sprintf( envname, "CPM%c", i + 'A');
	if (( cpm_drive[ i] = getenv( envname)) != NULL) {
	    cpm_disk_vct |= (word)( 1 << i);
	}
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movw $0x3, 0x10df09(%rip)    # 0x11b4ba
movl $0x2, -0x4(%rbp)
cmpl $0x10, -0x4(%rbp)
jge 0xd632
movslq -0x4(%rbp), %rcx
leaq 0x10e017(%rip), %rax    # 0x11b5e0
cmpq $0x0, (%rax,%rcx,8)
je 0xd5d2
jmp 0xd627
leaq -0xc(%rbp), %rdi
movl -0x4(%rbp), %edx
addl $0x41, %edx
leaq 0xae4b(%rip), %rsi      # 0x1842e
movb $0x0, %al
callq 0x23b0
leaq -0xc(%rbp), %rdi
callq 0x2030
movslq -0x4(%rbp), %rdx
leaq 0x10dfe2(%rip), %rcx    # 0x11b5e0
movq %rax, (%rcx,%rdx,8)
cmpq $0x0, %rax
je 0xd625
movl -0x4(%rbp), %ecx
movl $0x1, %eax
shll %cl, %eax
movzwl %ax, %ecx
movzwl 0x10de9e(%rip), %eax    # 0x11b4ba
orl %ecx, %eax
movw %ax, 0x10de95(%rip)     # 0x11b4ba
jmp 0xd627
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0xd5b8
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/serge-404[P]CPM32/cpm.c
// Function: CharUpperX
char* CharUpperX(char* st)
{
  char* ss=st;
  if (st==NULL) 
		return st;
  while (*ss) {
    *ss=toupper(*ss);
    ss++;
  }
  return st;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0xd665
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xd69a
jmp 0xd667
movq -0x18(%rbp), %rax
cmpb $0x0, (%rax)
je 0xd692
movq -0x18(%rbp), %rax
movsbl (%rax), %edi
callq 0x20a0
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, (%rax)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0xd667
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/serge-404[P]CPM32/cpm.c
// Function: splitpath
void _splitpath(char *path, char *drive, char *dir, char *name, char *ext)
{
	char* cc, sz;
	void* pp;
	*dir=0; *name=0; *ext=0;
	pp=malloc((sz=strlen(path))+1);
	strncpy(pp,path,sz);										/* because dirname flushes `path` */
	strncpy(name, (cc=basename(path)) ? cc: "", _MAX_FNAME);
	strncpy(dir,  (cc=dirname(path)) ? cc: "", _MAX_DIR);
	if ((strcmp(dir,".")==0)&&(*path!='.'))
		*dir=0;								
	if ((cc=strstr(name, "."))!=NULL) {
		strncpy(ext, &cc[1], _MAX_EXT);
		*cc='\0';
	}
	strncpy(path,pp,sz);
	free(pp);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x18(%rbp), %rax
movb $0x0, (%rax)
movq -0x20(%rbp), %rax
movb $0x0, (%rax)
movq -0x28(%rbp), %rax
movb $0x0, (%rax)
movq -0x8(%rbp), %rdi
callq 0x20f0
movb %al, -0x31(%rbp)
movsbl %al, %eax
addl $0x1, %eax
movslq %eax, %rdi
callq 0x22b0
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
movq -0x8(%rbp), %rsi
movsbq -0x31(%rbp), %rdx
callq 0x2060
movq -0x20(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
callq 0x2270
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
je 0xd736
movq -0x30(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0xd743
leaq 0xae3e(%rip), %rax      # 0x1857b
movq %rax, -0x50(%rbp)
jmp 0xd743
movq -0x48(%rbp), %rdi
movq -0x50(%rbp), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x2060
movq -0x18(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rdi
callq 0x2140
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
je 0xd77a
movq -0x30(%rbp), %rax
movq %rax, -0x60(%rbp)
jmp 0xd787
leaq 0xadfa(%rip), %rax      # 0x1857b
movq %rax, -0x60(%rbp)
jmp 0xd787
movq -0x58(%rbp), %rdi
movq -0x60(%rbp), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x2060
movq -0x18(%rbp), %rdi
leaq 0xb1b4(%rip), %rsi      # 0x18958
callq 0x21f0
cmpl $0x0, %eax
jne 0xd7c1
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2e, %eax
je 0xd7c1
movq -0x18(%rbp), %rax
movb $0x0, (%rax)
movq -0x20(%rbp), %rdi
leaq 0xb18c(%rip), %rsi      # 0x18958
callq 0x23f0
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
je 0xd7f8
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
addq $0x1, %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x2060
movq -0x30(%rbp), %rax
movb $0x0, (%rax)
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
movsbq -0x31(%rbp), %rdx
callq 0x2060
movq -0x40(%rbp), %rdi
callq 0x2040
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/serge-404[P]CPM32/cpm.c
// Function: buildname
char *buildname(char* dirnm, char* filenm)
{
	char *cp;
	static char buf[_MAX_DIR];

	if ((dirnm == NULL) || (*dirnm == '\0'))
		return filenm;
	if (filenm == NULL)
		return dirnm;
	if ((cp = strrchr(filenm, '/')) != NULL)
		filenm = cp + 1;
	strcpy(buf, dirnm);
	strcat(buf, "/");
	strcat(buf, filenm);
	return buf;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xd843
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0xd84d
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xd8c0
cmpq $0x0, -0x18(%rbp)
jne 0xd85e
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xd8c0
movq -0x18(%rbp), %rdi
movl $0x2f, %esi
callq 0x2120
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
je 0xd882
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rsi
leaq 0x10ddd3(%rip), %rdi    # 0x11b660
callq 0x2090
leaq 0x10ddc7(%rip), %rdi    # 0x11b660
leaq 0xab94(%rip), %rsi      # 0x18434
callq 0x23a0
movq -0x18(%rbp), %rsi
leaq 0x10ddb0(%rip), %rdi    # 0x11b660
callq 0x23a0
leaq 0x10dda4(%rip), %rax    # 0x11b660
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/serge-404[P]CPM32/cpm.c
// Function: makepath
void _makepath(char *path, char *drive, char *dir, char *name, char *ext)
{
  char *cc;
  if (path) {
	*path=0; 
	if ((name==NULL)&&(ext==NULL))
	   strncpy(path, dir, _MAX_DIR);
    else {
		cc=buildname(dir,name);
	    if (cc) strncpy(path, cc, _MAX_DIR);
	}
	if (ext) {
		if (*ext!='.')
			strcat(path, ".");
		strncat(path, ext, 4);		/* CPM have 3-char ext + dot */
	}
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0xd983
movq -0x8(%rbp), %rax
movb $0x0, (%rax)
cmpq $0x0, -0x20(%rbp)
jne 0xd920
cmpq $0x0, -0x28(%rbp)
jne 0xd920
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x2060
jmp 0xd94c
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0xd820
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0xd94a
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x2060
jmp 0xd94c
cmpq $0x0, -0x28(%rbp)
je 0xd981
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2e, %eax
je 0xd96f
movq -0x8(%rbp), %rdi
leaq 0xafee(%rip), %rsi      # 0x18958
callq 0x23a0
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl $0x4, %edx
callq 0x2190
jmp 0xd983
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/serge-404[P]CPM32/cpm.c
// Function: findPath
char* findPath(char* path, char* env)
{
	char *p, *envp;
	static char name[_MAX_PATH+1];

	if (*path == '/' ||   	/* qualified name */
	    *path == '.')
		return path;
	if ((envp = getenv(env)) != NULL)   /* lookup all pathes */
	  while (*envp) {
		p = name;
		while (*envp && (*p = *envp++) != ':') {
			if ((uint)(p - name) >= sizeof(name))
				break;
			++p;
		}
		if (*--p != '/')
			*++p = '/';
		++p;
		if ((p - name) + strlen(path) >= sizeof(name))
			break;
		strcpy(p, path);
		if (access(name, F_OK) == 0)
			return name;
	  }
    /* search within startdir */
	p=buildname(StartDir, path);
	if (access(p, F_OK) == 0)	/* file exist in current dir */
		return p;
	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2f, %eax
je 0xd9b8
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2e, %eax
jne 0xd9c5
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xdb2b
movq -0x18(%rbp), %rdi
callq 0x2030
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
je 0xdaf5
jmp 0xd9de
movq -0x28(%rbp), %rax
cmpb $0x0, (%rax)
je 0xdaf3
leaq 0x10dd6e(%rip), %rax    # 0x11b760
movq %rax, -0x20(%rbp)
movq -0x28(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x29(%rbp)
je 0xda2a
movq -0x28(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x28(%rbp)
movb (%rax), %al
movq -0x20(%rbp), %rcx
movb %al, (%rcx)
movsbl %al, %eax
cmpl $0x3a, %eax
setne %al
movb %al, -0x29(%rbp)
movb -0x29(%rbp), %al
testb $0x1, %al
jne 0xda33
jmp 0xda5b
movq -0x20(%rbp), %rax
leaq 0x10dd22(%rip), %rcx    # 0x11b760
subq %rcx, %rax
movl %eax, %eax
cmpq $0x105, %rax            # imm = 0x105
jb 0xda4d
jmp 0xda5b
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0xd9f6
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $-0x1, %rcx
movq %rcx, -0x20(%rbp)
movsbl -0x1(%rax), %eax
cmpl $0x2f, %eax
je 0xda86
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movb $0x2f, 0x1(%rax)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
leaq 0x10dcc3(%rip), %rcx    # 0x11b760
subq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
callq 0x20f0
movq %rax, %rcx
movq -0x38(%rbp), %rax
addq %rcx, %rax
cmpq $0x105, %rax            # imm = 0x105
jb 0xdac1
jmp 0xdaf3
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x2090
leaq 0x10dc8b(%rip), %rdi    # 0x11b760
xorl %esi, %esi
callq 0x2350
cmpl $0x0, %eax
jne 0xdaee
leaq 0x10dc78(%rip), %rax    # 0x11b760
movq %rax, -0x8(%rbp)
jmp 0xdb2b
jmp 0xd9de
jmp 0xdaf5
movq -0x10(%rbp), %rsi
leaq 0x10dd70(%rip), %rdi    # 0x11b870
callq 0xd820
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
xorl %esi, %esi
callq 0x2350
cmpl $0x0, %eax
jne 0xdb23
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xdb2b
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/serge-404[P]CPM32/cpm.c
// Function: mkFCB
void mkFCB( byte *p, char *s)
{
    int i, c;

    *p = 0;
    if ( s[ 1] == ':') {
        if (( c = *s) >= 'a') c &= 0x5f;
        *p = (byte)( c - 'A' + 1); s += 2;
    }
    p++;
    for ( i = 0; i < 8; i++) {
        c = ( *s && *s != '.') ? *s++ : ' ';
//	if ( c >= 'a' && c <= 'z') c &= 0x5f;
        *p++ = (byte)c;
    }
    while ( *s && *s != '.') s++;
    if ( *s) s++;
    for ( i = 0; i < 3; i++) {
        c = ( *s) ? *s++ : ' ';
//	if ( c >= 'a' && c <= 'z') c &= 0x5f;
        *p++ = (byte)c;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movb $0x0, (%rax)
movq -0x10(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x3a, %eax
jne 0xe1f5
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x18(%rbp)
cmpl $0x61, %eax
jl 0xe1d8
movl -0x18(%rbp), %eax
andl $0x5f, %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
subl $0x41, %eax
addl $0x1, %eax
movb %al, %cl
movq -0x8(%rbp), %rax
movb %cl, (%rax)
movq -0x10(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
movl $0x0, -0x14(%rbp)
cmpl $0x8, -0x14(%rbp)
jge 0xe26e
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0xe23d
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2e, %eax
je 0xe23d
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
movsbl (%rax), %eax
movl %eax, -0x1c(%rbp)
jmp 0xe247
movl $0x20, %eax
movl %eax, -0x1c(%rbp)
jmp 0xe247
movl -0x1c(%rbp), %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
movb %al, %cl
movq -0x8(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x8(%rbp)
movb %cl, (%rax)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xe208
jmp 0xe270
movq -0x10(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x1d(%rbp)
je 0xe291
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2e, %eax
setne %al
movb %al, -0x1d(%rbp)
movb -0x1d(%rbp), %al
testb $0x1, %al
jne 0xe29a
jmp 0xe2a8
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0xe270
movq -0x10(%rbp), %rax
cmpb $0x0, (%rax)
je 0xe2bd
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
cmpl $0x3, -0x14(%rbp)
jge 0xe31e
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0xe2ed
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
movsbl (%rax), %eax
movl %eax, -0x24(%rbp)
jmp 0xe2f7
movl $0x20, %eax
movl %eax, -0x24(%rbp)
jmp 0xe2f7
movl -0x24(%rbp), %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
movb %al, %cl
movq -0x8(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x8(%rbp)
movb %cl, (%rax)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xe2c4
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/serge-404[P]CPM32/cpm.c
// Function: FindNextFile
int FindNextFile(
    DIR *hFndFile,				    	// handle to search  
    WIN32_FIND_DATA *lpFindFileData) 	// pointer to structure for data on found file  
{
    struct dirent *pDirent;
    struct stat statbuf;
	if (hFndFile==INVALID_HANDLE_VALUE)
		return 0;
    while ((pDirent = readdir(hFndFile)) != NULL) {
       	strncpy(lpFindFileData->cFileName, pDirent->d_name, _MAX_PATH-1);
		if (fnmatch(ffName, CharUpperX(pDirent->d_name), FNM_CASEFOLD)==0) {
			if (stat(buildname(ffDir,lpFindFileData->cFileName), &statbuf)!=0) { 
				DEBUGOUT(stderr, "FindNext ERROR: failed while stat file `%s`\n",lpFindFileData->cFileName);
				break;
			}
			if (!(statbuf.st_mode & S_IFDIR)) {
				lpFindFileData->cAlternateFileName[0]=0;
				lpFindFileData->dwFileAttributes=(*(lpFindFileData->cFileName)=='.' ? FILE_ATTRIBUTE_HIDDEN : 0);	
				lpFindFileData->nFileSizeHigh=0;
				lpFindFileData->nFileSizeLow=(DWORD)statbuf.st_size;
				return 1;
			}
		}
    }
//    if (hFndFile!=INVALID_HANDLE_VALUE) closedir(hFndFile);
//    hFindFile=INVALID_HANDLE_VALUE;
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0xe8d6
movl $0x0, -0x4(%rbp)
jmp 0xe9ef
jmp 0xe8d8
movq -0x10(%rbp), %rdi
callq 0x22a0
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
je 0xe9e8
movq -0x18(%rbp), %rdi
addq $0x18, %rdi
movq -0x20(%rbp), %rsi
addq $0x13, %rsi
movl $0x103, %edx            # imm = 0x103
callq 0x2060
movq -0x20(%rbp), %rdi
addq $0x13, %rdi
callq 0xd640
movq %rax, %rsi
leaq 0x10e880(%rip), %rdi    # 0x11d1a0
movl $0x10, %edx
callq 0x2150
cmpl $0x0, %eax
jne 0xe9e3
movq -0x18(%rbp), %rsi
addq $0x18, %rsi
leaq 0x10e74e(%rip), %rdi    # 0x11d090
callq 0xd820
movq %rax, %rdi
leaq -0xb0(%rbp), %rsi
callq 0x2250
cmpl $0x0, %eax
je 0xe986
cmpl $0x0, 0x10cb52(%rip)    # 0x11b4b4
je 0xe984
movq 0xc68d(%rip), %rax      # 0x1aff8
movq (%rax), %rdi
movq -0x18(%rbp), %rdx
addq $0x18, %rdx
leaq 0x9b0a(%rip), %rsi      # 0x18487
movb $0x0, %al
callq 0x2220
jmp 0xe9e8
movl -0x98(%rbp), %eax
andl $0x4000, %eax           # imm = 0x4000
cmpl $0x0, %eax
jne 0xe9e1
movq -0x18(%rbp), %rax
movb $0x0, 0x11c(%rax)
movq -0x18(%rbp), %rax
movsbl 0x18(%rax), %edx
xorl %eax, %eax
movl $0x2, %ecx
cmpl $0x2e, %edx
cmovel %ecx, %eax
movslq %eax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x80(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movl $0x1, -0x4(%rbp)
jmp 0xe9ef
jmp 0xe9e3
jmp 0xe8d8
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xb0, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/serge-404[P]CPM32/cpm.c
// Function: FindClose
int FindClose(
    DIR *hFndFile 					// file search handle 
   )
{
	int res;
	if (hFndFile && (hFndFile!=INVALID_HANDLE_VALUE)) {
		res=closedir(hFndFile);
		hFindFile=INVALID_HANDLE_VALUE;
		return res==0;
	}
	return TRUE;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xea42
cmpq $0x0, -0x10(%rbp)
je 0xea42
movq -0x10(%rbp), %rdi
callq 0x21b0
movl %eax, -0x14(%rbp)
movq $0x0, 0x10e64f(%rip) # 0x11d080
cmpl $0x0, -0x14(%rbp)
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x4(%rbp)
jmp 0xea49
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/serge-404[P]CPM32/cpm.c
// Function: GetDiskFreeSpace
int GetDiskFreeSpace(
    char* lpRootPathName,			// address of root path 
    DWORD *lpSectorsPerCluster,		// address of sectors per cluster 
    DWORD *lpBytesPerSector,		// address of bytes per sector 
    DWORD *lpNumberOfFreeClusters,	// address of number of free clusters  
    DWORD *lpTotalNumberOfClusters 	// address of total number of clusters  
   )	
{ 
  struct statvfs stat;
  if (statvfs(lpRootPathName, &stat) != 0) {
    // error happens, just quits here
    return 0;
  }
  *lpTotalNumberOfClusters=stat.f_blocks;
  *lpNumberOfFreeClusters=stat.f_bavail;
  *lpBytesPerSector=stat.f_bsize;
  *lpSectorsPerCluster=stat.f_frsize/stat.f_bsize;
  return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq -0x10(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x2300
cmpl $0x0, %eax
je 0xea9d
movl $0x0, -0x4(%rbp)
jmp 0xeae7
movq -0x90(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movq -0x80(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0xa0(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x98(%rbp), %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq -0xa0(%rbp)
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xa0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/serge-404[P]CPM32/cpm.c
// Function: cpm_findnext
byte cpm_findnext( void)
{
    WIN32_FIND_DATA aFindData;
    char *p;
    struct FCB *fcb = (struct FCB *)(mem + cpm_dma_addr);

    if ( hFindFile == INVALID_HANDLE_VALUE) return 0xff;

    while ( FindNextFile( hFindFile, &aFindData)) {
	p = aFindData.cAlternateFileName;
	if ( !*p) p = aFindData.cFileName;
	if (( aFindData.dwFileAttributes & 
		(FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_HIDDEN)) == 0) {
	    DWORD l = aFindData.nFileSizeLow;
	    if ( aFindData.nFileSizeHigh || l > 0x7fff80) l = 0x7fff80;
	    l = (l + 0x7f) >> 7;
	    fcb->ex = (byte)(l >> 7);
	    fcb->rc = (byte)(l & 0x7f);
	    mkFCB( mem + cpm_dma_addr, p);
	    return 0;
	}
    }
    FindClose( hFindFile); 
    hFindFile = INVALID_HANDLE_VALUE;
    return 0xff;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movq 0xc6fe(%rip), %rax      # 0x1b210
movzwl 0xc711(%rip), %ecx      # 0x1b22a
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x148(%rbp)
cmpq $0x0, 0x10e552(%rip)    # 0x11d080
jne 0xeb39
movb $-0x1, -0x1(%rbp)
jmp 0xec59
jmp 0xeb3b
movq 0x10e53e(%rip), %rdi    # 0x11d080
leaq -0x138(%rbp), %rsi
callq 0xe8b0
cmpl $0x0, %eax
je 0xec3e
leaq -0x138(%rbp), %rax
addq $0x11c, %rax            # imm = 0x11C
movq %rax, -0x140(%rbp)
movq -0x140(%rbp), %rax
cmpb $0x0, (%rax)
jne 0xeb89
leaq -0x138(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x140(%rbp)
movq -0x138(%rbp), %rax
andq $0x4002, %rax           # imm = 0x4002
cmpq $0x0, %rax
jne 0xec39
movq -0x128(%rbp), %rax
movq %rax, -0x150(%rbp)
cmpq $0x0, -0x130(%rbp)
jne 0xebc5
cmpq $0x7fff80, -0x150(%rbp) # imm = 0x7FFF80
jbe 0xebd0
movq $0x7fff80, -0x150(%rbp) # imm = 0x7FFF80
movq -0x150(%rbp), %rax
addq $0x7f, %rax
shrq $0x7, %rax
movq %rax, -0x150(%rbp)
movq -0x150(%rbp), %rax
shrq $0x7, %rax
movb %al, %cl
movq -0x148(%rbp), %rax
movb %cl, 0xc(%rax)
movq -0x150(%rbp), %rax
andq $0x7f, %rax
movb %al, %cl
movq -0x148(%rbp), %rax
movb %cl, 0xf(%rax)
movq 0xc5f5(%rip), %rdi      # 0x1b210
movzwl 0xc608(%rip), %eax      # 0x1b22a
cltq
addq %rax, %rdi
movq -0x140(%rbp), %rsi
callq 0xe1a0
movb $0x0, -0x1(%rbp)
jmp 0xec59
jmp 0xeb3b
movq 0x10e43b(%rip), %rdi    # 0x11d080
callq 0xea00
movq $0x0, 0x10e42b(%rip) # 0x11d080
movb $-0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/serge-404[P]CPM32/cpm.c
// Function: cpm_findfirst
byte cpm_findfirst( byte *fcbaddr)
{
    WIN32_FIND_DATA aFindData;
    char *p;
    struct FCB *fcb = (struct FCB *)(mem + cpm_dma_addr);
    DWORD l;

    if ( hFindFile != INVALID_HANDLE_VALUE) FindClose( hFindFile);

    if ( !mk_filename( filename, fcbaddr)) return 0xff;

    hFindFile = FindFirstFile( filename, &aFindData);
    if ( hFindFile == INVALID_HANDLE_VALUE) return 0xff;

    p = aFindData.cAlternateFileName;
    if ( !*p) p = aFindData.cFileName;
    if ( aFindData.dwFileAttributes & 
	 (FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_HIDDEN)) {
		return cpm_findnext();
    }

    l = aFindData.nFileSizeLow;
    if ( aFindData.nFileSizeHigh || l > 0x7fff80) l = 0x7fff80;
    l = (l + 0x7f) >> 7;
    fcb->ex = (byte)(l >> 7);
    fcb->rc = (byte)(l & 0x7f);
    mkFCB( mem + cpm_dma_addr, p);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x160, %rsp            # imm = 0x160
movq %rdi, -0x10(%rbp)
movq 0xc58a(%rip), %rax      # 0x1b210
movzwl 0xc59d(%rip), %ecx      # 0x1b22a
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x150(%rbp)
cmpq $0x0, 0x10e3de(%rip)    # 0x11d080
je 0xecb0
movq 0x10e3d5(%rip), %rdi    # 0x11d080
callq 0xea00
movq -0x10(%rbp), %rsi
leaq 0x10dfc5(%rip), %rdi    # 0x11cc80
callq 0xe320
cmpq $0x0, %rax
jne 0xeccf
movb $-0x1, -0x1(%rbp)
jmp 0xede5
leaq 0x10dfaa(%rip), %rdi    # 0x11cc80
leaq -0x140(%rbp), %rsi
callq 0xe5e0
movq %rax, 0x10e397(%rip)    # 0x11d080
cmpq $0x0, 0x10e38f(%rip)    # 0x11d080
jne 0xecfc
movb $-0x1, -0x1(%rbp)
jmp 0xede5
leaq -0x140(%rbp), %rax
addq $0x11c, %rax            # imm = 0x11C
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rax
cmpb $0x0, (%rax)
jne 0xed2e
leaq -0x140(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x148(%rbp)
movq -0x140(%rbp), %rax
andq $0x4002, %rax           # imm = 0x4002
cmpq $0x0, %rax
je 0xed4e
callq 0xeb00
movb %al, -0x1(%rbp)
jmp 0xede5
movq -0x130(%rbp), %rax
movq %rax, -0x158(%rbp)
cmpq $0x0, -0x138(%rbp)
jne 0xed73
cmpq $0x7fff80, -0x158(%rbp) # imm = 0x7FFF80
jbe 0xed7e
movq $0x7fff80, -0x158(%rbp) # imm = 0x7FFF80
movq -0x158(%rbp), %rax
addq $0x7f, %rax
shrq $0x7, %rax
movq %rax, -0x158(%rbp)
movq -0x158(%rbp), %rax
shrq $0x7, %rax
movb %al, %cl
movq -0x150(%rbp), %rax
movb %cl, 0xc(%rax)
movq -0x158(%rbp), %rax
andq $0x7f, %rax
movb %al, %cl
movq -0x150(%rbp), %rax
movb %cl, 0xf(%rax)
movq 0xc447(%rip), %rdi      # 0x1b210
movzwl 0xc45a(%rip), %eax      # 0x1b22a
cltq
addq %rax, %rdi
movq -0x148(%rbp), %rsi
callq 0xe1a0
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x160, %rsp            # imm = 0x160
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/serge-404[P]CPM32/cpm.c
// Function: cpm_file_close
byte cpm_file_close( byte *fcbaddr)
{
    int i;
    struct FCB *fcb = (struct FCB *)fcbaddr;

	if (( i = fcb->d[ 0]) > 0 && --i < MAXFCB) {
DEBUGOUT( stderr, "CLOSE %d - ", i);
	    if ( fcbs[ i].fp) fclose( fcbs[ i].fp);
	    fcbs[ i].fp = 0;
	    fcb->d[ 0] = 0;
	    return 0;
	}
	if ( i == 0) return 0;
	return 0xff;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movzbl 0x10(%rax), %eax
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
jle 0xf343
movl -0x14(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x14(%rbp)
cmpl $0x40, %eax
jge 0xf343
cmpl $0x0, 0x10c1e7(%rip)    # 0x11b4b4
je 0xf2ea
movq 0xbd22(%rip), %rax      # 0x1aff8
movq (%rax), %rdi
movl -0x14(%rbp), %edx
leaq 0x91e6(%rip), %rsi      # 0x184c9
movb $0x0, %al
callq 0x2220
movslq -0x14(%rbp), %rcx
leaq 0x10dfbb(%rip), %rax    # 0x11d2b0
shlq $0x5, %rcx
addq %rcx, %rax
cmpq $0x0, (%rax)
je 0xf31c
movslq -0x14(%rbp), %rcx
leaq 0x10dfa3(%rip), %rax    # 0x11d2b0
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rdi
callq 0x20d0
movslq -0x14(%rbp), %rcx
leaq 0x10df89(%rip), %rax    # 0x11d2b0
shlq $0x5, %rcx
addq %rcx, %rax
movq $0x0, (%rax)
movq -0x20(%rbp), %rax
movb $0x0, 0x10(%rax)
movb $0x0, -0x1(%rbp)
jmp 0xf353
cmpl $0x0, -0x14(%rbp)
jne 0xf34f
movb $0x0, -0x1(%rbp)
jmp 0xf353
movb $-0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/serge-404[P]CPM32/cpm.c
// Function: cpm_change_filesize
void cpm_change_filesize( byte *fcbaddr)
{
    int i, sz;
    struct FCB *fcb = (struct FCB *)fcbaddr;

    sz = (fcb->d[ 3] << 16) + (fcb->d[2] << 8) + fcb->d[1];
    if (( sz >> 7) == fcb->ex && (sz & 0x7f) > fcb->rc &&
	 mk_filename( filename, fcbaddr) &&
	 ( i = open( filename, O_RDWR)) != -1) {
		chsize( i, (( fcb->ex << 7) + fcb->rc) << 7);
		close( i);
DEBUGOUT( stderr, "Change file size : %s\n", filename);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movzbl 0x13(%rax), %eax
shll $0x10, %eax
movq -0x18(%rbp), %rcx
movzbl 0x12(%rcx), %ecx
shll $0x8, %ecx
addl %ecx, %eax
movq -0x18(%rbp), %rcx
movzbl 0x11(%rcx), %ecx
addl %ecx, %eax
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
sarl $0x7, %eax
movq -0x18(%rbp), %rcx
movzbl 0xc(%rcx), %ecx
cmpl %ecx, %eax
jne 0xf44b
movl -0x10(%rbp), %eax
andl $0x7f, %eax
movq -0x18(%rbp), %rcx
movzbl 0xf(%rcx), %ecx
cmpl %ecx, %eax
jle 0xf44b
movq -0x8(%rbp), %rsi
leaq 0x10d8b0(%rip), %rdi    # 0x11cc80
callq 0xe320
cmpq $0x0, %rax
je 0xf44b
leaq 0x10d89e(%rip), %rdi    # 0x11cc80
movl $0x2, %esi
movb $0x0, %al
callq 0x2340
movl %eax, -0xc(%rbp)
cmpl $-0x1, %eax
je 0xf44b
movl -0xc(%rbp), %edi
movq -0x18(%rbp), %rax
movzbl 0xc(%rax), %eax
shll $0x7, %eax
movq -0x18(%rbp), %rcx
movzbl 0xf(%rcx), %ecx
addl %ecx, %eax
shll $0x7, %eax
movslq %eax, %rsi
callq 0x2130
movl -0xc(%rbp), %edi
callq 0x21a0
cmpl $0x0, 0x10c08c(%rip)    # 0x11b4b4
je 0xf449
movq 0xbbc7(%rip), %rax      # 0x1aff8
movq (%rax), %rdi
leaq 0x909a(%rip), %rsi      # 0x184d5
leaq 0x10d83e(%rip), %rdx    # 0x11cc80
movb $0x0, %al
callq 0x2220
jmp 0xf44b
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/serge-404[P]CPM32/cpm.c
// Function: cpm_file_size
byte cpm_file_size( byte *fcbaddr)
{
    struct FCB *fcb = (struct FCB *)fcbaddr;
    DWORD d;

    if ( cpm_file_open( fcbaddr, CF_OPEN)) return 0xff;
    d = fcb->d[1] + (fcb->d[2] << 8) + (fcb->d[3] << 16);
    fcb->r0 = (byte)d;
    fcb->r1 = (byte)(d >> 8); 
    fcb->r2 = (byte)(d >> 16);
    cpm_file_close( fcbaddr);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0xee00
cmpb $0x0, %al
je 0xf989
movb $-0x1, -0x1(%rbp)
jmp 0xf9ed
movq -0x18(%rbp), %rax
movzbl 0x11(%rax), %eax
movq -0x18(%rbp), %rcx
movzbl 0x12(%rcx), %ecx
shll $0x8, %ecx
addl %ecx, %eax
movq -0x18(%rbp), %rcx
movzbl 0x13(%rcx), %ecx
shll $0x10, %ecx
addl %ecx, %eax
cltq
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0x21(%rax)
movq -0x20(%rbp), %rax
shrq $0x8, %rax
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0x22(%rax)
movq -0x20(%rbp), %rax
shrq $0x10, %rax
movb %al, %cl
movq -0x18(%rbp), %rax
movb %cl, 0x23(%rax)
movq -0x10(%rbp), %rdi
callq 0xf290
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/serge-404[P]CPM32/cpm.c
// Function: cpm_set_rndrec
byte cpm_set_rndrec( byte *fcbaddr)
{
    struct FCB *fcb = (struct FCB *)fcbaddr;
    unsigned d = (fcb->cr & 0x7f) + (fcb->ex << 7); /* 2012.02 bugfix 8->7 */

    fcb->r0 = (byte)d;
    fcb->r1 = (byte)(d >> 8); 
    fcb->r2 = (byte)(d >> 16);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movzbl 0x20(%rax), %eax
andl $0x7f, %eax
movq -0x10(%rbp), %rcx
movzbl 0xc(%rcx), %ecx
shll $0x7, %ecx
addl %ecx, %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x21(%rax)
movl -0x14(%rbp), %eax
shrl $0x8, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x22(%rax)
movl -0x14(%rbp), %eax
shrl $0x10, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x23(%rax)
xorl %eax, %eax
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/serge-404[P]CPM32/cpm.c
// Function: frameup_dpb_alloc
void frameup_dpb_alloc( void)
{
    DWORD spc, bps, free, total;
    DWORD *alloc = (DWORD *)(mem + DMY_ALLOC);
    byte sft;
    int i;

    GetDiskFreeSpace( NULL, &spc, &bps, &free, &total);
    spc *= bps;
    spc >>= 9; sft = 2;
    /* 2008.12 for large disk space (> 2TBytes) */
    while ( spc && (spc & 1) == 0) { spc >>= 1; sft++; }
    free *= spc;
    while ( free > MAXBLK) { free >>= 1; sft++; }
    mem[ DMY_DPB_SFT] = sft;
    *(word *)(mem + DMY_DPB_MSK) = (word)((1 << sft) - 1);

    i = 0;
    while ( free >= 32) {
        free -= 32; alloc[ i++] = 0;
    }
    alloc[ i++] = ~0 << free;
    while ( i < MAXBLK/32) alloc[ i++] = ~0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq 0xb541(%rip), %rax      # 0x1b210
addq $0xff20, %rax           # imm = 0xFF20
movq %rax, -0x28(%rbp)
xorl %eax, %eax
movl %eax, %edi
leaq -0x8(%rbp), %rsi
leaq -0x10(%rbp), %rdx
leaq -0x18(%rbp), %rcx
leaq -0x20(%rbp), %r8
callq 0xea60
movq -0x10(%rbp), %rax
imulq -0x8(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
shrq $0x9, %rax
movq %rax, -0x8(%rbp)
movb $0x2, -0x29(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x8(%rbp)
movb %al, -0x31(%rbp)
je 0xfd2d
movq -0x8(%rbp), %rax
andq $0x1, %rax
cmpq $0x0, %rax
sete %al
movb %al, -0x31(%rbp)
movb -0x31(%rbp), %al
testb $0x1, %al
jne 0xfd36
jmp 0xfd4b
movq -0x8(%rbp), %rax
shrq %rax
movq %rax, -0x8(%rbp)
movb -0x29(%rbp), %al
addb $0x1, %al
movb %al, -0x29(%rbp)
jmp 0xfd0f
movq -0x8(%rbp), %rax
imulq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
cmpq $0x400, -0x18(%rbp)     # imm = 0x400
jbe 0xfd77
movq -0x18(%rbp), %rax
shrq %rax
movq %rax, -0x18(%rbp)
movb -0x29(%rbp), %al
addb $0x1, %al
movb %al, -0x29(%rbp)
jmp 0xfd58
movb -0x29(%rbp), %cl
movq 0xb48f(%rip), %rax      # 0x1b210
movb %cl, 0xff12(%rax)
movzbl -0x29(%rbp), %ecx
movl $0x1, %eax
shll %cl, %eax
subl $0x1, %eax
movw %ax, %cx
movq 0xb471(%rip), %rax      # 0x1b210
movw %cx, 0xff13(%rax)
movl $0x0, -0x30(%rbp)
cmpq $0x20, -0x18(%rbp)
jb 0xfddc
movq -0x18(%rbp), %rax
subq $0x20, %rax
movq %rax, -0x18(%rbp)
movq -0x28(%rbp), %rax
movl -0x30(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x30(%rbp)
movslq %ecx, %rcx
movq $0x0, (%rax,%rcx,8)
jmp 0xfdad
movq -0x18(%rbp), %rax
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
shll %cl, %eax
movslq %eax, %rdx
movq -0x28(%rbp), %rax
movl -0x30(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x30(%rbp)
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
cmpl $0x20, -0x30(%rbp)
jge 0xfe24
movq -0x28(%rbp), %rax
movl -0x30(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x30(%rbp)
movslq %ecx, %rcx
movq $-0x1, (%rax,%rcx,8)
jmp 0xfe02
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/serge-404[P]CPM32/cpm.c
// Function: cpm_gettime
byte cpm_gettime( byte *buf, time_t t)
{
    int d;
    static time_t time780101;

    if ( time780101 == 0) {
 	struct tm tm;
	memset( &tm, 0, sizeof tm);
	tm.tm_year = 78;
	tm.tm_mon =   0;
	tm.tm_mday =  1;
	time780101 = mktime( &tm);
    }

    t -= time780101;
    d = t % 60; t /= 60;
    buf[ 4] = (byte)((d % 10) + ((d / 10) << 4));
    d = t % 60; t /= 60;
    buf[ 3] = (byte)((d % 10) + ((d / 10) << 4));
    d = t % 24; t /= 24;
    buf[ 2] = (byte)((d % 10) + ((d / 10) << 4));
    d = t + 1;
    buf[ 0] = (byte)d;
    buf[ 1] = (byte)(d >> 8);

    return buf[ 4];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, 0x10dc70(%rip)    # 0x11dab8
jne 0xfe7f
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
movl $0x38, %edx
callq 0x2160
movl $0x4e, -0x3c(%rbp)
movl $0x0, -0x40(%rbp)
movl $0x1, -0x44(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x22e0
movq %rax, 0x10dc39(%rip)    # 0x11dab8
movq 0x10dc32(%rip), %rcx    # 0x11dab8
movq -0x10(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl $0x3c, %ecx
cqto
idivq %rcx
movl %edx, %eax
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rax
movl $0x3c, %ecx
cqto
idivq %rcx
movq %rax, -0x10(%rbp)
movl -0x14(%rbp), %eax
movl $0xa, %ecx
cltd
idivl %ecx
movl %edx, -0x5c(%rbp)
movl -0x14(%rbp), %eax
movl $0xa, %ecx
cltd
idivl %ecx
movl -0x5c(%rbp), %edx
shll $0x4, %eax
addl %eax, %edx
movb %dl, %cl
movq -0x8(%rbp), %rax
movb %cl, 0x4(%rax)
movq -0x10(%rbp), %rax
movl $0x3c, %ecx
cqto
idivq %rcx
movl %edx, %eax
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rax
movl $0x3c, %ecx
cqto
idivq %rcx
movq %rax, -0x10(%rbp)
movl -0x14(%rbp), %eax
movl $0xa, %ecx
cltd
idivl %ecx
movl %edx, -0x58(%rbp)
movl -0x14(%rbp), %eax
movl $0xa, %ecx
cltd
idivl %ecx
movl -0x58(%rbp), %edx
shll $0x4, %eax
addl %eax, %edx
movb %dl, %cl
movq -0x8(%rbp), %rax
movb %cl, 0x3(%rax)
movq -0x10(%rbp), %rax
movl $0x18, %ecx
cqto
idivq %rcx
movl %edx, %eax
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rax
movl $0x18, %ecx
cqto
idivq %rcx
movq %rax, -0x10(%rbp)
movl -0x14(%rbp), %eax
movl $0xa, %ecx
cltd
idivl %ecx
movl %edx, -0x54(%rbp)
movl -0x14(%rbp), %eax
movl $0xa, %ecx
cltd
idivl %ecx
movl -0x54(%rbp), %edx
shll $0x4, %eax
addl %eax, %edx
movb %dl, %cl
movq -0x8(%rbp), %rax
movb %cl, 0x2(%rax)
movq -0x10(%rbp), %rax
addq $0x1, %rax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
movb %al, %cl
movq -0x8(%rbp), %rax
movb %cl, (%rax)
movl -0x14(%rbp), %eax
sarl $0x8, %eax
movb %al, %cl
movq -0x8(%rbp), %rax
movb %cl, 0x1(%rax)
movq -0x8(%rbp), %rax
movb 0x4(%rax), %al
addq $0x60, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/serge-404[P]CPM32/cpm.c
// Function: cpm_disk_reset
byte cpm_disk_reset( void)
{
    HANDLE hFndFile;
    WIN32_FIND_DATA aFindData;

    cpm_disk_no = 0;
    cpm_dma_addr = 0x80;

    sprintf( filename, "%s|*.*", cpm_drive[ cpm_disk_no]);
    hFndFile = FindFirstFile( filename, &aFindData);
    if ( hFndFile == INVALID_HANDLE_VALUE) return 0;
    FindClose( hFndFile);
    return 0xff;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movb $0x0, 0xb266(%rip)      # 0x1b228
movw $0x80, 0xb25f(%rip)     # 0x1b22a
movzbl 0xb256(%rip), %eax      # 0x1b228
movl %eax, %ecx
leaq 0x10b605(%rip), %rax    # 0x11b5e0
movq (%rax,%rcx,8), %rdx
leaq 0x10cc9a(%rip), %rdi    # 0x11cc80
leaq 0x854a(%rip), %rsi      # 0x18537
movb $0x0, %al
callq 0x23b0
leaq 0x10cc85(%rip), %rdi    # 0x11cc80
leaq -0x140(%rbp), %rsi
callq 0xe5e0
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x10018
movb $0x0, -0x1(%rbp)
jmp 0x10025
movq -0x10(%rbp), %rdi
callq 0xea00
movb $-0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/serge-404[P]CPM32/cpm.c
// Function: cpm_lst_out
void cpm_lst_out( byte c)	/* LST: out */
{
    static int err;

    if ( lstfp == NULL && !err) {
	char *dev = getenv( "CPMLST");
	err = ( lstfp = fopen( dev ? dev : "PRN:", "wb")) == NULL;
    }
    if ( lstfp) putc( c, lstfp);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movb %dil, %al
movb %al, -0x1(%rbp)
cmpq $0x0, 0x10da72(%rip)    # 0x11dac8
jne 0x100b8
cmpl $0x0, 0x10da61(%rip)    # 0x11dac0
jne 0x100b8
leaq 0x84d6(%rip), %rdi      # 0x1853e
callq 0x2030
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x10082
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0x1008f
leaq 0x84bc(%rip), %rax      # 0x18545
movq %rax, -0x18(%rbp)
jmp 0x1008f
movq -0x18(%rbp), %rdi
leaq 0x84b0(%rip), %rsi      # 0x1854a
callq 0x2360
movq %rax, 0x10da22(%rip)    # 0x11dac8
cmpq $0x0, %rax
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, 0x10da08(%rip)    # 0x11dac0
cmpq $0x0, 0x10da08(%rip)    # 0x11dac8
je 0x100d2
movzbl -0x1(%rbp), %edi
movq 0x10d9fb(%rip), %rsi    # 0x11dac8
callq 0x2200
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/serge-404[P]CPM32/cpm.c
// Function: cpm_rdr_in
byte cpm_rdr_in( void)		/* RDR: in */
{
    static int err;
    char *dev;
    int c, ct = 16;

    if ( rdrfp == NULL && !err) {
	if (( dev = getenv( "CPMRDR")) != NULL) {
	    err = ( rdrfp = fopen( dev, "r+b")) == NULL;
	} else if ( punfp) {
	    rdrfp = punfp;
	} else {
	    dev = getenv( "CPMAUX");
	    err = ( rdrfp = fopen( dev ? dev : "AUX:", "r+b")) == NULL;
	}
    }
    if ( rdrfp && ( c = getc( rdrfp)) != EOF) return (byte)c;
    if ( --ct == 0) exit( 0);
    return '\x1a';
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl $0x10, -0x18(%rbp)
cmpq $0x0, 0x10d9e1(%rip)    # 0x11dad8
jne 0x101c0
cmpl $0x0, 0x10d9cc(%rip)    # 0x11dad0
jne 0x101c0
leaq 0x843c(%rip), %rdi      # 0x1854d
callq 0x2030
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
je 0x1014b
movq -0x10(%rbp), %rdi
leaq 0x839a(%rip), %rsi      # 0x184c5
callq 0x2360
movq %rax, 0x10d9a1(%rip)    # 0x11dad8
cmpq $0x0, %rax
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, 0x10d987(%rip)    # 0x11dad0
jmp 0x101be
cmpq $0x0, 0x10d98d(%rip)    # 0x11dae0
je 0x10165
movq 0x10d984(%rip), %rax    # 0x11dae0
movq %rax, 0x10d975(%rip)    # 0x11dad8
jmp 0x101bc
leaq 0x83e8(%rip), %rdi      # 0x18554
callq 0x2030
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x10186
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x10193
leaq 0x83ce(%rip), %rax      # 0x1855b
movq %rax, -0x20(%rbp)
jmp 0x10193
movq -0x20(%rbp), %rdi
leaq 0x8327(%rip), %rsi      # 0x184c5
callq 0x2360
movq %rax, 0x10d92e(%rip)    # 0x11dad8
cmpq $0x0, %rax
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, 0x10d914(%rip)    # 0x11dad0
jmp 0x101be
jmp 0x101c0
cmpq $0x0, 0x10d910(%rip)    # 0x11dad8
je 0x101e6
movq 0x10d907(%rip), %rdi    # 0x11dad8
callq 0x23e0
movl %eax, -0x14(%rbp)
cmpl $-0x1, %eax
je 0x101e6
movl -0x14(%rbp), %eax
movb %al, -0x1(%rbp)
jmp 0x101ff
movl -0x18(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x18(%rbp)
cmpl $0x0, %eax
jne 0x101fb
xorl %edi, %edi
callq 0x23c0
movb $0x1a, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/serge-404[P]CPM32/cpm.c
// Function: cpm_pun_out
void cpm_pun_out( byte c)	/* PUN: out */
{
    static int err;
    char *dev;

    if ( punfp == NULL && !err) {
	if (( dev = getenv( "CPMPUN")) != NULL) {
	    err = ( punfp = fopen( dev, "r+b")) == NULL;
	} else if ( rdrfp) {
	    punfp = rdrfp;
	} else {
	    dev = getenv( "CPMAUX");
	    err = ( punfp = fopen( dev ? dev : "AUX:", "r+b")) == NULL;
	}
    }
    if ( punfp) putc( c, punfp);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movb %dil, %al
movb %al, -0x1(%rbp)
cmpq $0x0, 0x10d8ba(%rip)    # 0x11dae0
jne 0x102ef
cmpl $0x0, 0x10d8b5(%rip)    # 0x11dae8
jne 0x102ef
leaq 0x8320(%rip), %rdi      # 0x18560
callq 0x2030
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
je 0x1027a
movq -0x10(%rbp), %rdi
leaq 0x826b(%rip), %rsi      # 0x184c5
callq 0x2360
movq %rax, 0x10d87a(%rip)    # 0x11dae0
cmpq $0x0, %rax
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, 0x10d870(%rip)    # 0x11dae8
jmp 0x102ed
cmpq $0x0, 0x10d856(%rip)    # 0x11dad8
je 0x10294
movq 0x10d84d(%rip), %rax    # 0x11dad8
movq %rax, 0x10d84e(%rip)    # 0x11dae0
jmp 0x102eb
leaq 0x82b9(%rip), %rdi      # 0x18554
callq 0x2030
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x102b5
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0x102c2
leaq 0x829f(%rip), %rax      # 0x1855b
movq %rax, -0x18(%rbp)
jmp 0x102c2
movq -0x18(%rbp), %rdi
leaq 0x81f8(%rip), %rsi      # 0x184c5
callq 0x2360
movq %rax, 0x10d807(%rip)    # 0x11dae0
cmpq $0x0, %rax
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, 0x10d7fd(%rip)    # 0x11dae8
jmp 0x102ed
jmp 0x102ef
cmpq $0x0, 0x10d7e9(%rip)    # 0x11dae0
je 0x10309
movzbl -0x1(%rbp), %edi
movq 0x10d7dc(%rip), %rsi    # 0x11dae0
callq 0x2200
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/serge-404[P]CPM32/cpm.c
// Function: cpull
int cpull()					/* FIFO imitation */
{
        int res=xgch;
        xgch=xgch2;
        xgch2=xgch3;
        xgch3=CON_BUF_EMPTY;
        return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl 0xae92(%rip), %eax      # 0x1b24c
movl %eax, -0x4(%rbp)
movl 0xae8d(%rip), %eax      # 0x1b250
movl %eax, 0xae83(%rip)      # 0x1b24c
movl 0xae85(%rip), %eax      # 0x1b254
movl %eax, 0xae7b(%rip)      # 0x1b250
movl $0xffffffff, 0xae75(%rip) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/serge-404[P]CPM32/cpm.c
// Function: getCursorPosition
void getCursorPosition(int *row, int *col) {
	fflush(0);
    printf("\x1b[6n");
    char buff[128];
    int indx = 0;
    for(;;) {
        int cc = getchar();
        buff[indx] = (char)cc;
        indx++;
        if(cc == 'R') {
            buff[indx + 1] = '\0';
            break;
        }
    }    
    sscanf(buff, "\x1b[%d;%dR", row, col);
    fseek(stdin, 0, SEEK_END);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
xorl %eax, %eax
movl %eax, %edi
callq 0x22c0
leaq 0x8154(%rip), %rdi      # 0x18567
movb $0x0, %al
callq 0x2110
movl $0x0, -0x94(%rbp)
callq 0x2210
movl %eax, -0x98(%rbp)
movl -0x98(%rbp), %eax
movb %al, %cl
movslq -0x94(%rbp), %rax
movb %cl, -0x90(%rbp,%rax)
movl -0x94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x94(%rbp)
cmpl $0x52, -0x98(%rbp)
jne 0x10472
movl -0x94(%rbp), %eax
addl $0x1, %eax
cltq
movb $0x0, -0x90(%rbp,%rax)
jmp 0x10474
jmp 0x10424
leaq -0x90(%rbp), %rdi
movq -0x8(%rbp), %rdx
movq -0x10(%rbp), %rcx
leaq 0x80e2(%rip), %rsi      # 0x1856c
movb $0x0, %al
callq 0x22d0
movq 0xab40(%rip), %rax      # 0x1afd8
movq (%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x2, %edx
callq 0x22f0
addq $0xa0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)