// File: /workspace/github_cpp_makefile_star2_O3/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, %rbx
testl %edx, %edx
jle 0x34c40
movq %rdi, %r12
movl %edx, -0x38(%rbp)
movl %edx, %r14d
leaq 0xc(%rbx), %rax
xorl %ecx, %ecx
movl %ecx, (%rax)
incq %rcx
addq $0x10, %rax
cmpq %rcx, %r14
jne 0x348da
leaq 0xdeb(%rip), %rcx       # 0x356da
movl $0x10, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7530
cmpl $0x0, -0x38(%rbp)
jle 0x34c5a
leaq 0x18(%r12), %rax
movq %rax, -0x40(%rbp)
xorl %r10d, %r10d
movq %r14, -0x58(%rbp)
movq %r12, -0x70(%rbp)
movq %rbx, -0x78(%rbp)
movq %r10, %rdi
shlq $0x4, %rdi
movzwl 0x4(%rbx,%rdi), %eax
movl 0x8(%r12), %ecx
movq %rax, -0x80(%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 0x34cbd
movzwl 0x6(%rbx,%rdi), %eax
movq %rax, -0x48(%rbp)
movq 0x18(%r12), %rbx
movzwl (%rbx), %esi
leal (%r14,%rsi), %eax
cmpl (%r12), %eax
movq %rdi, -0x88(%rbp)
movq %r10, -0x60(%rbp)
jle 0x34995
movl 0x10(%r12), %ecx
xorl %r13d, %r13d
movl $0x40000000, -0x34(%rbp) # imm = 0x40000000
movl $0x40000000, -0x2c(%rbp) # imm = 0x40000000
jmp 0x34a31
movl $0x40000000, -0x34(%rbp) # imm = 0x40000000
xorl %r13d, %r13d
movq -0x40(%rbp), %r15
movl $0x40000000, -0x2c(%rbp) # imm = 0x40000000
movq %rbx, %rdi
movl %r14d, %edx
leaq -0x50(%rbp), %rcx
callq 0x35724
movl 0x10(%r12), %ecx
testl %ecx, %ecx
je 0x349f6
movq -0x48(%rbp), %rdx
addl %eax, %edx
cmpl 0x4(%r12), %edx
jg 0x34a05
movl -0x50(%rbp), %edx
cmpl -0x2c(%rbp), %eax
jl 0x349eb
sete %sil
cmpl -0x34(%rbp), %edx
setl %dil
andb %sil, %dil
cmpb $0x1, %dil
jne 0x34a05
movl %eax, -0x2c(%rbp)
movq %r15, %r13
movl %edx, -0x34(%rbp)
jmp 0x34a05
movl -0x2c(%rbp), %edx
cmpl %edx, %eax
cmovll %eax, %edx
movl %edx, -0x2c(%rbp)
cmovlq %r15, %r13
movq %rbx, %r15
movq 0x8(%rbx), %rbx
addq $0x8, %r15
movzwl (%rbx), %esi
leal (%r14,%rsi), %eax
cmpl (%r12), %eax
jle 0x349aa
testq %r13, %r13
je 0x34a2e
movq (%r13), %rax
movzwl (%rax), %eax
movl %eax, -0x30(%rbp)
jmp 0x34a38
xorl %r13d, %r13d
movl $0x0, -0x30(%rbp)
movq %r13, -0x68(%rbp)
cmpl $0x1, %ecx
jne 0x34af3
movq -0x40(%rbp), %rax
movq (%rax), %rbx
movzwl (%rbx), %eax
movq %rbx, %r15
cmpl %eax, %r14d
jle 0x34a67
movq %rbx, %r15
movq 0x8(%r15), %r15
movzwl (%r15), %eax
cmpl %eax, %r14d
ja 0x34a5a
movq -0x40(%rbp), %r12
movzwl (%r15), %r13d
subl %r14d, %r13d
movq %r12, %rax
movq %rbx, %rcx
js 0x34c7f
movq %rcx, %rbx
movq %rax, %r12
leaq 0x8(%rcx), %rax
movq 0x8(%rcx), %rcx
movzwl (%rcx), %edx
cmpl %edx, %r13d
jae 0x34a7e
movzwl (%rbx), %eax
cmpl %eax, %r13d
jb 0x34c9e
movq %rbx, %rdi
movl %r13d, %esi
movl %r14d, %edx
leaq -0x4c(%rbp), %rcx
callq 0x35724
movq -0x48(%rbp), %rcx
addl %eax, %ecx
movq -0x70(%rbp), %rdx
cmpl 0x4(%rdx), %ecx
jge 0x34ae6
cmpl -0x2c(%rbp), %eax
jg 0x34ae6
movl -0x4c(%rbp), %ecx
jb 0x34ad8
cmpl -0x34(%rbp), %ecx
jl 0x34ad8
jne 0x34ae6
cmpl -0x30(%rbp), %r13d
jge 0x34ae6
movl %eax, -0x2c(%rbp)
movq %r12, -0x68(%rbp)
movl %r13d, -0x30(%rbp)
movl %ecx, -0x34(%rbp)
movq 0x8(%r15), %r15
testq %r15, %r15
jne 0x34a6b
movq -0x78(%rbp), %rbx
movq -0x88(%rbp), %r9
addq %rbx, %r9
movq -0x68(%rbp), %rdi
testq %rdi, %rdi
movq -0x70(%rbp), %r12
je 0x34ba9
movq -0x48(%rbp), %rax
addl -0x2c(%rbp), %eax
cmpl 0x4(%r12), %eax
jg 0x34ba9
movq 0x20(%r12), %rcx
testq %rcx, %rcx
je 0x34ba9
movq %rax, %rdx
movl -0x30(%rbp), %r11d
movl %r11d, %eax
movw %r11w, (%rcx)
movw %dx, 0x2(%rcx)
movq 0x8(%rcx), %rdx
movq %rdx, 0x20(%r12)
movq (%rdi), %rdx
movzwl (%rdx), %esi
cmpl %esi, %r11d
movq -0x58(%rbp), %r14
movq -0x60(%rbp), %r10
jle 0x34b6a
movq 0x8(%rdx), %rsi
addq $0x8, %rdx
movq %rdx, %rdi
movq %rsi, %rdx
movq %rcx, (%rdi)
movq 0x8(%rdx), %r8
addl -0x80(%rbp), %r11d
testq %r8, %r8
je 0x34bc7
leaq 0x8(%rdx), %rdi
movq %r8, %rsi
movzwl (%r8), %r8d
cmpl %r8d, %r11d
jl 0x34bc7
movq 0x20(%r12), %r8
movq %r8, (%rdi)
movq %rdx, 0x20(%r12)
leaq 0x8(%rsi), %rdi
movq 0x8(%rsi), %r8
movq %rsi, %rdx
testq %r8, %r8
jne 0x34b7e
jmp 0x34bca
movl $0xffffffff, 0x8(%r9)   # imm = 0xFFFFFFFF
movq -0x58(%rbp), %r14
movq -0x60(%rbp), %r10
incq %r10
cmpq %r14, %r10
jne 0x34921
jmp 0x34be9
movq %rdx, %rsi
movq %rsi, 0x8(%rcx)
movzwl (%rsi), %ecx
cmpl %ecx, %r11d
jle 0x34bda
movw %r11w, (%rsi)
movw %ax, 0x8(%r9)
movl -0x2c(%rbp), %eax
movw %ax, 0xa(%r9)
jmp 0x34bb9
leaq 0xb1b(%rip), %rcx       # 0x3570b
movl $0x10, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7530
cmpl $0x0, -0x38(%rbp)
jle 0x34c31
shlq $0x4, %r14
xorl %eax, %eax
movl $0x1, %ecx
cmpw $-0x1, 0x8(%rbx,%rax)
jne 0x34c24
xorl %ecx, %ecx
cmpw $-0x1, 0xa(%rbx,%rax)
setne %cl
movl %ecx, 0xc(%rbx,%rax)
addq $0x10, %rax
cmpq %rax, %r14
jne 0x34c0c
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movslq %edx, %r14
leaq 0xa90(%rip), %rcx       # 0x356da
movl $0x10, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7530
leaq 0xaaa(%rip), %rcx       # 0x3570b
movl $0x10, %edx
movq %rbx, %rdi
movq %r14, %rsi
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x7530
leaq 0x12139(%rip), %rdi     # 0x46dbf
leaq 0x11fe9(%rip), %rsi     # 0x46c76
leaq 0x120e1(%rip), %rcx     # 0x46d75
movl $0x171, %edx            # imm = 0x171
callq 0x7140
leaq 0x12124(%rip), %rdi     # 0x46dc9
leaq 0x11fca(%rip), %rsi     # 0x46c76
leaq 0x120c2(%rip), %rcx     # 0x46d75
movl $0x177, %edx            # imm = 0x177
callq 0x7140
leaq 0x1209b(%rip), %rdi     # 0x46d5f
leaq 0x11fab(%rip), %rsi     # 0x46c76
leaq 0x120a3(%rip), %rcx     # 0x46d75
movl $0x138, %edx            # imm = 0x138
callq 0x7140