// File: /workspace/github_c_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %r12
movq %rdi, %r14
xorl %eax, %eax
testl %edx, %edx
movl $0x0, %r13d
cmovgl %edx, %r13d
leaq 0x14(%rsi), %rcx
cmpq %rax, %r13
je 0x2aba4
movl %eax, (%rcx)
incq %rax
addq $0x18, %rcx
jmp 0x2ab94
movslq %edx, %rsi
leaq 0x40d(%rip), %rcx       # 0x2afbb
pushq $0x18
popq %rdx
movq %r12, %rdi
movq %rsi, 0x50(%rsp)
callq 0x12490
leaq 0x18(%r14), %rax
movq %rax, 0x28(%rsp)
xorl %edi, %edi
pushq $0xc
popq %r8
pushq $0x10
popq %r9
movq %r12, 0x60(%rsp)
movq %r13, 0x58(%rsp)
cmpq %r13, %rdi
je 0x2aef2
imulq $0x18, %rdi, %rax
leaq (%r12,%rax), %r10
movl 0x4(%r12,%rax), %r11d
xorl %ebx, %ebx
testl %r11d, %r11d
je 0x2ad15
movl 0x8(%r10), %r15d
movq %r9, %rax
movq %r8, %rdx
movl $0x0, %esi
movq %r15, 0x20(%rsp)
testl %r15d, %r15d
je 0x2ae59
movl 0x8(%r14), %ecx
leal (%r11,%rcx), %ebp
decl %ebp
movl %ebp, %eax
cltd
idivl %ecx
subl %edx, %ebp
movl %ebp, %eax
cltd
idivl %ecx
testl %edx, %edx
jne 0x2af9c
movl (%r14), %eax
movl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
cmpl %eax, %ebp
jg 0x2ae4e
movq 0x20(%rsp), %rcx
cmpl %ecx, 0x4(%r14)
jl 0x2ae4e
movq %r11, 0x30(%rsp)
movq %r10, 0x38(%rsp)
movq %rdi, 0x40(%rsp)
movq 0x28(%rsp), %rbx
movq (%rbx), %r15
movl $0x40000000, 0x14(%rsp) # imm = 0x40000000
movl $0x40000000, 0xc(%rsp)  # imm = 0x40000000
movq $0x0, 0x18(%rsp)
movl (%r15), %esi
leal (%rsi,%rbp), %ecx
cmpl %eax, %ecx
jg 0x2ad22
movq %r15, %rdi
movl %ebp, %edx
leaq 0x4c(%rsp), %rcx
callq 0x4f268
cmpl $0x0, 0x10(%r14)
je 0x2ace4
movq 0x20(%rsp), %rcx
addl %eax, %ecx
cmpl 0x4(%r14), %ecx
jg 0x2acff
movl 0x4c(%rsp), %ecx
cmpl 0xc(%rsp), %eax
jl 0x2acd5
sete %dl
cmpl 0x14(%rsp), %ecx
setl %sil
andb %dl, %sil
cmpb $0x1, %sil
jne 0x2acff
movl %ecx, 0x14(%rsp)
movl %eax, 0xc(%rsp)
movq %rbx, 0x18(%rsp)
jmp 0x2acff
movl 0xc(%rsp), %ecx
cmpl %ecx, %eax
cmovll %eax, %ecx
movl %ecx, 0xc(%rsp)
movq 0x18(%rsp), %rax
cmovlq %rbx, %rax
movq %rax, 0x18(%rsp)
movq 0x8(%r15), %rcx
addq $0x8, %r15
movl (%r14), %eax
movq %r15, %rbx
movq %rcx, %r15
jmp 0x2ac86
movq %r9, %rax
movq %r8, %rdx
xorl %esi, %esi
jmp 0x2ae59
movq 0x18(%rsp), %rcx
testq %rcx, %rcx
je 0x2ad37
movq (%rcx), %rax
movl (%rax), %eax
movl %eax, 0x10(%rsp)
jmp 0x2ad3f
movl $0x0, 0x10(%rsp)
movq 0x40(%rsp), %rdi
pushq $0xc
popq %r8
pushq $0x10
popq %r9
movq 0x38(%rsp), %r10
movq 0x30(%rsp), %r11
movl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
cmpl $0x1, 0x10(%r14)
jne 0x2ae3a
movq 0x28(%rsp), %rax
movq (%rax), %r15
movq %r15, %r13
cmpl %ebp, (%r13)
jge 0x2ad7d
movq 0x8(%r13), %r13
jmp 0x2ad71
movq 0x28(%rsp), %rbx
testq %r13, %r13
je 0x2ae0f
movl (%r13), %r12d
subl %ebp, %r12d
movq %rbx, %rax
movq %r15, %rcx
js 0x2af7d
movq %rcx, %r15
movq %rax, %rbx
leaq 0x8(%rcx), %rax
movq 0x8(%rcx), %rcx
cmpl %r12d, (%rcx)
jle 0x2ad9e
cmpl %r12d, (%r15)
jg 0x2af5e
movq %r15, %rdi
movl %r12d, %esi
movl %ebp, %edx
leaq 0x48(%rsp), %rcx
callq 0x4f268
movq 0x20(%rsp), %rcx
addl %eax, %ecx
cmpl 0x4(%r14), %ecx
jg 0x2ae06
cmpl 0xc(%rsp), %eax
jg 0x2ae06
movl 0x48(%rsp), %ecx
jb 0x2adf4
cmpl 0x14(%rsp), %ecx
jl 0x2adf4
jne 0x2ae06
cmpl 0x10(%rsp), %r12d
jge 0x2ae06
movl %ecx, 0x14(%rsp)
movl %r12d, 0x10(%rsp)
movl %eax, 0xc(%rsp)
movq %rbx, 0x18(%rsp)
movq 0x8(%r13), %r13
jmp 0x2ad82
movq 0x60(%rsp), %r12
movq 0x58(%rsp), %r13
movq 0x40(%rsp), %rdi
pushq $0xc
popq %r8
pushq $0x10
popq %r9
movq 0x38(%rsp), %r10
movq 0x30(%rsp), %r11
movl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
movq 0x18(%rsp), %rcx
testq %rcx, %rcx
je 0x2ae4e
movq 0x20(%rsp), %rax
addl 0xc(%rsp), %eax
cmpl 0x4(%r14), %eax
jle 0x2ae69
movq %r9, %rax
movq %r8, %rdx
movl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
movl %ebx, (%r10,%rax)
movl %esi, (%r10,%rdx)
incq %rdi
jmp 0x2abdb
movq %rcx, %rbp
movq %rax, %r15
movq 0x20(%r14), %rcx
movq %r9, %rax
movq %r8, %rdx
movl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
testq %rcx, %rcx
je 0x2ae59
movl 0x10(%rsp), %edx
movl %edx, (%rcx)
movl %r15d, 0x4(%rcx)
movq 0x8(%rcx), %rax
movq %rax, 0x20(%r14)
movq (%rbp), %rax
cmpl %edx, (%rax)
jge 0x2aeab
movq 0x8(%rax), %rdx
addq $0x8, %rax
movq %rax, %rbp
movq %rdx, %rax
movq %rcx, (%rbp)
addl 0x10(%rsp), %r11d
movq 0x8(%rax), %rdx
testq %rdx, %rdx
je 0x2aed3
cmpl %r11d, (%rdx)
jg 0x2aed3
movq 0x20(%r14), %rsi
movq %rsi, 0x8(%rax)
movq %rax, 0x20(%r14)
movq %rdx, %rax
jmp 0x2aeb4
movq %rax, 0x8(%rcx)
cmpl %r11d, (%rax)
jge 0x2aedf
movl %r11d, (%rax)
movq %r8, %rax
movl 0x10(%rsp), %ebx
movq %r9, %rdx
movl 0xc(%rsp), %esi
jmp 0x2ae59
leaq 0xe6(%rip), %rcx        # 0x2afdf
pushq $0x18
popq %rdx
movq %r12, %rdi
movq 0x50(%rsp), %rsi
callq 0x12490
imulq $0x18, %r13, %rcx
pushq $0x1
popq %rax
xorl %edx, %edx
cmpq %rdx, %rcx
je 0x2af4f
cmpl $0x7fffffff, 0xc(%r12,%rdx) # imm = 0x7FFFFFFF
jne 0x2af3c
xorl %esi, %esi
xorl %edi, %edi
cmpl $0x7fffffff, 0x10(%r12,%rdx) # imm = 0x7FFFFFFF
setne %dil
movl %edi, 0x14(%r12,%rdx)
jne 0x2af45
jmp 0x2af47
movl $0x1, 0x14(%r12,%rdx)
movl %eax, %esi
addq $0x18, %rdx
movl %esi, %eax
jmp 0x2af12
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3f07b(%rip), %rdi     # 0x69fe0
leaq 0x3edbe(%rip), %rsi     # 0x69d2a
leaq 0x3f019(%rip), %rcx     # 0x69f8c
movl $0x2bf7, %edx           # imm = 0x2BF7
callq 0x12b10
leaq 0x3f052(%rip), %rdi     # 0x69fd6
leaq 0x3ed9f(%rip), %rsi     # 0x69d2a
leaq 0x3effa(%rip), %rcx     # 0x69f8c
movl $0x2bf1, %edx           # imm = 0x2BF1
callq 0x12b10
leaq 0x3efd3(%rip), %rdi     # 0x69f76
leaq 0x3ed80(%rip), %rsi     # 0x69d2a
leaq 0x3efdb(%rip), %rcx     # 0x69f8c
movl $0x2bb1, %edx           # imm = 0x2BB1
callq 0x12b10