// File: /workspace/github_c_makefile_star2_O1/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
movl (%rsi,%rax,4), %ecx
bswapl %ecx
movl %ecx, -0x60(%rsp,%rax,4)
incq %rax
cmpq $0x10, %rax
jne 0x6e9f
movl $0x10, %eax
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
xorl %r8d, %edx
addl -0xa0(%rsp,%rax,4), %ecx
addl %edx, %ecx
movl %ecx, -0x60(%rsp,%rax,4)
incq %rax
cmpq $0x40, %rax
jne 0x6eb6
movl 0x50(%rdi), %r11d
movl 0x54(%rdi), %r12d
movl 0x58(%rdi), %ecx
movl 0x5c(%rdi), %r9d
movl 0x60(%rdi), %r8d
movl 0x64(%rdi), %ebp
movl 0x68(%rdi), %ebx
movl 0x6c(%rdi), %r14d
xorl %r15d, %r15d
leaq 0x2058(%rip), %r13      # 0x8f80
movl %r11d, -0x80(%rsp)
movl %r12d, -0x7c(%rsp)
movl %r14d, -0x64(%rsp)
movl %ebx, -0x68(%rsp)
movl %ebp, -0x6c(%rsp)
movl %r8d, -0x70(%rsp)
movl %r9d, -0x74(%rsp)
movl %ecx, -0x78(%rsp)
movl %ecx, %edx
movl %r8d, %eax
movl %ebp, %r10d
roll $0x1a, %r8d
movl %ebx, %esi
movl %eax, %ebx
roll $0x15, %ebx
movl %r12d, %ecx
movl %eax, %ebp
roll $0x7, %ebp
xorl %r8d, %ebx
xorl %ebx, %ebp
movl %r10d, %ebx
xorl %esi, %ebx
andl %eax, %ebx
xorl %esi, %ebx
addl %r14d, %ebx
addl %ebp, %ebx
addl (%r15,%r13), %ebx
addl -0x60(%rsp,%r15), %ebx
movl %r11d, %r12d
movl %r11d, %r8d
roll $0x1e, %r8d
roll $0x13, %r11d
xorl %r8d, %r11d
movl %r12d, %r8d
roll $0xa, %r8d
xorl %r11d, %r8d
movl %ecx, %ebp
xorl %edx, %ebp
andl %r12d, %ebp
movl %ecx, %r11d
andl %edx, %r11d
xorl %ebp, %r11d
addl %r8d, %r11d
movl %r9d, %r8d
addl %ebx, %r8d
addl %ebx, %r11d
addq $0x4, %r15
movl %esi, %r14d
movl %r10d, %ebx
movl %eax, %ebp
movl %edx, %r9d
cmpq $0x100, %r15            # imm = 0x100
jne 0x6f4d
addl -0x80(%rsp), %r11d
movl %r11d, 0x50(%rdi)
addl -0x7c(%rsp), %r12d
movl %r12d, 0x54(%rdi)
addl -0x78(%rsp), %ecx
movl %ecx, 0x58(%rdi)
addl -0x74(%rsp), %edx
movl %edx, 0x5c(%rdi)
addl -0x70(%rsp), %r8d
movl %r8d, 0x60(%rdi)
addl -0x6c(%rsp), %eax
movl %eax, 0x64(%rdi)
addl -0x68(%rsp), %r10d
movl %r10d, 0x68(%rdi)
addl -0x64(%rsp), %esi
movl %esi, 0x6c(%rdi)
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq