// File: Finsenty54[P]fast_collision/block1.cpp
// Function: find_block1(unsigned int*, unsigned int const*)
void find_block1(uint32 block[], const uint32 IV[])
{
	if ( ((IV[1]^IV[2])&(1<<31))==0 && ((IV[1]^IV[3])&(1<<31))==0
		&& (IV[3]&(1<<25))==0 && (IV[2]&(1<<25))==0 && (IV[1]&(1<<25))==0 && ((IV[2]^IV[1])&1)==0 
	   )
	{
		uint32 IV2[4] = { IV[0]+(1<<31), IV[1]+(1<<31)+(1<<25), IV[2]+(1<<31)+(1<<25), IV[3]+(1<<31)+(1<<25) };
		if ((IV[1]&(1<<6))!=0 && (IV[1]&1)!=0) {
			std::cout << "S11" << std::flush;
			find_block1_stevens_11(block, IV2);
		} else if ((IV[1]&(1<<6))!=0 && (IV[1]&1)==0) {
			std::cout << "S10" << std::flush;
			find_block1_stevens_10(block, IV2);
		} else if ((IV[1]&(1<<6))==0 && (IV[1]&1)!=0) {
			std::cout << "S01" << std::flush;
			find_block1_stevens_01(block, IV2);
		} else {
			std::cout << "S00" << std::flush;
			find_block1_stevens_00(block, IV2);
		}
		block[4] += 1<<31;
		block[11] += 1<<15;
		block[14] += 1<<31;
	} else {
		std::cout << "W" << std::flush;
		find_block1_wang(block, IV);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x10(%rbp), %rcx
xorl 0x8(%rcx), %eax
andl $0x80000000, %eax       # imm = 0x80000000
cmpl $0x0, %eax
jne 0x5073
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x10(%rbp), %rcx
xorl 0xc(%rcx), %eax
andl $0x80000000, %eax       # imm = 0x80000000
cmpl $0x0, %eax
jne 0x5073
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x2000000, %eax        # imm = 0x2000000
cmpl $0x0, %eax
jne 0x5073
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
andl $0x2000000, %eax        # imm = 0x2000000
cmpl $0x0, %eax
jne 0x5073
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x2000000, %eax        # imm = 0x2000000
cmpl $0x0, %eax
jne 0x5073
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x10(%rbp), %rcx
xorl 0x4(%rcx), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x5073
movq -0x10(%rbp), %rax
movl (%rax), %eax
addl $0x80000000, %eax       # imm = 0x80000000
movl %eax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
addl $0x80000000, %eax       # imm = 0x80000000
addl $0x2000000, %eax        # imm = 0x2000000
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
addl $0x80000000, %eax       # imm = 0x80000000
addl $0x2000000, %eax        # imm = 0x2000000
movl %eax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
addl $0x80000000, %eax       # imm = 0x80000000
addl $0x2000000, %eax        # imm = 0x2000000
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0x4f6d
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x4f6d
movq 0x11090(%rip), %rdi     # 0x15fd0
leaq 0xe1a2(%rip), %rsi      # 0x130e9
callq 0x10d0
movq %rax, %rdi
movq 0x11082(%rip), %rsi     # 0x15fd8
callq 0x1100
movq -0x8(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0xd240
jmp 0x5041
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0x4fbf
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x4fbf
movq 0x1103e(%rip), %rdi     # 0x15fd0
leaq 0xe154(%rip), %rsi      # 0x130ed
callq 0x10d0
movq %rax, %rdi
movq 0x11030(%rip), %rsi     # 0x15fd8
callq 0x1100
movq -0x8(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0xab50
jmp 0x503f
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x40, %eax
cmpl $0x0, %eax
jne 0x500e
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x500e
movq 0x10fec(%rip), %rdi     # 0x15fd0
leaq 0xe106(%rip), %rsi      # 0x130f1
callq 0x10d0
movq %rax, %rdi
movq 0x10fde(%rip), %rsi     # 0x15fd8
callq 0x1100
movq -0x8(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x84d0
jmp 0x503d
movq 0x10fbb(%rip), %rdi     # 0x15fd0
leaq 0xe0d9(%rip), %rsi      # 0x130f5
callq 0x10d0
movq %rax, %rdi
movq 0x10fad(%rip), %rsi     # 0x15fd8
callq 0x1100
movq -0x8(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x5e20
jmp 0x503f
jmp 0x5041
movq -0x8(%rbp), %rax
movl 0x10(%rax), %ecx
addl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, 0x10(%rax)
movq -0x8(%rbp), %rax
movl 0x2c(%rax), %ecx
addl $0x8000, %ecx           # imm = 0x8000
movl %ecx, 0x2c(%rax)
movq -0x8(%rbp), %rax
movl 0x38(%rax), %ecx
addl $0x80000000, %ecx       # imm = 0x80000000
movl %ecx, 0x38(%rax)
jmp 0x50a2
movq 0x10f56(%rip), %rdi     # 0x15fd0
leaq 0xe078(%rip), %rsi      # 0x130f9
callq 0x10d0
movq %rax, %rdi
movq 0x10f48(%rip), %rsi     # 0x15fd8
callq 0x1100
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xf940
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)