// File: /workspace/github_c_makefile_star2_O0/justy989[P]ce/ce_app.c
// Function: build_clangd_completion_view
void build_clangd_completion_view(CeView_t* view,
                                  CePoint_t start,
                                  CeView_t* completed_view,
                                  CeBuffer_t* buffer,
                                  CeConfigOptions_t* config_options,
                                  CeRect_t* terminal_rect){
     int64_t view_height = 0;
     if(buffer->line_count > config_options->completion_line_limit){
          view_height = config_options->completion_line_limit;
     }else{
          view_height = buffer->line_count;
     }

     CePoint_t view_start = (CePoint_t){completed_view->rect.left + (start.x - completed_view->scroll.x),
                                        completed_view->rect.top + (start.y - completed_view->scroll.y)};

     if(start.y > view_height){
          view->rect.bottom = view_start.y;
          view->rect.top = view->rect.bottom - view_height;
     }else{
          view->rect.top = view_start.y + 1;
          view->rect.bottom = view->rect.top + view_height;
     }

     view->rect.left = view_start.x;
     if(!completed_view->buffer->no_line_numbers){
          view->rect.left += ce_line_number_column_width(config_options->line_number,
                                                         completed_view->buffer->line_count,
                                                         completed_view->rect.top,
                                                         completed_view->rect.bottom);
     }

     int64_t longest_line = 0;
     for(int64_t i = 0; i < buffer->line_count; i++){
          int64_t line_len = ce_buffer_line_len(buffer, i);
          if(line_len > longest_line){
               longest_line = line_len;
          }
     }
     view->rect.right = view->rect.left + longest_line;

     // Clamp to the view.
     if(view->rect.left >= terminal_rect->right){
          view->rect.left = terminal_rect->right - 1;
     }
     if(view->rect.right >= terminal_rect->right){
          view->rect.right = terminal_rect->right - 1;
     }
     if(view->rect.bottom >= terminal_rect->bottom){
          view->rect.bottom = terminal_rect->bottom - 1;
     }
     if(view->rect.top >= terminal_rect->bottom){
          view->rect.top = terminal_rect->bottom - 1;
     }
     if(view->rect.left < 0){
          view->rect.left = 0;
     }
     if(view->rect.right < 0){
          view->rect.right = 0;
     }
     if(view->rect.bottom < 0){
          view->rect.bottom = 0;
     }
     if(view->rect.top < 0){
          view->rect.top = 0;
     }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq 0x10(%rbp), %rax
movq %rsi, -0x10(%rbp)
movq %rdx, -0x8(%rbp)
movq %rdi, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x30(%rbp), %rcx
cmpq 0x30(%rcx), %rax
jle 0x167fc
movq -0x30(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x16808
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movq -0x20(%rbp), %rdx
subq 0x20(%rdx), %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rcx
movq -0x20(%rbp), %rdx
subq 0x28(%rdx), %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
cmpq -0x38(%rbp), %rax
jle 0x16869
movq -0x40(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rcx
subq -0x38(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x1688d
movq -0x40(%rbp), %rcx
addq $0x1, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rcx
addq -0x38(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x48(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rax
testb $0x1, 0x50(%rax)
jne 0x168da
movq -0x30(%rbp), %rax
movl (%rax), %edi
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rsi
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdx
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rcx
callq 0x12940
movq %rax, %rcx
movq -0x18(%rbp), %rax
addq (%rax), %rcx
movq %rcx, (%rax)
movq $0x0, -0x50(%rbp)
movq $0x0, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq -0x28(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jge 0x1692b
movq -0x28(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0xf6e0
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
cmpq -0x50(%rbp), %rax
jle 0x1691b
movq -0x60(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x1691d
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
jmp 0x168ea
movq -0x18(%rbp), %rax
movq (%rax), %rcx
addq -0x50(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jl 0x16962
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rcx
subq $0x1, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x10(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jl 0x16988
movq 0x10(%rbp), %rax
movq 0x8(%rax), %rcx
subq $0x1, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x10(%rbp), %rcx
cmpq 0x18(%rcx), %rax
jl 0x169ae
movq 0x10(%rbp), %rax
movq 0x18(%rax), %rcx
subq $0x1, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x10(%rbp), %rcx
cmpq 0x18(%rcx), %rax
jl 0x169d4
movq 0x10(%rbp), %rax
movq 0x18(%rax), %rcx
subq $0x1, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rax
cmpq $0x0, (%rax)
jge 0x169e9
movq -0x18(%rbp), %rax
movq $0x0, (%rax)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jge 0x16a00
movq -0x18(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jge 0x16a17
movq -0x18(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jge 0x16a2e
movq -0x18(%rbp), %rax
movq $0x0, 0x10(%rax)
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)