// File: /workspace/github_c_makefile_star2_O3/zecoxao[P]ps3_decrypt_tools/lib/des.c
// Function: des_crypt_ecb
int des_crypt_ecb(des_context *ctx,
        const unsigned char input[8],
        unsigned char output[8]) {
    int i;
    uint32_t X, Y, T, *SK;

    SK = ctx->sk;

    GET_UINT32_BE(X, input, 0);
    GET_UINT32_BE(Y, input, 4);

    DES_IP(X, Y);

    for (i = 0; i < 8; i++) {
        DES_ROUND(Y, X);
        DES_ROUND(X, Y);
    }

    DES_FP(Y, X);

    PUT_UINT32_BE(Y, output, 0);
    PUT_UINT32_BE(X, output, 4);

    return ( 0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, -0x10(%rsp)
movq %rdi, -0x8(%rsp)
movl (%rsi), %ecx
movl 0x4(%rsi), %eax
bswapl %ecx
bswapl %eax
movl %ecx, %edx
shrl $0x4, %edx
xorl %eax, %edx
andl $0xf0f0f0f, %edx        # imm = 0xF0F0F0F
xorl %edx, %eax
shll $0x4, %edx
xorl %ecx, %edx
movl %edx, %esi
shrl $0x10, %esi
movzwl %ax, %ecx
xorl %esi, %ecx
xorl %ecx, %eax
shll $0x10, %ecx
xorl %edx, %ecx
movl %eax, %edx
shrl $0x2, %edx
xorl %ecx, %edx
andl $0x33333333, %edx       # imm = 0x33333333
xorl %edx, %ecx
shll $0x2, %edx
xorl %eax, %edx
movl %edx, %ebp
shrl $0x8, %ebp
xorl %ecx, %ebp
andl $0xff00ff, %ebp         # imm = 0xFF00FF
xorl %ebp, %ecx
shll $0x8, %ebp
xorl %edx, %ebp
roll %ebp
movl %ebp, %eax
xorl %ecx, %eax
andl $0xaaaaaaaa, %eax       # imm = 0xAAAAAAAA
xorl %eax, %ebp
xorl %ecx, %eax
roll %eax
xorl %ecx, %ecx
movl $0xfc, %r13d
movq -0x8(%rsp), %r8
leaq 0x7ddf(%rip), %r11      # 0xc5e0
leaq 0x7ed8(%rip), %rbx      # 0xc6e0
leaq 0x7fd1(%rip), %r14      # 0xc7e0
leaq 0x80ca(%rip), %r15      # 0xc8e0
leaq 0x81c3(%rip), %r12      # 0xc9e0
movl %ebp, %edx
movl 0x4(%r8,%rcx), %ebp
xorl %edx, %ebp
movl %edx, %edi
movl %ebp, %edx
andl $0x3f, %edx
movl %ebp, %esi
shrl $0x6, %esi
andl %r13d, %esi
leaq 0x7ba4(%rip), %r9       # 0xc3e0
xorl (%r9,%rdx,4), %eax
movl %ebp, %edx
shrl $0xe, %edx
andl %r13d, %edx
shrl $0x16, %ebp
andl %r13d, %ebp
leaq 0x7c8b(%rip), %r10      # 0xc4e0
xorl (%rsi,%r10), %eax
movl %edi, %esi
movl %edi, %r10d
roll $0x1c, %esi
xorl 0x8(%r8,%rcx), %esi
xorl (%rdx,%r11), %eax
movl %esi, %edx
andl $0x3f, %edx
xorl (%rbp,%rbx), %eax
movl %esi, %ebp
shrl $0x6, %ebp
andl %r13d, %ebp
xorl (%r14,%rdx,4), %eax
movl %esi, %edx
shrl $0xe, %edx
andl %r13d, %edx
shrl $0x16, %esi
andl %r13d, %esi
xorl (%rbp,%r15), %eax
xorl (%rdx,%r12), %eax
leaq 0x8243(%rip), %rdi      # 0xcae0
xorl (%rsi,%rdi), %eax
movl 0xc(%r8,%rcx), %esi
xorl %eax, %esi
movl %esi, %edx
andl $0x3f, %edx
movl (%r9,%rdx,4), %ebp
movl %esi, %edx
shrl $0x6, %edx
andl %r13d, %edx
leaq 0x7c21(%rip), %r9       # 0xc4e0
xorl (%rdx,%r9), %ebp
movl %esi, %edx
shrl $0xe, %edx
andl %r13d, %edx
shrl $0x16, %esi
andl %r13d, %esi
xorl (%rdx,%r11), %ebp
movl %eax, %edx
roll $0x1c, %edx
xorl 0x10(%r8,%rcx), %edx
xorl (%rsi,%rbx), %ebp
movl %edx, %esi
andl $0x3f, %esi
xorl (%r14,%rsi,4), %ebp
movl %edx, %esi
shrl $0x6, %esi
andl %r13d, %esi
xorl (%rsi,%r15), %ebp
movl %edx, %esi
shrl $0xe, %esi
andl %r13d, %esi
xorl (%rsi,%r12), %ebp
shrl $0x16, %edx
andl %r13d, %edx
xorl (%rdx,%rdi), %ebp
xorl %r10d, %ebp
addq $0x10, %rcx
cmpl $0x80, %ecx
jne 0x481d
rorl %ebp
movl %ebp, %ecx
xorl %eax, %ecx
andl $0xaaaaaaaa, %ecx       # imm = 0xAAAAAAAA
xorl %ecx, %ebp
xorl %eax, %ecx
rorl %ecx
movl %ecx, %edx
shrl $0x8, %edx
xorl %ebp, %edx
andl $0xff00ff, %edx         # imm = 0xFF00FF
xorl %edx, %ebp
shll $0x8, %edx
xorl %ecx, %edx
movl %edx, %eax
shrl $0x2, %eax
xorl %ebp, %eax
andl $0x33333333, %eax       # imm = 0x33333333
xorl %eax, %ebp
shll $0x2, %eax
xorl %edx, %eax
movl %ebp, %ecx
shrl $0x10, %ecx
movzwl %ax, %edx
xorl %ecx, %edx
xorl %edx, %eax
shll $0x10, %edx
xorl %ebp, %edx
movl %edx, %ecx
shrl $0x4, %ecx
xorl %eax, %ecx
andl $0xf0f0f0f, %ecx        # imm = 0xF0F0F0F
xorl %ecx, %eax
shll $0x4, %ecx
xorl %edx, %ecx
movl %ecx, %edx
shrl $0x18, %edx
movq -0x10(%rsp), %rsi
movb %dl, (%rsi)
movl %ecx, %edx
shrl $0x10, %edx
movb %dl, 0x1(%rsi)
movb %ch, 0x2(%rsi)
movb %cl, 0x3(%rsi)
movl %eax, %ecx
shrl $0x18, %ecx
movb %cl, 0x4(%rsi)
movl %eax, %ecx
shrl $0x10, %ecx
movb %cl, 0x5(%rsi)
movb %ah, 0x6(%rsi)
movb %al, 0x7(%rsi)
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq