// File: /workspace/github_c_makefile_star2_O1/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, %rbx
movq %rdi, %r13
movl %edx, %r14d
movq %rdx, 0x20(%rsp)
testl %edx, %edx
jle 0x2c920
movq 0x20(%rsp), %rax
incl %eax
andl $-0x2, %eax
leaq -0x1(%r14), %rcx
movq %rcx, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
leaq 0x14(%rbx), %rcx
movdqa 0x41ce4(%rip), %xmm1    # 0x6e590
xorl %edx, %edx
movdqa 0x41cba(%rip), %xmm2    # 0x6e570
pxor %xmm2, %xmm0
pcmpeqd %xmm3, %xmm3
movdqa 0x41d8a(%rip), %xmm4    # 0x6e650
movdqa %xmm1, %xmm5
pxor %xmm2, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm0, %xmm6
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm7     # xmm7 = xmm5[1,1,3,3]
pand %xmm6, %xmm7
pshufd $0xf5, %xmm6, %xmm5     # xmm5 = xmm6[1,1,3,3]
por %xmm7, %xmm5
movd %xmm5, %esi
notl %esi
testb $0x1, %sil
je 0x2c8fa
movl %edx, (%rcx)
pxor %xmm3, %xmm5
pextrw $0x4, %xmm5, %esi
testb $0x1, %sil
je 0x2c90f
leal 0x1(%rdx), %esi
movl %esi, 0x18(%rcx)
addq $0x2, %rdx
paddq %xmm4, %xmm1
addq $0x30, %rcx
cmpq %rdx, %rax
jne 0x2c8c6
movq 0x20(%rsp), %r15
movslq %r15d, %rsi
leaq 0x3f8(%rip), %rcx       # 0x2cd27
movl $0x18, %edx
movq %rbx, %rdi
movq %rsi, 0x38(%rsp)
callq 0x12450
testl %r15d, %r15d
jle 0x2cc53
leaq 0x18(%r13), %rbp
xorl %r11d, %r11d
movq %r13, 0x30(%rsp)
movq %rbp, 0x40(%rsp)
movq %rbx, 0x50(%rsp)
movq %r14, 0x48(%rsp)
leaq (%r11,%r11,2), %rax
leaq (%rbx,%rax,8), %r15
movl 0x4(%r15), %eax
testl %eax, %eax
je 0x2c9c7
movl 0x8(%r15), %edx
movq %rdx, 0x18(%rsp)
testl %edx, %edx
je 0x2c9c7
movl 0x8(%r13), %ecx
movq %rax, 0x28(%rsp)
leal (%rax,%rcx), %r12d
decl %r12d
movl %r12d, %eax
cltd
idivl %ecx
subl %edx, %r12d
movl %r12d, %eax
cltd
idivl %ecx
testl %edx, %edx
jne 0x2cd08
movl (%r13), %eax
cmpl %eax, %r12d
jg 0x2c9bd
movq 0x18(%rsp), %rcx
cmpl %ecx, 0x4(%r13)
jge 0x2c9d6
xorl %r8d, %r8d
xorl %ecx, %ecx
jmp 0x2cb87
movl $0x0, 0x10(%r15)
xorl %eax, %eax
jmp 0x2cc1d
movq %r15, 0x58(%rsp)
movq %r11, 0x60(%rsp)
movq (%rbp), %r14
movl (%r14), %esi
leal (%rsi,%r12), %ecx
cmpl %eax, %ecx
jle 0x2ca09
movl $0x40000000, (%rsp)     # imm = 0x40000000
movl $0x40000000, %ebx       # imm = 0x40000000
movq $0x0, 0x8(%rsp)
jmp 0x2ca8f
movl $0x40000000, %ebx       # imm = 0x40000000
movq $0x0, 0x8(%rsp)
movq %rbp, %r15
movl $0x40000000, (%rsp)     # imm = 0x40000000
movq %r14, %rdi
movl %r12d, %edx
leaq 0x14(%rsp), %rcx
callq 0x54d30
cmpl $0x0, 0x10(%r13)
je 0x2ca64
movq 0x18(%rsp), %rcx
addl %eax, %ecx
cmpl 0x4(%r13), %ecx
jg 0x2ca77
cmpl %ebx, %eax
jl 0x2ca54
jne 0x2ca77
movl (%rsp), %ecx
cmpl %ecx, 0x14(%rsp)
jge 0x2ca77
movl 0x14(%rsp), %ecx
movl %ecx, (%rsp)
movl %eax, %ebx
movq %r15, 0x8(%rsp)
jmp 0x2ca77
cmpl %ebx, %eax
cmovll %eax, %ebx
movq 0x8(%rsp), %rax
cmovlq %r15, %rax
movq %rax, 0x8(%rsp)
movq %r14, %r15
movq 0x8(%r14), %r14
addq $0x8, %r15
movl (%r14), %esi
leal (%rsi,%r12), %eax
cmpl (%r13), %eax
jle 0x2ca21
movq 0x8(%rsp), %rax
testq %rax, %rax
je 0x2caa4
movq (%rax), %rax
movl (%rax), %eax
movl %eax, 0x4(%rsp)
jmp 0x2caac
movl $0x0, 0x4(%rsp)
cmpl $0x1, 0x10(%r13)
jne 0x2cb59
movq (%rbp), %r14
movq %r14, %r15
cmpl %r12d, (%r14)
jge 0x2cacf
movq %r14, %r15
movq 0x8(%r15), %r15
cmpl %r12d, (%r15)
jl 0x2cac6
movl (%r15), %r13d
subl %r12d, %r13d
movq %rbp, %rax
movq %r14, %rcx
js 0x2ccca
movq %rcx, %r14
movq %rax, %rbp
leaq 0x8(%rcx), %rax
movq 0x8(%rcx), %rcx
cmpl %r13d, (%rcx)
jle 0x2cae1
cmpl %r13d, (%r14)
jg 0x2cce9
movq %r14, %rdi
movl %r13d, %esi
movl %r12d, %edx
leaq 0x10(%rsp), %rcx
callq 0x54d30
movq 0x18(%rsp), %rcx
addl %eax, %ecx
movq 0x30(%rsp), %rdx
cmpl 0x4(%rdx), %ecx
jg 0x2cb4c
cmpl %ebx, %eax
jg 0x2cb4c
jl 0x2cb39
movl (%rsp), %ecx
cmpl %ecx, 0x10(%rsp)
jl 0x2cb39
jne 0x2cb4c
cmpl 0x4(%rsp), %r13d
jge 0x2cb4c
movl 0x10(%rsp), %ecx
movl %ecx, (%rsp)
movl %r13d, 0x4(%rsp)
movl %eax, %ebx
movq %rbp, 0x8(%rsp)
movq 0x8(%r15), %r15
testq %r15, %r15
jne 0x2cacf
shlq $0x20, %rbx
movl 0x4(%rsp), %ecx
orq %rbx, %rcx
movq 0x50(%rsp), %rbx
movq 0x48(%rsp), %r14
movq 0x30(%rsp), %r13
movq 0x40(%rsp), %rbp
movq 0x60(%rsp), %r11
movq 0x58(%rsp), %r15
movq 0x8(%rsp), %r8
testq %r8, %r8
je 0x2cc10
movq %rcx, %rax
shrq $0x20, %rax
movq 0x18(%rsp), %rdx
addl %eax, %edx
cmpl 0x4(%r13), %edx
jg 0x2cc10
movq %rdx, %rsi
movq 0x20(%r13), %rdx
testq %rdx, %rdx
je 0x2cc10
movl %ecx, (%rdx)
movl %esi, 0x4(%rdx)
movq 0x8(%rdx), %rsi
movq %rsi, 0x20(%r13)
movq (%r8), %rsi
cmpl %ecx, (%rsi)
jge 0x2cbd2
movq 0x8(%rsi), %rdi
addq $0x8, %rsi
movq %rsi, %r8
movq %rdi, %rsi
movq %rdx, (%r8)
movq 0x8(%rsi), %r10
testq %r10, %r10
je 0x2cc34
leaq 0x8(%rsi), %r8
movq 0x28(%rsp), %rdi
leal (%rdi,%rcx), %r9d
cmpl %r9d, (%r10)
jg 0x2cc34
movq %r10, %rdi
movq 0x20(%r13), %r10
movq %r10, (%r8)
movq %rsi, 0x20(%r13)
leaq 0x8(%rdi), %r8
movq 0x8(%rdi), %r10
movq %rdi, %rsi
testq %r10, %r10
jne 0x2cbeb
jmp 0x2cc37
movl $0x7fffffff, 0x10(%r15) # imm = 0x7FFFFFFF
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl $0xc, %ecx
movl %eax, (%r15,%rcx)
incq %r11
cmpq %r14, %r11
jne 0x2c965
jmp 0x2cc53
movq %rsi, %rdi
movq %rdi, 0x8(%rdx)
movq 0x28(%rsp), %rdx
addl %ecx, %edx
cmpl %edx, (%rdi)
jge 0x2cc48
movl %edx, (%rdi)
movl %ecx, 0xc(%r15)
movl $0x10, %ecx
jmp 0x2cc22
leaq 0xf5(%rip), %rcx        # 0x2cd4f
movl $0x18, %edx
movq %rbx, %rdi
movq 0x38(%rsp), %rsi
callq 0x12450
cmpl $0x0, 0x20(%rsp)
jle 0x2ccb6
shlq $0x3, %r14
leaq (%r14,%r14,2), %rcx
movl $0x1, %eax
xorl %edx, %edx
xorl %esi, %esi
movb $0x1, %dil
cmpl $0x7fffffff, 0xc(%rbx,%rsi) # imm = 0x7FFFFFFF
jne 0x2cc9d
cmpl $0x7fffffff, 0x10(%rbx,%rsi) # imm = 0x7FFFFFFF
setne %dil
movzbl %dil, %edi
movl %edi, 0x14(%rbx,%rsi)
testb %dil, %dil
cmovel %edx, %eax
addq $0x18, %rsi
cmpq %rsi, %rcx
jne 0x2cc84
jmp 0x2ccbb
movl $0x1, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x45385(%rip), %rdi     # 0x72056
leaq 0x450d2(%rip), %rsi     # 0x71daa
leaq 0x4532d(%rip), %rcx     # 0x7200c
movl $0x2bf1, %edx           # imm = 0x2BF1
callq 0x12a50
leaq 0x45370(%rip), %rdi     # 0x72060
leaq 0x450b3(%rip), %rsi     # 0x71daa
leaq 0x4530e(%rip), %rcx     # 0x7200c
movl $0x2bf7, %edx           # imm = 0x2BF7
callq 0x12a50
leaq 0x452e7(%rip), %rdi     # 0x71ff6
leaq 0x45094(%rip), %rsi     # 0x71daa
leaq 0x452ef(%rip), %rcx     # 0x7200c
movl $0x2bb1, %edx           # imm = 0x2BB1
callq 0x12a50