// File: /workspace/github_c_makefile_star2_O0/Cloudef[P]dwm-fork/dwm.c
// Function: grid
void
grid(Monitor *m) {
   unsigned int i, n, cx, cy, cw, ch, aw, ah, cols, rows;
   Client *c;

   for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next))
      n++;

   /* grid dimensions */
   for(rows = 0; rows <= n/2; rows++)
      if(rows*rows >= n)
         break;
   cols = (rows && (rows - 1) * rows >= n) ? rows - 1 : rows;

   /* window geoms (cell height/width) */
   ch = m->wh / (rows ? rows : 1);
   cw = m->ww / (cols ? cols : 1);
   for(i = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next)) {
      cx = m->wx + (i / rows) * cw;
      cy = m->wy + (i % rows) * ch;
      /* adjust height/width of last row/column's windows */
      ah = ((i + 1) % rows == 0) ? m->wh - ch * rows : 0;
      aw = (i >= rows * (cols - 1)) ? m->ww - cw * cols : 0;
      resize(c, cx, cy, cw - 2 * c->bw + aw, ch - 2 * c->bw + ah, False);
      i++;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movl $0x0, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rdi
callq 0x7fc0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x79ba
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
movq -0x38(%rbp), %rax
movq 0x190(%rax), %rdi
callq 0x7fc0
movq %rax, -0x38(%rbp)
jmp 0x7994
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
movl -0x10(%rbp), %ecx
shrl %ecx
cmpl %ecx, %eax
ja 0x79e8
movl -0x30(%rbp), %eax
imull -0x30(%rbp), %eax
cmpl -0x10(%rbp), %eax
jb 0x79db
jmp 0x79e8
jmp 0x79dd
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x79c1
cmpl $0x0, -0x30(%rbp)
je 0x7a08
movl -0x30(%rbp), %eax
subl $0x1, %eax
imull -0x30(%rbp), %eax
cmpl -0x10(%rbp), %eax
jb 0x7a08
movl -0x30(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x7a0e
movl -0x30(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rax
movl 0x44(%rax), %eax
movl %eax, -0x40(%rbp)
cmpl $0x0, -0x30(%rbp)
je 0x7a2c
movl -0x30(%rbp), %eax
movl %eax, -0x44(%rbp)
jmp 0x7a36
movl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x7a36
movl -0x40(%rbp), %eax
movl -0x44(%rbp), %ecx
xorl %edx, %edx
divl %ecx
movl %eax, -0x20(%rbp)
movq -0x8(%rbp), %rax
movl 0x40(%rax), %eax
movl %eax, -0x48(%rbp)
cmpl $0x0, -0x2c(%rbp)
je 0x7a5b
movl -0x2c(%rbp), %eax
movl %eax, -0x4c(%rbp)
jmp 0x7a65
movl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x7a65
movl -0x48(%rbp), %eax
movl -0x4c(%rbp), %ecx
xorl %edx, %edx
divl %ecx
movl %eax, -0x1c(%rbp)
movl $0x0, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq 0x78(%rax), %rdi
callq 0x7fc0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x7b99
movq -0x8(%rbp), %rax
movl 0x38(%rax), %eax
movl %eax, -0x54(%rbp)
movl -0xc(%rbp), %eax
xorl %edx, %edx
divl -0x30(%rbp)
movl %eax, %ecx
movl -0x54(%rbp), %eax
imull -0x1c(%rbp), %ecx
addl %ecx, %eax
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rax
movl 0x3c(%rax), %eax
movl %eax, -0x50(%rbp)
movl -0xc(%rbp), %eax
xorl %edx, %edx
divl -0x30(%rbp)
movl -0x50(%rbp), %eax
imull -0x20(%rbp), %edx
addl %edx, %eax
movl %eax, -0x18(%rbp)
movl -0xc(%rbp), %eax
addl $0x1, %eax
xorl %edx, %edx
divl -0x30(%rbp)
cmpl $0x0, %edx
jne 0x7af8
movq -0x8(%rbp), %rax
movl 0x44(%rax), %eax
movl -0x20(%rbp), %ecx
imull -0x30(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0x58(%rbp)
jmp 0x7aff
xorl %eax, %eax
movl %eax, -0x58(%rbp)
jmp 0x7aff
movl -0x58(%rbp), %eax
movl %eax, -0x28(%rbp)
movl -0xc(%rbp), %eax
movl -0x30(%rbp), %ecx
movl -0x2c(%rbp), %edx
subl $0x1, %edx
imull %edx, %ecx
cmpl %ecx, %eax
jb 0x7b2d
movq -0x8(%rbp), %rax
movl 0x40(%rax), %eax
movl -0x1c(%rbp), %ecx
imull -0x2c(%rbp), %ecx
subl %ecx, %eax
movl %eax, -0x5c(%rbp)
jmp 0x7b34
xorl %eax, %eax
movl %eax, -0x5c(%rbp)
jmp 0x7b34
movl -0x5c(%rbp), %eax
movl %eax, -0x24(%rbp)
movq -0x38(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
movl -0x1c(%rbp), %ecx
movq -0x38(%rbp), %rax
movl 0x150(%rax), %eax
shll %eax
subl %eax, %ecx
addl -0x24(%rbp), %ecx
movl -0x20(%rbp), %r8d
movq -0x38(%rbp), %rax
movl 0x150(%rax), %eax
shll %eax
subl %eax, %r8d
addl -0x28(%rbp), %r8d
xorl %r9d, %r9d
callq 0x8060
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
movq -0x38(%rbp), %rax
movq 0x190(%rax), %rdi
callq 0x7fc0
movq %rax, -0x38(%rbp)
jmp 0x7a8a
addq $0x60, %rsp
popq %rbp
retq
nop