LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/./dev-unix.c
// Function: unix_run_external
V unix_run_external(NgaState *vm) {
  char *line, *args[128];
  int i, status;
  pid_t pid;

  char **argv = args;
  line = string_extract(vm, stack_pop(vm));

  for(i = 0; i < 128; i++)
    args[i] = 0;

  while (*line != '\0') {
    while (*line == ' ' || *line == '\t' || *line == '\n')
      *line++ = '\0';
    *argv++ = line;
    while (*line != '\0' && *line != ' ' && *line != '\t' && *line != '\n')
      line++;
  }

  if ((pid = fork()) < 0) {
    printf("*** ERROR: forking child process failed\n");
    exit(1);
  }
  else if (pid == 0) {
    int e = execvp(*args, args);
    if (e < 0) {
      printf("*** ERROR: exec failed with %d\n", e);
      exit(1);
    }
  } else {
  while (wait(&status) != pid)
    ;
  }
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x418, %rsp            # imm = 0x418
movq %rdi, %rbx
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), %rax
movl (%rdi,%rax,4), %ecx
testl %ecx, %ecx
je 0x63ca
leaq (%rbx,%rax,4), %rax
addq $0x4, %rax
xorl %esi, %esi
leaq 0x1(%rsi), %rdx
movb %cl, 0x2045b8(%rbx,%rsi)
cmpq $0x1ffe, %rsi           # imm = 0x1FFE
ja 0x63cc
movl (%rax,%rsi,4), %ecx
movq %rdx, %rsi
testl %ecx, %ecx
jne 0x63aa
jmp 0x63cc
xorl %edx, %edx
movb $0x0, 0x2045b8(%rbx,%rdx)
leaq 0x10(%rsp), %r14
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
xorl %esi, %esi
callq 0x31a0
cmpb $0x0, 0x2045b8(%rbx)
je 0x6443
addq $0x2045b8, %rbx         # imm = 0x2045B8
movabsq $0x100000601, %rax      # imm = 0x100000601
movabsq $0x100000600, %rcx      # imm = 0x100000600
movzbl (%rbx), %edx
cmpq $0x20, %rdx
ja 0x6423
btq %rdx, %rcx
jae 0x6423
movb $0x0, (%rbx)
incq %rbx
jmp 0x640c
movq %rbx, (%r14)
addq $0x8, %r14
movzbl (%rbx), %edx
cmpq $0x20, %rdx
ja 0x6439
btq %rdx, %rax
jb 0x643e
incq %rbx
jmp 0x642a
cmpb $0x0, (%rbx)
jne 0x640c
callq 0x3460
testl %eax, %eax
js 0x647f
je 0x6463
movl %eax, %ebx
leaq 0xc(%rsp), %r14
movq %r14, %rdi
callq 0x3440
cmpl %ebx, %eax
jne 0x6455
jmp 0x6474
leaq 0x10(%rsp), %rsi
movq (%rsi), %rdi
callq 0x33b0
testl %eax, %eax
js 0x648d
addq $0x418, %rsp            # imm = 0x418
popq %rbx
popq %r14
retq
leaq 0x5018(%rip), %rdi      # 0xb49e
callq 0x30a0
jmp 0x649d
leaq 0x4c44(%rip), %rdi      # 0xb0d8
movl %eax, %esi
xorl %eax, %eax
callq 0x3150
movl $0x1, %edi
callq 0x33d0
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/./dev-unix.c
// Function: unix_exec0
V unix_exec0(NgaState *vm) {
  char path[1025];
  strlcpy(path, string_extract(vm, stack_pop(vm)), 1024);
  execl(path, path, (char *)0);
  stack_push(vm, errno);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
movq %rdi, %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
movl (%rdi,%rax,4), %edx
testl %edx, %edx
je 0x6509
leaq (%rbx,%rax,4), %rcx
addq $0x4, %rcx
xorl %esi, %esi
leaq 0x1(%rsi), %rax
movb %dl, 0x2045b8(%rbx,%rsi)
cmpq $0x1ffe, %rsi           # imm = 0x1FFE
ja 0x650b
movl (%rcx,%rsi,4), %edx
movq %rax, %rsi
testl %edx, %edx
jne 0x64e9
jmp 0x650b
xorl %eax, %eax
leaq 0x200004(%rbx), %r14
movb $0x0, 0x2045b8(%rbx,%rax)
xorl %ecx, %ecx
movq %rcx, %rax
cmpq $0x3ff, %rcx            # imm = 0x3FF
je 0x653f
movb 0x2045b8(%rbx,%rax), %dl
movb %dl, (%rsp,%rax)
leaq 0x1(%rax), %rcx
testb %dl, %dl
jne 0x651c
addq %rsp, %rcx
jmp 0x6543
leaq (%rsp,%rax), %rcx
cmpq $0x3ff, %rax            # imm = 0x3FF
jne 0x654e
movb $0x0, (%rcx)
movq %rsp, %rdi
movq %rdi, %rsi
xorl %edx, %edx
xorl %eax, %eax
callq 0x3400
callq 0x3070
movl (%rax), %eax
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 $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/./dev-unix.c
// Function: unix_exec1
V unix_exec1(NgaState *vm) {
  char path[1025];
  char arg0[1025];
  strlcpy(arg0, string_extract(vm, stack_pop(vm)), 1024);
  strlcpy(path, string_extract(vm, stack_pop(vm)), 1024);
  execl(path, path, arg0, (char *)0);
  stack_push(vm, errno);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x818, %rsp            # imm = 0x818
movq %rdi, %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
movl (%rdi,%rax,4), %edx
testl %edx, %edx
je 0x65f3
leaq (%rbx,%rax,4), %rcx
addq $0x4, %rcx
xorl %esi, %esi
leaq 0x1(%rsi), %rax
movb %dl, 0x2045b8(%rbx,%rsi)
cmpq $0x1ffe, %rsi           # imm = 0x1FFE
ja 0x65f5
movl (%rcx,%rsi,4), %edx
movq %rax, %rsi
testl %edx, %edx
jne 0x65d3
jmp 0x65f5
xorl %eax, %eax
leaq 0x200004(%rbx), %r14
movb $0x0, 0x2045b8(%rbx,%rax)
xorl %ecx, %ecx
movq %rcx, %rax
cmpq $0x3ff, %rcx            # imm = 0x3FF
je 0x6629
movb 0x2045b8(%rbx,%rax), %dl
movb %dl, (%rsp,%rax)
leaq 0x1(%rax), %rcx
testb %dl, %dl
jne 0x6606
addq %rsp, %rcx
jmp 0x662d
leaq (%rsp,%rax), %rcx
cmpq $0x3ff, %rax            # imm = 0x3FF
jne 0x6638
movb $0x0, (%rcx)
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
leaq (%r14,%rax), %rcx
movslq (%r14,%rax), %rdx
leal -0x1(%rdx), %esi
movl %esi, (%r14,%rax)
movslq 0x14(%rcx,%rdx,4), %rax
movl (%rbx,%rax,4), %ecx
testl %ecx, %ecx
je 0x668b
leaq (%rbx,%rax,4), %rax
addq $0x4, %rax
xorl %esi, %esi
leaq 0x1(%rsi), %rdx
movb %cl, 0x2045b8(%rbx,%rsi)
cmpq $0x1ffe, %rsi           # imm = 0x1FFE
ja 0x668d
movl (%rax,%rsi,4), %ecx
movq %rdx, %rsi
testl %ecx, %ecx
jne 0x666b
jmp 0x668d
xorl %edx, %edx
movb $0x0, 0x2045b8(%rbx,%rdx)
xorl %ecx, %ecx
movq %rcx, %rax
cmpq $0x3ff, %rcx            # imm = 0x3FF
je 0x66c5
movb 0x2045b8(%rbx,%rax), %dl
movb %dl, 0x410(%rsp,%rax)
leaq 0x1(%rax), %rcx
testb %dl, %dl
jne 0x6697
addq %rsp, %rcx
addq $0x410, %rcx            # imm = 0x410
jmp 0x66d0
leaq (%rsp,%rax), %rcx
addq $0x410, %rcx            # imm = 0x410
cmpq $0x3ff, %rax            # imm = 0x3FF
jne 0x66db
movb $0x0, (%rcx)
leaq 0x410(%rsp), %rdi
movq %rsp, %rdx
movq %rdi, %rsi
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x3400
callq 0x3070
movl (%rax), %eax
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 $0x818, %rsp            # imm = 0x818
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/./dev-unix.c
// Function: unix_write
V unix_write(NgaState *vm) {
  ssize_t ignore;
  CELL c = stack_pop(vm);
  CELL b = stack_pop(vm);
  CELL a = stack_pop(vm);
  ignore = write(fileno(vm->OpenFileHandles[c]), string_extract(vm, a), b);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
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), %rsi
leaq -0x2(%rdx), %rdi
movl %edi, 0x200004(%rbx,%rax)
movslq 0x200014(%rcx,%rdx,4), %r14
leal -0x3(%rdx), %edi
movl %edi, 0x200004(%rbx,%rax)
movslq 0x200010(%rcx,%rdx,4), %r15
movq 0x288ef0(%rbx,%rsi,8), %rdi
callq 0x32d0
movl (%rbx,%r15,4), %edx
testl %edx, %edx
je 0x6ddc
leaq (%rbx,%r15,4), %rcx
addq $0x4, %rcx
xorl %edi, %edi
leaq 0x1(%rdi), %rsi
movb %dl, 0x2045b8(%rbx,%rdi)
cmpq $0x1ffe, %rdi           # imm = 0x1FFE
ja 0x6dde
movl (%rcx,%rdi,4), %edx
movq %rsi, %rdi
testl %edx, %edx
jne 0x6dbc
jmp 0x6dde
xorl %esi, %esi
movb $0x0, 0x2045b8(%rbx,%rsi)
addq $0x2045b8, %rbx         # imm = 0x2045B8
movl %eax, %edi
movq %rbx, %rsi
movq %r14, %rdx
popq %rbx
popq %r14
popq %r15
jmp 0x30d0
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/retro.c
// Function: validate_opcode_bundle
V validate_opcode_bundle(NgaState *vm, CELL opcode) {
  CELL remainingOpcode = opcode;
  for (int i = 0; i < 4; i++) {
    CELL current = remainingOpcode & 0xFF;
    if (current < 0 || current > 29) {
      invalid_opcode(vm, opcode);
    }
    remainingOpcode >>= 8;
  }
}

// Assembly:
movl $0x4, %eax
movl %esi, %ecx
movl %ecx, %edx
andl $0xfe, %edx
cmpl $0x1e, %edx
jae 0x802b
sarl $0x8, %ecx
decl %eax
jne 0x8016
retq
pushq %rax
callq 0x7f91
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/retro.c
// Function: process_opcode_bundle
V process_opcode_bundle(NgaState *vm, CELL opcode) {
#ifndef BRANCH_PREDICTION
  if (INST(0))  instructions[opcode & 0xFF](vm);
  if (INST(8))  instructions[(opcode >> 8) & 0xFF](vm);
  if (INST(16)) instructions[(opcode >> 16) & 0xFF](vm);
  if (INST(24)) instructions[(opcode >> 24) & 0xFF](vm);
#else
  for (size_t i = 0; i < 4; ++i) {
    uint8_t current = ((uint8_t*)&opcode)[i];
    if (unlikely(current > 29)) {
      invalid_opcode(vm, opcode);
    }
    instructions[current](vm);
  }
#endif
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl %esi, %eax
andl $0xff, %eax
movq %rsi, %r14
je 0x8056
movl %eax, %eax
leaq 0x4e103(%rip), %rcx     # 0x56150
movq %rbx, %rdi
callq *(%rcx,%rax,8)
movq %r14, %rsi
movl %esi, %eax
shrl $0x8, %eax
andl $0xff, %eax
je 0x8074
movl %eax, %eax
leaq 0x4e0e5(%rip), %rcx     # 0x56150
movq %rbx, %rdi
callq *(%rcx,%rax,8)
movq %r14, %rsi
movl %esi, %eax
shrl $0x10, %eax
andl $0xff, %eax
je 0x8092
movl %eax, %eax
leaq 0x4e0c7(%rip), %rcx     # 0x56150
movq %rbx, %rdi
callq *(%rcx,%rax,8)
movq %r14, %rsi
cmpl $0x1000000, %esi        # imm = 0x1000000
jae 0x80a2
addq $0x8, %rsp
popq %rbx
popq %r14
retq
shrl $0x18, %esi
leaq 0x4e0a4(%rip), %rax     # 0x56150
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmpq *(%rax,%rsi,8)
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/retro.c
// Function: prepare_vm
V prepare_vm(NgaState *vm) {
  vm->active = 0;
  ACTIVE.ip = ACTIVE.sp = ACTIVE.rp = ACTIVE.u = 0;
  ACTIVE.active = -1;
  for (ACTIVE.ip = 0; ACTIVE.ip < IMAGE_SIZE; ACTIVE.ip++)
    vm->memory[ACTIVE.ip] = 0; /* NO - nop instruction */
  for (ACTIVE.ip = 0; ACTIVE.ip < STACK_DEPTH; ACTIVE.ip++)
    ACTIVE.data[ACTIVE.ip] = 0;
  for (ACTIVE.ip = 0; ACTIVE.ip < ADDRESSES; ACTIVE.ip++)
    ACTIVE.address[ACTIVE.ip] = 0;
}

// Assembly:
xorl %ecx, %ecx
movl %ecx, 0x2043a4(%rdi)
leaq 0x200004(%rdi), %rax
movl %ecx, 0x200014(%rdi)
movq $0x0, 0x200004(%rdi)
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
movq %rdx, 0x20000c(%rdi)
testb %cl, %cl
jne 0x8624
movslq %ecx, %rcx
movl $0x0, (%rdi,%rcx,4)
movslq 0x2043a4(%rdi), %rcx
imulq $0x874, %rcx, %rdx      # imm = 0x874
movl 0x8(%rax,%rdx), %ecx
incl %ecx
movl %ecx, 0x8(%rax,%rdx)
cmpl $0x80000, %ecx          # imm = 0x80000
jl 0x85f0
leaq (%rax,%rdx), %rcx
addq $0x8, %rcx
jmp 0x862b
leaq 0x20000c(%rdi), %rcx
movl $0x0, (%rcx)
movslq 0x2043a4(%rdi), %rcx
imulq $0x874, %rcx, %rdx      # imm = 0x874
movl 0x8(%rax,%rdx), %edx
cmpl $0xff, %edx
jg 0x8680
movslq %edx, %rdx
imulq $0x874, %rcx, %rcx      # imm = 0x874
addq %rax, %rcx
movl $0x0, 0x14(%rcx,%rdx,4)
movslq 0x2043a4(%rdi), %rcx
imulq $0x874, %rcx, %rsi      # imm = 0x874
movl 0x8(%rax,%rsi), %edx
incl %edx
movl %edx, 0x8(%rax,%rsi)
cmpl $0x100, %edx            # imm = 0x100
jl 0x864b
imulq $0x874, %rcx, %rcx      # imm = 0x874
movl $0x0, 0x8(%rax,%rcx)
movslq 0x2043a4(%rdi), %rcx
imulq $0x874, %rcx, %rdx      # imm = 0x874
movl 0x8(%rax,%rdx), %edx
cmpl $0xff, %edx
jg 0x86e1
movslq %edx, %rdx
imulq $0x874, %rcx, %rcx      # imm = 0x874
addq %rax, %rcx
movl $0x0, 0x414(%rcx,%rdx,4)
movslq 0x2043a4(%rdi), %rcx
imulq $0x874, %rcx, %rsi      # imm = 0x874
movl 0x8(%rax,%rsi), %edx
incl %edx
movl %edx, 0x8(%rax,%rsi)
cmpl $0x100, %edx            # imm = 0x100
jl 0x86a9
retq
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/retro.c
// Function: register_signal_handlers
V register_signal_handlers() {
#ifdef ENABLE_SIGNALS
  signal(SIGHUP, sig_handler);
  signal(SIGINT, sig_handler);
  signal(SIGILL, sig_handler);
  signal(SIGBUS, sig_handler);
  signal(SIGFPE, sig_handler);
#endif
}

// Assembly:
pushq %rbx
leaq 0x42(%rip), %rbx        # 0x8aa1
movl $0x1, %edi
movq %rbx, %rsi
callq 0x3260
movl $0x2, %edi
movq %rbx, %rsi
callq 0x3260
movl $0x4, %edi
movq %rbx, %rsi
callq 0x3260
movl $0x7, %edi
movq %rbx, %rsi
callq 0x3260
movl $0x8, %edi
movq %rbx, %rsi
popq %rbx
jmp 0x3260
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/retro.c
// Function: load_image
CELL load_image(NgaState *vm, char *imageFile) {
  FILE *fp;
  CELL imageSize = 0;
  long fileLen;
  if ((fp = fopen(imageFile, "rb")) != NULL) {
    /* Determine length (in cells) */
    fseek(fp, 0, SEEK_END);
    fileLen = ftell(fp) / sizeof(CELL);
    if (fileLen > IMAGE_SIZE) {
      fclose(fp);
      printf("\nERROR (nga/ngaLoadImage): Image is larger than alloted space!\n");
      exit(1);
    }
    rewind(fp);

    /* Erase old image in memory: 0 = nop instruction */
    for (int i = 0; i < IMAGE_SIZE; i++) { vm->memory[i] = 0; }

    /* Read the file into memory */
    imageSize = fread(vm->memory, sizeof(CELL), fileLen, fp);
    fclose(fp);
  }
  return imageSize;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rax
movq %rdi, %r14
leaq 0x20a0(%rip), %rsi      # 0xb08f
movq %rax, %rdi
callq 0x3360
testq %rax, %rax
je 0x905c
movq %rax, %rbx
movq %rax, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x3310
movq %rbx, %rdi
callq 0x3280
cmpq $0x200004, %rax         # imm = 0x200004
jae 0x9068
movq %rax, %r15
shrq $0x2, %r15
movq %rbx, %rdi
callq 0x3160
movl $0x200000, %edx         # imm = 0x200000
movq %r14, %rdi
xorl %esi, %esi
callq 0x31a0
movl $0x4, %esi
movq %r14, %rdi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x30b0
movq %rax, %r14
movq %rbx, %rdi
callq 0x3110
jmp 0x905f
xorl %r14d, %r14d
movl %r14d, %eax
popq %rbx
popq %r14
popq %r15
retq
movq %rbx, %rdi
callq 0x3110
leaq 0x2731(%rip), %rdi      # 0xb7a8
callq 0x30a0
movl $0x1, %edi
callq 0x33d0
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/retro.c
// Function: i_li
V i_li(NgaState *vm) {
  guard(vm, 0, 1, 0);
  ACTIVE.sp++;
  ACTIVE.ip++;
  TOS = vm->memory[ACTIVE.ip];
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
xorl %esi, %esi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x3700
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
leaq (%rbx,%rax), %rcx
movslq 0x200004(%rbx,%rax), %rdx
leaq 0x1(%rdx), %rsi
movl %esi, 0x200004(%rbx,%rax)
movslq 0x20000c(%rbx,%rax), %rsi
leal 0x1(%rsi), %edi
movl %edi, 0x20000c(%rbx,%rax)
movl 0x4(%rbx,%rsi,4), %eax
movl %eax, 0x20001c(%rcx,%rdx,4)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/retro.c
// Function: i_sw
V i_sw(NgaState *vm) {
  guard(vm, 2, 2, 0);
  CELL a;
  a = TOS;
  TOS = NOS;
  NOS = a;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl $0x2, %esi
movl $0x2, %edx
xorl %ecx, %ecx
callq 0x3700
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
addq %rbx, %rax
addq $0x200004, %rax         # imm = 0x200004
movslq (%rax), %rcx
movl 0x10(%rax,%rcx,4), %edx
movl 0x14(%rax,%rcx,4), %esi
movl %edx, 0x14(%rax,%rcx,4)
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
addq %rbx, %rax
addq $0x200004, %rax         # imm = 0x200004
movslq (%rax), %rcx
movl %esi, 0x10(%rax,%rcx,4)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/retro.c
// Function: i_pu
V i_pu(NgaState *vm) {
  guard(vm, 1, 0, 1);
  ACTIVE.rp++;
  TORS = TOS;
  i_dr(vm);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl $0x1, %esi
xorl %edx, %edx
movl $0x1, %ecx
callq 0x3700
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
addq %rbx, %rax
addq $0x200004, %rax         # imm = 0x200004
movslq 0x4(%rax), %rcx
leal 0x1(%rcx), %edx
movl %edx, 0x4(%rax)
movslq (%rax), %rdx
movl 0x14(%rax,%rdx,4), %edx
movl %edx, 0x418(%rax,%rcx,4)
movq %rbx, %rdi
movl $0x1, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x3700
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
addq %rbx, %rax
addq $0x200004, %rax         # imm = 0x200004
movslq (%rax), %rcx
movl $0x0, 0x14(%rax,%rcx,4)
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
decl 0x200004(%rbx,%rax)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/retro.c
// Function: i_po
V i_po(NgaState *vm) {
  guard(vm, 0, 1, -1);
  ACTIVE.sp++;
  TOS = TORS;
  ACTIVE.rp--;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
xorl %esi, %esi
movl $0x1, %edx
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
callq 0x3700
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
addq %rbx, %rax
addq $0x200004, %rax         # imm = 0x200004
movslq (%rax), %rcx
leaq 0x1(%rcx), %rdx
movl %edx, (%rax)
movslq 0x4(%rax), %rdx
movl 0x414(%rax,%rdx,4), %edx
movl %edx, 0x18(%rax,%rcx,4)
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
decl 0x200008(%rbx,%rax)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/retro.c
// Function: i_ca
V i_ca(NgaState *vm) {
  guard(vm, 1, 0, 1);
  ACTIVE.rp++;
  TORS = ACTIVE.ip;
  ACTIVE.ip = TOS - 1;
  i_dr(vm);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl $0x1, %esi
xorl %edx, %edx
movl $0x1, %ecx
callq 0x3700
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
addq %rbx, %rax
addq $0x200004, %rax         # imm = 0x200004
movslq 0x4(%rax), %rcx
leal 0x1(%rcx), %edx
movl %edx, 0x4(%rax)
movl 0x8(%rax), %edx
movl %edx, 0x418(%rax,%rcx,4)
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
addq %rbx, %rax
addq $0x200004, %rax         # imm = 0x200004
movslq (%rax), %rcx
movl 0x14(%rax,%rcx,4), %ecx
decl %ecx
movl %ecx, 0x8(%rax)
movq %rbx, %rdi
movl $0x1, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x3700
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
addq %rbx, %rax
addq $0x200004, %rax         # imm = 0x200004
movslq (%rax), %rcx
movl $0x0, 0x14(%rax,%rcx,4)
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
decl 0x200004(%rbx,%rax)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/retro.c
// Function: i_cc
V i_cc(NgaState *vm) {
  guard(vm, 2, 0, 1);
  CELL a, b;
  a = TOS; i_dr(vm);  /* Target */
  b = TOS; i_dr(vm);  /* Flag   */
  if (b != 0) {
    ACTIVE.rp++;
    TORS = ACTIVE.ip;
    ACTIVE.ip = a - 1;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
movl $0x2, %esi
xorl %edx, %edx
movl $0x1, %ecx
callq 0x3700
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
addq %rbx, %rax
addq $0x200004, %rax         # imm = 0x200004
movslq (%rax), %rcx
movl 0x14(%rax,%rcx,4), %ebp
movq %rbx, %rdi
movl $0x1, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x3700
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
addq %rbx, %rax
addq $0x200004, %rax         # imm = 0x200004
movslq (%rax), %rcx
movl %r14d, 0x14(%rax,%rcx,4)
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
addq %rbx, %rax
addq $0x200004, %rax         # imm = 0x200004
movslq (%rax), %rcx
leaq -0x1(%rcx), %rdx
movl %edx, (%rax)
movl 0x10(%rax,%rcx,4), %r15d
movq %rbx, %rdi
movl $0x1, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x3700
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
addq %rbx, %rax
addq $0x200004, %rax         # imm = 0x200004
movslq (%rax), %rcx
movl %r14d, 0x14(%rax,%rcx,4)
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
decl 0x200004(%rbx,%rax)
cmpl %r14d, %r15d
je 0x94fd
leaq 0x200004(%rbx), %rcx
incl 0x4(%rcx,%rax)
addq %rbx, %rax
addq $0x200004, %rax         # imm = 0x200004
movl 0x8(%rax), %edx
movslq 0x4(%rax), %rsi
movl %edx, 0x414(%rax,%rsi,4)
decl %ebp
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
movl %ebp, 0x8(%rcx,%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/retro.c
// Function: i_eq
V i_eq(NgaState *vm) {
  guard(vm, 2, 1, 0);
  if (ACTIVE.u != 0) {
    NOS = ((unsigned)NOS == (unsigned)TOS) ? -1 : 0;
    ACTIVE.u = 0;
  } else {
    NOS = (NOS == TOS) ? -1 : 0;
  }
  i_dr(vm);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x2, %esi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x3700
leaq 0x200004(%rbx), %r14
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
addq %rbx, %rax
addq $0x200004, %rax         # imm = 0x200004
movslq (%rax), %rcx
movl 0x10(%rax,%rcx,4), %edx
xorl %esi, %esi
cmpl 0x14(%rax,%rcx,4), %edx
sete %sil
negl %esi
cmpl $0x0, 0x10(%rax)
movl %esi, 0x10(%rax,%rcx,4)
je 0x95b8
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
movl $0x0, 0x10(%r14,%rax)
movq %rbx, %rdi
movl $0x1, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x3700
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
leaq (%r14,%rax), %rcx
movslq (%r14,%rax), %rax
movl $0x0, 0x14(%rcx,%rax,4)
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
decl (%r14,%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/retro.c
// Function: i_fe
V i_fe(NgaState *vm) {
  guard(vm, 1, 1, 0);
  switch (TOS) {
    case -1: TOS = ACTIVE.sp - 1; break;
    case -2: TOS = ACTIVE.rp; break;
    case -3: TOS = IMAGE_SIZE; break;
    case -4: TOS = CELL_MIN; break;
    case -5: TOS = CELL_MAX; break;
    default: TOS = vm->memory[TOS]; break;
  }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl $0x1, %esi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x3700
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
leaq (%rbx,%rax), %rdx
addq %rbx, %rax
addq $0x200004, %rax         # imm = 0x200004
movslq (%rax), %rcx
movslq 0x200018(%rdx,%rcx,4), %rdx
leal 0x5(%rdx), %esi
cmpl $0x4, %esi
ja 0x98a2
leaq 0x17a6(%rip), %rdx      # 0xb020
movslq (%rdx,%rsi,4), %rsi
addq %rdx, %rsi
jmpq *%rsi
movl $0x7ffffffe, %edx       # imm = 0x7FFFFFFE
jmp 0x98a5
leal -0x1(%rcx), %edx
jmp 0x98a5
movl $0x80000, %edx          # imm = 0x80000
jmp 0x98a5
movl 0x4(%rax), %edx
jmp 0x98a5
movl $0x80000001, %edx       # imm = 0x80000001
jmp 0x98a5
movl (%rbx,%rdx,4), %edx
movl %edx, 0x14(%rax,%rcx,4)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/retro.c
// Function: i_st
V i_st(NgaState *vm) {
  guard(vm, 2, 0, 0);
  vm->memory[TOS] = NOS;
  i_dr(vm);
  i_dr(vm);
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %ebp, %ebp
movl $0x2, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x3700
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
addq %rbx, %rax
addq $0x200004, %rax         # imm = 0x200004
movslq (%rax), %rcx
movl 0x10(%rax,%rcx,4), %edx
movslq 0x14(%rax,%rcx,4), %rax
movl %edx, (%rbx,%rax,4)
movq %rbx, %rdi
movl $0x1, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x3700
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
addq %rbx, %rax
addq $0x200004, %rax         # imm = 0x200004
movslq (%rax), %rcx
movl %ebp, 0x14(%rax,%rcx,4)
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
decl 0x200004(%rbx,%rax)
movq %rbx, %rdi
movl $0x1, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x3700
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
addq %rbx, %rax
addq $0x200004, %rax         # imm = 0x200004
movslq (%rax), %rcx
movl %ebp, 0x14(%rax,%rcx,4)
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
decl 0x200004(%rbx,%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/retro.c
// Function: i_ad
V i_ad(NgaState *vm) {
  guard(vm, 2, 1, 0);
  if (ACTIVE.u != 0) {
    NOS = (unsigned)NOS + (unsigned)TOS;
    ACTIVE.u = 0;
  } else {
    NOS += TOS;
  }
  i_dr(vm);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x2, %esi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x3700
leaq 0x200004(%rbx), %r14
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
addq %rbx, %rax
addq $0x200004, %rax         # imm = 0x200004
cmpl $0x0, 0x10(%rax)
movslq (%rax), %rcx
je 0x99d6
movl 0x14(%rax,%rcx,4), %edx
addl %edx, 0x10(%rax,%rcx,4)
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
movl $0x0, 0x10(%r14,%rax)
jmp 0x99de
movl 0x14(%rax,%rcx,4), %edx
addl %edx, 0x10(%rax,%rcx,4)
movq %rbx, %rdi
movl $0x1, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x3700
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
leaq (%r14,%rax), %rcx
movslq (%r14,%rax), %rax
movl $0x0, 0x14(%rcx,%rax,4)
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
decl (%r14,%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/retro.c
// Function: i_di
V i_di(NgaState *vm) {
  guard(vm, 2, 2, 0);
  CELL a, b;
  a = TOS;
  b = NOS;
  if (b == 0) {
#ifdef ENABLE_ERROR
    if (vm->ErrorHandlers[6] != 0) {
    }
#endif
  }
  if (ACTIVE.u != 0) {
    TOS = (unsigned)b / (unsigned)a;
    NOS = (unsigned)b % (unsigned)a;
    ACTIVE.u = 0;
  } else {
    TOS = b / a;
    NOS = b % a;
  }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl $0x2, %esi
movl $0x2, %edx
xorl %ecx, %ecx
callq 0x3700
leaq 0x200004(%rbx), %rcx
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
leaq (%rbx,%rax), %rsi
addq $0x200004, %rsi         # imm = 0x200004
movslq (%rsi), %rdi
movl 0x10(%rsi,%rdi,4), %eax
movl 0x14(%rsi,%rdi,4), %r8d
cmpl $0x0, 0x10(%rsi)
je 0x9c15
xorl %edx, %edx
divl %r8d
movl %eax, 0x14(%rsi,%rdi,4)
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
leaq (%rcx,%rax), %rsi
movslq (%rcx,%rax), %rax
movl %edx, 0x10(%rsi,%rax,4)
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
movl $0x0, 0x10(%rcx,%rax)
jmp 0x9c37
cltd
idivl %r8d
movl %eax, 0x14(%rsi,%rdi,4)
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
leaq (%rcx,%rax), %rsi
movslq (%rcx,%rax), %rax
movl %edx, 0x10(%rsi,%rax,4)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/retro.c
// Function: i_sh
V i_sh(NgaState *vm) {
  guard(vm, 2, 1, 0);
  CELL y = TOS;
  CELL x = NOS;
  if (TOS < 0)
    NOS = NOS << (0 - TOS);
  else {
    if (ACTIVE.u != 0) {
      NOS = (unsigned)x >> (unsigned)y;
      ACTIVE.u = 0;
    } else {
      if (x < 0 && y > 0)
        NOS = x >> y | ~(~0U >> y);
      else
        NOS = x >> y;
    }
  }
  i_dr(vm);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x2, %esi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x3700
leaq 0x200004(%rbx), %r14
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
addq %rbx, %rax
addq $0x200004, %rax         # imm = 0x200004
movslq (%rax), %rdx
movl 0x10(%rax,%rdx,4), %esi
movl 0x14(%rax,%rdx,4), %ecx
testl %ecx, %ecx
js 0x9e26
cmpl $0x0, 0x10(%rax)
je 0x9e30
shrl %cl, %esi
movl %esi, 0x10(%rax,%rdx,4)
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
movl $0x0, 0x10(%r14,%rax)
jmp 0x9e4b
negb %cl
shll %cl, %esi
movl %esi, 0x10(%rax,%rdx,4)
jmp 0x9e4b
movl %esi, %edi
sarl %cl, %edi
testl %ecx, %ecx
je 0x9e47
testl %esi, %esi
jns 0x9e47
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
shrl %cl, %esi
notl %esi
orl %esi, %edi
movl %edi, 0x10(%rax,%rdx,4)
movq %rbx, %rdi
movl $0x1, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x3700
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
leaq (%r14,%rax), %rcx
movslq (%r14,%rax), %rax
movl $0x0, 0x14(%rcx,%rax,4)
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
decl (%r14,%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/retro.c
// Function: i_zr
V i_zr(NgaState *vm) {
  guard(vm, 1, 0, 0);
  if (TOS == 0) {
    i_dr(vm);
    ACTIVE.ip = TORS;
    ACTIVE.rp--;
  }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x1, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x3700
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
addq %rbx, %rax
addq $0x200004, %rax         # imm = 0x200004
movslq (%rax), %rcx
cmpl $0x0, 0x14(%rax,%rcx,4)
jne 0x9f2c
leaq 0x200004(%rbx), %r14
movq %rbx, %rdi
movl $0x1, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x3700
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
leaq (%r14,%rax), %rcx
movslq (%r14,%rax), %rax
movl $0x0, 0x14(%rcx,%rax,4)
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
decl (%r14,%rax)
leaq (%r14,%rax), %rcx
movslq 0x4(%r14,%rax), %rdx
movl 0x414(%rcx,%rdx,4), %ecx
movl %ecx, 0x8(%r14,%rax)
decl 0x4(%r14,%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/retro.c
// Function: i_ha
V i_ha(NgaState *vm) {
  guard(vm, 0, 0, 0);
  ACTIVE.ip = IMAGE_SIZE;
  ACTIVE.rp = 0;
  exit(0);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x3700
movslq 0x2043a4(%rbx), %rax
imulq $0x874, %rax, %rax      # imm = 0x874
movabsq $0x8000000000000, %rcx  # imm = 0x8000000000000
movq %rcx, 0x200008(%rbx,%rax)
xorl %edi, %edi
callq 0x33d0
// File: /workspace/github_c_makefile_star2_O1/crcx[P]retroforth/vm/nga-c/retro.c
// Function: strlcat
size_t strlcat(char *dst, const char *src, size_t dsize) {
  const char *odst = dst;
  const char *osrc = src;
  size_t n = dsize;
  size_t dlen;

  /* Find the end of dst and adjust bytes left but don't go past end. */
  while (n-- != 0 && *dst != '\0')
    dst++;
  dlen = dst - odst;
  n = dsize - dlen;

  if (n-- == 0)
    return(dlen + strlen(src));
  while (*src != '\0') {
    if (n != 0) {
      *dst++ = *src;
      n--;
    }
    src++;
  }
  *dst = '\0';
  return(dlen + (src - osrc));  /* count does not include NUL */
}

// Assembly:
pushq %rbx
movq %rdi, %rcx
testq %rdx, %rdx
je 0xa07d
leaq (%rdi,%rdx), %rax
movq %rdx, %r8
movq %rdi, %rcx
cmpb $0x0, (%rcx)
je 0xa07d
incq %rcx
decq %r8
jne 0xa06d
movq %rax, %rcx
movq %rcx, %rbx
subq %rdi, %rbx
cmpq %rdx, %rbx
jne 0xa092
movq %rsi, %rdi
callq 0x3120
jmp 0xa0cf
movb (%rsi), %r8b
testb %r8b, %r8b
je 0xa0c6
movq %rbx, %rdi
notq %rdi
addq %rdx, %rdi
movq %rsi, %rax
testq %rdi, %rdi
je 0xa0b6
movb %r8b, (%rcx)
incq %rcx
decq %rdi
jmp 0xa0b8
xorl %edi, %edi
movb 0x1(%rax), %r8b
incq %rax
testb %r8b, %r8b
jne 0xa0a6
jmp 0xa0c9
movq %rsi, %rax
movb $0x0, (%rcx)
subq %rsi, %rax
addq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/chatziko-k08[P]lecture-code/tests/ADTPriorityQueue_test.c
// Function: shuffle
void shuffle(int* array[], int size) {
	for (int i = 0; i < size; i++) {
		int new_pos = i + rand() / (RAND_MAX / (size - i) + 1);
		int* temp = array[new_pos];
		array[new_pos] = array[i];
		array[i] = temp;
	}
}

// Assembly:
testl %esi, %esi
jle 0x3e0a
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl %esi, %r14d
xorl %r15d, %r15d
callq 0x2290
movl %eax, %ecx
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
xorl %edx, %edx
idivl %r14d
movl %eax, %esi
incl %esi
movl %ecx, %eax
cltd
idivl %esi
cltq
addq %r15, %rax
movq (%rbx,%rax,8), %rcx
movq (%rbx,%r15,8), %rdx
movq %rdx, (%rbx,%rax,8)
movq %rcx, (%rbx,%r15,8)
incq %r15
decq %r14
jne 0x3dce
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/chatziko-k08[P]lecture-code/tests/ADTPriorityQueue_test.c
// Function: test_insert
void test_insert(void) {
	PriorityQueue pqueue = pqueue_create(compare_ints, NULL, NULL);
	int N = 1000;
	int* array = malloc(N * sizeof(*array));					// Στο pqueue θα προσθέσουμε pointers προς τα στοιχεία αυτού του πίνακα

	// insert N στοιχεία
	for (int i = 0; i < N; i++) {
		array[i] = i;
		pqueue_insert(pqueue, &array[i]);
		TEST_ASSERT(pqueue_size(pqueue) == i+1);			// Το size ενημερώθηκε;
		TEST_ASSERT(pqueue_max(pqueue) == &array[i]);	// Εισαγωγή σε αύξουσα σειρά, το στοιχείο που μόλις βάλαμε πρέπει να είναι στην κορυφή
	}

	pqueue_destroy(pqueue);
	free(array);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq -0x238(%rip), %rdi      # 0x3e1c
xorl %esi, %esi
xorl %edx, %edx
callq 0x4830
movq %rax, %rbx
movl $0xfa0, %edi            # imm = 0xFA0
callq 0x21a0
movq %rax, %r14
movl $0x1, %r13d
leaq 0x129e(%rip), %r15      # 0x5318
leaq 0x1444(%rip), %r12      # 0x54c5
leaq 0x1342(%rip), %rbp      # 0x53ca
movq %rax, (%rsp)
cmpq $0x3e9, %r13            # imm = 0x3E9
je 0x410d
leal -0x1(%r13), %eax
movl %eax, (%r14)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x48d8
movq %rbx, %rdi
callq 0x48c6
movl %eax, %eax
xorl %edi, %edi
cmpq %rax, %r13
sete %dil
movq %r15, %rsi
movl $0x46, %edx
movq %r12, %rcx
leaq 0x12e3(%rip), %r8       # 0x53af
xorl %eax, %eax
callq 0x25dc
testl %eax, %eax
je 0x4108
movq %rbx, %rdi
callq 0x48ce
xorl %edi, %edi
cmpq %rax, %r14
sete %dil
movq %r15, %rsi
movl $0x47, %edx
movq %r12, %rcx
movq %rbp, %r8
xorl %eax, %eax
callq 0x25dc
incq %r13
addq $0x4, %r14
testl %eax, %eax
jne 0x408c
callq 0x2e23
movq %rbx, %rdi
callq 0x4ac5
movq (%rsp), %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x22b0
// File: /workspace/github_c_makefile_star2_O1/chatziko-k08[P]lecture-code/tests/ADTPriorityQueue_test.c
// Function: test_remove
void test_remove(void) {
	PriorityQueue pqueue = pqueue_create(compare_ints, free, NULL);

	// προσθήκη δεδομένων, τυχαία σειρά
	int N = 10;
	int** array = malloc(N * sizeof(*array));
	for (int i = 0; i < N; i++)
		array[i] = create_int(i);
	shuffle(array, N);

	for (int i = 0; i < N; i++)
		pqueue_insert(pqueue, array[i]);

	// Διαδοχικά remove ώστε να συμβούν και resizes
	for (int i = N-1; i >= 0; i--) {
		int* value = pqueue_max(pqueue);
		TEST_ASSERT(*value == i);
		pqueue_remove_max(pqueue);
		TEST_ASSERT(pqueue_size(pqueue) == i);
	}

	pqueue_destroy(pqueue);

	// remove από ουρά χωρίς συνάρτηση destroy
	pqueue = pqueue_create(compare_ints, NULL, NULL);
	pqueue_insert(pqueue, &N);
	TEST_ASSERT(pqueue_max(pqueue) == &N);
	pqueue_remove_max(pqueue);
	pqueue_destroy(pqueue);
	free(array);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq -0x322(%rip), %rdi      # 0x3e1c
movq 0x3e7b(%rip), %rsi      # 0x7fc0
xorl %r15d, %r15d
xorl %edx, %edx
callq 0x4830
movq %rax, %r14
movl $0xa, 0x4(%rsp)
movl $0x50, %edi
callq 0x21a0
movq %rax, %rbx
movl $0x4, %edi
callq 0x21a0
movl %r15d, (%rax)
movq %rax, (%rbx,%r15,8)
incq %r15
cmpq $0xa, %r15
jne 0x4167
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3dbc
movl 0x4(%rsp), %r13d
testl %r13d, %r13d
jle 0x41b4
xorl %r15d, %r15d
movq (%rbx,%r15,8), %rsi
movq %r14, %rdi
callq 0x48d8
incq %r15
movslq 0x4(%rsp), %r13
cmpq %r13, %r15
jl 0x419b
leaq 0x115d(%rip), %r15      # 0x5318
leaq 0x1303(%rip), %r12      # 0x54c5
leaq 0x122d(%rip), %rbp      # 0x53f6
testl %r13d, %r13d
jle 0x4236
decl %r13d
movq %r14, %rdi
callq 0x48ce
xorl %edi, %edi
cmpl (%rax), %r13d
sete %dil
movq %r15, %rsi
movl $0x5e, %edx
movq %r12, %rcx
leaq 0x11f6(%rip), %r8       # 0x53ea
xorl %eax, %eax
callq 0x25dc
testl %eax, %eax
je 0x4231
movq %r14, %rdi
callq 0x495f
movq %r14, %rdi
callq 0x48c6
xorl %edi, %edi
cmpl %eax, %r13d
sete %dil
movq %r15, %rsi
movl $0x60, %edx
movq %r12, %rcx
movq %rbp, %r8
xorl %eax, %eax
callq 0x25dc
testl %eax, %eax
jne 0x41c9
callq 0x2e23
movq %r14, %rdi
callq 0x4ac5
leaq -0x429(%rip), %rdi      # 0x3e1c
xorl %esi, %esi
xorl %edx, %edx
callq 0x4830
movq %rax, %r14
leaq 0x4(%rsp), %r15
movq %rax, %rdi
movq %r15, %rsi
callq 0x48d8
movq %r14, %rdi
callq 0x48ce
xorl %edi, %edi
cmpq %r15, %rax
sete %dil
leaq 0x109f(%rip), %rsi      # 0x5318
leaq 0x1245(%rip), %rcx      # 0x54c5
leaq 0x1188(%rip), %r8       # 0x540f
movl $0x68, %edx
xorl %eax, %eax
callq 0x25dc
testl %eax, %eax
je 0x4231
movq %r14, %rdi
callq 0x495f
movq %r14, %rdi
callq 0x4ac5
movq %rbx, %rdi
callq 0x22b0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/chatziko-k08[P]lecture-code/lib/../modules/UsingHeap/ADTPriorityQueue.c
// Function: pqueue_create
PriorityQueue pqueue_create(CompareFunc compare, DestroyFunc destroy_value, Vector values) {
	assert(compare != NULL);	// LCOV_EXCL_LINE

	PriorityQueue pqueue = malloc(sizeof(*pqueue));
	pqueue->compare = compare;
	pqueue->destroy_value = destroy_value;

	// Δημιουργία του vector που αποθηκεύει τα στοιχεία.
	// ΠΡΟΣΟΧΗ: ΔΕΝ περνάμε την destroy_value στο vector!
	// Αν την περάσουμε θα καλείται όταν κάνουμε swap 2 στοιχεία, το οποίο δεν το επιθυμούμε.
	pqueue->values = vector_create(0, NULL);

	// Αν values != NULL, αρχικοποιούμε το σωρό.
	if (values != NULL)
		naive_heapify(pqueue, values);

	return pqueue;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
testq %rdi, %rdi
je 0x48a7
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r12
movl $0x18, %edi
callq 0x21a0
movq %rax, %r14
movq %r12, 0x8(%rax)
movq %r15, 0x10(%rax)
xorl %edi, %edi
xorl %esi, %esi
callq 0x4ae8
movq %rax, (%r14)
testq %rbx, %rbx
je 0x489b
movq %rbx, %rdi
callq 0x4b28
testl %eax, %eax
jle 0x489b
movl %eax, %ebp
xorl %r15d, %r15d
movq %rbx, %rdi
movl %r15d, %esi
callq 0x4b2c
movq %r14, %rdi
movq %rax, %rsi
callq 0x48d8
incl %r15d
cmpl %r15d, %ebp
jne 0x487d
movq %r14, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x15a7(%rip), %rdi      # 0x5e55
leaq 0x15b0(%rip), %rsi      # 0x5e65
leaq 0x15d1(%rip), %rcx      # 0x5e8d
movl $0x6a, %edx
callq 0x2110
// File: /workspace/github_c_makefile_star2_O1/chatziko-k08[P]lecture-code/lib/../modules/UsingHeap/ADTPriorityQueue.c
// Function: pqueue_insert
void pqueue_insert(PriorityQueue pqueue, Pointer value) {
	// Προσθέτουμε την τιμή στο τέλος το σωρού
	vector_insert_last(pqueue->values, value);

 	// Ολοι οι κόμβοι ικανοποιούν την ιδιότητα του σωρού εκτός από τον τελευταίο, που μπορεί να είναι
	// μεγαλύτερος από τον πατέρα του. Αρα μπορούμε να επαναφέρουμε την ιδιότητα του σωρού καλώντας
	// τη bubble_up γα τον τελευταίο κόμβο (του οποίου το 1-based id ισούται με το νέο μέγεθος του σωρού).
	bubble_up(pqueue, pqueue_size(pqueue));
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
callq 0x4bb9
movq (%rbx), %rdi
callq 0x4b28
movq %rbx, %rdi
movl %eax, %esi
popq %rbx
jmp 0x48f4
// File: /workspace/github_c_makefile_star2_O1/chatziko-k08[P]lecture-code/lib/../modules/UsingHeap/ADTPriorityQueue.c
// Function: bubble_up
static void bubble_up(PriorityQueue pqueue, int node_id) {
	// Αν φτάσαμε στη ρίζα, σταματάμε
	if (node_id == 1)
		return;

	int parent = node_id / 2;		// Ο πατέρας του κόμβου. Τα node_ids είναι 1-based

	// Αν ο πατέρας έχει μικρότερη τιμή από τον κόμβο, swap και συνεχίζουμε αναδρομικά προς τα πάνω
	if (pqueue->compare(node_value(pqueue, parent), node_value(pqueue, node_id)) < 0) {
		node_swap(pqueue, parent, node_id);
		bubble_up(pqueue, parent);
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %esi, %r14d
movq %rdi, %rbx
cmpl $0x1, %r14d
je 0x4955
movl %r14d, %r15d
shrl $0x1f, %r15d
addl %r14d, %r15d
sarl %r15d
movq (%rbx), %rdi
movq 0x8(%rbx), %r13
leal -0x1(%r15), %esi
callq 0x4b2c
movq %rax, %r12
movq (%rbx), %rdi
leal -0x1(%r14), %esi
callq 0x4b2c
movq %r12, %rdi
movq %rax, %rsi
callq *%r13
testl %eax, %eax
jns 0x4955
movq %rbx, %rdi
movl %r15d, %esi
movl %r14d, %edx
callq 0x49d1
movl %r15d, %r14d
jmp 0x4903
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/chatziko-k08[P]lecture-code/lib/../modules/UsingHeap/ADTPriorityQueue.c
// Function: pqueue_remove_max
void pqueue_remove_max(PriorityQueue pqueue) {
	int last_node = pqueue_size(pqueue);
	assert(last_node != 0);		// LCOV_EXCL_LINE

	// Destroy την τιμή που αφαιρείται
	if (pqueue->destroy_value != NULL)
		pqueue->destroy_value(pqueue_max(pqueue));

	// Αντικαθιστούμε τον πρώτο κόμβο με τον τελευταίο και αφαιρούμε τον τελευταίο
	node_swap(pqueue, 1, last_node);
	vector_remove_last(pqueue->values);

 	// Ολοι οι κόμβοι ικανοποιούν την ιδιότητα του σωρού εκτός από τη νέα ρίζα
 	// που μπορεί να είναι μικρότερη από κάποιο παιδί της. Αρα μπορούμε να
 	// επαναφέρουμε την ιδιότητα του σωρού καλώντας τη bubble_down για τη ρίζα.
	bubble_down(pqueue, 1);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
callq 0x4b28
testl %eax, %eax
je 0x49b2
movl %eax, %ebp
movq 0x10(%rbx), %r14
testq %r14, %r14
je 0x498d
movq (%rbx), %rdi
xorl %esi, %esi
callq 0x4b2c
movq %rax, %rdi
callq *%r14
movq %rbx, %rdi
movl $0x1, %esi
movl %ebp, %edx
callq 0x49d1
movq (%rbx), %rdi
callq 0x4bfa
movq %rbx, %rdi
movl $0x1, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x4a1e
leaq 0x1512(%rip), %rdi      # 0x5ecb
leaq 0x14a5(%rip), %rsi      # 0x5e65
leaq 0x1513(%rip), %rcx      # 0x5eda
movl $0x90, %edx
callq 0x2110
// File: /workspace/github_c_makefile_star2_O1/chatziko-k08[P]lecture-code/lib/../modules/UsingHeap/ADTPriorityQueue.c
// Function: node_swap
static void node_swap(PriorityQueue pqueue, int node_id1, int node_id2) {
	// τα node_ids είναι 1-based, το node_id αποθηκεύεται στη θέση node_id - 1
	Pointer value1 = node_value(pqueue, node_id1);
	Pointer value2 = node_value(pqueue, node_id2);

	vector_set_at(pqueue->values, node_id1 - 1, value2);
	vector_set_at(pqueue->values, node_id2 - 1, value1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %r14
movq (%rdi), %rdi
decl %ebp
movl %ebp, %esi
callq 0x4b2c
movq %rax, %r15
movq (%r14), %rdi
decl %ebx
movl %ebx, %esi
callq 0x4b2c
movq (%r14), %rdi
movl %ebp, %esi
movq %rax, %rdx
callq 0x4b5f
movq (%r14), %rdi
movl %ebx, %esi
movq %r15, %rdx
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x4b5f
// File: /workspace/github_c_makefile_star2_O1/chatziko-k08[P]lecture-code/lib/../modules/UsingHeap/ADTPriorityQueue.c
// Function: bubble_down
static void bubble_down(PriorityQueue pqueue, int node_id) {
	// βρίσκουμε τα παιδιά του κόμβου (αν δεν υπάρχουν σταματάμε)
	int left_child = 2 * node_id;
	int right_child = left_child + 1;

	int size = pqueue_size(pqueue);
	if (left_child > size)
		return;

	// βρίσκουμε το μέγιστο από τα 2 παιδιά
	int max_child = left_child;
	if (right_child <= size && pqueue->compare(node_value(pqueue, left_child), node_value(pqueue, right_child)) < 0)
			max_child = right_child;

	// Αν ο κόμβος είναι μικρότερος από το μέγιστο παιδί, swap και συνεχίζουμε προς τα κάτω
	if (pqueue->compare(node_value(pqueue, node_id), node_value(pqueue, max_child)) < 0) {
		node_swap(pqueue, node_id, max_child);
		bubble_down(pqueue, max_child);
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %esi, %r14d
movq %rdi, %rbx
leal (%r14,%r14), %r15d
movq (%rbx), %rdi
callq 0x4b28
cmpl %eax, %r15d
jg 0x4ab2
jge 0x4a70
movq (%rbx), %rdi
movq 0x8(%rbx), %r13
leal -0x1(%r15), %esi
callq 0x4b2c
movq %rax, %r12
movq (%rbx), %rdi
movl %r15d, %esi
callq 0x4b2c
movq %r12, %rdi
movq %rax, %rsi
callq *%r13
shrl $0x1f, %eax
orl %r15d, %eax
movl %eax, %r15d
movq (%rbx), %rdi
movq 0x8(%rbx), %r13
leal -0x1(%r14), %esi
callq 0x4b2c
movq %rax, %r12
movq (%rbx), %rdi
leal -0x1(%r15), %esi
callq 0x4b2c
movq %r12, %rdi
movq %rax, %rsi
callq *%r13
testl %eax, %eax
jns 0x4ab2
movq %rbx, %rdi
movl %r14d, %esi
movl %r15d, %edx
callq 0x49d1
movl %r15d, %r14d
jmp 0x4a2d
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/chatziko-k08[P]lecture-code/lib/../modules/UsingHeap/ADTPriorityQueue.c
// Function: pqueue_destroy
void pqueue_destroy(PriorityQueue pqueue) {
	// Αντί να κάνουμε εμείς destroy τα στοιχεία, είναι απλούστερο να
	// προσθέσουμε τη destroy_value στο vector ώστε να κληθεί κατά το vector_destroy.
	vector_set_destroy_value(pqueue->values, pqueue->destroy_value);
	vector_destroy(pqueue->values);

	free(pqueue);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
movq 0x10(%rbx), %rsi
callq 0x4cc9
movq (%rbx), %rdi
callq 0x4cd2
movq %rbx, %rdi
popq %rbx
jmp 0x22b0
nop
// File: /workspace/github_c_makefile_star2_O1/umbrant[P]Non-blocking-Buffers/nameserver_main.c
// Function: main
int main() 
{
	if(init_nameserver()) {
		printf("Error initializing nameserver, failing!\n");
		return -1;
	}

  signal(SIGUSR1, data_available);

	while(1) {
    sleep(1);
	}
}

// Assembly:
pushq %rax
xorl %eax, %eax
callq 0x1932
testl %eax, %eax
je 0x135b
leaq 0x1cb5(%rip), %rdi      # 0x3004
callq 0x1070
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rcx
retq
leaq 0x1312(%rip), %rsi      # 0x2674
movl $0xa, %edi
callq 0x1150
movl $0x1, %edi
callq 0x1230
jmp 0x136c
// File: /workspace/github_c_makefile_star2_O1/umbrant[P]Non-blocking-Buffers/nameserver.c
// Function: data_available
void data_available(int signum)
{
	char* recv;
  size_t recv_len;
	int retval = -1;
  int request_type;

	retval = nbb_read_item(CHANNEL_ID, (void**)&recv, &recv_len);

	// This is kind of a hack
	// Do an extra resize and copy to null terminate
	char* recv_str = (char*)calloc(recv_len+1, sizeof(char));
	memcpy(recv_str, recv, recv_len);
	recv_str[recv_len] = '\0';
 
printf("nameserver recv: %s\n", recv_str);

  request_type = atoi(strtok(recv_str, " "));
  handle_connection[request_type](strtok(NULL, ""));

  signal(SIGUSR1, data_available);
  free(recv);
  free(recv_str);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
leaq 0x10(%rsp), %rbx
leaq 0x8(%rsp), %r14
xorl %edi, %edi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x1828
movq (%r14), %r15
leaq 0x1(%r15), %rdi
movl $0x1, %esi
callq 0x1100
movq %rax, %r14
movq (%rbx), %rsi
movq %rax, %rdi
movq %r15, %rdx
callq 0x1140
movb $0x0, (%r14,%r15)
leaq 0x12ed(%rip), %rdi      # 0x39b1
movq %r14, %rsi
xorl %eax, %eax
callq 0x10c0
leaq 0xa70(%rip), %rsi       # 0x3145
movq %r14, %rdi
callq 0x11d0
movq %rax, %rdi
callq 0x1200
movslq %eax, %r15
leaq 0x36f1(%rip), %r12      # 0x5de0
leaq 0xce8(%rip), %rsi       # 0x33de
xorl %edi, %edi
callq 0x11d0
movq %rax, %rdi
callq *(%r12,%r15,8)
leaq -0x97(%rip), %rsi       # 0x2674
movl $0xa, %edi
callq 0x1150
movq (%rbx), %rdi
callq 0x1030
movq %r14, %rdi
callq 0x1030
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq