// File: /workspace/github_c_makefile_star2_O2/skeeto[P]enchive/src/sha256.c
// Function: sha256_transform
void sha256_transform(SHA256_CTX *ctx, const uint8_t data[])
{
	uint32_t a, b, c, d, e, f, g, h, i, j, t1, t2, m[64];

	for (i = 0, j = 0; i < 16; ++i, j += 4)
		m[i] = (data[j] << 24) | (data[j + 1] << 16) | (data[j + 2] << 8) | (data[j + 3]);
	for ( ; i < 64; ++i)
		m[i] = SIG1(m[i - 2]) + m[i - 7] + SIG0(m[i - 15]) + m[i - 16];

	a = ctx->state[0];
	b = ctx->state[1];
	c = ctx->state[2];
	d = ctx->state[3];
	e = ctx->state[4];
	f = ctx->state[5];
	g = ctx->state[6];
	h = ctx->state[7];

	for (i = 0; i < 64; ++i) {
		t1 = h + EP1(e) + CH(e,f,g) + k[i] + m[i];
		t2 = EP0(a) + MAJ(a,b,c);
		h = g;
		g = f;
		f = e;
		e = d + t1;
		d = c;
		c = b;
		b = a;
		a = t1 + t2;
	}

	ctx->state[0] += a;
	ctx->state[1] += b;
	ctx->state[2] += c;
	ctx->state[3] += d;
	ctx->state[4] += e;
	ctx->state[5] += f;
	ctx->state[6] += g;
	ctx->state[7] += h;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
xorl %eax, %eax
cmpq $0x10, %rax
je 0x6923
movl (%rsi,%rax,4), %ecx
bswapl %ecx
movl %ecx, -0x60(%rsp,%rax,4)
incq %rax
jmp 0x690f
movabsq $0x10, %rax
cmpq $0x40, %rax
je 0x697a
movl -0x68(%rsp,%rax,4), %ecx
movl %ecx, %edx
roll $0xf, %edx
movl %ecx, %esi
roll $0xd, %esi
xorl %edx, %esi
shrl $0xa, %ecx
xorl %esi, %ecx
addl -0x7c(%rsp,%rax,4), %ecx
movl -0x9c(%rsp,%rax,4), %edx
movl %edx, %esi
roll $0x19, %esi
movl %edx, %r8d
roll $0xe, %r8d
xorl %esi, %r8d
shrl $0x3, %edx
addl -0xa0(%rsp,%rax,4), %ecx
xorl %r8d, %edx
addl %edx, %ecx
movl %ecx, -0x60(%rsp,%rax,4)
incq %rax
jmp 0x692d
movl 0x50(%rdi), %r9d
movl 0x54(%rdi), %esi
movl 0x58(%rdi), %ebx
movl 0x5c(%rdi), %r8d
movl 0x60(%rdi), %ecx
movl 0x64(%rdi), %r14d
movl 0x68(%rdi), %ebp
movl 0x6c(%rdi), %r11d
xorl %r13d, %r13d
leaq 0x1600(%rip), %rax      # 0x7fa0
movl %ebx, -0x78(%rsp)
movl %r8d, -0x74(%rsp)
movl %ecx, -0x70(%rsp)
movl %r14d, -0x6c(%rsp)
movl %ebp, -0x68(%rsp)
movl %r11d, -0x64(%rsp)
movl %esi, -0x7c(%rsp)
movl %r9d, -0x80(%rsp)
movl %ebp, %r12d
movl %r14d, %ebp
movl %ecx, %r14d
movl %ebx, %r15d
cmpq $0x100, %r13            # imm = 0x100
je 0x6a52
movl %r14d, %ecx
roll $0x1a, %ecx
movl %r14d, %edx
roll $0x15, %edx
movl %r14d, %r10d
roll $0x7, %r10d
xorl %ecx, %edx
xorl %edx, %r10d
movl %ebp, %ecx
xorl %r12d, %ecx
andl %r14d, %ecx
xorl %r12d, %ecx
addl %ecx, %r11d
addl %r10d, %r11d
addl (%r13,%rax), %r11d
addl -0x60(%rsp,%r13), %r11d
movl %r9d, %r10d
movl %r9d, %ecx
movl %esi, %edx
movl %esi, %ebx
xorl %r15d, %esi
andl %r9d, %esi
andl %r15d, %edx
xorl %esi, %edx
movl %r9d, %esi
roll $0x1e, %r9d
roll $0x13, %r10d
xorl %r9d, %r10d
roll $0xa, %ecx
xorl %r10d, %ecx
addl %ecx, %edx
movl %r8d, %ecx
addl %r11d, %ecx
addl %r11d, %edx
addq $0x4, %r13
movl %r15d, %r8d
movl %r12d, %r11d
movl %edx, %r9d
jmp 0x69c4
addl -0x80(%rsp), %r9d
movl %r9d, 0x50(%rdi)
addl -0x7c(%rsp), %esi
movl %esi, 0x54(%rdi)
addl -0x78(%rsp), %r15d
movl %r15d, 0x58(%rdi)
addl -0x74(%rsp), %r8d
movl %r8d, 0x5c(%rdi)
addl -0x70(%rsp), %r14d
movl %r14d, 0x60(%rdi)
addl -0x6c(%rsp), %ebp
movl %ebp, 0x64(%rdi)
addl -0x68(%rsp), %r12d
movl %r12d, 0x68(%rdi)
addl -0x64(%rsp), %r11d
movl %r11d, 0x6c(%rdi)
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq