// File: /workspace/github_c_makefile_star2_O0/baines[P]MiniGBS/ui.c
// Function: ui_volume_draw
static void ui_volume_draw(uint16_t notes[static 4]){
	static const char* vol_glyphs[] = {
		" ", "▎", "▌", "▊", "█",
	};

	static uint8_t prev_vol[8];
	uint8_t vol[8];
	audio_get_vol(vol);

	for(int i = 0; i < 8; ++i){
		if(notes[i/2] == 0xffff) vol[i] = 0;
		if(!prev_vol[i]) continue;

		vol[i] = MAX(prev_vol[i] - 1, vol[i]);
	}

	for(int i = 0; i < 4; ++i){
		move((cfg.win_h-6)/6+9, (cfg.win_w-47)/2+3+(12*i));

		attron(COLOR_PAIR(i+11));
		for(int j = 3; j --> 0 ;) {
			uint8_t v = vol[i*2+0] / 5;
			if(v == j){
				printw("%s", vol_glyphs[4-(vol[i*2+0] % 5)]);
			} else if(v > j){
				printw("%s", vol_glyphs[0]);
			} else {
				printw("%s", vol_glyphs[4]);
			}
		}
		attroff(COLOR_PAIR(i+11));

		attron(COLOR_PAIR(i+1));
		if(vol[i*2+0] || vol[i*2+1]) printw("█");

		for(int j = 0; j < 3; ++j){
			uint8_t v = vol[i*2+1] / 5;
			if(v == j){
				printw("%s", vol_glyphs[vol[i*2+1] % 5]);
			} else if(v > j){
				printw("%s", vol_glyphs[4]);
			} else {
				printw("%s", vol_glyphs[0]);
			}
		}

		attroff(COLOR_PAIR(i+1));
	}

	memcpy(prev_vol, vol, sizeof(vol));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
leaq -0x10(%rbp), %rdi
callq 0xc520
movl $0x0, -0x14(%rbp)
cmpl $0x8, -0x14(%rbp)
jge 0xe5b4
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movl -0x14(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0x40(%rbp), %rax
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
jne 0xe546
movslq -0x14(%rbp), %rax
movb $0x0, -0x10(%rbp,%rax)
movslq -0x14(%rbp), %rcx
leaq 0xfadf(%rip), %rax      # 0x1e030
cmpb $0x0, (%rax,%rcx)
jne 0xe559
jmp 0xe5a6
movslq -0x14(%rbp), %rcx
leaq 0xfacc(%rip), %rax      # 0x1e030
movzbl (%rax,%rcx), %eax
subl $0x1, %eax
movl %eax, -0x18(%rbp)
movslq -0x14(%rbp), %rax
movb -0x10(%rbp,%rax), %al
movb %al, -0x19(%rbp)
movl -0x18(%rbp), %eax
movzbl -0x19(%rbp), %ecx
cmpl %ecx, %eax
jle 0xe58c
movl -0x18(%rbp), %eax
movl %eax, -0x44(%rbp)
jmp 0xe593
movzbl -0x19(%rbp), %eax
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
movb %al, %cl
movslq -0x14(%rbp), %rax
movb %cl, -0x10(%rbp,%rax)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xe50c
movl $0x0, -0x24(%rbp)
cmpl $0x4, -0x24(%rbp)
jge 0xe840
movq 0x6a04(%rip), %rax      # 0x14fd0
movq (%rax), %rdi
leaq 0x8342(%rip), %rax      # 0x16918
movl 0x2c(%rax), %eax
subl $0x6, %eax
movl $0x6, %ecx
cltd
idivl %ecx
movl %eax, %esi
addl $0x9, %esi
leaq 0x8328(%rip), %rax      # 0x16918
movl 0x28(%rax), %eax
subl $0x2f, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %edx
addl $0x3, %edx
imull $0xc, -0x24(%rbp), %eax
addl %eax, %edx
callq 0x5200
movq 0x69bb(%rip), %rax      # 0x14fd0
movq (%rax), %rdi
movl -0x24(%rbp), %esi
addl $0xb, %esi
shll $0x8, %esi
andl $0xff00, %esi           # imm = 0xFF00
xorl %eax, %eax
movl %eax, %edx
callq 0x52b0
movl $0x3, -0x28(%rbp)
movl -0x28(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0x28(%rbp)
cmpl $0x0, %eax
jle 0xe6e6
movl -0x24(%rbp), %eax
shll %eax
addl $0x0, %eax
cltq
movzbl -0x10(%rbp,%rax), %eax
movl $0x5, %ecx
cltd
idivl %ecx
movb %al, -0x29(%rbp)
movzbl -0x29(%rbp), %eax
cmpl -0x28(%rbp), %eax
jne 0xe6aa
movl -0x24(%rbp), %eax
shll %eax
addl $0x0, %eax
cltq
movzbl -0x10(%rbp,%rax), %eax
movl $0x5, %ecx
cltd
idivl %ecx
movl $0x4, %eax
subl %edx, %eax
movslq %eax, %rcx
leaq 0x811a(%rip), %rax      # 0x167b0
movq (%rax,%rcx,8), %rsi
leaq 0x27ae(%rip), %rdi      # 0x10e4f
movb $0x0, %al
callq 0x54e0
jmp 0xe6e1
movzbl -0x29(%rbp), %eax
cmpl -0x28(%rbp), %eax
jle 0xe6ca
movq 0x80f6(%rip), %rsi      # 0x167b0
leaq 0x278e(%rip), %rdi      # 0x10e4f
movb $0x0, %al
callq 0x54e0
jmp 0xe6df
movq 0x80ff(%rip), %rsi      # 0x167d0
leaq 0x2777(%rip), %rdi      # 0x10e4f
movb $0x0, %al
callq 0x54e0
jmp 0xe6e1
jmp 0xe637
movq 0x68e3(%rip), %rax      # 0x14fd0
movq (%rax), %rdi
movl -0x24(%rbp), %esi
addl $0xb, %esi
shll $0x8, %esi
andl $0xff00, %esi           # imm = 0xFF00
xorl %eax, %eax
movl %eax, %edx
callq 0x55a0
movq 0x68c1(%rip), %rax      # 0x14fd0
movq (%rax), %rdi
movl -0x24(%rbp), %esi
addl $0x1, %esi
shll $0x8, %esi
andl $0xff00, %esi           # imm = 0xFF00
xorl %eax, %eax
movl %eax, %edx
callq 0x52b0
movl -0x24(%rbp), %eax
shll %eax
addl $0x0, %eax
cltq
movzbl -0x10(%rbp,%rax), %eax
cmpl $0x0, %eax
jne 0xe752
movl -0x24(%rbp), %eax
shll %eax
addl $0x1, %eax
cltq
movzbl -0x10(%rbp,%rax), %eax
cmpl $0x0, %eax
je 0xe760
leaq 0x389e(%rip), %rdi      # 0x11ff7
movb $0x0, %al
callq 0x54e0
movl $0x0, -0x30(%rbp)
cmpl $0x3, -0x30(%rbp)
jge 0xe810
movl -0x24(%rbp), %eax
shll %eax
addl $0x1, %eax
cltq
movzbl -0x10(%rbp,%rax), %eax
movl $0x5, %ecx
cltd
idivl %ecx
movb %al, -0x31(%rbp)
movzbl -0x31(%rbp), %eax
cmpl -0x30(%rbp), %eax
jne 0xe7c9
movl -0x24(%rbp), %eax
shll %eax
addl $0x1, %eax
cltq
movzbl -0x10(%rbp,%rax), %eax
movl $0x5, %ecx
cltd
idivl %ecx
movslq %edx, %rcx
leaq 0x7ffb(%rip), %rax      # 0x167b0
movq (%rax,%rcx,8), %rsi
leaq 0x268f(%rip), %rdi      # 0x10e4f
movb $0x0, %al
callq 0x54e0
jmp 0xe800
movzbl -0x31(%rbp), %eax
cmpl -0x30(%rbp), %eax
jle 0xe7e9
movq 0x7ff7(%rip), %rsi      # 0x167d0
leaq 0x266f(%rip), %rdi      # 0x10e4f
movb $0x0, %al
callq 0x54e0
jmp 0xe7fe
movq 0x7fc0(%rip), %rsi      # 0x167b0
leaq 0x2658(%rip), %rdi      # 0x10e4f
movb $0x0, %al
callq 0x54e0
jmp 0xe800
jmp 0xe802
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0xe767
movq 0x67b9(%rip), %rax      # 0x14fd0
movq (%rax), %rdi
movl -0x24(%rbp), %esi
addl $0x1, %esi
shll $0x8, %esi
andl $0xff00, %esi           # imm = 0xFF00
xorl %eax, %eax
movl %eax, %edx
callq 0x55a0
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xe5bb
movq -0x10(%rbp), %rax
movq %rax, 0xf7e5(%rip)      # 0x1e030
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)