// File: /workspace/github_c_makefile_star2_O1/uobikiemukot[P]yaft/./ctrlseq/dcs.h
// Function: reset_sixel
void reset_sixel(struct sixel_canvas_t *sc, struct color_pair_t color_pair, int width, int height)
{
	extern const uint32_t color_list[]; /* global */
	int i;

	memset(sc->pixmap, 0, BYTES_PER_PIXEL * width * height);

	sc->width   = 1;
	sc->height  = 6;
	sc->point.x	= 0;
	sc->point.y = 0;
	sc->line_length = BYTES_PER_PIXEL * width;
	sc->color_index = 0;

	/* 0 - 15: use vt340 or ansi color map */
	/* VT340 VT340 Default Color Map
		ref: http://www.vt100.net/docs/vt3xx-gp/chapter2.html#T2-3
	*/
	sc->color_table[0] = 0x000000; sc->color_table[8]  = 0x424242;
	sc->color_table[1] = 0x3333CC; sc->color_table[9]  = 0x545499;
	sc->color_table[2] = 0xCC2121; sc->color_table[10] = 0x994242;
	sc->color_table[3] = 0x33CC33; sc->color_table[11] = 0x549954;
	sc->color_table[4] = 0xCC33CC; sc->color_table[12] = 0x995499;
	sc->color_table[5] = 0x33CCCC; sc->color_table[13] = 0x549999;
	sc->color_table[6] = 0xCCCC33; sc->color_table[14] = 0x999954;
	sc->color_table[7] = 0x878787; sc->color_table[15] = 0xCCCCCC;

	/* ANSI 16color table (but unusual order corresponding vt340 color map)
	sc->color_table[0] = color_list[0]; sc->color_table[8]  = color_list[8];
	sc->color_table[1] = color_list[4]; sc->color_table[9]  = color_list[12];
	sc->color_table[2] = color_list[1]; sc->color_table[10] = color_list[9];
	sc->color_table[3] = color_list[2]; sc->color_table[11] = color_list[10];
	sc->color_table[4] = color_list[5]; sc->color_table[12] = color_list[13];
	sc->color_table[5] = color_list[6]; sc->color_table[13] = color_list[14];
	sc->color_table[6] = color_list[3]; sc->color_table[14] = color_list[11];
	sc->color_table[7] = color_list[7]; sc->color_table[15] = color_list[15];
	*/
	/* change palette 0, because its often the same color as terminal background */
	sc->color_table[0] = color_list[color_pair.fg];

	/* 16 - 255: use xterm 256 color palette */
	/* copy 256 color map */
	for (i = 16; i < COLORS; i++)
		sc->color_table[i] = color_list[i];
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %r14d
movl %esi, %ebp
movq %rdi, %rbx
movq (%rdi), %rdi
shll $0x2, %r14d
imull %r14d, %ecx
movslq %ecx, %rdx
xorl %r15d, %r15d
xorl %esi, %esi
callq 0x2130
movabsq $0x600000001, %rax      # imm = 0x600000001
movq %rax, 0xc(%rbx)
movw %r15w, 0x8(%rbx)
movw %r15w, 0xa(%rbx)
movl %r14d, 0x14(%rbx)
movb $0x0, 0x18(%rbx)
movabsq $0x54549900424242, %rax # imm = 0x54549900424242
movq %rax, 0x3c(%rbx)
movl $0x3333cc, 0x20(%rbx)   # imm = 0x3333CC
movabsq $0x33cc3300cc2121, %rax # imm = 0x33CC3300CC2121
movq %rax, 0x24(%rbx)
movabsq $0x54995400994242, %rax # imm = 0x54995400994242
movq %rax, 0x44(%rbx)
movabsq $0x33cccc00cc33cc, %rax # imm = 0x33CCCC00CC33CC
movq %rax, 0x2c(%rbx)
movabsq $0x54999900995499, %rax # imm = 0x54999900995499
movq %rax, 0x4c(%rbx)
movabsq $0x87878700cccc33, %rax # imm = 0x87878700CCCC33
movq %rax, 0x34(%rbx)
movabsq $0xcccccc00999954, %rax # imm = 0xCCCCCC00999954
movq %rax, 0x54(%rbx)
movzbl %bpl, %ecx
leaq 0x18f1(%rip), %rax      # 0x80c0
movl (%rax,%rcx,4), %ecx
movl %ecx, 0x1c(%rbx)
movl 0x40(%rax,%r15,4), %ecx
movl %ecx, 0x5c(%rbx,%r15,4)
incq %r15
cmpq $0xf0, %r15
jne 0x67d5
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq