// File: /workspace/github_c_makefile_star2_O1/kobolt[P]curses-collection/scca/scca.c
// Function: screen_update
static void screen_update(void)
{
  unsigned char c;
  int i, y, x, maxy, maxx, skip_newline;

  getmaxyx(stdscr, maxy, maxx);
  erase();

  /* Alphabet. */
  x = 0;
  for (c = 0; c < UCHAR_MAX; c++) {
    if (allowed_char[c] != -1) {
      mvaddch(0, x, c);
      x++;
      if (x > maxx)
        break;
    }
  }

  /* Cipher */
  x = 0;
  for (c = 0; c < UCHAR_MAX; c++) {
    mvaddch(1, x, cipher[c]);
    x++;
    if (x > maxx)
      break;
  }

  /* Upper Separation Line */
  mvhline(2, 0, ACS_HLINE, maxx);

  /* Text */
  skip_newline = text_offset;
  move(3, 0);
  for (i = 0; i < TEXT_MAX; i++) {
    if (text[i] == '\0')
      break;

    if (skip_newline > 0) {
      if (text[i] == '\n') {
        skip_newline--;
      }
      continue;
    }

    c = cipher_applied(text[i]);
    if (c != text[i]) {
      attron(A_REVERSE);
    }
    addch(c);
    if (c != text[i]) {
      attroff(A_REVERSE);
    }

    getyx(stdscr, y, x);
    if (y >= (maxy - 1)) {
      break;
    }
  }

  /* Lower Separation Line */
  mvhline(maxy - 1, 0, ACS_HLINE, maxx);

  move(1, cipher_pos);
  refresh();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0x26d7(%rip), %r12      # 0x3fd0
movq (%r12), %rdi
testq %rdi, %rdi
je 0x190b
movswl 0x4(%rdi), %eax
movl %eax, (%rsp)
jmp 0x1912
movl $0xfffffffe, (%rsp)     # imm = 0xFFFFFFFE
testq %rdi, %rdi
je 0x191f
movswl 0x6(%rdi), %ebx
incl %ebx
jmp 0x1924
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
callq 0x1030
xorl %r14d, %r14d
leaq 0x28dd(%rip), %r13      # 0x4210
xorl %r15d, %r15d
cmpl $-0x1, (%r13)
je 0x1964
movq (%r12), %rdi
xorl %esi, %esi
movl %r15d, %edx
callq 0x1150
cmpl $-0x1, %eax
je 0x195c
movq (%r12), %rdi
movl %r14d, %esi
callq 0x1170
cmpl %ebx, %r15d
jge 0x1974
incl %r15d
incq %r14
addq $0x4, %r13
cmpq $0xff, %r14
jne 0x1936
xorl %r14d, %r14d
testl %ebx, %ebx
movl $0x0, %r15d
cmovgl %ebx, %r15d
leaq 0x2786(%rip), %r13      # 0x4110
movq (%r12), %rdi
movl $0x1, %esi
movl %r14d, %edx
callq 0x1150
cmpl $-0x1, %eax
je 0x19ae
movq (%r12), %rdi
movzbl (%r14,%r13), %esi
callq 0x1170
cmpq %r14, %r15
je 0x19bf
incq %r14
cmpq $0xff, %r14
jne 0x198a
movq (%r12), %rdi
movl $0x2, %esi
xorl %edx, %edx
callq 0x1150
cmpl $-0x1, %eax
je 0x19ec
movq (%r12), %rdi
movq 0x25e9(%rip), %rax      # 0x3fc8
movl 0x1c4(%rax), %esi
movl %ebx, %edx
callq 0x1190
movl %ebx, 0x4(%rsp)
movl 0x2711(%rip), %r15d     # 0x4108
movq (%r12), %rdi
xorl %r13d, %r13d
movl $0x3, %esi
xorl %edx, %edx
callq 0x1150
leaq 0x2bff(%rip), %rbp      # 0x4610
movb (%r13,%rbp), %bl
testb %bl, %bl
je 0x1a97
testl %r15d, %r15d
jle 0x1a2c
xorl %eax, %eax
cmpb $0xa, %bl
sete %al
subl %eax, %r15d
jmp 0x1a87
movzbl %bl, %edi
callq 0x1aef
movl %eax, %r14d
cmpb %bl, %al
je 0x1a4b
movq (%r12), %rdi
movl $0x40000, %esi          # imm = 0x40000
xorl %edx, %edx
callq 0x1100
movzbl %r14b, %esi
movq (%r12), %rdi
callq 0x1170
cmpb (%r13,%rbp), %r14b
je 0x1a6f
movq (%r12), %rdi
movl $0x40000, %esi          # imm = 0x40000
xorl %edx, %edx
callq 0x11a0
movq (%r12), %rax
testq %rax, %rax
je 0x1a7d
movswl (%rax), %eax
jmp 0x1a82
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl (%rsp), %eax
jge 0x1a97
incq %r13
cmpq $0x10000, %r13          # imm = 0x10000
jne 0x1a11
movq (%r12), %rdi
movl (%rsp), %esi
xorl %edx, %edx
callq 0x1150
cmpl $-0x1, %eax
je 0x1ac4
movq (%r12), %rdi
movq 0x2513(%rip), %rax      # 0x3fc8
movl 0x1c4(%rax), %esi
movl 0x4(%rsp), %edx
callq 0x1190
movq (%r12), %rdi
movl 0x2632(%rip), %edx      # 0x4100
movl $0x1, %esi
callq 0x1150
movq (%r12), %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x10b0