// File: /workspace/github_c_makefile_star2_O2/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, -0x8(%rsp)
movl (%rsi), %ecx
movl 0x4(%rsi), %eax
bswapl %ecx
bswapl %eax
movl %ecx, %esi
shrl $0x4, %esi
xorl %eax, %esi
andl $0xf0f0f0f, %esi        # imm = 0xF0F0F0F
xorl %esi, %eax
shll $0x4, %esi
xorl %ecx, %esi
movl %esi, %ecx
shrl $0x10, %ecx
movzwl %ax, %edx
xorl %ecx, %edx
xorl %edx, %eax
shll $0x10, %edx
xorl %esi, %edx
movl %eax, %ecx
shrl $0x2, %ecx
xorl %edx, %ecx
andl $0x33333333, %ecx       # imm = 0x33333333
xorl %ecx, %edx
shll $0x2, %ecx
xorl %eax, %ecx
movl %ecx, %eax
shrl $0x8, %eax
xorl %edx, %eax
andl $0xff00ff, %eax         # imm = 0xFF00FF
xorl %eax, %edx
shll $0x8, %eax
xorl %ecx, %eax
roll %eax
movl %eax, %ecx
xorl %edx, %ecx
andl $0xaaaaaaaa, %ecx       # imm = 0xAAAAAAAA
xorl %ecx, %eax
xorl %edx, %ecx
roll %ecx
xorl %esi, %esi
movl $0xfc, %r9d
leaq 0x6d08(%rip), %r10      # 0xb3e0
leaq 0x6e01(%rip), %r11      # 0xb4e0
leaq 0x6efa(%rip), %rbx      # 0xb5e0
leaq 0x6ff3(%rip), %r14      # 0xb6e0
leaq 0x70ec(%rip), %r15      # 0xb7e0
leaq 0x71e5(%rip), %r12      # 0xb8e0
leaq 0x72de(%rip), %r13      # 0xb9e0
cmpl $0x80, %esi
je 0x480b
movl 0x4(%rdi,%rsi), %edx
xorl %eax, %edx
movl %edx, %r8d
andl $0x3f, %r8d
movl (%r10,%r8,4), %ebp
movl %edx, %r8d
shrl $0x6, %r8d
andl %r9d, %r8d
xorl (%r8,%r11), %ebp
movl %edx, %r8d
shrl $0xe, %r8d
andl %r9d, %r8d
shrl $0x16, %edx
andl %r9d, %edx
xorl (%r8,%rbx), %ebp
movl %eax, %r8d
roll $0x1c, %r8d
xorl 0x8(%rdi,%rsi), %r8d
xorl (%rdx,%r14), %ebp
movl %r8d, %edx
andl $0x3f, %edx
xorl (%r15,%rdx,4), %ebp
movl %r8d, %edx
shrl $0x6, %edx
andl %r9d, %edx
xorl (%rdx,%r12), %ebp
movl %r8d, %edx
shrl $0xe, %edx
andl %r9d, %edx
shrl $0x16, %r8d
andl %r9d, %r8d
xorl (%rdx,%r13), %ebp
leaq 0x735d(%rip), %rdx      # 0xbae0
xorl (%r8,%rdx), %ebp
xorl %ebp, %ecx
movl 0xc(%rdi,%rsi), %r8d
xorl %ecx, %r8d
movl %r8d, %edx
andl $0x3f, %edx
movl (%r10,%rdx,4), %ebp
movl %r8d, %edx
shrl $0x6, %edx
andl %r9d, %edx
xorl (%rdx,%r11), %ebp
movl %r8d, %edx
shrl $0xe, %edx
andl %r9d, %edx
shrl $0x16, %r8d
xorl (%rdx,%rbx), %ebp
movl %ecx, %edx
roll $0x1c, %edx
xorl 0x10(%rdi,%rsi), %edx
andl %r9d, %r8d
xorl (%r8,%r14), %ebp
movl %edx, %r8d
andl $0x3f, %r8d
xorl (%r15,%r8,4), %ebp
movl %edx, %r8d
shrl $0x6, %r8d
andl %r9d, %r8d
xorl (%r8,%r12), %ebp
movl %edx, %r8d
shrl $0xe, %r8d
andl %r9d, %r8d
xorl (%r8,%r13), %ebp
shrl $0x16, %edx
andl %r9d, %edx
leaq 0x72e4(%rip), %r8       # 0xbae0
xorl (%rdx,%r8), %ebp
xorl %ebp, %eax
addq $0x10, %rsi
jmp 0x4702
rorl %eax
movl %eax, %edx
xorl %ecx, %edx
andl $0xaaaaaaaa, %edx       # imm = 0xAAAAAAAA
xorl %edx, %eax
xorl %ecx, %edx
rorl %edx
movl %edx, %esi
shrl $0x8, %esi
xorl %eax, %esi
andl $0xff00ff, %esi         # imm = 0xFF00FF
xorl %esi, %eax
shll $0x8, %esi
xorl %edx, %esi
movl %esi, %ecx
shrl $0x2, %ecx
xorl %eax, %ecx
andl $0x33333333, %ecx       # imm = 0x33333333
xorl %ecx, %eax
shll $0x2, %ecx
xorl %esi, %ecx
movl %eax, %edx
shrl $0x10, %edx
movzwl %cx, %esi
xorl %edx, %esi
xorl %esi, %ecx
shll $0x10, %esi
xorl %eax, %esi
movl %esi, %eax
shrl $0x4, %eax
xorl %ecx, %eax
andl $0xf0f0f0f, %eax        # imm = 0xF0F0F0F
xorl %eax, %ecx
shll $0x4, %eax
xorl %esi, %eax
movl %eax, %edx
shrl $0x18, %edx
movq -0x8(%rsp), %rsi
movb %dl, (%rsi)
movl %eax, %edx
shrl $0x10, %edx
movb %dl, 0x1(%rsi)
movb %ah, 0x2(%rsi)
movb %al, 0x3(%rsi)
movl %ecx, %eax
shrl $0x18, %eax
movb %al, 0x4(%rsi)
movl %ecx, %eax
shrl $0x10, %eax
movb %al, 0x5(%rsi)
movb %ch, 0x6(%rsi)
movb %cl, 0x7(%rsi)
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq