LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/hamsternz[P]emulate-risc-v/spi.c
// Function: SPI_init
int SPI_init(struct region *r) {
  uint32_t *data;

  if(r->data != NULL) {
    display_log("SPI already initialized");
    return 0;
  }
 
  data = malloc(r->size);
  if(data == NULL){
    return 0;
  }
  r->data = (void *)data;
  memset(r->data, 0, r->size);
  display_log("Set up SPI region");
  return 1;
}

// Assembly:
pushq %rbx
cmpq $0x0, 0x38(%rdi)
je 0x54eb
xorl %ebx, %ebx
leaq 0x31e4(%rip), %rdi      # 0x86cd
jmp 0x550c
movq %rdi, %rbx
movl 0xc(%rdi), %esi
pushq $0x1
popq %rdi
callq 0x2130
testq %rax, %rax
je 0x5515
movq %rax, 0x38(%rbx)
pushq $0x1
popq %rbx
leaq 0x31d9(%rip), %rdi      # 0x86e5
callq 0x4b7e
movl %ebx, %eax
popq %rbx
retq
xorl %ebx, %ebx
jmp 0x5511
// File: /workspace/github_c_makefile_star2_O2/hamsternz[P]emulate-risc-v/spi.c
// Function: SPI_get
int SPI_get(struct region *r, uint32_t address, uint32_t *value) {
   uint32_t v = 0;
   char buffer[100];
   if((address & 3) != 0) {
     fprintf(stderr,"Unaligned memory read 0x%08x\n", r->base+address);
     return 0;
   }

   if(address+4 > r->size) {
     fprintf(stderr,"Memory region boundary crossed at 0x%08x\n", r->base+address);
     return 0;
   }

   v = ((unsigned char *)r->data)[address]; 
   v = v + (((unsigned char *)r->data)[address+1] << 8); 
   v = v + (((unsigned char *)r->data)[address+2] << 16); 
   v = v + (((unsigned char *)r->data)[address+3] << 24); 

   if(address == 0)
     v |= 1<<31;
   *value = v;
     
   sprintf(buffer,"SPI Rd address 0x%08x: 0x%08x", address, v);
   display_log(buffer);

   return 1;
}

// Assembly:
pushq %rbx
subq $0x70, %rsp
movq %rdx, %rax
movl %esi, %edx
testb $0x3, %dl
jne 0x5665
leal 0x4(%rdx), %ecx
cmpl 0xc(%rdi), %ecx
ja 0x567b
movq 0x38(%rdi), %rcx
movl %edx, %esi
movl (%rcx,%rsi), %esi
movl %esi, %ecx
orl $0x80000000, %ecx       # imm = 0x80000000
testl %edx, %edx
cmovnel %esi, %ecx
movl %ecx, (%rax)
leaq 0x30d0(%rip), %rsi      # 0x8715
movq %rsp, %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x21f0
movq %rbx, %rdi
callq 0x4b7e
pushq $0x1
popq %rbx
movl %ebx, %eax
addq $0x70, %rsp
popq %rbx
retq
movq 0x698c(%rip), %rax      # 0xbff8
movq (%rax), %rax
addl 0x8(%rdi), %edx
leaq 0x296f(%rip), %rsi      # 0x7fe8
jmp 0x568f
movq 0x6976(%rip), %rax      # 0xbff8
movq (%rax), %rax
addl 0x8(%rdi), %edx
leaq 0x2910(%rip), %rsi      # 0x7f9f
xorl %ebx, %ebx
movq %rax, %rdi
xorl %eax, %eax
callq 0x2140
jmp 0x565d
// File: /workspace/github_c_makefile_star2_O2/hamsternz[P]emulate-risc-v/spi.c
// Function: SPI_free
void SPI_free(struct region *r) {
   char buffer[100];
   sprintf(buffer, "Releasing SPI at 0x%08x", r->base);
   display_log(buffer);
   if(r->data != NULL) 
     free(r->data);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
movl 0x8(%rdi), %edx
leaq 0x2fec(%rip), %rsi      # 0x874d
movq %rsp, %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x21f0
movq %r14, %rdi
callq 0x4b7e
movq 0x38(%rbx), %rdi
callq 0x2040
addq $0x68, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_c_makefile_star2_O2/hamsternz[P]emulate-risc-v/clint.c
// Function: CLINT_init
int CLINT_init(struct region *r) {
  uint32_t *data;

  if(r->data != NULL) {
    display_log("CLINT already initialized");
    return 0;
  }
 
  data = malloc(r->size);
  if(data == NULL){
    return 0;
  }
  r->data = (void *)data;
  memset(r->data, 0, r->size);
  display_log("Set up CLINT region");
  return 1;
}

// Assembly:
pushq %rbx
cmpq $0x0, 0x38(%rdi)
je 0x579b
xorl %ebx, %ebx
leaq 0x2fcc(%rip), %rdi      # 0x8765
jmp 0x57bc
movq %rdi, %rbx
movl 0xc(%rdi), %esi
pushq $0x1
popq %rdi
callq 0x2130
testq %rax, %rax
je 0x57c5
movq %rax, 0x38(%rbx)
pushq $0x1
popq %rbx
leaq 0x2fc3(%rip), %rdi      # 0x877f
callq 0x4b7e
movl %ebx, %eax
popq %rbx
retq
xorl %ebx, %ebx
jmp 0x57c1
// File: /workspace/github_c_makefile_star2_O2/hamsternz[P]emulate-risc-v/clint.c
// Function: CLINT_get
int CLINT_get(struct region *r, uint32_t address, uint32_t *value) {
   uint32_t v = 0;
   char buffer[100];
   if((address & 3) != 0) {
     fprintf(stderr,"Unaligned memory read 0x%08x\n", r->base+address);
     return 0;
   }

   if(address+4 > r->size) {
     fprintf(stderr,"Memory region boundary crossed at 0x%08x\n", r->base+address);
     return 0;
   }

   v = ((unsigned char *)r->data)[address]; 
   v = v + (((unsigned char *)r->data)[address+1] << 8); 
   v = v + (((unsigned char *)r->data)[address+2] << 16); 
   v = v + (((unsigned char *)r->data)[address+3] << 24); 

   switch(address) {
     case 0x0000: // MSIP regs
        *value = v;
	break;
     case 0x4000: // Timer Compare Reg
        *value = v;
	break;
     case 0x4004:
        *value = v;
	break;
     case 0xBFF8:   // Cycle count
        *value = riscv_cycle_count_l();
	break;
     case 0xBFFC:
        *value = riscv_cycle_count_h();
	break;
     default:
        sprintf(buffer,"CLINT Rd of non-register address 0x%08x", address);
        display_log(buffer);
	*value = 0;
	return 1;
   }
     
   sprintf(buffer,"CLINT Rd address 0x%08x: 0x%08x", address, v);
   display_log(buffer);

   return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x68, %rsp
movl %esi, %ebx
testb $0x3, %bl
jne 0x5979
leal 0x4(%rbx), %eax
cmpl 0xc(%rdi), %eax
ja 0x598f
movq %rdx, %r14
movq 0x38(%rdi), %rax
movl %ebx, %ecx
movl (%rax,%rcx), %ebp
movl %ebp, %eax
testl %ebx, %ebx
je 0x5922
movl %ebp, %eax
cmpl $0x4000, %ebx           # imm = 0x4000
je 0x5922
movl %ebp, %eax
cmpl $0x4004, %ebx           # imm = 0x4004
je 0x5922
cmpl $0xbffc, %ebx           # imm = 0xBFFC
je 0x591d
cmpl $0xbff8, %ebx           # imm = 0xBFF8
jne 0x5955
callq 0x2dde
jmp 0x5922
callq 0x2de5
movl %eax, (%r14)
leaq 0x2eaf(%rip), %rsi      # 0x87db
movq %rsp, %r14
movq %r14, %rdi
movl %ebx, %edx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x21f0
movq %r14, %rdi
callq 0x4b7e
pushq $0x1
popq %rbp
movl %ebp, %eax
addq $0x68, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2e57(%rip), %rsi      # 0x87b3
movq %rsp, %r15
movq %r15, %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0x21f0
movq %r15, %rdi
callq 0x4b7e
andl $0x0, (%r14)
jmp 0x5945
movq 0x6678(%rip), %rax      # 0xbff8
movq (%rax), %rax
addl 0x8(%rdi), %ebx
leaq 0x265b(%rip), %rsi      # 0x7fe8
jmp 0x59a3
movq 0x6662(%rip), %rax      # 0xbff8
movq (%rax), %rax
addl 0x8(%rdi), %ebx
leaq 0x25fc(%rip), %rsi      # 0x7f9f
xorl %ebp, %ebp
movq %rax, %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0x2140
jmp 0x5948
// File: /workspace/github_c_makefile_star2_O2/hamsternz[P]emulate-risc-v/clint.c
// Function: CLINT_free
void CLINT_free(struct region *r) {
   char buffer[100];
   sprintf(buffer, "Releasing CLINT at 0x%08x", r->base);
   display_log(buffer);
   if(r->data != NULL) 
     free(r->data);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
movl 0x8(%rdi), %edx
leaq 0x2da0(%rip), %rsi      # 0x8817
movq %rsp, %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x21f0
movq %r14, %rdi
callq 0x4b7e
movq 0x38(%rbx), %rdi
callq 0x2040
addq $0x68, %rsp
popq %rbx
popq %r14
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/hamsternz[P]emulate-risc-v/gpio.c
// Function: GPIO_init
int GPIO_init(struct region *r) {
  uint32_t *data;

  if(r->data != NULL) {
    display_log("GPIO already initialized");
    return 0;
  }
 
  data = malloc(r->size);
  if(data == NULL){
    return 0;
  }
  r->data = (void *)data;
  memset(r->data, 0, r->size);
  display_log("Set up GPIO region");
  return 1;
}

// Assembly:
pushq %rbx
cmpq $0x0, 0x38(%rdi)
je 0x5ab3
xorl %ebx, %ebx
leaq 0x2d80(%rip), %rdi      # 0x8831
jmp 0x5ad4
movq %rdi, %rbx
movl 0xc(%rdi), %esi
pushq $0x1
popq %rdi
callq 0x2130
testq %rax, %rax
je 0x5add
movq %rax, 0x38(%rbx)
pushq $0x1
popq %rbx
leaq 0x2d76(%rip), %rdi      # 0x884a
callq 0x4b7e
movl %ebx, %eax
popq %rbx
retq
xorl %ebx, %ebx
jmp 0x5ad9
// File: /workspace/github_c_makefile_star2_O2/hamsternz[P]emulate-risc-v/gpio.c
// Function: GPIO_free
void GPIO_free(struct region *r) {
   char buffer[100];
   sprintf(buffer, "Releasing GPIO at 0x%08x", r->base);
   display_log(buffer);
   if(r->data != NULL) 
     free(r->data);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
movl 0x8(%rdi), %edx
leaq 0x2b9a(%rip), %rsi      # 0x88b6
movq %rsp, %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x21f0
movq %r14, %rdi
callq 0x4b7e
movq 0x38(%rbx), %rdi
callq 0x2040
addq $0x68, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_c_makefile_star2_O2/hamsternz[P]emulate-risc-v/memory.c
// Function: memory_read_request
uint32_t memory_read_request(uint32_t address) {
  if(read_request_fifo.count == FIFO_SIZE)
    return 0;
  read_request_fifo.address[read_request_fifo.write_ptr] = address;
  read_request_fifo.count++;
  read_request_fifo.write_ptr = (read_request_fifo.write_ptr == FIFO_SIZE-1) ? 0 : read_request_fifo.write_ptr+1;
  return 1;
}

// Assembly:
movl 0xaf9a(%rip), %ecx      # 0x10d38
xorl %eax, %eax
cmpl $0x8, %ecx
je 0x5dd6
movl 0xaf89(%rip), %eax      # 0x10d34
leaq 0xaf7e(%rip), %rdx      # 0x10d30
incl %ecx
leal 0x1(%rax), %esi
xorl %r8d, %r8d
cmpq $0x7, %rax
movl %edi, 0xc(%rdx,%rax,4)
movl %ecx, 0xaf70(%rip)      # 0x10d38
cmovnel %esi, %r8d
movl %r8d, 0xaf61(%rip)      # 0x10d34
pushq $0x1
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/hamsternz[P]emulate-risc-v/memory.c
// Function: memory_fetch_request
uint32_t memory_fetch_request(uint32_t address) {
  if(fetch_request_fifo.count == FIFO_SIZE)
    return 0;

  fetch_request_fifo.address[fetch_request_fifo.write_ptr] = address;
  fetch_request_fifo.count++;
  fetch_request_fifo.write_ptr = (fetch_request_fifo.write_ptr == FIFO_SIZE-1) ? 0 : fetch_request_fifo.write_ptr+1;

  return 1;
}

// Assembly:
movl 0xaf87(%rip), %ecx      # 0x10d64
xorl %eax, %eax
cmpl $0x8, %ecx
je 0x5e15
movl 0xaf76(%rip), %eax      # 0x10d60
leaq 0xaf6b(%rip), %rdx      # 0x10d5c
incl %ecx
leal 0x1(%rax), %esi
xorl %r8d, %r8d
cmpq $0x7, %rax
movl %edi, 0xc(%rdx,%rax,4)
movl %ecx, 0xaf5d(%rip)      # 0x10d64
cmovnel %esi, %r8d
movl %r8d, 0xaf4e(%rip)      # 0x10d60
pushq $0x1
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/hamsternz[P]emulate-risc-v/memory.c
// Function: memory_read_data
uint32_t memory_read_data(void) {
  uint32_t rtn;
  if(read_data_fifo.count == 0) {
    display_log("Attempt to read empty FIFO read_data");
    return 0;
  }

  rtn = read_data_fifo.data[read_data_fifo.read_ptr];
  read_data_fifo.count--;
  read_data_fifo.read_ptr = (read_data_fifo.read_ptr == FIFO_SIZE-1) ? 0 : read_data_fifo.read_ptr+1; 
  return rtn;
}

// Assembly:
movl 0xae3e(%rip), %ecx      # 0x10c74
testl %ecx, %ecx
je 0x5e66
movl 0xae2c(%rip), %eax      # 0x10c6c
leaq 0xae25(%rip), %rdx      # 0x10c6c
decl %ecx
leal 0x1(%rax), %esi
xorl %edi, %edi
cmpq $0x7, %rax
movl 0xc(%rdx,%rax,4), %eax
movl %ecx, 0xae18(%rip)      # 0x10c74
cmovnel %esi, %edi
movl %edi, 0xae07(%rip)      # 0x10c6c
retq
pushq %rax
leaq 0x2a6e(%rip), %rdi      # 0x88dc
callq 0x4b7e
xorl %eax, %eax
addq $0x8, %rsp
retq
// File: /workspace/github_c_makefile_star2_O2/hamsternz[P]emulate-risc-v/memory.c
// Function: memory_fetch_data
uint32_t memory_fetch_data(void) {
  uint32_t rtn;
  if(fetch_data_fifo.count == 0) {
    display_log("Attempt to read empty FIFO fetch_data");
    return 0;
  }

  rtn = fetch_data_fifo.data[fetch_data_fifo.read_ptr];
  fetch_data_fifo.count--;
  fetch_data_fifo.read_ptr = (fetch_data_fifo.read_ptr == FIFO_SIZE-1) ? 0 : fetch_data_fifo.read_ptr+1;
  return rtn;
}

// Assembly:
movl 0xae20(%rip), %ecx      # 0x10ca0
testl %ecx, %ecx
je 0x5eb0
movl 0xae0e(%rip), %eax      # 0x10c98
leaq 0xae07(%rip), %rdx      # 0x10c98
decl %ecx
leal 0x1(%rax), %esi
xorl %edi, %edi
cmpq $0x7, %rax
movl 0xc(%rdx,%rax,4), %eax
movl %ecx, 0xadfa(%rip)      # 0x10ca0
cmovnel %esi, %edi
movl %edi, 0xade9(%rip)      # 0x10c98
retq
pushq %rax
leaq 0x2a49(%rip), %rdi      # 0x8901
callq 0x4b7e
xorl %eax, %eax
addq $0x8, %rsp
retq
// File: /workspace/github_c_makefile_star2_O2/hamsternz[P]emulate-risc-v/memory.c
// Function: memory_write_request
int      memory_write_request(uint32_t address, uint32_t mask, uint32_t value) {
  if(write_request_fifo.count == FIFO_SIZE) {
    return 0;
  }
  write_request_fifo.address[write_request_fifo.write_ptr] = address;
  write_request_fifo.mask[write_request_fifo.write_ptr]    = mask;
  write_request_fifo.data[write_request_fifo.write_ptr]    = value;
  write_request_fifo.count++;
  write_request_fifo.write_ptr = (write_request_fifo.write_ptr == FIFO_SIZE-1) ? 0 : write_request_fifo.write_ptr+1;
  return 1; 
}

// Assembly:
movl 0xadf5(%rip), %ecx      # 0x10ccc
xorl %eax, %eax
cmpl $0x8, %ecx
je 0x5f1b
movl 0xade4(%rip), %eax      # 0x10cc8
leaq 0xadd9(%rip), %r8       # 0x10cc4
incl %ecx
leal 0x1(%rax), %r9d
xorl %r10d, %r10d
cmpq $0x7, %rax
movl %edi, 0xc(%r8,%rax,4)
movl %esi, 0x2c(%r8,%rax,4)
movl %edx, 0x4c(%r8,%rax,4)
movl %ecx, 0xadbf(%rip)      # 0x10ccc
cmovnel %r9d, %r10d
movl %r10d, 0xadb0(%rip)     # 0x10cc8
pushq $0x1
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/FredTheDino[P]Fog/src/rain/editor_main.cpp
// Function: read_with_default(char const*, char const*, char*, unsigned int)
void read_with_default(const char *prompt, const char *def, char *val, u32 length) {
    s32 input_length;
    do {
        printf("%s", prompt);
        if (def)
            printf(" [%s]", def);
        printf(": ");

        fgets(val, length, stdin);
        input_length = strlen(val);
        if (val[MAX(input_length - 1, 0)] == '\n') {
            break;
        }

        printf("You passed in a too long string, max length is %d.\n", length);
        do {
            fgets(val, length, stdin);
            input_length = strlen(val);
        } while (val[MAX(input_length - 1, 0)] != '\n');
    } while (true);

    if (input_length == 2)
        memcpy((void *) def, (void *) val, strlen(def));
    else
        val[input_length - 1] = '\0';

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %r15d
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, -0x30(%rbp)
movq 0x4787e(%rip), %r13     # 0x49fe8
pushq $0x1
popq %r12
leaq 0x29b0e(%rip), %rdi     # 0x2c283
movq -0x30(%rbp), %rsi
xorl %eax, %eax
callq 0x2080
testq %r14, %r14
je 0x2796
leaq 0x28924(%rip), %rdi     # 0x2b0b0
movq %r14, %rsi
xorl %eax, %eax
callq 0x2080
leaq 0x29773(%rip), %rdi     # 0x2bf10
xorl %eax, %eax
callq 0x2080
movq (%r13), %rdx
movq %rbx, %rdi
movl %r15d, %esi
callq 0x22f0
movq %rbx, %rdi
callq 0x2250
movslq %eax, %rcx
decq %rcx
testl %ecx, %ecx
movl $0x0, %edx
cmovgl %ecx, %edx
cmpb $0xa, (%rbx,%rdx)
je 0x280c
leaq 0x288de(%rip), %rdi     # 0x2b0b6
movl %r15d, %esi
xorl %eax, %eax
callq 0x2080
movq (%r13), %rdx
movq %rbx, %rdi
movl %r15d, %esi
callq 0x22f0
movq %rbx, %rdi
callq 0x2250
cmpl $0x2, %eax
cmovll %r12d, %eax
cmpb $0xa, -0x1(%rbx,%rax)
jne 0x27e2
jmp 0x276e
cmpl $0x2, %eax
jne 0x2835
movq %r14, %rdi
callq 0x2250
movq %r14, %rdi
movq %rbx, %rsi
movq %rax, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2090
movb $0x0, (%rbx,%rcx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/FredTheDino[P]Fog/src/rain/editor_main.cpp
// Function: write_sprite_to_file(EditableSprite, _IO_FILE*)
void write_sprite_to_file(EditableSprite sprite, FILE *file) {
    fprintf(file, "%s:#%llu:%d:", sprite.name,
            fog_asset_hash(sprite.sheet), sprite.points.size());

    Vec2 center = fog_V2(0, 0);
    for (u32 i = 0; i < sprite.points.size(); i++) {
        center += sprite.points[i];
    }
    center /= sprite.points.size();
    for (u32 i = 0; i < sprite.points.size(); i++) {
        Vec2 p = sprite.points[i];
        fprintf(file, "(%f %f %f %f)",
            p.x - center.x, p.y - center.y,
            p.x, p.y);
    }
    fprintf(file, "\n");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x20(%rdi), %r15
movq 0x18(%rdi), %rdi
callq 0x251b3
movq 0x8(%r14), %r8
subq (%r14), %r8
sarq $0x3, %r8
leaq 0x2886e(%rip), %rsi     # 0x2b0ea
xorl %r12d, %r12d
movq %rbx, %rdi
movq %r15, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x2170
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
callq 0x2530a
movq (%r14), %rax
movq 0x8(%r14), %rcx
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movl %r12d, %esi
cmpq %rsi, %rdx
jbe 0x28c1
movsd (%rax,%rsi,8), %xmm1
addps %xmm1, %xmm0
leal 0x1(%rsi), %r12d
jmp 0x28ab
cvtsi2ss %rdx, %xmm2
movss 0x28736(%rip), %xmm1    # 0x2b004
divss %xmm2, %xmm1
movaps %xmm0, %xmm2
mulss %xmm1, %xmm2
movaps %xmm2, -0x30(%rbp)
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
mulss %xmm1, %xmm0
movaps %xmm0, -0x40(%rbp)
xorl %edx, %edx
leaq 0x28805(%rip), %r15     # 0x2b0f7
movl %edx, %r12d
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r12, %rcx
jbe 0x2943
movss (%rax,%r12,8), %xmm0
movss 0x4(%rax,%r12,8), %xmm1
cvtss2sd %xmm0, %xmm2
subss -0x30(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
cvtss2sd %xmm1, %xmm3
subss -0x40(%rbp), %xmm1
cvtss2sd %xmm1, %xmm1
movq %rbx, %rdi
movq %r15, %rsi
movb $0x4, %al
callq 0x2170
leal 0x1(%r12), %edx
movq (%r14), %rax
movq 0x8(%r14), %rcx
jmp 0x28f2
pushq $0xa
popq %rdi
movq %rbx, %rsi
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x2400
// File: /workspace/github_c_makefile_star2_O2/FredTheDino[P]Fog/src/rain/editor_main.cpp
// Function: find_next_sheet(unsigned long long, int)
AssetID find_next_sheet(AssetID start=0, int dir=1) {
    for (s32 i = 1; i < (s32) fog_asset_num(); i++) {
        AssetID curr = (start + i * dir + fog_asset_num()) % fog_asset_num();
        if (fog_asset_is(curr, Type::TEXTURE))
            return curr;
    }
    return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r15
movslq %esi, %r13
addq %r13, %r15
xorl %ebx, %ebx
callq 0x251a2
cltq
incq %rbx
cmpq %rax, %rbx
jge 0x29bb
leaq (%r15,%r13), %r14
callq 0x251a2
movq %rax, %r12
addq %r15, %r12
callq 0x251a2
movq %rax, %rcx
movq %r12, %rax
xorl %edx, %edx
divq %rcx
movq %rdx, %r12
movq %rdx, %rdi
pushq $0x1
popq %rsi
callq 0x25198
movq %r14, %r15
testb %al, %al
je 0x2973
movq %r12, %rax
jmp 0x29be
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/FredTheDino[P]Fog/src/rain/editor_main.cpp
// Function: create_new_sprite()
void create_new_sprite() {
    EditableSprite new_sprite = {
        std::vector<Vec2>(0),
        find_next_sheet(0, 1),
    };
    read_with_default("sprite name",
            nullptr,
            new_sprite.name,
            MAX_TEXT_LENGTH);

    global_editor.current_sprite = global_editor.sprites.size();
    global_editor.sprites.push_back(new_sprite);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x38, %rsp
leaq -0x40(%rbp), %rdi
leaq -0x9(%rbp), %rdx
xorl %esi, %esi
callq 0x3eda
pushq $0x1
popq %rsi
xorl %edi, %edi
callq 0x295a
leaq -0x20(%rbp), %rdx
movq %rax, -0x8(%rdx)
xorps %xmm0, %xmm0
movups %xmm0, (%rdx)
leaq 0x286ac(%rip), %rdi     # 0x2b105
pushq $0x10
popq %rcx
xorl %esi, %esi
callq 0x2748
movq 0x4832e(%rip), %rax     # 0x4ad98
leaq 0x4831f(%rip), %rdi     # 0x4ad90
subq 0x48318(%rip), %rax     # 0x4ad90
pushq $0x30
popq %rcx
cqto
idivq %rcx
movl %eax, 0x48302(%rip)     # 0x4ad88
leaq -0x40(%rbp), %rsi
callq 0x3f2c
leaq -0x40(%rbp), %rdi
callq 0x416e
addq $0x38, %rsp
popq %rbx
popq %rbp
retq
jmp 0x2aa1
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x416e
jmp 0x2ab2
movq %rax, %rbx
movq %rbx, %rdi
callq 0x2310
// File: /workspace/github_c_makefile_star2_O2/FredTheDino[P]Fog/src/rain/editor_main.cpp
// Function: main
int main(int argc, char *argv[]) {
    fog_input_request_name((u32) In::EDIT_NUM_BINDINGS);
    fog_init(argc, argv);
    setup(argc, argv);

    fog_run(sprite_editor_update, sprite_editor_draw);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movl %edi, %r14d
pushq $0x12
popq %rdi
callq 0x256c4
movl %r14d, %edi
movq %rbx, %rsi
callq 0x251c7
movl %r14d, %edi
movq %rbx, %rsi
callq 0x2aba
leaq -0xd68(%rip), %rdi      # 0x3150
leaq -0x408(%rip), %rsi      # 0x3ab7
callq 0x251de
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O2/FredTheDino[P]Fog/src/engine/util/printf.c
// Function: fctprintf
int fctprintf(void (*out)(char character, void* arg), void* arg, const char* format, ...)
{
  va_list va;
  va_start(va, format);
  const out_fct_wrap_type out_fct_wrap = { out, arg };
  const int ret = _vsnprintf(_out_fct, (char*)(uintptr_t)&out_fct_wrap, (size_t)-1, format, va);
  va_end(va);
  return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdx, %r10
leaq -0xe0(%rbp), %rdx
movq %rcx, 0x18(%rdx)
movq %r8, 0x20(%rdx)
movq %r9, 0x28(%rdx)
testb %al, %al
je 0x67db
movaps %xmm0, -0xb0(%rbp)
movaps %xmm1, -0xa0(%rbp)
movaps %xmm2, -0x90(%rbp)
movaps %xmm3, -0x80(%rbp)
movaps %xmm4, -0x70(%rbp)
movaps %xmm5, -0x60(%rbp)
movaps %xmm6, -0x50(%rbp)
movaps %xmm7, -0x40(%rbp)
leaq -0x30(%rbp), %r8
movq %rdx, 0x10(%r8)
leaq 0x10(%rbp), %rax
movq %rax, 0x8(%r8)
movabsq $0x3000000018, %rax     # imm = 0x3000000018
movq %rax, (%r8)
leaq -0x10(%rbp), %rax
movq %rdi, (%rax)
movq %rsi, 0x8(%rax)
leaq 0x17(%rip), %rdi        # 0x6821
pushq $-0x1
popq %rdx
movq %rax, %rsi
movq %r10, %rcx
callq 0x5ce1
addq $0xe0, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/FredTheDino[P]Fog/src/engine/util/tweak_values.cpp
// Function: Util::tweak(char const*, unsigned char*)
b8 tweak(const char *name, b8 *value) {
    if (!debug_values_are_on()) return false;
    const char *buffer = Util::format_int(" %s: %s", name, *value ? "true" : "false");
    debug_value_logic(name, buffer);

    if (name == global_tweak.active && Input::mouse_pressed(0)) {
        *value = !*value;
        return true;
    }
    return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
cmpb $0x0, 0x41e93(%rip)     # 0x4a370
je 0x853e
movq %rsi, %rbx
movq %rdi, %r15
cmpb $0x0, (%rsi)
leaq 0x24390(%rip), %rax     # 0x2c87f
leaq 0x24384(%rip), %rdx     # 0x2c87a
cmoveq %rax, %rdx
leaq 0x24371(%rip), %rdi     # 0x2c872
xorl %r14d, %r14d
movq %r15, %rsi
xorl %eax, %eax
callq 0x9642
movq %r15, %rdi
movq %rax, %rsi
callq 0x21c65
leaq 0x428d8(%rip), %rax     # 0x4adf8
cmpq %r15, 0x18(%rax)
jne 0x8541
leaq 0x41dab(%rip), %rax     # 0x4a2d8
cmpl $0x3, 0x68(%rax)
jne 0x8541
cmpb $0x0, (%rbx)
sete (%rbx)
movb $0x1, %r14b
jmp 0x8541
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/FredTheDino[P]Fog/src/engine/util/tweak_values.cpp
// Function: Util::tweak(char const*, int*)
b8 tweak(const char *name, s32 *value) {
    if (!debug_values_are_on()) return false;
    const char *buffer = Util::format_int(" %s: %d", name, *value);
    debug_value_logic(name, buffer);

    if (name == global_tweak.hot) {
        s32 delta = moved_over_boundry().x;
        *value += delta;
        return delta != 0;
    }
    return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
cmpb $0x0, 0x41e06(%rip)     # 0x4a370
je 0x85af
movq %rsi, %rbx
movq %rdi, %r15
movl (%rsi), %edx
leaq 0x24314(%rip), %rdi     # 0x2c88f
xorl %r14d, %r14d
movq %r15, %rsi
xorl %eax, %eax
callq 0x9642
movq %r15, %rdi
movq %rax, %rsi
callq 0x21c65
leaq 0x4285e(%rip), %rax     # 0x4adf8
cmpq %r15, 0x20(%rax)
jne 0x85b2
callq 0x21d7d
addl %eax, (%rbx)
testl %eax, %eax
setne %r14b
jmp 0x85b2
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/FredTheDino[P]Fog/src/engine/util/tweak_values.cpp
// Function: Util::tweak(char const*, unsigned int*)
b8 tweak(const char *name, u32 *value) {
    if (!debug_values_are_on()) return false;
    const char *buffer = Util::format_int(" %s: %u", name, *value);
    debug_value_logic(name, buffer);

    if (name == global_tweak.hot) {
        s32 delta = moved_over_boundry().x;
        if ((s32) *value < -delta) {
            *value = 0;
        } else {
            *value += delta;
        }
        return delta != 0;
    }
    return true;
}

// Assembly:
cmpb $0x0, 0x41d9f(%rip)     # 0x4a370
je 0x8639
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl (%rsi), %edx
leaq 0x242ab(%rip), %rdi     # 0x2c897
xorl %r15d, %r15d
movq %r14, %rsi
xorl %eax, %eax
callq 0x9642
movq %r14, %rdi
movq %rax, %rsi
callq 0x21c65
leaq 0x427ed(%rip), %rcx     # 0x4adf8
movb $0x1, %al
cmpq %r14, 0x20(%rcx)
jne 0x862e
callq 0x21d7d
movq %rax, %rcx
movl (%rbx), %edx
movl %ecx, %esi
negl %esi
setb %al
addl %edx, %ecx
cmpl %esi, %edx
cmovll %r15d, %ecx
movl %ecx, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/FredTheDino[P]Fog/src/engine/util/tweak_values.cpp
// Function: Util::tweak(char const*, float*, float)
b8 tweak(const char *name, f32 *value, f32 modifier) {
    if (!debug_values_are_on()) return false;
    const char *buffer = Util::format_int(" %s: %.4f", name, *value);
    debug_value_logic(name, buffer);

    if (name == global_tweak.hot) {
        f32 delta;
        if (Input::down(TWEAK_STEP)) {
            delta = moved_over_boundry().x;

            if (Input::down(TWEAK_SMOOTH))
                delta *= 0.1;

            if (delta) {
                *value += delta;
                precise_snap(value);
            }
        } else {
            delta = scaled_mouse_movements().x;
            *value += delta * modifier;
        }
        return delta != 0;
    }
    return false;
}

// Assembly:
cmpb $0x0, 0x41d23(%rip)     # 0x4a370
je 0x8699
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movss %xmm0, -0x20(%rbp)
cvtss2sd (%rsi), %xmm0
leaq 0x24215(%rip), %rdi     # 0x2c885
movq %r14, %rsi
movb $0x1, %al
callq 0x9642
movq %r14, %rdi
movq %rax, %rsi
callq 0x21c65
leaq 0x4276c(%rip), %rax     # 0x4adf8
cmpq %r14, 0x20(%rax)
je 0x869c
xorl %eax, %eax
jmp 0x874a
xorl %eax, %eax
retq
leaq 0x572dd(%rip), %rax     # 0x5f980
movl (%rax), %edi
pushq $0xf
popq %rsi
callq 0xa2f1
testb %al, %al
je 0x86e6
callq 0x21d7d
cvtsi2ss %eax, %xmm0
movaps %xmm0, -0x20(%rbp)
leaq 0x572b7(%rip), %rax     # 0x5f97c
movl (%rax), %edi
pushq $0xf
popq %rsi
callq 0xa2f1
testb %al, %al
je 0x8701
cvtss2sd -0x20(%rbp), %xmm0
mulsd 0x22988(%rip), %xmm0    # 0x2b068
cvtsd2ss %xmm0, %xmm1
jmp 0x8705
callq 0x21d38
movaps %xmm0, %xmm1
movss -0x20(%rbp), %xmm0
mulss %xmm1, %xmm0
addss (%rbx), %xmm0
movss %xmm0, (%rbx)
jmp 0x873b
movaps -0x20(%rbp), %xmm1
xorps %xmm0, %xmm0
ucomiss %xmm0, %xmm1
jne 0x870f
jnp 0x873b
movss (%rbx), %xmm0
addss %xmm1, %xmm0
movss %xmm0, (%rbx)
movss 0x228e1(%rip), %xmm0    # 0x2b004
movaps %xmm1, -0x20(%rbp)
movss 0x22b01(%rip), %xmm1    # 0x2b230
movq %rbx, %rdi
callq 0x21e00
movaps -0x20(%rbp), %xmm1
xorps %xmm0, %xmm0
cmpneqss %xmm1, %xmm0
movd %xmm0, %eax
andl $0x1, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/FredTheDino[P]Fog/src/engine/util/tweak_values.cpp
// Function: Util::show(char const*, unsigned char)
b8 show(const char *name, b8 value) {
    if (!debug_values_are_on()) return false;
    const char *buffer = Util::format_int(" %s: %s", name, value ? "true" : "false");
    debug_value_logic(name, buffer);
    return name == global_tweak.active && Input::mouse_pressed(0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
cmpb $0x0, 0x418c0(%rip)     # 0x4a370
je 0x8b07
movq %rdi, %rbx
testb %sil, %sil
leaq 0x23dc0(%rip), %rax     # 0x2c87f
leaq 0x23db4(%rip), %rdx     # 0x2c87a
cmoveq %rax, %rdx
leaq 0x23da1(%rip), %rdi     # 0x2c872
xorl %r14d, %r14d
movq %rbx, %rsi
xorl %eax, %eax
callq 0x9642
movq %rbx, %rdi
movq %rax, %rsi
callq 0x21c65
leaq 0x42308(%rip), %rax     # 0x4adf8
cmpq %rbx, 0x18(%rax)
jne 0x8b0a
leaq 0x417db(%rip), %rax     # 0x4a2d8
cmpl $0x3, 0x68(%rax)
sete %r14b
jmp 0x8b0a
xorl %r14d, %r14d
movl %r14d, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/FredTheDino[P]Fog/src/engine/util/tweak_values.cpp
// Function: Util::show(char const*, int)
b8 show(const char *name, s32 value) {
    if (!debug_values_are_on()) return false;
    const char *buffer = Util::format_int(" %s: %d", name, value);
    debug_value_logic(name, buffer);
    return name == global_tweak.active && Input::mouse_pressed(0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
cmpb $0x0, 0x41846(%rip)     # 0x4a370
je 0x8b6c
movl %esi, %edx
movq %rdi, %r14
leaq 0x23d57(%rip), %rdi     # 0x2c88f
xorl %ebx, %ebx
movq %r14, %rsi
xorl %eax, %eax
callq 0x9642
movq %r14, %rdi
movq %rax, %rsi
callq 0x21c65
leaq 0x422a2(%rip), %rax     # 0x4adf8
cmpq %r14, 0x18(%rax)
jne 0x8b6e
leaq 0x41775(%rip), %rax     # 0x4a2d8
cmpl $0x3, 0x68(%rax)
sete %bl
jmp 0x8b6e
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/FredTheDino[P]Fog/src/engine/util/tweak_values.cpp
// Function: Util::show(char const*, unsigned int)
b8 show(const char *name, u32 value) {
    if (!debug_values_are_on()) return false;
    const char *buffer = Util::format_int(" %s: %u", name, value);
    debug_value_logic(name, buffer);
    return name == global_tweak.active && Input::mouse_pressed(0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
cmpb $0x0, 0x417e3(%rip)     # 0x4a370
je 0x8bcf
movl %esi, %edx
movq %rdi, %r14
leaq 0x23cfc(%rip), %rdi     # 0x2c897
xorl %ebx, %ebx
movq %r14, %rsi
xorl %eax, %eax
callq 0x9642
movq %r14, %rdi
movq %rax, %rsi
callq 0x21c65
leaq 0x4223f(%rip), %rax     # 0x4adf8
cmpq %r14, 0x18(%rax)
jne 0x8bd1
leaq 0x41712(%rip), %rax     # 0x4a2d8
cmpl $0x3, 0x68(%rax)
sete %bl
jmp 0x8bd1
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/FredTheDino[P]Fog/src/engine/util/tweak_values.cpp
// Function: Util::show(char const*, float)
b8 show(const char *name, f32 value) {
    if (!debug_values_are_on()) return false;
    const char *buffer = Util::format_int(" %s: %.4f", name, value);
    debug_value_logic(name, buffer);
    return name == global_tweak.active && Input::mouse_pressed(0);
}

// Assembly:
cmpb $0x0, 0x41787(%rip)     # 0x4a370
je 0x8c25
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
cvtss2sd %xmm0, %xmm0
leaq 0x23c86(%rip), %rdi     # 0x2c885
movq %rbx, %rsi
movb $0x1, %al
callq 0x9642
movq %rbx, %rdi
movq %rax, %rsi
callq 0x21c65
leaq 0x421dd(%rip), %rax     # 0x4adf8
cmpq %rbx, 0x18(%rax)
je 0x8c28
xorl %eax, %eax
jmp 0x8c36
xorl %eax, %eax
retq
leaq 0x416a9(%rip), %rax     # 0x4a2d8
cmpl $0x3, 0x68(%rax)
sete %al
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/FredTheDino[P]Fog/src/engine/util/tweak_values.cpp
// Function: Util::show(char const*, Vec2)
b8 show(const char *name, Vec2 value) {
    if (!debug_values_are_on()) return false;
    const char *buffer = Util::format_int(" %s: %.4f, %.4f", name, value.x, value.y);
    debug_value_logic(name, buffer);
    return name == global_tweak.active && Input::mouse_pressed(0);
}

// Assembly:
cmpb $0x0, 0x41722(%rip)     # 0x4a370
je 0x8c95
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
cvtss2sd %xmm0, %xmm2
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
cvtss2sd %xmm0, %xmm1
leaq 0x23c33(%rip), %rdi     # 0x2c89f
movq %rbx, %rsi
movaps %xmm2, %xmm0
movb $0x2, %al
callq 0x9642
movq %rbx, %rdi
movq %rax, %rsi
callq 0x21c65
leaq 0x4216d(%rip), %rax     # 0x4adf8
cmpq %rbx, 0x18(%rax)
je 0x8c98
xorl %eax, %eax
jmp 0x8ca6
xorl %eax, %eax
retq
leaq 0x41639(%rip), %rax     # 0x4a2d8
cmpl $0x3, 0x68(%rax)
sete %al
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/FredTheDino[P]Fog/src/engine/util/tweak_values.cpp
// Function: Util::show(char const*, Span)
b8 show(const char *name, Span value) {
    if (!debug_values_are_on()) return false;
    const char *buffer = Util::format_int(" %s: %.4f, %.4f", name, value.min, value.max);
    debug_value_logic(name, buffer);
    return name == global_tweak.active && Input::mouse_pressed(0);
}

// Assembly:
cmpb $0x0, 0x416b2(%rip)     # 0x4a370
je 0x8d05
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
cvtss2sd %xmm0, %xmm2
shufps $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
cvtss2sd %xmm0, %xmm1
leaq 0x23bc3(%rip), %rdi     # 0x2c89f
movq %rbx, %rsi
movaps %xmm2, %xmm0
movb $0x2, %al
callq 0x9642
movq %rbx, %rdi
movq %rax, %rsi
callq 0x21c65
leaq 0x420fd(%rip), %rax     # 0x4adf8
cmpq %rbx, 0x18(%rax)
je 0x8d08
xorl %eax, %eax
jmp 0x8d16
xorl %eax, %eax
retq
leaq 0x415c9(%rip), %rax     # 0x4a2d8
cmpl $0x3, 0x68(%rax)
sete %al
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/FredTheDino[P]Fog/src/engine/platform/input.h
// Function: Input::toID(Input::Player)
u32 toID(Player p) {
    switch (p) {
        case (Player::P1):
            return 0;
        case (Player::P2):
            return 1;
        case (Player::P3):
            return 2;
        case (Player::P4):
            return 3;
        default:
            UNREACHABLE;
    }
    // Safe guard return.
    return 0;
}

// Assembly:
decl %edi
cmpl $0x8, %edi
jae 0x8dac
movl $0x8b, %eax
btl %edi, %eax
jae 0x8dac
movl %edi, %eax
leaq 0x37c08(%rip), %rcx     # 0x409b0
movl (%rcx,%rax,4), %eax
retq
pushq %rbp
movq %rsp, %rbp
movq 0x41219(%rip), %rax     # 0x49fd0
movq (%rax), %rsi
leaq 0x22d88(%rip), %rdi     # 0x2bb49
leaq 0x22d8d(%rip), %rdx     # 0x2bb55
leaq 0x22da2(%rip), %r8      # 0x2bb71
leaq 0x22da0(%rip), %r9      # 0x2bb76
pushq $0x2d
popq %rcx
xorl %eax, %eax
callq 0x683a
callq 0x68ed
pushq $-0x1
popq %rdi
callq 0x2330
// File: /workspace/github_c_makefile_star2_O2/FredTheDino[P]Fog/src/engine/platform/input.cpp
// Function: Input::add_mod(unsigned int, unsigned int, Input::Player, float)
b8 add_mod(InputCode code, Name name, Player player, f32 modifier) {
    Binding binding = {code, player, name, 0};

    // Check if there is a free binding.
    ASSERT(is_valid_player(player), "");
    auto buttons = global_mapping.buttons[toID(player)];
    u32 index = binding.index();
    b8 valid = false;
    for (u32 i = 0; i < NUM_ALTERNATIVE_BINDINGS; i++) {
        if (buttons[index + i].is_used()) continue;
        binding.binding_id = i;
        buttons[index + i].reset(name, modifier);
        valid = true;
        break;
    }

    CHECK(valid, "Cannot add new mapping");
    if (!valid) return false;

    insert(binding);
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movss %xmm0, -0x24(%rbp)
movl %edx, %r14d
movl %esi, %ebx
movl %edi, -0x20(%rbp)
movl %edx, -0x1c(%rbp)
movl %esi, -0x18(%rbp)
movb $0x0, -0x14(%rbp)
cmpl $0x4, %edx
ja 0x8e50
movb $0x1, %al
pushq $0x16
popq %rcx
btl %r14d, %ecx
jb 0x8e57
cmpl $0x8, %r14d
sete %al
movzbl %al, %ecx
leaq 0x23026(%rip), %rdi     # 0x2be87
leaq 0x23091(%rip), %rdx     # 0x2bef9
pushq $0x27
popq %rsi
callq 0x6903
movl %r14d, %edi
callq 0x8d8e
movl %eax, %eax
leaq 0x41457(%rip), %rcx     # 0x4a2d8
movq 0x20(%rcx,%rax,8), %r14
leaq -0x20(%rbp), %rdi
callq 0x29374
movl %eax, %ecx
xorl %eax, %eax
cmpq $0x4, %rax
je 0x8eac
leal (%rcx,%rax), %edx
shlq $0x4, %rdx
cmpl $0x0, (%r14,%rdx)
je 0x8ec8
incq %rax
jmp 0x8e93
leaq 0x22fd4(%rip), %rdi     # 0x2be87
leaq 0x23059(%rip), %rdx     # 0x2bf13
pushq $0x33
popq %rsi
xorl %ebx, %ebx
xorl %ecx, %ecx
callq 0x693a
jmp 0x8f09
addq %rdx, %r14
movb %al, -0x14(%rbp)
movl %ebx, (%r14)
movss -0x24(%rbp), %xmm0
movss %xmm0, 0x4(%r14)
andq $0x0, 0x8(%r14)
leaq 0x22f9f(%rip), %rdi     # 0x2be87
leaq 0x23024(%rip), %rdx     # 0x2bf13
pushq $0x33
popq %rsi
pushq $0x1
popq %rcx
callq 0x693a
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x9c2a
movb $0x1, %bl
movl %ebx, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/FredTheDino[P]Fog/src/engine/util/font_settings.h
// Function: Util::init()
b8 init() {
        DEBUG_FONT = Asset::fetch_id("MONACO_FONT");
        if (DEBUG_FONT != Asset::ASSET_ID_NO_ASSET)
            return true;
        LOG("Failed to load the default font.");
        return false;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
leaq 0x22c56(%rip), %rdi     # 0x2bb8f
callq 0x8f8f
leaq 0x56a4b(%rip), %rcx     # 0x5f990
movq %rax, (%rcx)
movb $0x1, %bl
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpq %rcx, %rax
jne 0x8f86
movq 0x4106d(%rip), %rax     # 0x49fc8
movq (%rax), %rsi
leaq 0x22c36(%rip), %rdi     # 0x2bb9b
leaq 0x22c33(%rip), %rdx     # 0x2bb9f
leaq 0x22c4c(%rip), %r8      # 0x2bbbf
leaq 0x22c4a(%rip), %r9      # 0x2bbc4
xorl %ebx, %ebx
pushq $0xe
popq %rcx
xorl %eax, %eax
callq 0x683a
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/FredTheDino[P]Fog/src/engine/asset/asset.cpp
// Function: Asset::fetch_id(char const*)
AssetID fetch_id(const char *str) {
    u64 hash = asset_hash(str);
    for (u64 i = 0; i < system.num_assets; i++) {
        Header *headers = system.headers;
        if (headers[i].hash == hash) return i;
    }
    LOG("Failed to load asset: '%s', check that the correct .fog file is loaded.", str);
    return ASSET_ID_NO_ASSET;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x8495
movq %rax, %rcx
leaq 0x5d2f9(%rip), %rax     # 0x662a0
movq 0x28(%rax), %rdx
movq 0x38(%rax), %rsi
addq $0x28, %rdx
xorl %eax, %eax
cmpq %rax, %rsi
je 0x8fc8
cmpq %rcx, (%rdx)
je 0x9001
incq %rax
addq $0x38, %rdx
jmp 0x8fb5
movq 0x40ff9(%rip), %rax     # 0x49fc8
movq (%rax), %rsi
movq %rbx, (%rsp)
leaq 0x22bbe(%rip), %rdi     # 0x2bb9b
leaq 0x235ca(%rip), %rdx     # 0x2c5ae
leaq 0x23642(%rip), %r8      # 0x2c62d
leaq 0x23644(%rip), %r9      # 0x2c636
pushq $0x40
popq %rcx
xorl %eax, %eax
callq 0x683a
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/FredTheDino[P]Fog/src/engine/renderer/text.cpp
// Function: Renderer::messure_text(char const*, float, unsigned long long)
Vec2 messure_text(const char *string, f32 size, AssetID font_id) {
    Asset::Font *font = Asset::fetch_font(font_id);
    ASSERT(font, "Cannot find font");
    f32 length = 0;
    if (!font->num_kernings) {
        while (*(string++)) length += font->glyphs[(u8) 'A'].advance;
    } else {
        u8 prev = '\0';
        while (*string) {
            u8 curr = *(string++);
            length += font->find_kerning(prev, curr);
            length += font->glyphs[curr].advance + font->glyphs[curr].x_offset;
        }
    }
    return V2(length * size, size * font->height);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movaps %xmm0, -0x30(%rbp)
movq %rdi, %r14
movq %rsi, %rdi
callq 0x202ce
movq %rax, %rbx
xorl %ecx, %ecx
testq %rax, %rax
setne %cl
leaq 0x232e7(%rip), %rdi     # 0x2c371
leaq 0x232fd(%rip), %rdx     # 0x2c38e
pushq $0x5
popq %rsi
callq 0x6903
cmpq $0x0, 0x18(%rbx)
je 0x90e5
xorps %xmm1, %xmm1
movzbl (%r14), %r15d
testq %r15, %r15
je 0x90ff
incq %r14
movsbl %r15b, %edx
movq %rbx, %rdi
xorl %esi, %esi
movaps %xmm1, -0x40(%rbp)
callq 0x29a5c
movaps -0x40(%rbp), %xmm1
addss %xmm0, %xmm1
movq 0x20(%rbx), %rax
shll $0x5, %r15d
movss 0x1c(%rax,%r15), %xmm0
addss 0x14(%rax,%r15), %xmm0
addss %xmm0, %xmm1
jmp 0x90a3
xorps %xmm1, %xmm1
cmpb $0x0, (%r14)
je 0x90ff
incq %r14
movq 0x20(%rbx), %rax
addss 0x83c(%rax), %xmm1
jmp 0x90e8
movaps -0x30(%rbp), %xmm0
mulss %xmm0, %xmm1
mulss 0x8(%rbx), %xmm0
unpcklps %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movaps %xmm1, %xmm0
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/FredTheDino[P]Fog/src/engine/util/io.cpp
// Function: Util::format(char const*, __va_list_tag*)
char *format(const char *fmt, va_list args) {
    // TODO(ed): Test this function.
    char c;
    int size = vsnprintf(&c, 1, fmt, args);
    ASSERT(size > 0, "Failed to print format string");
    char *buffer = request_temporary_memory<char>(++size);
    vsnprintf(buffer, size, fmt, args);
    va_end(args);
    return buffer;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq -0x21(%rbp), %rdi
pushq $0x1
popq %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x2340
movl %eax, %r15d
xorl %ecx, %ecx
testl %eax, %eax
setg %cl
leaq 0x22637(%rip), %rdi     # 0x2bc38
leaq 0x22647(%rip), %rdx     # 0x2bc4f
pushq $0x3c
popq %rsi
callq 0x6903
incl %r15d
movslq %r15d, %r15
movq %r15, %rdi
callq 0x29318
movq %rax, %r12
movq %rax, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x2340
movq %r12, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/FredTheDino[P]Fog/src/engine/util/io.cpp
// Function: Util::format_int(char const*, ...)
char *format_int(const char *fmt, ...) {
    va_list args;
    va_start(args, fmt);
    char c;
    int size = vsnprintf_(&c, 1, fmt, args);
    ASSERT(size > 0, "Failed to print format string");
    va_end(args);
    char *buffer = request_temporary_memory<char>(++size);
    va_start(args, fmt);
    vsnprintf_(buffer, size, fmt, args);
    va_end(args);
    return buffer;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rdi, %rbx
leaq -0x100(%rbp), %r13
movq %rsi, 0x8(%r13)
movq %rdx, 0x10(%r13)
movq %rcx, 0x18(%r13)
movq %r8, 0x20(%r13)
movq %r9, 0x28(%r13)
testb %al, %al
je 0x96a7
movaps %xmm0, -0xd0(%rbp)
movaps %xmm1, -0xc0(%rbp)
movaps %xmm2, -0xb0(%rbp)
movaps %xmm3, -0xa0(%rbp)
movaps %xmm4, -0x90(%rbp)
movaps %xmm5, -0x80(%rbp)
movaps %xmm6, -0x70(%rbp)
movaps %xmm7, -0x60(%rbp)
leaq -0x50(%rbp), %r14
movq %r13, 0x10(%r14)
leaq 0x10(%rbp), %rax
movq %rax, 0x8(%r14)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%r14)
leaq -0x29(%rbp), %rdi
pushq $0x1
popq %rsi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x6770
movl %eax, %r15d
xorl %ecx, %ecx
testl %eax, %eax
setg %cl
leaq 0x22551(%rip), %rdi     # 0x2bc38
leaq 0x22561(%rip), %rdx     # 0x2bc4f
pushq $0x4a
popq %rsi
callq 0x6903
incl %r15d
movslq %r15d, %r15
movq %r15, %rdi
callq 0x29318
movq %rax, %r12
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%r14)
leaq 0x10(%rbp), %rax
movq %rax, 0x8(%r14)
movq %r13, 0x10(%r14)
movq %r12, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x6770
movq %r12, %rax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/FredTheDino[P]Fog/src/engine/util/io.cpp
// Function: Util::format_inplace(char*, char const*, ...)
u32 format_inplace(char *out, const char *fmt, ...) {
    // TODO(ed): This needs some error checking..
    va_list args;
    va_start(args, fmt);
    u32 written = vsnprintf(out, 100, fmt, args);
    va_end(args);
    return written;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rsi, %r10
leaq -0xd0(%rbp), %rsi
movq %rdx, 0x10(%rsi)
movq %rcx, 0x18(%rsi)
movq %r8, 0x20(%rsi)
movq %r9, 0x28(%rsi)
testb %al, %al
je 0x9795
movaps %xmm0, -0xa0(%rbp)
movaps %xmm1, -0x90(%rbp)
movaps %xmm2, -0x80(%rbp)
movaps %xmm3, -0x70(%rbp)
movaps %xmm4, -0x60(%rbp)
movaps %xmm5, -0x50(%rbp)
movaps %xmm6, -0x40(%rbp)
movaps %xmm7, -0x30(%rbp)
leaq -0x20(%rbp), %rcx
movq %rsi, 0x10(%rcx)
leaq 0x10(%rbp), %rax
movq %rax, 0x8(%rcx)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, (%rcx)
pushq $0x64
popq %rsi
movq %r10, %rdx
callq 0x2340
addq $0xd0, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/FredTheDino[P]Fog/src/engine/util/io.cpp
// Function: Util::utf8_size(char const*)
u8 utf8_size(const char *c) {
    if ((*c & 0b10000000) == 0) return 1;
    if ((*c & 0b11100000) == 0b11000000) return 2;
    if ((*c & 0b11110000) == 0b11100000) return 3;
    if ((*c & 0b11111000) == 0b11110000) return 4;
    ERR("Invalid codepoint");
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movzbl (%rdi), %eax
movb $0x1, %bl
testb %al, %al
jns 0x9831
movl %eax, %ecx
andl $-0x20, %ecx
movb $0x2, %bl
cmpl $0xc0, %ecx
je 0x9831
movl %eax, %ecx
andl $-0x10, %ecx
movb $0x3, %bl
cmpl $0xe0, %ecx
je 0x9831
andl $-0x8, %eax
movb $0x4, %bl
cmpl $0xf0, %eax
je 0x9831
movq 0x407ca(%rip), %rax     # 0x49fd0
movq (%rax), %rsi
leaq 0x22467(%rip), %rdi     # 0x2bc77
leaq 0x22421(%rip), %rdx     # 0x2bc38
leaq 0x2245d(%rip), %r8      # 0x2bc7b
leaq 0x22460(%rip), %r9      # 0x2bc85
xorl %ebx, %ebx
pushq $0x6e
popq %rcx
xorl %eax, %eax
callq 0x683a
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/FredTheDino[P]Fog/src/engine/util/io.cpp
// Function: Util::utf8_insert_glyph(char*, char const*, unsigned int)
b8 utf8_insert_glyph(char *to, const char *from, u32 length) {
    const u32 glyph_size = utf8_size(from);
    if (glyph_size > length) return false;
    for (u32 i = 0; i < glyph_size; i++)
        to[i] = from[i];
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %r15d
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
callq 0x97c6
movzbl %al, %eax
cmpl %r15d, %eax
jbe 0x9870
xorl %eax, %eax
jmp 0x9885
xorl %ecx, %ecx
cmpq %rcx, %rax
je 0x9883
movb (%rbx,%rcx), %dl
movb %dl, (%r14,%rcx)
incq %rcx
jmp 0x9872
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/FredTheDino[P]Fog/src/engine/util/io.cpp
// Function: Util::contains_substr(char const*, char const*)
b8 contains_substr(const char *str, const char *substr) {
    for (; *str; str++) {
        for (u32 i = 0; str[i] == substr[i]; i++) {
            if (substr[i+1] == '\0')
                return true;
        }
    }
    return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl $0x1, %eax
cmpb $0x0, (%rdi)
je 0x98dd
movb (%rsi), %dl
movl %eax, %ecx
leal -0x1(%rcx), %r8d
cmpb %dl, (%rdi,%r8)
jne 0x98d4
movl %ecx, %edx
movb (%rsi,%rdx), %dl
incl %ecx
testb %dl, %dl
jne 0x98bd
jmp 0x98d9
incq %rdi
jmp 0x98b4
movb $0x1, %al
popq %rbp
retq
xorl %eax, %eax
jmp 0x98db
// File: /workspace/github_c_makefile_star2_O2/FredTheDino[P]Fog/src/engine/util/memory.cpp
// Function: Util::do_all_allocations()
void do_all_allocations() {
    static_assert(TOTAL_MEMORY_BUDGET % ARENA_SIZE_IN_BYTES == 0);

    // Setup regions.
    global_memory.free_regions = global_memory.all_regions + 0;
    global_memory.num_free_regions = NUM_ARENAS;
    for (u64 i = 0; i < NUM_ARENAS - 1; i++) {
        global_memory.all_regions[i].next = global_memory.all_regions + i + 1;
        global_memory.all_regions[i].memory = malloc(ARENA_SIZE_IN_BYTES);
    }
    global_memory.all_regions[NUM_ARENAS - 1].next = 0;

    // Frame memory
    for (u32 i = 0; i < FRAME_LAG_FOR_MEMORY; i++)
        FRAME_MEMORY[i] = request_arena();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
leaq 0x41479(%rip), %rbx     # 0x4ae28
leaq 0x10(%rbx), %rax
movq %rax, 0x8(%rbx)
movq $0x40, (%rbx)
leaq 0x30(%rbx), %r14
pushq $0x3f
popq %r15
subq $0x1, %r15
jb 0x99e4
movq %r14, -0x10(%r14)
movl $0x200000, %edi         # imm = 0x200000
callq 0x2450
movq %rax, -0x8(%r14)
addq $0x20, %r14
jmp 0x99c6
andq $0x0, 0x800(%rbx)
xorl %ebx, %ebx
leaq 0x55feb(%rip), %r14     # 0x5f9e0
cmpq $0x10, %rbx
je 0x9a0c
xorl %edi, %edi
callq 0x9a17
movq %rax, (%rbx,%r14)
addq $0x8, %rbx
jmp 0x99f5
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq