LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/tylerneylon[P]APIsWithLua/ch6/limit_cpu.c
// Function: main
int main() {
  lua_State *L = luaL_newstate();
  luaL_openlibs(L);
  lua_sethook(L, hook, LUA_MASKCOUNT, instructions_per_hook);

  print_status();
  while (accept_and_run_a_line(L)) print_status();

  lua_close(L);
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
callq 0x14b71
movq %rax, %rbx
movq %rax, %rdi
callq 0x14d74
movl 0x29a3a(%rip), %ecx     # 0x2e2a8
leaq -0x89(%rip), %rsi       # 0x47ec
movq %rbx, %rdi
movl $0x8, %edx
callq 0x635c
movq 0x29a4f(%rip), %rsi     # 0x2e2d8
leaq 0x1c78e(%rip), %rdi     # 0x2101e
xorl %eax, %eax
callq 0x4170
movq %rbx, %rdi
callq 0x203c4
testl %eax, %eax
je 0x48c7
leaq 0x1c774(%rip), %r14     # 0x2101e
movq 0x29a27(%rip), %rsi     # 0x2e2d8
movq %r14, %rdi
xorl %eax, %eax
callq 0x4170
movq %rbx, %rdi
callq 0x203c4
testl %eax, %eax
jne 0x48aa
movq %rbx, %rdi
callq 0xe27b
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O3/theandrew168[P]skylark/src/chip8.c
// Function: chip8_init
int
chip8_init(struct chip8* chip8)
{
    assert(chip8 != NULL);

    memset(chip8, 0, sizeof(*chip8));
    srand(time(NULL));

    memmove(chip8->mem, CHIP8_FONT, sizeof(CHIP8_FONT));

    return CHIP8_OK;
}

// Assembly:
pushq %rbx
testq %rdi, %rdi
je 0x278f
movq %rdi, %rbx
movl $0x1848, %edx           # imm = 0x1848
xorl %esi, %esi
callq 0x20c0
xorl %edi, %edi
callq 0x2120
movl %eax, %edi
callq 0x2140
leaq 0x1a72(%rip), %rsi      # 0x41f0
movl $0x50, %edx
movq %rbx, %rdi
callq 0x2100
xorl %eax, %eax
popq %rbx
retq
leaq 0x1985(%rip), %rdi      # 0x411b
leaq 0x198c(%rip), %rsi      # 0x4129
leaq 0x1991(%rip), %rcx      # 0x4135
movl $0x29, %edx
callq 0x20e0
// File: /workspace/github_c_makefile_star2_O3/theandrew168[P]skylark/src/chip8.c
// Function: chip8_load
int
chip8_load(struct chip8* chip8, const uint8_t* rom, long size)
{
    assert(rom != NULL);

    if (CHIP8_ROM_ADDR + size >= CHIP8_MEM_SIZE) {
        return CHIP8_ERROR_OVERSIZED_ROM;
    }

    memmove(chip8->mem + CHIP8_ROM_ADDR, rom, size);
    chip8->pc = CHIP8_ROM_ADDR;

    return CHIP8_OK;
}

// Assembly:
pushq %rbx
testq %rsi, %rsi
je 0x27de
movl $0x1, %eax
cmpq $0xdff, %rdx            # imm = 0xDFF
jg 0x27dc
movq %rdi, %rbx
addq $0x200, %rdi            # imm = 0x200
callq 0x21d0
movw $0x200, 0x1012(%rbx)    # imm = 0x200
xorl %eax, %eax
popq %rbx
retq
leaq 0x196f(%rip), %rdi      # 0x4154
leaq 0x193d(%rip), %rsi      # 0x4129
leaq 0x196d(%rip), %rcx      # 0x4160
movl $0x36, %edx
callq 0x20e0
// File: /workspace/github_c_makefile_star2_O3/theandrew168[P]skylark/src/chip8.c
// Function: chip8_step
int
chip8_step(struct chip8* chip8)
{
    uint16_t code = chip8->mem[chip8->pc] << 8 | chip8->mem[chip8->pc + 1];

    struct instruction inst = { 0 };
    int rc = instruction_decode(&inst, code);
    if (rc != INSTRUCTION_OK) {
        fprintf(stderr, "attempted to decode a bad instruction\n");
        return CHIP8_ERROR_BAD_INSTRUCTION;
    }

    rc = operation_apply(chip8, &inst);
    if (rc != OPERATION_OK) {
        fprintf(stderr, "attempted to execute a bad operation: %s\n", operation_error_message(rc));
        return CHIP8_ERROR_BAD_OPERATION;
    }

    if (chip8->timer_delay > 0) chip8->timer_delay -= 1;
    if (chip8->timer_sound > 0) chip8->timer_sound -= 1;

    return CHIP8_OK;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movzwl 0x1012(%rdi), %eax
movzwl (%rdi,%rax), %eax
rolw $0x8, %ax
movq %rsp, %rdi
movl $0x0, 0x8(%rdi)
movq $0x0, (%rdi)
movzwl %ax, %esi
callq 0x28ac
testl %eax, %eax
jne 0x286c
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x2948
testl %eax, %eax
jne 0x2878
movb 0x1846(%rbx), %al
testb %al, %al
je 0x2852
decb %al
movb %al, 0x1846(%rbx)
movb 0x1847(%rbx), %cl
xorl %eax, %eax
testb %cl, %cl
je 0x2866
decb %cl
movb %cl, 0x1847(%rbx)
addq $0x10, %rsp
popq %rbx
retq
callq 0x2335
movl $0x2, %eax
jmp 0x2866
movl %eax, %edi
callq 0x2357
movl $0x3, %eax
jmp 0x2866
// File: /workspace/github_c_makefile_star2_O3/theandrew168[P]skylark/src/inst.c
// Function: instruction_decode
int
instruction_decode(struct instruction* inst, uint16_t code)
{
    // params can be set now since their position is consistent
    inst->opcode = OPCODE_UNDEFINED;
    inst->nnn = code & 0x0fff;
    inst->n = code & 0x000f;
    inst->x = (code & 0x0f00) >> 8;
    inst->y = (code & 0x00f0) >> 4;
    inst->kk = code & 0x00ff;

    // loop through each opcode and try to find a match
    for (int op = OPCODE_UNDEFINED + 1; op < OPCODE_COUNT; op++) {
        // check for a match by masking the code and comparing the values
        if ((code & INSTRUCTION_MASKS[op].mask) == INSTRUCTION_MASKS[op].value) {
            inst->opcode = op;
            return INSTRUCTION_OK;
        }
    }

    // if nothing matched from the above loop then the code is invalid
    return INSTRUCTION_ERROR;
}

// Assembly:
movl $0x0, (%rdi)
movl %esi, %eax
andl $0xfff, %eax            # imm = 0xFFF
movw %ax, 0x4(%rdi)
movl %esi, %eax
andb $0xf, %al
movb %al, 0x6(%rdi)
movl %esi, %eax
shrl $0x8, %eax
andb $0xf, %al
movb %al, 0x7(%rdi)
movl %esi, %eax
shrb $0x4, %al
movb %al, 0x8(%rdi)
movb %sil, 0x9(%rdi)
cmpl $0xe0, %esi
jne 0x28eb
xorl %eax, %eax
movl $0x1, %ecx
jmp 0x291e
xorl %eax, %eax
leaq 0x194c(%rip), %rdx      # 0x4240
cmpq $0x22, %rax
je 0x2921
movzwl 0x8(%rdx,%rax,4), %r8d
andw %si, %r8w
leaq 0x1(%rax), %rcx
cmpw 0xa(%rdx,%rax,4), %r8w
movq %rcx, %rax
jne 0x28f4
xorl %eax, %eax
cmpq $0x23, %rcx
setae %al
incl %ecx
movl %ecx, (%rdi)
retq
movl $0x1, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/theandrew168[P]skylark/src/op.c
// Function: operation_apply
int
operation_apply(struct chip8* chip8, const struct instruction* inst)
{
    assert(chip8 != NULL);
    assert(inst != NULL);

    operation_func operation = OPERATIONS[inst->opcode];
    return operation(chip8, inst);
}

// Assembly:
pushq %rax
testq %rdi, %rdi
je 0x2961
testq %rsi, %rsi
je 0x2980
movslq (%rsi), %rax
leaq 0x4363(%rip), %rcx      # 0x6cc0
popq %rdx
jmpq *(%rcx,%rax,8)
leaq 0x17b3(%rip), %rdi      # 0x411b
leaq 0x1c41(%rip), %rsi      # 0x45b0
leaq 0x1c43(%rip), %rcx      # 0x45b9
movl $0x17d, %edx            # imm = 0x17D
callq 0x20e0
leaq 0x1c72(%rip), %rdi      # 0x45f9
leaq 0x1c22(%rip), %rsi      # 0x45b0
leaq 0x1c24(%rip), %rcx      # 0x45b9
movl $0x17e, %edx            # imm = 0x17E
callq 0x20e0
// File: /workspace/github_c_makefile_star2_O3/theandrew168[P]skylark/src/op.c
// Function: operation_RET_00EE
static int
operation_RET_00EE(struct chip8* chip8, const struct instruction* inst)
{
    if (chip8->sp <= 0) return OPERATION_ERROR_STACK_UNDERFLOW;

    chip8->sp -= 1;
    chip8->pc = chip8->stack[chip8->sp];
    chip8->pc += 2;
    return OPERATION_OK;
}

// Assembly:
movzwl 0x1034(%rdi), %eax
testw %ax, %ax
je 0x2a13
decl %eax
movw %ax, 0x1034(%rdi)
movzwl %ax, %eax
movzwl 0x1014(%rdi,%rax,2), %eax
addl $0x2, %eax
movw %ax, 0x1012(%rdi)
xorl %eax, %eax
retq
movl $0x4, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/theandrew168[P]skylark/src/op.c
// Function: operation_CALL_2nnn
static int
operation_CALL_2nnn(struct chip8* chip8, const struct instruction* inst)
{
    if (chip8->sp >= CHIP8_STACK_SIZE - 1) return OPERATION_ERROR_STACK_OVERFLOW;

    chip8->stack[chip8->sp] = chip8->pc;
    chip8->sp += 1;
    chip8->pc = inst->nnn;
    return OPERATION_OK;
}

// Assembly:
movzwl 0x1034(%rdi), %ecx
movl $0x3, %eax
cmpq $0xe, %rcx
ja 0x2a6a
movzwl 0x1012(%rdi), %eax
movw %ax, 0x1014(%rdi,%rcx,2)
incw 0x1034(%rdi)
movzwl 0x4(%rsi), %eax
movw %ax, 0x1012(%rdi)
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/theandrew168[P]skylark/src/op.c
// Function: operation_DRW_Dxyn
static int
operation_DRW_Dxyn(struct chip8* chip8, const struct instruction* inst)
{
    chip8->reg[CHIP8_REG_VF] = 0;
    for (long dy = 0; dy < inst->n; dy++) {
        uint8_t sprite = chip8->mem[chip8->index + dy];
        for (long dx = 0; dx < CHIP8_SPRITE_WIDTH; dx++) {
            // account for pixels wrapping around edges of the display
            long x = (chip8->reg[inst->x] + dx) % CHIP8_DISPLAY_WIDTH;
            long y = (chip8->reg[inst->y] + dy) % CHIP8_DISPLAY_HEIGHT;

            // chip8->display is stored as a row-major matrix
            long pixel_index = (y * CHIP8_DISPLAY_WIDTH) + x;

            // determine what the resulting pixel value will be
            bool new_pixel = sprite & (0x80 >> dx);
            bool old_pixel = chip8->display[pixel_index];
            bool resulting_pixel = new_pixel ^ old_pixel;

            // set VF register to 1 if a pixel gets turned off
            if (old_pixel && !resulting_pixel) chip8->reg[CHIP8_REG_VF] = 1;

            chip8->display[pixel_index] = resulting_pixel;
        }
    }
    chip8->pc += 2;
    return OPERATION_OK;
}

// Assembly:
movb $0x0, 0x100f(%rdi)
cmpb $0x0, 0x6(%rsi)
je 0x2df0
pushq %rbx
movzwl 0x1010(%rdi), %eax
xorl %edx, %edx
leaq (%rdx,%rax), %rcx
movzbl (%rdi,%rcx), %r8d
xorl %ecx, %ecx
movzbl 0x7(%rsi), %r9d
movzbl 0x1000(%rdi,%r9), %r10d
addl %ecx, %r10d
andl $0x3f, %r10d
movzbl 0x8(%rsi), %r9d
movzbl 0x1000(%rdi,%r9), %r9d
addl %edx, %r9d
andl $0x1f, %r9d
shll $0x6, %r9d
orl %r10d, %r9d
movl %r8d, %r10d
shll %cl, %r10d
movb 0x1046(%rdi,%r9), %bl
shrb $0x7, %r10b
cmpb %r10b, %bl
setne %r11b
cmpb $0x1, %bl
jne 0x2dce
cmpb %r10b, %bl
jne 0x2dce
movb $0x1, 0x100f(%rdi)
movb %r11b, 0x1046(%rdi,%r9)
incq %rcx
cmpq $0x8, %rcx
jne 0x2d73
incq %rdx
movzbl 0x6(%rsi), %ecx
cmpq %rcx, %rdx
jb 0x2d68
popq %rbx
addw $0x2, 0x1012(%rdi)
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/theandrew168[P]skylark/src/op.c
// Function: operation_LD_Fx55
static int
operation_LD_Fx55(struct chip8* chip8, const struct instruction* inst)
{
    for (long i = 0; i < inst->x; i++) {
        chip8->mem[chip8->index + i] = chip8->reg[i];
    }
    chip8->pc += 2;
    return OPERATION_OK;
}

// Assembly:
cmpb $0x0, 0x7(%rsi)
je 0x2fd1
xorl %eax, %eax
leaq (%rdi,%rax), %rcx
movb 0x1000(%rdi,%rax), %dl
movzwl 0x1010(%rdi), %r8d
movb %dl, (%r8,%rcx)
incq %rax
movzbl 0x7(%rsi), %ecx
cmpq %rcx, %rax
jb 0x2fae
addw $0x2, 0x1012(%rdi)
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/theandrew168[P]skylark/src/op.c
// Function: operation_LD_Fx65
static int
operation_LD_Fx65(struct chip8* chip8, const struct instruction* inst)
{
    for (long i = 0; i < inst->x; i++) {
        chip8->reg[i] = chip8->mem[chip8->index + i];
    }
    chip8->pc += 2;
    return OPERATION_OK;
}

// Assembly:
cmpb $0x0, 0x7(%rsi)
je 0x3005
xorl %eax, %eax
movzwl 0x1010(%rdi), %ecx
leaq (%rdi,%rax), %rdx
movb (%rcx,%rdx), %cl
movb %cl, 0x1000(%rdi,%rax)
incq %rax
movzbl 0x7(%rsi), %ecx
cmpq %rcx, %rax
jb 0x2fe4
addw $0x2, 0x1012(%rdi)
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/albinoloverats[P]hide/src/tiff.c
// Function: init
extern image_type_t *init(void)
{
	static image_type_t tiff;
	tiff.type = "TIFF";
	tiff.is_type = is_tiff;
	tiff.read = read_tiff;
	tiff.write = write_tiff;
	tiff.info = info_tiff;
	tiff.free = free_tiff;
	return &tiff;
}

// Assembly:
leaq 0xe3d(%rip), %rax       # 0x2000
movq %rax, 0x2ebe(%rip)      # 0x4088
leaq 0x2eb7(%rip), %rax      # 0x4088
leaq 0x40(%rip), %rcx        # 0x1218
movq %rcx, 0x2eb1(%rip)      # 0x4090
leaq 0x6b(%rip), %rcx        # 0x1251
movq %rcx, 0x2eab(%rip)      # 0x4098
leaq 0x14b(%rip), %rcx       # 0x133f
movq %rcx, 0x2ea5(%rip)      # 0x40a0
leaq 0x2b9(%rip), %rcx       # 0x14bb
movq %rcx, 0x2e9f(%rip)      # 0x40a8
leaq 0x2c5(%rip), %rcx       # 0x14d5
movq %rcx, 0x2e99(%rip)      # 0x40b0
retq
// File: /workspace/github_c_makefile_star2_O3/albinoloverats[P]hide/src/tiff.c
// Function: write_tiff
static int write_tiff(image_info_t image_info, void (*progress_update)(uint64_t, uint64_t))
{
	errno = EXIT_SUCCESS;

	TIFF *tif = TIFFOpen(image_info.file, "w");
	if (!tif)
		return errno;

	TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, image_info.width);
	TIFFSetField(tif, TIFFTAG_IMAGELENGTH, image_info.height);
	TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, image_info.bpp);
	TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_LZW);

	TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8);
	TIFFSetField(tif, TIFFTAG_RESOLUTIONUNIT, RESUNIT_CENTIMETER);
	TIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
	TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
	TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);

	TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, TIFFDefaultStripSize(tif, image_info.width * image_info.bpp));

	for (uint64_t y = 0; y < image_info.height; y++)
	{
		TIFFWriteScanline(tif, image_info.buffer[y], y, 0);
		free(image_info.buffer[y]);
		if (progress_update)
			progress_update(y, image_info.height);
	}
	free(image_info.buffer);

	TIFFClose(tif);

	return errno;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
callq 0x1040
movq %rax, %rbx
movl $0x0, (%rax)
movq 0x40(%rsp), %rdi
leaq 0xca0(%rip), %rsi       # 0x2007
callq 0x1050
testq %rax, %rax
je 0x14aa
movq %rax, %r15
movq %rbx, (%rsp)
leaq 0x40(%rsp), %rbp
movq 0x30(%rbp), %r13
movq %rax, %rdi
movl $0x100, %esi            # imm = 0x100
movq %r13, %rdx
xorl %eax, %eax
callq 0x1080
movq 0x28(%rbp), %r12
movq %r15, %rdi
movl $0x101, %esi            # imm = 0x101
movq %r12, %rdx
xorl %eax, %eax
callq 0x1080
movzwl 0x38(%rbp), %ebx
movq %r15, %rdi
movl $0x115, %esi            # imm = 0x115
movl %ebx, %edx
xorl %eax, %eax
callq 0x1080
movq %r15, %rdi
movl $0x103, %esi            # imm = 0x103
movl $0x5, %edx
xorl %eax, %eax
callq 0x1080
movq %r15, %rdi
movl $0x102, %esi            # imm = 0x102
movl $0x8, %edx
xorl %eax, %eax
callq 0x1080
movq %r15, %rdi
movl $0x128, %esi            # imm = 0x128
movl $0x3, %edx
xorl %eax, %eax
callq 0x1080
movq %r15, %rdi
movl $0x112, %esi            # imm = 0x112
movl $0x1, %edx
xorl %eax, %eax
callq 0x1080
movq %r15, %rdi
movl $0x11c, %esi            # imm = 0x11C
movl $0x1, %edx
xorl %eax, %eax
callq 0x1080
movq %r15, %rdi
movl $0x106, %esi            # imm = 0x106
movl $0x2, %edx
xorl %eax, %eax
callq 0x1080
imull %ebx, %r13d
movq %r15, %rdi
movl %r13d, %esi
callq 0x1060
movq %r15, %rdi
movl $0x116, %esi            # imm = 0x116
movl %eax, %edx
xorl %eax, %eax
callq 0x1080
movq 0x40(%rbp), %r13
testq %r12, %r12
je 0x1496
xorl %ebp, %ebp
movq (%r13,%rbp,8), %rsi
movq %r15, %rdi
movl %ebp, %edx
xorl %ecx, %ecx
callq 0x10c0
movq (%r13,%rbp,8), %rdi
callq 0x1030
testq %r14, %r14
je 0x148e
movq %rbp, %rdi
movq %r12, %rsi
callq *%r14
incq %rbp
cmpq %rbp, %r12
jne 0x1465
movq %r13, %rdi
callq 0x1030
movq %r15, %rdi
callq 0x10d0
movq (%rsp), %rbx
movl (%rbx), %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_log_init
bool ce_log_init(const char* filename){
     g_ce_log = fopen(filename, "wa");
     if(!g_ce_log){
          fprintf(stderr, "error: unable to create ce log: fopen(\"%s\", \"wa\") failed: '%s'\n", filename, strerror(errno));
          return false;
     }

     static const char* greetings [] = {
          "Thank you for flying ce",
          "There's nothing like a fresh cup of ce in the morning",
          "Why do kids love the taste of C Editor?\n\nIt's the taste you can ce",
          "ce is for C Editor, that's good enough for me",
          "I missed you.",
          "Hope you're having a great day! -ce",
          "You're a special person -- or robot. I don't judge.",
          "I missed you... in a creepy way.",
          "I'm a potato",
          "At least this isn't emacs? Am I right!",
          "TACOCAT is the best palindrome",
          "Found a bug? It's a feature.",
          "Yo.",
          "Slurp'n up whitespace since 2016",
          "Welcome to GNU Emacs, one component of the GNU/Linux operating system.",
          "ce, the world's only editor with a Michelin star.",
          "Oy! ce's a beaut!",
          "The default config has a great vimplementation!",
          "They see me slurpin' They hatin'",
          "'Days of pain are worth the years of upcoming prosperity' -confucius, probably",
          "ce, aka, 'the cache miss king'",
          "All the terminal you want with none of the illness",
          "I used ce before it was cool",
          "'Where has this been all my life' -emacs enthusiast",
     };

     srand(time(NULL));
     ce_log("%s\n", greetings[rand() % (sizeof(greetings) / sizeof(greetings[0]))]);
     return true;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
leaq 0x1f82a(%rip), %rsi     # 0x2d104
callq 0xd5b0
movq %rax, %rbx
movq %rax, 0x2d207(%rip)     # 0x3aaf0
testq %rax, %rax
je 0xd94a
xorl %edi, %edi
callq 0xd450
movl %eax, %edi
callq 0xd370
callq 0xd710
movslq %eax, %rcx
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
movq %rcx, %rax
mulq %rdx
shrq $0x4, %rdx
shll $0x3, %edx
leal (%rdx,%rdx,2), %eax
subl %eax, %ecx
leaq 0x1f77d(%rip), %rax     # 0x2d0a4
movslq (%rax,%rcx,4), %rsi
addq %rax, %rsi
leaq 0x2301c(%rip), %rdi     # 0x30951
xorl %eax, %eax
callq 0xd954
testq %rbx, %rbx
setne %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %r14, %rdi
callq 0xd760
jmp 0xd93c
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_log
void ce_log(const char* fmt, ...){
     va_list args;
     va_start(args, fmt);
     size_t string_len = vsnprintf(g_log_string, BUFSIZ, fmt, args);
     va_end(args);

#if defined(PLATFORM_WINDOWS)
     printf("%s", g_log_string);
#else
     fwrite(g_log_string, string_len, 1, g_ce_log);
#endif
     CePoint_t end = ce_buffer_end_point(g_ce_log_buffer);
     g_ce_log_buffer->status = CE_BUFFER_STATUS_NONE;
     ce_buffer_insert_string(g_ce_log_buffer, g_log_string, end);
     g_ce_log_buffer->status = CE_BUFFER_STATUS_READONLY;
}

// Assembly:
pushq %rbx
subq $0xd0, %rsp
movq %rdi, %r10
leaq 0x20(%rsp), %rdi
movq %rsi, 0x8(%rdi)
movq %rdx, 0x10(%rdi)
movq %rcx, 0x18(%rdi)
movq %r8, 0x20(%rdi)
movq %r9, 0x28(%rdi)
testb %al, %al
je 0xd9b3
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
movq %rsp, %rcx
movq %rdi, 0x10(%rcx)
leaq 0xe0(%rsp), %rax
movq %rax, 0x8(%rcx)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%rcx)
leaq 0x2d126(%rip), %rbx     # 0x3ab00
movl $0x2000, %esi           # imm = 0x2000
movq %rbx, %rdi
movq %r10, %rdx
callq 0xd180
movslq %eax, %rsi
movq 0x2d0fc(%rip), %rcx     # 0x3aaf0
movl $0x1, %edx
movq %rbx, %rdi
callq 0xd610
movq 0x2d0f0(%rip), %rdi     # 0x3aaf8
callq 0xda40
movq %rdx, %rcx
movq 0x2d0e1(%rip), %rdi     # 0x3aaf8
movl $0x0, 0x18(%rdi)
movq %rbx, %rsi
movq %rax, %rdx
callq 0xda6e
movq 0x2d0c8(%rip), %rax     # 0x3aaf8
movl $0x2, 0x18(%rax)
addq $0xd0, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_buffer_end_point
CePoint_t ce_buffer_end_point(CeBuffer_t* buffer){
     CePoint_t point = {0, buffer->line_count};
     if(point.y > 0){
          point.y--;
          point.x = ce_utf8_last_index(buffer->lines[point.y]);
     }
     return point;
}

// Assembly:
pushq %rbx
movq 0x8(%rdi), %rbx
testq %rbx, %rbx
jle 0xda67
movq (%rdi), %rax
movq -0x8(%rax,%rbx,8), %rdi
decq %rbx
callq 0xe445
xorl %ecx, %ecx
testq %rax, %rax
setg %cl
subq %rcx, %rax
jmp 0xda69
xorl %eax, %eax
movq %rbx, %rdx
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_buffer_alloc
bool ce_buffer_alloc(CeBuffer_t* buffer, int64_t line_count, const char* name){
     if(buffer->lines) ce_buffer_free(buffer);

     if(line_count <= 0){
          ce_log("%s() error: 0 line_count specified.\n", __FUNCTION__);
          return false;
     }

     buffer->lines = (char**)malloc(line_count * sizeof(*buffer->lines));
     if(!buffer->lines){
          ce_log("%s() failed to malloc() %ld lines.\n", __FUNCTION__, line_count);
          return false;
     }

     buffer->line_count = line_count;
     buffer->name = strdup(name);

     for(int64_t i = 0; i < line_count; i++){
          buffer->lines[i] = (char*)calloc(1, sizeof(buffer->lines[i]));
     }

     buffer->status = CE_BUFFER_STATUS_MODIFIED;
     return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
cmpq $0x0, (%rdi)
je 0xde10
movq %r14, %rdi
callq 0xdea8
testq %rbx, %rbx
jle 0xde68
leaq (,%rbx,8), %rdi
callq 0xd4c0
movq %rax, (%r14)
testq %rax, %rax
je 0xde81
movq %rbx, 0x8(%r14)
movq %r15, %rdi
callq 0xd640
movq %rax, 0x10(%r14)
xorl %r15d, %r15d
movl $0x1, %edi
movl $0x8, %esi
callq 0xd380
movq (%r14), %rcx
movq %rax, (%rcx,%r15,8)
incq %r15
cmpq %r15, %rbx
jne 0xde3d
movl $0x1, 0x18(%r14)
movb $0x1, %bpl
jmp 0xde9b
leaq 0x1f681(%rip), %rdi     # 0x2d4f0
leaq 0x1f69f(%rip), %rsi     # 0x2d515
xorl %ebp, %ebp
xorl %eax, %eax
callq 0xd954
jmp 0xde9b
leaq 0x1f69d(%rip), %rdi     # 0x2d525
leaq 0x1f686(%rip), %rsi     # 0x2d515
xorl %ebp, %ebp
movq %rbx, %rdx
xorl %eax, %eax
callq 0xd954
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_buffer_free
void ce_buffer_free(CeBuffer_t* buffer){
     for(int64_t i = 0; i < buffer->line_count; i++){
          free(buffer->lines[i]);
     }

     free(buffer->lines);
     free(buffer->name);

     if(buffer->change_node){
          CeBufferChangeNode_t* head = buffer->change_node;
          while(head->prev) head = head->prev;
          ce_buffer_change_node_free(&head);
     }

     memset(buffer, 0, sizeof(*buffer));
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpq $0x0, 0x8(%rdi)
jle 0xdece
xorl %r14d, %r14d
movq (%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0xd090
incq %r14
cmpq 0x8(%rbx), %r14
jl 0xdeb9
movq (%rbx), %rdi
callq 0xd090
movq 0x10(%rbx), %rdi
callq 0xd090
movq 0x40(%rbx), %rax
testq %rax, %rax
je 0xdeff
movq %rax, %rcx
movq 0x48(%rax), %rax
testq %rax, %rax
jne 0xdee8
movq %rsp, %rdi
movq %rcx, (%rdi)
callq 0xdf25
xorps %xmm0, %xmm0
movups %xmm0, 0x60(%rbx)
movups %xmm0, 0x50(%rbx)
movups %xmm0, 0x40(%rbx)
movups %xmm0, 0x30(%rbx)
movups %xmm0, 0x20(%rbx)
movups %xmm0, 0x10(%rbx)
movups %xmm0, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_buffer_change_node_free
static void ce_buffer_change_node_free(CeBufferChangeNode_t** head){
     CeBufferChangeNode_t* itr = *head;
     while(itr){
          CeBufferChangeNode_t* tmp = itr;
          itr = itr->next;
          free(tmp->change.string);
          free(tmp);
     }

     *head = NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %r14
testq %r14, %r14
je 0xdf52
movq 0x8(%r14), %rdi
movq 0x40(%r14), %r15
callq 0xd090
movq %r14, %rdi
callq 0xd090
movq %r15, %r14
testq %r15, %r15
jne 0xdf35
movq $0x0, (%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_util_count_string_lines
int64_t ce_util_count_string_lines(const char* string){
     int64_t string_length = strlen(string);
     int64_t line_count = 0;
     for(int64_t i = 0; i <= string_length; ++i){
          if(string[i] == CE_NEWLINE || string[i] == 0) line_count++;
     }

     return line_count;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0xd210
testq %rax, %rax
js 0xe2a8
incq %rax
xorl %edx, %edx
xorl %ecx, %ecx
movzbl (%rbx,%rdx), %esi
cmpl $0xa, %esi
je 0xe29b
testl %esi, %esi
jne 0xe29e
incq %rcx
incq %rdx
cmpq %rdx, %rax
jne 0xe28e
jmp 0xe2aa
xorl %ecx, %ecx
movq %rcx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_buffer_save
bool ce_buffer_save(CeBuffer_t* buffer){
     FILE* file = fopen(buffer->name, "wb");
     if(!file){
          ce_log("%s() fopen('%s', 'wb') failed: '%s'\n", __FUNCTION__, buffer->name, strerror(errno));
          return false;
     }

     char newline = CE_NEWLINE;
     for(int64_t i = 0; i < buffer->line_count; ++i){
          int64_t line_len = strlen(buffer->lines[i]);
          fwrite(buffer->lines[i], 1, line_len, file);
          fwrite(&newline, 1, 1, file);
     }

     fclose(file);
     if(buffer->status == CE_BUFFER_STATUS_MODIFIED) buffer->status = CE_BUFFER_STATUS_NONE;
     buffer->save_at_change_node = buffer->change_node;

     struct stat statbuf;
     if(stat(buffer->name, &statbuf) == 0){
          buffer->file_modified_time = statbuf.st_mtime;
     }

     return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdi, %r14
movq 0x10(%rdi), %rdi
leaq 0x1f34d(%rip), %rsi     # 0x2d618
callq 0xd5b0
movq %rax, %rbx
testq %rax, %rax
je 0xe356
cmpq $0x0, 0x8(%r14)
jle 0xe31a
xorl %r12d, %r12d
movq (%r14), %rax
movq (%rax,%r12,8), %r15
movq %r15, %rdi
callq 0xd210
movl $0x1, %esi
movq %r15, %rdi
movq %rax, %rdx
movq %rbx, %rcx
callq 0xd610
movl $0xa, %edi
movq %rbx, %rsi
callq 0xd330
incq %r12
cmpq 0x8(%r14), %r12
jl 0xe2e2
movq %rbx, %rdi
callq 0xd1f0
cmpl $0x1, 0x18(%r14)
jne 0xe331
movl $0x0, 0x18(%r14)
movq 0x40(%r14), %rax
movq %rax, 0x48(%r14)
movq 0x10(%r14), %rdi
leaq 0x8(%rsp), %rsi
callq 0xd3f0
testl %eax, %eax
jne 0xe381
movq 0x60(%rsp), %rax
movq %rax, 0x68(%r14)
jmp 0xe381
movq 0x10(%r14), %r14
callq 0xd0a0
movl (%rax), %edi
callq 0xd650
leaq 0x1f2ae(%rip), %rdi     # 0x2d61b
leaq 0x1f2cc(%rip), %rsi     # 0x2d640
movq %r14, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0xd954
testq %rbx, %rbx
setne %al
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_buffer_empty
bool ce_buffer_empty(CeBuffer_t* buffer){
     if(buffer->lines == NULL) return false;

     // free all lines after the first
     for(int64_t i = 0; i < buffer->line_count; ++i){
          free(buffer->lines[i]);
     }

     // re allocate it down to a single blank line
     buffer->lines = realloc(buffer->lines, sizeof(*buffer->lines));
     buffer->lines[0] = malloc(sizeof(buffer->lines[0]));
     buffer->lines[0][0] = 0;
     buffer->line_count = 1;
     buffer->status = CE_BUFFER_STATUS_NONE;

     return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq (%rdi), %r15
testq %r15, %r15
je 0xe3fa
movq %rdi, %rbx
cmpq $0x0, 0x8(%rdi)
movq %r15, %rdi
jle 0xe3cb
xorl %r14d, %r14d
movq (%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0xd090
incq %r14
cmpq 0x8(%rbx), %r14
jl 0xe3b3
movq (%rbx), %rdi
movl $0x8, %esi
callq 0xd520
movq %rax, %r14
movq %rax, (%rbx)
movl $0x8, %edi
callq 0xd4c0
movq %rax, (%r14)
movb $0x0, (%rax)
movq $0x1, 0x8(%rbx)
movl $0x0, 0x18(%rbx)
testq %r15, %r15
setne %al
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_buffer_contains_point
bool ce_buffer_contains_point(CeBuffer_t* buffer, CePoint_t point){
     if(point.y < 0 || point.y >= buffer->line_count || point.x < 0) return false;
     int64_t line_len = ce_utf8_strlen(buffer->lines[point.y]);
     if(point.x >= line_len){
          if(line_len == 0 && point.x == 0){
               return true;
          }
          return false;
     }

     return true;
}

// Assembly:
testq %rdx, %rdx
js 0xe424
pushq %rbx
movq %rsi, %rbx
cmpq %rdx, 0x8(%rdi)
setle %al
testq %rsi, %rsi
sets %cl
orb %al, %cl
je 0xe427
xorl %eax, %eax
jmp 0xe443
xorl %eax, %eax
retq
movq (%rdi), %rax
movq (%rax,%rdx,8), %rdi
callq 0xe445
movq %rax, %rcx
movb $0x1, %al
cmpq %rbx, %rcx
jg 0xe443
orq %rbx, %rcx
sete %al
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_utf8_strlen
int64_t ce_utf8_strlen(const char* string){
     int64_t len = 0;
     int64_t byte_count = 0;

     while(*string){
          if((*string & 0x80) == 0){
               byte_count = 1;
          }else if((*string & 0xE0) == 0xC0){
               byte_count = 2;
          }else if((*string & 0xF0) == 0xE0){
               byte_count = 3;
          }else if((*string & 0xF8) == 0xF0){
               byte_count = 4;
          }else{
               assert(!"unicode character claiming it has more than 4 bytes?!");
               return -1;
          }

          // validate string doesn't early terminate
          for(int64_t i = 0; i < byte_count; i++){
               if(*string == 0) return -1;
               string++;
          }

          len++;
     }

     return len;
}

// Assembly:
pushq %rax
movb (%rdi), %dl
xorl %eax, %eax
testb %dl, %dl
je 0xe4b3
movl $0x1, %ecx
testb %dl, %dl
jns 0xe48e
movzbl %dl, %edx
movl %edx, %esi
andl $-0x20, %esi
movl $0x2, %ecx
cmpl $0xc0, %esi
je 0xe48e
movl %edx, %esi
andl $-0x10, %esi
movl $0x3, %ecx
cmpl $0xe0, %esi
je 0xe48e
andl $-0x8, %edx
movl $0x4, %ecx
cmpl $0xf0, %edx
jne 0xe4b5
leaq (%rdi,%rcx), %rsi
xorl %edx, %edx
cmpb $0x0, (%rdi,%rdx)
je 0xe4ac
incq %rdx
cmpq %rdx, %rcx
jne 0xe494
incq %rax
movb (%rsi), %dl
movq %rsi, %rdi
jmp 0xe44a
movq $-0x1, %rax
popq %rcx
retq
leaq 0x1f26b(%rip), %rdi     # 0x2d727
leaq 0x1f1b5(%rip), %rsi     # 0x2d678
leaq 0x1f296(%rip), %rcx     # 0x2d760
movl $0x531, %edx            # imm = 0x531
callq 0xd280
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_buffer_point_is_valid
int64_t ce_buffer_point_is_valid(CeBuffer_t* buffer, CePoint_t point){
     if(point.y < 0 || point.y >= buffer->line_count || point.x < 0) return false;
     int64_t line_len = ce_utf8_strlen(buffer->lines[point.y]);
     if(point.x > line_len) return false;

     return true;
}

// Assembly:
testq %rdx, %rdx
js 0xe4f2
pushq %rbx
movq %rsi, %rbx
cmpq %rdx, 0x8(%rdi)
setle %al
testq %rsi, %rsi
sets %cl
orb %al, %cl
je 0xe4f5
xorl %eax, %eax
jmp 0xe50c
xorl %eax, %eax
retq
movq (%rdi), %rax
movq (%rax,%rdx,8), %rdi
callq 0xe445
movq %rax, %rcx
xorl %eax, %eax
cmpq %rbx, %rcx
setge %al
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_buffer_get_rune
CeRune_t ce_buffer_get_rune(CeBuffer_t* buffer, CePoint_t point){
     if(!ce_buffer_point_is_valid(buffer, point)) return CE_UTF8_INVALID;

     char* str = ce_utf8_iterate_to(buffer->lines[point.y], point.x);
     int64_t rune_len = 0;
     return ce_utf8_decode(str, &rune_len);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testq %rdx, %rdx
js 0xe569
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %r12
cmpq %rdx, 0x8(%rdi)
setle %al
testq %rsi, %rsi
sets %cl
orb %al, %cl
jne 0xe569
movq (%r12), %rax
movq (%rax,%r15,8), %rdi
callq 0xe445
cmpq %r14, %rax
jl 0xe569
movq (%r12), %rax
movq (%rax,%r15,8), %rdi
movq %r14, %rsi
callq 0xe577
movq %rsp, %rsi
movq %rax, %rdi
callq 0xe602
movl %eax, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_utf8_iterate_to
char* ce_utf8_iterate_to(char* string, int64_t index){
     int64_t bytes = 0;
     while(index){
          if((*string & 0x80) == 0){
               bytes = 1;
          }else if((*string & 0xE0) == 0xC0){
               bytes = 2;
          }else if((*string & 0xF0) == 0xE0){
               bytes = 3;
          }else if((*string & 0xF8) == 0xF0){
               bytes = 4;
          }else{
               assert(!"unicode character claiming it has more than 4 bytes?!");
               return NULL;
          }

          for(int64_t i = 0; i < bytes; ++i){
               if(*string == 0){
                    return NULL;
               }
               string++;
          }

          index--;
     }

     return string;
}

// Assembly:
pushq %rax
testq %rsi, %rsi
je 0xe5de
movzbl (%rdi), %eax
movl $0x1, %ecx
testb %al, %al
jns 0xe5bc
movl %eax, %edx
andl $-0x20, %edx
movl $0x2, %ecx
cmpl $0xc0, %edx
je 0xe5bc
movl %eax, %edx
andl $-0x10, %edx
movl $0x3, %ecx
cmpl $0xe0, %edx
je 0xe5bc
andl $-0x8, %eax
movl $0x4, %ecx
cmpl $0xf0, %eax
jne 0xe5e3
leaq (%rdi,%rcx), %rax
xorl %edx, %edx
cmpb $0x0, (%rdi,%rdx)
je 0xe5da
incq %rdx
cmpq %rdx, %rcx
jne 0xe5c2
movq %rax, %rdi
decq %rsi
jne 0xe57d
jmp 0xe5e1
xorl %eax, %eax
jmp 0xe5e1
movq %rdi, %rax
popq %rcx
retq
leaq 0x1f13d(%rip), %rdi     # 0x2d727
leaq 0x1f087(%rip), %rsi     # 0x2d678
leaq 0x1f1c8(%rip), %rcx     # 0x2d7c0
movl $0x572, %edx            # imm = 0x572
callq 0xd280
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_utf8_decode
CeRune_t ce_utf8_decode(const char* string, int64_t* bytes_consumed){
     CeRune_t rune = CE_UTF8_INVALID;

     // 0xxxxxxx is just ascii
     if((*string & 0x80) == 0){
          *bytes_consumed = 1;
          rune = string[0];
     // 110xxxxx is a 2 byte utf8 string
     }else if((*string & 0xE0) == 0xC0){
          *bytes_consumed = 2;
          rune = string[0] & 0x1F;
          rune <<= 6;
          rune |= string[1] & 0x3F;
     // 1110xxxx is a 3 byte utf8 string
     }else if((*string & 0xF0) == 0xE0){
          *bytes_consumed = 3;
          rune = string[0] & 0x0F;
          rune <<= 6;
          rune |= string[1] & 0x3F;
          rune <<= 6;
          rune |= string[2] & 0x3F;
     // 11110xxx is a 4 byte utf8 string
     }else if((*string & 0xF8) == 0xF0){
          *bytes_consumed = 4;
          rune = string[0] & 0x0F;
          rune <<= 6;
          rune |= string[1] & 0x3F;
          rune <<= 6;
          rune |= string[2] & 0x3F;
          rune <<= 6;
          rune |= string[3] & 0x3F;
     }

     return rune;
}

// Assembly:
movzbl (%rdi), %ecx
testb %cl, %cl
js 0xe614
movq $0x1, (%rsi)
movsbl (%rdi), %eax
retq
movl %ecx, %eax
andl $-0x20, %eax
cmpl $0xc0, %eax
jne 0xe636
movq $0x2, (%rsi)
movzbl (%rdi), %ecx
andl $0x1f, %ecx
shll $0x6, %ecx
movzbl 0x1(%rdi), %eax
jmp 0xe662
movl %ecx, %eax
andl $-0x10, %eax
cmpl $0xe0, %eax
jne 0xe668
movq $0x3, (%rsi)
movzbl (%rdi), %eax
andl $0xf, %eax
movzbl 0x1(%rdi), %ecx
andl $0x3f, %ecx
shll $0xc, %eax
shll $0x6, %ecx
orl %eax, %ecx
movzbl 0x2(%rdi), %eax
andl $0x3f, %eax
orl %ecx, %eax
retq
andl $-0x8, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl $0xf0, %ecx
jne 0xe6a9
movq $0x4, (%rsi)
movzbl (%rdi), %eax
andl $0xf, %eax
movzbl 0x1(%rdi), %ecx
andl $0x3f, %ecx
shll $0xc, %eax
shll $0x6, %ecx
orl %eax, %ecx
movzbl 0x2(%rdi), %edx
andl $0x3f, %edx
orl %ecx, %edx
shll $0x6, %edx
movzbl 0x3(%rdi), %eax
andl $0x3f, %eax
orl %edx, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_buffer_search_forward
CePoint_t ce_buffer_search_forward(CeBuffer_t* buffer, CePoint_t start, const char* pattern){
     CePoint_t result = (CePoint_t){-1, -1};

     if(!ce_buffer_point_is_valid(buffer, start)) return result;

     int64_t save_y = start.y;
     char* itr = ce_utf8_iterate_to(buffer->lines[start.y], start.x);
     char* match = NULL;

     // try to match the pattern on each line to the end
     while(true){
          match = strstr(itr, pattern);
          if(match) break;
          start.y++;
          if(start.y >= buffer->line_count) break;
          itr = buffer->lines[start.y];
     }

     if(match){
          // figure out index in the line
          int64_t index = 0;
          int64_t rune_len = 0;
          while(match > itr){
               ce_utf8_decode(itr, &rune_len);
               itr += rune_len;
               index++;
          }

          if(start.y == save_y){
               // if we are on the same line, use the starting x plus the index
               result.x = start.x + index;
          }else{
               result.x = index;
          }
          result.y = start.y;
     }

     return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq $-0x1, %rbp
testq %rdx, %rdx
js 0xe6f2
movq %rcx, %r13
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
cmpq %rdx, 0x8(%rdi)
setle %al
testq %rsi, %rsi
sets %cl
orb %al, %cl
jne 0xe6f2
movq (%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0xe445
cmpq %r15, %rax
jge 0xe70e
movq $-0x1, %r12
movq %rbp, %rax
movq %r12, %rdx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rbx), %rax
movq (%rax,%r14,8), %rdi
movq %r15, 0x8(%rsp)
movq %r15, %rsi
callq 0xe577
movq %rax, %rbp
movq %rax, %rdi
movq %r13, %rsi
callq 0xd6f0
testq %rax, %rax
je 0xe73d
movq %rax, %r15
movq %r14, %r12
jmp 0xe772
movq 0x8(%rbx), %rax
movq %rax, 0x10(%rsp)
movq %r14, %rax
leaq 0x1(%rax), %r12
cmpq 0x10(%rsp), %r12
jge 0xe7af
movq (%rbx), %rcx
movq 0x8(%rcx,%rax,8), %rbp
movq %rbp, %rdi
movq %r13, %rsi
callq 0xd6f0
movq %rax, %r15
movq %r12, %rax
testq %r15, %r15
je 0xe749
movq $0x0, (%rsp)
xorl %r13d, %r13d
cmpq %rbp, %r15
jbe 0xe79c
movq %rsp, %rbx
movq %rbp, %rdi
movq %rbx, %rsi
callq 0xe602
addq (%rsp), %rbp
incq %r13
cmpq %rbp, %r15
ja 0xe785
xorl %ebp, %ebp
cmpq %r14, %r12
cmoveq 0x8(%rsp), %rbp
addq %r13, %rbp
jmp 0xe6f9
movq $-0x1, %r12
movq $-0x1, %rbp
jmp 0xe6f9
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_buffer_search_backward
CePoint_t ce_buffer_search_backward(CeBuffer_t* buffer, CePoint_t start, const char* pattern){
     CePoint_t result = (CePoint_t){-1, -1};

     if(!ce_buffer_point_is_valid(buffer, start)) return result;

     char* beginning_of_line = buffer->lines[start.y];
     char* itr = ce_utf8_iterate_to(beginning_of_line, start.x);
     bool match = false;
     size_t pattern_len = strlen(pattern);

     // try to match the pattern on each line to the end
     while(true){
          while(itr > beginning_of_line){
               if(strncmp(itr, pattern, pattern_len) == 0){
                    match = true;
                    break;
               }

               itr--;
          }
          if(match) break;
          start.y--;
          if(start.y < 0) break;
          beginning_of_line = buffer->lines[start.y];
          itr = beginning_of_line + ce_utf8_last_index(beginning_of_line);
     }

     if(match){
          // figure out index in the line
          int64_t index = 0;
          int64_t rune_len = 0;
          while(itr > beginning_of_line){
               ce_utf8_decode(beginning_of_line, &rune_len);
               beginning_of_line += rune_len;
               index++;
          }

          result.x = index;
          result.y = start.y;
     }

     return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq $-0x1, %r14
testq %rdx, %rdx
js 0xe80b
movq %rcx, %r15
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, %r13
cmpq %rdx, 0x8(%rdi)
setle %al
testq %rsi, %rsi
sets %cl
orb %al, %cl
jne 0xe80b
movq (%r13), %rax
movq (%rax,%rbx,8), %rdi
callq 0xe445
cmpq %r12, %rax
jge 0xe827
movq $-0x1, %rbx
movq %r14, %rax
movq %rbx, %rdx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r13, 0x10(%rsp)
movq (%r13), %rax
movq (%rax,%rbx,8), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0xe577
movq %rax, %rbp
movq %r15, %rdi
callq 0xd210
movq %rax, %r12
cmpq %r13, %rbp
jbe 0xe869
movq %rbp, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0xd0d0
testl %eax, %eax
je 0xe899
decq %rbp
jmp 0xe84d
testq %rbx, %rbx
jle 0xe80b
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq -0x8(%rax,%rbx,8), %r13
decq %rbx
movq %r13, %rdi
callq 0xe445
movq %rax, %rbp
xorl %eax, %eax
testq %rbp, %rbp
setg %al
addq %r13, %rbp
subq %rax, %rbp
jmp 0xe84d
movq $0x0, 0x8(%rsp)
xorl %r14d, %r14d
cmpq %r13, %rbp
jbe 0xe812
leaq 0x8(%rsp), %r15
movq %r13, %rdi
movq %r15, %rsi
callq 0xe602
addq 0x8(%rsp), %r13
incq %r14
cmpq %r13, %rbp
ja 0xe8b3
jmp 0xe812
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_buffer_regex_search_forward
CeRegexSearchResult_t ce_buffer_regex_search_forward(CeBuffer_t* buffer, CePoint_t start, CeRegex_t regex){
     CeRegexSearchResult_t result = {(CePoint_t){-1, -1}, -1};

     if(!ce_buffer_point_is_valid(buffer, start)) return result;

     while(start.y < buffer->line_count){
          CeRegexResult_t regex_result = ce_regex_match(regex,
                                                        buffer->lines[start.y] + start.x);
          if(regex_result.error_message != NULL){
               ce_log("ce_regex_match() failed: %s", regex_result.error_message);
               free(regex_result.error_message);
               break;
          }
          if(regex_result.match_start != CE_REGEX_NO_MATCH){
               result.point = start;
               result.point.x += regex_result.match_start;
               result.length = regex_result.match_length;
               break;
          }
          start.y++;
          start.x = 0;
     }

     return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
pcmpeqd %xmm0, %xmm0
movdqu %xmm0, (%rdi)
movq $-0x1, 0x10(%rdi)
testq %rcx, %rcx
js 0xe9b2
movq %rcx, %r14
movq %rdx, %r13
movq %rsi, %r12
cmpq %rcx, 0x8(%rsi)
setle %al
testq %rdx, %rdx
sets %cl
orb %al, %cl
jne 0xe9b2
movq %r8, %r15
movq (%r12), %rax
movq (%rax,%r14,8), %rdi
callq 0xe445
cmpq %r13, %rax
jl 0xe9b2
cmpq %r14, 0x8(%r12)
jle 0xe9b2
movq %rsp, %rbp
movq (%r12), %rax
movq (%rax,%r14,8), %rdx
addq %r13, %rdx
movq %rbp, %rdi
movq %r15, %rsi
callq 0x1f430
movq (%rsp), %rsi
testq %rsi, %rsi
jne 0xe986
movq 0x8(%rsp), %rax
cmpq $-0x1, %rax
jne 0xe99f
incq %r14
movl $0x0, %r13d
cmpq 0x8(%r12), %r14
jl 0xe94a
jmp 0xe9b2
leaq 0x1ecc2(%rip), %rdi     # 0x2d64f
xorl %eax, %eax
callq 0xd954
movq (%rsp), %rdi
callq 0xd090
jmp 0xe9b2
movq %r14, 0x8(%rbx)
addq %r13, %rax
movq %rax, (%rbx)
movq 0x10(%rsp), %rax
movq %rax, 0x10(%rbx)
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_buffer_range_len
int64_t ce_buffer_range_len(CeBuffer_t* buffer, CePoint_t start, CePoint_t end){
     if(!ce_buffer_point_is_valid(buffer, start)) return -1;
     if(!ce_buffer_point_is_valid(buffer, end)) return -1;
     if(ce_point_after(start, end)) return -1; // TODO: calculate negative value?

     // easy case where they are on the same line
     if(start.y == end.y) return (end.x - start.x) + 1;

     int64_t length = 0;
     for(int64_t y = start.y; y <= end.y; ++y){
          if(y == start.y){
               // count from the star to the end of the line
               length = ce_utf8_strlen(ce_utf8_iterate_to(buffer->lines[y], start.x)) + 1;
          }else if(y == end.y){
               length += end.x + 1;
          }else{
               // count entire line
               int64_t line_length = ce_utf8_strlen(buffer->lines[y]) + 1;
               if(line_length == 0) length++;
               length += line_length;
          }
     }

     return length;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq $-0x1, %rbp
testq %rdx, %rdx
js 0xec5f
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r13
cmpq %rdx, 0x8(%rdi)
setle %al
testq %rsi, %rsi
sets %cl
orb %al, %cl
jne 0xec5f
movq %r8, %rbx
movq (%r13), %rax
movq (%rax,%r15,8), %rdi
callq 0xe445
cmpq %r12, %rax
setl %al
testq %rbx, %rbx
sets %cl
orb %al, %cl
jne 0xec5f
cmpq %rbx, 0x8(%r13)
setle %al
testq %r14, %r14
sets %cl
orb %al, %cl
jne 0xec5f
movq (%r13), %rax
movq (%rax,%rbx,8), %rdi
callq 0xe445
cmpq %r14, %rax
setl %al
cmpq %r15, %rbx
setb %cl
orb %al, %cl
jne 0xec5f
cmpq %r15, %rbx
sete %cl
movq %r14, (%rsp)
subq %r12, %r14
setb %dl
testb %dl, %cl
jne 0xec5f
subq %r15, %rbx
jne 0xebed
incq %r14
movq %r14, %rbp
jmp 0xec5f
incq (%rsp)
leaq 0x1(%rbx), %rax
movq %rax, 0x10(%rsp)
leaq (,%r15,8), %rax
movq %rax, 0x8(%rsp)
xorl %r14d, %r14d
xorl %ebp, %ebp
testq %r14, %r14
je 0xec1c
cmpq %r14, %rbx
jne 0xec3c
addq (%rsp), %rbp
jmp 0xec55
movq (%r13), %rax
movq (%rax,%r15,8), %rdi
movq %r12, %rsi
callq 0xe577
movq %rax, %rdi
callq 0xe445
movq %rax, %rbp
incq %rbp
jmp 0xec55
movq (%r13), %rax
addq 0x8(%rsp), %rax
movq (%rax,%r14,8), %rdi
callq 0xe445
addq $0x1, %rax
adcq %rax, %rbp
incq %r14
cmpq %r14, 0x10(%rsp)
jne 0xec0c
movq %rbp, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_buffer_move_point
CePoint_t ce_buffer_move_point(CeBuffer_t* buffer, CePoint_t point, CePoint_t delta, int64_t tab_width, CeClampX_t clamp_x){
     if(delta.y){
          CE_CLAMP(point.y, 0, (buffer->line_count - 1));

          // figure out where we are visibly (due to tabs being variable length)
          int64_t cur_visible_index = ce_util_string_index_to_visible_index(buffer->lines[point.y], point.x, tab_width);

          // move to the new line
          point.y += delta.y;

          // always clamp y
          CE_CLAMP(point.y, 0, (buffer->line_count - 1));

          // convert the x from visible index to a string index
          point.x = ce_util_visible_index_to_string_index(buffer->lines[point.y], cur_visible_index, tab_width);
     }

     point.x += delta.x;
     int64_t line_len = ce_buffer_line_len(buffer, point.y);

     switch(clamp_x){
     case CE_CLAMP_X_NONE:
          break;
     case CE_CLAMP_X_ON:
          CE_CLAMP(point.x, 0, line_len);
          break;
     case CE_CLAMP_X_INSIDE:
          if(line_len == 0){
               point.x = 0;
          }else{
               CE_CLAMP(point.x, 0, (line_len - 1));
          }
          break;
     }

     return point;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r15
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r12
testq %r8, %r8
je 0xed29
movq %r9, %r13
movq %r8, %rbp
movq %r15, (%rsp)
testq %rbx, %rbx
js 0xece0
movq 0x8(%r12), %rax
leaq -0x1(%rax), %r15
cmpq %rbx, %rax
cmovgq %rbx, %r15
jmp 0xece3
xorl %r15d, %r15d
movq (%r12), %rax
movq (%rax,%r15,8), %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0xed91
addq %r15, %rbp
js 0xed0d
movq 0x8(%r12), %rcx
leaq -0x1(%rcx), %rbx
cmpq %rcx, %rbp
cmovlq %rbp, %rbx
jmp 0xed0f
xorl %ebx, %ebx
movq (%rsp), %r15
movq (%r12), %rcx
movq (%rcx,%rbx,8), %rdi
movq %rax, %rsi
movq %r13, %rdx
callq 0xee03
movq %rax, %r14
movl 0x40(%rsp), %ebp
movq $-0x1, %rax
testq %rbx, %rbx
js 0xed4d
cmpq %rbx, 0x8(%r12)
jle 0xed4d
movq (%r12), %rax
movq (%rax,%rbx,8), %rdi
callq 0xe445
addq %r15, %r14
cmpl $0x2, %ebp
je 0xed5c
cmpl $0x1, %ebp
je 0xed64
jmp 0xed77
testq %rax, %rax
je 0xed8c
decq %rax
cmpq %rax, %r14
cmovlq %r14, %rax
xorl %ecx, %ecx
testq %r14, %r14
cmovnsq %rax, %rcx
movq %rcx, %r14
movq %r14, %rax
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r14d, %r14d
jmp 0xed77
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_util_string_index_to_visible_index
int64_t ce_util_string_index_to_visible_index(const char* string, int64_t index, int64_t tab_width){
     int64_t x = 0;
     int64_t rune_len = 0;
     CeRune_t rune = 1;

     while(rune > 0 && index > 0){
          rune = ce_utf8_decode(string, &rune_len);

          if(rune > 0){
               if(rune == CE_TAB){
                    x += tab_width;
               }else{
                    x++;
               }
          }else{
               x++;
          }

          string += rune_len;
          index--;
     }

     return x;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq $0x0, 0x8(%rsp)
testq %rsi, %rsi
jle 0xedf3
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
xorl %eax, %eax
leaq 0x8(%rsp), %r12
movq %rax, %r13
movq %r14, %rdi
movq %r12, %rsi
callq 0xe602
movl %eax, %ecx
cmpl $0x9, %eax
movl $0x1, %eax
cmoveq %rbx, %rax
addq %r13, %rax
testl %ecx, %ecx
jle 0xedf5
addq 0x8(%rsp), %r14
leaq -0x1(%r15), %rcx
cmpq $0x1, %r15
movq %rcx, %r15
ja 0xedbc
jmp 0xedf5
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq