LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/extracters/dbtap/tapeio.c
// Function: WriteTapeRecord
int WriteTapeRecord(
  void *buf,
  int len
)
{
  uint8 meta[4];
  int datalen;

  meta[0] = len & 0xFF;
  meta[1] = (len >> 8) & 0xFF;
  meta[2] = (len >> 16) & 0xFF;
  meta[3] = (len >> 24) & 0xFF;

  datalen = (len + 1) & ~1;

  if (fwrite(meta, sizeof(meta), 1, tfile) != 1)
    return -1;

  if (fwrite(buf, datalen, 1, tfile) != 1)
    return -1;

  if (fwrite(meta, sizeof(meta), 1, tfile) != 1)
    return -1;

  return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %esi, %ebp
movq %rdi, %r14
leaq 0xc(%rsp), %rdi
movl %esi, (%rdi)
movq 0x3234(%rip), %rcx      # 0x5220
movl $0x4, %esi
movl $0x1, %edx
callq 0x11e0
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpq $0x1, %rax
jne 0x204e
incl %ebp
andl $-0x2, %ebp
movslq %ebp, %rsi
movq 0x320b(%rip), %rcx      # 0x5220
movl $0x1, %edx
movq %r14, %rdi
callq 0x11e0
cmpq $0x1, %rax
jne 0x204e
movq 0x31f1(%rip), %rcx      # 0x5220
leaq 0xc(%rsp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x11e0
xorl %ebx, %ebx
cmpq $0x1, %rax
setne %bl
negl %ebx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/extracters/dbtap/tapeio.c
// Function: WriteTapeMark
int WriteTapeMark(
  int backup
)
{
  uint32 tm = 0;

  if (fwrite(&tm, sizeof(tm), 1, tfile) != 1)
    return -1;

  if (backup)
    if (fseek(tfile, -sizeof(tm), SEEK_CUR) != 0)
      return -1;

  return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %edi, %ebp
leaq 0x4(%rsp), %rdi
movl $0x0, (%rdi)
movq 0x31b0(%rip), %rcx      # 0x5220
movl $0x4, %esi
movl $0x1, %edx
callq 0x11e0
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpq $0x1, %rax
jne 0x20ac
testl %ebp, %ebp
je 0x20aa
movq 0x318b(%rip), %rdi      # 0x5220
movq $-0x4, %rsi
movl $0x1, %edx
callq 0x1170
testl %eax, %eax
jne 0x20ac
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/extracters/dbtap/tapeio.c
// Function: writeTapeBuffering
int writeTapeBuffering(
  char ch
)
{
  buffer[occupied++] = ch;

  if (occupied == rLength) {
    occupied = 0;
    return WriteTapeRecord(buffer, rLength);
  }
  return 0;
}

// Assembly:
movslq 0x313c(%rip), %rax      # 0x522c
leal 0x1(%rax), %esi
movl %esi, 0x3133(%rip)      # 0x522c
leaq 0x3130(%rip), %rcx      # 0x5230
movb %dil, (%rax,%rcx)
cmpl 0x311e(%rip), %esi      # 0x5228
jne 0x2122
movl $0x0, 0x3116(%rip)      # 0x522c
leaq 0x3113(%rip), %rdi      # 0x5230
jmp 0x1fd1
xorl %eax, %eax
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/extracters/dbtap/dos11.c
// Function: AscR50
static uint16 AscR50(
  char *inbuf
)
{
  uint16 value;
  char *ptr;

  if ((ptr = strchr(rad50, toupper(*inbuf++))) == NULL)
    ptr = strchr(rad50, '%');

  value = (ptr - rad50) * 03100;

  if ((ptr = strchr(rad50, toupper(*inbuf++))) == NULL)
    ptr = strchr(rad50, '%');

  value += (ptr - rad50) * 050;

  if ((ptr = strchr(rad50, toupper(*inbuf))) == NULL)
    ptr = strchr(rad50, '%');

  value += ptr - rad50;

  return value;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
callq 0x1030
movq (%rax), %r12
movsbq (%r14), %rax
movl (%r12,%rax,4), %esi
leaq 0x2d18(%rip), %rdi      # 0x5130
callq 0x10d0
movq %rax, %rbx
testq %rax, %rax
jne 0x2439
leaq 0x2d04(%rip), %rdi      # 0x5130
movl $0x25, %esi
callq 0x10d0
movq %rax, %rbx
movsbq 0x1(%r14), %rax
movl (%r12,%rax,4), %esi
leaq 0x2ce7(%rip), %rdi      # 0x5130
callq 0x10d0
movq %rax, %r15
testq %rax, %rax
jne 0x246a
leaq 0x2cd3(%rip), %rdi      # 0x5130
movl $0x25, %esi
callq 0x10d0
movq %rax, %r15
movsbq 0x2(%r14), %rax
movl (%r12,%rax,4), %esi
leaq 0x2cb6(%rip), %rdi      # 0x5130
callq 0x10d0
testq %rax, %rax
jne 0x2495
leaq 0x2ca5(%rip), %rdi      # 0x5130
movl $0x25, %esi
callq 0x10d0
leaq 0x2c94(%rip), %rcx      # 0x5130
subl %ecx, %ebx
imull $0x640, %ebx, %edx      # imm = 0x640
subl %ecx, %r15d
shll $0x3, %r15d
leal (%r15,%r15,4), %esi
subl %ecx, %edx
addl %esi, %eax
addl %edx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/simh[P]simtools/extracters/dbtap/dos11.c
// Function: r50AscNoSpace
static int r50AscNoSpace(
  uint16 value,
  char *outbuf
)
{
  int count = 0;
  int value2 = value / 050;

  /*
   * The rad50 representation of ' ' is zero.
   */
  if ((value2 / 050) != 0)
    outbuf[count++] = rad50[value2 / 050];
  if ((value2 % 050) != 0)
    outbuf[count++] = rad50[value2 % 050];
  if ((value % 050) != 0)
    outbuf[count++] = rad50[value % 050];

  return count;
}

// Assembly:
imull $0xcccd, %edi, %edx     # imm = 0xCCCD
shrl $0x15, %edx
movl %edx, %eax
shll $0x3, %eax
leal (%rax,%rax,4), %eax
movl %edi, %ecx
subl %eax, %ecx
xorl %eax, %eax
cmpl $0x640, %edi            # imm = 0x640
jb 0x27ec
movzwl %di, %eax
shrl $0x6, %eax
imull $0xa3e, %eax, %eax      # imm = 0xA3E
shrl $0x10, %eax
leaq 0x294e(%rip), %rdi      # 0x5130
movb (%rax,%rdi), %al
movb %al, (%rsi)
movl $0x1, %eax
movzwl %dx, %edx
imull $0x667, %edx, %edi      # imm = 0x667
shrl $0xd, %edi
andl $-0x8, %edi
leal (%rdi,%rdi,4), %edi
subw %di, %dx
je 0x2817
movzwl %dx, %edx
leaq 0x2923(%rip), %rdi      # 0x5130
movb (%rdx,%rdi), %dl
movl %eax, %edi
incl %eax
movb %dl, (%rsi,%rdi)
testw %cx, %cx
je 0x2830
movzwl %cx, %ecx
leaq 0x290a(%rip), %rdx      # 0x5130
movb (%rcx,%rdx), %cl
movl %eax, %edx
incl %eax
movb %cl, (%rsi,%rdx)
retq
// File: /workspace/github_c_makefile_star2_O3/pyk[P]simple-nn/deps/pcg/src/pcg-advance-8.c
// Function: pcg_advance_lcg_8
uint8_t pcg_advance_lcg_8(uint8_t state, uint8_t delta, uint8_t cur_mult,
                          uint8_t cur_plus)
{
    uint8_t acc_mult = 1u;
    uint8_t acc_plus = 0u;
    while (delta > 0) {
        if (delta & 1) {
            acc_mult *= cur_mult;
            acc_plus = acc_plus * cur_mult + cur_plus;
        }
        cur_plus = (cur_mult + 1) * cur_plus;
        cur_mult *= cur_mult;
        delta /= 2;
    }
    return acc_mult * state + acc_plus;
}

// Assembly:
testl %esi, %esi
je 0x1751
pushq %rbx
movl %ecx, %r8d
movl %edx, %r9d
movb $0x1, %dl
xorl %ecx, %ecx
movl $0x1, %r11d
movl %esi, %ebx
movl %ecx, %eax
mulb %r9b
addb %r8b, %al
testb $0x1, %sil
movzbl %r9b, %r9d
movl %r9d, %r10d
cmovel %r11d, %r10d
movzbl %al, %eax
movzbl %cl, %ecx
cmovnel %eax, %ecx
movl %edx, %eax
mulb %r10b
leal 0x1(%r9), %r10d
movl %eax, %edx
movl %r10d, %eax
mulb %r8b
movl %eax, %r8d
movl %r9d, %eax
mulb %r9b
shrb %bl
movl %eax, %r9d
cmpb $0x1, %sil
movl %ebx, %esi
ja 0x1707
popq %rbx
jmp 0x1755
movb $0x1, %dl
xorl %ecx, %ecx
movl %edx, %eax
mulb %dil
addb %cl, %al
retq
// File: /workspace/github_c_makefile_star2_O3/mflatt[P]gc-demo/common/tree.c
// Function: make_tree
static struct node *make_tree(int depth)
{
  if (depth == 0)
    return NULL;
  else {
    if (create_garbage) {
      /* create and destroy a junk branch */
      struct node *n = NULL;
      PUSH_STACK_POINTER(n);
      SET_NODE(n, make_tree(depth-1));
      destroy_tree(n);
      UNSET_NODE(n);
      POP_STACK_POINTER(n);
    }
    
    /* Left subtree */
    struct node *l = NULL;
    PUSH_STACK_POINTER(l);
    SET_NODE(l, make_tree(depth-1));
    
    /* Right subtree */
    struct node *r = NULL;
    PUSH_STACK_POINTER(r);
    SET_NODE(r, make_tree(depth-1));
    
    /* New node */
    struct node *t = NULL;
    PUSH_STACK_POINTER(t);
    SET_NODE(t, allocate());
    SET_NODE(t->left, l);
    UNSET_NODE(l);
    SET_NODE(t->right, r);
    UNSET_NODE(r);

    UNSET_RETURN_NODE(t);

    POP_STACK_POINTER(t);
    POP_STACK_POINTER(r);
    POP_STACK_POINTER(l);

    return t;
  }
}

// Assembly:
testl %edi, %edi
je 0x1255
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edi, %ebx
leaq 0x2e64(%rip), %r14      # 0x4080
movl (%r14), %eax
cmpb $0x0, 0x2e2e(%rip)      # 0x4054
je 0x1258
cltq
movq %rsp, %rcx
movq $0x0, (%rcx)
leal 0x1(%rax), %edx
movl %edx, (%r14)
leaq 0x2e4f(%rip), %rdx      # 0x4090
movq %rcx, (%rdx,%rax,8)
decl %ebx
movl %ebx, %edi
callq 0x1201
movl (%r14), %eax
decl %eax
jmp 0x125a
xorl %eax, %eax
retq
decl %ebx
xorl %r12d, %r12d
movq %rsp, %r15
movq %r12, (%r15)
leal 0x1(%rax), %ecx
movl %ecx, (%r14)
cltq
leaq 0x2e1e(%rip), %rbp      # 0x4090
movq %r15, (%rbp,%rax,8)
movl %ebx, %edi
callq 0x1201
movq %rax, (%r15)
leaq 0x10(%rsp), %r13
movq %r12, (%r13)
movslq (%r14), %rax
leal 0x1(%rax), %ecx
movl %ecx, (%r14)
movq %r13, (%rbp,%rax,8)
movl %ebx, %edi
callq 0x1201
movq %rax, (%r13)
leaq 0x8(%rsp), %rbx
movq %r12, (%rbx)
movslq (%r14), %rax
leal 0x1(%rax), %ecx
movl %ecx, (%r14)
movq %rbx, (%rbp,%rax,8)
xorl %eax, %eax
callq 0x13fc
movq %rax, (%rbx)
movq (%r15), %rcx
movq %rcx, (%rax)
movq (%r13), %rcx
movq (%rbx), %rax
movq %rcx, 0x8(%rax)
addl $-0x3, (%r14)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/mflatt[P]gc-demo/2space/2space.c
// Function: collect_garbage
void collect_garbage()
{
  /* Set up new space */
  size_t new_size = (space_end - space_start + sizeof(struct gc_node));
  if (new_size < (prev_size * 2))
    new_size = prev_size * 2;
  
  void *new_space = raw_malloc(new_size);
  struct gc_node *alloc_pos = new_space;

  /* Copy into new space */
  copy_from_roots(&alloc_pos);

  /* Clean up old space */
  if (space_start != 0)
    raw_free((void *)space_start, space_end - space_start);

  /* Continue allocating into new space */
  space_start = (uintptr_t)new_space;
  space_end = space_start + new_size;
  space_next = (uintptr_t)alloc_pos;

  /* Remember size after collection to be used as a guide for the next
     space's size: */
  prev_size = space_next - space_start;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
leaq 0x2d19(%rip), %r15      # 0x4078
movq (%r15), %rax
leaq 0x3127(%rip), %r12      # 0x4490
subq (%r12), %rax
addq $0x18, %rax
movq 0x2cc8(%rip), %rbx      # 0x4040
addq %rbx, %rbx
cmpq %rbx, %rax
cmovaq %rax, %rbx
movq %rbx, %rdi
callq 0x1318
movq %rax, %r14
movq %rsp, %rdi
movq %rax, (%rdi)
callq 0x1436
movq (%r12), %rdi
testq %rdi, %rdi
je 0x13ac
movq (%r15), %rsi
subq %rdi, %rsi
callq 0x1342
movq %r14, (%r12)
addq %r14, %rbx
movq %rbx, (%r15)
movq (%rsp), %rax
leaq 0x2caf(%rip), %rcx      # 0x4070
movq %rax, (%rcx)
subq %r14, %rax
movq %rax, 0x2c72(%rip)      # 0x4040
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/mflatt[P]gc-demo/2space/copy.c
// Function: allocate
struct node *allocate()
{
  if (space_next + sizeof(struct gc_node) > space_end)
    collect_garbage();

  struct gc_node *p = (struct gc_node *)space_next;
  space_next += sizeof(struct gc_node);

  p->forwarded = 0;

  return &p->n;
}

// Assembly:
pushq %rax
movq 0x2c6c(%rip), %rax      # 0x4070
leaq 0x18(%rax), %rcx
cmpq 0x2c69(%rip), %rcx      # 0x4078
jbe 0x1423
xorl %eax, %eax
callq 0x1350
movq 0x2c51(%rip), %rax      # 0x4070
leaq 0x18(%rax), %rcx
movq %rcx, 0x2c46(%rip)      # 0x4070
movl $0x0, (%rax)
addq $0x8, %rax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/mflatt[P]gc-demo/2space/copy.c
// Function: copy_from_roots
void copy_from_roots(struct gc_node **alloc_pos_ptr)
{
  struct gc_node *init_ptr = *alloc_pos_ptr;
  
  for (int i = 0; i < num_roots; i++) {
    copy_or_forward(root_addrs[i], alloc_pos_ptr);
  }

  traverse_copied(init_ptr, alloc_pos_ptr);
}

// Assembly:
cmpl $0x0, 0x2c43(%rip)      # 0x4080
jle 0x14a6
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %r14
leaq 0x2c3c(%rip), %r15      # 0x4090
xorl %r12d, %r12d
movq (%r15), %rdi
movq %rbx, %rsi
callq 0x14a7
incq %r12
movslq 0x2c14(%rip), %rax      # 0x4080
addq $0x8, %r15
cmpq %rax, %r12
jl 0x1457
cmpq %r14, (%rbx)
jbe 0x149b
leaq 0x8(%r14), %rdi
movq %rbx, %rsi
callq 0x14a7
leaq 0x10(%r14), %rdi
movq %rbx, %rsi
callq 0x14a7
addq $0x18, %r14
cmpq (%rbx), %r14
jb 0x147a
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/mflatt[P]gc-demo/2space/copy.c
// Function: copy_or_forward
static void copy_or_forward(struct node **addr,
                            struct gc_node **alloc_pos_ptr)
{
  if (is_allocated(*addr)) {
    struct gc_node *nh;
    nh = NODE_TO_GC(*addr);
    
    if (nh->forwarded) {
      /* Object already copied */
      *addr = nh->forward_to;
    } else {
      /* Allocate a copy: */
      struct gc_node *nh2;
      nh2 = *alloc_pos_ptr;
      (*alloc_pos_ptr)++;
      memcpy(nh2, nh, sizeof(struct gc_node));

      /* Mark old location as copied and set forwarding pointer */
      nh->forwarded = 1;
      nh->forward_to = &nh2->n;
      *addr = &nh2->n;
    }
  }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq (%rdi), %rdi
callq 0x13da
testl %eax, %eax
je 0x14f8
movq (%rbx), %rax
cmpl $0x0, -0x8(%rax)
je 0x14cb
movq (%rax), %rcx
jmp 0x14f5
leaq -0x8(%rax), %rdx
movq (%r14), %rcx
leaq 0x18(%rcx), %rsi
movq %rsi, (%r14)
movq 0x10(%rdx), %rsi
movq %rsi, 0x10(%rcx)
movups (%rdx), %xmm0
movups %xmm0, (%rcx)
movl $0x1, -0x8(%rax)
addq $0x8, %rcx
movq %rcx, (%rax)
movq %rcx, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/adelciotto[P]scg/examples/../scg.h
// Function: scg_image_new
scg_image_t *scg_image_new(int width, int height) {
    uint32_t *pixels = calloc(width * height, sizeof(*pixels));
    if (pixels == NULL) {
        scg_log_error("Failed to allocate memory for pixels");

        return NULL;
    }

    scg_image_t *image = malloc(sizeof(*image));
    if (image == NULL) {
        scg_log_error("Failed to allocate memory for image");

        free(pixels);
        return NULL;
    }

    image->width = width;
    image->height = height;
    image->pitch = width * sizeof(*pixels);
    image->pixels = pixels;
    image->blend_mode = SCG_BLEND_MODE_NONE;

    return image;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %r15d
movl %edi, %ebp
movl %esi, %eax
imull %edi, %eax
movslq %eax, %rdi
movl $0x4, %esi
callq 0x2150
testq %rax, %rax
je 0x28b3
movq %rax, %r14
movl $0x20, %edi
callq 0x22f0
testq %rax, %rax
je 0x28e2
movq %rax, %rbx
movl %ebp, (%rax)
movl %r15d, 0x4(%rax)
shll $0x2, %ebp
movl %ebp, 0x8(%rax)
movq %r14, 0x10(%rax)
movl $0x0, 0x18(%rax)
jmp 0x2917
leaq 0x3826(%rip), %rsi      # 0x60e0
leaq 0x3837(%rip), %rdx      # 0x60f8
leaq 0x383e(%rip), %rcx      # 0x6106
leaq 0x3849(%rip), %r9       # 0x6118
xorl %ebx, %ebx
xorl %edi, %edi
movl $0x262, %r8d            # imm = 0x262
xorl %eax, %eax
callq 0x22e0
jmp 0x2917
leaq 0x37f7(%rip), %rsi      # 0x60e0
leaq 0x3808(%rip), %rdx      # 0x60f8
leaq 0x380f(%rip), %rcx      # 0x6106
leaq 0x383f(%rip), %r9       # 0x613d
xorl %ebx, %ebx
xorl %edi, %edi
movl $0x269, %r8d            # imm = 0x269
xorl %eax, %eax
callq 0x22e0
movq %r14, %rdi
callq 0x2290
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/adelciotto[P]scg/examples/../scg.h
// Function: scg_image_set_pixel
void scg_image_set_pixel(scg_image_t *image, int x, int y, scg_pixel_t color) {
    int w = image->width;
    int h = image->height;

    if (x < 0 || x >= w || y < 0 || y >= h) {
        return;
    }

    scg_blend_mode_t blend_mode = image->blend_mode;
    int i = scg_pixel_index_from_xy(x, y, w);

    if (blend_mode == SCG_BLEND_MODE_NONE) {
        image->pixels[i] = color.packed;
    }

    if (blend_mode == SCG_BLEND_MODE_MASK) {
        if (color.data.a == 255) {
            image->pixels[i] = color.packed;
        }
    }

    if (blend_mode == SCG_BLEND_MODE_ALPHA) {
        scg_pixel_t d = scg_pixel_new_uint32(image->pixels[i]);
        float32_t a = (float32_t)(color.data.a / 255.0f);
        float32_t c = 1.0f - a;
        float32_t r = a * (float32_t)color.data.r + c * (float32_t)d.data.r;
        float32_t g = a * (float32_t)color.data.g + c * (float32_t)d.data.g;
        float32_t b = a * (float32_t)color.data.b + c * (float32_t)d.data.b;

        scg_pixel_t blended_color =
            scg_pixel_new_rgb((uint8_t)r, (uint8_t)g, (uint8_t)b);
        image->pixels[i] = blended_color.packed;
    }
}

// Assembly:
testl %esi, %esi
js 0x2bae
testl %edx, %edx
js 0x2bae
movl (%rdi), %r8d
cmpl %esi, %r8d
jle 0x2bae
cmpl %edx, 0x4(%rdi)
jle 0x2bae
movl 0x18(%rdi), %eax
imull %edx, %r8d
addl %esi, %r8d
testl %eax, %eax
je 0x2ba4
movl %ecx, %esi
shrl $0x18, %esi
movl %eax, %edx
xorl $0x1, %edx
movl %esi, %r9d
xorl $0xff, %r9d
orl %edx, %r9d
jne 0x2baf
movq 0x10(%rdi), %rax
movl %r8d, %edx
movl %ecx, (%rax,%rdx,4)
retq
cmpl $0x2, %eax
jne 0x2bae
movl %ecx, %r9d
shrl $0x8, %r9d
movl %ecx, %r10d
shrl $0x10, %r10d
movq 0x10(%rdi), %rax
movl %r8d, %edx
movl (%rax,%rdx,4), %edi
movl %edi, %r8d
shrl $0x8, %r8d
movl %edi, %r11d
shrl $0x10, %r11d
cvtsi2ss %esi, %xmm0
divss 0x3426(%rip), %xmm0     # 0x600c
movss 0x341a(%rip), %xmm2     # 0x6008
movzbl %r10b, %esi
cvtsi2ss %esi, %xmm1
movl $0xff, %esi
andl %esi, %r11d
cvtsi2ss %r11d, %xmm3
subss %xmm0, %xmm2
mulss %xmm2, %xmm3
mulss %xmm0, %xmm1
addss %xmm3, %xmm1
movzbl %r9b, %r9d
xorps %xmm3, %xmm3
cvtsi2ss %r9d, %xmm3
andl %esi, %r8d
cvtsi2ss %r8d, %xmm4
mulss %xmm2, %xmm4
mulss %xmm0, %xmm3
addss %xmm4, %xmm3
movzbl %cl, %ecx
xorps %xmm4, %xmm4
cvtsi2ss %ecx, %xmm4
andl %esi, %edi
cvtsi2ss %edi, %xmm5
mulss %xmm2, %xmm5
mulss %xmm0, %xmm4
addss %xmm5, %xmm4
cvttss2si %xmm4, %ecx
cvttss2si %xmm3, %edi
cvttss2si %xmm1, %r8d
shll $0x10, %r8d
andl %esi, %edi
shll $0x8, %edi
orl %r8d, %edi
andl %esi, %ecx
orl %edi, %ecx
orl $0xff000000, %ecx       # imm = 0xFF000000
jmp 0x2bab
// File: /workspace/github_c_makefile_star2_O3/adelciotto[P]scg/examples/../scg.h
// Function: scg_image_clear
void scg_image_clear(scg_image_t *image, scg_pixel_t color) {
    int num_pixels = image->width * image->height;
    uint32_t pixel = color.packed;

    for (int i = 0; i < num_pixels; i++) {
        image->pixels[i] = pixel;
    }
}

// Assembly:
movl 0x4(%rdi), %eax
imull (%rdi), %eax
testl %eax, %eax
jle 0x2d73
movq 0x10(%rdi), %rcx
movl %eax, %edx
addl $0x3, %eax
andl $-0x4, %eax
decq %rdx
movq %rdx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
movdqa 0x33ba(%rip), %xmm1     # 0x6060
movdqa 0x33c2(%rip), %xmm2     # 0x6070
xorl %edx, %edx
movdqa 0x33c8(%rip), %xmm3     # 0x6080
pxor %xmm3, %xmm0
pcmpeqd %xmm4, %xmm4
movdqa 0x33c8(%rip), %xmm5     # 0x6090
movdqa %xmm2, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
movd %xmm6, %edi
notl %edi
testb $0x1, %dil
je 0x2d00
movl %esi, (%rcx,%rdx,4)
pxor %xmm4, %xmm6
pextrw $0x4, %xmm6, %edi
testb $0x1, %dil
je 0x2d13
movl %esi, 0x4(%rcx,%rdx,4)
movdqa %xmm1, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
pxor %xmm4, %xmm6
pextrw $0x0, %xmm6, %edi
testb $0x1, %dil
je 0x2d4f
movl %esi, 0x8(%rcx,%rdx,4)
pextrw $0x4, %xmm6, %edi
testb $0x1, %dil
je 0x2d5e
movl %esi, 0xc(%rcx,%rdx,4)
addq $0x4, %rdx
paddq %xmm5, %xmm2
paddq %xmm5, %xmm1
cmpq %rdx, %rax
jne 0x2cc8
retq
// File: /workspace/github_c_makefile_star2_O3/adelciotto[P]scg/examples/../scg.h
// Function: scg_image_draw_image
void scg_image_draw_image(scg_image_t *dest, scg_image_t *src, int x, int y) {
    int src_w = src->width;
    int src_h = src->height;

    for (int i = 0; i < src_h; i++) {
        for (int j = 0; j < src_w; j++) {
            scg_pixel_t color = scg_image_get_pixel(src, j, i);
            scg_image_set_pixel(dest, x + j, y + i, color);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, 0x8(%rsp)
movq %rdx, 0x10(%rsp)
movl 0x4(%rsi), %eax
movl %eax, 0x4(%rsp)
testl %eax, %eax
jle 0x2df8
movq %rsi, %r15
movq %rdi, %r12
movl (%rsi), %ebx
xorl %r13d, %r13d
testl %ebx, %ebx
jle 0x2dee
movq 0x8(%rsp), %rax
leal (%rax,%r13), %ebp
xorl %r14d, %r14d
movl (%r15), %eax
movl $0xffff00ff, %ecx       # imm = 0xFFFF00FF
cmpl %r14d, %eax
jle 0x2dd3
cmpl %r13d, 0x4(%r15)
jle 0x2dd3
imull %r13d, %eax
addl %r14d, %eax
movq 0x10(%r15), %rcx
movl (%rcx,%rax,4), %ecx
movq 0x10(%rsp), %rax
leal (%rax,%r14), %esi
movq %r12, %rdi
movl %ebp, %edx
callq 0x2b68
incl %r14d
cmpl %r14d, %ebx
jne 0x2db2
incl %r13d
cmpl 0x4(%rsp), %r13d
jne 0x2da2
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/adelciotto[P]scg/examples/../scg.h
// Function: scg_image_draw_line
void scg_image_draw_line(scg_image_t *image, int x0, int y0, int x1, int y1,
                         scg_pixel_t color) {
    // Line is vertical
    if (x0 == x1) {
        if (y1 < y0) {
            int tmp = y1;
            y1 = y0;
            y0 = tmp;
        }

        for (int y = y0; y <= y1; y++) {
            scg_image_set_pixel(image, x0, y, color);
        }

        return;
    }

    // Line is horizontal
    if (y0 == y1) {
        if (x1 < x0) {
            int tmp = x1;
            x1 = x0;
            x0 = tmp;
        }

        for (int x = x0; x <= x1; x++) {
            scg_image_set_pixel(image, x, y0, color);
        }

        return;
    }

    int dx = abs(x1 - x0);
    int dy = abs(y1 - y0);

    int step_x = x0 < x1 ? 1 : -1;
    int step_y = y0 < y1 ? 1 : -1;
    int err = (dx > dy ? dx : -dy) / 2;
    int e2 = 0;

    for (;;) {
        scg_image_set_pixel(image, x0, y0, color);

        if (x0 == x1 && y0 == y1) {
            break;
        }

        e2 = err;
        if (e2 > -dx) {
            err -= dy;
            x0 += step_x;
        }
        if (e2 < dy) {
            err += dx;
            y0 += step_y;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r9d, %ebx
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %r15
movl %ecx, (%rsp)
cmpl %esi, %ecx
jne 0x346d
cmpl %ebp, %r8d
movl %ebp, %r12d
cmovgl %r8d, %r12d
cmovll %r8d, %ebp
incl %r12d
movq %r15, %rdi
movl %r14d, %esi
movl %ebp, %edx
movl %ebx, %ecx
callq 0x2b68
incl %ebp
cmpl %ebp, %r12d
jne 0x3452
jmp 0x355c
movl %r8d, %eax
subl %ebp, %eax
jne 0x34a4
movl (%rsp), %eax
cmpl %r14d, %eax
movl %r14d, %r12d
cmovgl %eax, %r12d
cmovll %eax, %r14d
incl %r12d
movq %r15, %rdi
movl %r14d, %esi
movl %ebp, %edx
movl %ebx, %ecx
callq 0x2b68
incl %r14d
cmpl %r14d, %r12d
jne 0x3488
jmp 0x355c
movl %r8d, 0x14(%rsp)
setg %cl
xorl %edx, %edx
movl (%rsp), %esi
subl %r14d, %esi
setg %dl
movl %esi, %edi
negl %edi
cmovsl %esi, %edi
movl %eax, %r12d
negl %r12d
cmovsl %eax, %r12d
leal -0x1(%rdx,%rdx), %eax
movl %eax, 0x10(%rsp)
movzbl %cl, %eax
leal -0x1(,%rax,2), %eax
movl %eax, 0xc(%rsp)
movl %r12d, %eax
negl %eax
movl %edi, 0x4(%rsp)
cmpl %r12d, %edi
cmoval %edi, %eax
movl %eax, %r13d
shrl $0x1f, %r13d
addl %eax, %r13d
sarl %r13d
movq %r15, %rdi
movl %r14d, %esi
movl %ebp, %edx
movl %ebx, %ecx
callq 0x2b68
movl 0x4(%rsp), %eax
negl %eax
movl %eax, 0x8(%rsp)
movl 0x10(%rsp), %eax
movl %r12d, %ecx
cmpl 0x8(%rsp), %r13d
jg 0x3525
xorl %eax, %eax
xorl %ecx, %ecx
movl 0xc(%rsp), %esi
movl 0x4(%rsp), %edx
cmpl %r12d, %r13d
jl 0x3536
xorl %esi, %esi
xorl %edx, %edx
addl %esi, %ebp
addl %eax, %r14d
subl %ecx, %r13d
addl %edx, %r13d
movq %r15, %rdi
movl %r14d, %esi
movl %ebp, %edx
movl %ebx, %ecx
callq 0x2b68
cmpl 0x14(%rsp), %ebp
jne 0x3513
cmpl (%rsp), %r14d
jne 0x3513
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/adelciotto[P]scg/examples/../scg.h
// Function: scg_image_draw_rect
void scg_image_draw_rect(scg_image_t *image, int x, int y, int w, int h,
                         scg_pixel_t color) {
    int minx = x;
    int miny = y;
    int maxx = minx + w;
    int maxy = miny + h;

    scg_image_draw_line(image, minx, miny, maxx, miny, color);
    scg_image_draw_line(image, maxx, miny, maxx, maxy, color);
    scg_image_draw_line(image, maxx, maxy, minx, maxy, color);
    scg_image_draw_line(image, minx, maxy, minx, miny, color);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r9d, %ebx
movl %edx, %r14d
movl %esi, %r15d
movq %rdi, %r12
leal (%rcx,%r15), %ebp
leal (%r8,%r14), %r13d
movl %ebp, %ecx
movl %edx, %r8d
callq 0x3421
movq %r12, %rdi
movl %ebp, %esi
movl %r14d, %edx
movl %ebp, %ecx
movl %r13d, %r8d
movl %ebx, %r9d
callq 0x3421
movq %r12, %rdi
movl %ebp, %esi
movl %r13d, %edx
movl %r15d, %ecx
movl %r13d, %r8d
movl %ebx, %r9d
callq 0x3421
movq %r12, %rdi
movl %r15d, %esi
movl %r13d, %edx
movl %r15d, %ecx
movl %r14d, %r8d
movl %ebx, %r9d
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3421
// File: /workspace/github_c_makefile_star2_O3/adelciotto[P]scg/examples/../scg.h
// Function: scg_image_fill_circle
void scg_image_fill_circle(scg_image_t *image, int x, int y, int r,
                           scg_pixel_t color) {
    int f = 1 - r;
    int ddf_x = 0;
    int ddf_y = -2 * r;
    int xi = 0;
    int yi = r;

    scg_image_draw_line(image, x, y - r, x, y + r, color);
    scg_image_draw_line(image, x - r, y, x + r, y, color);

    while (xi < yi) {
        if (f >= 0) {
            yi--;
            ddf_y += 2;
            f += ddf_y;
        }

        xi++;
        ddf_x += 2;
        f += ddf_x + 1;

        scg_image_draw_line(image, x - xi, y + yi, x + xi, y + yi, color);
        scg_image_draw_line(image, x - xi, y - yi, x + xi, y - yi, color);
        scg_image_draw_line(image, x - yi, y + xi, x + yi, y + xi, color);
        scg_image_draw_line(image, x - yi, y - xi, x + yi, y - xi, color);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %r8d, %ebx
movl %ecx, %r14d
movl %edx, %r13d
movl %esi, %r12d
movq %rdi, %r15
subl %ecx, %edx
leal (%r14,%r13), %r8d
movl %esi, %ecx
movl %ebx, %r9d
callq 0x3421
movl %r12d, %esi
subl %r14d, %esi
leal (%r14,%r12), %ecx
movq %r15, 0x28(%rsp)
movq %r15, %rdi
movl %r13d, %edx
movl %r13d, %r8d
movl %ebx, %r9d
callq 0x3421
testl %r14d, %r14d
jle 0x39c3
leal (%r14,%r14), %esi
negl %esi
movl $0x1, %r8d
movl $0x1, %r15d
subl %r14d, %r15d
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0x3, %r9d
movq %r12, (%rsp)
movq %r8, 0x18(%rsp)
movl %r9d, 0x14(%rsp)
movq %rdi, 0x20(%rsp)
leal 0x2(%rsi), %eax
xorl %ecx, %ecx
testl %r15d, %r15d
setns %cl
movl $0x0, %edx
cmovnsl %eax, %edx
cmovnsl %eax, %esi
movq %rsi, 0x30(%rsp)
subl %ecx, %r14d
movq %r14, 0x8(%rsp)
addl %r9d, %r15d
addl %edx, %r15d
leal (%r12,%rdi), %ebp
leal (%r14,%r13), %edx
movq %r13, %r12
movl %ebx, %r13d
movq (%rsp), %rax
leal (%rax,%r8), %ebx
movq 0x28(%rsp), %r14
movq %r14, %rdi
movl %ebp, %esi
movl %ebx, %ecx
movl %edx, %r8d
movl %r13d, %r9d
callq 0x3421
movl %r12d, %edx
subl 0x8(%rsp), %edx
movq %r14, %rdi
movl %ebp, %esi
movl %ebx, %ecx
movl %edx, %r8d
movl %r13d, %r9d
callq 0x3421
movq (%rsp), %rax
movl %eax, %ebx
subl 0x8(%rsp), %ebx
movq 0x18(%rsp), %rax
leal (%r12,%rax), %edx
movq 0x8(%rsp), %rax
movq (%rsp), %rcx
leal (%rax,%rcx), %ebp
movq %r14, %rdi
movl %ebx, %esi
movl %ebp, %ecx
movl %edx, %r8d
movl %r13d, %r9d
callq 0x3421
movq 0x20(%rsp), %rax
leal (%r12,%rax), %edx
movq %r14, %rdi
movl %ebx, %esi
movl %r13d, %ebx
movq %r12, %r13
movq (%rsp), %r12
movq 0x8(%rsp), %r14
movl %ebp, %ecx
movl %edx, %r8d
movl %ebx, %r9d
callq 0x3421
movl 0x14(%rsp), %r9d
movq 0x20(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq 0x18(%rsp), %rcx
leal 0x1(%rcx), %eax
decl %edi
addl $0x2, %r9d
cmpl %r14d, %ecx
movl %eax, %r8d
jl 0x38c1
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/adelciotto[P]scg/examples/../scg.h
// Function: scg_image_draw_char
void scg_image_draw_char(scg_image_t *image, char ch, int x, int y,
                         scg_pixel_t color) {
    uint8_t char_code = (uint8_t)ch;
    if (char_code > SCG__FONT_CHAR_CODE_END) {
        char_code = SCG__FONT_CHAR_CODE_QUESTION_MARK;
    }

    char bitmap[SCG_FONT_SIZE];
    int index = char_code * SCG_FONT_SIZE;
    memcpy(bitmap, scg__font8x8 + index, SCG_FONT_SIZE);

    scg__draw_char_bitmap(image, bitmap, x, y, color);
}

// Assembly:
pushq %rax
testb %sil, %sil
movl $0x3f, %eax
cmovnsl %esi, %eax
movzbl %al, %eax
leaq 0x6838(%rip), %rsi      # 0xa220
movq (%rsi,%rax,8), %rax
movq %rsp, %rsi
movq %rax, (%rsi)
callq 0x39f9
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O3/adelciotto[P]scg/examples/../scg.h
// Function: scg__draw_char_bitmap
static void scg__draw_char_bitmap(scg_image_t *image, const char *bitmap, int x,
                                  int y, scg_pixel_t color) {
    for (int i = 0; i < SCG_FONT_SIZE; i++) {
        for (int j = 0; j < SCG_FONT_SIZE; j++) {
            int set = bitmap[i] & 1 << j;

            if (set) {
                scg_image_set_pixel(image, x + j, y + i, color);
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r8d, 0xc(%rsp)
movq %rcx, 0x10(%rsp)
movl %edx, %r15d
movq %rsi, %r12
movq %rdi, %r13
xorl %r14d, %r14d
movq 0x10(%rsp), %rax
leal (%r14,%rax), %ebp
xorl %ebx, %ebx
movsbl (%r12,%r14), %eax
btl %ebx, %eax
jae 0x3a44
leal (%r15,%rbx), %esi
movq %r13, %rdi
movl %ebp, %edx
movl 0xc(%rsp), %ecx
callq 0x2b68
incl %ebx
cmpl $0x8, %ebx
jne 0x3a28
incq %r14
cmpq $0x8, %r14
jne 0x3a1d
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/adelciotto[P]scg/examples/../scg.h
// Function: scg_image_draw_string
void scg_image_draw_string(scg_image_t *image, const char *str, int x, int y,
                           bool anchor_to_center, scg_pixel_t color) {
    int current_x = x;
    int current_y = y;

    if (anchor_to_center) {
        int width = strlen(str) * SCG_FONT_SIZE;
        current_x = x - width / 2;
        current_y -= SCG_FONT_SIZE / 2;
    }

    for (int i = 0; str[i] != '\0'; i++) {
        if (str[i] != SCG__FONT_CHAR_CODE_SPACE) {
            scg_image_draw_char(image, str[i], current_x, current_y, color);
        }

        current_x += SCG_FONT_SIZE;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r9d, %ebx
movl %ecx, %ebp
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, %r12
testl %r8d, %r8d
je 0x3a94
movq %r15, %rdi
callq 0x20f0
shll $0x3, %eax
sarl %eax
subl %eax, %r14d
addl $-0x4, %ebp
movq %rsp, %r13
movzbl (%r15), %eax
cmpl $0x20, %eax
je 0x3ad6
testl %eax, %eax
je 0x3adf
testb %al, %al
movzbl %al, %eax
movl $0x3f, %ecx
cmovsl %ecx, %eax
movzbl %al, %eax
leaq 0x6765(%rip), %rcx      # 0xa220
movq (%rcx,%rax,8), %rax
movq %rax, (%rsp)
movq %r12, %rdi
movq %r13, %rsi
movl %r14d, %edx
movl %ebp, %ecx
movl %ebx, %r8d
callq 0x39f9
addl $0x8, %r14d
incq %r15
jmp 0x3a97
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/adelciotto[P]scg/examples/../scg.h
// Function: scg_image_draw_wchar
void scg_image_draw_wchar(scg_image_t *image, wchar_t ch, int x, int y,
                          scg_pixel_t color) {
    char bitmap[SCG_FONT_SIZE];

    if (ch <= SCG__FONT_CHAR_CODE_END) {
        int index = ch * SCG_FONT_SIZE;
        memcpy(bitmap, scg__font8x8 + index, SCG_FONT_SIZE);
    } else if (ch >= SCG__FONT_HIRAGANA_CHAR_CODE_START &&
               ch <= SCG__FONT_HIRAGANA_CHAR_CODE_END) {
        int mapped_code = SCG__FONT_HIRAGANA_NUM_CHARS -
                          (SCG__FONT_HIRAGANA_CHAR_CODE_END - ch);

        int index = mapped_code * SCG_FONT_SIZE;
        memcpy(bitmap, scg__font8x8_hiragana + index, SCG_FONT_SIZE);
    } else {
        int index = SCG__FONT_CHAR_CODE_QUESTION_MARK * SCG_FONT_SIZE;
        memcpy(bitmap, scg__font8x8 + index, SCG_FONT_SIZE);
    }

    scg__draw_char_bitmap(image, bitmap, x, y, color);
}

// Assembly:
pushq %rax
cmpl $0x7f, %esi
jg 0x3b04
movslq %esi, %rax
leaq 0x6722(%rip), %rsi      # 0xa220
movq (%rsi,%rax,8), %rax
jmp 0x3b29
leal -0x3040(%rsi), %eax
cmpl $0x5f, %eax
ja 0x3b22
movl %esi, %eax
leaq 0x6b08(%rip), %rsi      # 0xa620
movq -0x181f8(%rsi,%rax,8), %rax
jmp 0x3b29
movq 0x68ef(%rip), %rax      # 0xa418
movq %rax, (%rsp)
movq %rsp, %rsi
callq 0x39f9
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O3/adelciotto[P]scg/examples/../scg.h
// Function: scg_image_draw_wstring
void scg_image_draw_wstring(scg_image_t *image, const wchar_t *str, int x,
                            int y, bool anchor_to_center, scg_pixel_t color) {
    int current_x = x;
    int current_y = y;

    if (anchor_to_center) {
        int width = wcslen(str) * SCG_FONT_SIZE;
        current_x = x - width / 2;
        current_y -= SCG_FONT_SIZE / 2;
    }

    for (int i = 0; str[i] != '\0'; i++) {
        if (str[i] != SCG__FONT_CHAR_CODE_SPACE) {
            scg_image_draw_wchar(image, str[i], current_x, current_y, color);
        }

        current_x += SCG_FONT_SIZE;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %r9d, %ebx
movl %ecx, %ebp
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, %r12
testl %r8d, %r8d
je 0x3b7f
movq %r15, %rdi
callq 0x21e0
shll $0x3, %eax
sarl %eax
subl %eax, %r14d
addl $-0x4, %ebp
jmp 0x3b7f
movq %r12, %rdi
movl %r14d, %edx
movl %ebp, %ecx
movl %ebx, %r8d
callq 0x3aee
addl $0x8, %r14d
addq $0x4, %r15
movl (%r15), %esi
cmpl $0x20, %esi
je 0x3b77
testl %esi, %esi
jne 0x3b67
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/adelciotto[P]scg/examples/../scg.h
// Function: scg_image_draw_frame_metrics
void scg_image_draw_frame_metrics(scg_image_t *image,
                                  scg_frame_metrics_t frame_metrics) {
    int fps = frame_metrics.fps;
    float32_t frame_time_ms = frame_metrics.frame_time_millisecs;
    const char *fmt = "fps:%d ms/f:%.4f";

    ssize_t bsize = snprintf(NULL, 0, fmt, fps, frame_time_ms);
    char buffer[bsize];
    snprintf(buffer, bsize + 1, fmt, fps, frame_time_ms);

    scg_pixel_t color = SCG_COLOR_GREEN;
    float32_t target_fps = (float32_t)frame_metrics.target_fps;
    if (fps < target_fps * 0.95) {
        color = SCG_COLOR_YELLOW;
    }
    if (fps < target_fps * 0.5) {
        color = SCG_COLOR_RED;
    }

    // Draw the metrics with no alpha blending.
    scg_blend_mode_t blend_mode = image->blend_mode;
    scg_image_set_blend_mode(image, SCG_BLEND_MODE_NONE);
    scg_image_draw_string(image, buffer, 10, 10, 0, color);
    scg_image_set_blend_mode(image, blend_mode);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x28(%rbp), %r15d
cvtsd2ss 0x20(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x30(%rbp)
leaq 0x26d0(%rip), %r12      # 0x628e
xorl %r13d, %r13d
xorl %edi, %edi
xorl %esi, %esi
movq %r12, %rdx
movl %r15d, %ecx
movb $0x1, %al
callq 0x2340
movslq %eax, %rsi
leaq 0xf(%rsi), %rax
andq $-0x10, %rax
movq %rsp, %r14
subq %rax, %r14
movq %r14, %rsp
incq %rsi
movq %r14, %rdi
movq %r12, %rdx
movl %r15d, %ecx
movsd -0x30(%rbp), %xmm0
movb $0x1, %al
callq 0x2340
xorps %xmm0, %xmm0
cvtsi2ssl 0x10(%rbp), %xmm0
cvtsi2sd %r15d, %xmm1
cvtss2sd %xmm0, %xmm0
movsd 0x2499(%rip), %xmm2     # 0x60b0
mulsd %xmm0, %xmm2
ucomisd %xmm1, %xmm2
movl $0xff0000, %eax         # imm = 0xFF0000
movl $0x0, %ecx
cmoval %eax, %ecx
mulsd 0x2484(%rip), %xmm0     # 0x60b8
ucomisd %xmm1, %xmm0
cmoval %eax, %ecx
movl 0x18(%rbx), %r15d
movl %r13d, 0x18(%rbx)
movl $0xff000000, %eax       # imm = 0xFF000000
movl $0xff00ff00, %r9d       # imm = 0xFF00FF00
cmoval %eax, %r9d
orl %ecx, %r9d
movq %rbx, %rdi
movq %r14, %rsi
movl $0xa, %edx
movl $0xa, %ecx
xorl %r8d, %r8d
callq 0x3a63
movl %r15d, 0x18(%rbx)
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/adelciotto[P]scg/examples/../scg.h
// Function: scg_image_save_to_bmp
bool scg_image_save_to_bmp(scg_image_t *image, const char *filepath) {
    SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormatFrom(
        (void *)image->pixels, image->width, image->height, 32, image->pitch,
        SCG__IMAGE_PIXEL_FORMAT);
    if (surface == NULL) {
        scg_log_errorf("Failed to create SDL surface from image. %s",
                       SDL_GetError());

        return false;
    }

    if (SDL_SaveBMP(surface, filepath) != 0) {
        scg_log_errorf("Failed to save image to %s. %s", filepath,
                       SDL_GetError());

        SDL_FreeSurface(surface);
        return false;
    }

    SDL_FreeSurface(surface);

    return true;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq 0x10(%rdi), %rax
movl (%rdi), %esi
movl 0x4(%rdi), %edx
movl 0x8(%rdi), %r8d
movq %rax, %rdi
movl $0x20, %ecx
movl $0x16362004, %r9d       # imm = 0x16362004
callq 0x22c0
testq %rax, %rax
je 0x3d12
movq %rax, %r14
leaq 0x263c(%rip), %rsi      # 0x62f6
movq %rbx, %rdi
callq 0x20e0
movq %r14, %rdi
movq %rax, %rsi
movl $0x1, %edx
callq 0x2110
testl %eax, %eax
je 0x3d42
callq 0x2190
movq %rax, (%rsp)
leaq 0x2613(%rip), %rsi      # 0x62f9
leaq 0x25f3(%rip), %rdx      # 0x62e0
leaq 0x2412(%rip), %rcx      # 0x6106
xorl %ebp, %ebp
xorl %edi, %edi
movl $0x4d5, %r8d            # imm = 0x4D5
movq %rbx, %r9
xorl %eax, %eax
callq 0x22e0
movq %r14, %rdi
callq 0x2230
jmp 0x3d4d
callq 0x2190
leaq 0x2581(%rip), %rsi      # 0x629f
leaq 0x25bb(%rip), %rdx      # 0x62e0
leaq 0x23da(%rip), %rcx      # 0x6106
xorl %ebp, %ebp
xorl %edi, %edi
movl $0x4ce, %r8d            # imm = 0x4CE
movq %rax, %r9
xorl %eax, %eax
callq 0x22e0
jmp 0x3d4d
movq %r14, %rdi
callq 0x2230
movb $0x1, %bpl
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/adelciotto[P]scg/examples/../scg.h
// Function: scg_sound_new_from_wav
scg_sound_t *scg_sound_new_from_wav(scg_audio_t *audio, const char *filepath,
                                    bool loop) {
    if (audio->num_sounds == SCG__MAX_SOUNDS) {
        scg_log_error("Maximum sounds reached");

        return NULL;
    }

    SDL_AudioSpec spec;
    uint32_t length;
    uint8_t *buffer;

    if (SDL_LoadWAV(filepath, &spec, &buffer, &length) == NULL) {
        scg_log_errorf("Failed to load WAV file at %s. %s", filepath,
                       SDL_GetError());

        return NULL;
    }

    scg_sound_t *sound = malloc(sizeof(*sound));
    if (sound == NULL) {
        scg_log_error("Failed to allocate memory for sound");

        SDL_FreeWAV(buffer);
        return NULL;
    }

    sound->sdl_spec = spec;
    sound->length = length;
    sound->buffer = buffer;
    sound->play_offset = 0;
    sound->end_position = buffer + length;
    sound->is_playing = false;
    sound->loop = loop;

    audio->sounds[audio->num_sounds++] = sound;

    return sound;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x38, %rsp
cmpl $0x10, 0xa0(%rdi)
jne 0x3df1
leaq 0x2313(%rip), %rsi      # 0x60e0
leaq 0x2559(%rip), %rdx      # 0x632d
leaq 0x232b(%rip), %rcx      # 0x6106
leaq 0x2562(%rip), %r9       # 0x6344
xorl %ebx, %ebx
xorl %edi, %edi
movl $0x51a, %r8d            # imm = 0x51A
jmp 0x3eba
movl %edx, %ebp
movq %rsi, %r15
movq %rdi, %r14
leaq 0x2361(%rip), %rsi      # 0x6161
movq %r15, %rdi
callq 0x20e0
leaq 0x18(%rsp), %rdx
leaq 0x10(%rsp), %rcx
leaq 0xc(%rsp), %r8
movq %rax, %rdi
movl $0x1, %esi
callq 0x2090
testq %rax, %rax
je 0x3e8f
movl $0x50, %edi
callq 0x22f0
testq %rax, %rax
je 0x3ecf
movq %rax, %rbx
movups 0x18(%rsp), %xmm0
movups 0x28(%rsp), %xmm1
movups %xmm1, 0x18(%rax)
movups %xmm0, 0x8(%rax)
movl 0xc(%rsp), %eax
movl %eax, 0x28(%rbx)
movq 0x10(%rsp), %rcx
movq %rcx, 0x30(%rbx)
movl $0x0, 0x38(%rbx)
addq %rax, %rcx
movq %rcx, 0x40(%rbx)
movb $0x0, 0x48(%rbx)
movb %bpl, 0x49(%rbx)
movslq 0xa0(%r14), %rax
leal 0x1(%rax), %ecx
movl %ecx, 0xa0(%r14)
movq %rbx, 0x20(%r14,%rax,8)
jmp 0x3ec1
callq 0x2190
movq %rax, (%rsp)
leaq 0x24bc(%rip), %rsi      # 0x635b
leaq 0x2487(%rip), %rdx      # 0x632d
leaq 0x2259(%rip), %rcx      # 0x6106
xorl %ebx, %ebx
xorl %edi, %edi
movl $0x525, %r8d            # imm = 0x525
movq %r15, %r9
xorl %eax, %eax
callq 0x22e0
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x220a(%rip), %rsi      # 0x60e0
leaq 0x2450(%rip), %rdx      # 0x632d
leaq 0x2222(%rip), %rcx      # 0x6106
leaq 0x24a7(%rip), %r9       # 0x6392
xorl %ebx, %ebx
xorl %edi, %edi
movl $0x52c, %r8d            # imm = 0x52C
xorl %eax, %eax
callq 0x22e0
movq 0x10(%rsp), %rdi
callq 0x2310
jmp 0x3ec1
// File: /workspace/github_c_makefile_star2_O3/adelciotto[P]scg/examples/../scg.h
// Function: scg_config_new_default
scg_config_t scg_config_new_default(void) {
    return (scg_config_t){
        .video = {.width = 640,
                  .height = 480,
                  .title = "SCG Application",
                  .scale = 1,
                  .fullscreen = false,
                  .vsync = true,
                  .lock_fps = true,
                  .show_frame_metrics = true},
        .input = {.hide_mouse_cursor = true},
        .audio = {.enabled = false, .volume = SCG__MAX_VOLUME / 2}};
}

// Assembly:
movq %rdi, %rax
movabsq $0x1e000000280, %rcx    # imm = 0x1E000000280
movq %rcx, (%rdi)
leaq 0x246b(%rip), %rcx      # 0x63b6
movq %rcx, 0x8(%rdi)
movl $0x1, 0x10(%rdi)
xorl %ecx, %ecx
movb %cl, 0x14(%rdi)
movl $0x1010101, 0x15(%rdi)  # imm = 0x1010101
movb %cl, 0x1c(%rdi)
movl $0x40, 0x20(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O3/adelciotto[P]scg/examples/../scg.h
// Function: scg__decode_font_data
static void scg__decode_font_data(char *out, size_t out_len, const char *data) {
    const int len = strlen(data);

    uint8_t indices[4];
    uint8_t buf[3];
    size_t size = 0;

    for (int i = 0; i < len; i += 4) {
        indices[0] = scg__base64_index_from_char(data[i]);
        indices[1] = scg__base64_index_from_char(data[i + 1]);
        indices[2] = scg__base64_index_from_char(data[i + 2]);
        indices[3] = scg__base64_index_from_char(data[i + 3]);

        buf[0] = (indices[0] << 2) + ((indices[1] & 0x30) >> 4);
        buf[1] = ((indices[1] & 0xF) << 4) + ((indices[2] & 0x3C) >> 2);
        buf[2] = ((indices[2] & 0x3) << 6) + indices[3];

        for (int j = 0; j < 3; j++) {
            if (size == out_len) {
                return;
            }

            out[size++] = buf[j];
        }
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq %rdx, %rdi
callq 0x20f0
testl %eax, %eax
jle 0x4a3c
xorl %ecx, %ecx
leaq 0x28fc(%rip), %rdx      # 0x7260
xorl %esi, %esi
movb (%rbx,%rcx), %r8b
movq %rdx, %r9
xorl %edi, %edi
cmpb %r8b, (%r9)
je 0x4986
addq $0x4, %rdi
incq %r9
cmpq $0x100, %rdi            # imm = 0x100
jne 0x496f
xorl %edi, %edi
movb 0x1(%rbx,%rcx), %r9b
xorl %r8d, %r8d
cmpb %r9b, (%r8,%rdx)
je 0x49a0
incq %r8
cmpq $0x40, %r8
jne 0x498e
xorl %r8d, %r8d
movb 0x2(%rbx,%rcx), %r10b
xorl %r9d, %r9d
cmpb %r10b, (%r9,%rdx)
je 0x49ba
incq %r9
cmpq $0x40, %r9
jne 0x49a8
xorl %r9d, %r9d
movb 0x3(%rbx,%rcx), %r11b
xorl %r10d, %r10d
cmpb %r11b, (%r10,%rdx)
je 0x49d4
incq %r10
cmpq $0x40, %r10
jne 0x49c2
xorl %r10d, %r10d
movl %r8d, %r11d
shrb $0x4, %r11b
andb $0x3, %r11b
orb %dil, %r11b
movb %r11b, 0xd(%rsp)
shlb $0x4, %r8b
movl %r9d, %edi
shrb $0x2, %dil
andb $0xf, %dil
orb %r8b, %dil
movb %dil, 0xe(%rsp)
shlb $0x6, %r9b
addb %r10b, %r9b
movb %r9b, 0xf(%rsp)
movq %r14, %r8
subq %rsi, %r8
leaq (%r15,%rsi), %r9
xorl %edi, %edi
cmpq %rdi, %r8
je 0x4a3c
movb 0xd(%rsp,%rdi), %r10b
movb %r10b, (%r9,%rdi)
incq %rdi
cmpq $0x3, %rdi
jne 0x4a16
addq $0x4, %rcx
addq %rdi, %rsi
cmpl %eax, %ecx
jl 0x4966
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/adelciotto[P]scg/examples/../scg.h
// Function: scg_app_free
void scg_app_free(scg_app_t *app) {
    if (app->audio != NULL) {
        scg__audio_free(app->audio);
    }

    free(app->mouse);
    free(app->keyboard);
    scg__screen_free(app->screen);
    scg_image_free(app->draw_target);

    SDL_Quit();
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x50(%rdi), %r14
testq %r14, %r14
je 0x50ab
movl (%r14), %edi
movl $0x1, %esi
callq 0x22d0
movl (%r14), %edi
callq 0x2330
cmpl $0x0, 0xa0(%r14)
jle 0x5092
xorl %r15d, %r15d
movq 0x20(%r14,%r15,8), %rax
movq 0x30(%rax), %rdi
callq 0x2310
incq %r15
movslq 0xa0(%r14), %rax
cmpq %rax, %r15
jl 0x5075
movq 0x18(%r14), %rdi
callq 0x2290
movl (%r14), %edi
callq 0x20d0
movq %r14, %rdi
callq 0x2290
movq 0x48(%rbx), %rdi
callq 0x2290
movq 0x40(%rbx), %rdi
callq 0x2290
movq 0x60(%rbx), %rdi
callq 0x4881
movq 0x38(%rbx), %rbx
movq 0x10(%rbx), %rdi
callq 0x2290
movq %rbx, %rdi
callq 0x2290
popq %rbx
popq %r14
popq %r15
jmp 0x2060
// File: /workspace/github_c_makefile_star2_O3/adelciotto[P]scg/examples/../scg.h
// Function: scg_tween_exponential_ease_in_out
float32_t scg_tween_exponential_ease_in_out(float32_t t) {
    if (t == 0.0f || t == 1.0f) {
        return t;
    }

    if (t < 0.5f) {
        return 0.5f * powf(2.0f, (20.0f * t) - 10.0f);
    }

    return -0.5f * powf(2.0f, (-20.0f * t) + 10.0f) + 1.0f;
}

// Assembly:
pushq %rax
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x5149
jnp 0x51a5
ucomiss 0xeb8(%rip), %xmm0      # 0x6008
jne 0x5154
jnp 0x51a5
movss 0xea8(%rip), %xmm1      # 0x6004
ucomiss %xmm0, %xmm1
jbe 0x5180
mulss 0xebb(%rip), %xmm0      # 0x6024
addss 0xea7(%rip), %xmm0      # 0x6018
callq 0x23e0
mulss 0xe86(%rip), %xmm0      # 0x6004
jmp 0x51a5
mulss 0xe94(%rip), %xmm0      # 0x601c
addss 0xe84(%rip), %xmm0      # 0x6014
callq 0x23e0
mulss 0xe83(%rip), %xmm0      # 0x6020
addss 0xe63(%rip), %xmm0      # 0x6008
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O3/adelciotto[P]scg/examples/../scg.h
// Function: scg_tween_elastic_ease_in
float32_t scg_tween_elastic_ease_in(float32_t t) {
    if (t == 0.0f) {
        return 0.0f;
    }

    if (t == 1.0f) {
        return 1.0f;
    }

    return -powf(2.0f, 10.0f * (t - 1.0f)) * sinf((t - 1.1f) * 5.0f * SCG_PI);
}

// Assembly:
movaps %xmm0, %xmm1
xorps %xmm0, %xmm0
ucomiss %xmm0, %xmm1
jne 0x51b5
jp 0x51b5
retq
movss 0xe4b(%rip), %xmm0      # 0x6008
ucomiss %xmm0, %xmm1
jne 0x51c4
jnp 0x51b4
subq $0x28, %rsp
movss 0xe40(%rip), %xmm0      # 0x6010
addss %xmm1, %xmm0
mulss 0xe38(%rip), %xmm0      # 0x6014
movss %xmm1, 0xc(%rsp)
callq 0x23e0
xorps 0xe92(%rip), %xmm0      # 0x6080
movaps %xmm0, 0x10(%rsp)
movss 0xc(%rsp), %xmm0
addss 0xe27(%rip), %xmm0      # 0x6028
mulss 0xe23(%rip), %xmm0      # 0x602c
mulss 0xe1f(%rip), %xmm0      # 0x6030
callq 0x21d0
mulss 0x10(%rsp), %xmm0
addq $0x28, %rsp
retq
// File: /workspace/github_c_makefile_star2_O3/adelciotto[P]scg/examples/../scg.h
// Function: scg_tween_elastic_ease_out
float32_t scg_tween_elastic_ease_out(float32_t t) {
    if (t == 0.0f) {
        return 0.0f;
    }

    if (t == 1.0f) {
        return 1.0f;
    }

    return powf(2.0f, -10.0f * t) * sinf((t - 0.1f) * 5.0f * SCG_PI) + 1.0f;
}

// Assembly:
movaps %xmm0, %xmm1
xorps %xmm0, %xmm0
ucomiss %xmm0, %xmm1
jne 0x522f
jp 0x522f
retq
movss 0xdd1(%rip), %xmm0      # 0x6008
ucomiss %xmm0, %xmm1
jne 0x523e
jnp 0x522e
pushq %rax
movss 0xdd1(%rip), %xmm0      # 0x6018
mulss %xmm1, %xmm0
movss %xmm1, (%rsp)
callq 0x23e0
movss %xmm0, 0x4(%rsp)
movss (%rsp), %xmm0
addss 0xdcc(%rip), %xmm0      # 0x6034
mulss 0xdbc(%rip), %xmm0      # 0x602c
mulss 0xdb8(%rip), %xmm0      # 0x6030
callq 0x21d0
mulss 0x4(%rsp), %xmm0
addss 0xd7d(%rip), %xmm0      # 0x6008
popq %rax
retq