For XTerm and anything that claims compatibility with it, you'll want this:
https://invisible-island.net/xterm/ctlseqs/ctlseqs.html
You'll also need the manual for the VT100 terminal, which XTerm emulates and expands on:
https://vt100.net/docs/vt100-ug/contents.html
The Linux console_codes(4) man page describes the control codes used by the Linux console, which is also a superset of VT100 and the man page sometimes has more verbose descriptions than the other sources above:
http://man7.org/linux/man-pages/man4/console_codes.4.html
The unknown codes in your example:
\33[22;0;0t
Here, the first part \33[ (or ESC [ ) is known as CSI or Control Sequence Introducer.
The CSI <number> ; <number> ; <number> t is a window manipulation sequence. Control sequences ending with t always take three numeric parameters, but won't always use all of them. The first parameter is 22, and the second is 0, so this code tells the terminal emulator to save the current window and icon titles so that they can be restored later.
\33[1;39r
This is CSI <number> ; <number> r. The meaning is "set scrolling region". Setting this to something smaller than the size of the current window would efficiently allow keeping something static like a menu line at the top of a TUI display, a status line at the bottom, or both while displaying a lot of text within the scrolling region.
\33[4l
This is CSI <one or more numbers> l. The meaning is "reset mode". Value 4 resets (disables) "insertion-replace mode", or in plain terms, tells that anything printed to the screen should simply overwrite what was there before.
\33[39;1H
This is CSI <number> ; <number> H. This moves the cursor to the 39th line, 1st column.
\33[23;0;0t
This is another window manipulation sequence. This restores the previously-saved window and icon titles. Obviously your test program did not change the titles at all, but these sequences are part of the standard initialization/exit procedures done by initscr() and endwin() respectively.
\33[?1l # Set cursor key to cursor
This sets the cursor keys of the VT100 keypad to the regular "cursor key mode". There was also another mode, intended to allow these keys to be used for application-specific purposes, like an extra set of function keys. The VT100 terminal produced different output for these keys according to the mode settings; this just ensures that if the application switched the cursor keys to a non-default mode, they will be returned to default mode before the program exits.
\33>
This is just ESC >. This is similar to the previous code, but for the numeric keypad.
gdbdid not help :).