decompiled_code:
__int64 __fastcall grid_view_set_cell(__int64 a1, __int64 a2, int a3)
{
return grid_set_cell(a1, a2, (unsigned int)(*(_DWORD *)(a1 + 12) + a3));
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, __int64 a2, int a3)
{
return grid_set_cell(a1, a2, (unsigned int)(*(_DWORD *)(a1 + 12) + a3));
}

original_code:
void
grid_view_set_cell(
    struct grid *gd, u_int px, u_int py, const struct grid_cell *gc)
{
 grid_set_cell(gd, (px), ((gd)->hsize + (py)), gc);
}

canonical_original_code:
void grid_view_set_cell(struct grid *gd, unsigned int px, unsigned int py, struct grid_cell *gc)
{
 grid_set_cell(gd, (px), ((gd)->hsize + (py)), gc);
}

variable_types: struct grid { int flags; unsigned int sx; unsigned int sy; unsigned int hsize; unsigned int hlimit; struct grid_line { unsigned int cellsize; struct grid_cell { unsigned char attr; unsigned char flags; unsigned char fg; unsigned char bg; unsigned char data; } *celldata; unsigned int utf8size; struct grid_utf8 { unsigned char width; unsigned char data[9]; } *utf8data; int flags; } *linedata; } *

variable_types:
gc
struct grid_cell *


repo: ThomasAdam/tmux-ARCHIVED

decompiled_code:
__int64 __fastcall grid_view_peek_utf8(__int64 a1, __int64 a2, int a3)
{
return grid_peek_utf8(a1, a2, (unsigned int)(*(_DWORD *)(a1 + 12) + a3));
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1, __int64 a2, int a3)
{
return grid_peek_utf8(a1, a2, (unsigned int)(*(_DWORD *)(a1 + 12) + a3));
}

original_code:
const struct grid_utf8 *
grid_view_peek_utf8(struct grid *gd, u_int px, u_int py)
{
 return (grid_peek_utf8(gd, (px), ((gd)->hsize + (py))));
}

canonical_original_code:
struct grid_utf8 *grid_view_peek_utf8(struct grid *gd, unsigned int px, unsigned int py)
{
 return (grid_peek_utf8(gd, (px), ((gd)->hsize + (py))));
}

variable_types: struct grid { int flags; unsigned int sx; unsigned int sy; unsigned int hsize; unsigned int hlimit; struct grid_line { unsigned int cellsize; struct grid_cell { unsigned char attr; unsigned char flags; unsigned char fg; unsigned char bg; unsigned char data; } *celldata; unsigned int utf8size; struct grid_utf8 *utf8data; int flags; } *linedata; } *

variable_types:
px
unsigned int

variable_types:
py
unsigned int

return_type: struct grid_utf8 { unsigned char width; unsigned char data[9]; } *

user_defined_types: struct grid { int flags; unsigned int sx; unsigned int sy; unsigned int hsize; unsigned int hlimit; struct grid_line *linedata; }

user_defined_types: struct grid_line { unsigned int cellsize; struct grid_cell *celldata; unsigned int utf8size; struct grid_utf8 *utf8data; int flags; }


decompiled_code:
__int64 __fastcall grid_view_get_utf8(__int64 a1, __int64 a2, int a3)
{
return grid_get_utf8(a1, a2, (unsigned int)(*(_DWORD *)(a1 + 12) + a3));
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1, __int64 a2, int a3)
{
return grid_get_utf8(a1, a2, (unsigned int)(*(_DWORD *)(a1 + 12) + a3));
}

original_code:
struct grid_utf8 *
grid_view_get_utf8(struct grid *gd, u_int px, u_int py)
{
 return (grid_get_utf8(gd, (px), ((gd)->hsize + (py))));
}

canonical_original_code:
struct grid_utf8 *grid_view_get_utf8(struct grid *gd, unsigned int px, unsigned int py)
{
 return (grid_get_utf8(gd, (px), ((gd)->hsize + (py))));
}

user_defined_types: struct grid_utf8 { unsigned char width; unsigned char data[9]; }

user_defined_types: struct grid_cell { unsigned char attr; unsigned char flags; unsigned char fg; unsigned char bg; unsigned char data; }


decompiled_code:
__int64 __fastcall grid_view_set_utf8(__int64 a1, __int64 a2, int a3)
{
return grid_set_utf8(a1, a2, (unsigned int)(*(_DWORD *)(a1 + 12) + a3));
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1, __int64 a2, int a3)
{
return grid_set_utf8(a1, a2, (unsigned int)(*(_DWORD *)(a1 + 12) + a3));
}

original_code:
void
grid_view_set_utf8(
    struct grid *gd, u_int px, u_int py, const struct grid_utf8 *gu)
{
 grid_set_utf8(gd, (px), ((gd)->hsize + (py)), gu);
}

canonical_original_code:
void grid_view_set_utf8(struct grid *gd, unsigned int px, unsigned int py, struct grid_utf8 *gu)
{
 grid_set_utf8(gd, (px), ((gd)->hsize + (py)), gu);
}

variable_types:
gu
struct grid_utf8 *

return_type: void


decompiled_code:
__int64 __fastcall grid_view_clear(__int64 a1, __int64 a2, int a3)
{
return grid_clear(a1, a2, (unsigned int)(*(_DWORD *)(a1 + 12) + a3));
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1, __int64 a2, int a3)
{
return grid_clear(a1, a2, (unsigned int)(*(_DWORD *)(a1 + 12) + a3));
}

original_code:
void
grid_view_clear(struct grid *gd, u_int px, u_int py, u_int nx, u_int ny)
{
 ;
 px = (px);
 py = ((gd)->hsize + (py));
 grid_clear(gd, px, py, nx, ny);
}

canonical_original_code:
void grid_view_clear(struct grid *gd, unsigned int px, unsigned int py, unsigned int nx, unsigned int ny)
{
 ;
 px = (px);
 py = ((gd)->hsize + (py));
 grid_clear(gd, px, py, nx, ny);
}

variable_types:
nx
unsigned int

variable_types:
ny
unsigned int


decompiled_code:
__int64 __fastcall grid_view_scroll_region_down(__int64 a1, int a2, int a3)
{
return grid_move_lines(
a1,
(unsigned int)(a2 + *(_DWORD *)(a1 + 12) + 1),
(unsigned int)(a2 + *(_DWORD *)(a1 + 12)),
(unsigned int)(a3 - a2));
}

canonical_decompiled_code:
__int64 __fastcall func8(__int64 a1, int a2, int a3)
{
return grid_move_lines(
a1,
(unsigned int)(a2 + *(_DWORD *)(a1 + 12) + 1),
(unsigned int)(a2 + *(_DWORD *)(a1 + 12)),
(unsigned int)(a3 - a2));
}

original_code:
void
grid_view_scroll_region_down(struct grid *gd, u_int rupper, u_int rlower)
{
 ;
 rupper = ((gd)->hsize + (rupper));
 rlower = ((gd)->hsize + (rlower));
 grid_move_lines(gd, rupper + 1, rupper, rlower - rupper);
}

canonical_original_code:
void grid_view_scroll_region_down(struct grid *gd, unsigned int rupper, unsigned int rlower)
{
 ;
 rupper = ((gd)->hsize + (rupper));
 rlower = ((gd)->hsize + (rlower));
 grid_move_lines(gd, rupper + 1, rupper, rlower - rupper);
}

variable_types:
rupper
unsigned int

variable_types:
rlower
unsigned int


decompiled_code:
__int64 __fastcall grid_view_insert_lines(__int64 a1, int a2, int a3)
{
return grid_move_lines(
a1,
(unsigned int)(a2 + *(_DWORD *)(a1 + 12) + a3),
(unsigned int)(a2 + *(_DWORD *)(a1 + 12)),
(unsigned int)(*(_DWORD *)(a1 + 8) - (a3 + a2)));
}

canonical_decompiled_code:
__int64 __fastcall func9(__int64 a1, int a2, int a3)
{
return grid_move_lines(
a1,
(unsigned int)(a2 + *(_DWORD *)(a1 + 12) + a3),
(unsigned int)(a2 + *(_DWORD *)(a1 + 12)),
(unsigned int)(*(_DWORD *)(a1 + 8) - (a3 + a2)));
}

original_code:
void
grid_view_insert_lines(struct grid *gd, u_int py, u_int ny)
{
 u_int sy;
 ;
 py = ((gd)->hsize + (py));
 sy = ((gd)->hsize + (gd->sy));
 grid_move_lines(gd, py + ny, py, sy - py - ny);
}

canonical_original_code:
void grid_view_insert_lines(struct grid *gd, unsigned int py, unsigned int ny)
{
 unsigned int sy;
 ;
 py = ((gd)->hsize + (py));
 sy = ((gd)->hsize + (gd->sy));
 grid_move_lines(gd, py + ny, py, sy - py - ny);
}

variable_types:
sy
unsigned int


decompiled_code:
__int64 __fastcall grid_view_string_cells(__int64 a1, __int64 a2, int a3)
{
return grid_string_cells(a1, a2, (unsigned int)(*(_DWORD *)(a1 + 12) + a3));
}

canonical_decompiled_code:
__int64 __fastcall func15(__int64 a1, __int64 a2, int a3)
{
return grid_string_cells(a1, a2, (unsigned int)(*(_DWORD *)(a1 + 12) + a3));
}

original_code:
char *
grid_view_string_cells(struct grid *gd, u_int px, u_int py, u_int nx)
{
 ;
 px = (px);
 py = ((gd)->hsize + (py));
 return (grid_string_cells(gd, px, py, nx));
}

canonical_original_code:
char *grid_view_string_cells(struct grid *gd, unsigned int px, unsigned int py, unsigned int nx)
{
 ;
 px = (px);
 py = ((gd)->hsize + (py));
 return (grid_string_cells(gd, px, py, nx));
}

return_type: char *


decompiled_code:
__int64 __fastcall ibuf_realloc(__int64 a1, __int64 a2)
{
size_t v3; // rsi
void *v4; // rax
__int64 v5; // rbp
__int64 result; // rax

v3 = *(_QWORD *)(a1 + 40) + a2;
if ( v3 > *(_QWORD *)(a1 + 32) )
{
*_errno_location() = 12;
result = 0xFFFFFFFFLL;
}
else
{
v4 = realloc(*(void **)(a1 + 16), v3);
if ( v4 )
{
v5 = *(_QWORD *)(a1 + 40) + a2;
*(_QWORD *)(a1 + 16) = v4;
result = 0LL;
*(_QWORD *)(a1 + 24) = v5;
}
else
{
result = 0xFFFFFFFFLL;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, __int64 a2)
{
size_t v3; // rsi
void *v4; // rax
__int64 v5; // rbp
__int64 result; // rax

v3 = *(_QWORD *)(a1 + 40) + a2;
if ( v3 > *(_QWORD *)(a1 + 32) )
{
*_errno_location() = 12;
result = 0xFFFFFFFFLL;
}
else
{
v4 = realloc(*(void **)(a1 + 16), v3);
if ( v4 )
{
v5 = *(_QWORD *)(a1 + 40) + a2;
*(_QWORD *)(a1 + 16) = v4;
result = 0LL;
*(_QWORD *)(a1 + 24) = v5;
}
else
{
result = 0xFFFFFFFFLL;
}
}
return result;
}

original_code:
int
ibuf_realloc(struct ibuf *buf, size_t len)
{
 u_char *b;
 if (buf->wpos + len > buf->max) {
  (*__errno_location ()) = 12;
  return (-1);
 }
 b = realloc(buf->buf, buf->wpos + len);
 if (b == ((void *)0))
  return (-1);
 buf->buf = b;
 buf->size = buf->wpos + len;
 return (0);
}

canonical_original_code:
int ibuf_realloc(struct ibuf *buf, unsigned long len)
{
 unsigned char *b;
 if (buf->wpos + len > buf->max) {
  (*__errno_location ()) = 12;
  return (-1);
 }
 b = realloc(buf->buf, buf->wpos + len);
 if (b == ((void *)0))
  return (-1);
 buf->buf = b;
 buf->size = buf->wpos + len;
 return (0);
}

variable_types: struct ibuf { struct { struct ibuf *tqe_next; struct ibuf **tqe_prev; } entry; unsigned char *buf; unsigned long size; unsigned long max; unsigned long wpos; unsigned long rpos; int fd; } *

variable_types:
len
unsigned long

variable_types:
b
unsigned char *

return_type: int


decompiled_code:
__int64 __fastcall ibuf_add(_QWORD *a1, const void *a2, size_t a3)
{
__int64 v5; // rdi
__int64 result; // rax

v5 = a1[5];
if ( v5 + a3 > a1[3] )
{
result = ibuf_realloc((__int64)a1, a3);
if ( (_DWORD)result == -1 )
return result;
v5 = a1[5];
}
memcpy((void *)(a1[2] + v5), a2, a3);
a1[5] += a3;
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func1(_QWORD *a1, const void *a2, size_t a3)
{
__int64 v5; // rdi
__int64 result; // rax

v5 = a1[5];
if ( v5 + a3 > a1[3] )
{
result = func0((__int64)a1, a3);
if ( (_DWORD)result == -1 )
return result;
v5 = a1[5];
}
memcpy((void *)(a1[2] + v5), a2, a3);
a1[5] += a3;
return 0LL;
}

original_code:
int
ibuf_add(struct ibuf *buf, const void *data, size_t len)
{
 if (buf->wpos + len > buf->size)
  if (ibuf_realloc(buf, len) == -1)
   return (-1);
 memcpy(buf->buf + buf->wpos, data, len);
 buf->wpos += len;
 return (0);
}

canonical_original_code:
int ibuf_add(struct ibuf *buf, void *data, unsigned long len)
{
 if (buf->wpos + len > buf->size)
  if (ibuf_realloc(buf, len) == -1)
   return (-1);
 memcpy(buf->buf + buf->wpos, data, len);
 buf->wpos += len;
 return (0);
}

variable_types:
data
void *

user_defined_types: struct ibuf { struct { struct ibuf *tqe_next; struct ibuf **tqe_prev; } entry; unsigned char *buf; unsigned long size; unsigned long max; unsigned long wpos; unsigned long rpos; int fd; }


decompiled_code:
__int64 __fastcall ibuf_reserve(_QWORD *a1, __int64 a2)
{
__int64 v2; // rax
__int64 v3; // rdx

v2 = a1[5];
v3 = v2 + a2;
if ( (unsigned __int64)(v2 + a2) <= a1[3] )
goto LABEL_2;
if ( (unsigned int)ibuf_realloc((__int64)a1, a2) != -1 )
{
v2 = a1[5];
v3 = a2 + v2;
LABEL_2:
a1[5] = v3;
return a1[2] + v2;
}
return 0LL;
}

original_code:
void *
ibuf_reserve(struct ibuf *buf, size_t len)
{
 void *b;
 if (buf->wpos + len > buf->size)
  if (ibuf_realloc(buf, len) == -1)
   return (((void *)0));
 b = buf->buf + buf->wpos;
 buf->wpos += len;
 return (b);
}

canonical_original_code:
void *ibuf_reserve(struct ibuf *buf, unsigned long len)
{
 void *b;
 if (buf->wpos + len > buf->size)
  if (ibuf_realloc(buf, len) == -1)
   return (((void *)0));
 b = buf->buf + buf->wpos;
 buf->wpos += len;
 return (b);
}

variable_types:
b
void *

return_type: void *


decompiled_code:
__int64 __fastcall ibuf_seek(__int64 a1, __int64 a2, __int64 a3)
{
__int64 result; // rax

if ( (unsigned __int64)(a2 + a3) > *(_QWORD *)(a1 + 40) )
result = 0LL;
else
result = a2 + *(_QWORD *)(a1 + 16);
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1, __int64 a2, __int64 a3)
{
__int64 result; // rax

if ( (unsigned __int64)(a2 + a3) > *(_QWORD *)(a1 + 40) )
result = 0LL;
else
result = a2 + *(_QWORD *)(a1 + 16);
return result;
}

original_code:
void *
ibuf_seek(struct ibuf *buf, size_t pos, size_t len)
{
 if (pos + len > buf->wpos)
  return (((void *)0));
 return (buf->buf + pos);
}

canonical_original_code:
void *ibuf_seek(struct ibuf *buf, unsigned long pos, unsigned long len)
{
 if (pos + len > buf->wpos)
  return (((void *)0));
 return (buf->buf + pos);
}

variable_types:
pos
unsigned long


decompiled_code:
__int64 __fastcall ibuf_size(__int64 a1)
{
return *(_QWORD *)(a1 + 40);
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1)
{
return *(_QWORD *)(a1 + 40);
}

original_code:
size_t
ibuf_size(struct ibuf *buf)
{
 return (buf->wpos);
}

canonical_original_code:
unsigned long ibuf_size(struct ibuf *buf)
{
 return (buf->wpos);
}

return_type: unsigned long


decompiled_code:
__int64 __fastcall ibuf_left(__int64 a1)
{
return *(_QWORD *)(a1 + 32) - *(_QWORD *)(a1 + 40);
}

original_code:
size_t
ibuf_left(struct ibuf *buf)
{
 return (buf->max - buf->wpos);
}

canonical_original_code:
unsigned long ibuf_left(struct ibuf *buf)
{
 return (buf->max - buf->wpos);
}


decompiled_code:
void __fastcall ibuf_free(void *ptr)
{
free(*((void **)ptr + 2));
free(ptr);
}

canonical_decompiled_code:
void __fastcall func6(void *ptr)
{
free(*((void **)ptr + 2));
free(ptr);
}

original_code:
void
ibuf_free(struct ibuf *buf)
{
 free(buf->buf);
 free(buf);
}


decompiled_code:
unsigned __int64 __fastcall msgbuf_init(_QWORD *a1)
{
unsigned __int64 result; // rax

result = 0xFFFFFFFF00000000LL;
*a1 = 0LL;
a1[2] = 0xFFFFFFFF00000000LL;
a1[1] = a1;
return result;
}

canonical_decompiled_code:
unsigned __int64 __fastcall func7(_QWORD *a1)
{
unsigned __int64 result; // rax

result = 0xFFFFFFFF00000000LL;
*a1 = 0LL;
a1[2] = 0xFFFFFFFF00000000LL;
a1[1] = a1;
return result;
}

original_code:
void
msgbuf_init(struct msgbuf *msgbuf)
{
 msgbuf->queued = 0;
 msgbuf->fd = -1;
 do { (&msgbuf->bufs)->tqh_first = ((void *)0); (&msgbuf->bufs)->tqh_last = &(&msgbuf->bufs)->tqh_first; } while (0);
}

variable_types: struct msgbuf { struct { struct ibuf { struct { struct ibuf *tqe_next; struct ibuf **tqe_prev; } entry; unsigned char *buf; unsigned long size; unsigned long max; unsigned long wpos; unsigned long rpos; int fd; } *tqh_first; struct ibuf **tqh_last; } bufs; unsigned int queued; int fd; } *

user_defined_types: struct msgbuf { struct { struct ibuf *tqh_first; struct ibuf **tqh_last; } bufs; unsigned int queued; int fd; }


original_code:
void
ibuf_dequeue(struct msgbuf *msgbuf, struct ibuf *buf)
{
 do { if (((buf)->entry.tqe_next) != ((void *)0)) (buf)->entry.tqe_next->entry.tqe_prev = (buf)->entry.tqe_prev; else (&msgbuf->bufs)->tqh_last = (buf)->entry.tqe_prev; *(buf)->entry.tqe_prev = (buf)->entry.tqe_next; ; ; } while (0);
 if (buf->fd != -1)
  close(buf->fd);
 msgbuf->queued--;
 ibuf_free(buf);
}

variable_types:
buf
struct ibuf *


original_code:
int
ibuf_write(struct msgbuf *msgbuf)
{
 struct iovec iov[1024];
 struct ibuf *buf;
 unsigned int i = 0;
 ssize_t n;
 bzero(&iov, sizeof(iov));
 for((buf) = ((&msgbuf->bufs)->tqh_first); (buf) != ((void *)0); (buf) = ((buf)->entry.tqe_next)) {
  if (i >= 1024)
   break;
  iov[i].iov_base = buf->buf + buf->rpos;
  iov[i].iov_len = buf->wpos - buf->rpos;
  i++;
 }
 if ((n = writev(msgbuf->fd, iov, i)) == -1) {
  if ((*__errno_location ()) == 11 || (*__errno_location ()) == 105 ||
      (*__errno_location ()) == 4)
   return (0);
  else
   return (-1);
 }
 if (n == 0) {
  (*__errno_location ()) = 0;
  return (-2);
 }
 msgbuf_drain(msgbuf, n);
 return (0);
}

canonical_original_code:
int ibuf_write(struct msgbuf *msgbuf)
{
 struct iovec iov[1024];
 struct ibuf *buf;
 unsigned int i = 0;
 long n;
 bzero(&iov, sizeof(iov));
 for((buf) = ((&msgbuf->bufs)->tqh_first); (buf) != ((void *)0); (buf) = ((buf)->entry.tqe_next)) {
  if (i >= 1024)
   break;
  iov[i].iov_base = buf->buf + buf->rpos;
  iov[i].iov_len = buf->wpos - buf->rpos;
  i++;
 }
 if ((n = writev(msgbuf->fd, iov, i)) == -1) {
  if ((*__errno_location ()) == 11 || (*__errno_location ()) == 105 ||
      (*__errno_location ()) == 4)
   return (0);
  else
   return (-1);
 }
 if (n == 0) {
  (*__errno_location ()) = 0;
  return (-2);
 }
 msgbuf_drain(msgbuf, n);
 return (0);
}

variable_types: struct iovec { void *iov_base; unsigned long iov_len; } [1024]

variable_types:
i
unsigned int

variable_types: n long


decompiled_code:
void __fastcall layout_active_only_refresh(__int64 a1)
{
__int64 i; // rbx
int v2; // eax
__int64 v3; // rdx

for ( i = *(_QWORD *)(a1 + 32); i; i = *(_QWORD *)(i + 376) )
{
while ( 1 )
{
v2 = *(_DWORD *)(i + 24);
if ( *(_QWORD *)(a1 + 24) == i )
break;
*(_DWORD *)(i + 24) = v2 | 1;
i = *(_QWORD *)(i + 376);
if ( !i )
return;
}
*(_QWORD *)(i + 16) = 0LL;
v3 = *(unsigned int *)(a1 + 56);
*(_DWORD *)(i + 24) = v2 & 0xFFFFFFFE;
window_pane_resize(i, *(unsigned int *)(a1 + 52), v3);
}
}

original_code:
void
layout_active_only_refresh(struct window *w, __attribute__ ((unused)) int active_only)
{
 struct window_pane *wp;
 for((wp) = ((&w->panes)->tqh_first); (wp) != ((void *)0); (wp) = ((wp)->entry.tqe_next)) {
  if (wp == w->active) {
   wp->flags &= ~0x1;
   wp->xoff = wp->yoff = 0;
   window_pane_resize(wp, w->sx, w->sy);
  } else
   wp->flags |= 0x1;
 }
}

canonical_original_code:
void layout_active_only_refresh(struct window *w, int active_only)
{
 struct window_pane *wp;
 for((wp) = ((&w->panes)->tqh_first); (wp) != ((void *)0); (wp) = ((wp)->entry.tqe_next)) {
  if (wp == w->active) {
   wp->flags &= ~0x1;
   wp->xoff = wp->yoff = 0;
   window_pane_resize(wp, w->sx, w->sy);
  } else
   wp->flags |= 0x1;
 }
}

variable_types: struct window { char *name; struct timeval { long tv_sec; long tv_usec; } name_timer; struct window_pane { struct window *window; unsigned int sx; unsigned int sy; unsigned int xoff; unsigned int yoff; int flags; char *cmd; char *cwd; int pid; int fd; char tty[32]; struct buffer { unsigned char *base; unsigned long space; unsigned long size; unsigned long off; } *in; struct buffer *out; struct input_ctx { struct window_pane *wp; struct screen_write_ctx { struct window_pane *wp; struct screen { char *title; struct grid { unsigned int sx; unsigned int sy; unsigned int hsize; unsigned int hlimit; unsigned int *size; struct grid_cell { unsigned char attr; unsigned char flags; unsigned char fg; unsigned char bg; unsigned char data; } **data; unsigned int *usize; struct grid_utf8 { unsigned char width; unsigned char data[8]; } **udata; } *grid; unsigned int cx; unsigned int cy; unsigned int old_cx; unsigned int old_cy; unsigned int rupper; unsigned int rlower; unsigned int old_rupper; unsigned int old_rlower; int mode; unsigned char *tabs; struct screen_sel { int flag; unsigned int sx; unsigned int sy; unsigned int ex; unsigned int ey; struct grid_cell cell; } sel; } *s; } ctx; unsigned char *buf; unsigned long len; unsigned long off; struct grid_cell cell; struct grid_cell saved_cell; unsigned int saved_cx; unsigned int saved_cy; unsigned char *string_buf; unsigned long string_len; int string_type; unsigned char utf8_buf[4]; unsigned int utf8_len; unsigned int utf8_off; unsigned char intermediate; void *(*state)(unsigned char, struct input_ctx *); unsigned char private; struct { struct input_arg { unsigned char data[64]; unsigned long used; } *list; unsigned int num; unsigned long space; } args; } ictx; struct screen *screen; struct screen base; struct window_mode { struct screen *(*init)(struct window_pane *); void (*free)(struct window_pane *); void (*resize)(struct window_pane *, unsigned int, unsigned int); void (*key)(struct window_pane *, struct client { int fd; struct buffer *in; struct buffer *out; char *title; char *cwd; struct tty { char *path; unsigned int sx; unsigned int sy; unsigned int cx; unsigned int cy; int mode; unsigned int rlower; unsigned int rupper; char *termname; struct tty_term { char *name; unsigned int references; struct tty_code { enum tty_code_type { TTYCODE_NONE=0, TTYCODE_STRING=1, TTYCODE_NUMBER=2, TTYCODE_FLAG=3 } type; union { char *string; int number; int flag; } value; } codes[-1]; int flags; struct { struct tty_term *sle_next; } entry; } *term; int fd; struct buffer *in; struct buffer *out; int log_fd; struct termios { unsigned int c_iflag; unsigned int c_oflag; unsigned int c_cflag; unsigned int c_lflag; unsigned char c_line; unsigned char c_cc[32]; unsigned int c_ispeed; unsigned int c_ospeed; } tio; struct grid_cell cell; unsigned char acs[-1]; int flags; int term_flags; struct timeval key_timer; unsigned long ksize; struct tty_keys { struct tty_key { int key; char *string; int flags; struct { struct tty_key *rbe_left; struct tty_key *rbe_right; struct tty_key *rbe_parent; int rbe_color; } entry; } *rbh_root; } ktree; } tty; struct timeval status_timer; struct timeval repeat_timer; struct screen status; int flags; char *message_string; struct timeval message_timer; char *prompt_string; char *prompt_buffer; unsigned long prompt_index; int (*prompt_callback)(void *, char *); void *prompt_data; int prompt_flags; unsigned int prompt_hindex; struct { char **list; unsigned int num; unsigned long space; } prompt_hdata; struct mode_key_data { int type; int flags; } prompt_mdata; struct session { char *name; struct timeval tv; unsigned int sx; unsigned int sy; struct winlink { int idx; struct window *window; struct { struct winlink *rbe_left; struct winlink *rbe_right; struct winlink *rbe_parent; int rbe_color; } entry; struct { struct winlink *sle_next; } sentry; } *curw; struct winlink_stack { struct winlink *slh_first; } lastw; struct winlinks { struct winlink *rbh_root; } windows; struct options { struct options_tree { struct options_entry { char *name; enum { OPTIONS_STRING=0, OPTIONS_NUMBER=1, OPTIONS_KEY=2 } type; union { char *string; long long number; int key; } value; struct { struct options_entry *spe_left; struct options_entry *spe_right; } entry; } *sph_root; } tree; struct options *parent; } options; struct paste_stack { struct paste_buffer { char *data; struct timeval tv; } **list; unsigned int num; unsigned long space; } buffers; struct { struct session_alert { struct winlink *wl; int type; struct { struct session_alert *sle_next; } entry; } *slh_first; } alerts; int flags; } *session; } *, int); void (*mouse)(struct window_pane *, struct client *, unsigned char, unsigned char, unsigned char); void (*timer)(struct window_pane *); } *mode; void *modedata; struct { struct window_pane *tqe_next; struct window_pane **tqe_prev; } entry; } *active; struct window_panes { struct window_pane *tqh_first; struct window_pane **tqh_last; } panes; unsigned int layout; unsigned int sx; unsigned int sy; int flags; struct options options; unsigned int references; } *

variable_types: struct window_pane { struct window { char *name; struct timeval { long tv_sec; long tv_usec; } name_timer; struct window_pane *active; struct window_panes { struct window_pane *tqh_first; struct window_pane **tqh_last; } panes; unsigned int layout; unsigned int sx; unsigned int sy; int flags; struct options { struct options_tree { struct options_entry { char *name; enum { OPTIONS_STRING=0, OPTIONS_NUMBER=1, OPTIONS_KEY=2 } type; union { char *string; long long number; int key; } value; struct { struct options_entry *spe_left; struct options_entry *spe_right; } entry; } *sph_root; } tree; struct options *parent; } options; unsigned int references; } *window; unsigned int sx; unsigned int sy; unsigned int xoff; unsigned int yoff; int flags; char *cmd; char *cwd; int pid; int fd; char tty[32]; struct buffer { unsigned char *base; unsigned long space; unsigned long size; unsigned long off; } *in; struct buffer *out; struct input_ctx { struct window_pane *wp; struct screen_write_ctx { struct window_pane *wp; struct screen { char *title; struct grid { unsigned int sx; unsigned int sy; unsigned int hsize; unsigned int hlimit; unsigned int *size; struct grid_cell { unsigned char attr; unsigned char flags; unsigned char fg; unsigned char bg; unsigned char data; } **data; unsigned int *usize; struct grid_utf8 { unsigned char width; unsigned char data[8]; } **udata; } *grid; unsigned int cx; unsigned int cy; unsigned int old_cx; unsigned int old_cy; unsigned int rupper; unsigned int rlower; unsigned int old_rupper; unsigned int old_rlower; int mode; unsigned char *tabs; struct screen_sel { int flag; unsigned int sx; unsigned int sy; unsigned int ex; unsigned int ey; struct grid_cell cell; } sel; } *s; } ctx; unsigned char *buf; unsigned long len; unsigned long off; struct grid_cell cell; struct grid_cell saved_cell; unsigned int saved_cx; unsigned int saved_cy; unsigned char *string_buf; unsigned long string_len; int string_type; unsigned char utf8_buf[4]; unsigned int utf8_len; unsigned int utf8_off; unsigned char intermediate; void *(*state)(unsigned char, struct input_ctx *); unsigned char private; struct { struct input_arg { unsigned char data[64]; unsigned long used; } *list; unsigned int num; unsigned long space; } args; } ictx; struct screen *screen; struct screen base; struct window_mode { struct screen *(*init)(struct window_pane *); void (*free)(struct window_pane *); void (*resize)(struct window_pane *, unsigned int, unsigned int); void (*key)(struct window_pane *, struct client { int fd; struct buffer *in; struct buffer *out; char *title; char *cwd; struct tty { char *path; unsigned int sx; unsigned int sy; unsigned int cx; unsigned int cy; int mode; unsigned int rlower; unsigned int rupper; char *termname; struct tty_term { char *name; unsigned int references; struct tty_code { enum tty_code_type { TTYCODE_NONE=0, TTYCODE_STRING=1, TTYCODE_NUMBER=2, TTYCODE_FLAG=3 } type; union { char *string; int number; int flag; } value; } codes[-1]; int flags; struct { struct tty_term *sle_next; } entry; } *term; int fd; struct buffer *in; struct buffer *out; int log_fd; struct termios { unsigned int c_iflag; unsigned int c_oflag; unsigned int c_cflag; unsigned int c_lflag; unsigned char c_line; unsigned char c_cc[32]; unsigned int c_ispeed; unsigned int c_ospeed; } tio; struct grid_cell cell; unsigned char acs[-1]; int flags; int term_flags; struct timeval key_timer; unsigned long ksize; struct tty_keys { struct tty_key { int key; char *string; int flags; struct { struct tty_key *rbe_left; struct tty_key *rbe_right; struct tty_key *rbe_parent; int rbe_color; } entry; } *rbh_root; } ktree; } tty; struct timeval status_timer; struct timeval repeat_timer; struct screen status; int flags; char *message_string; struct timeval message_timer; char *prompt_string; char *prompt_buffer; unsigned long prompt_index; int (*prompt_callback)(void *, char *); void *prompt_data; int prompt_flags; unsigned int prompt_hindex; struct { char **list; unsigned int num; unsigned long space; } prompt_hdata; struct mode_key_data { int type; int flags; } prompt_mdata; struct session { char *name; struct timeval tv; unsigned int sx; unsigned int sy; struct winlink { int idx; struct window *window; struct { struct winlink *rbe_left; struct winlink *rbe_right; struct winlink *rbe_parent; int rbe_color; } entry; struct { struct winlink *sle_next; } sentry; } *curw; struct winlink_stack { struct winlink *slh_first; } lastw; struct winlinks { struct winlink *rbh_root; } windows; struct options options; struct paste_stack { struct paste_buffer { char *data; struct timeval tv; } **list; unsigned int num; unsigned long space; } buffers; struct { struct session_alert { struct winlink *wl; int type; struct { struct session_alert *sle_next; } entry; } *slh_first; } alerts; int flags; } *session; } *, int); void (*mouse)(struct window_pane *, struct client *, unsigned char, unsigned char, unsigned char); void (*timer)(struct window_pane *); } *mode; void *modedata; struct { struct window_pane *tqe_next; struct window_pane **tqe_prev; } entry; } *

user_defined_types: struct window { char *name; struct timeval name_timer; struct window_pane *active; struct window_panes panes; unsigned int layout; unsigned int sx; unsigned int sy; int flags; struct options options; unsigned int references; }

user_defined_types: struct window_pane { struct window *window; unsigned int sx; unsigned int sy; unsigned int xoff; unsigned int yoff; int flags; char *cmd; char *cwd; int pid; int fd; char tty[32]; struct buffer *in; struct buffer *out; struct input_ctx ictx; struct screen *screen; struct screen base; struct window_mode *mode; void *modedata; struct { struct window_pane *tqe_next; struct window_pane **tqe_prev; } entry; }

user_defined_types: struct input_ctx { struct window_pane *wp; struct screen_write_ctx ctx; unsigned char *buf; unsigned long len; unsigned long off; struct grid_cell cell; struct grid_cell saved_cell; unsigned int saved_cx; unsigned int saved_cy; unsigned char *string_buf; unsigned long string_len; int string_type; unsigned char utf8_buf[4]; unsigned int utf8_len; unsigned int utf8_off; unsigned char intermediate; void *(*state)(unsigned char, struct input_ctx *); unsigned char private; struct { struct input_arg *list; unsigned int num; unsigned long space; } args; }

user_defined_types: struct screen_write_ctx { struct window_pane *wp; struct screen *s; }

user_defined_types: struct window_mode { struct screen *(*init)(struct window_pane *); void (*free)(struct window_pane *); void (*resize)(struct window_pane *, unsigned int, unsigned int); void (*key)(struct window_pane *, struct client *, int); void (*mouse)(struct window_pane *, struct client *, unsigned char, unsigned char, unsigned char); void (*timer)(struct window_pane *); }

user_defined_types: struct options { struct options_tree tree; struct options *parent; }

user_defined_types: struct options_tree { struct options_entry *sph_root; }

user_defined_types: struct screen { char *title; struct grid *grid; unsigned int cx; unsigned int cy; unsigned int old_cx; unsigned int old_cy; unsigned int rupper; unsigned int rlower; unsigned int old_rupper; unsigned int old_rlower; int mode; unsigned char *tabs; struct screen_sel sel; }

user_defined_types: struct grid { unsigned int sx; unsigned int sy; unsigned int hsize; unsigned int hlimit; unsigned int *size; struct grid_cell **data; unsigned int *usize; struct grid_utf8 **udata; }

user_defined_types: struct client { int fd; struct buffer *in; struct buffer *out; char *title; char *cwd; struct tty tty; struct timeval status_timer; struct timeval repeat_timer; struct screen status; int flags; char *message_string; struct timeval message_timer; char *prompt_string; char *prompt_buffer; unsigned long prompt_index; int (*prompt_callback)(void *, char *); void *prompt_data; int prompt_flags; unsigned int prompt_hindex; struct { char **list; unsigned int num; unsigned long space; } prompt_hdata; struct mode_key_data prompt_mdata; struct session *session; }

user_defined_types: struct tty { char *path; unsigned int sx; unsigned int sy; unsigned int cx; unsigned int cy; int mode; unsigned int rlower; unsigned int rupper; char *termname; struct tty_term *term; int fd; struct buffer *in; struct buffer *out; int log_fd; struct termios tio; struct grid_cell cell; unsigned char acs[-1]; int flags; int term_flags; struct timeval key_timer; unsigned long ksize; struct tty_keys ktree; }

user_defined_types: struct tty_keys { struct tty_key *rbh_root; }

user_defined_types: struct session { char *name; struct timeval tv; unsigned int sx; unsigned int sy; struct winlink *curw; struct winlink_stack lastw; struct winlinks windows; struct options options; struct paste_stack buffers; struct { struct session_alert *slh_first; } alerts; int flags; }

user_defined_types: struct tty_term { char *name; unsigned int references; struct tty_code codes[-1]; int flags; struct { struct tty_term *sle_next; } entry; }

user_defined_types: struct paste_stack { struct paste_buffer **list; unsigned int num; unsigned long space; }

user_defined_types: struct tty_code { enum tty_code_type type; union { char *string; int number; int flag; } value; }


original_code:
void
layout_even_h_refresh(struct window *w, int active_only)
{
 struct window_pane *wp;
 u_int i, n, width, xoff;
 if (active_only)
  return;
 n = window_count_panes(w);
 if (n == 0)
  return;
 if (w->sx / n < 4) {
  width = 4;
  n = w->sx / 4;
 } else
  width = w->sx / n;
 i = xoff = 0;
 for((wp) = ((&w->panes)->tqh_first); (wp) != ((void *)0); (wp) = ((wp)->entry.tqe_next)) {
  if (i > n) {
   wp->flags |= 0x1;
   continue;
  }
  wp->flags &= ~0x1;
  wp->xoff = xoff;
  wp->yoff = 0;
  if (i != n - 1)
    window_pane_resize(wp, width - 1, w->sy);
  else
    window_pane_resize(wp, width, w->sy);
  i++;
  xoff += width;
 }
 while (xoff++ < w->sx) {
  wp = (*(((struct window_panes *)((&w->panes)->tqh_last))->tqh_last));
  window_pane_resize(wp, wp->sx + 1, wp->sy);
 }
}

canonical_original_code:
void layout_even_h_refresh(struct window *w, int active_only)
{
 struct window_pane *wp;
 unsigned int i; unsigned int n; unsigned int width; unsigned int xoff;
 if (active_only)
  return;
 n = window_count_panes(w);
 if (n == 0)
  return;
 if (w->sx / n < 4) {
  width = 4;
  n = w->sx / 4;
 } else
  width = w->sx / n;
 i = xoff = 0;
 for((wp) = ((&w->panes)->tqh_first); (wp) != ((void *)0); (wp) = ((wp)->entry.tqe_next)) {
  if (i > n) {
   wp->flags |= 0x1;
   continue;
  }
  wp->flags &= ~0x1;
  wp->xoff = xoff;
  wp->yoff = 0;
  if (i != n - 1)
    window_pane_resize(wp, width - 1, w->sy);
  else
    window_pane_resize(wp, width, w->sy);
  i++;
  xoff += width;
 }
 while (xoff++ < w->sx) {
  wp = (*(((struct window_panes *)((&w->panes)->tqh_last))->tqh_last));
  window_pane_resize(wp, wp->sx + 1, wp->sy);
 }
}

variable_types:
n
unsigned int

variable_types:
width
unsigned int

variable_types:
xoff
unsigned int

user_defined_types: struct window_panes { struct window_pane *tqh_first; struct window_pane **tqh_last; }

user_defined_types: struct timeval { long tv_sec; long tv_usec; }

user_defined_types: struct buffer { unsigned char *base; unsigned long space; unsigned long size; unsigned long off; }

user_defined_types: struct input_arg { unsigned char data[64]; unsigned long used; }

user_defined_types: struct screen_sel { int flag; unsigned int sx; unsigned int sy; unsigned int ex; unsigned int ey; struct grid_cell cell; }

user_defined_types: struct options_entry { char *name; enum { OPTIONS_STRING=0, OPTIONS_NUMBER=1, OPTIONS_KEY=2 } type; union { char *string; long long number; int key; } value; struct { struct options_entry *spe_left; struct options_entry *spe_right; } entry; }

user_defined_types: struct mode_key_data { int type; int flags; }

user_defined_types: struct termios { unsigned int c_iflag; unsigned int c_oflag; unsigned int c_cflag; unsigned int c_lflag; unsigned char c_line; unsigned char c_cc[32]; unsigned int c_ispeed; unsigned int c_ospeed; }

user_defined_types: struct grid_cell { unsigned char attr; unsigned char flags; unsigned char fg; unsigned char bg; unsigned char data; }

user_defined_types: struct grid_utf8 { unsigned char width; unsigned char data[8]; }

user_defined_types: struct winlink_stack { struct winlink *slh_first; }

user_defined_types: struct winlinks { struct winlink *rbh_root; }

user_defined_types: struct tty_key { int key; char *string; int flags; struct { struct tty_key *rbe_left; struct tty_key *rbe_right; struct tty_key *rbe_parent; int rbe_color; } entry; }

user_defined_types: struct winlink { int idx; struct window *window; struct { struct winlink *rbe_left; struct winlink *rbe_right; struct winlink *rbe_parent; int rbe_color; } entry; struct { struct winlink *sle_next; } sentry; }

user_defined_types: struct session_alert { struct winlink *wl; int type; struct { struct session_alert *sle_next; } entry; }

user_defined_types: enum tty_code_type { TTYCODE_NONE=0, TTYCODE_STRING=1, TTYCODE_NUMBER=2, TTYCODE_FLAG=3 }

user_defined_types: struct paste_buffer { char *data; struct timeval tv; }


original_code:
void
layout_even_v_refresh(struct window *w, int active_only)
{
 struct window_pane *wp;
 u_int i, n, height, yoff;
 if (active_only)
  return;
 n = window_count_panes(w);
 if (n == 0)
  return;
 if (w->sy / n < 4) {
  height = 4;
  n = w->sy / 4;
 } else
  height = w->sy / n;
 i = yoff = 0;
 for((wp) = ((&w->panes)->tqh_first); (wp) != ((void *)0); (wp) = ((wp)->entry.tqe_next)) {
  if (i > n) {
   wp->flags |= 0x1;
   continue;
  }
  wp->flags &= ~0x1;
  wp->xoff = 0;
  wp->yoff = yoff;
  if (i != n - 1)
    window_pane_resize(wp, w->sx, height - 1);
  else
    window_pane_resize(wp, w->sx, height);
  i++;
  yoff += height;
 }
 while (yoff++ < w->sy) {
  wp = (*(((struct window_panes *)((&w->panes)->tqh_last))->tqh_last));
  window_pane_resize(wp, wp->sx, wp->sy + 1);
 }
}

canonical_original_code:
void layout_even_v_refresh(struct window *w, int active_only)
{
 struct window_pane *wp;
 unsigned int i; unsigned int n; unsigned int height; unsigned int yoff;
 if (active_only)
  return;
 n = window_count_panes(w);
 if (n == 0)
  return;
 if (w->sy / n < 4) {
  height = 4;
  n = w->sy / 4;
 } else
  height = w->sy / n;
 i = yoff = 0;
 for((wp) = ((&w->panes)->tqh_first); (wp) != ((void *)0); (wp) = ((wp)->entry.tqe_next)) {
  if (i > n) {
   wp->flags |= 0x1;
   continue;
  }
  wp->flags &= ~0x1;
  wp->xoff = 0;
  wp->yoff = yoff;
  if (i != n - 1)
    window_pane_resize(wp, w->sx, height - 1);
  else
    window_pane_resize(wp, w->sx, height);
  i++;
  yoff += height;
 }
 while (yoff++ < w->sy) {
  wp = (*(((struct window_panes *)((&w->panes)->tqh_last))->tqh_last));
  window_pane_resize(wp, wp->sx, wp->sy + 1);
 }
}

variable_types:
height
unsigned int

variable_types:
yoff
unsigned int

user_defined_types: struct window { char *name; struct timeval name_timer; struct window_pane *active; struct window_panes panes; unsigned int layout; unsigned int sx; unsigned int sy; int flags; struct options options; unsigned int references; }

user_defined_types: struct window_pane { struct window *window; unsigned int sx; unsigned int sy; unsigned int xoff; unsigned int yoff; int flags; char *cmd; char *cwd; int pid; int fd; char tty[32]; struct buffer *in; struct buffer *out; struct input_ctx ictx; struct screen *screen; struct screen base; struct window_mode *mode; void *modedata; struct { struct window_pane *tqe_next; struct window_pane **tqe_prev; } entry; }

user_defined_types: struct window_panes { struct window_pane *tqh_first; struct window_pane **tqh_last; }

user_defined_types: struct input_ctx { struct window_pane *wp; struct screen_write_ctx ctx; unsigned char *buf; unsigned long len; unsigned long off; struct grid_cell cell; struct grid_cell saved_cell; unsigned int saved_cx; unsigned int saved_cy; unsigned char *string_buf; unsigned long string_len; int string_type; unsigned char utf8_buf[4]; unsigned int utf8_len; unsigned int utf8_off; unsigned char intermediate; void *(*state)(unsigned char, struct input_ctx *); unsigned char private; struct { struct input_arg *list; unsigned int num; unsigned long space; } args; }

user_defined_types: struct screen_write_ctx { struct window_pane *wp; struct screen *s; }

user_defined_types: struct window_mode { struct screen *(*init)(struct window_pane *); void (*free)(struct window_pane *); void (*resize)(struct window_pane *, unsigned int, unsigned int); void (*key)(struct window_pane *, struct client *, int); void (*mouse)(struct window_pane *, struct client *, unsigned char, unsigned char, unsigned char); void (*timer)(struct window_pane *); }

user_defined_types: struct options { struct options_tree tree; struct options *parent; }

user_defined_types: struct options_tree { struct options_entry *sph_root; }

user_defined_types: struct screen { char *title; struct grid *grid; unsigned int cx; unsigned int cy; unsigned int old_cx; unsigned int old_cy; unsigned int rupper; unsigned int rlower; unsigned int old_rupper; unsigned int old_rlower; int mode; unsigned char *tabs; struct screen_sel sel; }

user_defined_types: struct grid { unsigned int sx; unsigned int sy; unsigned int hsize; unsigned int hlimit; unsigned int *size; struct grid_cell **data; unsigned int *usize; struct grid_utf8 **udata; }

user_defined_types: struct client { int fd; struct buffer *in; struct buffer *out; char *title; char *cwd; struct tty tty; struct timeval status_timer; struct timeval repeat_timer; struct screen status; int flags; char *message_string; struct timeval message_timer; char *prompt_string; char *prompt_buffer; unsigned long prompt_index; int (*prompt_callback)(void *, char *); void *prompt_data; int prompt_flags; unsigned int prompt_hindex; struct { char **list; unsigned int num; unsigned long space; } prompt_hdata; struct mode_key_data prompt_mdata; struct session *session; }

user_defined_types: struct tty { char *path; unsigned int sx; unsigned int sy; unsigned int cx; unsigned int cy; int mode; unsigned int rlower; unsigned int rupper; char *termname; struct tty_term *term; int fd; struct buffer *in; struct buffer *out; int log_fd; struct termios tio; struct grid_cell cell; unsigned char acs[-1]; int flags; int term_flags; struct timeval key_timer; unsigned long ksize; struct tty_keys ktree; }

user_defined_types: struct tty_keys { struct tty_key *rbh_root; }

user_defined_types: struct session { char *name; struct timeval tv; unsigned int sx; unsigned int sy; struct winlink *curw; struct winlink_stack lastw; struct winlinks windows; struct options options; struct paste_stack buffers; struct { struct session_alert *slh_first; } alerts; int flags; }

user_defined_types: struct tty_term { char *name; unsigned int references; struct tty_code codes[-1]; int flags; struct { struct tty_term *sle_next; } entry; }

user_defined_types: struct paste_stack { struct paste_buffer **list; unsigned int num; unsigned long space; }

user_defined_types: struct tty_code { enum tty_code_type type; union { char *string; int number; int flag; } value; }


original_code:
void
layout_main_v_refresh(struct window *w, int active_only)
{
 struct window_pane *wp;
 u_int i, n, mainwidth, height, yoff;
 if (active_only)
  return;
 n = window_count_panes(w);
 if (n == 0)
  return;
 mainwidth = options_get_number(&w->options, "main-pane-width") + 1;
 if (n == 1 || w->sx < mainwidth + 4) {
  layout_active_only_refresh(w, active_only);
  return;
 }
 n--;
 if (w->sy / n < 4) {
  height = 4;
  n = w->sy / 4;
 } else
  height = w->sy / n;
 i = yoff = 0;
 for((wp) = ((&w->panes)->tqh_first); (wp) != ((void *)0); (wp) = ((wp)->entry.tqe_next)) {
  if (wp == ((&w->panes)->tqh_first)) {
   wp->xoff = 0;
   wp->yoff = 0;
   window_pane_resize(wp, mainwidth - 1, w->sy);
   wp->flags &= ~0x1;
   continue;
  }
  if (i > n) {
   wp->flags |= 0x1;
   continue;
  }
  wp->flags &= ~0x1;
  wp->xoff = mainwidth;
  wp->yoff = yoff;
  if (i != n - 1)
    window_pane_resize(wp, w->sx - mainwidth, height - 1);
  else
    window_pane_resize(wp, w->sx - mainwidth, height);
  i++;
  yoff += height;
 }
 while (yoff++ < w->sy) {
  wp = (*(((struct window_panes *)((&w->panes)->tqh_last))->tqh_last));
  while (wp != ((void *)0) && wp == ((&w->panes)->tqh_first))
   wp = (*(((struct window_panes *)((wp)->entry.tqe_prev))->tqh_last));
  if (wp == ((void *)0))
   break;
  window_pane_resize(wp, wp->sx, wp->sy + 1);
 }
}

canonical_original_code:
void layout_main_v_refresh(struct window *w, int active_only)
{
 struct window_pane *wp;
 unsigned int i; unsigned int n; unsigned int mainwidth; unsigned int height; unsigned int yoff;
 if (active_only)
  return;
 n = window_count_panes(w);
 if (n == 0)
  return;
 mainwidth = options_get_number(&w->options, "main-pane-width") + 1;
 if (n == 1 || w->sx < mainwidth + 4) {
  layout_active_only_refresh(w, active_only);
  return;
 }
 n--;
 if (w->sy / n < 4) {
  height = 4;
  n = w->sy / 4;
 } else
  height = w->sy / n;
 i = yoff = 0;
 for((wp) = ((&w->panes)->tqh_first); (wp) != ((void *)0); (wp) = ((wp)->entry.tqe_next)) {
  if (wp == ((&w->panes)->tqh_first)) {
   wp->xoff = 0;
   wp->yoff = 0;
   window_pane_resize(wp, mainwidth - 1, w->sy);
   wp->flags &= ~0x1;
   continue;
  }
  if (i > n) {
   wp->flags |= 0x1;
   continue;
  }
  wp->flags &= ~0x1;
  wp->xoff = mainwidth;
  wp->yoff = yoff;
  if (i != n - 1)
    window_pane_resize(wp, w->sx - mainwidth, height - 1);
  else
    window_pane_resize(wp, w->sx - mainwidth, height);
  i++;
  yoff += height;
 }
 while (yoff++ < w->sy) {
  wp = (*(((struct window_panes *)((&w->panes)->tqh_last))->tqh_last));
  while (wp != ((void *)0) && wp == ((&w->panes)->tqh_first))
   wp = (*(((struct window_panes *)((wp)->entry.tqe_prev))->tqh_last));
  if (wp == ((void *)0))
   break;
  window_pane_resize(wp, wp->sx, wp->sy + 1);
 }
}

variable_types:
mainwidth
unsigned int

user_defined_types: struct window { char *name; struct timeval name_timer; struct window_pane *active; struct window_panes panes; unsigned int layout; unsigned int sx; unsigned int sy; int flags; struct options options; unsigned int references; }

user_defined_types: struct timeval { long tv_sec; long tv_usec; }

user_defined_types: struct buffer { unsigned char *base; unsigned long space; unsigned long size; unsigned long off; }

user_defined_types: struct input_arg { unsigned char data[64]; unsigned long used; }

user_defined_types: struct screen_sel { int flag; unsigned int sx; unsigned int sy; unsigned int ex; unsigned int ey; struct grid_cell cell; }

user_defined_types: struct options_entry { char *name; enum { OPTIONS_STRING=0, OPTIONS_NUMBER=1, OPTIONS_KEY=2 } type; union { char *string; long long number; int key; } value; struct { struct options_entry *spe_left; struct options_entry *spe_right; } entry; }

user_defined_types: struct mode_key_data { int type; int flags; }

user_defined_types: struct termios { unsigned int c_iflag; unsigned int c_oflag; unsigned int c_cflag; unsigned int c_lflag; unsigned char c_line; unsigned char c_cc[32]; unsigned int c_ispeed; unsigned int c_ospeed; }

user_defined_types: struct grid_cell { unsigned char attr; unsigned char flags; unsigned char fg; unsigned char bg; unsigned char data; }

user_defined_types: struct grid_utf8 { unsigned char width; unsigned char data[8]; }

user_defined_types: struct winlink_stack { struct winlink *slh_first; }

user_defined_types: struct winlinks { struct winlink *rbh_root; }

user_defined_types: struct tty_key { int key; char *string; int flags; struct { struct tty_key *rbe_left; struct tty_key *rbe_right; struct tty_key *rbe_parent; int rbe_color; } entry; }

user_defined_types: struct winlink { int idx; struct window *window; struct { struct winlink *rbe_left; struct winlink *rbe_right; struct winlink *rbe_parent; int rbe_color; } entry; struct { struct winlink *sle_next; } sentry; }

user_defined_types: struct session_alert { struct winlink *wl; int type; struct { struct session_alert *sle_next; } entry; }

user_defined_types: enum tty_code_type { TTYCODE_NONE=0, TTYCODE_STRING=1, TTYCODE_NUMBER=2, TTYCODE_FLAG=3 }

user_defined_types: struct paste_buffer { char *data; struct timeval tv; }


original_code:
void
layout_main_h_refresh(struct window *w, int active_only)
{
 struct window_pane *wp;
 u_int i, n, mainheight, width, xoff;
 if (active_only)
  return;
 n = window_count_panes(w);
 if (n == 0)
  return;
 mainheight = options_get_number(&w->options, "main-pane-height") + 1;
 if (n == 1 || w->sy < mainheight + 4) {
  layout_active_only_refresh(w, active_only);
  return;
 }
 n--;
 if (w->sx / n < 4) {
  width = 4;
  n = w->sx / 4;
 } else
  width = w->sx / n;
 i = xoff = 0;
 for((wp) = ((&w->panes)->tqh_first); (wp) != ((void *)0); (wp) = ((wp)->entry.tqe_next)) {
  if (wp == ((&w->panes)->tqh_first)) {
   wp->xoff = 0;
   wp->yoff = 0;
   window_pane_resize(wp, w->sx, mainheight - 1);
   wp->flags &= ~0x1;
   continue;
  }
  if (i > n) {
   wp->flags |= 0x1;
   continue;
  }
  wp->flags &= ~0x1;
  wp->xoff = xoff;
  wp->yoff = mainheight;
  if (i != n - 1)
    window_pane_resize(wp, width - 1, w->sy - mainheight);
  else
    window_pane_resize(wp, width - 1, w->sy - mainheight);
  i++;
  xoff += width;
 }
 while (xoff++ < w->sx + 1) {
  wp = (*(((struct window_panes *)((&w->panes)->tqh_last))->tqh_last));
  while (wp != ((void *)0) && wp == ((&w->panes)->tqh_first))
   wp = (*(((struct window_panes *)((wp)->entry.tqe_prev))->tqh_last));
  if (wp == ((void *)0))
   break;
  window_pane_resize(wp, wp->sx + 1, wp->sy);
 }
}

canonical_original_code:
void layout_main_h_refresh(struct window *w, int active_only)
{
 struct window_pane *wp;
 unsigned int i; unsigned int n; unsigned int mainheight; unsigned int width; unsigned int xoff;
 if (active_only)
  return;
 n = window_count_panes(w);
 if (n == 0)
  return;
 mainheight = options_get_number(&w->options, "main-pane-height") + 1;
 if (n == 1 || w->sy < mainheight + 4) {
  layout_active_only_refresh(w, active_only);
  return;
 }
 n--;
 if (w->sx / n < 4) {
  width = 4;
  n = w->sx / 4;
 } else
  width = w->sx / n;
 i = xoff = 0;
 for((wp) = ((&w->panes)->tqh_first); (wp) != ((void *)0); (wp) = ((wp)->entry.tqe_next)) {
  if (wp == ((&w->panes)->tqh_first)) {
   wp->xoff = 0;
   wp->yoff = 0;
   window_pane_resize(wp, w->sx, mainheight - 1);
   wp->flags &= ~0x1;
   continue;
  }
  if (i > n) {
   wp->flags |= 0x1;
   continue;
  }
  wp->flags &= ~0x1;
  wp->xoff = xoff;
  wp->yoff = mainheight;
  if (i != n - 1)
    window_pane_resize(wp, width - 1, w->sy - mainheight);
  else
    window_pane_resize(wp, width - 1, w->sy - mainheight);
  i++;
  xoff += width;
 }
 while (xoff++ < w->sx + 1) {
  wp = (*(((struct window_panes *)((&w->panes)->tqh_last))->tqh_last));
  while (wp != ((void *)0) && wp == ((&w->panes)->tqh_first))
   wp = (*(((struct window_panes *)((wp)->entry.tqe_prev))->tqh_last));
  if (wp == ((void *)0))
   break;
  window_pane_resize(wp, wp->sx + 1, wp->sy);
 }
}

variable_types:
mainheight
unsigned int

user_defined_types: struct window { char *name; struct timeval name_timer; struct window_pane *active; struct window_panes panes; unsigned int layout; unsigned int sx; unsigned int sy; int flags; struct options options; unsigned int references; }

user_defined_types: struct window_pane { struct window *window; unsigned int sx; unsigned int sy; unsigned int xoff; unsigned int yoff; int flags; char *cmd; char *cwd; int pid; int fd; char tty[32]; struct buffer *in; struct buffer *out; struct input_ctx ictx; struct screen *screen; struct screen base; struct window_mode *mode; void *modedata; struct { struct window_pane *tqe_next; struct window_pane **tqe_prev; } entry; }

user_defined_types: struct window_panes { struct window_pane *tqh_first; struct window_pane **tqh_last; }

user_defined_types: struct input_ctx { struct window_pane *wp; struct screen_write_ctx ctx; unsigned char *buf; unsigned long len; unsigned long off; struct grid_cell cell; struct grid_cell saved_cell; unsigned int saved_cx; unsigned int saved_cy; unsigned char *string_buf; unsigned long string_len; int string_type; unsigned char utf8_buf[4]; unsigned int utf8_len; unsigned int utf8_off; unsigned char intermediate; void *(*state)(unsigned char, struct input_ctx *); unsigned char private; struct { struct input_arg *list; unsigned int num; unsigned long space; } args; }

user_defined_types: struct screen_write_ctx { struct window_pane *wp; struct screen *s; }

user_defined_types: struct window_mode { struct screen *(*init)(struct window_pane *); void (*free)(struct window_pane *); void (*resize)(struct window_pane *, unsigned int, unsigned int); void (*key)(struct window_pane *, struct client *, int); void (*mouse)(struct window_pane *, struct client *, unsigned char, unsigned char, unsigned char); void (*timer)(struct window_pane *); }

user_defined_types: struct options { struct options_tree tree; struct options *parent; }

user_defined_types: struct options_tree { struct options_entry *sph_root; }

user_defined_types: struct screen { char *title; struct grid *grid; unsigned int cx; unsigned int cy; unsigned int old_cx; unsigned int old_cy; unsigned int rupper; unsigned int rlower; unsigned int old_rupper; unsigned int old_rlower; int mode; unsigned char *tabs; struct screen_sel sel; }

user_defined_types: struct grid { unsigned int sx; unsigned int sy; unsigned int hsize; unsigned int hlimit; unsigned int *size; struct grid_cell **data; unsigned int *usize; struct grid_utf8 **udata; }

user_defined_types: struct client { int fd; struct buffer *in; struct buffer *out; char *title; char *cwd; struct tty tty; struct timeval status_timer; struct timeval repeat_timer; struct screen status; int flags; char *message_string; struct timeval message_timer; char *prompt_string; char *prompt_buffer; unsigned long prompt_index; int (*prompt_callback)(void *, char *); void *prompt_data; int prompt_flags; unsigned int prompt_hindex; struct { char **list; unsigned int num; unsigned long space; } prompt_hdata; struct mode_key_data prompt_mdata; struct session *session; }

user_defined_types: struct tty { char *path; unsigned int sx; unsigned int sy; unsigned int cx; unsigned int cy; int mode; unsigned int rlower; unsigned int rupper; char *termname; struct tty_term *term; int fd; struct buffer *in; struct buffer *out; int log_fd; struct termios tio; struct grid_cell cell; unsigned char acs[-1]; int flags; int term_flags; struct timeval key_timer; unsigned long ksize; struct tty_keys ktree; }

user_defined_types: struct tty_keys { struct tty_key *rbh_root; }

user_defined_types: struct session { char *name; struct timeval tv; unsigned int sx; unsigned int sy; struct winlink *curw; struct winlink_stack lastw; struct winlinks windows; struct options options; struct paste_stack buffers; struct { struct session_alert *slh_first; } alerts; int flags; }

user_defined_types: struct tty_term { char *name; unsigned int references; struct tty_code codes[-1]; int flags; struct { struct tty_term *sle_next; } entry; }

user_defined_types: struct paste_stack { struct paste_buffer **list; unsigned int num; unsigned long space; }

user_defined_types: struct tty_code { enum tty_code_type type; union { char *string; int number; int flag; } value; }


decompiled_code:
char *__fastcall layout_name(__int64 a1)
{
return (&layouts)[3 * *(unsigned int *)(a1 + 48)];
}

canonical_decompiled_code:
char *__fastcall func5(__int64 a1)
{
return (&layouts)[3 * *(unsigned int *)(a1 + 48)];
}

original_code:
const char *
layout_name(struct window *w)
{
 return (layouts[w->layout].name);
}

canonical_original_code:
char *layout_name(struct window *w)
{
 return (layouts[w->layout].name);
}

user_defined_types: struct window { char *name; struct timeval name_timer; struct window_pane *active; struct window_panes panes; unsigned int layout; unsigned int sx; unsigned int sy; int flags; struct options options; unsigned int references; }

user_defined_types: struct timeval { long tv_sec; long tv_usec; }

user_defined_types: struct buffer { unsigned char *base; unsigned long space; unsigned long size; unsigned long off; }

user_defined_types: struct input_arg { unsigned char data[64]; unsigned long used; }

user_defined_types: struct screen_sel { int flag; unsigned int sx; unsigned int sy; unsigned int ex; unsigned int ey; struct grid_cell cell; }

user_defined_types: struct mode_key_data { int type; int flags; }

user_defined_types: struct termios { unsigned int c_iflag; unsigned int c_oflag; unsigned int c_cflag; unsigned int c_lflag; unsigned char c_line; unsigned char c_cc[32]; unsigned int c_ispeed; unsigned int c_ospeed; }

user_defined_types: struct grid_cell { unsigned char attr; unsigned char flags; unsigned char fg; unsigned char bg; unsigned char data; }

user_defined_types: struct grid_utf8 { unsigned char width; unsigned char data[8]; }

user_defined_types: struct winlink_stack { struct winlink *slh_first; }

user_defined_types: struct winlinks { struct winlink *rbh_root; }

user_defined_types: struct tty_key { int key; char *string; int flags; struct { struct tty_key *rbe_left; struct tty_key *rbe_right; struct tty_key *rbe_parent; int rbe_color; } entry; }

user_defined_types: struct winlink { int idx; struct window *window; struct { struct winlink *rbe_left; struct winlink *rbe_right; struct winlink *rbe_parent; int rbe_color; } entry; struct { struct winlink *sle_next; } sentry; }

user_defined_types: struct session_alert { struct winlink *wl; int type; struct { struct session_alert *sle_next; } entry; }

user_defined_types: enum tty_code_type { TTYCODE_NONE=0, TTYCODE_STRING=1, TTYCODE_NUMBER=2, TTYCODE_FLAG=3 }

user_defined_types: struct options_entry { char *name; enum { OPTIONS_STRING=0, OPTIONS_NUMBER=1, OPTIONS_KEY=2 } type; union { char *string; long long number; int key; } value; struct { struct options_entry *spe_left; struct options_entry *spe_right; } entry; }

user_defined_types: struct paste_buffer { char *data; struct timeval tv; }


decompiled_code:
__int64 __fastcall layout_lookup(char *s2)
{
unsigned int v1; // er14
const char **v3; // rbp
unsigned int v4; // ebx
size_t v5; // rax
const char *v6; // rdi
size_t v7; // r13

v1 = -1;
v3 = (const char **)(unsigned int)((_DWORD)&layouts + 24);
v4 = 0;
v5 = strlen(s2);
v6 = "manual-vertical";
v7 = v5;
while ( 1 )
{
if ( strncmp(v6, s2, v7) )
goto LABEL_6;
if ( v1 != -1 )
return 0xFFFFFFFFLL;
v1 = v4;
LABEL_6:
if ( ++v4 == 6 )
return v1;
v6 = *v3;
v3 += 3;
}
}

canonical_decompiled_code:
__int64 __fastcall func6(char *s2)
{
unsigned int v1; // er14
const char **v3; // rbp
unsigned int v4; // ebx
size_t v5; // rax
const char *v6; // rdi
size_t v7; // r13

v1 = -1;
v3 = (const char **)(unsigned int)((_DWORD)&layouts + 24);
v4 = 0;
v5 = strlen(s2);
v6 = "manual-vertical";
v7 = v5;
while ( 1 )
{
if ( strncmp(v6, s2, v7) )
goto LABEL_6;
if ( v1 != -1 )
return 0xFFFFFFFFLL;
v1 = v4;
LABEL_6:
if ( ++v4 == 6 )
return v1;
v6 = *v3;
v3 += 3;
}
}

original_code:
int
layout_lookup(const char *name)
{
 u_int i;
 int matched = -1;
 for (i = 0; i < (sizeof((layouts)) / sizeof((layouts)[0])); i++) {
  if (strncmp(layouts[i].name, name, strlen(name)) == 0) {
   if (matched != -1)
    return (-1);
   matched = i;
  }
 }
 return (matched);
}

canonical_original_code:
int layout_lookup(char *name)
{
 unsigned int i;
 int matched = -1;
 for (i = 0; i < (sizeof((layouts)) / sizeof((layouts)[0])); i++) {
  if (strncmp(layouts[i].name, name, strlen(name)) == 0) {
   if (matched != -1)
    return (-1);
   matched = i;
  }
 }
 return (matched);
}

variable_types:
name
char *

variable_types: matched int


decompiled_code:
__int64 __fastcall layout_select(__int64 a1, unsigned int a2)
{
if ( a2 > 5 || *(_DWORD *)(a1 + 48) == a2 )
return 0xFFFFFFFFLL;
*(_DWORD *)(a1 + 48) = a2;
layout_refresh(a1);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func8(__int64 a1, unsigned int a2)
{
if ( a2 > 5 || *(_DWORD *)(a1 + 48) == a2 )
return 0xFFFFFFFFLL;
*(_DWORD *)(a1 + 48) = a2;
func7(a1);
return 0LL;
}

original_code:
int
layout_select(struct window *w, u_int layout)
{
 if (layout > (sizeof((layouts)) / sizeof((layouts)[0])) - 1 || layout == w->layout)
  return (-1);
 w->layout = layout;
 layout_refresh(w, 0);
 return (0);
}

canonical_original_code:
int layout_select(struct window *w, unsigned int layout)
{
 if (layout > (sizeof((layouts)) / sizeof((layouts)[0])) - 1 || layout == w->layout)
  return (-1);
 w->layout = layout;
 layout_refresh(w, 0);
 return (0);
}

variable_types:
layout
unsigned int

user_defined_types: struct window { char *name; struct timeval name_timer; struct window_pane *active; struct window_panes panes; unsigned int layout; unsigned int sx; unsigned int sy; int flags; struct options options; unsigned int references; }

user_defined_types: struct window_panes { struct window_pane *tqh_first; struct window_pane **tqh_last; }

user_defined_types: struct window_pane { struct window *window; unsigned int sx; unsigned int sy; unsigned int xoff; unsigned int yoff; int flags; char *cmd; char *cwd; int pid; int fd; char tty[32]; struct buffer *in; struct buffer *out; struct input_ctx ictx; struct screen *screen; struct screen base; struct window_mode *mode; void *modedata; struct { struct window_pane *tqe_next; struct window_pane **tqe_prev; } entry; }

user_defined_types: struct input_ctx { struct window_pane *wp; struct screen_write_ctx ctx; unsigned char *buf; unsigned long len; unsigned long off; struct grid_cell cell; struct grid_cell saved_cell; unsigned int saved_cx; unsigned int saved_cy; unsigned char *string_buf; unsigned long string_len; int string_type; unsigned char utf8_buf[4]; unsigned int utf8_len; unsigned int utf8_off; unsigned char intermediate; void *(*state)(unsigned char, struct input_ctx *); unsigned char private; struct { struct input_arg *list; unsigned int num; unsigned long space; } args; }

user_defined_types: struct screen_write_ctx { struct window_pane *wp; struct screen *s; }

user_defined_types: struct window_mode { struct screen *(*init)(struct window_pane *); void (*free)(struct window_pane *); void (*resize)(struct window_pane *, unsigned int, unsigned int); void (*key)(struct window_pane *, struct client *, int); void (*mouse)(struct window_pane *, struct client *, unsigned char, unsigned char, unsigned char); void (*timer)(struct window_pane *); }

user_defined_types: struct screen { char *title; struct grid *grid; unsigned int cx; unsigned int cy; unsigned int old_cx; unsigned int old_cy; unsigned int rupper; unsigned int rlower; unsigned int old_rupper; unsigned int old_rlower; int mode; unsigned char *tabs; struct screen_sel sel; }

user_defined_types: struct grid { unsigned int sx; unsigned int sy; unsigned int hsize; unsigned int hlimit; unsigned int *size; struct grid_cell **data; unsigned int *usize; struct grid_utf8 **udata; }

user_defined_types: struct client { int fd; struct buffer *in; struct buffer *out; char *title; char *cwd; struct tty tty; struct timeval status_timer; struct timeval repeat_timer; struct screen status; int flags; char *message_string; struct timeval message_timer; char *prompt_string; char *prompt_buffer; unsigned long prompt_index; int (*prompt_callback)(void *, char *); void *prompt_data; int prompt_flags; unsigned int prompt_hindex; struct { char **list; unsigned int num; unsigned long space; } prompt_hdata; struct mode_key_data prompt_mdata; struct session *session; }

user_defined_types: struct tty { char *path; unsigned int sx; unsigned int sy; unsigned int cx; unsigned int cy; int mode; unsigned int rlower; unsigned int rupper; char *termname; struct tty_term *term; int fd; struct buffer *in; struct buffer *out; int log_fd; struct termios tio; struct grid_cell cell; unsigned char acs[-1]; int flags; int term_flags; struct timeval key_timer; unsigned long ksize; struct tty_keys ktree; }

user_defined_types: struct tty_keys { struct tty_key *rbh_root; }

user_defined_types: struct session { char *name; struct timeval tv; unsigned int sx; unsigned int sy; struct winlink *curw; struct winlink_stack lastw; struct winlinks windows; struct options options; struct paste_stack buffers; struct { struct session_alert *slh_first; } alerts; int flags; }

user_defined_types: struct tty_term { char *name; unsigned int references; struct tty_code codes[-1]; int flags; struct { struct tty_term *sle_next; } entry; }

user_defined_types: struct options { struct options_tree tree; struct options *parent; }

user_defined_types: struct paste_stack { struct paste_buffer **list; unsigned int num; unsigned long space; }

user_defined_types: struct options_tree { struct options_entry *sph_root; }

user_defined_types: struct tty_code { enum tty_code_type type; union { char *string; int number; int flag; } value; }


decompiled_code:
__int64 __fastcall layout_previous(__int64 a1)
{
int v1; // edx
int v2; // eax

v1 = *(_DWORD *)(a1 + 48);
v2 = v1 - 1;
if ( !v1 )
v2 = 5;
*(_DWORD *)(a1 + 48) = v2;
return layout_refresh(a1);
}

original_code:
void
layout_previous(struct window *w)
{
 if (w->layout == 0)
  w->layout = (sizeof((layouts)) / sizeof((layouts)[0])) - 1;
 else
  w->layout--;
 layout_refresh(w, 0);
}

user_defined_types: struct window { char *name; struct timeval name_timer; struct window_pane *active; struct window_panes panes; unsigned int layout; unsigned int sx; unsigned int sy; int flags; struct options options; unsigned int references; }

user_defined_types: struct timeval { long tv_sec; long tv_usec; }

user_defined_types: struct buffer { unsigned char *base; unsigned long space; unsigned long size; unsigned long off; }

user_defined_types: struct input_arg { unsigned char data[64]; unsigned long used; }

user_defined_types: struct screen_sel { int flag; unsigned int sx; unsigned int sy; unsigned int ex; unsigned int ey; struct grid_cell cell; }

user_defined_types: struct mode_key_data { int type; int flags; }

user_defined_types: struct termios { unsigned int c_iflag; unsigned int c_oflag; unsigned int c_cflag; unsigned int c_lflag; unsigned char c_line; unsigned char c_cc[32]; unsigned int c_ispeed; unsigned int c_ospeed; }

user_defined_types: struct grid_cell { unsigned char attr; unsigned char flags; unsigned char fg; unsigned char bg; unsigned char data; }

user_defined_types: struct grid_utf8 { unsigned char width; unsigned char data[8]; }

user_defined_types: struct winlink_stack { struct winlink *slh_first; }

user_defined_types: struct winlinks { struct winlink *rbh_root; }

user_defined_types: struct tty_key { int key; char *string; int flags; struct { struct tty_key *rbe_left; struct tty_key *rbe_right; struct tty_key *rbe_parent; int rbe_color; } entry; }

user_defined_types: struct winlink { int idx; struct window *window; struct { struct winlink *rbe_left; struct winlink *rbe_right; struct winlink *rbe_parent; int rbe_color; } entry; struct { struct winlink *sle_next; } sentry; }

user_defined_types: struct session_alert { struct winlink *wl; int type; struct { struct session_alert *sle_next; } entry; }

user_defined_types: enum tty_code_type { TTYCODE_NONE=0, TTYCODE_STRING=1, TTYCODE_NUMBER=2, TTYCODE_FLAG=3 }

user_defined_types: struct options_entry { char *name; enum { OPTIONS_STRING=0, OPTIONS_NUMBER=1, OPTIONS_KEY=2 } type; union { char *string; long long number; int key; } value; struct { struct options_entry *spe_left; struct options_entry *spe_right; } entry; }

user_defined_types: struct paste_buffer { char *data; struct timeval tv; }


decompiled_code:
__int64 __fastcall layout_refresh(__int64 a1)
{
(*(&layouts + 3 * *(unsigned int *)(a1 + 48) + 1))();
return server_redraw_window(a1);
}

canonical_decompiled_code:
__int64 __fastcall func7(__int64 a1)
{
(*(&layouts + 3 * *(unsigned int *)(a1 + 48) + 1))();
return server_redraw_window(a1);
}

original_code:
void
layout_refresh(struct window *w, int active_only)
{
 layouts[w->layout].refresh(w, active_only);
 server_redraw_window(w);
}

user_defined_types: struct window { char *name; struct timeval name_timer; struct window_pane *active; struct window_panes panes; unsigned int layout; unsigned int sx; unsigned int sy; int flags; struct options options; unsigned int references; }

user_defined_types: struct window_panes { struct window_pane *tqh_first; struct window_pane **tqh_last; }

user_defined_types: struct window_pane { struct window *window; unsigned int sx; unsigned int sy; unsigned int xoff; unsigned int yoff; int flags; char *cmd; char *cwd; int pid; int fd; char tty[32]; struct buffer *in; struct buffer *out; struct input_ctx ictx; struct screen *screen; struct screen base; struct window_mode *mode; void *modedata; struct { struct window_pane *tqe_next; struct window_pane **tqe_prev; } entry; }

user_defined_types: struct input_ctx { struct window_pane *wp; struct screen_write_ctx ctx; unsigned char *buf; unsigned long len; unsigned long off; struct grid_cell cell; struct grid_cell saved_cell; unsigned int saved_cx; unsigned int saved_cy; unsigned char *string_buf; unsigned long string_len; int string_type; unsigned char utf8_buf[4]; unsigned int utf8_len; unsigned int utf8_off; unsigned char intermediate; void *(*state)(unsigned char, struct input_ctx *); unsigned char private; struct { struct input_arg *list; unsigned int num; unsigned long space; } args; }

user_defined_types: struct screen_write_ctx { struct window_pane *wp; struct screen *s; }

user_defined_types: struct window_mode { struct screen *(*init)(struct window_pane *); void (*free)(struct window_pane *); void (*resize)(struct window_pane *, unsigned int, unsigned int); void (*key)(struct window_pane *, struct client *, int); void (*mouse)(struct window_pane *, struct client *, unsigned char, unsigned char, unsigned char); void (*timer)(struct window_pane *); }

user_defined_types: struct screen { char *title; struct grid *grid; unsigned int cx; unsigned int cy; unsigned int old_cx; unsigned int old_cy; unsigned int rupper; unsigned int rlower; unsigned int old_rupper; unsigned int old_rlower; int mode; unsigned char *tabs; struct screen_sel sel; }

user_defined_types: struct grid { unsigned int sx; unsigned int sy; unsigned int hsize; unsigned int hlimit; unsigned int *size; struct grid_cell **data; unsigned int *usize; struct grid_utf8 **udata; }

user_defined_types: struct client { int fd; struct buffer *in; struct buffer *out; char *title; char *cwd; struct tty tty; struct timeval status_timer; struct timeval repeat_timer; struct screen status; int flags; char *message_string; struct timeval message_timer; char *prompt_string; char *prompt_buffer; unsigned long prompt_index; int (*prompt_callback)(void *, char *); void *prompt_data; int prompt_flags; unsigned int prompt_hindex; struct { char **list; unsigned int num; unsigned long space; } prompt_hdata; struct mode_key_data prompt_mdata; struct session *session; }

user_defined_types: struct tty { char *path; unsigned int sx; unsigned int sy; unsigned int cx; unsigned int cy; int mode; unsigned int rlower; unsigned int rupper; char *termname; struct tty_term *term; int fd; struct buffer *in; struct buffer *out; int log_fd; struct termios tio; struct grid_cell cell; unsigned char acs[-1]; int flags; int term_flags; struct timeval key_timer; unsigned long ksize; struct tty_keys ktree; }

user_defined_types: struct tty_keys { struct tty_key *rbh_root; }

user_defined_types: struct session { char *name; struct timeval tv; unsigned int sx; unsigned int sy; struct winlink *curw; struct winlink_stack lastw; struct winlinks windows; struct options options; struct paste_stack buffers; struct { struct session_alert *slh_first; } alerts; int flags; }

user_defined_types: struct tty_term { char *name; unsigned int references; struct tty_code codes[-1]; int flags; struct { struct tty_term *sle_next; } entry; }

user_defined_types: struct options { struct options_tree tree; struct options *parent; }

user_defined_types: struct paste_stack { struct paste_buffer **list; unsigned int num; unsigned long space; }

user_defined_types: struct options_tree { struct options_entry *sph_root; }

user_defined_types: struct tty_code { enum tty_code_type type; union { char *string; int number; int flag; } value; }


decompiled_code:
__int64 __fastcall layout_next(__int64 a1)
{
unsigned int v1; // eax

v1 = *(_DWORD *)(a1 + 48) + 1;
if ( v1 > 5 )
v1 = 0;
*(_DWORD *)(a1 + 48) = v1;
return layout_refresh(a1);
}

original_code:
void
layout_next(struct window *w)
{
 w->layout++;
 if (w->layout > (sizeof((layouts)) / sizeof((layouts)[0])) - 1)
  w->layout = 0;
 layout_refresh(w, 0);
}

user_defined_types: struct window { char *name; struct timeval name_timer; struct window_pane *active; struct window_panes panes; unsigned int layout; unsigned int sx; unsigned int sy; int flags; struct options options; unsigned int references; }

user_defined_types: struct timeval { long tv_sec; long tv_usec; }

user_defined_types: struct buffer { unsigned char *base; unsigned long space; unsigned long size; unsigned long off; }

user_defined_types: struct input_arg { unsigned char data[64]; unsigned long used; }

user_defined_types: struct screen_sel { int flag; unsigned int sx; unsigned int sy; unsigned int ex; unsigned int ey; struct grid_cell cell; }

user_defined_types: struct mode_key_data { int type; int flags; }

user_defined_types: struct termios { unsigned int c_iflag; unsigned int c_oflag; unsigned int c_cflag; unsigned int c_lflag; unsigned char c_line; unsigned char c_cc[32]; unsigned int c_ispeed; unsigned int c_ospeed; }

user_defined_types: struct grid_cell { unsigned char attr; unsigned char flags; unsigned char fg; unsigned char bg; unsigned char data; }

user_defined_types: struct grid_utf8 { unsigned char width; unsigned char data[8]; }

user_defined_types: struct winlink_stack { struct winlink *slh_first; }

user_defined_types: struct winlinks { struct winlink *rbh_root; }

user_defined_types: struct tty_key { int key; char *string; int flags; struct { struct tty_key *rbe_left; struct tty_key *rbe_right; struct tty_key *rbe_parent; int rbe_color; } entry; }

user_defined_types: struct winlink { int idx; struct window *window; struct { struct winlink *rbe_left; struct winlink *rbe_right; struct winlink *rbe_parent; int rbe_color; } entry; struct { struct winlink *sle_next; } sentry; }

user_defined_types: struct session_alert { struct winlink *wl; int type; struct { struct session_alert *sle_next; } entry; }

user_defined_types: enum tty_code_type { TTYCODE_NONE=0, TTYCODE_STRING=1, TTYCODE_NUMBER=2, TTYCODE_FLAG=3 }

user_defined_types: struct options_entry { char *name; enum { OPTIONS_STRING=0, OPTIONS_NUMBER=1, OPTIONS_KEY=2 } type; union { char *string; long long number; int key; } value; struct { struct options_entry *spe_left; struct options_entry *spe_right; } entry; }

user_defined_types: struct paste_buffer { char *data; struct timeval tv; }


decompiled_code:
__int64 __fastcall layout_resize(__int64 a1)
{
void (*v1)(void); // rax

v1 = (void (*)(void))*(&layouts + 3 * *(unsigned int *)(*(_QWORD *)a1 + 48LL) + 2);
if ( !v1 )
return 0xFFFFFFFFLL;
v1();
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func11(__int64 a1)
{
void (*v1)(void); // rax

v1 = (void (*)(void))*(&layouts + 3 * *(unsigned int *)(*(_QWORD *)a1 + 48LL) + 2);
if ( !v1 )
return 0xFFFFFFFFLL;
v1();
return 0LL;
}

original_code:
int
layout_resize(struct window_pane *wp, int adjust)
{
 struct window *w = wp->window;
 if (layouts[w->layout].resize == ((void *)0))
  return (-1);
 layouts[w->layout].resize(wp, adjust);
 return (0);
}

variable_types: adjust int

user_defined_types: struct window_pane { struct window *window; unsigned int sx; unsigned int sy; unsigned int xoff; unsigned int yoff; int flags; char *cmd; char *cwd; int pid; int fd; char tty[32]; struct buffer *in; struct buffer *out; struct input_ctx ictx; struct screen *screen; struct screen base; struct window_mode *mode; void *modedata; struct { struct window_pane *tqe_next; struct window_pane **tqe_prev; } entry; }

user_defined_types: struct window { char *name; struct timeval name_timer; struct window_pane *active; struct window_panes panes; unsigned int layout; unsigned int sx; unsigned int sy; int flags; struct options options; unsigned int references; }

user_defined_types: struct input_ctx { struct window_pane *wp; struct screen_write_ctx ctx; unsigned char *buf; unsigned long len; unsigned long off; struct grid_cell cell; struct grid_cell saved_cell; unsigned int saved_cx; unsigned int saved_cy; unsigned char *string_buf; unsigned long string_len; int string_type; unsigned char utf8_buf[4]; unsigned int utf8_len; unsigned int utf8_off; unsigned char intermediate; void *(*state)(unsigned char, struct input_ctx *); unsigned char private; struct { struct input_arg *list; unsigned int num; unsigned long space; } args; }

user_defined_types: struct window_panes { struct window_pane *tqh_first; struct window_pane **tqh_last; }

user_defined_types: struct screen_write_ctx { struct window_pane *wp; struct screen *s; }

user_defined_types: struct window_mode { struct screen *(*init)(struct window_pane *); void (*free)(struct window_pane *); void (*resize)(struct window_pane *, unsigned int, unsigned int); void (*key)(struct window_pane *, struct client *, int); void (*mouse)(struct window_pane *, struct client *, unsigned char, unsigned char, unsigned char); void (*timer)(struct window_pane *); }

user_defined_types: struct options { struct options_tree tree; struct options *parent; }

user_defined_types: struct options_tree { struct options_entry *sph_root; }

user_defined_types: struct screen { char *title; struct grid *grid; unsigned int cx; unsigned int cy; unsigned int old_cx; unsigned int old_cy; unsigned int rupper; unsigned int rlower; unsigned int old_rupper; unsigned int old_rlower; int mode; unsigned char *tabs; struct screen_sel sel; }

user_defined_types: struct grid { unsigned int sx; unsigned int sy; unsigned int hsize; unsigned int hlimit; unsigned int *size; struct grid_cell **data; unsigned int *usize; struct grid_utf8 **udata; }

user_defined_types: struct client { int fd; struct buffer *in; struct buffer *out; char *title; char *cwd; struct tty tty; struct timeval status_timer; struct timeval repeat_timer; struct screen status; int flags; char *message_string; struct timeval message_timer; char *prompt_string; char *prompt_buffer; unsigned long prompt_index; int (*prompt_callback)(void *, char *); void *prompt_data; int prompt_flags; unsigned int prompt_hindex; struct { char **list; unsigned int num; unsigned long space; } prompt_hdata; struct mode_key_data prompt_mdata; struct session *session; }

user_defined_types: struct tty { char *path; unsigned int sx; unsigned int sy; unsigned int cx; unsigned int cy; int mode; unsigned int rlower; unsigned int rupper; char *termname; struct tty_term *term; int fd; struct buffer *in; struct buffer *out; int log_fd; struct termios tio; struct grid_cell cell; unsigned char acs[-1]; int flags; int term_flags; struct timeval key_timer; unsigned long ksize; struct tty_keys ktree; }

user_defined_types: struct tty_keys { struct tty_key *rbh_root; }

user_defined_types: struct session { char *name; struct timeval tv; unsigned int sx; unsigned int sy; struct winlink *curw; struct winlink_stack lastw; struct winlinks windows; struct options options; struct paste_stack buffers; struct { struct session_alert *slh_first; } alerts; int flags; }

user_defined_types: struct tty_term { char *name; unsigned int references; struct tty_code codes[-1]; int flags; struct { struct tty_term *sle_next; } entry; }

user_defined_types: struct paste_stack { struct paste_buffer **list; unsigned int num; unsigned long space; }

user_defined_types: struct tty_code { enum tty_code_type type; union { char *string; int number; int flag; } value; }


decompiled_code:
__int64 __fastcall cmd_copy_buffer_send(__int64 a1, __int64 a2)
{
_QWORD *v2; // rbx

v2 = *(_QWORD **)(a1 + 8);
buffer_write(a2, v2, 24LL);
cmd_send_string(a2, *v2);
return cmd_send_string(a2, v2[1]);
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, __int64 a2)
{
_QWORD *v2; // rbx

v2 = *(_QWORD **)(a1 + 8);
buffer_write(a2, v2, 24LL);
cmd_send_string(a2, *v2);
return cmd_send_string(a2, v2[1]);
}

original_code:
void
cmd_copy_buffer_send(struct cmd *self, struct buffer *b)
{
 struct cmd_copy_buffer_data *data = self->data;
 buffer_write(b, data, sizeof *data);
 cmd_send_string(b, data->dst_session);
 cmd_send_string(b, data->src_session);
}

variable_types: struct cmd { struct cmd_entry { char *name; char *alias; char *usage; int flags; void (*init)(struct cmd *, int); int (*parse)(struct cmd *, int, char **, char **); int (*exec)(struct cmd *, struct cmd_ctx { struct client { int fd; struct buffer { unsigned char *base; unsigned long space; unsigned long size; unsigned long off; } *in; struct buffer *out; char *title; char *cwd; struct tty { char *path; unsigned int sx; unsigned int sy; unsigned int cx; unsigned int cy; int mode; unsigned int rlower; unsigned int rupper; char *termname; struct tty_term { char *name; unsigned int references; struct tty_code { enum tty_code_type { TTYCODE_NONE=0, TTYCODE_STRING=1, TTYCODE_NUMBER=2, TTYCODE_FLAG=3 } type; union { char *string; int number; int flag; } value; } codes[-1]; int flags; struct { struct tty_term *sle_next; } entry; } *term; int fd; struct buffer *in; struct buffer *out; int log_fd; struct termios { unsigned int c_iflag; unsigned int c_oflag; unsigned int c_cflag; unsigned int c_lflag; unsigned char c_line; unsigned char c_cc[32]; unsigned int c_ispeed; unsigned int c_ospeed; } tio; struct grid_cell { unsigned char attr; unsigned char flags; unsigned char fg; unsigned char bg; unsigned char data; } cell; unsigned char acs[-1]; int flags; int term_flags; struct timeval { long tv_sec; long tv_usec; } key_timer; unsigned long ksize; struct tty_keys { struct tty_key { int key; char *string; int flags; struct { struct tty_key *rbe_left; struct tty_key *rbe_right; struct tty_key *rbe_parent; int rbe_color; } entry; } *rbh_root; } ktree; } tty; struct timeval status_timer; struct timeval repeat_timer; struct screen { char *title; struct grid { unsigned int sx; unsigned int sy; unsigned int hsize; unsigned int hlimit; unsigned int *size; struct grid_cell **data; unsigned int *usize; struct grid_utf8 { unsigned char width; unsigned char data[8]; } **udata; } *grid; unsigned int cx; unsigned int cy; unsigned int old_cx; unsigned int old_cy; unsigned int rupper; unsigned int rlower; unsigned int old_rupper; unsigned int old_rlower; int mode; unsigned char *tabs; struct screen_sel { int flag; unsigned int sx; unsigned int sy; unsigned int ex; unsigned int ey; struct grid_cell cell; } sel; } status; int flags; char *message_string; struct timeval message_timer; char *prompt_string; char *prompt_buffer; unsigned long prompt_index; int (*prompt_callback)(void *, char *); void *prompt_data; int prompt_flags; unsigned int prompt_hindex; struct { char **list; unsigned int num; unsigned long space; } prompt_hdata; struct mode_key_data { int type; int flags; } prompt_mdata; struct session { char *name; struct timeval tv; unsigned int sx; unsigned int sy; struct winlink { int idx; struct window { char *name; struct timeval name_timer; struct window_pane { struct window *window; unsigned int sx; unsigned int sy; unsigned int xoff; unsigned int yoff; int flags; char *cmd; char *cwd; int pid; int fd; char tty[32]; struct buffer *in; struct buffer *out; struct input_ctx { struct window_pane *wp; struct screen_write_ctx { struct window_pane *wp; struct screen *s; } ctx; unsigned char *buf; unsigned long len; unsigned long off; struct grid_cell cell; struct grid_cell saved_cell; unsigned int saved_cx; unsigned int saved_cy; unsigned char *string_buf; unsigned long string_len; int string_type; unsigned char utf8_buf[4]; unsigned int utf8_len; unsigned int utf8_off; unsigned char intermediate; void *(*state)(unsigned char, struct input_ctx *); unsigned char private; struct { struct input_arg { unsigned char data[64]; unsigned long used; } *list; unsigned int num; unsigned long space; } args; } ictx; struct screen *screen; struct screen base; struct window_mode { struct screen *(*init)(struct window_pane *); void (*free)(struct window_pane *); void (*resize)(struct window_pane *, unsigned int, unsigned int); void (*key)(struct window_pane *, struct client *, int); void (*mouse)(struct window_pane *, struct client *, unsigned char, unsigned char, unsigned char); void (*timer)(struct window_pane *); } *mode; void *modedata; struct { struct window_pane *tqe_next; struct window_pane **tqe_prev; } entry; } *active; struct window_panes { struct window_pane *tqh_first; struct window_pane **tqh_last; } panes; unsigned int layout; unsigned int sx; unsigned int sy; int flags; struct options { struct options_tree { struct options_entry { char *name; enum { OPTIONS_STRING=0, OPTIONS_NUMBER=1, OPTIONS_KEY=2 } type; union { char *string; long long number; int key; } value; struct { struct options_entry *spe_left; struct options_entry *spe_right; } entry; } *sph_root; } tree; struct options *parent; } options; unsigned int references; } *window; struct { struct winlink *rbe_left; struct winlink *rbe_right; struct winlink *rbe_parent; int rbe_color; } entry; struct { struct winlink *sle_next; } sentry; } *curw; struct winlink_stack { struct winlink *slh_first; } lastw; struct winlinks { struct winlink *rbh_root; } windows; struct options options; struct paste_stack { struct paste_buffer { char *data; struct timeval tv; } **list; unsigned int num; unsigned long space; } buffers; struct { struct session_alert { struct winlink *wl; int type; struct { struct session_alert *sle_next; } entry; } *slh_first; } alerts; int flags; } *session; } *cmdclient; struct client *curclient; struct session *cursession; struct msg_command_data { int pid; unsigned int idx; unsigned long namelen; } *msgdata; void (*print)(struct cmd_ctx *, char *, ...); void (*info)(struct cmd_ctx *, char *, ...); void (*error)(struct cmd_ctx *, char *, ...); } *); void (*send)(struct cmd *, struct buffer *); void (*recv)(struct cmd *, struct buffer *); void (*free)(struct cmd *); unsigned long (*print)(struct cmd *, char *, unsigned long); } *entry; void *data; struct { struct cmd *tqe_next; struct cmd **tqe_prev; } qentry; } *

variable_types:
b
struct buffer *

variable_types: struct cmd_copy_buffer_data { char *dst_session; char *src_session; int dst_idx; int src_idx; } *

user_defined_types: struct cmd { struct cmd_entry *entry; void *data; struct { struct cmd *tqe_next; struct cmd **tqe_prev; } qentry; }

user_defined_types: struct cmd_entry { char *name; char *alias; char *usage; int flags; void (*init)(struct cmd *, int); int (*parse)(struct cmd *, int, char **, char **); int (*exec)(struct cmd *, struct cmd_ctx *); void (*send)(struct cmd *, struct buffer *); void (*recv)(struct cmd *, struct buffer *); void (*free)(struct cmd *); unsigned long (*print)(struct cmd *, char *, unsigned long); }

user_defined_types: struct cmd_ctx { struct client *cmdclient; struct client *curclient; struct session *cursession; struct msg_command_data *msgdata; void (*print)(struct cmd_ctx *, char *, ...); void (*info)(struct cmd_ctx *, char *, ...); void (*error)(struct cmd_ctx *, char *, ...); }

user_defined_types: struct winlink { int idx; struct window *window; struct { struct winlink *rbe_left; struct winlink *rbe_right; struct winlink *rbe_parent; int rbe_color; } entry; struct { struct winlink *sle_next; } sentry; }

user_defined_types: struct window_pane { struct window *window; unsigned int sx; unsigned int sy; unsigned int xoff; unsigned int yoff; int flags; char *cmd; char *cwd; int pid; int fd; char tty[32]; struct buffer *in; struct buffer *out; struct input_ctx ictx; struct screen *screen; struct screen base; struct window_mode *mode; void *modedata; struct { struct window_pane *tqe_next; struct window_pane **tqe_prev; } entry; }


decompiled_code:
__int64 __fastcall cmd_copy_buffer_recv(__int64 a1, __int64 a2)
{
__int64 v2; // rax
_QWORD *v3; // rbx
__int64 result; // rax

v2 = xmalloc(24LL);
*(_QWORD *)(a1 + 8) = v2;
v3 = (_QWORD *)v2;
buffer_read(a2, v2, 24LL);
*v3 = cmd_recv_string(a2);
result = cmd_recv_string(a2);
v3[1] = result;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1, __int64 a2)
{
__int64 v2; // rax
_QWORD *v3; // rbx
__int64 result; // rax

v2 = xmalloc(24LL);
*(_QWORD *)(a1 + 8) = v2;
v3 = (_QWORD *)v2;
buffer_read(a2, v2, 24LL);
*v3 = cmd_recv_string(a2);
result = cmd_recv_string(a2);
v3[1] = result;
return result;
}

original_code:
void
cmd_copy_buffer_recv(struct cmd *self, struct buffer *b)
{
 struct cmd_copy_buffer_data *data;
 self->data = data = xmalloc(sizeof *data);
 buffer_read(b, data, sizeof *data);
 data->dst_session = cmd_recv_string(b);
 data->src_session = cmd_recv_string(b);
}

user_defined_types: struct cmd_copy_buffer_data { char *dst_session; char *src_session; int dst_idx; int src_idx; }

user_defined_types: struct msg_command_data { int pid; unsigned int idx; unsigned long namelen; }

user_defined_types: struct mode_key_data { int type; int flags; }

user_defined_types: struct buffer { unsigned char *base; unsigned long space; unsigned long size; unsigned long off; }

user_defined_types: struct termios { unsigned int c_iflag; unsigned int c_oflag; unsigned int c_cflag; unsigned int c_lflag; unsigned char c_line; unsigned char c_cc[32]; unsigned int c_ispeed; unsigned int c_ospeed; }

user_defined_types: struct grid_cell { unsigned char attr; unsigned char flags; unsigned char fg; unsigned char bg; unsigned char data; }

user_defined_types: struct timeval { long tv_sec; long tv_usec; }

user_defined_types: struct screen_sel { int flag; unsigned int sx; unsigned int sy; unsigned int ex; unsigned int ey; struct grid_cell cell; }

user_defined_types: struct winlink_stack { struct winlink *slh_first; }

user_defined_types: struct winlinks { struct winlink *rbh_root; }

user_defined_types: struct tty_key { int key; char *string; int flags; struct { struct tty_key *rbe_left; struct tty_key *rbe_right; struct tty_key *rbe_parent; int rbe_color; } entry; }

user_defined_types: struct session_alert { struct winlink *wl; int type; struct { struct session_alert *sle_next; } entry; }

user_defined_types: enum tty_code_type { TTYCODE_NONE=0, TTYCODE_STRING=1, TTYCODE_NUMBER=2, TTYCODE_FLAG=3 }

user_defined_types: struct grid_utf8 { unsigned char width; unsigned char data[8]; }

user_defined_types: struct window { char *name; struct timeval name_timer; struct window_pane *active; struct window_panes panes; unsigned int layout; unsigned int sx; unsigned int sy; int flags; struct options options; unsigned int references; }

user_defined_types: struct paste_buffer { char *data; struct timeval tv; }

user_defined_types: struct window_panes { struct window_pane *tqh_first; struct window_pane **tqh_last; }

user_defined_types: struct input_ctx { struct window_pane *wp; struct screen_write_ctx ctx; unsigned char *buf; unsigned long len; unsigned long off; struct grid_cell cell; struct grid_cell saved_cell; unsigned int saved_cx; unsigned int saved_cy; unsigned char *string_buf; unsigned long string_len; int string_type; unsigned char utf8_buf[4]; unsigned int utf8_len; unsigned int utf8_off; unsigned char intermediate; void *(*state)(unsigned char, struct input_ctx *); unsigned char private; struct { struct input_arg *list; unsigned int num; unsigned long space; } args; }

user_defined_types: struct screen_write_ctx { struct window_pane *wp; struct screen *s; }

user_defined_types: struct window_mode { struct screen *(*init)(struct window_pane *); void (*free)(struct window_pane *); void (*resize)(struct window_pane *, unsigned int, unsigned int); void (*key)(struct window_pane *, struct client *, int); void (*mouse)(struct window_pane *, struct client *, unsigned char, unsigned char, unsigned char); void (*timer)(struct window_pane *); }

user_defined_types: struct options_entry { char *name; enum { OPTIONS_STRING=0, OPTIONS_NUMBER=1, OPTIONS_KEY=2 } type; union { char *string; long long number; int key; } value; struct { struct options_entry *spe_left; struct options_entry *spe_right; } entry; }

user_defined_types: struct input_arg { unsigned char data[64]; unsigned long used; }