// File: /workspace/github_c_makefile_star2_O2/fritzw[P]cube-utils/blowfish.c
// Function: blowfish_decrypt
void blowfish_decrypt(const BYTE in[], BYTE out[], const BLOWFISH_KEY *keystruct, int compatibility_mode)
{
    WORD l,r,t; //,i;

    if (compatibility_mode) {
        // Swap input byte order to conform with broken encoding
        l = (in[3] << 24) | (in[2] << 16) | (in[1] << 8) | (in[0]);
        r = (in[7] << 24) | (in[6] << 16) | (in[5] << 8) | (in[4]);
    } else {
        l = (in[0] << 24) | (in[1] << 16) | (in[2] << 8) | (in[3]);
        r = (in[4] << 24) | (in[5] << 16) | (in[6] << 8) | (in[7]);
    }

    ITERATION(l,r,t,17);
    ITERATION(l,r,t,16);
    ITERATION(l,r,t,15);
    ITERATION(l,r,t,14);
    ITERATION(l,r,t,13);
    ITERATION(l,r,t,12);
    ITERATION(l,r,t,11);
    ITERATION(l,r,t,10);
    ITERATION(l,r,t,9);
    ITERATION(l,r,t,8);
    ITERATION(l,r,t,7);
    ITERATION(l,r,t,6);
    ITERATION(l,r,t,5);
    ITERATION(l,r,t,4);
    ITERATION(l,r,t,3);
    l ^= keystruct->p[2]; F(l,t); r^= t; //Last iteration has no swap()
    r ^= keystruct->p[1];
    l ^= keystruct->p[0];

    if (compatibility_mode) {
        // Swap input byte order to conform with broken encoding
        out[3] = l >> 24;
        out[2] = l >> 16;
        out[1] = l >> 8;
        out[0] = l;
        out[7] = r >> 24;
        out[6] = r >> 16;
        out[5] = r >> 8;
        out[4] = r;
    } else {
        out[0] = l >> 24;
        out[1] = l >> 16;
        out[2] = l >> 8;
        out[3] = l;
        out[4] = r >> 24;
        out[5] = r >> 16;
        out[6] = r >> 8;
        out[7] = r;
    }
}

// Assembly:
testl %ecx, %ecx
je 0x1a60
movl (%rdi), %r9d
movl 0x4(%rdi), %r10d
jmp 0x1a6d
movl (%rdi), %r9d
movl 0x4(%rdi), %r10d
bswapl %r9d
bswapl %r10d
pushq %rbp
pushq %rbx
xorl 0x44(%rdx), %r9d
movl %r9d, %eax
shrl $0x18, %eax
movl %r9d, %r8d
shrl $0xe, %r8d
movl $0x3fc, %edi            # imm = 0x3FC
andl %edi, %r8d
movl 0x448(%rdx,%r8), %r8d
addl 0x48(%rdx,%rax,4), %r8d
movl %r9d, %r11d
shrl $0x8, %r11d
movl $0xff, %eax
andl %eax, %r11d
xorl 0x848(%rdx,%r11,4), %r8d
movl %r9d, %r11d
andl %eax, %r11d
addl 0xc48(%rdx,%r11,4), %r8d
xorl %r10d, %r8d
xorl 0x40(%rdx), %r8d
movl %r8d, %r11d
shrl $0x18, %r11d
movl %r8d, %r10d
shrl $0xe, %r10d
andl %edi, %r10d
movl 0x448(%rdx,%r10), %r10d
addl 0x48(%rdx,%r11,4), %r10d
movl %r8d, %r11d
shrl $0x8, %r11d
andl %eax, %r11d
xorl 0x848(%rdx,%r11,4), %r10d
movl %r8d, %r11d
andl %eax, %r11d
addl 0xc48(%rdx,%r11,4), %r10d
xorl 0x3c(%rdx), %r10d
xorl %r9d, %r10d
movl %r10d, %r11d
shrl $0x18, %r11d
movl %r10d, %r9d
shrl $0xe, %r9d
andl %edi, %r9d
movl 0x448(%rdx,%r9), %r9d
addl 0x48(%rdx,%r11,4), %r9d
movl %r10d, %r11d
shrl $0x8, %r11d
andl %eax, %r11d
xorl 0x848(%rdx,%r11,4), %r9d
movl %r10d, %r11d
andl %eax, %r11d
addl 0xc48(%rdx,%r11,4), %r9d
xorl 0x38(%rdx), %r9d
xorl %r8d, %r9d
movl %r9d, %r11d
shrl $0x18, %r11d
movl %r9d, %r8d
shrl $0xe, %r8d
andl %edi, %r8d
movl 0x448(%rdx,%r8), %r8d
addl 0x48(%rdx,%r11,4), %r8d
movl %r9d, %r11d
shrl $0x8, %r11d
andl %eax, %r11d
xorl 0x848(%rdx,%r11,4), %r8d
movl %r9d, %r11d
andl %eax, %r11d
addl 0xc48(%rdx,%r11,4), %r8d
xorl 0x34(%rdx), %r8d
xorl %r10d, %r8d
movl %r8d, %r11d
shrl $0x18, %r11d
movl %r8d, %r10d
shrl $0xe, %r10d
andl %edi, %r10d
movl 0x448(%rdx,%r10), %r10d
addl 0x48(%rdx,%r11,4), %r10d
movl %r8d, %r11d
shrl $0x8, %r11d
andl %eax, %r11d
xorl 0x848(%rdx,%r11,4), %r10d
movl %r8d, %r11d
andl %eax, %r11d
addl 0xc48(%rdx,%r11,4), %r10d
xorl 0x30(%rdx), %r10d
xorl %r9d, %r10d
movl %r10d, %r11d
shrl $0x18, %r11d
movl %r10d, %r9d
shrl $0xe, %r9d
andl %edi, %r9d
movl 0x448(%rdx,%r9), %r9d
addl 0x48(%rdx,%r11,4), %r9d
movl %r10d, %r11d
shrl $0x8, %r11d
andl %eax, %r11d
xorl 0x848(%rdx,%r11,4), %r9d
movl %r10d, %r11d
andl %eax, %r11d
addl 0xc48(%rdx,%r11,4), %r9d
xorl 0x2c(%rdx), %r9d
xorl %r8d, %r9d
movl %r9d, %r11d
shrl $0x18, %r11d
movl %r9d, %r8d
shrl $0xe, %r8d
andl %edi, %r8d
movl 0x448(%rdx,%r8), %r8d
addl 0x48(%rdx,%r11,4), %r8d
movl %r9d, %r11d
shrl $0x8, %r11d
andl %eax, %r11d
xorl 0x848(%rdx,%r11,4), %r8d
movl %r9d, %r11d
andl %eax, %r11d
addl 0xc48(%rdx,%r11,4), %r8d
xorl 0x28(%rdx), %r8d
xorl %r10d, %r8d
movl %r8d, %r11d
shrl $0x18, %r11d
movl %r8d, %r10d
shrl $0xe, %r10d
andl %edi, %r10d
movl 0x448(%rdx,%r10), %r10d
addl 0x48(%rdx,%r11,4), %r10d
movl %r8d, %r11d
shrl $0x8, %r11d
andl %eax, %r11d
xorl 0x848(%rdx,%r11,4), %r10d
movl %r8d, %r11d
andl %eax, %r11d
addl 0xc48(%rdx,%r11,4), %r10d
xorl 0x24(%rdx), %r10d
xorl %r9d, %r10d
movl %r10d, %r11d
shrl $0x18, %r11d
movl %r10d, %r9d
shrl $0xe, %r9d
andl %edi, %r9d
movl 0x448(%rdx,%r9), %r9d
addl 0x48(%rdx,%r11,4), %r9d
movl %r10d, %r11d
shrl $0x8, %r11d
andl %eax, %r11d
xorl 0x848(%rdx,%r11,4), %r9d
movl %r10d, %r11d
andl %eax, %r11d
addl 0xc48(%rdx,%r11,4), %r9d
xorl 0x20(%rdx), %r9d
xorl %r8d, %r9d
movl %r9d, %r11d
shrl $0x18, %r11d
movl %r9d, %r8d
shrl $0xe, %r8d
andl %edi, %r8d
movl 0x448(%rdx,%r8), %r8d
addl 0x48(%rdx,%r11,4), %r8d
movl %r9d, %r11d
shrl $0x8, %r11d
andl %eax, %r11d
xorl 0x848(%rdx,%r11,4), %r8d
movl %r9d, %r11d
andl %eax, %r11d
addl 0xc48(%rdx,%r11,4), %r8d
xorl 0x1c(%rdx), %r8d
xorl %r10d, %r8d
movl %r8d, %r11d
shrl $0x18, %r11d
movl %r8d, %r10d
shrl $0xe, %r10d
andl %edi, %r10d
movl 0x448(%rdx,%r10), %r10d
addl 0x48(%rdx,%r11,4), %r10d
movl %r8d, %r11d
shrl $0x8, %r11d
andl %eax, %r11d
xorl 0x848(%rdx,%r11,4), %r10d
movl %r8d, %r11d
andl %eax, %r11d
addl 0xc48(%rdx,%r11,4), %r10d
xorl 0x18(%rdx), %r10d
xorl %r9d, %r10d
movl %r10d, %r11d
shrl $0x18, %r11d
movl %r10d, %r9d
shrl $0xe, %r9d
andl %edi, %r9d
movl 0x448(%rdx,%r9), %r9d
addl 0x48(%rdx,%r11,4), %r9d
movl %r10d, %r11d
shrl $0x8, %r11d
andl %eax, %r11d
xorl 0x848(%rdx,%r11,4), %r9d
movl %r10d, %r11d
andl %eax, %r11d
addl 0xc48(%rdx,%r11,4), %r9d
xorl 0x14(%rdx), %r9d
xorl %r8d, %r9d
movl %r9d, %r8d
shrl $0x18, %r8d
movl %r9d, %r11d
shrl $0xe, %r11d
andl %edi, %r11d
movl 0x448(%rdx,%r11), %r11d
addl 0x48(%rdx,%r8,4), %r11d
movl %r9d, %r8d
shrl $0x8, %r8d
andl %eax, %r8d
xorl 0x848(%rdx,%r8,4), %r11d
movl %r9d, %r8d
andl %eax, %r8d
addl 0xc48(%rdx,%r8,4), %r11d
xorl 0x10(%rdx), %r11d
xorl %r10d, %r11d
movl %r11d, %r8d
shrl $0x18, %r8d
movl %r11d, %r10d
shrl $0xe, %r10d
andl %edi, %r10d
movl 0x448(%rdx,%r10), %r10d
addl 0x48(%rdx,%r8,4), %r10d
movl %r11d, %r8d
shrl $0x8, %r8d
andl %eax, %r8d
xorl 0x848(%rdx,%r8,4), %r10d
movl %r11d, %r8d
andl %eax, %r8d
addl 0xc48(%rdx,%r8,4), %r10d
xorl 0xc(%rdx), %r10d
xorl %r9d, %r10d
movl %r10d, %r9d
shrl $0x18, %r9d
movl %r10d, %r8d
shrl $0xe, %r8d
andl %edi, %r8d
movl 0x448(%rdx,%r8), %r8d
addl 0x48(%rdx,%r9,4), %r8d
movl %r10d, %r9d
shrl $0x8, %r9d
andl %eax, %r9d
xorl 0x848(%rdx,%r9,4), %r8d
movl %r10d, %r9d
andl %eax, %r9d
addl 0xc48(%rdx,%r9,4), %r8d
xorl 0x8(%rdx), %r8d
xorl %r11d, %r8d
movl %r8d, %r9d
shrl $0x18, %r9d
movl %r8d, %r11d
shrl $0xe, %r11d
andl %edi, %r11d
movl 0x448(%rdx,%r11), %edi
addl 0x48(%rdx,%r9,4), %edi
movl %r8d, %r9d
shrl $0x8, %r9d
andl %eax, %r9d
xorl 0x848(%rdx,%r9,4), %edi
andl %r8d, %eax
addl 0xc48(%rdx,%rax,4), %edi
xorl 0x4(%rdx), %edi
xorl %r10d, %edi
xorl (%rdx), %r8d
movl %r8d, %eax
shrl $0x18, %eax
movl %r8d, %r11d
shrl $0x10, %r11d
movl %r8d, %r9d
shrl $0x8, %r9d
movl %edi, %edx
shrl $0x18, %edx
movl %edi, %ebx
shrl $0x10, %ebx
movl %edi, %r10d
shrl $0x8, %r10d
testl %ecx, %ecx
movl %edx, %ecx
cmovel %edi, %ecx
movl %ebx, %ebp
cmovel %r10d, %ebp
cmovel %ebx, %r10d
cmovnel %edi, %edx
movl %eax, %edi
cmovel %r8d, %edi
movl %r11d, %ebx
cmovel %r9d, %ebx
cmovel %r11d, %r9d
cmovnel %r8d, %eax
movb %al, (%rsi)
movb %r9b, 0x1(%rsi)
movb %bl, 0x2(%rsi)
movb %dil, 0x3(%rsi)
movb %dl, 0x4(%rsi)
movb %r10b, 0x5(%rsi)
movb %bpl, 0x6(%rsi)
movb %cl, 0x7(%rsi)
popq %rbx
popq %rbp
retq