// File: /workspace/github_c_makefile_star2_O0/stetre[P]moonnuklear/src/./nuklear/nuklear.h
// Function: stbrp_pack_rects
STBRP_DEF int stbrp_pack_rects(stbrp_context *context, stbrp_rect *rects, int num_rects)
{
   int i, all_rects_packed = 1;

   /*  we use the 'was_packed' field internally to allow sorting/unsorting */
   for (i=0; i < num_rects; ++i) {
      rects[i].was_packed = i;
   }

   /*  sort according to heuristic */
   STBRP_SORT(rects, num_rects, sizeof(rects[0]), rect_height_compare);

   for (i=0; i < num_rects; ++i) {
      if (rects[i].w == 0 || rects[i].h == 0) {
         rects[i].x = rects[i].y = 0;  /*  empty rect needs no space */
      } else {
         stbrp__findresult fr = stbrp__skyline_pack_rectangle(context, rects[i].w, rects[i].h);
         if (fr.prev_link) {
            rects[i].x = (stbrp_coord) fr.x;
            rects[i].y = (stbrp_coord) fr.y;
         } else {
            rects[i].x = rects[i].y = STBRP__MAXVAL;
         }
      }
   }

   /*  unsort */
   STBRP_SORT(rects, num_rects, sizeof(rects[0]), rect_original_order);

   /*  set was_packed flags and all_rects_packed status */
   for (i=0; i < num_rects; ++i) {
      rects[i].was_packed = !(rects[i].x == STBRP__MAXVAL && rects[i].y == STBRP__MAXVAL);
      if (!rects[i].was_packed)
         all_rects_packed = 0;
   }

   /*  return the all_rects_packed status */
   return all_rects_packed;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movl %edx, 0x24(%rsp)
movl $0x1, 0x1c(%rsp)
movl $0x0, 0x20(%rsp)
movl 0x20(%rsp), %eax
cmpl 0x24(%rsp), %eax
jge 0x3c491
movl 0x20(%rsp), %ecx
movq 0x28(%rsp), %rax
movslq 0x20(%rsp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x14(%rax)
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
jmp 0x3c462
movq 0x28(%rsp), %rdi
movslq 0x24(%rsp), %rsi
movl $0x18, %edx
leaq 0x209(%rip), %rcx       # 0x3c6b0
callq 0x134b0
movl $0x0, 0x20(%rsp)
movl 0x20(%rsp), %eax
cmpl 0x24(%rsp), %eax
jge 0x3c5df
movq 0x28(%rsp), %rax
movslq 0x20(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x4(%rax)
je 0x3c4f0
movq 0x28(%rsp), %rax
movslq 0x20(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x8(%rax)
jne 0x3c525
movq 0x28(%rsp), %rax
movslq 0x20(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0x10(%rax)
movq 0x28(%rsp), %rax
movslq 0x20(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0xc(%rax)
jmp 0x3c5cd
movq 0x30(%rsp), %rdi
movq 0x28(%rsp), %rax
movslq 0x20(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x4(%rax), %esi
movq 0x28(%rsp), %rax
movslq 0x20(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %edx
callq 0x3c750
movq %rax, 0x8(%rsp)
movq %rdx, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
je 0x3c59b
movl 0x8(%rsp), %ecx
movq 0x28(%rsp), %rax
movslq 0x20(%rsp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0xc(%rax)
movl 0xc(%rsp), %ecx
movq 0x28(%rsp), %rax
movslq 0x20(%rsp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x10(%rax)
jmp 0x3c5cb
movq 0x28(%rsp), %rax
movslq 0x20(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl $0x7fffffff, 0x10(%rax) # imm = 0x7FFFFFFF
movq 0x28(%rsp), %rax
movslq 0x20(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl $0x7fffffff, 0xc(%rax)  # imm = 0x7FFFFFFF
jmp 0x3c5cd
jmp 0x3c5cf
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
jmp 0x3c4b4
movq 0x28(%rsp), %rdi
movslq 0x24(%rsp), %rsi
movl $0x18, %edx
leaq 0x2fb(%rip), %rcx       # 0x3c8f0
callq 0x134b0
movl $0x0, 0x20(%rsp)
movl 0x20(%rsp), %eax
cmpl 0x24(%rsp), %eax
jge 0x3c69f
movq 0x28(%rsp), %rcx
movslq 0x20(%rsp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rcx
xorl %eax, %eax
cmpl $0x7fffffff, 0xc(%rcx)  # imm = 0x7FFFFFFF
movb %al, 0x7(%rsp)
jne 0x3c64f
movq 0x28(%rsp), %rax
movslq 0x20(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpl $0x7fffffff, 0x10(%rax) # imm = 0x7FFFFFFF
sete %al
movb %al, 0x7(%rsp)
movb 0x7(%rsp), %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %ecx
movq 0x28(%rsp), %rax
movslq 0x20(%rsp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x14(%rax)
movq 0x28(%rsp), %rax
movslq 0x20(%rsp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, 0x14(%rax)
jne 0x3c68d
movl $0x0, 0x1c(%rsp)
jmp 0x3c68f
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
jmp 0x3c602
movl 0x1c(%rsp), %eax
addq $0x38, %rsp
retq
nopl (%rax,%rax)