// File: /workspace/github_c_makefile_star2_O1/justy989[P]ce/ce_layout.c
// Function: ce_layout_resize_rect
bool ce_layout_resize_rect(CeLayout_t* root, CeLayout_t* layout, CeRect_t rect, CeDirection_t direction, bool expand, int64_t amount){
     switch(layout->type){
     default:
          break;
     case CE_LAYOUT_TYPE_VIEW:
     {
          ResizeRectResult_t result = resize_rect(&layout->view.rect, rect, direction, expand, amount);

          if(result.new_value < 0) return false;

          switch(direction){
          default:
               break;
          case CE_LEFT:
               if(expand){
                    resize_opposites_left(root, layout, rect, &result);
                    resize_shareds_left(root, layout, rect, &result);
               }else{
                    resize_shareds_left(root, layout, rect, &result);
                    resize_opposites_left(root, layout, rect, &result);
               }

               layout->view.rect.left = result.new_value;
               break;
          case CE_RIGHT:
               if(expand){
                    resize_opposites_right(root, layout, rect, &result);
                    resize_shareds_right(root, layout, rect, &result);
               }else{
                    resize_shareds_right(root, layout, rect, &result);
                    resize_opposites_right(root, layout, rect, &result);
               }

               layout->view.rect.right = result.new_value;
               break;
          case CE_UP:
               if(expand){
                    resize_opposites_up(root, layout, rect, &result);
                    resize_shareds_up(root, layout, rect, &result);
               }else{
                    resize_shareds_up(root, layout, rect, &result);
                    resize_opposites_up(root, layout, rect, &result);
               }

               layout->view.rect.top = result.new_value;
               break;
          case CE_DOWN:
               if(expand){
                    resize_opposites_down(root, layout, rect, &result);
                    resize_shareds_down(root, layout, rect, &result);
               }else{
                    resize_shareds_down(root, layout, rect, &result);
                    resize_opposites_down(root, layout, rect, &result);
               }

               layout->view.rect.bottom = result.new_value;
               break;
          }

          // Update parent rect
          CeLayout_t* parent = ce_layout_find_parent(root, layout);
          do{
              CeRect_t* parent_rect = NULL;
              switch(parent->type){
              default:
                  break;
              case CE_LAYOUT_TYPE_LIST:
                  parent_rect = &parent->list.rect;
                  break;
              case CE_LAYOUT_TYPE_TAB:
                  parent_rect = &parent->tab.rect;
                  break;
              case CE_LAYOUT_TYPE_TAB_LIST:
                  parent_rect = &parent->tab_list.rect;
                  break;
              }
              if(parent_rect){
                   switch(direction){
                   default:
                        break;
                   case CE_LEFT:
                        if(layout->view.rect.left < parent_rect->left){
                            parent_rect->left = layout->view.rect.left;
                        }
                        break;
                   case CE_RIGHT:
                        if(layout->view.rect.right > parent_rect->right){
                            parent_rect->right = layout->view.rect.right;
                        }
                        break;
                   case CE_UP:
                        if(layout->view.rect.top < parent_rect->top){
                            parent_rect->top = layout->view.rect.top;
                        }
                        break;
                   case CE_DOWN:
                        if(layout->view.rect.bottom > parent_rect->bottom){
                            parent_rect->bottom = layout->view.rect.bottom;
                        }
                        break;
                   }

              }
              parent = ce_layout_find_parent(root, parent);
          }while(parent);

     } break;
     case CE_LAYOUT_TYPE_LIST:
          break;
     case CE_LAYOUT_TYPE_TAB:
          break;
     case CE_LAYOUT_TYPE_TAB_LIST:
          break;
     }

     return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
cmpl $0x0, (%rsi)
je 0x1e2ee
movb $0x1, %al
jmp 0x1e7b7
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x80(%rsp), %r13
leaq 0x8(%rsi), %rax
movq %rax, 0x40(%rsp)
movq (%r13), %r9
movq 0x8(%r13), %rsi
movq 0x10(%r13), %r10
movq 0x18(%r13), %rdi
pcmpeqd %xmm0, %xmm0
movdqa %xmm0, 0x20(%rsp)
movq $-0x1, 0x30(%rsp)
movl %edx, %ebp
cmpl $0x3, %edx
ja 0x1e458
leaq 0x12838(%rip), %rax     # 0x30b74
movslq (%rax,%rbp,4), %rdx
addq %rax, %rdx
jmpq *%rdx
movq 0x40(%rsp), %rax
movq (%rax), %rax
movq %r8, %rdi
negq %rdi
testb %cl, %cl
cmoveq %r8, %rdi
addq %rax, %rdi
cmpq %r9, %rdi
setl %dl
cmpq %rsi, %rdi
setg %r8b
orb %dl, %r8b
jne 0x1e458
leaq -0x1(%rdi), %rdx
cmpq %r9, %rdi
setle %r8b
cmpq %rsi, %rdx
setg %sil
orb %r8b, %sil
jne 0x1e458
movq %rdi, 0x20(%rsp)
jmp 0x1e44b
movq %r8, %rdi
negq %rdi
testb %cl, %cl
cmovneq %r8, %rdi
movq 0x10(%r14), %rax
addq %rax, %rdi
cmpq %r9, %rdi
setge %dl
cmpq %rsi, %rdi
setl %sil
andb %dl, %sil
cmpb $0x1, %sil
jne 0x1e458
movq %rdi, %rdx
incq %rdx
movq %rdi, 0x20(%rsp)
jmp 0x1e405
movq %r8, %rsi
negq %rsi
testb %cl, %cl
cmovneq %r8, %rsi
movq 0x20(%r14), %rax
addq %rax, %rsi
cmpq %r10, %rsi
setge %dl
cmpq %rdi, %rsi
setl %dil
andb %dl, %dil
cmpb $0x1, %dil
jne 0x1e458
movq %rsi, %rdx
incq %rdx
movq %rsi, 0x20(%rsp)
incq %rax
jmp 0x1e44e
movq 0x18(%r14), %rax
movq %r8, %rsi
negq %rsi
testb %cl, %cl
cmoveq %r8, %rsi
addq %rax, %rsi
cmpq %r10, %rsi
setl %dl
cmpq %rdi, %rsi
setg %r8b
orb %dl, %r8b
jne 0x1e458
leaq -0x1(%rsi), %rdx
cmpq %r10, %rsi
setle %r8b
cmpq %rdi, %rdx
setg %dil
orb %r8b, %dil
jne 0x1e458
movq %rsi, 0x20(%rsp)
decq %rax
movq %rax, 0x28(%rsp)
movq %rdx, 0x30(%rsp)
movq 0x20(%rsp), %r12
testq %r12, %r12
js 0x1e7b5
cmpl $0x3, %ebx
ja 0x1e713
leaq 0x1270e(%rip), %rax     # 0x30b84
movslq (%rax,%rbp,4), %rdx
addq %rax, %rdx
jmpq *%rdx
testb %cl, %cl
je 0x1e675
movups (%r13), %xmm0
movups 0x10(%r13), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
leaq 0x20(%rsp), %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x1e7c6
movdqu (%r13), %xmm0
movups 0x10(%r13), %xmm1
movups %xmm1, 0x10(%rsp)
movdqu %xmm0, (%rsp)
movq %r15, %rdi
movq %r14, %rsi
leaq 0x20(%rsp), %rdx
callq 0x1e88a
jmp 0x1e6bd
testb %cl, %cl
je 0x1e5d3
movups (%r13), %xmm0
movups 0x10(%r13), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
leaq 0x20(%rsp), %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x1e938
movdqu (%r13), %xmm0
movups 0x10(%r13), %xmm1
movups %xmm1, 0x10(%rsp)
movdqu %xmm0, (%rsp)
movq %r15, %rdi
movq %r14, %rsi
leaq 0x20(%rsp), %rdx
callq 0x1e9fc
jmp 0x1e61b
testb %cl, %cl
je 0x1e624
movups (%r13), %xmm0
movups 0x10(%r13), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
leaq 0x20(%rsp), %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x1ec1c
movdqu (%r13), %xmm0
movups 0x10(%r13), %xmm1
movups %xmm1, 0x10(%rsp)
movdqu %xmm0, (%rsp)
movq %r15, %rdi
movq %r14, %rsi
leaq 0x20(%rsp), %rdx
callq 0x1ece0
jmp 0x1e66c
testb %cl, %cl
je 0x1e6c4
movups (%r13), %xmm0
movups 0x10(%r13), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
leaq 0x20(%rsp), %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x1eaaa
movdqu (%r13), %xmm0
movups 0x10(%r13), %xmm1
movups %xmm1, 0x10(%rsp)
movdqu %xmm0, (%rsp)
movq %r15, %rdi
movq %r14, %rsi
leaq 0x20(%rsp), %rdx
callq 0x1eb6e
jmp 0x1e70c
movups (%r13), %xmm0
movups 0x10(%r13), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
leaq 0x20(%rsp), %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x1e9fc
movdqu (%r13), %xmm0
movups 0x10(%r13), %xmm1
movups %xmm1, 0x10(%rsp)
movdqu %xmm0, (%rsp)
movq %r15, %rdi
movq %r14, %rsi
leaq 0x20(%rsp), %rdx
callq 0x1e938
leaq 0x10(%r14), %rax
jmp 0x1e710
movups (%r13), %xmm0
movups 0x10(%r13), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
leaq 0x20(%rsp), %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x1ece0
movdqu (%r13), %xmm0
movups 0x10(%r13), %xmm1
movups %xmm1, 0x10(%rsp)
movdqu %xmm0, (%rsp)
movq %r15, %rdi
movq %r14, %rsi
leaq 0x20(%rsp), %rdx
callq 0x1ec1c
leaq 0x20(%r14), %rax
jmp 0x1e710
movups (%r13), %xmm0
movups 0x10(%r13), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
leaq 0x20(%rsp), %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x1e88a
movdqu (%r13), %xmm0
movups 0x10(%r13), %xmm1
movups %xmm1, 0x10(%rsp)
movdqu %xmm0, (%rsp)
movq %r15, %rdi
movq %r14, %rsi
leaq 0x20(%rsp), %rdx
callq 0x1e7c6
movq 0x40(%rsp), %rax
jmp 0x1e710
movups (%r13), %xmm0
movups 0x10(%r13), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
leaq 0x20(%rsp), %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x1eb6e
movdqu (%r13), %xmm0
movups 0x10(%r13), %xmm1
movups %xmm1, 0x10(%rsp)
movdqu %xmm0, (%rsp)
movq %r15, %rdi
movq %r14, %rsi
leaq 0x20(%rsp), %rdx
callq 0x1eaaa
leaq 0x18(%r14), %rax
movq %r12, (%rax)
movq %r15, %rdi
movq %r14, %rsi
callq 0x1dde1
leaq 0x1246f(%rip), %r13     # 0x30b94
movl (%rax), %ecx
cmpl $0x3, %ecx
je 0x1e736
cmpl $0x2, %ecx
je 0x1e73c
cmpl $0x1, %ecx
jne 0x1e742
leaq 0x20(%rax), %rcx
jmp 0x1e744
leaq 0x18(%rax), %rcx
jmp 0x1e744
xorl %ecx, %ecx
testq %rcx, %rcx
je 0x1e798
cmpl $0x3, %ebx
ja 0x1e798
movslq (%r13,%rbp,4), %rdx
addq %r13, %rdx
jmpq *%rdx
movq 0x40(%rsp), %rdx
movq (%rdx), %rdx
cmpq (%rcx), %rdx
jge 0x1e798
movq %rdx, (%rcx)
jmp 0x1e798
movq 0x10(%r14), %rdx
cmpq 0x8(%rcx), %rdx
jle 0x1e798
movq %rdx, 0x8(%rcx)
jmp 0x1e798
movq 0x20(%r14), %rdx
cmpq 0x18(%rcx), %rdx
jle 0x1e798
movq %rdx, 0x18(%rcx)
jmp 0x1e798
movq 0x18(%r14), %rdx
cmpq 0x10(%rcx), %rdx
jge 0x1e798
movq %rdx, 0x10(%rcx)
movq %r15, %rdi
movq %rax, %rsi
callq 0x1dde1
testq %rax, %rax
jne 0x1e725
testq %r12, %r12
jns 0x1e2e7
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq