LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/vampirefrog[P]x68ksjis/sjis.c
// Function: sjis_to_utf8
int sjis_to_utf8(uint8_t *sjis_data, int sjis_len, uint8_t *utf8_data, int utf8_len) {
	if(sjis_len < 1) return 0;
	if(utf8_len < 1) return -1;

	int j = 0, last_byte = 0;
	for(int i = 0; i < sjis_len; i++) {
		uint8_t b = sjis_data[i];
		if(last_byte == 0 && SJIS_FIRST_CHAR(b)) {
			last_byte = b;
		} else {
			char buf[4];
			int l = utf8_encode(sjis_char_to_unicode((last_byte << 8) | b), buf);
			if(j + l >= utf8_len - 1)
				return j;
			strcpy((char *)utf8_data + j, buf);
			j += l;
			last_byte = 0;
		}
	}
	return j;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
cmpl $0x1, -0x14(%rbp)
jge 0x1568
movl $0x0, -0x4(%rbp)
jmp 0x1684
cmpl $0x1, -0x24(%rbp)
jge 0x157a
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1684
movl $0x0, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x167e
movq -0x10(%rbp), %rax
movslq -0x30(%rbp), %rcx
movb (%rax,%rcx), %al
movb %al, -0x31(%rbp)
cmpl $0x0, -0x2c(%rbp)
jne 0x1610
movzbl -0x31(%rbp), %eax
cmpl $0x80, %eax
jl 0x15c5
movzbl -0x31(%rbp), %eax
cmpl $0x84, %eax
jle 0x1607
movzbl -0x31(%rbp), %eax
cmpl $0x88, %eax
jl 0x15db
movzbl -0x31(%rbp), %eax
cmpl $0x9f, %eax
jle 0x1607
movzbl -0x31(%rbp), %eax
cmpl $0xe0, %eax
jl 0x15f1
movzbl -0x31(%rbp), %eax
cmpl $0xeb, %eax
jle 0x1607
movzbl -0x31(%rbp), %eax
cmpl $0xf0, %eax
jl 0x1610
movzbl -0x31(%rbp), %eax
cmpl $0xf3, %eax
jg 0x1610
movzbl -0x31(%rbp), %eax
movl %eax, -0x2c(%rbp)
jmp 0x166e
movl -0x2c(%rbp), %eax
shll $0x8, %eax
movzbl -0x31(%rbp), %ecx
orl %ecx, %eax
movzwl %ax, %edi
callq 0x1ba0
movl %eax, %edi
leaq -0x35(%rbp), %rsi
callq 0x4320
movl %eax, -0x3c(%rbp)
movl -0x28(%rbp), %eax
addl -0x3c(%rbp), %eax
movl -0x24(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jl 0x164a
movl -0x28(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1684
movq -0x20(%rbp), %rdi
movslq -0x28(%rbp), %rax
addq %rax, %rdi
leaq -0x35(%rbp), %rsi
callq 0x1030
movl -0x3c(%rbp), %eax
addl -0x28(%rbp), %eax
movl %eax, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
jmp 0x1670
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x158f
movl -0x28(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/vampirefrog[P]x68ksjis/sjis.c
// Function: sjis_write_utf8
int sjis_write_utf8(FILE *f, uint8_t *sjis_data, int sjis_len) {
	if(sjis_len < 1) return 0;

	int j = 0, last_byte = 0;
	for(int i = 0; i < sjis_len; i++) {
		uint8_t b = sjis_data[i];
		if(last_byte == 0 && SJIS_FIRST_CHAR(b)) {
			last_byte = b;
		} else {
			char buf[4];
			int l = utf8_encode(sjis_char_to_unicode((last_byte << 8) | b), buf);
			if(l) fwrite(buf, l, 1, f);
			j += l;
			last_byte = 0;
		}
	}

	return j;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
cmpl $0x1, -0x1c(%rbp)
jge 0x16e5
movl $0x0, -0x4(%rbp)
jmp 0x17df
movl $0x0, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x17d9
movq -0x18(%rbp), %rax
movslq -0x28(%rbp), %rcx
movb (%rax,%rcx), %al
movb %al, -0x29(%rbp)
cmpl $0x0, -0x24(%rbp)
jne 0x177b
movzbl -0x29(%rbp), %eax
cmpl $0x80, %eax
jl 0x1730
movzbl -0x29(%rbp), %eax
cmpl $0x84, %eax
jle 0x1772
movzbl -0x29(%rbp), %eax
cmpl $0x88, %eax
jl 0x1746
movzbl -0x29(%rbp), %eax
cmpl $0x9f, %eax
jle 0x1772
movzbl -0x29(%rbp), %eax
cmpl $0xe0, %eax
jl 0x175c
movzbl -0x29(%rbp), %eax
cmpl $0xeb, %eax
jle 0x1772
movzbl -0x29(%rbp), %eax
cmpl $0xf0, %eax
jl 0x177b
movzbl -0x29(%rbp), %eax
cmpl $0xf3, %eax
jg 0x177b
movzbl -0x29(%rbp), %eax
movl %eax, -0x24(%rbp)
jmp 0x17c9
movl -0x24(%rbp), %eax
shll $0x8, %eax
movzbl -0x29(%rbp), %ecx
orl %ecx, %eax
movzwl %ax, %edi
callq 0x1ba0
movl %eax, %edi
leaq -0x2d(%rbp), %rsi
callq 0x4320
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0x17b9
leaq -0x2d(%rbp), %rdi
movslq -0x34(%rbp), %rsi
movq -0x10(%rbp), %rcx
movl $0x1, %edx
callq 0x10a0
movl -0x34(%rbp), %eax
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
jmp 0x17cb
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x16fa
movl -0x20(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/vampirefrog[P]x68ksjis/sjis.c
// Function: sjis_fputc
int sjis_fputc(int sjis, FILE *f) {
	uint8_t b = (sjis >> 8) & 0xff;
	if(SJIS_FIRST_CHAR(b))
		fputc(b, f); // TODO: error check
	return fputc(sjis & 0xff, f);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movl -0x4(%rbp), %eax
sarl $0x8, %eax
andl $0xff, %eax
movb %al, -0x11(%rbp)
movzbl -0x11(%rbp), %eax
cmpl $0x80, %eax
jl 0x1823
movzbl -0x11(%rbp), %eax
cmpl $0x84, %eax
jle 0x1865
movzbl -0x11(%rbp), %eax
cmpl $0x88, %eax
jl 0x1839
movzbl -0x11(%rbp), %eax
cmpl $0x9f, %eax
jle 0x1865
movzbl -0x11(%rbp), %eax
cmpl $0xe0, %eax
jl 0x184f
movzbl -0x11(%rbp), %eax
cmpl $0xeb, %eax
jle 0x1865
movzbl -0x11(%rbp), %eax
cmpl $0xf0, %eax
jl 0x1872
movzbl -0x11(%rbp), %eax
cmpl $0xf3, %eax
jg 0x1872
movzbl -0x11(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x1090
movl -0x4(%rbp), %edi
andl $0xff, %edi
movq -0x10(%rbp), %rsi
callq 0x1090
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/vampirefrog[P]x68ksjis/sjis.c
// Function: sjis_fgetc
int sjis_fgetc(FILE *f) {
	int b = fgetc(f);
	if(b == EOF) return EOF;
	if(!SJIS_FIRST_CHAR(b))
		return b;

	int b2 = fgetc(f);
	if(b2 == EOF) return EOF;
	return b << 8 | b2;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1080
movl %eax, -0x14(%rbp)
cmpl $-0x1, -0x14(%rbp)
jne 0x18b7
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x192e
cmpl $0x80, -0x14(%rbp)
jl 0x18c9
cmpl $0x84, -0x14(%rbp)
jle 0x1907
cmpl $0x88, -0x14(%rbp)
jl 0x18db
cmpl $0x9f, -0x14(%rbp)
jle 0x1907
cmpl $0xe0, -0x14(%rbp)
jl 0x18ed
cmpl $0xeb, -0x14(%rbp)
jle 0x1907
cmpl $0xf0, -0x14(%rbp)
jl 0x18ff
cmpl $0xf3, -0x14(%rbp)
jle 0x1907
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x192e
movq -0x10(%rbp), %rdi
callq 0x1080
movl %eax, -0x18(%rbp)
cmpl $-0x1, -0x18(%rbp)
jne 0x1922
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x192e
movl -0x14(%rbp), %eax
shll $0x8, %eax
orl -0x18(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/vampirefrog[P]x68ksjis/sjis.c
// Function: jis_to_sjis
uint16_t jis_to_sjis(uint16_t val) {
	uint8_t j2 = val & 0xff;
	uint8_t j1 = val >> 8;
	uint8_t s1, s2;
	if(33 <= j1 && j1 <= 94)
		s1 = (j1 + 1) / 2 + 112;
	else
		s1 = (j1 + 1) / 2 + 176;
	if(j1 & 1)
		s2 = j2 + 31 + (j2 / 96);
	else
		s2 = j2 + 126;

	return (s1 << 8) | s2;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movw %di, %ax
movw %ax, -0x2(%rbp)
movzwl -0x2(%rbp), %eax
andl $0xff, %eax
movb %al, -0x3(%rbp)
movzwl -0x2(%rbp), %eax
sarl $0x8, %eax
movb %al, -0x4(%rbp)
movzbl -0x4(%rbp), %ecx
movl $0x21, %eax
cmpl %ecx, %eax
jg 0x198e
movzbl -0x4(%rbp), %eax
cmpl $0x5e, %eax
jg 0x198e
movzbl -0x4(%rbp), %eax
addl $0x1, %eax
movl $0x2, %ecx
cltd
idivl %ecx
addl $0x70, %eax
movb %al, -0x5(%rbp)
jmp 0x19a5
movzbl -0x4(%rbp), %eax
addl $0x1, %eax
movl $0x2, %ecx
cltd
idivl %ecx
addl $0xb0, %eax
movb %al, -0x5(%rbp)
movzbl -0x4(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x19d3
movzbl -0x3(%rbp), %eax
addl $0x1f, %eax
movl %eax, -0xc(%rbp)
movzbl -0x3(%rbp), %eax
movl $0x60, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0xc(%rbp), %eax
addl %ecx, %eax
movb %al, -0x6(%rbp)
jmp 0x19dd
movzbl -0x3(%rbp), %eax
addl $0x7e, %eax
movb %al, -0x6(%rbp)
movzbl -0x5(%rbp), %eax
shll $0x8, %eax
movzbl -0x6(%rbp), %ecx
orl %ecx, %eax
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/vampirefrog[P]x68ksjis/sjis.c
// Function: jis_from_sjis
uint16_t jis_from_sjis(uint16_t val) {
	int status = 0;
	uint8_t j1 = 0;
	uint8_t j2 = 0;
	uint8_t b1 = val >> 8;
	uint8_t b2 = val & 0xff;
	if((b1 >= 0x81 && b1 <= 0x84) || (b1 >= 0x87 && b1 <= 0x9f)) {
		j1 = 2 * (b1 - 0x70) - 1;
		if (b2 >= 0x40 && b2 <= 0x9e) {
			j2 = b2 - 31;
			if (j2 > 95)
				j2 -= 1;
			status = 1;
		} else if (b2 >= 0x9f && b2 <= 0xfc) {
			j2 = b2 - 126;
			j1 += 1;
			status = 1;
		}
	} else if (b1 >= 0xe0 && b1 <= 0xef) {
		j1 = 2 * (b1 - 0xb0) - 1;
		if (b2 >= 0x40 && b2 <= 0x9e) {
			j2 = b2 - 31;
			if (j2 > 95)
				j2 -= 1;
			status = 1;
		} else if (b2 >= 0x9f && b2 <= 0xfc) {
			j2 = b2 - 126;
			j1 += 1;
			status = 1;
		}
	}

	if(status == 0) return 0;
	return (j1 << 8) | j2;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movw %di, %ax
movw %ax, -0x4(%rbp)
movl $0x0, -0x8(%rbp)
movb $0x0, -0x9(%rbp)
movb $0x0, -0xa(%rbp)
movzwl -0x4(%rbp), %eax
sarl $0x8, %eax
movb %al, -0xb(%rbp)
movzwl -0x4(%rbp), %eax
andl $0xff, %eax
movb %al, -0xc(%rbp)
movzbl -0xb(%rbp), %eax
cmpl $0x81, %eax
jl 0x1a36
movzbl -0xb(%rbp), %eax
cmpl $0x84, %eax
jle 0x1a54
movzbl -0xb(%rbp), %eax
cmpl $0x87, %eax
jl 0x1ad5
movzbl -0xb(%rbp), %eax
cmpl $0x9f, %eax
jg 0x1ad5
movzbl -0xb(%rbp), %eax
subl $0x70, %eax
shll %eax
subl $0x1, %eax
movb %al, -0x9(%rbp)
movzbl -0xc(%rbp), %eax
cmpl $0x40, %eax
jl 0x1a9d
movzbl -0xc(%rbp), %eax
cmpl $0x9e, %eax
jg 0x1a9d
movzbl -0xc(%rbp), %eax
subl $0x1f, %eax
movb %al, -0xa(%rbp)
movzbl -0xa(%rbp), %eax
cmpl $0x5f, %eax
jle 0x1a94
movzbl -0xa(%rbp), %eax
subl $0x1, %eax
movb %al, -0xa(%rbp)
movl $0x1, -0x8(%rbp)
jmp 0x1ad0
movzbl -0xc(%rbp), %eax
cmpl $0x9f, %eax
jl 0x1ace
movzbl -0xc(%rbp), %eax
cmpl $0xfc, %eax
jg 0x1ace
movzbl -0xc(%rbp), %eax
subl $0x7e, %eax
movb %al, -0xa(%rbp)
movzbl -0x9(%rbp), %eax
addl $0x1, %eax
movb %al, -0x9(%rbp)
movl $0x1, -0x8(%rbp)
jmp 0x1ad0
jmp 0x1b75
movzbl -0xb(%rbp), %eax
cmpl $0xe0, %eax
jl 0x1b73
movzbl -0xb(%rbp), %eax
cmpl $0xef, %eax
jg 0x1b73
movzbl -0xb(%rbp), %eax
subl $0xb0, %eax
shll %eax
subl $0x1, %eax
movb %al, -0x9(%rbp)
movzbl -0xc(%rbp), %eax
cmpl $0x40, %eax
jl 0x1b3e
movzbl -0xc(%rbp), %eax
cmpl $0x9e, %eax
jg 0x1b3e
movzbl -0xc(%rbp), %eax
subl $0x1f, %eax
movb %al, -0xa(%rbp)
movzbl -0xa(%rbp), %eax
cmpl $0x5f, %eax
jle 0x1b35
movzbl -0xa(%rbp), %eax
subl $0x1, %eax
movb %al, -0xa(%rbp)
movl $0x1, -0x8(%rbp)
jmp 0x1b71
movzbl -0xc(%rbp), %eax
cmpl $0x9f, %eax
jl 0x1b6f
movzbl -0xc(%rbp), %eax
cmpl $0xfc, %eax
jg 0x1b6f
movzbl -0xc(%rbp), %eax
subl $0x7e, %eax
movb %al, -0xa(%rbp)
movzbl -0x9(%rbp), %eax
addl $0x1, %eax
movb %al, -0x9(%rbp)
movl $0x1, -0x8(%rbp)
jmp 0x1b71
jmp 0x1b73
jmp 0x1b75
cmpl $0x0, -0x8(%rbp)
jne 0x1b83
movw $0x0, -0x2(%rbp)
jmp 0x1b94
movzbl -0x9(%rbp), %eax
shll $0x8, %eax
movzbl -0xa(%rbp), %ecx
orl %ecx, %eax
movw %ax, -0x2(%rbp)
movw -0x2(%rbp), %ax
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/vampirefrog[P]x68ksjis/utf8.c
// Function: utf8_encode
int utf8_encode(int c, char *buf) {
	if(c < 0x80) {
		buf[0] = c;
		return 1;
	} else if(c < 0x800) {
		buf[0] = 192 + c / 64;
		buf[1] = 128 + c % 64;
		return 2;
	} else if(c - 0xd800u < 0x800) {
	} else if(c < 0x10000) {
		buf[0] = 224 + c / 4096;
		buf[1] = 128 + c / 64 % 64;
		buf[2] = 128 + c % 64;
		return 3;
	} else if (c<0x110000) {
		buf[0] = 240+c/262144;
		buf[1] = 128+c/4096%64;
		buf[2] = 128+c/64%64;
		buf[3] = 128+c%64;
		return 4;
	}

	buf[0] = c;
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x80, -0x8(%rbp)
jge 0x434b
movl -0x8(%rbp), %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0x44b1
cmpl $0x800, -0x8(%rbp)      # imm = 0x800
jge 0x4392
movl -0x8(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
addl $0xc0, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, (%rax)
movl -0x8(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
addl $0x80, %edx
movb %dl, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x1(%rax)
movl $0x2, -0x4(%rbp)
jmp 0x44b1
movl -0x8(%rbp), %eax
subl $0xd800, %eax           # imm = 0xD800
cmpl $0x800, %eax            # imm = 0x800
jae 0x43a6
jmp 0x449b
cmpl $0x10000, -0x8(%rbp)    # imm = 0x10000
jge 0x440f
movl -0x8(%rbp), %eax
movl $0x1000, %ecx           # imm = 0x1000
cltd
idivl %ecx
addl $0xe0, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, (%rax)
movl -0x8(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movl $0x40, %ecx
cltd
idivl %ecx
addl $0x80, %edx
movb %dl, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x1(%rax)
movl -0x8(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
addl $0x80, %edx
movb %dl, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x2(%rax)
movl $0x3, -0x4(%rbp)
jmp 0x44b1
cmpl $0x110000, -0x8(%rbp)   # imm = 0x110000
jge 0x4497
movl -0x8(%rbp), %eax
movl $0x40000, %ecx          # imm = 0x40000
cltd
idivl %ecx
addl $0xf0, %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, (%rax)
movl -0x8(%rbp), %eax
movl $0x1000, %ecx           # imm = 0x1000
cltd
idivl %ecx
movl $0x40, %ecx
cltd
idivl %ecx
addl $0x80, %edx
movb %dl, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x1(%rax)
movl -0x8(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
movl $0x40, %ecx
cltd
idivl %ecx
addl $0x80, %edx
movb %dl, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x2(%rax)
movl -0x8(%rbp), %eax
movl $0x40, %ecx
cltd
idivl %ecx
addl $0x80, %edx
movb %dl, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x3(%rax)
movl $0x4, -0x4(%rbp)
jmp 0x44b1
jmp 0x4499
jmp 0x449b
jmp 0x449d
jmp 0x449f
movl -0x8(%rbp), %eax
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, (%rax)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/vampirefrog[P]x68ksjis/utf8.c
// Function: utf8_fputc
int utf8_fputc(int c, FILE *f) {
	char buf[4];
	int chars = utf8_encode(c, buf);
	if(chars) {
		if(fwrite(buf, chars, 1, f) < 1)
			return EOF;
		return c;
	}
	return EOF;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl -0x8(%rbp), %edi
leaq -0x14(%rbp), %rsi
callq 0x4320
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x18(%rbp)
je 0x4511
leaq -0x14(%rbp), %rdi
movslq -0x18(%rbp), %rsi
movq -0x10(%rbp), %rcx
movl $0x1, %edx
callq 0x10a0
cmpq $0x1, %rax
jae 0x4509
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x4518
movl -0x8(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x4518
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/vampirefrog[P]x68ksjis/utf8.c
// Function: utf8_fgetc
int utf8_fgetc(FILE *f) {
	int state = 0;
	int codepoint = 0;
	int b = 0;
	while((b = fgetc(f)) != EOF) {
		if(state == 0) {
			if (b < 0x80) {  // Single-byte (ASCII)
				return b;
			} else if ((b & 0xE0) == 0xC0) {  // Start of 2-byte sequence
				codepoint = b & 0x1F;
				state = 1;
			} else if ((b & 0xF0) == 0xE0) {  // Start of 3-byte sequence
				codepoint = b & 0x0F;
				state = 2;
			} else if ((b & 0xF8) == 0xF0) {  // Start of 4-byte sequence
				codepoint = b & 0x07;
				state = 3;
			} else {
				return -2;
			}
		} else {
			if((b & 0xC0) == 0x80) {  // Valid continuation byte
				codepoint = (codepoint << 6) | (b & 0x3F);
				state--;  // Move to the next expected byte or finish
				if(state == 0)
					return codepoint;
			} else {
				return -2;
			}
		}
	}
	return EOF;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1080
movl %eax, -0x1c(%rbp)
cmpl $-0x1, %eax
je 0x4641
cmpl $0x0, -0x14(%rbp)
jne 0x45f8
cmpl $0x80, -0x1c(%rbp)
jge 0x4584
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x4648
movl -0x1c(%rbp), %eax
andl $0xe0, %eax
cmpl $0xc0, %eax
jne 0x45a5
movl -0x1c(%rbp), %eax
andl $0x1f, %eax
movl %eax, -0x18(%rbp)
movl $0x1, -0x14(%rbp)
jmp 0x45f4
movl -0x1c(%rbp), %eax
andl $0xf0, %eax
cmpl $0xe0, %eax
jne 0x45c6
movl -0x1c(%rbp), %eax
andl $0xf, %eax
movl %eax, -0x18(%rbp)
movl $0x2, -0x14(%rbp)
jmp 0x45f2
movl -0x1c(%rbp), %eax
andl $0xf8, %eax
cmpl $0xf0, %eax
jne 0x45e7
movl -0x1c(%rbp), %eax
andl $0x7, %eax
movl %eax, -0x18(%rbp)
movl $0x3, -0x14(%rbp)
jmp 0x45f0
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x4648
jmp 0x45f2
jmp 0x45f4
jmp 0x45f6
jmp 0x463c
movl -0x1c(%rbp), %eax
andl $0xc0, %eax
cmpl $0x80, %eax
jne 0x4631
movl -0x18(%rbp), %eax
shll $0x6, %eax
movl -0x1c(%rbp), %ecx
andl $0x3f, %ecx
orl %ecx, %eax
movl %eax, -0x18(%rbp)
movl -0x14(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
jne 0x462f
movl -0x18(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x4648
jmp 0x463a
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0x4648
jmp 0x463c
jmp 0x4551
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/mjosaarinen[P]brutus/crypto_aead/joltikeq6464v13/ref/encrypt.c
// Function: crypto_aead_encrypt
int crypto_aead_encrypt(unsigned char *c, unsigned long long *clen,
                        const unsigned char *m, unsigned long long mlen,
                        const unsigned char *ad, unsigned long long adlen,
                        const unsigned char *nsec,
                        const unsigned char *npub,
                        const unsigned char *k
                        ) 
{
    
    size_t outlen = 0;
    joltik_aead_encrypt(ad, adlen, m, mlen, k, npub, c, &outlen);
    *clen = outlen;
    (void)nsec;
    return 0;
}

// Assembly:
subq $0x48, %rsp
movq 0x60(%rsp), %rax
movq 0x58(%rsp), %rax
movq 0x50(%rsp), %rax
movq %rdi, 0x40(%rsp)
movq %rsi, 0x38(%rsp)
movq %rdx, 0x30(%rsp)
movq %rcx, 0x28(%rsp)
movq %r8, 0x20(%rsp)
movq %r9, 0x18(%rsp)
movq $0x0, 0x10(%rsp)
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq 0x28(%rsp), %rcx
movq 0x60(%rsp), %r8
movq 0x58(%rsp), %r9
movq 0x40(%rsp), %r10
leaq 0x10(%rsp), %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x1110
movq 0x10(%rsp), %rcx
movq 0x38(%rsp), %rax
movq %rcx, (%rax)
xorl %eax, %eax
addq $0x48, %rsp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mjosaarinen[P]brutus/crypto_aead/joltikeq6464v13/ref/joltik.c
// Function: get_block_number_from_tag
uint64_t get_block_number_from_tag(uint8_t *tag) {
    return
    ((uint64_t)(tag[ 0]&0x7f) << 56 ) ^
    ((uint64_t)tag[ 1] << 48 ) ^
    ((uint64_t)tag[ 2] << 40 ) ^
    ((uint64_t)tag[ 3] << 32 ) ^
    ((uint64_t)tag[ 4] << 24 ) ^
    ((uint64_t)tag[ 5] << 16 ) ^
    ((uint64_t)tag[ 6] <<  8 ) ^
    ((uint64_t)tag[ 7]       )
    ;
}

// Assembly:
movq %rdi, -0x8(%rsp)
movq -0x8(%rsp), %rax
movzbl (%rax), %eax
andl $0x7f, %eax
cltq
shlq $0x38, %rax
movq -0x8(%rsp), %rcx
movzbl 0x1(%rcx), %ecx
shlq $0x30, %rcx
xorq %rcx, %rax
movq -0x8(%rsp), %rcx
movzbl 0x2(%rcx), %ecx
shlq $0x28, %rcx
xorq %rcx, %rax
movq -0x8(%rsp), %rcx
movzbl 0x3(%rcx), %ecx
shlq $0x20, %rcx
xorq %rcx, %rax
movq -0x8(%rsp), %rcx
movzbl 0x4(%rcx), %ecx
shlq $0x18, %rcx
xorq %rcx, %rax
movq -0x8(%rsp), %rcx
movzbl 0x5(%rcx), %ecx
shlq $0x10, %rcx
xorq %rcx, %rax
movq -0x8(%rsp), %rcx
movzbl 0x6(%rcx), %ecx
shlq $0x8, %rcx
xorq %rcx, %rax
movq -0x8(%rsp), %rcx
movzbl 0x7(%rcx), %ecx
xorq %rcx, %rax
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mjosaarinen[P]brutus/crypto_aead/joltikeq6464v13/ref/joltik.c
// Function: getUnpaddedLength
size_t getUnpaddedLength(uint8_t* message) {
  int i;
  for(i=7;message[i]==0x00 && i>0;--i);
  if(message[i]==0x80) return i;
  else return -1;
}

// Assembly:
movq %rdi, -0x10(%rsp)
movl $0x7, -0x14(%rsp)
movq -0x10(%rsp), %rax
movslq -0x14(%rsp), %rcx
movzbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x15(%rsp)
jne 0x13f2
cmpl $0x0, -0x14(%rsp)
setg %al
movb %al, -0x15(%rsp)
movb -0x15(%rsp), %al
testb $0x1, %al
jne 0x13fc
jmp 0x140b
jmp 0x13fe
movl -0x14(%rsp), %eax
addl $-0x1, %eax
movl %eax, -0x14(%rsp)
jmp 0x13cd
movq -0x10(%rsp), %rax
movslq -0x14(%rsp), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x80, %eax
jne 0x142c
movslq -0x14(%rsp), %rax
movq %rax, -0x8(%rsp)
jmp 0x1435
movq $-0x1, -0x8(%rsp)
movq -0x8(%rsp), %rax
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mjosaarinen[P]brutus/crypto_aead/joltikeq6464v13/ref/joltik.c
// Function: memcmp_const
int memcmp_const(const void * a, const void *b, const size_t size)  {

  size_t i;
  unsigned char result = 0;
  const unsigned char *_a = (const unsigned char *) a;
  const unsigned char *_b = (const unsigned char *) b;

  for (i = 0; i < size; i++) {
    result |= _a[i] ^ _b[i];
  }

  /* returns 0 if equal, nonzero otherwise */
  return result; 
}

// Assembly:
movq %rdi, -0x8(%rsp)
movq %rsi, -0x10(%rsp)
movq %rdx, -0x18(%rsp)
movb $0x0, -0x21(%rsp)
movq -0x8(%rsp), %rax
movq %rax, -0x30(%rsp)
movq -0x10(%rsp), %rax
movq %rax, -0x38(%rsp)
movq $0x0, -0x20(%rsp)
movq -0x20(%rsp), %rax
cmpq -0x18(%rsp), %rax
jae 0x14b6
movq -0x30(%rsp), %rax
movq -0x20(%rsp), %rcx
movzbl (%rax,%rcx), %ecx
movq -0x38(%rsp), %rax
movq -0x20(%rsp), %rdx
movzbl (%rax,%rdx), %eax
xorl %eax, %ecx
movzbl -0x21(%rsp), %eax
orl %ecx, %eax
movb %al, -0x21(%rsp)
movq -0x20(%rsp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rsp)
jmp 0x1471
movzbl -0x21(%rsp), %eax
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/mjosaarinen[P]brutus/crypto_aead/joltikeq6464v13/ref/joltik.c
// Function: set_block_number_in_tweak_4
static void set_block_number_in_tweak_4(uint8_t *tweak, const uint64_t block_no) {
    tweak[0] = (tweak[0]&0xf0) ^
               ((block_no >> 56ULL) & 0x0f);
    tweak[1] = ((block_no >> 48ULL) & 0xff);
    tweak[2] = ((block_no >> 40ULL) & 0xff);
    tweak[3] = ((block_no >> 32ULL) & 0xff);
    tweak[4] = ((block_no >> 24ULL) & 0xff);
    tweak[5] = ((block_no >> 16ULL) & 0xff);
    tweak[6] = ((block_no >>  8ULL) & 0xff);
    tweak[7] = ((block_no >>  0ULL) & 0xff);
}

// Assembly:
movq %rdi, -0x8(%rsp)
movq %rsi, -0x10(%rsp)
movq -0x8(%rsp), %rax
movzbl (%rax), %eax
andl $0xf0, %eax
cltq
movq -0x10(%rsp), %rcx
shrq $0x38, %rcx
andq $0xf, %rcx
xorq %rcx, %rax
movb %al, %cl
movq -0x8(%rsp), %rax
movb %cl, (%rax)
movq -0x10(%rsp), %rax
shrq $0x30, %rax
andq $0xff, %rax
movb %al, %cl
movq -0x8(%rsp), %rax
movb %cl, 0x1(%rax)
movq -0x10(%rsp), %rax
shrq $0x28, %rax
andq $0xff, %rax
movb %al, %cl
movq -0x8(%rsp), %rax
movb %cl, 0x2(%rax)
movq -0x10(%rsp), %rax
shrq $0x20, %rax
andq $0xff, %rax
movb %al, %cl
movq -0x8(%rsp), %rax
movb %cl, 0x3(%rax)
movq -0x10(%rsp), %rax
shrq $0x18, %rax
andq $0xff, %rax
movb %al, %cl
movq -0x8(%rsp), %rax
movb %cl, 0x4(%rax)
movq -0x10(%rsp), %rax
shrq $0x10, %rax
andq $0xff, %rax
movb %al, %cl
movq -0x8(%rsp), %rax
movb %cl, 0x5(%rax)
movq -0x10(%rsp), %rax
shrq $0x8, %rax
andq $0xff, %rax
movb %al, %cl
movq -0x8(%rsp), %rax
movb %cl, 0x6(%rax)
movq -0x10(%rsp), %rax
shrq $0x0, %rax
andq $0xff, %rax
movb %al, %cl
movq -0x8(%rsp), %rax
movb %cl, 0x7(%rax)
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mjosaarinen[P]brutus/crypto_aead/joltikeq6464v13/ref/joltik.c
// Function: set_block_number_in_tweak_1
static void set_block_number_in_tweak_1(uint8_t *tweak, const uint64_t block_no) {
    tweak[0] = ((block_no >> 56ULL) & 0x7f) ^ 0x80 ;
    tweak[1] = ((block_no >> 48ULL) & 0xff);
    tweak[2] = ((block_no >> 40ULL) & 0xff);
    tweak[3] = ((block_no >> 32ULL) & 0xff);
    tweak[4] = ((block_no >> 24ULL) & 0xff);
    tweak[5] = ((block_no >> 16ULL) & 0xff);
    tweak[6] = ((block_no >>  8ULL) & 0xff);
    tweak[7] = ((block_no >>  0ULL) & 0xff);
}

// Assembly:
movq %rdi, -0x8(%rsp)
movq %rsi, -0x10(%rsp)
movq -0x10(%rsp), %rax
shrq $0x38, %rax
andq $0x7f, %rax
xorq $0x80, %rax
movb %al, %cl
movq -0x8(%rsp), %rax
movb %cl, (%rax)
movq -0x10(%rsp), %rax
shrq $0x30, %rax
andq $0xff, %rax
movb %al, %cl
movq -0x8(%rsp), %rax
movb %cl, 0x1(%rax)
movq -0x10(%rsp), %rax
shrq $0x28, %rax
andq $0xff, %rax
movb %al, %cl
movq -0x8(%rsp), %rax
movb %cl, 0x2(%rax)
movq -0x10(%rsp), %rax
shrq $0x20, %rax
andq $0xff, %rax
movb %al, %cl
movq -0x8(%rsp), %rax
movb %cl, 0x3(%rax)
movq -0x10(%rsp), %rax
shrq $0x18, %rax
andq $0xff, %rax
movb %al, %cl
movq -0x8(%rsp), %rax
movb %cl, 0x4(%rax)
movq -0x10(%rsp), %rax
shrq $0x10, %rax
andq $0xff, %rax
movb %al, %cl
movq -0x8(%rsp), %rax
movb %cl, 0x5(%rax)
movq -0x10(%rsp), %rax
shrq $0x8, %rax
andq $0xff, %rax
movb %al, %cl
movq -0x8(%rsp), %rax
movb %cl, 0x6(%rax)
movq -0x10(%rsp), %rax
shrq $0x0, %rax
andq $0xff, %rax
movb %al, %cl
movq -0x8(%rsp), %rax
movb %cl, 0x7(%rax)
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mjosaarinen[P]brutus/crypto_aead/joltikeq6464v13/ref/tweakableBC.c
// Function: multi
uint8_t multi (uint8_t x, uint8_t alpha) {
  if( 1 == alpha ) return x;
  if( 2 == alpha ) return mul2[x];
  if( 4 == alpha ) return mul4[x];

  printf("Incorrect alpha (%d) passed to the function g in the tweakey schedule. Exiting...\n", alpha); exit(2);
}

// Assembly:
pushq %rax
movb %sil, %al
movb %dil, %cl
movb %cl, 0x6(%rsp)
movb %al, 0x5(%rsp)
movzbl 0x5(%rsp), %ecx
movl $0x1, %eax
cmpl %ecx, %eax
jne 0x2347
movb 0x6(%rsp), %al
movb %al, 0x7(%rsp)
jmp 0x23ae
movzbl 0x5(%rsp), %ecx
movl $0x2, %eax
cmpl %ecx, %eax
jne 0x236c
movzbl 0x6(%rsp), %eax
movl %eax, %ecx
leaq 0x1c9d(%rip), %rax      # 0x4000
movb (%rax,%rcx), %al
movb %al, 0x7(%rsp)
jmp 0x23ae
movzbl 0x5(%rsp), %ecx
movl $0x4, %eax
cmpl %ecx, %eax
jne 0x2391
movzbl 0x6(%rsp), %eax
movl %eax, %ecx
leaq 0x1c88(%rip), %rax      # 0x4010
movb (%rax,%rcx), %al
movb %al, 0x7(%rsp)
jmp 0x23ae
movzbl 0x5(%rsp), %esi
leaq 0x35a3(%rip), %rdi      # 0x5940
movb $0x0, %al
callq 0x1040
movl $0x2, %edi
callq 0x1070
movb 0x7(%rsp), %al
popq %rcx
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mjosaarinen[P]brutus/crypto_aead/joltikeq6464v13/ref/tweakableBC.c
// Function: G
uint64_t G (uint64_t tweakey, uint8_t alpha) {
  uint64_t i;
  uint64_t shift;
  uint8_t tmp;
  for(i=0; i<16; i++) {
    shift=4ULL*i;

    tmp=(tweakey>>shift)&0xf;
    tweakey&=0xffffffffffffffffULL^(0xfULL<<shift);

    tmp=multi(tmp, alpha);
    tweakey^=((uint64_t)tmp)<<shift;
  }

  return tweakey;
}

// Assembly:
subq $0x28, %rsp
movb %sil, %al
movq %rdi, 0x20(%rsp)
movb %al, 0x1f(%rsp)
movq $0x0, 0x10(%rsp)
cmpq $0x10, 0x10(%rsp)
jae 0x245e
movq 0x10(%rsp), %rax
shlq $0x2, %rax
movq %rax, 0x8(%rsp)
movq 0x20(%rsp), %rax
movq 0x8(%rsp), %rcx
shrq %cl, %rax
andq $0xf, %rax
movb %al, 0x7(%rsp)
movq 0x8(%rsp), %rcx
movl $0xf, %eax
shlq %cl, %rax
xorq $-0x1, %rax
andq 0x20(%rsp), %rax
movq %rax, 0x20(%rsp)
movb 0x7(%rsp), %al
movzbl %al, %edi
movzbl 0x1f(%rsp), %esi
callq 0x10b0
movb %al, 0x7(%rsp)
movzbl 0x7(%rsp), %eax
movq 0x8(%rsp), %rcx
shlq %cl, %rax
xorq 0x20(%rsp), %rax
movq %rax, 0x20(%rsp)
movq 0x10(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x10(%rsp)
jmp 0x23d9
movq 0x20(%rsp), %rax
addq $0x28, %rsp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/mjosaarinen[P]brutus/crypto_aead/joltikeq6464v13/ref/tweakableBC.c
// Function: H
uint64_t H(uint64_t tweakey) {

  uint64_t i;
  uint64_t shiftIn;
  uint64_t shiftOut;
  uint64_t res=0;
  for (i=0; i<16; i++) {
    shiftIn=60ULL-4ULL*i;
    shiftOut=60ULL-4ULL*perm[i];
    res^=((tweakey>>shiftIn)&0xf)<<shiftOut;
  }
 return res;
}

// Assembly:
movq %rdi, -0x8(%rsp)
movq $0x0, -0x28(%rsp)
movq $0x0, -0x10(%rsp)
cmpq $0x10, -0x10(%rsp)
jae 0x24fb
movq -0x10(%rsp), %rcx
shlq $0x2, %rcx
movl $0x3c, %eax
subq %rcx, %rax
movq %rax, -0x18(%rsp)
movq -0x10(%rsp), %rcx
leaq 0x1b6f(%rip), %rax      # 0x4020
movzbl (%rax,%rcx), %eax
movl %eax, %ecx
shlq $0x2, %rcx
movl $0x3c, %eax
subq %rcx, %rax
movq %rax, -0x20(%rsp)
movq -0x8(%rsp), %rax
movq -0x18(%rsp), %rcx
shrq %cl, %rax
andq $0xf, %rax
movq -0x20(%rsp), %rcx
shlq %cl, %rax
xorq -0x28(%rsp), %rax
movq %rax, -0x28(%rsp)
movq -0x10(%rsp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rsp)
jmp 0x2487
movq -0x28(%rsp), %rax
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/ebiggers[P]xpack/lib/xpack_compress.c
// Function: xpack_compress
LIBEXPORT size_t
xpack_compress(struct xpack_compressor *c, const void *in, size_t in_nbytes,
	       void *out, size_t out_nbytes_avail)
{
	/* Don't bother trying to compress very small inputs. */
	if (in_nbytes < 100)
		return 0;

	/* Safety check */
	if (unlikely(in_nbytes > c->max_buffer_size))
		return 0;

#ifdef ENABLE_PREPROCESSING
	/* Copy the input data into the internal buffer and preprocess it. */
	memcpy(c->in_buffer, in, in_nbytes);
	c->in_nbytes = in_nbytes;
	preprocess(c->in_buffer, in_nbytes);
#else
	/* Preprocessing is disabled.  No internal buffer is needed. */
	c->in_buffer = (void *)in;
	c->in_nbytes = in_nbytes;
#endif

	return (*c->impl)(c, out, out_nbytes_avail);
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movq %rdx, 0x18(%rsp)
movq %rcx, 0x10(%rsp)
movq %r8, 0x8(%rsp)
cmpq $0x64, 0x18(%rsp)
jae 0x5410
movq $0x0, 0x30(%rsp)
jmp 0x5478
movq 0x18(%rsp), %rax
movq 0x28(%rsp), %rcx
cmpq 0x18(%rcx), %rax
seta %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x543d
movq $0x0, 0x30(%rsp)
jmp 0x5478
movq 0x20(%rsp), %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x18(%rsp), %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x28(%rsp), %rax
movq 0x20(%rax), %rax
movq 0x28(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq 0x8(%rsp), %rdx
callq *%rax
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rax
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/ebiggers[P]xpack/lib/xpack_compress.c
// Function: begin_block
static void
begin_block(struct xpack_compressor *c)
{
	memset(&c->freqs, 0, sizeof(c->freqs));
	c->num_literals = 0;
	c->num_matches = 0;
	c->num_extra_bytes = 0;
	init_block_split_stats(&c->split_stats);
}

// Assembly:
pushq %rax
movq %rdi, (%rsp)
movq (%rsp), %rdi
addq $0x28, %rdi
xorl %esi, %esi
movl $0x5e0, %edx            # imm = 0x5E0
callq 0x1040
movq (%rsp), %rax
movl $0x0, 0x3224(%rax)
movq (%rsp), %rax
movl $0x0, 0x3228(%rax)
movq (%rsp), %rax
movl $0x0, 0x322c(%rax)
movq (%rsp), %rdi
addq $0x608, %rdi            # imm = 0x608
callq 0x5f00
popq %rax
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/ebiggers[P]xpack/lib/xpack_compress.c
// Function: record_explicit_offset
static void
record_explicit_offset(struct xpack_compressor *c, struct match *match,
		       u32 offset)
{
	unsigned offset_log2 = bsr32(offset);
	unsigned offset_sym = NUM_REPS + offset_log2;

	match->offset_sym = offset_sym;
	c->freqs.offset[offset_sym]++;
	match->extra_offset_bits = offset - ((u32)1 << offset_log2);
	if (offset_log2 >= NUM_ALIGNED_BITS)
		c->freqs.aligned[offset & (ALIGNED_ALPHABET_SIZE - 1)]++;
}

// Assembly:
movq %rdi, -0x8(%rsp)
movq %rsi, -0x10(%rsp)
movl %edx, -0x14(%rsp)
movl -0x14(%rsp), %eax
bsrl %eax, %ecx
xorl $0x1f, %ecx
movl $0x1f, %eax
subl %ecx, %eax
movl %eax, -0x18(%rsp)
movl -0x18(%rsp), %eax
addl $0x3, %eax
movl %eax, -0x1c(%rsp)
movl -0x1c(%rsp), %eax
movb %al, %cl
movq -0x10(%rsp), %rax
movb %cl, 0x2(%rax)
movq -0x8(%rsp), %rax
movl -0x1c(%rsp), %ecx
movl 0x568(%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, 0x568(%rax,%rcx,4)
movl -0x14(%rsp), %eax
movl %eax, -0x20(%rsp)
movl -0x18(%rsp), %ecx
movl $0x1, %eax
shll %cl, %eax
movl -0x20(%rsp), %ecx
subl %eax, %ecx
movq -0x10(%rsp), %rax
movl %ecx, 0x4(%rax)
cmpl $0x3, -0x18(%rsp)
jb 0x563d
movq -0x8(%rsp), %rax
movl -0x14(%rsp), %ecx
andl $0x7, %ecx
movl %ecx, %ecx
movl 0x5e8(%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, 0x5e8(%rax,%rcx,4)
retq
nop
// File: /workspace/github_c_makefile_star2_O0/ebiggers[P]xpack/lib/xpack_compress.c
// Function: record_litrunlen
static void
record_litrunlen(struct xpack_compressor *c, struct match *match, u32 litrunlen)
{
	unsigned litrunlen_sym;

	if (litrunlen >= LITRUNLEN_ALPHABET_SIZE - 1) {
		u32 v = litrunlen - (LITRUNLEN_ALPHABET_SIZE - 1);
		if (v < 0xFF) {
			c->extra_bytes[c->num_extra_bytes++] = v;
		} else {
			v -= 0xFF;
			c->extra_bytes[c->num_extra_bytes++] = 0xFF;
			c->extra_bytes[c->num_extra_bytes++] = (u8)(v >> 0);
			c->extra_bytes[c->num_extra_bytes++] = (u8)(v >> 8);
			c->extra_bytes[c->num_extra_bytes++] = (u8)(v >> 16);
		}
		litrunlen_sym = LITRUNLEN_ALPHABET_SIZE - 1;
	} else {
		litrunlen_sym = litrunlen;
	}

	match->litrunlen_sym = litrunlen_sym;
	c->freqs.litrunlen[litrunlen_sym]++;
}

// Assembly:
movq %rdi, -0x8(%rsp)
movq %rsi, -0x10(%rsp)
movl %edx, -0x14(%rsp)
cmpl $0xf, -0x14(%rsp)
jb 0x5760
movl -0x14(%rsp), %eax
subl $0xf, %eax
movl %eax, -0x1c(%rsp)
cmpl $0xff, -0x1c(%rsp)
jae 0x569d
movl -0x1c(%rsp), %eax
movb %al, %dl
movq -0x8(%rsp), %rax
movq -0x8(%rsp), %rsi
movl 0x322c(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, 0x322c(%rsi)
movl %ecx, %ecx
movb %dl, 0x171798(%rax,%rcx)
jmp 0x5756
movl -0x1c(%rsp), %eax
subl $0xff, %eax
movl %eax, -0x1c(%rsp)
movq -0x8(%rsp), %rax
movq -0x8(%rsp), %rdx
movl 0x322c(%rdx), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, 0x322c(%rdx)
movl %ecx, %ecx
movb $-0x1, 0x171798(%rax,%rcx)
movl -0x1c(%rsp), %eax
shrl $0x0, %eax
movb %al, %dl
movq -0x8(%rsp), %rax
movq -0x8(%rsp), %rsi
movl 0x322c(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, 0x322c(%rsi)
movl %ecx, %ecx
movb %dl, 0x171798(%rax,%rcx)
movl -0x1c(%rsp), %eax
shrl $0x8, %eax
movb %al, %dl
movq -0x8(%rsp), %rax
movq -0x8(%rsp), %rsi
movl 0x322c(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, 0x322c(%rsi)
movl %ecx, %ecx
movb %dl, 0x171798(%rax,%rcx)
movl -0x1c(%rsp), %eax
shrl $0x10, %eax
movb %al, %dl
movq -0x8(%rsp), %rax
movq -0x8(%rsp), %rsi
movl 0x322c(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, 0x322c(%rsi)
movl %ecx, %ecx
movb %dl, 0x171798(%rax,%rcx)
movl $0xf, -0x18(%rsp)
jmp 0x5768
movl -0x14(%rsp), %eax
movl %eax, -0x18(%rsp)
movl -0x18(%rsp), %eax
movb %al, %cl
movq -0x10(%rsp), %rax
movb %cl, (%rax)
movq -0x8(%rsp), %rax
movl -0x18(%rsp), %ecx
movl 0x428(%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, 0x428(%rax,%rcx,4)
retq
// File: /workspace/github_c_makefile_star2_O0/ebiggers[P]xpack/lib/xpack_compress.c
// Function: record_length
static void
record_length(struct xpack_compressor *c, struct match *match, u32 length)
{
	unsigned length_sym;

	length -= MIN_MATCH_LEN;

	if (length >= LENGTH_ALPHABET_SIZE - 1) {
		u32 v = length - (LENGTH_ALPHABET_SIZE - 1);
		if (v < 0xFF) {
			c->extra_bytes[c->num_extra_bytes++] = v;
		} else {
			v -= 0xFF;
			c->extra_bytes[c->num_extra_bytes++] = 0xFF;
			c->extra_bytes[c->num_extra_bytes++] = (u8)(v >> 0);
			c->extra_bytes[c->num_extra_bytes++] = (u8)(v >> 8);
			c->extra_bytes[c->num_extra_bytes++] = (u8)(v >> 16);
		}
		length_sym = LENGTH_ALPHABET_SIZE - 1;
	} else {
		length_sym = length;
	}

	match->length_sym = length_sym;
	c->freqs.length[length_sym]++;
}

// Assembly:
movq %rdi, -0x8(%rsp)
movq %rsi, -0x10(%rsp)
movl %edx, -0x14(%rsp)
movl -0x14(%rsp), %eax
subl $0x2, %eax
movl %eax, -0x14(%rsp)
cmpl $0x3f, -0x14(%rsp)
jb 0x58bb
movl -0x14(%rsp), %eax
subl $0x3f, %eax
movl %eax, -0x1c(%rsp)
cmpl $0xff, -0x1c(%rsp)
jae 0x57f8
movl -0x1c(%rsp), %eax
movb %al, %dl
movq -0x8(%rsp), %rax
movq -0x8(%rsp), %rsi
movl 0x322c(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, 0x322c(%rsi)
movl %ecx, %ecx
movb %dl, 0x171798(%rax,%rcx)
jmp 0x58b1
movl -0x1c(%rsp), %eax
subl $0xff, %eax
movl %eax, -0x1c(%rsp)
movq -0x8(%rsp), %rax
movq -0x8(%rsp), %rdx
movl 0x322c(%rdx), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, 0x322c(%rdx)
movl %ecx, %ecx
movb $-0x1, 0x171798(%rax,%rcx)
movl -0x1c(%rsp), %eax
shrl $0x0, %eax
movb %al, %dl
movq -0x8(%rsp), %rax
movq -0x8(%rsp), %rsi
movl 0x322c(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, 0x322c(%rsi)
movl %ecx, %ecx
movb %dl, 0x171798(%rax,%rcx)
movl -0x1c(%rsp), %eax
shrl $0x8, %eax
movb %al, %dl
movq -0x8(%rsp), %rax
movq -0x8(%rsp), %rsi
movl 0x322c(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, 0x322c(%rsi)
movl %ecx, %ecx
movb %dl, 0x171798(%rax,%rcx)
movl -0x1c(%rsp), %eax
shrl $0x10, %eax
movb %al, %dl
movq -0x8(%rsp), %rax
movq -0x8(%rsp), %rsi
movl 0x322c(%rsi), %ecx
movl %ecx, %edi
addl $0x1, %edi
movl %edi, 0x322c(%rsi)
movl %ecx, %ecx
movb %dl, 0x171798(%rax,%rcx)
movl $0x3f, -0x18(%rsp)
jmp 0x58c3
movl -0x14(%rsp), %eax
movl %eax, -0x18(%rsp)
movl -0x18(%rsp), %eax
movb %al, %cl
movq -0x10(%rsp), %rax
movb %cl, 0x1(%rax)
movq -0x8(%rsp), %rax
movl -0x18(%rsp), %ecx
movl 0x468(%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, 0x468(%rax,%rcx,4)
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/ebiggers[P]xpack/lib/xpack_compress.c
// Function: init_block_split_stats
static void
init_block_split_stats(struct block_split_stats *stats)
{
	int i;

	for (i = 0; i < NUM_OBSERVATION_TYPES; i++) {
		stats->new_observations[i] = 0;
		stats->observations[i] = 0;
	}
	stats->num_new_observations = 0;
	stats->num_observations = 0;
}

// Assembly:
movq %rdi, -0x8(%rsp)
movl $0x0, -0xc(%rsp)
cmpl $0xa, -0xc(%rsp)
jge 0x5f44
movq -0x8(%rsp), %rax
movslq -0xc(%rsp), %rcx
movl $0x0, (%rax,%rcx,4)
movq -0x8(%rsp), %rax
movslq -0xc(%rsp), %rcx
movl $0x0, 0x28(%rax,%rcx,4)
movl -0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rsp)
jmp 0x5f0d
movq -0x8(%rsp), %rax
movl $0x0, 0x50(%rax)
movq -0x8(%rsp), %rax
movl $0x0, 0x54(%rax)
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/ebiggers[P]xpack/lib/xpack_compress.c
// Function: do_end_block_check
static bool
do_end_block_check(struct block_split_stats *stats, u32 block_size)
{
	int i;

	if (stats->num_observations > 0) {

		/* Note: to avoid slow divisions, we do not divide by
		 * 'num_observations', but rather do all math with the numbers
		 * multiplied by 'num_observations'.  */
		u32 total_delta = 0;
		for (i = 0; i < NUM_OBSERVATION_TYPES; i++) {
			u32 expected = stats->observations[i] * stats->num_new_observations;
			u32 actual = stats->new_observations[i] * stats->num_observations;
			u32 delta = (actual > expected) ? actual - expected :
							  expected - actual;
			total_delta += delta;
		}

		/* Ready to end the block? */
		if (total_delta + (block_size >> 12) * stats->num_observations >=
		    200 * stats->num_observations)
			return true;
	}

	for (i = 0; i < NUM_OBSERVATION_TYPES; i++) {
		stats->num_observations += stats->new_observations[i];
		stats->observations[i] += stats->new_observations[i];
		stats->new_observations[i] = 0;
	}
	stats->num_new_observations = 0;
	return false;
}

// Assembly:
movq %rdi, -0x10(%rsp)
movl %esi, -0x14(%rsp)
movq -0x10(%rsp), %rax
cmpl $0x0, 0x54(%rax)
jbe 0x603b
movl $0x0, -0x1c(%rsp)
movl $0x0, -0x18(%rsp)
cmpl $0xa, -0x18(%rsp)
jge 0x600c
movq -0x10(%rsp), %rax
movslq -0x18(%rsp), %rcx
movl 0x28(%rax,%rcx,4), %eax
movq -0x10(%rsp), %rcx
imull 0x50(%rcx), %eax
movl %eax, -0x20(%rsp)
movq -0x10(%rsp), %rax
movslq -0x18(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movq -0x10(%rsp), %rcx
imull 0x54(%rcx), %eax
movl %eax, -0x24(%rsp)
movl -0x24(%rsp), %eax
cmpl -0x20(%rsp), %eax
jbe 0x5fdc
movl -0x24(%rsp), %eax
subl -0x20(%rsp), %eax
movl %eax, -0x2c(%rsp)
jmp 0x5fe8
movl -0x20(%rsp), %eax
subl -0x24(%rsp), %eax
movl %eax, -0x2c(%rsp)
movl -0x2c(%rsp), %eax
movl %eax, -0x28(%rsp)
movl -0x28(%rsp), %eax
addl -0x1c(%rsp), %eax
movl %eax, -0x1c(%rsp)
movl -0x18(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rsp)
jmp 0x5f88
movl -0x1c(%rsp), %eax
movl -0x14(%rsp), %ecx
shrl $0xc, %ecx
movq -0x10(%rsp), %rdx
imull 0x54(%rdx), %ecx
addl %ecx, %eax
movq -0x10(%rsp), %rcx
imull $0xc8, 0x54(%rcx), %ecx
cmpl %ecx, %eax
jb 0x6039
movb $0x1, -0x1(%rsp)
jmp 0x60b0
jmp 0x603b
movl $0x0, -0x18(%rsp)
cmpl $0xa, -0x18(%rsp)
jge 0x609f
movq -0x10(%rsp), %rax
movslq -0x18(%rsp), %rcx
movl (%rax,%rcx,4), %ecx
movq -0x10(%rsp), %rax
addl 0x54(%rax), %ecx
movl %ecx, 0x54(%rax)
movq -0x10(%rsp), %rax
movslq -0x18(%rsp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x10(%rsp), %rax
movslq -0x18(%rsp), %rcx
addl 0x28(%rax,%rcx,4), %edx
movl %edx, 0x28(%rax,%rcx,4)
movq -0x10(%rsp), %rax
movslq -0x18(%rsp), %rcx
movl $0x0, (%rax,%rcx,4)
movl -0x18(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rsp)
jmp 0x6043
movq -0x10(%rsp), %rax
movl $0x0, 0x50(%rax)
movb $0x0, -0x1(%rsp)
movb -0x1(%rsp), %al
andb $0x1, %al
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/ebiggers[P]xpack/lib/xpack_compress.c
// Function: choose_block_type
static int
choose_block_type(struct xpack_compressor *c)
{
	u32 min_count = -1;
	u32 max_count = 0;
	unsigned sym;

	for (sym = 0; sym < ALIGNED_ALPHABET_SIZE; sym++) {
		min_count = MIN(min_count, c->freqs.aligned[sym]);
		max_count = MAX(max_count, c->freqs.aligned[sym]);
	}

	if (min_count * 3 < max_count) /* unbalanced? */
		return BLOCKTYPE_ALIGNED;
	else
		return BLOCKTYPE_VERBATIM;
}

// Assembly:
movq %rdi, -0x10(%rsp)
movl $0xffffffff, -0x14(%rsp) # imm = 0xFFFFFFFF
movl $0x0, -0x18(%rsp)
movl $0x0, -0x1c(%rsp)
cmpl $0x8, -0x1c(%rsp)
jae 0x6170
movl -0x14(%rsp), %eax
movq -0x10(%rsp), %rcx
movl -0x1c(%rsp), %edx
cmpl 0x5e8(%rcx,%rdx,4), %eax
ja 0x6108
movl -0x14(%rsp), %eax
movl %eax, -0x20(%rsp)
jmp 0x611c
movq -0x10(%rsp), %rax
movl -0x1c(%rsp), %ecx
movl 0x5e8(%rax,%rcx,4), %eax
movl %eax, -0x20(%rsp)
movl -0x20(%rsp), %eax
movl %eax, -0x14(%rsp)
movl -0x18(%rsp), %eax
movq -0x10(%rsp), %rcx
movl -0x1c(%rsp), %edx
cmpl 0x5e8(%rcx,%rdx,4), %eax
jb 0x6144
movl -0x18(%rsp), %eax
movl %eax, -0x24(%rsp)
jmp 0x6158
movq -0x10(%rsp), %rax
movl -0x1c(%rsp), %ecx
movl 0x5e8(%rax,%rcx,4), %eax
movl %eax, -0x24(%rsp)
movl -0x24(%rsp), %eax
movl %eax, -0x18(%rsp)
movl -0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rsp)
jmp 0x60dd
imull $0x3, -0x14(%rsp), %eax
cmpl -0x18(%rsp), %eax
jae 0x6185
movl $0x2, -0x4(%rsp)
jmp 0x618d
movl $0x1, -0x4(%rsp)
movl -0x4(%rsp), %eax
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/ebiggers[P]xpack/lib/xpack_compress.c
// Function: header_ostream_init
static void
header_ostream_init(struct header_ostream *os,
		    void *out, size_t out_nbytes_avail)
{
	os->bitbuf = 0;
	os->bitcount = 0;
	os->begin = out;
	os->next = os->begin;
	os->end = os->next + out_nbytes_avail;
}

// Assembly:
movq %rdi, -0x8(%rsp)
movq %rsi, -0x10(%rsp)
movq %rdx, -0x18(%rsp)
movq -0x8(%rsp), %rax
movq $0x0, (%rax)
movq -0x8(%rsp), %rax
movl $0x0, 0x8(%rax)
movq -0x10(%rsp), %rcx
movq -0x8(%rsp), %rax
movq %rcx, 0x10(%rax)
movq -0x8(%rsp), %rax
movq 0x10(%rax), %rcx
movq -0x8(%rsp), %rax
movq %rcx, 0x18(%rax)
movq -0x8(%rsp), %rax
movq 0x18(%rax), %rcx
addq -0x18(%rsp), %rcx
movq -0x8(%rsp), %rax
movq %rcx, 0x20(%rax)
retq
nop
// File: /workspace/github_c_makefile_star2_O0/ebiggers[P]xpack/lib/xpack_compress.c
// Function: header_ostream_write_bits
static void
header_ostream_write_bits(struct header_ostream *os,
			  machine_word_t bits, unsigned num_bits)
{
	/*
	 * We only flush 'bitbuf' when it completely fills up.  This improves
	 * performance.
	 */
	os->bitbuf |= bits << os->bitcount;
	os->bitcount += num_bits;
	if (os->bitcount >= WORDBITS) {
		if (os->end - os->next >= WORDBYTES) {
			put_unaligned_leword(os->bitbuf, os->next);
			os->next += WORDBYTES;
		} else {
			os->next = os->end;
		}
		os->bitcount -= WORDBITS;
		os->bitbuf = bits >> (num_bits - os->bitcount);
	}
}

// Assembly:
movq %rdi, -0x38(%rsp)
movq %rsi, -0x40(%rsp)
movl %edx, -0x44(%rsp)
movq -0x40(%rsp), %rax
movq -0x38(%rsp), %rcx
movl 0x8(%rcx), %ecx
shlq %cl, %rax
movq %rax, %rcx
movq -0x38(%rsp), %rax
orq (%rax), %rcx
movq %rcx, (%rax)
movl -0x44(%rsp), %ecx
movq -0x38(%rsp), %rax
addl 0x8(%rax), %ecx
movl %ecx, 0x8(%rax)
movq -0x38(%rsp), %rax
cmpl $0x40, 0x8(%rax)
jb 0x6309
movq -0x38(%rsp), %rax
movq 0x20(%rax), %rax
movq -0x38(%rsp), %rcx
movq 0x18(%rcx), %rcx
subq %rcx, %rax
cmpq $0x8, %rax
jl 0x62c8
movq -0x38(%rsp), %rax
movq (%rax), %rcx
movq -0x38(%rsp), %rax
movq 0x18(%rax), %rax
movq %rcx, -0x28(%rsp)
movq %rax, -0x30(%rsp)
movq -0x28(%rsp), %rcx
movq -0x30(%rsp), %rax
movq %rcx, -0x18(%rsp)
movq %rax, -0x20(%rsp)
movq -0x18(%rsp), %rcx
movq -0x20(%rsp), %rax
movq %rcx, -0x8(%rsp)
movq %rax, -0x10(%rsp)
movq -0x8(%rsp), %rcx
movq -0x10(%rsp), %rax
movq %rcx, (%rax)
movq -0x38(%rsp), %rax
movq 0x18(%rax), %rcx
addq $0x8, %rcx
movq %rcx, 0x18(%rax)
jmp 0x62da
movq -0x38(%rsp), %rax
movq 0x20(%rax), %rcx
movq -0x38(%rsp), %rax
movq %rcx, 0x18(%rax)
movq -0x38(%rsp), %rax
movl 0x8(%rax), %ecx
subl $0x40, %ecx
movl %ecx, 0x8(%rax)
movq -0x40(%rsp), %rax
movl -0x44(%rsp), %ecx
movq -0x38(%rsp), %rdx
subl 0x8(%rdx), %ecx
movl %ecx, %ecx
shrq %cl, %rax
movq %rax, %rcx
movq -0x38(%rsp), %rax
movq %rcx, (%rax)
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/ebiggers[P]xpack/lib/xpack_compress.c
// Function: write_block_size
static void
write_block_size(struct header_ostream *os, u32 block_size)
{
	u32 bits;
	int num_bits;

	if (block_size == DEFAULT_BLOCK_SIZE) {
		bits = 1;
		num_bits = 1;
	} else {
		bits = block_size << 1;
		num_bits = 1 + NUM_BLOCKSIZE_BITS;
	}

	header_ostream_write_bits(os, bits, num_bits);
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movl %esi, 0xc(%rsp)
cmpl $0x8000, 0xc(%rsp)      # imm = 0x8000
jne 0x6339
movl $0x1, 0x8(%rsp)
movl $0x1, 0x4(%rsp)
jmp 0x634b
movl 0xc(%rsp), %eax
shll %eax
movl %eax, 0x8(%rsp)
movl $0x15, 0x4(%rsp)
movq 0x10(%rsp), %rdi
movl 0x8(%rsp), %eax
movl %eax, %esi
movl 0x4(%rsp), %edx
callq 0x6200
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/ebiggers[P]xpack/lib/xpack_compress.c
// Function: choose_state_counts
static unsigned
choose_state_counts(const u32 freqs[], unsigned alphabet_size,
		    unsigned max_log2_num_states, u16 state_counts[])
{
	u32 total_freq = 0;
	unsigned num_used_syms = 0;
	unsigned log2_num_states;
	unsigned sym;

	/* Compute the total frequency and the number of used symbols. */
	for (sym = 0; sym < alphabet_size; sym++) {
		if (freqs[sym] != 0) {
			num_used_syms++;
			total_freq += freqs[sym];
		}
	}

	/*
	 * If no symbols from this alphabet were used, then output a code that
	 * contains an arbitrary unused symbol.
	 */
	if (total_freq == 0) {
		state_counts[0] = 1;
		for (sym = 1; sym < alphabet_size; sym++)
			state_counts[sym] = 0;
		return 0;
	}

	/* Select the number of states to use. */
	log2_num_states = select_log2_num_states(total_freq, num_used_syms,
						 max_log2_num_states);

	/* Decide how many states to assign to each symbol. */
	compute_state_counts(freqs, total_freq, state_counts,
			     alphabet_size, log2_num_states);

	return log2_num_states;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movl %esi, 0x24(%rsp)
movl %edx, 0x20(%rsp)
movq %rcx, 0x18(%rsp)
movl $0x0, 0x14(%rsp)
movl $0x0, 0x10(%rsp)
movl $0x0, 0x8(%rsp)
movl 0x8(%rsp), %eax
cmpl 0x24(%rsp), %eax
jae 0x63e5
movq 0x28(%rsp), %rax
movl 0x8(%rsp), %ecx
cmpl $0x0, (%rax,%rcx,4)
je 0x63d6
movl 0x10(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x10(%rsp)
movq 0x28(%rsp), %rax
movl 0x8(%rsp), %ecx
movl (%rax,%rcx,4), %eax
addl 0x14(%rsp), %eax
movl %eax, 0x14(%rsp)
jmp 0x63d8
movl 0x8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8(%rsp)
jmp 0x639e
cmpl $0x0, 0x14(%rsp)
jne 0x642e
movq 0x18(%rsp), %rax
movw $0x1, (%rax)
movl $0x1, 0x8(%rsp)
movl 0x8(%rsp), %eax
cmpl 0x24(%rsp), %eax
jae 0x6424
movq 0x18(%rsp), %rax
movl 0x8(%rsp), %ecx
movw $0x0, (%rax,%rcx,2)
movl 0x8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x8(%rsp)
jmp 0x63fe
movl $0x0, 0x34(%rsp)
jmp 0x6467
movl 0x14(%rsp), %edi
movl 0x10(%rsp), %esi
movl 0x20(%rsp), %edx
callq 0x9030
movl %eax, 0xc(%rsp)
movq 0x28(%rsp), %rdi
movl 0x14(%rsp), %esi
movq 0x18(%rsp), %rdx
movl 0x24(%rsp), %ecx
movl 0xc(%rsp), %r8d
callq 0x90e0
movl 0xc(%rsp), %eax
movl %eax, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq