LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/stetre[P]moongl/src/whole_framebuffer.c
// Function: ClearColor
static int ClearColor(lua_State *L)
    {
    GLfloat color[4];
    checkcolor(L, 1, color);
    glClearColor(color[0], color[1], color[2], color[3]);
    CheckError(L);
    return 0;
    }

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq %rsp, %r14
movl $0x1, %esi
movq %r14, %rdx
callq 0x113f0
movss (%r14), %xmm0
movss 0x4(%r14), %xmm1
movss 0x8(%r14), %xmm2
movss 0xc(%r14), %xmm3
callq 0x11380
movq %rbx, %rdi
callq 0x11870
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/stetre[P]moongl/src/whole_framebuffer.c
// Function: DrawBuffers
static int DrawBuffers(lua_State *L)
    {
    int named, arg = 1;
    GLuint framebuffer = 0;
    GLsizei n;
    GLenum *bufs;
    if(lua_isinteger(L, arg))
        {
        named = 1;
        framebuffer = luaL_checkinteger(L, arg++);
        }
    else
        named = 0;
    bufs = CheckBufList(L, arg, &n);
    if(named)
        glNamedFramebufferDrawBuffers(framebuffer, n, bufs);
    else
        glDrawBuffers(n, bufs);
    Free(L, bufs);
    CheckError(L);
    return 0;
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x1, %esi
callq 0x115b0
testl %eax, %eax
je 0x3df17
movq %rbx, %rdi
movl $0x1, %esi
callq 0x11af0
movq %rax, %r15
leaq 0x4(%rsp), %r12
movq %rbx, %rdi
movl $0x2, %esi
movq %r12, %rdx
callq 0x3e176
movq %rax, %r14
movq 0x18c57(%rip), %rax     # 0x56b60
movl (%r12), %esi
movl %r15d, %edi
movq %r14, %rdx
callq *(%rax)
jmp 0x3df3e
leaq 0x4(%rsp), %r15
movq %rbx, %rdi
movl $0x1, %esi
movq %r15, %rdx
callq 0x3e176
movq %rax, %r14
movq 0x18eba(%rip), %rax     # 0x56df0
movl (%r15), %edi
movq %r14, %rsi
callq *(%rax)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x11360
movq %rbx, %rdi
callq 0x11870
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/stetre[P]moongl/src/whole_framebuffer.c
// Function: ClearBufferfi
static int ClearBufferfi(lua_State *L)
/* clear_bufferfi(depth, stencil)
 */
    {
    int named, arg = 1;
    GLuint framebuffer;
    GLfloat depth;
    GLint stencil;
    if(lua_isinteger(L, 1))
        {
        named = 1;
        framebuffer = luaL_checkinteger(L, arg++);
        }
    else
        named = 0;
    depth = luaL_checknumber(L, arg++);
    stencil = luaL_checkinteger(L, arg++);
    if(named)
        {
#if 0
/*@@NOTE: The prototype for glClearNamedFramebufferfi() in glcorearb.h is/was wrong,
 *        (rfr: https://www.khronos.org/bugzilla/show_bug.cgi?id=1394 ),
 *        so this may not compile with OpenGL v4.5.
 *      In such a case, you can update the glcorearb.h file on your system with the
 *      correct version, or just disable this function by setting to 0 the above "#if 1".
 */
        glClearNamedFramebufferfi(framebuffer, GL_DEPTH_STENCIL, 0, depth, stencil);
#else
        (void)framebuffer;
        NOT_AVAILABLE;
#endif
        }
    else
        glClearBufferfi(GL_DEPTH_STENCIL, 0, depth, stencil);
    CheckError(L);
    return 0;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x1, %r14d
movl $0x1, %esi
callq 0x115b0
movl %eax, %ebp
testl %eax, %eax
je 0x3e109
movq %rbx, %rdi
movl $0x1, %esi
callq 0x11af0
movl $0x2, %r14d
leal 0x1(%r14), %r15d
movq %rbx, %rdi
movl %r14d, %esi
callq 0x11a80
movsd %xmm0, (%rsp)
movq %rbx, %rdi
movl %r15d, %esi
callq 0x11af0
testl %ebp, %ebp
je 0x3e147
leaq 0x10ae(%rip), %rsi      # 0x3f1e1
movq %rbx, %rdi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x11ae0
xorps %xmm0, %xmm0
cvtsd2ss (%rsp), %xmm0
movq 0x189a2(%rip), %rcx     # 0x56af8
movl $0x84f9, %edi           # imm = 0x84F9
xorl %esi, %esi
movl %eax, %edx
callq *(%rcx)
movq %rbx, %rdi
callq 0x11870
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/stetre[P]moongl/src/whole_framebuffer.c
// Function: CheckBufList
static GLenum* CheckBufList(lua_State *L, int arg, GLsizei *n)
/* the caller must Free() the returned bufs */
    {
    GLenum *bufs;
    int i, err;
    if(lua_istable(L, arg))
        {
        *n = luaL_len(L, arg);
        if(*n==0) /* raise an error */
            checkbuffer(L, arg);
        bufs = (GLenum*)Malloc(L, (*n)*sizeof(GLenum));
        for(i = 0; i < (*n); i++)
            {
            lua_rawgeti(L, arg, i+1);
            bufs[i] = testbuffer(L, -1, &err);
            if(err) /* raise an error */
                { Free(L, bufs); checkbuffer(L, -1); }
            lua_pop(L, 1);
            }
        }
    else
        {
        i = arg;
        while(!lua_isnoneornil(L, i))
            { checkbuffer(L, i); i++; }
        if(i==arg) /* raise an error */
            checkbuffer(L, arg);
        *n = i - arg;
        bufs = (GLenum*)Malloc(L, (*n)*sizeof(GLenum));
        i = 0;
        for(i = 0; i < (*n); i++)
            bufs[i] = checkbuffer(L, arg + i);
        }
    return bufs;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
callq 0x11850
movq %r14, %rdi
movl %ebp, %esi
cmpl $0x5, %eax
jne 0x3e242
callq 0x11220
movl %eax, (%rbx)
testl %eax, %eax
jne 0x3e1b8
movq %r14, %rdi
movl $0x4f, %esi
movl %ebp, %edx
callq 0x11150
movl (%rbx), %eax
movslq %eax, %rsi
shlq $0x2, %rsi
movq %r14, %rdi
callq 0x111f0
movq %rax, %r15
cmpl $0x0, (%rbx)
jle 0x3e2d0
xorl %r13d, %r13d
movq %r13, %r12
incq %r13
movq %r14, %rdi
movl %ebp, %esi
movq %r13, %rdx
callq 0x11400
movq %r14, %rdi
movl $0x4f, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
leaq 0x4(%rsp), %rcx
callq 0x11410
movl %eax, (%r15,%r12,4)
cmpl $0x0, 0x4(%rsp)
je 0x3e228
movq %r14, %rdi
movq %r15, %rsi
callq 0x11360
movq %r14, %rdi
movl $0x4f, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x11150
movq %r14, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x116b0
movslq (%rbx), %rax
cmpq %rax, %r13
jl 0x3e1d6
jmp 0x3e2d0
callq 0x11850
movl %ebp, %r15d
testl %eax, %eax
jle 0x3e27e
xorl %r12d, %r12d
movl %ebp, %r15d
movq %r14, %rdi
movl $0x4f, %esi
movl %r15d, %edx
callq 0x11150
incl %r15d
movq %r14, %rdi
movl %r15d, %esi
callq 0x11850
decl %r12d
testl %eax, %eax
jg 0x3e254
testl %r12d, %r12d
jne 0x3e28d
movq %r14, %rdi
movl $0x4f, %esi
movl %ebp, %edx
callq 0x11150
subl %ebp, %r15d
movl %r15d, (%rbx)
movslq %r15d, %rsi
shlq $0x2, %rsi
movq %r14, %rdi
callq 0x111f0
movq %rax, %r15
cmpl $0x0, (%rbx)
jle 0x3e2d0
movl %ebp, %r12d
xorl %r13d, %r13d
leal (%r12,%r13), %edx
movq %r14, %rdi
movl $0x4f, %esi
callq 0x11150
movl %eax, (%r15,%r13,4)
incq %r13
movslq (%rbx), %rax
cmpq %rax, %r13
jl 0x3e2b0
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/Joy-Division[P]tools-mgs/dat-extract_enc.c
// Function: getDictionary
void getDictionary(dicentry **dic, int *num, char *path, char *name, unsigned int flags) {
	char tempname[256], *token = NULL;
	int i, j;
	if(flags & GAME_MGS2) *num = loaddic(dic, path, name, DIC_HASH_SINGLE_EXT | DIC_ADJUST_EXT_MGS2, StrCode24);
	if(flags & GAME_ZOE2) *num = loaddic(dic, path, name, DIC_HASH_FULL_NAME, StrCode32);
	if(flags & (GAME_MGS3|GAME_MGS4)) {
		*num = loaddic(dic, path, name, DIC_USE_EXTERNAL, StrCode24);
		for(i = 0; i < *num; i++) {
			strcpy(tempname, (*dic)[i].name);
			token = strtok(tempname, ".");
			token = strtok(NULL, ".");
			for(j = 0; j < 256; j++) {
				if(!strcmp(token, extList[(flags & GAME_MGS4) ? 1 : 0][j])) {
					(*dic)[i].extension = j;
					printf("set extension of entry %d to %08x\n", i, j);
					break;
				}
			}
			if(j > 255) printf("unknown extension %s\n", token);
		}
	}
	if(*num > 0) numdicentries += *num;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movl %r8d, %ebx
movq %rcx, %r12
movq %rdx, %r13
movq %rsi, (%rsp)
movq %rdi, 0x8(%rsp)
testb $0x1, %bl
je 0x5726
leaq -0x3a9(%rip), %r8       # 0x5362
movq 0x8(%rsp), %rdi
movq %r13, %rsi
movq %r12, %rdx
movl $0xa, %ecx
callq 0x53d8
movq (%rsp), %rcx
movl %eax, (%rcx)
testb $0x8, %bl
je 0x574d
leaq -0x39b(%rip), %r8       # 0x5397
movq 0x8(%rsp), %rdi
movq %r13, %rsi
movq %r12, %rdx
movl $0x1, %ecx
callq 0x53d8
movq (%rsp), %rcx
movl %eax, (%rcx)
testb $0x6, %bl
je 0x5842
leaq -0x3fb(%rip), %r8       # 0x5362
movq 0x8(%rsp), %rdi
movq %r13, %rsi
movq %r12, %rdx
movl $0x4, %ecx
callq 0x53d8
movq (%rsp), %rcx
movl %eax, (%rcx)
testl %eax, %eax
jle 0x5852
andl $0x4, %ebx
shll $0x9, %ebx
leaq 0x59c3(%rip), %r13      # 0xb150
xorl %ebp, %ebp
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq %rbp, %rcx
shlq $0x8, %rcx
leaq (%rcx,%rbp,8), %r15
leaq (%rax,%r15), %rsi
addq $0x8, %rsi
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x5050
movq %r14, %rdi
leaq 0x3398(%rip), %r14      # 0x8b59
movq %r14, %rsi
callq 0x51e0
xorl %edi, %edi
movq %r14, %rsi
callq 0x51e0
movq %rax, %r12
xorl %r14d, %r14d
leaq (%rbx,%r14,8), %rax
movq (%r13,%rax), %rsi
movq %r12, %rdi
callq 0x5140
testl %eax, %eax
je 0x580d
incq %r14
cmpq $0x100, %r14            # imm = 0x100
jne 0x57d9
leaq 0x2d90(%rip), %rdi      # 0x8591
movq %r12, %rsi
xorl %eax, %eax
callq 0x50c0
jmp 0x582d
movq 0x8(%rsp), %rax
movq (%rax), %rax
movl %r14d, 0x4(%rax,%r15)
leaq 0x2d4d(%rip), %rdi      # 0x856e
movl %ebp, %esi
movl %r14d, %edx
xorl %eax, %eax
callq 0x50c0
incq %rbp
movq (%rsp), %rax
movslq (%rax), %rax
cmpq %rax, %rbp
jl 0x578f
jmp 0x5848
movq (%rsp), %rax
movl (%rax), %eax
testl %eax, %eax
jle 0x5852
addl %eax, 0x6a3e(%rip)      # 0xc290
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Joy-Division[P]tools-mgs/dat-extract_enc.c
// Function: getExtensionFromHash32
char *getExtensionFromHash32(uint32_t hash) {
	char *retstring = malloc(16);
	memset(retstring, 0, 16);
	unsigned int i, testhash;
	for(i = 0; i < ZOE2_NUM_EXT; i++) {
		testhash = StrCode32(extListZoe2[i]);
		if(testhash == hash) RETPRINT(extListZoe2[i])
	}
	if(strlen(retstring) < 3) sprintf(retstring, "%08x", hash);
	return retstring;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl %edi, %ebx
movl $0x1, %edi
movl $0x10, %esi
callq 0x5130
movq %rax, %r14
xorl %r15d, %r15d
leaq 0x6897(%rip), %r12      # 0xc150
movq (%r15,%r12), %rdi
callq 0x5397
cmpl %ebx, %eax
je 0x58d5
addq $0x8, %r15
cmpq $0xd8, %r15
jne 0x58b9
jmp 0x58e1
movq (%r15,%r12), %rsi
movq %r14, %rdi
callq 0x5050
movq %r14, %rdi
callq 0x50b0
cmpq $0x2, %rax
ja 0x5902
leaq 0x2cb1(%rip), %rsi      # 0x85a7
movq %r14, %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0x5220
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/Joy-Division[P]tools-mgs/dat-extract_enc.c
// Function: getFolderNameFromHash
char *getFolderNameFromHash(uint32_t hash, unsigned int flags) {
	char *retstring = malloc(16);
	switch(hash) {
		case 0x7F000010: RETPRINT("sound")
		case 0x7F010000: RETPRINT("nocache")
		case 0x7F000002: RETPRINT("cache")
		case 0x7F000003: RETPRINT("resident")
		case 0x7F000004: RETPRINT(flags & GAME_TTS ? "tts-04" : "delayload")
		case 0x7F000005: RETPRINT(flags & GAME_TTS ? "tts-05" : "delayload_w")
		default: {
			sprintf(retstring, "%08x", hash);
			break;
		}
	}
	return retstring;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movl %edi, %r14d
movl $0x10, %edi
callq 0x5170
movq %rax, %rbx
leal -0x7f000002(%r14), %eax
cmpl $0x3, %eax
ja 0x5954
leaq 0x277e(%rip), %rcx      # 0x80b8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movw $0x65, 0x4(%rbx)
movl $0x68636163, (%rbx)     # imm = 0x68636163
jmp 0x59e0
cmpl $0x7f010000, %r14d      # imm = 0x7F010000
je 0x5974
cmpl $0x7f000010, %r14d      # imm = 0x7F000010
jne 0x5997
movw $0x64, 0x4(%rbx)
movl $0x6e756f73, (%rbx)     # imm = 0x6E756F73
jmp 0x59e0
movabsq $0x65686361636f6e, %rax # imm = 0x65686361636F6E
movq %rax, (%rbx)
jmp 0x59e0
testb $0x10, %bpl
leaq 0x2c3a(%rip), %rax      # 0x85c8
leaq 0x2c2c(%rip), %rsi      # 0x85c1
jmp 0x59bf
leaq 0x2c09(%rip), %rsi      # 0x85a7
movq %rbx, %rdi
movl %r14d, %edx
xorl %eax, %eax
callq 0x5220
jmp 0x59e0
testb $0x10, %bpl
leaq 0x2c21(%rip), %rax      # 0x85d9
leaq 0x2c13(%rip), %rsi      # 0x85d2
cmoveq %rax, %rsi
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x5050
movabsq $0x746e656469736572, %rax # imm = 0x746E656469736572
movq %rax, (%rbx)
movb $0x0, 0x8(%rbx)
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Joy-Division[P]tools-mgs/dat-extract_enc.c
// Function: getFileNameFromHashes
char *getFileNameFromHashes(uint32_t hash, uint32_t extension, unsigned int flags) {
	char *retstring = malloc(64);
	char *extensionstring = NULL;
	unsigned int result = matchhash(hash, extension, stagedic, numstagedic);
	if(result != 0xFFFFFFFF) sprintf(retstring, "%s", stagedic[result].name);
	else {
		result = matchhash(hash, extension, commondic, numcommondic);
		if(result != 0xFFFFFFFF) sprintf(retstring, "%s", commondic[result].name);
		else {
			if(flags & GAME_MGS2) sprintf(retstring, "%08x.%c", hash, extension+0x61 /* 'a' */);
			/* see extlist comment for info on how games are sorted */
			else if(flags & (GAME_MGS3|GAME_MGS4)) sprintf(retstring, "%08x.%s", hash, extList[(flags & GAME_MGS4) ? 1 : 0][extension]);
			else if(flags & GAME_ZOE2) {
				extensionstring = getExtensionFromHash32(extension);
				sprintf(retstring, "%08x.%s", hash, extensionstring);
				free(extensionstring);
			}
		}
	}
	return retstring;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %r15d
movl %esi, %r14d
movl %edi, %ebp
movl $0x40, %edi
callq 0x5170
movq %rax, %rbx
movslq 0x6881(%rip), %rax      # 0xc28c
testq %rax, %rax
jle 0x5a32
movq 0x6869(%rip), %rsi      # 0xc280
addq $0x8, %rsi
cmpl %ebp, -0x8(%rsi)
jne 0x5a26
cmpl %r14d, -0x4(%rsi)
je 0x5a9a
addq $0x108, %rsi            # imm = 0x108
decq %rax
jne 0x5a1b
movslq 0x684f(%rip), %rax      # 0xc288
testq %rax, %rax
jle 0x5a60
movq 0x6833(%rip), %rsi      # 0xc278
addq $0x8, %rsi
cmpl %ebp, -0x8(%rsi)
jne 0x5a54
cmpl %r14d, -0x4(%rsi)
je 0x5a9a
addq $0x108, %rsi            # imm = 0x108
decq %rax
jne 0x5a49
testb $0x1, %r15b
jne 0x5aac
testb $0x6, %r15b
je 0x5ad4
movl %r14d, %eax
andl $0x4, %r15d
shll $0x9, %r15d
leaq 0x56d2(%rip), %rcx      # 0xb150
addq %r15, %rcx
movq (%rcx,%rax,8), %rcx
leaq 0x2b61(%rip), %rsi      # 0x85ed
movq %rbx, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0x5220
jmp 0x5ac6
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5050
addl $0x61, %r14d
leaq 0x2b2e(%rip), %rsi      # 0x85e5
movq %rbx, %rdi
movl %ebp, %edx
movl %r14d, %ecx
xorl %eax, %eax
callq 0x5220
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
testb $0x8, %r15b
je 0x5ac6
movl %r14d, %edi
callq 0x5893
movq %rax, %r14
leaq 0x2b01(%rip), %rsi      # 0x85ed
movq %rbx, %rdi
movl %ebp, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0x5220
movq %r14, %rdi
callq 0x5030
jmp 0x5ac6
// File: /workspace/github_c_makefile_star2_O3/Joy-Division[P]tools-mgs/dat-extract_enc.c
// Function: decryptHeader
unsigned int decryptHeader(unsigned char *data, unsigned int length, unsigned int flags) {
	uint32_t *values = (uint32_t *)data;
	uint32_t seed, workkey;
	if(flags & IS_BIGENDIAN) workkey = initialkeybig;
	else workkey = initialkey;
	unsigned int i;
	for(i = 0; i < length ;i++) {
		seed = workkey * key1;
		values[i] ^= workkey;
		if(flags & IS_BIGENDIAN) workkey = seed + (initialkeybig ^ 0x0000F0F0);
		else workkey = seed + (initialkey ^ 0x0000F0F0);
	}
	return 1;
}

// Assembly:
testb $0x14, %dl
leaq 0x6761(%rip), %rcx      # 0xc270
leaq 0x675e(%rip), %rax      # 0xc274
cmoveq %rcx, %rax
testl %esi, %esi
je 0x5b48
movl (%rax), %edx
movl %esi, %ecx
xorl %esi, %esi
movl $0xf0f0, %r8d           # imm = 0xF0F0
movl 0x55ff(%rip), %r9d      # 0xb130
imull %edx, %r9d
xorl %edx, (%rdi,%rsi,4)
movl (%rax), %edx
xorl %r8d, %edx
addl %r9d, %edx
incq %rsi
cmpq %rsi, %rcx
jne 0x5b2a
movl $0x1, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/Joy-Division[P]tools-mgs/dat-extract_enc.c
// Function: decryptStage
unsigned int decryptStage(unsigned char *data, unsigned int length, char *name, unsigned int flags) {
	uint32_t *values = (uint32_t *)data;
	uint32_t seed, workkey, namehash, workkeyt;
	unsigned int i;
	if(flags & GAME_ZOE2) namehash = StrCode32(name);
	else namehash = StrCode24(name);
	workkeyt = (namehash << 0x07) + namehash + key2;
	if(flags & IS_BIGENDIAN) workkey = (namehash << 0x07) + initialkeybig + namehash + key34;
	else workkey = (namehash << 0x07) + initialkey + namehash + key34;
	for(i = 0; i < length; i++) {
		seed = workkey * key1;
		values[i] ^= workkey;
		workkey = seed + workkeyt;
	}
	return 1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %ecx, %r14d
movl %esi, %ebp
movq %rdi, %rbx
movq %rdx, %rdi
testb $0x8, %r14b
jne 0x5b6a
callq 0x5362
jmp 0x5b6f
callq 0x5397
testl %ebp, %ebp
je 0x5bbc
movl %eax, %ecx
shll $0x7, %ecx
addl %eax, %ecx
movl 0x55b4(%rip), %eax      # 0xb134
addl %ecx, %eax
testb $0x14, %r14b
leaq 0x66e3(%rip), %rdx      # 0xc270
leaq 0x66e0(%rip), %rsi      # 0xc274
cmoveq %rdx, %rsi
addl (%rsi), %ecx
addl 0x5598(%rip), %ecx      # 0xb138
movl %ebp, %edx
xorl %esi, %esi
movl 0x5586(%rip), %edi      # 0xb130
imull %ecx, %edi
xorl %ecx, (%rbx,%rsi,4)
addl %eax, %edi
incq %rsi
movl %edi, %ecx
cmpq %rsi, %rdx
jne 0x5ba4
movl $0x1, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Joy-Division[P]tools-mgs/dat-extract_enc.c
// Function: decryptContent
unsigned int decryptContent(unsigned char *data, unsigned int length) {
	uint32_t *values = (uint32_t *)data;
	uint32_t seed, workkey, workkeyt, workkeyv;
	unsigned int i;
	workkeyv = key5 ^ key6;
	workkeyt = workkeyv * key7;
	workkey = workkeyv | ((workkeyv ^ key8) << 0x10);
	for(i = 0; i < length; i++) {
		seed = workkey * key1;
		values[i] ^= workkey;
		workkey = seed + workkeyt;
	}
	return 1;
}

// Assembly:
testl %esi, %esi
je 0x5c0c
movl 0x5570(%rip), %edx      # 0xb140
xorl 0x5566(%rip), %edx      # 0xb13c
movl 0x5568(%rip), %eax      # 0xb144
imull %edx, %eax
movl 0x5563(%rip), %ecx      # 0xb148
xorl %edx, %ecx
shll $0x10, %ecx
orl %edx, %ecx
movl %esi, %edx
xorl %esi, %esi
movl 0x5539(%rip), %r8d      # 0xb130
imull %ecx, %r8d
xorl %ecx, (%rdi,%rsi,4)
addl %eax, %r8d
incq %rsi
movl %r8d, %ecx
cmpq %rsi, %rdx
jne 0x5bf0
movl $0x1, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/zhou-yuxin[P]redis-aof-no-cow/deps/lua/src/luac.c
// Function: main
int main(int argc, char* argv[])
{
 lua_State* L;
 struct Smain s;
 int i=doargs(argc,argv);
 argc-=i; argv+=i;
 if (argc<=0) usage("no input files given");
 L=lua_open();
 if (L==NULL) fatal("not enough memory for state");
 s.argc=argc;
 s.argv=argv;
 if (lua_cpcall(L,pmain,&s)!=0) fatal(lua_tostring(L,-1));
 lua_close(L);
 return EXIT_SUCCESS;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movl %edi, %ebx
movq (%rsi), %rax
testq %rax, %rax
je 0x24af
cmpb $0x0, (%rax)
je 0x24af
movq %rax, 0x17ca9(%rip)     # 0x1a158
movl 0x17cc3(%rip), %eax     # 0x1a178
cmpl $0x2, %ebx
jl 0x2590
movl $0x1, %ebp
xorl %r15d, %r15d
leaq 0xfb37(%rip), %rcx      # 0x12004
movslq %ebp, %rdx
movq (%r14,%rdx,8), %rdi
cmpb $0x2d, (%rdi)
jne 0x2598
movzbl 0x1(%rdi), %esi
leal -0x6c(%rsi), %r8d
cmpl $0xa, %r8d
ja 0x2644
movslq (%rcx,%r8,4), %rsi
addq %rcx, %rsi
jmpq *%rsi
cmpb $0x0, 0x2(%rdi)
jne 0x266c
incl %eax
movl %eax, 0x17c6e(%rip)     # 0x1a178
jmp 0x2584
cmpb $0x0, 0x2(%rdi)
jne 0x266c
movq 0x8(%r14,%rdx,8), %rdx
movq %rdx, 0x17c3e(%rip)     # 0x1a160
testq %rdx, %rdx
je 0x2671
incl %ebp
movzbl (%rdx), %esi
cmpl $0x2d, %esi
je 0x2573
testl %esi, %esi
jne 0x2584
jmp 0x2671
cmpb $0x0, 0x2(%rdi)
jne 0x266c
movb $0x1, 0x17c31(%rip)     # 0x1a180
jmp 0x2584
cmpb $0x0, 0x2(%rdi)
jne 0x266c
incl %r15d
jmp 0x2584
cmpb $0x0, 0x2(%rdi)
jne 0x266c
movb $0x1, 0x17c0b(%rip)     # 0x1a17c
jmp 0x2584
cmpb $0x0, 0x1(%rdx)
jne 0x2584
movq $0x0, 0x17bdc(%rip) # 0x1a160
incl %ebp
cmpl %ebx, %ebp
jl 0x24cd
jmp 0x2598
xorl %r15d, %r15d
movl $0x1, %ebp
cmpl %ebx, %ebp
jne 0x25c4
testl %eax, %eax
jne 0x25ab
testb $0x1, 0x17bd5(%rip)     # 0x1a17c
movl %ebx, %ebp
je 0x25c4
movb $0x1, 0x17bca(%rip)     # 0x1a17c
leal -0x1(%rbx), %ebp
movslq %ebx, %rax
leaq 0x17ba9(%rip), %rcx     # 0x1a168
movq %rcx, -0x8(%r14,%rax,8)
testl %r15d, %r15d
je 0x25f1
leaq 0xfaa5(%rip), %rdi      # 0x12075
leaq 0xfaa6(%rip), %rsi      # 0x1207d
leaq 0xfaa9(%rip), %rdx      # 0x12087
xorl %eax, %eax
callq 0x20f0
leal -0x1(%rbx), %eax
cmpl %eax, %r15d
je 0x2693
subl %ebp, %ebx
jle 0x267d
callq 0xf5de
testq %rax, %rax
je 0x2689
movq %rax, %r15
movslq %ebp, %rax
leaq (%r14,%rax,8), %rax
leaq 0x8(%rsp), %rdx
movl %ebx, (%rdx)
movq %rax, 0x8(%rdx)
leaq 0xd1(%rip), %rsi        # 0x26f4
movq %r15, %rdi
callq 0x414d
movq %r15, %rdi
testl %eax, %eax
jne 0x268e
callq 0xaebf
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
testl %esi, %esi
je 0x2598
cmpl $0x2d, %esi
jne 0x266c
cmpb $0x0, 0x2(%rdi)
jne 0x266c
incl %ebp
leal 0x1(%r15), %ecx
testl %r15d, %r15d
cmovel %r15d, %ecx
movl %ecx, %r15d
jmp 0x2598
callq 0x269a
leaq 0xf9e9(%rip), %rdi      # 0x12061
callq 0x269a
leaq 0xf9ac(%rip), %rdi      # 0x12030
callq 0x269a
callq 0x22d5
callq 0x22a0
xorl %edi, %edi
callq 0x2230
// File: /workspace/github_c_makefile_star2_O3/zhou-yuxin[P]redis-aof-no-cow/deps/lua/src/luac.c
// Function: usage
static void usage(const char* message)
{
 if (*message=='-')
  fprintf(stderr,"%s: unrecognized option " LUA_QS "\n",progname,message);
 else
  fprintf(stderr,"%s: %s\n",progname,message);
 fprintf(stderr,
 "usage: %s [options] [filenames].\n"
 "Available options are:\n"
 "  -        process stdin\n"
 "  -l       list\n"
 "  -o name  output to file " LUA_QL("name") " (default is \"%s\")\n"
 "  -p       parse only\n"
 "  -s       strip debug information\n"
 "  -v       show version information\n"
 "  --       stop handling options\n",
 progname,Output);
 exit(EXIT_FAILURE);
}

// Assembly:
pushq %rbx
movq %rdi, %rcx
cmpb $0x2d, (%rdi)
movq 0x17950(%rip), %rbx     # 0x19ff8
movq (%rbx), %rdi
movq 0x17aa6(%rip), %rdx     # 0x1a158
leaq 0xf9fc(%rip), %rax      # 0x120b5
leaq 0xfb60(%rip), %rsi      # 0x12220
cmoveq %rax, %rsi
xorl %eax, %eax
callq 0x2160
movq (%rbx), %rdi
movq 0x17a83(%rip), %rdx     # 0x1a158
leaq 0xf9f7(%rip), %rsi      # 0x120d3
leaq 0x17a85(%rip), %rcx     # 0x1a168
xorl %eax, %eax
callq 0x2160
movl $0x1, %edi
callq 0x2230
// File: /workspace/github_c_makefile_star2_O3/Seclabs-htc[P]slip39/trezor-crypto/pbkdf2.c
// Function: pbkdf2_hmac_sha256_Init
void pbkdf2_hmac_sha256_Init(PBKDF2_HMAC_SHA256_CTX *pctx, const uint8_t *pass,
                             int passlen, const uint8_t *salt, int saltlen,
                             uint32_t blocknr) {
  SHA256_CTX ctx;
#if BYTE_ORDER == LITTLE_ENDIAN
  REVERSE32(blocknr, blocknr);
#endif

  hmac_sha256_prepare(pass, passlen, pctx->odig, pctx->idig);
  memzero(pctx->g, sizeof(pctx->g));
  pctx->g[8] = 0x80000000;
  pctx->g[15] = (SHA256_BLOCK_LENGTH + SHA256_DIGEST_LENGTH) * 8;

  memcpy(ctx.state, pctx->idig, sizeof(pctx->idig));
  ctx.bitcount = SHA256_BLOCK_LENGTH * 8;
  sha256_Update(&ctx, salt, saltlen);
  sha256_Update(&ctx, (uint8_t *)&blocknr, sizeof(blocknr));
  sha256_Final(&ctx, (uint8_t *)pctx->g);
#if BYTE_ORDER == LITTLE_ENDIAN
  for (uint32_t k = 0; k < SHA256_DIGEST_LENGTH / sizeof(uint32_t); k++) {
    REVERSE32(pctx->g[k], pctx->g[k]);
  }
#endif
  sha256_Transform(pctx->odig, pctx->g, pctx->g);
  memcpy(pctx->f, pctx->g, SHA256_DIGEST_LENGTH);
  pctx->first = 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movl %r8d, %r13d
movq %rcx, %r12
movq %rdi, %rbx
bswapl %r9d
leaq -0x2c(%rbp), %rax
movl %r9d, (%rax)
leaq 0x20(%rdi), %rcx
movq %rsi, %rdi
movl %edx, %esi
movq %rbx, %rdx
callq 0x9c20
leaq 0x60(%rbx), %r14
movl $0x40, %esi
movq %r14, %rdi
callq 0x81bc
movl $0x80000000, 0x80(%rbx) # imm = 0x80000000
movl $0x300, 0x9c(%rbx)      # imm = 0x300
movups 0x20(%rbx), %xmm0
movups 0x30(%rbx), %xmm1
leaq -0xa0(%rbp), %r15
movaps %xmm1, 0x10(%r15)
movaps %xmm0, (%r15)
movq $0x200, 0x20(%r15)      # imm = 0x200
movslq %r13d, %rdx
movq %r15, %rdi
movq %r12, %rsi
callq 0x906b
movl $0x4, %edx
movq %r15, %rdi
leaq -0x2c(%rbp), %rsi
callq 0x906b
movq %r15, %rdi
movq %r14, %rsi
callq 0x91a4
movl $0x18, %eax
movl (%rbx,%rax,4), %ecx
bswapl %ecx
movl %ecx, (%rbx,%rax,4)
incq %rax
cmpq $0x20, %rax
jne 0x8271
movq %rbx, %rdi
movq %r14, %rsi
movq %r14, %rdx
callq 0x8e40
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups %xmm1, 0x50(%rbx)
movups %xmm0, 0x40(%rbx)
movb $0x1, 0xa0(%rbx)
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Seclabs-htc[P]slip39/trezor-crypto/pbkdf2.c
// Function: pbkdf2_hmac_sha256_Update
void pbkdf2_hmac_sha256_Update(PBKDF2_HMAC_SHA256_CTX *pctx,
                               uint32_t iterations) {
  for (uint32_t i = pctx->first; i < iterations; i++) {
    sha256_Transform(pctx->idig, pctx->g, pctx->g);
    sha256_Transform(pctx->odig, pctx->g, pctx->g);
    for (uint32_t j = 0; j < SHA256_DIGEST_LENGTH / sizeof(uint32_t); j++) {
      pctx->f[j] ^= pctx->g[j];
    }
  }
  pctx->first = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movsbl 0xa0(%rdi), %r13d
cmpl %esi, %r13d
jae 0x8319
movl %esi, %r14d
leaq 0x20(%rbx), %r15
leaq 0x60(%rbx), %r12
movq %r15, %rdi
movq %r12, %rsi
movq %r12, %rdx
callq 0x8e40
movq %rbx, %rdi
movq %r12, %rsi
movq %r12, %rdx
callq 0x8e40
movq $-0x8, %rax
movl 0x20(%r12,%rax,4), %ecx
xorl %ecx, (%r12,%rax,4)
incq %rax
jne 0x8303
incl %r13d
cmpl %r14d, %r13d
jne 0x82e0
movb $0x0, 0xa0(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Seclabs-htc[P]slip39/trezor-crypto/pbkdf2.c
// Function: pbkdf2_hmac_sha256_Final
void pbkdf2_hmac_sha256_Final(PBKDF2_HMAC_SHA256_CTX *pctx, uint8_t *key) {
#if BYTE_ORDER == LITTLE_ENDIAN
  for (uint32_t k = 0; k < SHA256_DIGEST_LENGTH / sizeof(uint32_t); k++) {
    REVERSE32(pctx->f[k], pctx->f[k]);
  }
#endif
  memcpy(key, pctx->f, SHA256_DIGEST_LENGTH);
  memzero(pctx, sizeof(PBKDF2_HMAC_SHA256_CTX));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x40(%rdi), %rax
movl $0x10, %ecx
movl (%rdi,%rcx,4), %edx
bswapl %edx
movl %edx, (%rdi,%rcx,4)
incq %rcx
cmpq $0x18, %rcx
jne 0x833c
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups %xmm1, 0x10(%rsi)
movups %xmm0, (%rsi)
movl $0xa4, %esi
popq %rbp
jmp 0x81bc
// File: /workspace/github_c_makefile_star2_O3/Seclabs-htc[P]slip39/trezor-crypto/pbkdf2.c
// Function: pbkdf2_hmac_sha512_Init
void pbkdf2_hmac_sha512_Init(PBKDF2_HMAC_SHA512_CTX *pctx, const uint8_t *pass,
                             int passlen, const uint8_t *salt, int saltlen,
                             uint32_t blocknr) {
  SHA512_CTX ctx;
#if BYTE_ORDER == LITTLE_ENDIAN
  REVERSE32(blocknr, blocknr);
#endif

  hmac_sha512_prepare(pass, passlen, pctx->odig, pctx->idig);
  memzero(pctx->g, sizeof(pctx->g));
  pctx->g[8] = 0x8000000000000000;
  pctx->g[15] = (SHA512_BLOCK_LENGTH + SHA512_DIGEST_LENGTH) * 8;

  memcpy(ctx.state, pctx->idig, sizeof(pctx->idig));
  ctx.bitcount[0] = SHA512_BLOCK_LENGTH * 8;
  ctx.bitcount[1] = 0;
  sha512_Update(&ctx, salt, saltlen);
  sha512_Update(&ctx, (uint8_t *)&blocknr, sizeof(blocknr));
  sha512_Final(&ctx, (uint8_t *)pctx->g);
#if BYTE_ORDER == LITTLE_ENDIAN
  for (uint32_t k = 0; k < SHA512_DIGEST_LENGTH / sizeof(uint64_t); k++) {
    REVERSE64(pctx->g[k], pctx->g[k]);
  }
#endif
  sha512_Transform(pctx->odig, pctx->g, pctx->g);
  memcpy(pctx->f, pctx->g, SHA512_DIGEST_LENGTH);
  pctx->first = 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movl %r8d, %r13d
movq %rcx, %r12
movq %rdi, %rbx
bswapl %r9d
leaq -0x2c(%rbp), %rax
movl %r9d, (%rax)
leaq 0x40(%rdi), %rcx
movq %rsi, %rdi
movl %edx, %esi
movq %rbx, %rdx
callq 0x9e90
leaq 0xc0(%rbx), %r14
movl $0x80, %esi
movq %r14, %rdi
callq 0x81bc
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rax, 0x100(%rbx)
movq $0x600, 0x138(%rbx) # imm = 0x600
movups 0x40(%rbx), %xmm0
movups 0x50(%rbx), %xmm1
movups 0x60(%rbx), %xmm2
movups 0x70(%rbx), %xmm3
leaq -0x100(%rbp), %r15
movaps %xmm3, 0x30(%r15)
movaps %xmm2, 0x20(%r15)
movaps %xmm1, 0x10(%r15)
movaps %xmm0, (%r15)
movq $0x400, 0x40(%r15)      # imm = 0x400
movq $0x0, 0x48(%r15)
movslq %r13d, %rdx
movq %r15, %rdi
movq %r12, %rsi
callq 0x96a8
movl $0x4, %edx
movq %r15, %rdi
leaq -0x2c(%rbp), %rsi
callq 0x96a8
movq %r15, %rdi
movq %r14, %rsi
callq 0x97f7
movl $0x18, %eax
movq (%rbx,%rax,8), %rcx
bswapq %rcx
movq %rcx, (%rbx,%rax,8)
incq %rax
cmpq $0x20, %rax
jne 0x8554
movq %rbx, %rdi
movq %r14, %rsi
movq %r14, %rdx
callq 0x9449
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups 0x20(%r14), %xmm2
movups 0x30(%r14), %xmm3
movups %xmm3, 0xb0(%rbx)
movups %xmm2, 0xa0(%rbx)
movups %xmm1, 0x90(%rbx)
movups %xmm0, 0x80(%rbx)
movb $0x1, 0x140(%rbx)
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Seclabs-htc[P]slip39/trezor-crypto/pbkdf2.c
// Function: pbkdf2_hmac_sha512_Update
void pbkdf2_hmac_sha512_Update(PBKDF2_HMAC_SHA512_CTX *pctx,
                               uint32_t iterations) {
  for (uint32_t i = pctx->first; i < iterations; i++) {
    sha512_Transform(pctx->idig, pctx->g, pctx->g);
    sha512_Transform(pctx->odig, pctx->g, pctx->g);
    for (uint32_t j = 0; j < SHA512_DIGEST_LENGTH / sizeof(uint64_t); j++) {
      pctx->f[j] ^= pctx->g[j];
    }
  }
  pctx->first = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movsbl 0x140(%rdi), %r13d
cmpl %esi, %r13d
jae 0x8623
movl %esi, %r14d
leaq 0x40(%rbx), %r15
leaq 0xc0(%rbx), %r12
movq %r15, %rdi
movq %r12, %rsi
movq %r12, %rdx
callq 0x9449
movq %rbx, %rdi
movq %r12, %rsi
movq %r12, %rdx
callq 0x9449
movq $-0x8, %rax
movq 0x40(%r12,%rax,8), %rcx
xorq %rcx, (%r12,%rax,8)
incq %rax
jne 0x860d
incl %r13d
cmpl %r14d, %r13d
jne 0x85ea
movb $0x0, 0x140(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Seclabs-htc[P]slip39/trezor-crypto/pbkdf2.c
// Function: pbkdf2_hmac_sha512_Final
void pbkdf2_hmac_sha512_Final(PBKDF2_HMAC_SHA512_CTX *pctx, uint8_t *key) {
#if BYTE_ORDER == LITTLE_ENDIAN
  for (uint32_t k = 0; k < SHA512_DIGEST_LENGTH / sizeof(uint64_t); k++) {
    REVERSE64(pctx->f[k], pctx->f[k]);
  }
#endif
  memcpy(key, pctx->f, SHA512_DIGEST_LENGTH);
  memzero(pctx, sizeof(PBKDF2_HMAC_SHA512_CTX));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x80(%rdi), %rax
movl $0x10, %ecx
movq (%rdi,%rcx,8), %rdx
bswapq %rdx
movq %rdx, (%rdi,%rcx,8)
incq %rcx
cmpq $0x18, %rcx
jne 0x8649
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movups 0x20(%rax), %xmm2
movups 0x30(%rax), %xmm3
movups %xmm3, 0x30(%rsi)
movups %xmm2, 0x20(%rsi)
movups %xmm1, 0x10(%rsi)
movups %xmm0, (%rsi)
movl $0x148, %esi            # imm = 0x148
popq %rbp
jmp 0x81bc
// File: /workspace/github_c_makefile_star2_O3/Seclabs-htc[P]slip39/trezor-crypto/pbkdf2.c
// Function: pbkdf2_hmac_sha512
void pbkdf2_hmac_sha512(const uint8_t *pass, int passlen, const uint8_t *salt,
                        int saltlen, uint32_t iterations, uint8_t *key,
                        int keylen) {
  uint32_t last_block_size = keylen % SHA512_DIGEST_LENGTH;
  uint32_t blocks_count = keylen / SHA512_DIGEST_LENGTH;
  if (last_block_size) {
    blocks_count++;
  } else {
    last_block_size = SHA512_DIGEST_LENGTH;
  }
  for (uint32_t blocknr = 1; blocknr <= blocks_count; blocknr++) {
    PBKDF2_HMAC_SHA512_CTX pctx;
    pbkdf2_hmac_sha512_Init(&pctx, pass, passlen, salt, saltlen, blocknr);
    pbkdf2_hmac_sha512_Update(&pctx, iterations);
    uint8_t digest[SHA512_DIGEST_LENGTH];
    pbkdf2_hmac_sha512_Final(&pctx, digest);
    uint32_t key_offset = (blocknr - 1) * SHA512_DIGEST_LENGTH;
    if (blocknr < blocks_count) {
      memcpy(key + key_offset, digest, SHA512_DIGEST_LENGTH);
    } else {
      memcpy(key + key_offset, digest, last_block_size);
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
movq %r9, -0x50(%rbp)
movl %r8d, -0x34(%rbp)
movl %ecx, -0x30(%rbp)
movq %rdx, -0x48(%rbp)
movl %esi, -0x2c(%rbp)
movl 0x10(%rbp), %eax
leal 0x3f(%rax), %ecx
testl %eax, %eax
cmovnsl %eax, %ecx
movl %ecx, %edx
sarl $0x6, %edx
andl $-0x40, %ecx
xorl %r12d, %r12d
subl %ecx, %eax
setne %r12b
movl $0x40, %ecx
cmovnel %eax, %ecx
movq %rcx, -0x40(%rbp)
addl %edx, %r12d
je 0x87bf
movq %rdi, %rbx
movl $0x1, %r14d
leaq -0x158(%rbp), %r13
leaq -0x1d8(%rbp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movl -0x2c(%rbp), %edx
movq -0x48(%rbp), %rcx
movl -0x30(%rbp), %r8d
movl %r14d, %r9d
callq 0x8483
movq %r15, %rdi
movl -0x34(%rbp), %esi
callq 0x85be
movl $0x10, %eax
movq -0x1d8(%rbp,%rax,8), %rcx
bswapq %rcx
movq %rcx, -0x1d8(%rbp,%rax,8)
incq %rax
cmpq $0x18, %rax
jne 0x871d
movups (%r13), %xmm0
movups 0x10(%r13), %xmm1
movups 0x20(%r13), %xmm2
movups 0x30(%r13), %xmm3
movaps %xmm3, -0x60(%rbp)
movaps %xmm2, -0x70(%rbp)
movaps %xmm1, -0x80(%rbp)
movaps %xmm0, -0x90(%rbp)
movl $0x148, %esi            # imm = 0x148
movq %r15, %rdi
callq 0x81bc
movl %r14d, %edi
shll $0x6, %edi
addl $-0x40, %edi
addq -0x50(%rbp), %rdi
cmpl %r12d, %r14d
jae 0x87a3
movaps -0x90(%rbp), %xmm0
movaps -0x80(%rbp), %xmm1
movaps -0x70(%rbp), %xmm2
movaps -0x60(%rbp), %xmm3
movups %xmm3, 0x30(%rdi)
movups %xmm2, 0x20(%rdi)
movups %xmm1, 0x10(%rdi)
movups %xmm0, (%rdi)
jmp 0x87b3
leaq -0x90(%rbp), %rsi
movq -0x40(%rbp), %rdx
callq 0x8080
incl %r14d
cmpl %r12d, %r14d
jbe 0x86f4
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/Seclabs-htc[P]slip39/trezor-crypto/sha2.c
// Function: sha1_Final
void sha1_Final(SHA1_CTX* context, sha2_byte digest[]) {
	unsigned int	usedspace;

	/* If no digest buffer is passed, we don't bother doing this: */
	if (digest != (sha2_byte*)0) {
		usedspace = (context->bitcount >> 3) % SHA1_BLOCK_LENGTH;
		/* Begin padding with a 1 bit: */
		((uint8_t*)context->buffer)[usedspace++] = 0x80;

		if (usedspace > SHA1_SHORT_BLOCK_LENGTH) {
			memzero(((uint8_t*)context->buffer) + usedspace, SHA1_BLOCK_LENGTH - usedspace);

#if BYTE_ORDER == LITTLE_ENDIAN
			/* Convert TO host byte order */
			for (int j = 0; j < 16; j++) {
				REVERSE32(context->buffer[j],context->buffer[j]);
			}
#endif
			/* Do second-to-last transform: */
			sha1_Transform(context->state, context->buffer, context->state);

			/* And prepare the last transform: */
			usedspace = 0;
		}
		/* Set-up for the last transform: */
		memzero(((uint8_t*)context->buffer) + usedspace, SHA1_SHORT_BLOCK_LENGTH - usedspace);

#if BYTE_ORDER == LITTLE_ENDIAN
		/* Convert TO host byte order */
		for (int j = 0; j < 14; j++) {
			REVERSE32(context->buffer[j],context->buffer[j]);
		}
#endif
		/* Set the bit count: */
		context->buffer[14] = context->bitcount >> 32;
		context->buffer[15] = context->bitcount & 0xffffffff;

		/* Final transform: */
		sha1_Transform(context->state, context->buffer, context->state);

#if BYTE_ORDER == LITTLE_ENDIAN
		/* Convert FROM host byte order */
		for (int j = 0; j < 5; j++) {
			REVERSE32(context->state[j],context->state[j]);
		}
#endif
		MEMCPY_BCOPY(digest, context->state, SHA1_DIGEST_LENGTH);
	}

	/* Clean up state data: */
	memzero(context, sizeof(SHA1_CTX));
	usedspace = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
testq %rsi, %rsi
je 0x8c88
movq %rsi, %r14
movl 0x18(%rbx), %esi
shrl $0x3, %esi
andl $0x3f, %esi
leaq 0x20(%rbx), %r15
leal 0x1(%rsi), %eax
movb $-0x80, 0x20(%rbx,%rsi)
cmpl $0x38, %esi
jb 0x8c26
movl %eax, %edi
addq %r15, %rdi
xorl $0x3f, %esi
callq 0x81bc
movl $0x8, %eax
movl (%rbx,%rax,4), %ecx
bswapl %ecx
movl %ecx, (%rbx,%rax,4)
incq %rax
cmpq $0x18, %rax
jne 0x8c05
movq %rbx, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x880b
xorl %eax, %eax
movl %eax, %edi
addq %r15, %rdi
movl $0x38, %esi
subl %eax, %esi
callq 0x81bc
movl $0x8, %eax
movl (%rbx,%rax,4), %ecx
bswapl %ecx
movl %ecx, (%rbx,%rax,4)
incq %rax
cmpq $0x16, %rax
jne 0x8c3c
movq 0x18(%rbx), %rax
rorq $0x20, %rax
movq %rax, 0x58(%rbx)
movq %rbx, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x880b
xorl %eax, %eax
movl (%rbx,%rax,4), %ecx
bswapl %ecx
movl %ecx, (%rbx,%rax,4)
incq %rax
cmpq $0x5, %rax
jne 0x8c69
movl 0x10(%rbx), %eax
movl %eax, 0x10(%r14)
movups (%rbx), %xmm0
movups %xmm0, (%r14)
movl $0x60, %esi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x81bc
// File: /workspace/github_c_makefile_star2_O3/Seclabs-htc[P]slip39/trezor-crypto/sha2.c
// Function: sha1_End
char *sha1_End(SHA1_CTX* context, char buffer[]) {
	sha2_byte	digest[SHA1_DIGEST_LENGTH], *d = digest;
	int		i;

	if (buffer != (char*)0) {
		sha1_Final(context, digest);

		for (i = 0; i < SHA1_DIGEST_LENGTH; i++) {
			*buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4];
			*buffer++ = sha2_hex_digits[*d & 0x0f];
			d++;
		}
		*buffer = (char)0;
	} else {
		memzero(context, sizeof(SHA1_CTX));
	}
	memzero(digest, SHA1_DIGEST_LENGTH);
	return buffer;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x18, %rsp
testq %rsi, %rsi
je 0x8cf8
movq %rsi, %rbx
leaq -0x20(%rbp), %rsi
callq 0x8bc0
xorl %eax, %eax
leaq 0x374e(%rip), %rcx      # 0xc410
xorl %edx, %edx
movzbl -0x20(%rbp,%rdx), %esi
movl %esi, %edi
shrl $0x4, %edi
movb (%rdi,%rcx), %dil
movb %dil, (%rbx,%rdx,2)
andl $0xf, %esi
movb (%rsi,%rcx), %sil
movb %sil, 0x1(%rbx,%rdx,2)
incq %rdx
addq $-0x2, %rax
cmpq $0x14, %rdx
jne 0x8cc4
movb $0x0, (%rbx,%rdx,2)
subq %rax, %rbx
jmp 0x8d04
movl $0x60, %esi
callq 0x81bc
xorl %ebx, %ebx
leaq -0x20(%rbp), %rdi
movl $0x14, %esi
callq 0x81bc
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Seclabs-htc[P]slip39/trezor-crypto/sha2.c
// Function: sha1_Raw
void sha1_Raw(const sha2_byte* data, size_t len, uint8_t digest[SHA1_DIGEST_LENGTH]) {
	SHA1_CTX	context;
	sha1_Init(&context);
	sha1_Update(&context, data, len);
	sha1_Final(&context, digest);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x60, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movaps 0x32d5(%rip), %xmm0     # 0xc010
leaq -0x60(%rbp), %r12
movaps %xmm0, -0x20(%r12)
movl $0xc3d2e1f0, -0x10(%r12) # imm = 0xC3D2E1F0
movl $0x40, %esi
movq %r12, %rdi
callq 0x81bc
movq $0x0, -0x8(%r12)
leaq -0x80(%rbp), %r12
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x8a87
movq %r12, %rdi
movq %rbx, %rsi
callq 0x8bc0
addq $0x60, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Seclabs-htc[P]slip39/trezor-crypto/sha2.c
// Function: sha1_Data
char* sha1_Data(const sha2_byte* data, size_t len, char digest[SHA1_DIGEST_STRING_LENGTH]) {
	SHA1_CTX	context;

	sha1_Init(&context);
	sha1_Update(&context, data, len);
	return sha1_End(&context, digest);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x60, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movaps 0x3263(%rip), %xmm0     # 0xc010
leaq -0x60(%rbp), %r12
movaps %xmm0, -0x20(%r12)
movl $0xc3d2e1f0, -0x10(%r12) # imm = 0xC3D2E1F0
movl $0x40, %esi
movq %r12, %rdi
callq 0x81bc
movq $0x0, -0x8(%r12)
leaq -0x80(%rbp), %r12
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x8a87
movq %r12, %rdi
movq %rbx, %rsi
callq 0x8c9f
addq $0x60, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Seclabs-htc[P]slip39/trezor-crypto/sha2.c
// Function: sha256_Init
void sha256_Init(SHA256_CTX* context) {
	if (context == (SHA256_CTX*)0) {
		return;
	}
	MEMCPY_BCOPY(context->state, sha256_initial_hash_value, SHA256_DIGEST_LENGTH);
	memzero(context->buffer, SHA256_BLOCK_LENGTH);
	context->bitcount = 0;
}

// Assembly:
testq %rdi, %rdi
je 0x8e3f
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movaps 0x322b(%rip), %xmm0     # 0xc040
movups %xmm0, 0x10(%rdi)
movaps 0x3210(%rip), %xmm0     # 0xc030
movups %xmm0, (%rdi)
addq $0x28, %rdi
movl $0x40, %esi
callq 0x81bc
movq $0x0, 0x20(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Seclabs-htc[P]slip39/trezor-crypto/sha2.c
// Function: sha256_Final
void sha256_Final(SHA256_CTX* context, sha2_byte digest[]) {
	unsigned int	usedspace;

	/* If no digest buffer is passed, we don't bother doing this: */
	if (digest != (sha2_byte*)0) {
		usedspace = (context->bitcount >> 3) % SHA256_BLOCK_LENGTH;
		/* Begin padding with a 1 bit: */
		((uint8_t*)context->buffer)[usedspace++] = 0x80;
		
		if (usedspace > SHA256_SHORT_BLOCK_LENGTH) {
			memzero(((uint8_t*)context->buffer) + usedspace, SHA256_BLOCK_LENGTH - usedspace);

#if BYTE_ORDER == LITTLE_ENDIAN
			/* Convert TO host byte order */
			for (int j = 0; j < 16; j++) {
				REVERSE32(context->buffer[j],context->buffer[j]);
			}
#endif
			/* Do second-to-last transform: */
			sha256_Transform(context->state, context->buffer, context->state);
			
			/* And prepare the last transform: */
			usedspace = 0;
		}
		/* Set-up for the last transform: */
		memzero(((uint8_t*)context->buffer) + usedspace, SHA256_SHORT_BLOCK_LENGTH - usedspace);

#if BYTE_ORDER == LITTLE_ENDIAN
		/* Convert TO host byte order */
		for (int j = 0; j < 14; j++) {
			REVERSE32(context->buffer[j],context->buffer[j]);
		}
#endif
		/* Set the bit count: */
		context->buffer[14] = context->bitcount >> 32;
		context->buffer[15] = context->bitcount & 0xffffffff;

		/* Final transform: */
		sha256_Transform(context->state, context->buffer, context->state);

#if BYTE_ORDER == LITTLE_ENDIAN
		/* Convert FROM host byte order */
		for (int j = 0; j < 8; j++) {
			REVERSE32(context->state[j],context->state[j]);
		}
#endif
		MEMCPY_BCOPY(digest, context->state, SHA256_DIGEST_LENGTH);
	}

	/* Clean up state data: */
	memzero(context, sizeof(SHA256_CTX));
	usedspace = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
testq %rsi, %rsi
je 0x926e
movq %rsi, %r14
movl 0x20(%rbx), %esi
shrl $0x3, %esi
andl $0x3f, %esi
leaq 0x28(%rbx), %r15
leal 0x1(%rsi), %eax
movb $-0x80, 0x28(%rbx,%rsi)
cmpl $0x38, %esi
jb 0x920a
movl %eax, %edi
addq %r15, %rdi
xorl $0x3f, %esi
callq 0x81bc
movl $0xa, %eax
movl (%rbx,%rax,4), %ecx
bswapl %ecx
movl %ecx, (%rbx,%rax,4)
incq %rax
cmpq $0x1a, %rax
jne 0x91e9
movq %rbx, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x8e40
xorl %eax, %eax
movl %eax, %edi
addq %r15, %rdi
movl $0x38, %esi
subl %eax, %esi
callq 0x81bc
movl $0xa, %eax
movl (%rbx,%rax,4), %ecx
bswapl %ecx
movl %ecx, (%rbx,%rax,4)
incq %rax
cmpq $0x18, %rax
jne 0x9220
movq 0x20(%rbx), %rax
rorq $0x20, %rax
movq %rax, 0x60(%rbx)
movq %rbx, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x8e40
xorl %eax, %eax
movl (%rbx,%rax,4), %ecx
bswapl %ecx
movl %ecx, (%rbx,%rax,4)
incq %rax
cmpq $0x8, %rax
jne 0x924d
movups (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movups %xmm1, 0x10(%r14)
movups %xmm0, (%r14)
movl $0x68, %esi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x81bc
// File: /workspace/github_c_makefile_star2_O3/Seclabs-htc[P]slip39/trezor-crypto/sha2.c
// Function: sha256_End
char *sha256_End(SHA256_CTX* context, char buffer[]) {
	sha2_byte	digest[SHA256_DIGEST_LENGTH], *d = digest;
	int		i;

	if (buffer != (char*)0) {
		sha256_Final(context, digest);

		for (i = 0; i < SHA256_DIGEST_LENGTH; i++) {
			*buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4];
			*buffer++ = sha2_hex_digits[*d & 0x0f];
			d++;
		}
		*buffer = (char)0;
	} else {
		memzero(context, sizeof(SHA256_CTX));
	}
	memzero(digest, SHA256_DIGEST_LENGTH);
	return buffer;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x28, %rsp
testq %rsi, %rsi
je 0x92de
movq %rsi, %rbx
leaq -0x30(%rbp), %rsi
callq 0x91a4
xorl %eax, %eax
leaq 0x3168(%rip), %rcx      # 0xc410
xorl %edx, %edx
movzbl -0x30(%rbp,%rdx), %esi
movl %esi, %edi
shrl $0x4, %edi
movb (%rdi,%rcx), %dil
movb %dil, (%rbx,%rdx,2)
andl $0xf, %esi
movb (%rsi,%rcx), %sil
movb %sil, 0x1(%rbx,%rdx,2)
incq %rdx
addq $-0x2, %rax
cmpq $0x20, %rdx
jne 0x92aa
movb $0x0, (%rbx,%rdx,2)
subq %rax, %rbx
jmp 0x92ea
movl $0x68, %esi
callq 0x81bc
xorl %ebx, %ebx
leaq -0x30(%rbp), %rdi
movl $0x20, %esi
callq 0x81bc
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Seclabs-htc[P]slip39/trezor-crypto/sha2.c
// Function: sha256_Raw
void sha256_Raw(const sha2_byte* data, size_t len, uint8_t digest[SHA256_DIGEST_LENGTH]) {
	SHA256_CTX	context;
	sha256_Init(&context);
	sha256_Update(&context, data, len);
	sha256_Final(&context, digest);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x70, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movaps 0x2d1f(%rip), %xmm0     # 0xc040
leaq -0x68(%rbp), %r12
movaps %xmm0, -0x18(%r12)
movaps 0x2cfe(%rip), %xmm0     # 0xc030
movaps %xmm0, -0x28(%r12)
movl $0x40, %esi
movq %r12, %rdi
callq 0x81bc
movq $0x0, -0x8(%r12)
leaq -0x90(%rbp), %r12
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x906b
movq %r12, %rdi
movq %rbx, %rsi
callq 0x91a4
addq $0x70, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Seclabs-htc[P]slip39/trezor-crypto/sha2.c
// Function: sha256_Data
char* sha256_Data(const sha2_byte* data, size_t len, char digest[SHA256_DIGEST_STRING_LENGTH]) {
	SHA256_CTX	context;

	sha256_Init(&context);
	sha256_Update(&context, data, len);
	return sha256_End(&context, digest);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x70, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movaps 0x2ca6(%rip), %xmm0     # 0xc040
leaq -0x68(%rbp), %r12
movaps %xmm0, -0x18(%r12)
movaps 0x2c85(%rip), %xmm0     # 0xc030
movaps %xmm0, -0x28(%r12)
movl $0x40, %esi
movq %r12, %rdi
callq 0x81bc
movq $0x0, -0x8(%r12)
leaq -0x90(%rbp), %r12
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x906b
movq %r12, %rdi
movq %rbx, %rsi
callq 0x9285
addq $0x70, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Seclabs-htc[P]slip39/trezor-crypto/sha2.c
// Function: sha512_Init
void sha512_Init(SHA512_CTX* context) {
	if (context == (SHA512_CTX*)0) {
		return;
	}
	MEMCPY_BCOPY(context->state, sha512_initial_hash_value, SHA512_DIGEST_LENGTH);
	memzero(context->buffer, SHA512_BLOCK_LENGTH);
	context->bitcount[0] = context->bitcount[1] =  0;
}

// Assembly:
testq %rdi, %rdi
je 0x9448
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movaps 0x2c77(%rip), %xmm0     # 0xc080
movups %xmm0, 0x30(%rdi)
movaps 0x2c5c(%rip), %xmm0     # 0xc070
movups %xmm0, 0x20(%rdi)
movaps 0x2c41(%rip), %xmm0     # 0xc060
movups %xmm0, 0x10(%rdi)
movaps 0x2c26(%rip), %xmm0     # 0xc050
movups %xmm0, (%rdi)
addq $0x50, %rdi
movl $0x80, %esi
callq 0x81bc
xorps %xmm0, %xmm0
movups %xmm0, 0x40(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq