// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x20, %rsp
movw %si, %ax
movw %ax, -0x2(%rbp)
movq %rdi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movl -0x14(%rbp), %eax
shll $0x2, %eax
imull -0x18(%rbp), %eax
movslq %eax, %rdx
xorl %esi, %esi
callq 0x2120
movq -0x10(%rbp), %rax
movl $0x1, 0xc(%rax)
movq -0x10(%rbp), %rax
movl $0x6, 0x10(%rax)
movq -0x10(%rbp), %rax
movw $0x0, 0x8(%rax)
movq -0x10(%rbp), %rax
movw $0x0, 0xa(%rax)
movl -0x14(%rbp), %ecx
shll $0x2, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x10(%rbp), %rax
movb $0x0, 0x18(%rax)
movq -0x10(%rbp), %rax
movl $0x0, 0x1c(%rax)
movq -0x10(%rbp), %rax
movl $0x424242, 0x3c(%rax)   # imm = 0x424242
movq -0x10(%rbp), %rax
movl $0x3333cc, 0x20(%rax)   # imm = 0x3333CC
movq -0x10(%rbp), %rax
movl $0x545499, 0x40(%rax)   # imm = 0x545499
movq -0x10(%rbp), %rax
movl $0xcc2121, 0x24(%rax)   # imm = 0xCC2121
movq -0x10(%rbp), %rax
movl $0x994242, 0x44(%rax)   # imm = 0x994242
movq -0x10(%rbp), %rax
movl $0x33cc33, 0x28(%rax)   # imm = 0x33CC33
movq -0x10(%rbp), %rax
movl $0x549954, 0x48(%rax)   # imm = 0x549954
movq -0x10(%rbp), %rax
movl $0xcc33cc, 0x2c(%rax)   # imm = 0xCC33CC
movq -0x10(%rbp), %rax
movl $0x995499, 0x4c(%rax)   # imm = 0x995499
movq -0x10(%rbp), %rax
movl $0x33cccc, 0x30(%rax)   # imm = 0x33CCCC
movq -0x10(%rbp), %rax
movl $0x549999, 0x50(%rax)   # imm = 0x549999
movq -0x10(%rbp), %rax
movl $0xcccc33, 0x34(%rax)   # imm = 0xCCCC33
movq -0x10(%rbp), %rax
movl $0x999954, 0x54(%rax)   # imm = 0x999954
movq -0x10(%rbp), %rax
movl $0x878787, 0x38(%rax)   # imm = 0x878787
movq -0x10(%rbp), %rax
movl $0xcccccc, 0x58(%rax)   # imm = 0xCCCCCC
movzbl -0x2(%rbp), %eax
movl %eax, %ecx
leaq 0x2ab0(%rip), %rax      # 0xb010
movl (%rax,%rcx,4), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x1c(%rax)
movl $0x10, -0x1c(%rbp)
cmpl $0x100, -0x1c(%rbp)     # imm = 0x100
jge 0x859f
movslq -0x1c(%rbp), %rcx
leaq 0x2a8b(%rip), %rax      # 0xb010
movl (%rax,%rcx,4), %edx
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl %edx, 0x1c(%rax,%rcx,4)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x8571
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)