// File: /workspace/github_cpp_makefile_star2_O2/donfreiday[P]gb/./imgui/stb_rect_pack.h
// Function: stbrp_pack_rects(stbrp_context*, stbrp_rect*, int)
STBRP_DEF void stbrp_pack_rects(stbrp_context *context, stbrp_rect *rects, int num_rects)
{
   int i;

   // we use the 'was_packed' field internally to allow sorting/unsorting
   for (i=0; i < num_rects; ++i) {
      rects[i].was_packed = i;
      #ifndef STBRP_LARGE_RECTS
      STBRP_ASSERT(rects[i].w <= 0xffff && rects[i].h <= 0xffff);
      #endif
   }

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

   for (i=0; i < num_rects; ++i) {
      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
   qsort(rects, num_rects, sizeof(rects[0]), rect_original_order);

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %r12
movq %rdi, %r8
xorl %eax, %eax
testl %edx, %edx
movl $0x0, %r13d
cmovgl %edx, %r13d
leaq 0xc(%rsi), %rcx
cmpq %rax, %r13
je 0x2de6b
movl %eax, (%rcx)
incq %rax
addq $0x10, %rcx
jmp 0x2de5b
movslq %edx, %rsi
leaq 0xbaa(%rip), %rcx       # 0x2ea1f
pushq $0x10
popq %rdx
movq %r12, %rdi
movq %rsi, -0x78(%rbp)
movq %r8, -0x58(%rbp)
callq 0x7520
movq -0x58(%rbp), %r8
leaq 0x18(%r8), %rax
movq %rax, -0x48(%rbp)
xorl %ecx, %ecx
movq %r12, -0x88(%rbp)
movq %r13, -0x80(%rbp)
cmpq %r13, %rcx
je 0x2e11d
movq %rcx, -0x70(%rbp)
shlq $0x4, %rcx
movzwl 0x4(%r12,%rcx), %eax
movl 0x8(%r8), %esi
movq %rax, -0x90(%rbp)
leal (%rax,%rsi), %r15d
decl %r15d
movl %r15d, %eax
cltd
idivl %esi
subl %edx, %r15d
movl %r15d, %eax
cltd
idivl %esi
testl %edx, %edx
jne 0x2e1b0
leaq (%r12,%rcx), %rax
movq %rax, -0x68(%rbp)
movzwl 0x6(%r12,%rcx), %eax
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %r14
movq (%r14), %rbx
movl $0x40000000, -0x2c(%rbp) # imm = 0x40000000
movq $0x0, -0x40(%rbp)
movl $0x40000000, -0x34(%rbp) # imm = 0x40000000
movzwl (%rbx), %esi
leal (%r15,%rsi), %eax
cmpl (%r8), %eax
jg 0x2df90
movq %rbx, %rdi
movl %r15d, %edx
leaq -0x60(%rbp), %rcx
callq 0x2ea6d
movq -0x58(%rbp), %r8
cmpl $0x0, 0x10(%r8)
je 0x2df69
movq -0x50(%rbp), %rcx
addl %eax, %ecx
cmpl 0x4(%r8), %ecx
jg 0x2df80
movl -0x60(%rbp), %ecx
cmpl -0x2c(%rbp), %eax
jl 0x2df5d
sete %dl
cmpl -0x34(%rbp), %ecx
setl %sil
andb %dl, %sil
cmpb $0x1, %sil
jne 0x2df80
movl %eax, -0x2c(%rbp)
movq %r14, -0x40(%rbp)
movl %ecx, -0x34(%rbp)
jmp 0x2df80
movl -0x2c(%rbp), %ecx
cmpl %ecx, %eax
cmovll %eax, %ecx
movl %ecx, -0x2c(%rbp)
movq -0x40(%rbp), %rax
cmovlq %r14, %rax
movq %rax, -0x40(%rbp)
movq 0x8(%rbx), %rax
addq $0x8, %rbx
movq %rbx, %r14
movq %rax, %rbx
jmp 0x2df10
movq -0x40(%rbp), %rsi
testq %rsi, %rsi
je 0x2dfa4
movq (%rsi), %rax
movzwl (%rax), %eax
movl %eax, -0x30(%rbp)
jmp 0x2dfab
movl $0x0, -0x30(%rbp)
cmpl $0x1, 0x10(%r8)
jne 0x2e072
movq -0x48(%rbp), %rax
movq (%rax), %rbx
movq %rbx, %r13
movzwl (%r13), %eax
cmpl %eax, %r15d
jle 0x2dfd0
movq 0x8(%r13), %r13
jmp 0x2dfc0
movq -0x48(%rbp), %r14
testq %r13, %r13
je 0x2e063
movzwl (%r13), %r12d
subl %r15d, %r12d
movq %r14, %rax
movq %rbx, %rcx
js 0x2e172
movq %rcx, %rbx
movq %rax, %r14
leaq 0x8(%rcx), %rax
movq 0x8(%rcx), %rcx
movzwl (%rcx), %edx
cmpl %edx, %r12d
jae 0x2dff1
movzwl (%rbx), %eax
cmpl %eax, %r12d
jb 0x2e191
movq %rbx, %rdi
movl %r12d, %esi
movl %r15d, %edx
leaq -0x5c(%rbp), %rcx
callq 0x2ea6d
movq -0x58(%rbp), %r8
movq -0x50(%rbp), %rcx
addl %eax, %ecx
cmpl 0x4(%r8), %ecx
jge 0x2e05a
cmpl -0x2c(%rbp), %eax
jg 0x2e05a
movl -0x5c(%rbp), %ecx
jb 0x2e04c
cmpl -0x34(%rbp), %ecx
jl 0x2e04c
jne 0x2e05a
cmpl -0x30(%rbp), %r12d
jge 0x2e05a
movl %eax, -0x2c(%rbp)
movq %r14, -0x40(%rbp)
movl %r12d, -0x30(%rbp)
movl %ecx, -0x34(%rbp)
movq 0x8(%r13), %r13
jmp 0x2dfd4
movq -0x88(%rbp), %r12
movq -0x80(%rbp), %r13
movq -0x40(%rbp), %rsi
testq %rsi, %rsi
je 0x2e0e7
movq -0x50(%rbp), %rax
addl -0x2c(%rbp), %eax
cmpl 0x4(%r8), %eax
jg 0x2e0e7
movq %rax, %rcx
movq 0x20(%r8), %rax
testq %rax, %rax
je 0x2e0e7
movl -0x30(%rbp), %edi
movw %di, (%rax)
movw %cx, 0x2(%rax)
movq 0x8(%rax), %rcx
movq %rcx, 0x20(%r8)
movq (%rsi), %rcx
movzwl (%rcx), %edx
cmpl %edx, %edi
jle 0x2e0ba
movq 0x8(%rcx), %rdx
addq $0x8, %rcx
movq %rcx, %rsi
movq %rdx, %rcx
movq %rax, (%rsi)
movl -0x30(%rbp), %edx
addl -0x90(%rbp), %edx
movq 0x8(%rcx), %rsi
testq %rsi, %rsi
je 0x2e0fb
movzwl (%rsi), %edi
cmpl %edi, %edx
jl 0x2e0fb
movq 0x20(%r8), %rdi
movq %rdi, 0x8(%rcx)
movq %rcx, 0x20(%r8)
movq %rsi, %rcx
jmp 0x2e0c6
movq -0x68(%rbp), %rax
orl $-0x1, 0x8(%rax)
movq -0x70(%rbp), %rcx
incq %rcx
jmp 0x2dea1
movq %rcx, 0x8(%rax)
movzwl (%rcx), %eax
cmpl %eax, %edx
jle 0x2e109
movw %dx, (%rcx)
movq -0x68(%rbp), %rax
movl -0x30(%rbp), %ecx
movw %cx, 0x8(%rax)
movl -0x2c(%rbp), %ecx
movw %cx, 0xa(%rax)
jmp 0x2e0ef
leaq 0x930(%rip), %rcx       # 0x2ea54
pushq $0x10
popq %rdx
movq %r12, %rdi
movq -0x78(%rbp), %rsi
callq 0x7520
shlq $0x4, %r13
xorl %eax, %eax
pushq $0x1
popq %rcx
cmpq %rax, %r13
je 0x2e163
cmpw $-0x1, 0x8(%r12,%rax)
movl %ecx, %edx
jne 0x2e158
xorl %edx, %edx
cmpw $-0x1, 0xa(%r12,%rax)
setne %dl
movl %edx, 0xc(%r12,%rax)
addq $0x10, %rax
jmp 0x2e13c
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x11e56(%rip), %rdi     # 0x3ffcf
leaq 0x11d06(%rip), %rsi     # 0x3fe86
leaq 0x11dfe(%rip), %rcx     # 0x3ff85
movl $0x171, %edx            # imm = 0x171
callq 0x7140
leaq 0x11e41(%rip), %rdi     # 0x3ffd9
leaq 0x11ce7(%rip), %rsi     # 0x3fe86
leaq 0x11ddf(%rip), %rcx     # 0x3ff85
movl $0x177, %edx            # imm = 0x177
callq 0x7140
leaq 0x11db8(%rip), %rdi     # 0x3ff6f
leaq 0x11cc8(%rip), %rsi     # 0x3fe86
leaq 0x11dc0(%rip), %rcx     # 0x3ff85
movl $0x138, %edx            # imm = 0x138
callq 0x7140