// File: /workspace/github_c_makefile_star2_O2/hughbarney[P]pEmacs/window.c
// Function: splitwind
int splitwind (int f, int n)
{
  LINE *lp;
  WINDOW *wp, *wp1, *wp2;
  int ntru, ntrl, ntrd;

  if (curwp->w_ntrows < 3)
    {
      mlwrite ("Cannot split a %d line window", curwp->w_ntrows);
      return (FALSE);
    }
  if ((wp = (WINDOW *) malloc (sizeof (WINDOW))) == NULL)
    {
      mlwrite ("Cannot allocate WINDOW block");
      return (FALSE);
    }
  ++curbp->b_nwnd;		/* Displayed twice */
  wp->w_bufp = curbp;
  wp->w_dotp = curwp->w_dotp;
  wp->w_doto = curwp->w_doto;
  wp->w_markp = curwp->w_markp;
  wp->w_marko = curwp->w_marko;
  wp->w_flag = 0;
  wp->w_force = 0;
  ntru = (curwp->w_ntrows - 1) / 2; /* Upper size */
  ntrl = (curwp->w_ntrows - 1) - ntru; /* Lower size */
  lp = curwp->w_linep;
  ntrd = 0;
  while (lp != curwp->w_dotp)
    {
      ++ntrd;
      lp = lforw (lp);
    }
  lp = curwp->w_linep;
  if (ntrd <= ntru)
    {				/* Old is upper window */
      if (ntrd == ntru)		/* Hit mode line */
	lp = lforw (lp);
      curwp->w_ntrows = ntru;
      wp->w_wndp = curwp->w_wndp;
      curwp->w_wndp = wp;
      wp->w_toprow = curwp->w_toprow + ntru + 1;
      wp->w_ntrows = ntrl;
    }
  else
    {				/* Old is lower window */
      wp1 = NULL;
      wp2 = wheadp;
      while (wp2 != curwp)
	{
	  wp1 = wp2;
	  wp2 = wp2->w_wndp;
	}
      if (wp1 == NULL)
	wheadp = wp;
      else
	wp1->w_wndp = wp;
      wp->w_wndp = curwp;
      wp->w_toprow = curwp->w_toprow;
      wp->w_ntrows = ntru;
      ++ntru;			/* Mode line */
      curwp->w_toprow += ntru;
      curwp->w_ntrows = ntrl;
      while (ntru--)
	lp = lforw (lp);
    }
  curwp->w_linep = lp;		/* Adjust the top lines */
  wp->w_linep = lp;		/* if necessary */
  curwp->w_flag |= WFMODE | WFHARD;
  wp->w_flag |= WFMODE | WFHARD;
  return (TRUE);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
leaq 0x568f(%rip), %r15      # 0xca38
movq (%r15), %r14
movsbl 0x39(%r14), %ebx
cmpl $0x2, %ebx
jg 0x73cd
leaq 0x1383(%rip), %rdi      # 0x8740
xorl %ebp, %ebp
movl %ebx, %esi
xorl %eax, %eax
callq 0x3dec
jmp 0x74a9
pushq $0x40
popq %rdi
callq 0x2190
testq %rax, %rax
je 0x7461
leaq 0x5643(%rip), %rcx      # 0xca28
movq (%rcx), %rcx
incb 0x31(%rcx)
movq %rcx, 0x8(%rax)
movq 0x18(%r14), %rdx
movq %rdx, 0x18(%rax)
movq 0x20(%r14), %rcx
movq %rcx, 0x20(%rax)
movq 0x28(%r14), %rcx
movq %rcx, 0x28(%rax)
movq 0x30(%r14), %rcx
movq %rcx, 0x30(%rax)
andw $0x0, 0x3a(%rax)
movzbl %bl, %esi
decl %esi
movl %esi, %ecx
shrl %ecx
leaq 0x10(%r14), %rdi
pushq $-0x1
popq %r8
movq %rdi, %r9
movq (%r9), %r9
incl %r8d
cmpq %rdx, %r9
jne 0x7428
subl %ecx, %esi
movq (%rdi), %rdx
cmpl %ecx, %r8d
jbe 0x7473
leaq 0x560c(%rip), %r9       # 0xca50
xorl %edi, %edi
movq %rdi, %r8
movq (%r9), %rdi
movq %rdi, %r9
cmpq %r14, %rdi
jne 0x7446
testq %r8, %r8
je 0x74b6
movq %rax, (%r8)
movq (%r15), %r14
jmp 0x74c0
leaq 0x12f6(%rip), %rdi      # 0x875e
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x3dec
jmp 0x74a9
jne 0x7478
movq (%rdx), %rdx
movb %cl, 0x39(%r14)
movq (%r14), %rdi
movq %rdi, (%rax)
movq %rax, (%r14)
movq (%r15), %r14
addb 0x38(%r14), %cl
incb %cl
movb %cl, 0x38(%rax)
movb %sil, 0x39(%rax)
movq %rdx, 0x10(%r14)
movq %rdx, 0x10(%rax)
orb $0x18, 0x3b(%r14)
orb $0x18, 0x3b(%rax)
pushq $0x1
popq %rbp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5593(%rip), %rdi      # 0xca50
movq %rax, (%rdi)
movq %r14, (%rax)
movb 0x38(%r14), %dil
movb %dil, 0x38(%rax)
movb %cl, 0x39(%rax)
incl %ecx
addl %ecx, %edi
movb %dil, 0x38(%r14)
movb %sil, 0x39(%r14)
subl $0x1, %ecx
jb 0x7495
movq (%rdx), %rdx
jmp 0x74da