LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/j4r0g[P]Projet_Labyrinthe/Boite_outils/Outil.c
// Function: While
void While(long zIterationMax){
	//prend note du nombre maximum d'itérations acceptable dans le while qui suit immédiatement l'appel de cette routine
//ATTENTION:l'utilisation de cette routine est incompatible avec des sorties de boucles intempestives telles que exit(), return, etc.
	assert(zIterationMax>=0);
	ipWhilE++;
	assert(ipWhilE<=kuWhileMaX);
	zWhilE[ipWhilE]=zIterationMax;
}

// Assembly:
pushq %rax
testq %rdi, %rdi
js 0x56fd
movslq 0xb1a4(%rip), %rax      # 0x10884
leal 0x1(%rax), %ecx
movl %ecx, 0xb19b(%rip)      # 0x10884
cmpq $0x5, %rax
jge 0x571c
leaq 0xc2ca(%rip), %rcx      # 0x119c0
movq %rdi, 0x8(%rcx,%rax,8)
popq %rax
retq
leaq 0x1995(%rip), %rdi      # 0x7099
leaq 0x11b4(%rip), %rsi      # 0x68bf
leaq 0x1998(%rip), %rcx      # 0x70aa
movl $0x3fc, %edx            # imm = 0x3FC
callq 0x10b0
leaq 0x1998(%rip), %rdi      # 0x70bb
leaq 0x1195(%rip), %rsi      # 0x68bf
leaq 0x1979(%rip), %rcx      # 0x70aa
movl $0x3fe, %edx            # imm = 0x3FE
callq 0x10b0
// File: /workspace/github_c_makefile_star2_O1/j4r0g[P]Projet_Labyrinthe/Boite_outils/Outil.c
// Function: bWhile
int bWhile(int bExpressionBooleenne){
	//rend bExpressionBooleenne tout en gérant l'itération en cours (ie son rang ne dépasse pas zIterationMax spécifié dans l'appel à While() qui précède
//ATTENTION:l'utilisation de cette routine est incompatible avec des sorties de boucles intempestives telles que exit(), return,etc
	Croit(0,ipWhilE,kuWhileMaX);
	zWhilE[ipWhilE]--;//décrémente le nombre d'itérations de la boucle imbriquée de rang ipWhilE
	assert(zWhilE[ipWhilE]>=0);
	if (bExpressionBooleenne==0){//la sortie imminente du while courant ramène le contexte ds la boucle imbriquée englobante,de rang ipWhilE-1
		zWhilE[ipWhilE]=0;//superflu mais ce nettoyage facilite la mise au point
		ipWhilE--;//vital
		assert(ipWhilE>=0);
	}//Chaque boucle while est donc contrôlée via 1° un appel à While() avant le while et 2° un appel à bWhile() dans l'expression booléenne liée au...
	return(bExpressionBooleenne);//...while; Appel1("") à la fin du main() vérifie que le contrôle des while est bien séquencé via "assert(ipWhilE>=0)".
}

// Assembly:
pushq %rbx
movl %edi, %ebx
movl 0xb140(%rip), %esi      # 0x10884
xorl %edi, %edi
movl $0x5, %edx
callq 0x4745
movslq 0xb12d(%rip), %rax      # 0x10884
leaq 0xc262(%rip), %rcx      # 0x119c0
movq (%rcx,%rax,8), %rdx
leaq -0x1(%rdx), %rsi
movq %rsi, (%rcx,%rax,8)
testq %rdx, %rdx
jle 0x578c
testl %ebx, %ebx
jne 0x5788
movq $0x0, (%rcx,%rax,8)
leal -0x1(%rax), %ecx
movl %ecx, 0xb100(%rip)      # 0x10884
testl %eax, %eax
jle 0x57ab
movl %ebx, %eax
popq %rbx
retq
leaq 0x193c(%rip), %rdi      # 0x70cf
leaq 0x1125(%rip), %rsi      # 0x68bf
leaq 0x1941(%rip), %rcx      # 0x70e2
movl $0x407, %edx            # imm = 0x407
callq 0x10b0
leaq 0x124b(%rip), %rdi      # 0x69fd
leaq 0x1106(%rip), %rsi      # 0x68bf
leaq 0x1922(%rip), %rcx      # 0x70e2
movl $0x40b, %edx            # imm = 0x40B
callq 0x10b0
// File: /workspace/github_c_makefile_star2_O1/marcespie[P]unix-samples/chapter2/ttysig.c
// Function: byebye
void
byebye(int sig)
{
	save_data();
	signal(sig, SIG_DFL);
	errwrap(tcsetattr(0, TCSANOW, &basetty));
	kill(getpid(), sig);
}

// Assembly:
pushq %rbx
movl %edi, %ebx
xorl %esi, %esi
callq 0x1090
leaq 0x2e56(%rip), %rdx      # 0x4094
xorl %edi, %edi
xorl %esi, %esi
callq 0x10d0
cmpl $-0x1, %eax
je 0x125b
callq 0x1060
movl %eax, %edi
movl %ebx, %esi
popq %rbx
jmp 0x10a0
leaq 0xda2(%rip), %rsi       # 0x2004
movl $0x1, %edi
xorl %eax, %eax
callq 0x10b0
// File: /workspace/github_c_makefile_star2_O1/marcespie[P]unix-samples/chapter2/ttysig.c
// Function: tstp_handler
void
tstp_handler(int sig)
{
	int save_errno = errno;

	signal(sig, SIG_DFL);
	errwrap(tcsetattr(0, TCSANOW, &basetty));
	kill(getpid(), sig);
	errno = save_errno;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edi, %ebx
callq 0x1030
movq %rax, %r14
movl (%rax), %ebp
movl %ebx, %edi
xorl %esi, %esi
callq 0x1090
leaq 0x2e06(%rip), %rdx      # 0x4094
xorl %edi, %edi
xorl %esi, %esi
callq 0x10d0
cmpl $-0x1, %eax
je 0x12b2
callq 0x1060
movl %eax, %edi
movl %ebx, %esi
callq 0x10a0
movl %ebp, (%r14)
popq %rbx
popq %r14
popq %rbp
retq
leaq 0xd4b(%rip), %rsi       # 0x2004
movl $0x1, %edi
xorl %eax, %eax
callq 0x10b0
// File: /workspace/github_c_makefile_star2_O1/marcespie[P]unix-samples/chapter2/ttysig.c
// Function: tcont_handler
void
tcont_handler(int sig)
{
	int save_errno = errno;

	signal(SIGTSTP, tstp_handler);
	errwrap(tcsetattr(0, TCSANOW, &mytty));
	errno = save_errno;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
callq 0x1030
movq %rax, %rbx
movl (%rax), %ebp
leaq -0x6b(%rip), %rsi       # 0x126e
movl $0x14, %edi
callq 0x1090
leaq 0x2de6(%rip), %rdx      # 0x40d0
xorl %edi, %edi
xorl %esi, %esi
callq 0x10d0
cmpl $-0x1, %eax
je 0x1301
movl %ebp, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0xd1c(%rip), %rsi       # 0x2024
movl $0x1, %edi
xorl %eax, %eax
callq 0x10b0
// File: /workspace/github_c_makefile_star2_O1/marcespie[P]unix-samples/chapter2/ttysig.c
// Function: main
int
main()
{
	if (!isatty(0)) {
		fprintf(stderr, "This example programs shows tty behavior\n");
		exit(0);
	}
	// save basic tty stuff for later
	errwrap(tcgetattr(0, &basetty));
	errwrap(tcgetattr(0, &mytty));

	// obvious signals where we need to change/restore behavior
	signal(SIGTSTP, tstp_handler);
	signal(SIGCONT, tcont_handler);

	// all the signals that "kill" your program, so you should save
	// data AND restore the tty
	signal(SIGINT, byebye);
	signal(SIGQUIT, byebye);
	signal(SIGTERM, byebye);
	signal(SIGHUP, byebye);

	// XXX a lot of modern shells may handle tty modes for us, but
	// it's by no way guaranteed, so to be fully compliant we must
	// restore the tty on TSTP, and restore it on CONT.


	// tweak stuff we want (e.g., echo off)
	mytty.c_lflag &= ~ECHO;
	errwrap(tcsetattr(0, TCSANOW, &mytty));


	char buffer[MYSIZE];

	while (true) {
		ssize_t r;
		errwrap(r = read(0, buffer, sizeof buffer));
		if (r == 0)
			break;
		safe_write(1, buffer, r);
	}
}

// Assembly:
pushq %rbx
subq $0x400, %rsp            # imm = 0x400
xorl %edi, %edi
callq 0x1040
testl %eax, %eax
je 0x141f
leaq 0x2d62(%rip), %rsi      # 0x4094
xorl %edi, %edi
callq 0x10c0
cmpl $-0x1, %eax
je 0x1424
leaq 0x2d87(%rip), %rsi      # 0x40d0
xorl %edi, %edi
callq 0x10c0
cmpl $-0x1, %eax
je 0x142d
leaq -0xf2(%rip), %rsi       # 0x126e
movl $0x14, %edi
callq 0x1090
leaq -0xac(%rip), %rsi       # 0x12c5
movl $0x12, %edi
callq 0x1090
leaq -0x155(%rip), %rbx      # 0x122d
movl $0x2, %edi
movq %rbx, %rsi
callq 0x1090
movl $0x3, %edi
movq %rbx, %rsi
callq 0x1090
movl $0xf, %edi
movq %rbx, %rsi
callq 0x1090
movl $0x1, %edi
movq %rbx, %rsi
callq 0x1090
leaq 0x2d13(%rip), %rdx      # 0x40d0
andb $-0x9, 0x2d18(%rip)     # 0x40dc
xorl %edi, %edi
xorl %esi, %esi
callq 0x10d0
cmpl $-0x1, %eax
je 0x1436
movq %rsp, %rbx
movl $0x400, %edx            # imm = 0x400
xorl %edi, %edi
movq %rbx, %rsi
callq 0x1080
testq %rax, %rax
je 0x1401
cmpq $-0x1, %rax
je 0x140c
movl $0x1, %edi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x1440
jmp 0x13d5
xorl %eax, %eax
addq $0x400, %rsp            # imm = 0x400
popq %rbx
retq
leaq 0xc85(%rip), %rsi       # 0x2098
movl $0x1, %edi
xorl %eax, %eax
callq 0x10b0
callq 0x1110
leaq 0xc41(%rip), %rsi       # 0x206c
jmp 0x1413
leaq 0xc4f(%rip), %rsi       # 0x2083
jmp 0x1413
leaq 0xbe7(%rip), %rsi       # 0x2024
jmp 0x1413
nop
// File: /workspace/github_c_makefile_star2_O1/marcespie[P]unix-samples/chapter2/safe_write.c
// Function: safe_write
void
safe_write(int fd, 
    const void *buf,
    size_t sz)
{
	const char *b = buf;
	while (sz != 0) {
		ssize_t r;
		errwrap(r = write(fd, b, sz));
		assert(r <= sz);
		b += r;
		sz -= r;
		// loop invariant: we have to write [buf, buf+sz[ to fd
	}
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
testq %rdx, %rdx
je 0x1471
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %ebp
movl %ebp, %edi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x1050
cmpq $-0x1, %rax
je 0x1476
cmpq %rax, %rbx
jb 0x1489
addq %rax, %r14
subq %rax, %rbx
jne 0x1451
popq %rbx
popq %r14
popq %rbp
retq
leaq 0xc3e(%rip), %rsi       # 0x20bb
movl $0x1, %edi
xorl %eax, %eax
callq 0x10b0
leaq 0xc40(%rip), %rdi       # 0x20d0
leaq 0xc41(%rip), %rsi       # 0x20d8
leaq 0xc47(%rip), %rcx       # 0x20e5
movl $0x11, %edx
callq 0x1070
// File: /workspace/github_c_makefile_star2_O1/eric-lo[P]3150/3-ProcessUser/fork_example_1.c
// Function: main
int main(void) {
	printf("Ready (PID = %d)\n", getpid());
	fork();
	printf("My PID is %d\n", getpid());
	return 0;
}

// Assembly:
pushq %rax
callq 0x1030
leaq 0xe9b(%rip), %rdi       # 0x2004
movl %eax, %esi
xorl %eax, %eax
callq 0x1040
callq 0x1050
callq 0x1030
leaq 0xe93(%rip), %rdi       # 0x2016
movl %eax, %esi
xorl %eax, %eax
callq 0x1040
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/teodorst[P]app-huffman/huffman_codification_pthreads.c
// Function: codification_thread
void *codification_thread(void *huffman_info_thread) {
	huffman_thread_struct* thread_arg = (huffman_thread_struct*) huffman_info_thread;
	
	unsigned long long int thread_size = thread_arg->input_buffer_size / NUM_THREADS;
	int index = (thread_arg->thread_id) * thread_size;
	int upper_limit = index + thread_size;
	
	int *output_buffer_contor = thread_arg->output_buffer_contors + thread_arg->thread_id;
	unsigned long long int *nbits = thread_arg->nbits_buffer + thread_arg->thread_id;

	
	char **codification = thread_arg->codification;

	char *input_buffer = thread_arg->input_buffer;
	char *output_buffer = thread_arg->output_buffer;

	printf("Hy! %d start %d, size %d !\n", thread_arg->thread_id, index, upper_limit);
	
	write_codification_for_chunk_pthreads(input_buffer, index, upper_limit, codification, output_buffer, output_buffer_contor, nbits);

	pthread_exit(NULL);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq 0x18(%rdi), %rbx
shrq $0x2, %rbx
movslq (%rdi), %rsi
movl %esi, %ebp
imull %ebx, %ebp
leaq (,%rsi,4), %r14
addq 0x28(%rdi), %r14
movq %rsi, %r15
shlq $0x3, %r15
addq 0x20(%rdi), %r15
addl %ebp, %ebx
movq 0x30(%rdi), %rax
movq %rax, 0x10(%rsp)
movq 0x8(%rdi), %r12
movq 0x10(%rdi), %r13
leaq 0x1c72(%rip), %rdi      # 0x3004
movl %ebp, %edx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x10a0
movq %r15, (%rsp)
movq %r12, %rdi
movl %ebp, %esi
movl %ebx, %edx
movq 0x10(%rsp), %rcx
movq %r13, %r8
movq %r14, %r9
callq 0x1c44
xorl %edi, %edi
callq 0x1120
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/retro.c
// Function: verbose_details
V verbose_details(NgaState *vm, CELL opcode) {
  fprintf(stderr, "ip: %lld ", (long long)ACTIVE.ip);
  fprintf(stderr, "sp: %lld ", (long long)ACTIVE.sp);
  fprintf(stderr, "rp: %lld ", (long long)ACTIVE.rp);
  fprintf(stderr, "core: %lld ", (long long)vm->active);
  fprintf(stderr, "opcode: %lld\n", (long long)opcode);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
movq 0xbb57(%rip), %r15      # 0xeff8
movq (%r15), %rdi
movslq 0x2043a4(%r14), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
movslq 0x20000c(%r14,%rax), %rdx
leaq 0x7dd5(%rip), %rsi      # 0xb296
xorl %eax, %eax
callq 0x3270
movq (%r15), %rdi
movslq 0x2043a4(%r14), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
movslq 0x200004(%r14,%rax), %rdx
leaq 0x7db8(%rip), %rsi      # 0xb2a0
xorl %eax, %eax
callq 0x3270
movq (%r15), %rdi
movslq 0x2043a4(%r14), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
movslq 0x200008(%r14,%rax), %rdx
leaq 0x7d9b(%rip), %rsi      # 0xb2aa
xorl %eax, %eax
callq 0x3270
movq (%r15), %rdi
movslq 0x2043a4(%r14), %rdx
leaq 0x7d8d(%rip), %rsi      # 0xb2b4
xorl %eax, %eax
callq 0x3270
movq (%r15), %rdi
movslq %ebx, %rdx
leaq 0x7d85(%rip), %rsi      # 0xb2c0
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
jmp 0x3270
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/./utf32.c
// Function: utf32_strcmp
int utf32_strcmp(const int32_t *str1, const int32_t *str2) {
  while (*str1 && (*str1 == *str2)) {
    str1++;
    str2++;
  }
  return *str1 - *str2;
}

// Assembly:
movl (%rdi), %eax
testl %eax, %eax
je 0x367c
addq $0x4, %rdi
cmpl (%rsi), %eax
jne 0x367c
addq $0x4, %rsi
movl (%rdi), %eax
addq $0x4, %rdi
testl %eax, %eax
jne 0x366a
subl (%rsi), %eax
retq
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/./utf32.c
// Function: c_to_utf32
void c_to_utf32(const char *source, int32_t *dest, int max) {
  int i = 0;
  while (source[i] != '\0' && i < max - 1) {
    dest[i] = (int32_t)source[i];
    i++;
  }
  dest[i] = 0;
}

// Assembly:
movb (%rdi), %al
testb %al, %al
sete %cl
cmpl $0x2, %edx
setl %r8b
orb %cl, %r8b
jne 0x36b1
decl %edx
movslq %edx, %rdx
xorl %ecx, %ecx
movsbl %al, %eax
movl %eax, (%rsi,%rcx,4)
movb 0x1(%rdi,%rcx), %al
incq %rcx
testb %al, %al
je 0x36b3
cmpq %rdx, %rcx
jl 0x3699
jmp 0x36b3
xorl %ecx, %ecx
movl $0x0, (%rsi,%rcx,4)
retq
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/./utf32.c
// Function: utf32_to_c
void utf32_to_c(const int32_t *source, char *dest, int max) {
  int i = 0;
  while (source[i] != 0 && i < max - 1) {
    if (source[i] <= 0x7F) {
      dest[i] = (char)source[i];
    } else {
      dest[i] = '?';
    }
    i++;
  }
  dest[i] = '\0';
}

// Assembly:
movl (%rdi), %eax
testl %eax, %eax
sete %cl
cmpl $0x2, %edx
setl %r8b
orb %cl, %r8b
jne 0x36f9
decl %edx
movslq %edx, %rdx
xorl %ecx, %ecx
movl $0x3f, %r8d
cmpl $0x80, %eax
cmovgel %r8d, %eax
movb %al, (%rsi,%rcx)
movl 0x4(%rdi,%rcx,4), %eax
incq %rcx
testl %eax, %eax
je 0x36fb
cmpq %rdx, %rcx
jl 0x36db
jmp 0x36fb
xorl %ecx, %ecx
movb $0x0, (%rsi,%rcx)
retq
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/./dev-error.c
// Function: handle_error
V handle_error(NgaState *vm, CELL error) {
  CELL saved_ip = vm->cpu[vm->active].ip;
  if (vm->ErrorHandlers[error] != 0) {
    printf("\nHandling %lld\n", (long long)error);
    execute(vm, vm->ErrorHandlers[error]);
  }
  vm->cpu[vm->active].ip = saved_ip;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x200004(%rdi), %r15
movslq 0x2043a4(%rdi), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
movl 0x20000c(%rdi,%rax), %ebp
movslq %esi, %r14
cmpl $0x0, 0x2079c4(%rdi,%r14,4)
je 0x3843
leaq 0x783f(%rip), %rdi      # 0xb068
movq %r14, %rsi
xorl %eax, %eax
callq 0x3150
movl 0x2079c4(%rbx,%r14,4), %esi
movq %rbx, %rdi
callq 0x3a2d
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
movl %ebp, 0x8(%r15,%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/./dev-ioctl.c
// Function: ioctl_get_terminal_size
void ioctl_get_terminal_size(NgaState *vm) {
  struct winsize size;
  ioctl(STDOUT_FILENO, TIOCGWINSZ, &size);
  stack_push(vm, size.ws_row);
  stack_push(vm, size.ws_col);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq %rsp, %r14
movl $0x5413, %esi           # imm = 0x5413
movl $0x1, %edi
movq %r14, %rdx
xorl %eax, %eax
callq 0x31b0
movzwl (%r14), %eax
movslq 0x2043a4(%rbx), %rcx
imulq $0x874, %rcx, %rcx      # imm = 0x874
addq %rbx, %rcx
addq $0x200004, %rcx         # imm = 0x200004
movslq (%rcx), %rdx
leaq 0x1(%rdx), %rsi
movl %esi, (%rcx)
movl %eax, 0x18(%rcx,%rdx,4)
movzwl 0x2(%r14), %eax
movslq 0x2043a4(%rbx), %rcx
imulq $0x874, %rcx, %rcx      # imm = 0x874
addq %rbx, %rcx
addq $0x200004, %rcx         # imm = 0x200004
movslq (%rcx), %rdx
leaq 0x1(%rdx), %rsi
movl %esi, (%rcx)
movl %eax, 0x18(%rcx,%rdx,4)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/./dev-ioctl.c
// Function: ioctl_set_character_breaking_mode
void ioctl_set_character_breaking_mode(NgaState *vm) {
  struct termios term;
  tcgetattr(STDIN_FILENO, &term);
  term.c_lflag &=(~ICANON & ECHO);
  tcsetattr(STDIN_FILENO, TCSANOW, &term);
}

// Assembly:
pushq %rbx
subq $0x40, %rsp
leaq 0x4(%rsp), %rbx
xorl %edi, %edi
movq %rbx, %rsi
callq 0x3320
andl $0x8, 0xc(%rbx)
xorl %edi, %edi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x3330
addq $0x40, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/./dev-ioctl.c
// Function: ioctl_set_line_buffered_mode
void ioctl_set_line_buffered_mode(NgaState *vm) {
  struct termios term;
  tcgetattr(STDIN_FILENO, &term);
  term.c_lflag |= ICANON;
  term.c_lflag |= ECHO;
  tcsetattr(STDIN_FILENO, TCSANOW, &term);
}

// Assembly:
pushq %rbx
subq $0x40, %rsp
leaq 0x4(%rsp), %rbx
xorl %edi, %edi
movq %rbx, %rsi
callq 0x3320
orb $0xa, 0xc(%rbx)
xorl %edi, %edi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x3330
addq $0x40, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/./dev-blocks.c
// Function: read_block
V read_block(NgaState *vm) {
  CELL buffer = stack_pop(vm);
  CELL block = stack_pop(vm);
  int32_t m[1024];
  int fp = open(vm->BlockFile, O_RDONLY, 0666);
  lseek(fp, 4096 * block, SEEK_SET);
  read(fp, m, 4096);
  for (int i = 0; i < 1024; i++) {
    vm->memory[buffer + i] = (CELL)m[i];
  }
  close(fp);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x1008, %rsp           # imm = 0x1008
movq %rdi, %rbx
movslq 0x2043a4(%rdi), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
leaq (%rdi,%rax), %rcx
movslq 0x200004(%rdi,%rax), %rdx
leaq -0x1(%rdx), %rsi
movl %esi, 0x200004(%rdi,%rax)
movslq 0x200018(%rcx,%rdx,4), %r15
leal -0x2(%rdx), %esi
movl %esi, 0x200004(%rdi,%rax)
movslq 0x200014(%rcx,%rdx,4), %r14
addq $0x2075c0, %rdi         # imm = 0x2075C0
xorl %esi, %esi
movl $0x1b6, %edx            # imm = 0x1B6
xorl %eax, %eax
callq 0x3340
movl %eax, %ebp
shlq $0xc, %r14
movl %eax, %edi
movq %r14, %rsi
xorl %edx, %edx
callq 0x3190
movq %rsp, %r14
movl $0x1000, %edx           # imm = 0x1000
movl %ebp, %edi
movq %r14, %rsi
callq 0x3220
leaq (%rbx,%r15,4), %rdi
movl $0x1000, %edx           # imm = 0x1000
movq %r14, %rsi
callq 0x32a0
movl %ebp, %edi
addq $0x1008, %rsp           # imm = 0x1008
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x31d0
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/./dev-blocks.c
// Function: write_block
V write_block(NgaState *vm) {
  CELL buffer = stack_pop(vm);
  CELL block = stack_pop(vm);
  int32_t m[1024];
  int fp = open(vm->BlockFile, O_WRONLY, 0666);
  lseek(fp, 4096 * block, SEEK_SET);
  for (int i = 0; i < 1024; i++) {
    m[i] = (int32_t)vm->memory[buffer + i];
  }
  write(fp, m, 4096);
  close(fp);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x1008, %rsp           # imm = 0x1008
movq %rdi, %rbx
movslq 0x2043a4(%rdi), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
leaq (%rdi,%rax), %rcx
movslq 0x200004(%rdi,%rax), %rdx
leaq -0x1(%rdx), %rsi
movl %esi, 0x200004(%rdi,%rax)
movslq 0x200018(%rcx,%rdx,4), %r15
leal -0x2(%rdx), %esi
movl %esi, 0x200004(%rdi,%rax)
movslq 0x200014(%rcx,%rdx,4), %r14
addq $0x2075c0, %rdi         # imm = 0x2075C0
movl $0x1, %esi
movl $0x1b6, %edx            # imm = 0x1B6
xorl %eax, %eax
callq 0x3340
movl %eax, %ebp
shlq $0xc, %r14
movl %eax, %edi
movq %r14, %rsi
xorl %edx, %edx
callq 0x3190
leaq (%rbx,%r15,4), %rsi
movq %rsp, %rbx
movl $0x1000, %edx           # imm = 0x1000
movq %rbx, %rdi
callq 0x32a0
movl $0x1000, %edx           # imm = 0x1000
movl %ebp, %edi
movq %rbx, %rsi
callq 0x30d0
movl %ebp, %edi
addq $0x1008, %rsp           # imm = 0x1008
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x31d0
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/retro.c
// Function: string_extract
char *string_extract(NgaState *vm, CELL at) {
  CELL starting = at, i = 0;
  while (vm->memory[starting] && i < 8192)
    vm->string_data[i++] = (char)vm->memory[starting++];
  vm->string_data[i] = 0;
  return (char *)vm->string_data;
}

// Assembly:
movq %rdi, %rax
movslq %esi, %rdx
movl (%rdi,%rdx,4), %ecx
testl %ecx, %ecx
je 0x3ec1
leaq (%rax,%rdx,4), %rdx
addq $0x4, %rdx
xorl %edi, %edi
leaq 0x1(%rdi), %rsi
movb %cl, 0x2045b8(%rax,%rdi)
movl (%rdx,%rdi,4), %ecx
testl %ecx, %ecx
je 0x3ec3
cmpq $0x1fff, %rdi           # imm = 0x1FFF
movq %rsi, %rdi
jb 0x3ea1
jmp 0x3ec3
xorl %esi, %esi
movb $0x0, 0x2045b8(%rax,%rsi)
addq $0x2045b8, %rax         # imm = 0x2045B8
retq
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/./dev-files.c
// Function: file_open
V file_open(NgaState *vm) {
  CELL slot = files_get_handle(vm);
  CELL mode = stack_pop(vm);
  CELL name = stack_pop(vm);
  char *modes[] = {"rb", "w", "a", "rb+"};
  char *request = string_extract(vm, name);
  if (slot > 0) {
    vm->OpenFileHandles[slot] = fopen(request, modes[mode]);
  }
  if (vm->OpenFileHandles[slot] == NULL) {
    vm->OpenFileHandles[slot] = 0;
    slot = 0;
  }
  stack_push(vm, slot);
//  FILE *file = (slot > 0) ? fopen(request, modes[mode]) : NULL;
//  vm->OpenFileHandles[slot] = (file != NULL) ? file : 0;
//  stack_push(vm, slot);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
cmpq $0x0, 0x288ef8(%rbx,%r14,8)
je 0x3fa8
incq %r14
cmpq $0x1f, %r14
jne 0x3f8f
xorl %r14d, %r14d
jmp 0x3fab
incl %r14d
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
leaq (%rbx,%rax), %rcx
addq $0x200004, %rcx         # imm = 0x200004
movslq (%rcx), %rdx
leaq -0x1(%rdx), %rax
movl %eax, (%rcx)
movslq 0x14(%rcx,%rdx,4), %rax
leal -0x2(%rdx), %esi
movl %esi, (%rcx)
movslq 0x10(%rcx,%rdx,4), %rcx
movl (%rbx,%rcx,4), %edx
testl %edx, %edx
je 0x400d
leaq (%rbx,%rcx,4), %rcx
addq $0x4, %rcx
xorl %edi, %edi
leaq 0x1(%rdi), %rsi
movb %dl, 0x2045b8(%rbx,%rdi)
cmpq $0x1ffe, %rdi           # imm = 0x1FFE
ja 0x400f
movl (%rcx,%rdi,4), %edx
movq %rsi, %rdi
testl %edx, %edx
jne 0x3fed
jmp 0x400f
xorl %esi, %esi
movb $0x0, 0x2045b8(%rbx,%rsi)
testl %r14d, %r14d
jle 0x4041
leaq 0x2045b8(%rbx), %rdi
leaq 0x700a(%rip), %rcx      # 0xb034
movslq (%rcx,%rax,4), %rsi
addq %rcx, %rsi
callq 0x3360
movl %r14d, %ecx
movq %rax, 0x288ef0(%rbx,%rcx,8)
leaq 0x200004(%rbx), %rax
movslq %r14d, %rcx
cmpq $0x0, 0x288ef0(%rbx,%rcx,8)
jne 0x4065
movq $0x0, 0x288ef0(%rbx,%rcx,8)
xorl %r14d, %r14d
movslq 0x2043a4(%rbx), %rcx
imulq $0x874, %rcx, %rcx      # imm = 0x874
leaq (%rax,%rcx), %rdx
movslq (%rax,%rcx), %rsi
leaq 0x1(%rsi), %rdi
movl %edi, (%rax,%rcx)
movl %r14d, 0x18(%rdx,%rsi,4)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/./dev-files.c
// Function: file_read
V file_read(NgaState *vm) {
  CELL slot = stack_pop(vm);
  FILE *file = vm->OpenFileHandles[slot];
  if (slot <= 0 || slot > MAX_OPEN_FILES || file == 0) {
    printf("\nERROR (nga/file_read): Invalid file handle\n");
    exit(1);
  }
  stack_push(vm, feof(file) ? 0 : fgetc(file));
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movslq 0x2043a4(%rdi), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
addq %rdi, %rax
addq $0x200004, %rax         # imm = 0x200004
movslq (%rax), %rcx
leal -0x1(%rcx), %edx
movl %edx, (%rax)
movslq 0x14(%rax,%rcx,4), %rax
leal -0x21(%rax), %ecx
cmpl $-0x20, %ecx
jb 0x4117
movq %rdi, %rbx
movq 0x288ef0(%rdi,%rax,8), %r14
testq %r14, %r14
je 0x4117
leaq 0x200004(%rbx), %r15
movq %r14, %rdi
callq 0x3290
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
jne 0x40ef
movq %r14, %rdi
callq 0x31c0
movslq 0x2043a4(%rbx), %rcx
imulq $0x874, %rcx, %rcx      # imm = 0x874
leaq (%r15,%rcx), %rdx
movslq (%r15,%rcx), %rsi
leaq 0x1(%rsi), %rdi
movl %edi, (%r15,%rcx)
movl %eax, 0x18(%rdx,%rsi,4)
popq %rbx
popq %r14
popq %r15
retq
leaq 0x72dc(%rip), %rdi      # 0xb3fa
callq 0x30a0
movl $0x1, %edi
callq 0x33d0
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/./dev-files.c
// Function: file_close
V file_close(NgaState *vm) {
  CELL slot = stack_pop(vm);
  FILE *file = vm->OpenFileHandles[slot];
  if (slot <= 0 || slot > MAX_OPEN_FILES || file == 0) {
    printf("\nERROR (nga/file_close): Invalid file handle\n");
    exit(1);
  }
  fclose(file);
  vm->OpenFileHandles[slot] = 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movslq 0x2043a4(%rdi), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
leaq (%rdi,%rax), %rcx
movslq 0x200004(%rdi,%rax), %rdx
leal -0x1(%rdx), %esi
movl %esi, 0x200004(%rdi,%rax)
movslq 0x200018(%rcx,%rdx,4), %r14
leal -0x21(%r14), %eax
cmpl $-0x20, %eax
jb 0x41ff
movq %rdi, %rbx
movq 0x288ef0(%rdi,%r14,8), %rdi
testq %rdi, %rdi
je 0x41ff
callq 0x3110
movq $0x0, 0x288ef0(%rbx,%r14,8)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x70d5(%rip), %rdi      # 0xb2db
callq 0x30a0
movl $0x1, %edi
callq 0x33d0
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/./dev-files.c
// Function: file_get_position
V file_get_position(NgaState *vm) {
  CELL slot = stack_pop(vm);
  if (slot <= 0 || slot > MAX_OPEN_FILES || vm->OpenFileHandles[slot] == 0) {
    printf("\nERROR (nga/file_get_position): Invalid file handle\n");
    exit(1);
  }
  stack_push(vm, (CELL) ftell(vm->OpenFileHandles[slot]));
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movslq 0x2043a4(%rdi), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
addq %rdi, %rax
addq $0x200004, %rax         # imm = 0x200004
movslq (%rax), %rcx
leal -0x1(%rcx), %edx
movl %edx, (%rax)
movl 0x14(%rax,%rcx,4), %eax
leal -0x21(%rax), %ecx
cmpl $-0x20, %ecx
jb 0x428a
movq %rdi, %rbx
movq 0x288ef0(%rdi,%rax,8), %rdi
testq %rdi, %rdi
je 0x428a
leaq 0x200004(%rbx), %r14
callq 0x3280
movslq 0x2043a4(%rbx), %rcx
imulq $0x874, %rcx, %rcx      # imm = 0x874
leaq (%r14,%rcx), %rdx
movslq (%r14,%rcx), %rsi
leaq 0x1(%rsi), %rdi
movl %edi, (%r14,%rcx)
movl %eax, 0x18(%rdx,%rsi,4)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x7077(%rip), %rdi      # 0xb308
callq 0x30a0
movl $0x1, %edi
callq 0x33d0
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/./dev-files.c
// Function: file_get_size
V file_get_size(NgaState *vm) {
  CELL slot, current, r, size;
  struct stat buffer;
  slot = stack_pop(vm);
  if (slot <= 0 || slot > MAX_OPEN_FILES || vm->OpenFileHandles[slot] == 0) {
    printf("\nERROR (nga/file_get_size): Invalid file handle\n");
    exit(1);
  }
  fstat(fileno(vm->OpenFileHandles[slot]), &buffer);
  if (!S_ISDIR(buffer.st_mode)) {
    current = ftell(vm->OpenFileHandles[slot]);
    r = fseek(vm->OpenFileHandles[slot], 0, SEEK_END);
    size = ftell(vm->OpenFileHandles[slot]);
    fseek(vm->OpenFileHandles[slot], current, SEEK_SET);
  } else {
    r = -1;
    size = 0;
  }
  stack_push(vm, (r == 0) ? size : 0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movslq 0x2043a4(%rdi), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
addq %rdi, %rax
addq $0x200004, %rax         # imm = 0x200004
movslq (%rax), %rcx
leal -0x1(%rcx), %edx
movl %edx, (%rax)
movl 0x14(%rax,%rcx,4), %r13d
leal -0x21(%r13), %eax
cmpl $-0x20, %eax
jb 0x441f
movq %rdi, %rbx
movq 0x288ef0(%rdi,%r13,8), %rdi
testq %rdi, %rdi
je 0x441f
leaq 0x200004(%rbx), %r12
callq 0x32d0
leaq 0x8(%rsp), %r14
movl %eax, %edi
movq %r14, %rsi
callq 0x3430
movl $0xf000, %eax           # imm = 0xF000
andl 0x18(%r14), %eax
xorl %r14d, %r14d
cmpl $0x4000, %eax           # imm = 0x4000
je 0x43ea
movq 0x288ef0(%rbx,%r13,8), %rdi
callq 0x3280
movq %rax, %r15
movq 0x288ef0(%rbx,%r13,8), %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x3310
movl %eax, %ebp
movq 0x288ef0(%rbx,%r13,8), %rdi
callq 0x3280
movq %rax, %r14
movq 0x288ef0(%rbx,%r13,8), %rdi
movslq %r15d, %rsi
xorl %edx, %edx
callq 0x3310
testl %ebp, %ebp
movl $0x0, %eax
cmovnel %eax, %r14d
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
leaq (%r12,%rax), %rcx
movslq (%r12,%rax), %rdx
leaq 0x1(%rdx), %rsi
movl %esi, (%r12,%rax)
movl %r14d, 0x18(%rcx,%rdx,4)
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x6f4a(%rip), %rdi      # 0xb370
callq 0x30a0
movl $0x1, %edi
callq 0x33d0
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/./dev-files.c
// Function: file_read_bytes
V file_read_bytes(NgaState *vm) {
  CELL slot = stack_pop(vm);
  CELL size = stack_pop(vm);
  CELL dest = stack_pop(vm);
  CELL z = fread((char *)file_bytes, 1, size, vm->OpenFileHandles[slot]);
  for (CELL i = 0; i < size; i++) {
    CELL x = file_bytes[i];
    vm->memory[dest + i] = x;
  }
  stack_push(vm, z);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
leaq 0x200004(%rdi), %r12
movslq 0x2043a4(%rdi), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
addq %rdi, %rax
addq $0x200004, %rax         # imm = 0x200004
movslq (%rax), %rcx
leaq -0x1(%rcx), %rdx
movl %edx, (%rax)
movslq 0x14(%rax,%rcx,4), %rdx
leaq -0x2(%rcx), %rsi
movl %esi, (%rax)
movslq 0x10(%rax,%rcx,4), %r14
leal -0x3(%rcx), %esi
movl %esi, (%rax)
movslq 0xc(%rax,%rcx,4), %r13
movq 0x288ef0(%rdi,%rdx,8), %rcx
leaq 0x51d31(%rip), %r15     # 0x56290
movl $0x1, %esi
movq %r15, %rdi
movq %r14, %rdx
callq 0x30b0
testq %r14, %r14
jle 0x458a
leaq (%rbx,%r13,4), %rcx
xorl %edx, %edx
movsbl (%rdx,%r15), %esi
movl %esi, (%rcx,%rdx,4)
incq %rdx
cmpq %rdx, %r14
jne 0x457a
movslq 0x2043a4(%rbx), %rcx
imulq $0x874, %rcx, %rcx      # imm = 0x874
leaq (%r12,%rcx), %rdx
movslq (%r12,%rcx), %rsi
leaq 0x1(%rsi), %rdi
movl %edi, (%r12,%rcx)
movl %eax, 0x18(%rdx,%rsi,4)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/./dev-files.c
// Function: file_write_bytes
V file_write_bytes(NgaState *vm) {
  CELL slot = stack_pop(vm);
  CELL size = stack_pop(vm);
  CELL src  = stack_pop(vm);
  for (CELL i = 0; i < size; i++) {
    char x = vm->memory[src + i];
    file_bytes[i] = x;
  }
  CELL z = fwrite(&file_bytes, 1, size, vm->OpenFileHandles[slot]);
  stack_push(vm, z);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x200004(%rdi), %r14
movslq 0x2043a4(%rdi), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
leaq (%rdi,%rax), %rcx
addq $0x200004, %rcx         # imm = 0x200004
movslq (%rcx), %rsi
leaq -0x1(%rsi), %rax
movl %eax, (%rcx)
movslq 0x14(%rcx,%rsi,4), %rax
leal -0x2(%rsi), %edx
movl %edx, (%rcx)
movslq 0x10(%rcx,%rsi,4), %rdx
leal -0x3(%rsi), %edi
movl %edi, (%rcx)
testq %rdx, %rdx
jle 0x4621
movslq 0xc(%rcx,%rsi,4), %rcx
leaq (%rbx,%rcx,4), %rcx
xorl %esi, %esi
leaq 0x51c7f(%rip), %rdi     # 0x56290
movb (%rcx,%rsi,4), %r8b
movb %r8b, (%rsi,%rdi)
incq %rsi
cmpq %rsi, %rdx
jne 0x4611
movq 0x288ef0(%rbx,%rax,8), %rcx
leaq 0x51c60(%rip), %rdi     # 0x56290
movl $0x1, %esi
callq 0x33e0
movslq 0x2043a4(%rbx), %rcx
imulq $0x874, %rcx, %rcx      # imm = 0x874
leaq (%r14,%rcx), %rdx
movslq (%r14,%rcx), %rsi
leaq 0x1(%rsi), %rdi
movl %edi, (%r14,%rcx)
movl %eax, 0x18(%rdx,%rsi,4)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/./dev-files.c
// Function: file_read_character
V file_read_character(NgaState *vm) {
  CELL c;
  CELL slot = stack_pop(vm);
  if (slot <= 0 || slot > MAX_OPEN_FILES || vm->OpenFileHandles[slot] == 0) {
    printf("\nERROR (nga/file_read): Invalid file handle\n");
    exit(1);
  }
  c = fread_character(vm->OpenFileHandles[slot]);
  stack_push(vm, feof(vm->OpenFileHandles[slot]) ? 0 : c);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movslq 0x2043a4(%rdi), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
addq %rdi, %rax
addq $0x200004, %rax         # imm = 0x200004
movslq (%rax), %rcx
leal -0x1(%rcx), %edx
movl %edx, (%rax)
movl 0x14(%rax,%rcx,4), %r14d
leal -0x21(%r14), %eax
cmpl $-0x20, %eax
jb 0x46f7
movq %rdi, %rbx
movq 0x288ef0(%rdi,%r14,8), %rdi
testq %rdi, %rdi
je 0x46f7
leaq 0x200004(%rbx), %r15
callq 0x470d
movl %eax, %ebp
movq 0x288ef0(%rbx,%r14,8), %rdi
callq 0x3290
xorl %ecx, %ecx
testl %eax, %eax
cmovel %ebp, %ecx
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
leaq (%r15,%rax), %rdx
movslq (%r15,%rax), %rsi
leaq 0x1(%rsi), %rdi
movl %edi, (%r15,%rax)
movl %ecx, 0x18(%rdx,%rsi,4)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x6cfc(%rip), %rdi      # 0xb3fa
callq 0x30a0
movl $0x1, %edi
callq 0x33d0
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/./dev-files.c
// Function: file_write_character
V file_write_character(NgaState *vm) {
  unsigned char utf8_bytes[4];
  int num_bytes;
  CELL slot, c, r;
  utf32_to_utf8(stack_pop(vm), utf8_bytes, &num_bytes);
  slot = stack_pop(vm);
  if (slot <= 0 || slot > MAX_OPEN_FILES || vm->OpenFileHandles[slot] == 0) {
    printf("\nERROR (nga/file_write): Invalid file handle\n");
    exit(1);
  }
  r = fwrite(&utf8_bytes, num_bytes, 1, vm->OpenFileHandles[slot]);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movslq 0x2043a4(%rdi), %rax
imulq $0x874, %rax, %r14      # imm = 0x874
leaq (%rdi,%r14), %r15
movslq 0x200004(%rdi,%r14), %r12
leaq -0x1(%r12), %rax
movl %eax, 0x200004(%rdi,%r14)
movl 0x200018(%r15,%r12,4), %edi
leaq 0x4(%rsp), %rsi
movq %rsp, %rdx
callq 0x48fe
leal -0x2(%r12), %eax
movl %eax, 0x200004(%rbx,%r14)
movl 0x200014(%r15,%r12,4), %eax
leal -0x21(%rax), %ecx
cmpl $-0x20, %ecx
jb 0x48e8
movq 0x288ef0(%rbx,%rax,8), %rcx
testq %rcx, %rcx
je 0x48e8
movslq (%rsp), %rsi
leaq 0x4(%rsp), %rdi
movl $0x1, %edx
callq 0x33e0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x6ade(%rip), %rdi      # 0xb3cd
callq 0x30a0
movl $0x1, %edi
callq 0x33d0
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/./dev-files.c
// Function: file_read_line
V file_read_line(NgaState *vm) {
  CELL slot = stack_pop(vm);
  CELL targ = stack_pop(vm);
  CELL c;
  if (slot <= 0 || slot > MAX_OPEN_FILES || vm->OpenFileHandles[slot] == 0) {
    printf("\nERROR (nga/file_read): Invalid file handle\n");
    exit(1);
  }
  c = fread_character(vm->OpenFileHandles[slot]);
  vm->memory[targ] = c;
  targ++;
  while (c != 10 && c != 13 && c != 0) {
    c = fread_character(vm->OpenFileHandles[slot]);
    vm->memory[targ] = c;
    targ++;
  }
  vm->memory[targ - 1] = 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movslq 0x2043a4(%rdi), %rax
imulq $0x874, %rax, %rdx      # imm = 0x874
leaq (%rdi,%rdx), %rax
movslq 0x200004(%rdi,%rdx), %rcx
leaq -0x1(%rcx), %rsi
movl %esi, 0x200004(%rdi,%rdx)
movl 0x200018(%rax,%rcx,4), %r14d
leal -0x2(%rcx), %esi
movl %esi, 0x200004(%rdi,%rdx)
leal -0x21(%r14), %edx
cmpl $-0x20, %edx
jb 0x4a6a
movq %rdi, %rbx
movq 0x288ef0(%rdi,%r14,8), %rdi
testq %rdi, %rdi
je 0x4a6a
movslq 0x200014(%rax,%rcx,4), %r15
callq 0x470d
leaq (%rbx,%r15,4), %r12
addq $0x4, %r12
movl %eax, -0x4(%r12)
shlq $0x20, %r15
movabsq $0x100000000, %r13      # imm = 0x100000000
movl $0x2401, %ebp           # imm = 0x2401
cmpl $0xd, %eax
ja 0x4a35
btl %eax, %ebp
jb 0x4a4f
movq 0x288ef0(%rbx,%r14,8), %rdi
callq 0x470d
movl %eax, (%r12)
addq %r13, %r15
addq $0x4, %r12
jmp 0x4a2b
sarq $0x1e, %r15
movl $0x0, (%rbx,%r15)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x6989(%rip), %rdi      # 0xb3fa
callq 0x30a0
movl $0x1, %edi
callq 0x33d0
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/./dev-multicore.c
// Function: init_core
void init_core(NgaState *vm, CELL x) {
  int y;
  vm->cpu[x].sp = 0;
  vm->cpu[x].rp = 0;
  vm->cpu[x].ip = 0;
  vm->cpu[x].active = 0;
  vm->cpu[x].u = 0;
  for (y = 0; y < STACK_DEPTH; y++) { vm->cpu[x].data[y] = 0; };
  for (y = 0; y < ADDRESSES; y++) { vm->cpu[x].address[y] = 0; };
  for (y = 0; y < 24; y++) { vm->cpu[x].registers[y] = 0; };
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movslq %esi, %rax
imulq $0x874, %rax, %r14      # imm = 0x874
addq %r14, %rdi
addq $0x200004, %rdi         # imm = 0x200004
movl $0x414, %edx            # imm = 0x414
xorl %esi, %esi
callq 0x31a0
addq %r14, %rbx
addq $0x200418, %rbx         # imm = 0x200418
movl $0x400, %edx            # imm = 0x400
movq %rbx, %rdi
xorl %esi, %esi
callq 0x31a0
xorps %xmm0, %xmm0
movups %xmm0, 0x400(%rbx)
movups %xmm0, 0x410(%rbx)
movups %xmm0, 0x420(%rbx)
movups %xmm0, 0x430(%rbx)
movups %xmm0, 0x440(%rbx)
movups %xmm0, 0x450(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/./dev-float.c
// Function: float_guard
void float_guard(NgaState *vm) {
  if (vm->fsp < 0 || vm->fsp > 255) {
    printf("\nERROR (nga/float_guard): Float Stack Limits Exceeded!\n");
    printf("At %lld, fsp = %lld\n", (long long)vm->cpu[vm->active].ip, (long long)vm->fsp);
    exit(1);
  }
  if (vm->afsp < 0 || vm->afsp > 255) {
    printf("\nERROR (nga/float_guard): Alternate Float Stack Limits Exceeded!\n");
    printf("At %lld, afsp = %lld\n", (long long)vm->cpu[vm->active].ip, (long long)vm->afsp);
    exit(1);
  }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
cmpl $0x100, 0x2075b8(%rdi)  # imm = 0x100
jae 0x4d8e
cmpl $0x100, 0x2075bc(%rbx)  # imm = 0x100
jae 0x4dc0
popq %rbx
retq
leaq 0x66d2(%rip), %rdi      # 0xb467
callq 0x30a0
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
movslq 0x20000c(%rbx,%rax), %rsi
movslq 0x2075b8(%rbx), %rdx
leaq 0x62dc(%rip), %rdi      # 0xb09a
jmp 0x4df0
leaq 0x665f(%rip), %rdi      # 0xb426
callq 0x30a0
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
movslq 0x20000c(%rbx,%rax), %rsi
movslq 0x2075bc(%rbx), %rdx
leaq 0x62bf(%rip), %rdi      # 0xb0af
xorl %eax, %eax
callq 0x3150
movl $0x1, %edi
callq 0x33d0
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/retro.c
// Function: string_inject
CELL string_inject(NgaState *vm, char *str, CELL buffer) {
  if (!str) {
    vm->memory[buffer] = 0;
    return 0;
  }

  CELL pos = 0;
  int i = 0;

  while (str[i] != '\0') {
    unsigned char *utf8_str = (unsigned char *)&str[i];
    int utf32_char = 0;
    int bytes_consumed = 0;

    // Convert UTF-8 to UTF-32
    if ((utf8_str[0] & 0x80) == 0x00) {
      // 1-byte UTF-8 sequence
      utf32_char = utf8_str[0];
      bytes_consumed = 1;
    } else if ((utf8_str[0] & 0xE0) == 0xC0) {
      // 2-byte UTF-8 sequence
      utf32_char = ((uint32_t)(utf8_str[0] & 0x1F) << 6) |
                              (utf8_str[1] & 0x3F);
      bytes_consumed = 2;
    } else if ((utf8_str[0] & 0xF0) == 0xE0) {
      // 3-byte UTF-8 sequence
      utf32_char = ((uint32_t)(utf8_str[0] & 0x0F) << 12) |
                   ((uint32_t)(utf8_str[1] & 0x3F) << 6) |
                              (utf8_str[2] & 0x3F);
      bytes_consumed = 3;
    } else if ((utf8_str[0] & 0xF8) == 0xF0) {
      // 4-byte UTF-8 sequence
      utf32_char = ((uint32_t)(utf8_str[0] & 0x07) << 18) |
                   ((uint32_t)(utf8_str[1] & 0x3F) << 12) |
                   ((uint32_t)(utf8_str[2] & 0x3F) << 6) |
                              (utf8_str[3] & 0x3F);
      bytes_consumed = 4;
    } else {
      // Invalid UTF-8, skip byte
      utf32_char = utf8_str[0];
      bytes_consumed = 1;
    }

    vm->memory[buffer + pos] = (CELL)utf32_char;
    vm->memory[buffer + pos + 1] = 0;
    pos++;
    i += bytes_consumed;
  }

  return buffer;
}

// Assembly:
movl %edx, %eax
testq %rsi, %rsi
je 0x5182
movb (%rsi), %r8b
testb %r8b, %r8b
je 0x5181
movslq %eax, %rcx
leaq (%rdi,%rcx,4), %rcx
addq $0x4, %rcx
xorl %edx, %edx
movq %rsi, %rdi
movzbl %r8b, %r8d
movl $0x1, %r9d
testb %r8b, %r8b
jns 0x515a
movl %r8d, %r10d
andl $-0x20, %r10d
cmpl $0xc0, %r10d
jne 0x50d4
andl $0x1f, %r8d
shll $0x6, %r8d
movl $0x2, %r9d
movl $0x1, %r11d
movl %r8d, %r10d
jmp 0x514e
movl %r8d, %r10d
andl $-0x10, %r10d
cmpl $0xe0, %r10d
jne 0x510a
shll $0xc, %r8d
movzwl %r8w, %r8d
movzbl 0x1(%rdi), %r10d
andl $0x3f, %r10d
shll $0x6, %r10d
orl %r8d, %r10d
movl $0x3, %r9d
movl $0x2, %r11d
jmp 0x514e
movl %r8d, %r10d
andl $-0x8, %r10d
cmpl $0xf0, %r10d
jne 0x515a
andl $0x7, %r8d
shll $0x12, %r8d
movzbl 0x1(%rdi), %r9d
andl $0x3f, %r9d
shll $0xc, %r9d
orl %r8d, %r9d
movzbl 0x2(%rdi), %r10d
andl $0x3f, %r10d
shll $0x6, %r10d
orl %r9d, %r10d
movl $0x4, %r9d
movl $0x3, %r11d
movzbl (%rdi,%r11), %r8d
andl $0x3f, %r8d
orl %r10d, %r8d
movl %r8d, -0x4(%rcx)
movl $0x0, (%rcx)
movl %r9d, %edi
movl %edx, %edx
addq %rdi, %rdx
leaq (%rsi,%rdx), %rdi
movb (%rsi,%rdx), %r8b
addq $0x4, %rcx
testb %r8b, %r8b
jne 0x5098
retq
cltq
movl $0x0, (%rdi,%rax,4)
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/./dev-float.c
// Function: float_to_number
void float_to_number(NgaState *vm) {
  double a = float_pop(vm);
  if (a > 2147483647)
    a = 2147483647;
  if (a < -2147483648)
    a = -2147483648;
  stack_push(vm, (CELL)round(a));
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
decl 0x2075b8(%rdi)
callq 0x4d70
movslq 0x2075b8(%rbx), %rax
movsd 0x5eac(%rip), %xmm1     # 0xb058
minsd 0x2065c0(%rbx,%rax,8), %xmm1
movsd 0x5ea3(%rip), %xmm0     # 0xb060
maxsd %xmm1, %xmm0
callq 0x3090
cvttsd2si %xmm0, %eax
movslq 0x2043a4(%rbx), %rcx
imulq $0x874, %rcx, %rcx      # imm = 0x874
leaq (%rbx,%rcx), %rdx
movslq 0x200004(%rbx,%rcx), %rsi
leaq 0x1(%rsi), %rdi
movl %edi, 0x200004(%rbx,%rcx)
movl %eax, 0x20001c(%rdx,%rsi,4)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/./dev-float.c
// Function: float_eq
void float_eq(NgaState *vm) {
  double a = float_pop(vm);
  double b = float_pop(vm);
  if (a == b)
    stack_push(vm, -1);
  else
    stack_push(vm, 0);
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
decl 0x2075b8(%rdi)
callq 0x4d70
movslq 0x2075b8(%rbx), %rax
movsd 0x2065c0(%rbx,%rax,8), %xmm0
movsd %xmm0, 0x8(%rsp)
decl %eax
movl %eax, 0x2075b8(%rbx)
movq %rbx, %rdi
callq 0x4d70
movslq 0x2075b8(%rbx), %rax
movsd 0x8(%rsp), %xmm0
cmpeqsd 0x2065c0(%rbx,%rax,8), %xmm0
movq %xmm0, %rax
movslq 0x2043a4(%rbx), %rcx
imulq $0x874, %rcx, %rcx      # imm = 0x874
leaq (%rbx,%rcx), %rdx
movslq 0x200004(%rbx,%rcx), %rsi
leaq 0x1(%rsi), %rdi
movl %edi, 0x200004(%rbx,%rcx)
movl %eax, 0x20001c(%rdx,%rsi,4)
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/./dev-float.c
// Function: float_lt
void float_lt(NgaState *vm) {
  double a = float_pop(vm);
  double b = float_pop(vm);
  if (b < a)
    stack_push(vm, -1);
  else
    stack_push(vm, 0);
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
decl 0x2075b8(%rdi)
callq 0x4d70
movslq 0x2075b8(%rbx), %rax
movsd 0x2065c0(%rbx,%rax,8), %xmm0
movsd %xmm0, 0x8(%rsp)
decl %eax
movl %eax, 0x2075b8(%rbx)
movq %rbx, %rdi
callq 0x4d70
movslq 0x2075b8(%rbx), %rax
xorl %ecx, %ecx
movsd 0x8(%rsp), %xmm0
ucomisd 0x2065c0(%rbx,%rax,8), %xmm0
seta %cl
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
leaq (%rbx,%rax), %rdx
movslq 0x200004(%rbx,%rax), %rsi
leaq 0x1(%rsi), %rdi
movl %edi, 0x200004(%rbx,%rax)
negl %ecx
movl %ecx, 0x20001c(%rdx,%rsi,4)
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/./dev-float.c
// Function: float_gt
void float_gt(NgaState *vm) {
  double a = float_pop(vm);
  double b = float_pop(vm);
  if (b > a)
    stack_push(vm, -1);
  else
    stack_push(vm, 0);
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
decl 0x2075b8(%rdi)
callq 0x4d70
movslq 0x2075b8(%rbx), %rax
movsd 0x2065c0(%rbx,%rax,8), %xmm0
movsd %xmm0, 0x8(%rsp)
decl %eax
movl %eax, 0x2075b8(%rbx)
movq %rbx, %rdi
callq 0x4d70
movslq 0x2075b8(%rbx), %rax
movsd 0x2065c0(%rbx,%rax,8), %xmm0
xorl %eax, %eax
ucomisd 0x8(%rsp), %xmm0
seta %al
movslq 0x2043a4(%rbx), %rcx
imulq $0x874, %rcx, %rcx      # imm = 0x874
leaq (%rbx,%rcx), %rdx
movslq 0x200004(%rbx,%rcx), %rsi
leaq 0x1(%rsi), %rdi
movl %edi, 0x200004(%rbx,%rcx)
negl %eax
movl %eax, 0x20001c(%rdx,%rsi,4)
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/./dev-float.c
// Function: float_swap
void float_swap(NgaState *vm) {
  double a = float_pop(vm);
  double b = float_pop(vm);
  float_push(vm, a);
  float_push(vm, b);
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
decl 0x2075b8(%rdi)
callq 0x4d70
movslq 0x2075b8(%rbx), %rax
movsd 0x2065c0(%rbx,%rax,8), %xmm0
movsd %xmm0, 0x8(%rsp)
decl %eax
movl %eax, 0x2075b8(%rbx)
movq %rbx, %rdi
callq 0x4d70
movslq 0x2075b8(%rbx), %rax
movsd 0x2065c0(%rbx,%rax,8), %xmm0
movsd %xmm0, (%rsp)
incq %rax
movl %eax, 0x2075b8(%rbx)
movq %rbx, %rdi
callq 0x4d70
movslq 0x2075b8(%rbx), %rax
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x2065b8(%rbx,%rax,8)
incl %eax
movl %eax, 0x2075b8(%rbx)
movq %rbx, %rdi
callq 0x4d70
movslq 0x2075b8(%rbx), %rax
movsd (%rsp), %xmm0
movsd %xmm0, 0x2065b8(%rbx,%rax,8)
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/./dev-rng.c
// Function: io_rng
V io_rng(NgaState *vm) {
  int64_t r = 0;
  char buffer[8];
  int i;
  ssize_t ignore;
  int fd = open("/dev/urandom", O_RDONLY);
  ignore = read(fd, buffer, 8);
  close(fd);
  for(i = 0; i < 8; ++i) {
    r = r << 8;
    r += ((int64_t)buffer[i] & 0xFF);
  }
#ifndef BIT64
  stack_push(vm, (CELL)abs((CELL)r));
#else
  stack_push(vm, (CELL)llabs((CELL)r));
#endif
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0x504b(%rip), %rdi      # 0xb0c8
xorl %r14d, %r14d
xorl %esi, %esi
xorl %eax, %eax
callq 0x3340
movl %eax, %ebp
leaq 0x8(%rsp), %rsi
movl $0x8, %edx
movl %eax, %edi
callq 0x3220
movl %ebp, %edi
callq 0x31d0
xorl %eax, %eax
movq %rax, %rcx
shlq $0x8, %rcx
movzbl 0x8(%rsp,%r14), %eax
orq %rcx, %rax
incq %r14
cmpq $0x8, %r14
jne 0x60a5
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
leaq (%rbx,%rax), %rdx
movslq 0x200004(%rbx,%rax), %rsi
leaq 0x1(%rsi), %rdi
movl %edi, 0x200004(%rbx,%rax)
movl %ecx, 0x20001c(%rdx,%rsi,4)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/./dev-unix.c
// Function: unix_open_pipe
V unix_open_pipe(NgaState *vm) {
  CELL slot, mode, name;
  char *request;
  const char *modes[] = {"r", "w", "", "r+"};
  slot = files_get_handle(vm);
  mode = stack_pop(vm);
  name = stack_pop(vm);
  request = string_extract(vm, name);
  if (slot > 0) {
    vm->OpenFileHandles[slot] = popen(request, modes[mode]);
  }
  if (vm->OpenFileHandles[slot] == NULL) {
    vm->OpenFileHandles[slot] = 0;
    slot = 0;
  }
  stack_push(vm, slot);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
cmpq $0x0, 0x288ef8(%rbx,%r14,8)
je 0x616e
incq %r14
cmpq $0x1f, %r14
jne 0x6155
xorl %r14d, %r14d
jmp 0x6171
incl %r14d
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
leaq (%rbx,%rax), %rcx
addq $0x200004, %rcx         # imm = 0x200004
movslq (%rcx), %rdx
leaq -0x1(%rdx), %rax
movl %eax, (%rcx)
movslq 0x14(%rcx,%rdx,4), %rax
leal -0x2(%rdx), %esi
movl %esi, (%rcx)
movslq 0x10(%rcx,%rdx,4), %rcx
movl (%rbx,%rcx,4), %edx
testl %edx, %edx
je 0x61d3
leaq (%rbx,%rcx,4), %rcx
addq $0x4, %rcx
xorl %edi, %edi
leaq 0x1(%rdi), %rsi
movb %dl, 0x2045b8(%rbx,%rdi)
cmpq $0x1ffe, %rdi           # imm = 0x1FFE
ja 0x61d5
movl (%rcx,%rdi,4), %edx
movq %rsi, %rdi
testl %edx, %edx
jne 0x61b3
jmp 0x61d5
xorl %esi, %esi
movb $0x0, 0x2045b8(%rbx,%rsi)
testl %r14d, %r14d
jle 0x6207
leaq 0x2045b8(%rbx), %rdi
leaq 0x4e54(%rip), %rcx      # 0xb044
movslq (%rcx,%rax,4), %rsi
addq %rcx, %rsi
callq 0x3350
movl %r14d, %ecx
movq %rax, 0x288ef0(%rbx,%rcx,8)
leaq 0x200004(%rbx), %rax
movslq %r14d, %rcx
cmpq $0x0, 0x288ef0(%rbx,%rcx,8)
jne 0x622b
movq $0x0, 0x288ef0(%rbx,%rcx,8)
xorl %r14d, %r14d
movslq 0x2043a4(%rbx), %rcx
imulq $0x874, %rcx, %rcx      # imm = 0x874
leaq (%rax,%rcx), %rdx
movslq (%rax,%rcx), %rsi
leaq 0x1(%rsi), %rdi
movl %edi, (%rax,%rcx)
movl %r14d, 0x18(%rdx,%rsi,4)
addq $0x8, %rsp
popq %rbx
popq %r14
retq