// File: /workspace/github_c_makefile_star2_O0/justy989[P]ce/main.c
// Function: build_buffer_list
static void build_buffer_list(CeBuffer_t* buffer, CeBufferNode_t* head){
     char buffer_info[BUFSIZ];
     ce_buffer_empty(buffer);

     // calc maxes of things we care about for formatting
     int64_t max_buffer_lines = 0;
     int64_t max_name_len = 0;
     const CeBufferNode_t* itr = head;
     while(itr){
          if(max_buffer_lines < itr->buffer->line_count) max_buffer_lines = itr->buffer->line_count;
          int64_t name_len = strlen(itr->buffer->name);
          if(max_name_len < name_len) max_name_len = name_len;
          itr = itr->next;
     }

     int64_t max_buffer_lines_digits = ce_count_digits(max_buffer_lines);
     if(max_buffer_lines_digits < 5) max_buffer_lines_digits = 5; // account for "lines" string row header
     if(max_name_len < 11) max_name_len = 11; // account for "buffer name" string row header

     // build format string, OMG THIS IS SO UNREADABLE HOLY MOLY BATMAN
     char format_string[BUFSIZ];
     snprintf(format_string, BUFSIZ, "%%5s %%-%"PRId64"s %%%"PRId64 PRId64, max_name_len, max_buffer_lines_digits);

     // build buffer info
     itr = head;
     while(itr){
          const char* buffer_flag_str = ce_buffer_status_get_str(itr->buffer->status);
          // if the current buffer is the one we are putthing this list together on, set it to readonly for visual sake
          if(itr->buffer == buffer) buffer_flag_str = ce_buffer_status_get_str(CE_BUFFER_STATUS_READONLY);
          snprintf(buffer_info, BUFSIZ, format_string, buffer_flag_str, itr->buffer->name,
                   itr->buffer->line_count);
          buffer_append_on_new_line(buffer, buffer_info);
          itr = itr->next;
     }

     buffer->status = CE_BUFFER_STATUS_READONLY;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x4050, %rsp           # imm = 0x4050
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0xe920
movq $0x0, -0x2018(%rbp)
movq $0x0, -0x2020(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x2028(%rbp)
cmpq $0x0, -0x2028(%rbp)
je 0x41252
movq -0x2018(%rbp), %rax
movq -0x2028(%rbp), %rcx
movq (%rcx), %rcx
cmpq 0x8(%rcx), %rax
jge 0x41203
movq -0x2028(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x2018(%rbp)
movq -0x2028(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rdi
callq 0xd200
movq %rax, -0x2030(%rbp)
movq -0x2020(%rbp), %rax
cmpq -0x2030(%rbp), %rax
jge 0x4123b
movq -0x2030(%rbp), %rax
movq %rax, -0x2020(%rbp)
movq -0x2028(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x2028(%rbp)
jmp 0x411cd
movq -0x2018(%rbp), %rdi
callq 0x128d0
movq %rax, -0x2038(%rbp)
cmpq $0x5, -0x2038(%rbp)
jge 0x4127a
movq $0x5, -0x2038(%rbp)
cmpq $0xb, -0x2020(%rbp)
jge 0x4128f
movq $0xb, -0x2020(%rbp)
leaq -0x4040(%rbp), %rdi
movq -0x2020(%rbp), %rcx
movq -0x2038(%rbp), %r8
movl $0x2000, %esi           # imm = 0x2000
leaq 0x48b8(%rip), %rdx      # 0x45b68
movb $0x0, %al
callq 0xd250
movq -0x10(%rbp), %rax
movq %rax, -0x2028(%rbp)
cmpq $0x0, -0x2028(%rbp)
je 0x4136e
movq -0x2028(%rbp), %rax
movq (%rax), %rax
movl 0x18(%rax), %edi
callq 0x11650
movq %rax, -0x4048(%rbp)
movq -0x2028(%rbp), %rax
movq (%rax), %rax
cmpq -0x8(%rbp), %rax
jne 0x4130a
movl $0x2, %edi
callq 0x11650
movq %rax, -0x4048(%rbp)
leaq -0x2010(%rbp), %rdi
leaq -0x4040(%rbp), %rdx
movq -0x4048(%rbp), %rcx
movq -0x2028(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rax), %r8
movq -0x2028(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %r9
movl $0x2000, %esi           # imm = 0x2000
movb $0x0, %al
callq 0xd250
movq -0x8(%rbp), %rdi
leaq -0x2010(%rbp), %rsi
callq 0x14fd0
movq -0x2028(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x2028(%rbp)
jmp 0x412c2
movq -0x8(%rbp), %rax
movl $0x2, 0x18(%rax)
addq $0x4050, %rsp           # imm = 0x4050
popq %rbp
retq
nopw %cs:(%rax,%rax)