// File: /workspace/github_cpp_makefile_star2_O1/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 $0x78, %rsp
movq %rsi, %rbx
movq %rdi, %r12
movl %edx, %r15d
movl %edx, -0x44(%rbp)
testl %edx, %edx
jle 0x3519b
leaq 0xc(%rbx), %rax
xorl %ecx, %ecx
movl %ecx, (%rax)
incq %rcx
addq $0x10, %rax
cmpq %rcx, %r15
jne 0x3518d
movl -0x44(%rbp), %r14d
movslq %r14d, %rsi
leaq 0xe2f(%rip), %rcx       # 0x35fd8
movl $0x10, %edx
movq %rbx, %rdi
movq %rsi, -0x88(%rbp)
callq 0x7540
testl %r14d, %r14d
jle 0x354ca
leaq 0x18(%r12), %rax
movq %rax, -0x58(%rbp)
xorl %r13d, %r13d
movq %rbx, -0x90(%rbp)
movq %r15, -0x68(%rbp)
movq %r12, -0x80(%rbp)
movq %r13, %rsi
shlq $0x4, %rsi
movzwl 0x4(%rbx,%rsi), %eax
movl 0x8(%r12), %ecx
movq %rax, -0x70(%rbp)
leal (%rax,%rcx), %r14d
decl %r14d
movl %r14d, %eax
cltd
idivl %ecx
subl %edx, %r14d
movl %r14d, %eax
cltd
idivl %ecx
testl %edx, %edx
jne 0x35563
movq %rsi, -0x98(%rbp)
movzwl 0x6(%rbx,%rsi), %eax
movq %rax, -0x60(%rbp)
movq 0x18(%r12), %rbx
movzwl (%rbx), %esi
leal (%r14,%rsi), %eax
cmpl (%r12), %eax
jle 0x35251
movl $0x40000000, -0x2c(%rbp) # imm = 0x40000000
movq $0x0, -0x38(%rbp)
movl $0x40000000, -0x30(%rbp) # imm = 0x40000000
jmp 0x352dc
movl $0x40000000, -0x30(%rbp) # imm = 0x40000000
movq $0x0, -0x38(%rbp)
movq -0x58(%rbp), %r15
movl $0x40000000, -0x2c(%rbp) # imm = 0x40000000
movq %rbx, %rdi
movl %r14d, %edx
leaq -0x4c(%rbp), %rcx
callq 0x36022
cmpl $0x0, 0x10(%r12)
je 0x352ad
movq -0x60(%rbp), %rcx
addl %eax, %ecx
cmpl 0x4(%r12), %ecx
jg 0x352c4
cmpl -0x2c(%rbp), %eax
jl 0x3529e
jne 0x352c4
movl -0x30(%rbp), %ecx
cmpl %ecx, -0x4c(%rbp)
jge 0x352c4
movl -0x4c(%rbp), %ecx
movl %ecx, -0x30(%rbp)
movl %eax, -0x2c(%rbp)
movq %r15, -0x38(%rbp)
jmp 0x352c4
movl -0x2c(%rbp), %ecx
cmpl %ecx, %eax
cmovll %eax, %ecx
movl %ecx, -0x2c(%rbp)
movq -0x38(%rbp), %rax
cmovlq %r15, %rax
movq %rax, -0x38(%rbp)
movq %rbx, %r15
movq 0x8(%rbx), %rbx
addq $0x8, %r15
movzwl (%rbx), %esi
leal (%r14,%rsi), %eax
cmpl (%r12), %eax
jle 0x3526b
movq -0x38(%rbp), %rax
testq %rax, %rax
movq %r13, -0x78(%rbp)
je 0x352f5
movq (%rax), %rax
movzwl (%rax), %eax
movq %rax, -0x40(%rbp)
jmp 0x352fd
movq $0x0, -0x40(%rbp)
cmpl $0x1, 0x10(%r12)
jne 0x353c1
movq -0x58(%rbp), %rax
movq (%rax), %rbx
movzwl (%rbx), %eax
movq %rbx, %r12
cmpl %eax, %r14d
jle 0x3532d
movq %rbx, %r12
movq 0x8(%r12), %r12
movzwl (%r12), %eax
cmpl %eax, %r14d
jg 0x3531e
movq -0x58(%rbp), %r15
movzwl (%r12), %r13d
subl %r14d, %r13d
movq %r15, %rax
movq %rbx, %rcx
js 0x35525
movq %rcx, %rbx
movq %rax, %r15
leaq 0x8(%rcx), %rax
movq 0x8(%rcx), %rcx
movzwl (%rcx), %edx
cmpl %edx, %r13d
jge 0x35345
movzwl (%rbx), %eax
cmpl %eax, %r13d
jl 0x35544
movq %rbx, %rdi
movl %r13d, %esi
movl %r14d, %edx
leaq -0x48(%rbp), %rcx
callq 0x36022
movq -0x60(%rbp), %rcx
addl %eax, %ecx
movq -0x80(%rbp), %rdx
cmpl 0x4(%rdx), %ecx
jge 0x353b3
cmpl -0x2c(%rbp), %eax
jg 0x353b3
jl 0x3539f
movl -0x30(%rbp), %ecx
cmpl %ecx, -0x48(%rbp)
jl 0x3539f
jne 0x353b3
cmpl -0x40(%rbp), %r13d
jge 0x353b3
movl -0x48(%rbp), %ecx
movl %ecx, -0x30(%rbp)
movl %eax, -0x2c(%rbp)
movq %r15, -0x38(%rbp)
movl %r13d, %eax
movq %rax, -0x40(%rbp)
movq 0x8(%r12), %r12
testq %r12, %r12
jne 0x35331
movq -0x90(%rbp), %rbx
movq -0x98(%rbp), %r9
addq %rbx, %r9
movq -0x38(%rbp), %rdx
testq %rdx, %rdx
movq -0x80(%rbp), %r12
je 0x35434
movq -0x60(%rbp), %rax
addl -0x2c(%rbp), %eax
cmpl 0x4(%r12), %eax
jg 0x35434
movq %rax, %rcx
movq 0x20(%r12), %rax
testq %rax, %rax
je 0x35434
movq -0x40(%rbp), %rsi
movw %si, (%rax)
movw %cx, 0x2(%rax)
movq 0x8(%rax), %rcx
movq %rcx, 0x20(%r12)
movq (%rdx), %rcx
movzwl (%rcx), %edx
cmpl %edx, %esi
movq -0x68(%rbp), %r15
movq -0x78(%rbp), %r13
jle 0x35452
movq 0x8(%rcx), %rdx
addq $0x8, %rcx
movq %rcx, %rsi
movq %rdx, %rcx
movq -0x70(%rbp), %r10
jmp 0x3545a
movl $0xffffffff, 0x8(%r9)   # imm = 0xFFFFFFFF
movq -0x68(%rbp), %r15
movq -0x78(%rbp), %r13
incq %r13
cmpq %r15, %r13
jne 0x351e1
jmp 0x354ca
movq -0x70(%rbp), %r10
movq -0x38(%rbp), %rsi
movq %rax, (%rsi)
movq 0x8(%rcx), %r8
testq %r8, %r8
je 0x3549d
leaq 0x8(%rcx), %rsi
movq -0x40(%rbp), %rdx
leal (%rdx,%r10), %edi
movq %r8, %rdx
movzwl (%r8), %r8d
cmpl %r8d, %edi
jl 0x3549d
movq 0x20(%r12), %r8
movq %r8, (%rsi)
movq %rcx, 0x20(%r12)
leaq 0x8(%rdx), %rsi
movq 0x8(%rdx), %r8
movq %rdx, %rcx
testq %r8, %r8
jne 0x35472
jmp 0x354a0
movq %rcx, %rdx
movq %rdx, 0x8(%rax)
movzwl (%rdx), %eax
addl -0x40(%rbp), %r10d
cmpl %eax, %r10d
jle 0x354b4
movw %r10w, (%rdx)
movq -0x40(%rbp), %rax
movw %ax, 0x8(%r9)
movl -0x2c(%rbp), %eax
movw %ax, 0xa(%r9)
jmp 0x35444
leaq 0xb38(%rip), %rcx       # 0x36009
movl $0x10, %edx
movq %rbx, %rdi
movq -0x88(%rbp), %rsi
callq 0x7540
cmpl $0x0, -0x44(%rbp)
jle 0x35516
shlq $0x4, %r15
xorl %eax, %eax
movl $0x1, %ecx
cmpw $-0x1, 0x8(%rbx,%rax)
jne 0x35509
xorl %ecx, %ecx
cmpw $-0x1, 0xa(%rbx,%rax)
setne %cl
movl %ecx, 0xc(%rbx,%rax)
addq $0x10, %rax
cmpq %rax, %r15
jne 0x354f1
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x11913(%rip), %rdi     # 0x46e3f
leaq 0x117c3(%rip), %rsi     # 0x46cf6
leaq 0x118bb(%rip), %rcx     # 0x46df5
movl $0x171, %edx            # imm = 0x171
callq 0x7140
leaq 0x118fe(%rip), %rdi     # 0x46e49
leaq 0x117a4(%rip), %rsi     # 0x46cf6
leaq 0x1189c(%rip), %rcx     # 0x46df5
movl $0x177, %edx            # imm = 0x177
callq 0x7140
leaq 0x11875(%rip), %rdi     # 0x46ddf
leaq 0x11785(%rip), %rsi     # 0x46cf6
leaq 0x1187d(%rip), %rcx     # 0x46df5
movl $0x138, %edx            # imm = 0x138
callq 0x7140