// File: /workspace/github_c_makefile_star2_O0/mjosaarinen[P]brutus/crypto_aead/shellaes128v2d5n64/ref/shellaes.c
// Function: shellaesDecVef_fb
int shellaesDecVef_fb(const u8 key[], const u8 nonce[], const u8 ad[], unsigned long long int adlen, const u8 c[], unsigned long long int ctlen, u8 p[], const u8 tag[]){

    u8 V[16], U[16], checksum[16], keyprime[16], F[16], L[16], Lprime[16];

    u8* S;
    u8* I;
    u8* Z;

    S=(u8 *) malloc(ctlen);
    I=(u8 *) malloc(ctlen);
    Z=(u8 *) malloc(ctlen);

    memset(V, 0, 16);
    memset(U, 0, 16);
    memset(checksum, 0, 16);
    memset(keyprime, 0, 16);
    memset(F, 0, 16);
    memset(L, 0, 16);
    memset(Lprime, 0, 16);

    u32 mk[4*d], sk[12*d], isk[12*d], rk[44], irk[44], rkprime[44];

    /*setup key materials*/
    aesKeySetupEnc(rk, key);
    aesKeySetupDec(irk, key);
    KeySetupDec(mk, sk, isk, L, Lprime, keyprime, rk, key);
    aesKeySetupEnc(rkprime, keyprime);

    /*process associated data*/
    PXMAC(mk, sk, L, V, rk, ad, adlen);

    /*decryption of XEX layer*/
    XEXLayerDec(irk, Lprime, c, Z, ctlen);

    /*decryption of PXENC layer*/
    PXDEC(mk, isk, L, V, Z, rk, I, ctlen);

    /*CENC layer*/
    CENC(rkprime, S, F, nonce, ctlen);

    /*produce the plaintext*/
    memcpy(p, S, ctlen);
    xor_byte_string(I, p, ctlen);

    /*verify the validness of tag*/
    int flag;
    memcpy(U, V, 16);
    checksum_state_string(I, checksum, ctlen);

    flag=tagVef(rk, checksum, Lprime, U, F, tag, ctlen);

    free(I);
    free(S);
    free(Z);

    return flag;

}

// Assembly:
subq $0x528, %rsp            # imm = 0x528
movq 0x538(%rsp), %rax
movq 0x530(%rsp), %rax
movq %rdi, 0x520(%rsp)
movq %rsi, 0x518(%rsp)
movq %rdx, 0x510(%rsp)
movq %rcx, 0x508(%rsp)
movq %r8, 0x500(%rsp)
movq %r9, 0x4f8(%rsp)
movq 0x4f8(%rsp), %rdi
callq 0x10b0
movq %rax, 0x478(%rsp)
movq 0x4f8(%rsp), %rdi
callq 0x10b0
movq %rax, 0x470(%rsp)
movq 0x4f8(%rsp), %rdi
callq 0x10b0
movq %rax, 0x468(%rsp)
leaq 0x4e0(%rsp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x1060
leaq 0x4d0(%rsp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x1060
leaq 0x4c0(%rsp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x1060
leaq 0x4b0(%rsp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x1060
leaq 0x4a0(%rsp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x1060
leaq 0x490(%rsp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x1060
leaq 0x480(%rsp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x1060
leaq 0x180(%rsp), %rdi
movq 0x520(%rsp), %rsi
callq 0x1130
leaq 0xd0(%rsp), %rdi
movq 0x520(%rsp), %rsi
callq 0x11f0
leaq 0x410(%rsp), %rdi
leaq 0x320(%rsp), %rsi
leaq 0x230(%rsp), %rdx
leaq 0x490(%rsp), %rcx
leaq 0x480(%rsp), %r8
leaq 0x4b0(%rsp), %r9
leaq 0x180(%rsp), %r10
movq 0x520(%rsp), %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x1050
leaq 0x20(%rsp), %rdi
leaq 0x4b0(%rsp), %rsi
callq 0x1130
leaq 0x410(%rsp), %rdi
leaq 0x320(%rsp), %rsi
leaq 0x490(%rsp), %rdx
leaq 0x4e0(%rsp), %rcx
leaq 0x180(%rsp), %r8
movq 0x510(%rsp), %r9
movq 0x508(%rsp), %rax
movq %rax, (%rsp)
callq 0x1150
leaq 0xd0(%rsp), %rdi
leaq 0x480(%rsp), %rsi
movq 0x500(%rsp), %rdx
movq 0x468(%rsp), %rcx
movq 0x4f8(%rsp), %r8
callq 0x1100
leaq 0x410(%rsp), %rdi
leaq 0x230(%rsp), %rsi
leaq 0x490(%rsp), %rdx
leaq 0x4e0(%rsp), %rcx
movq 0x468(%rsp), %r8
leaq 0x180(%rsp), %r9
movq 0x470(%rsp), %r10
movq 0x4f8(%rsp), %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x1090
leaq 0x20(%rsp), %rdi
movq 0x478(%rsp), %rsi
leaq 0x4a0(%rsp), %rdx
movq 0x518(%rsp), %rcx
movq 0x4f8(%rsp), %r8
callq 0x1140
movq 0x530(%rsp), %rdi
movq 0x478(%rsp), %rsi
movq 0x4f8(%rsp), %rdx
callq 0x1200
movq 0x470(%rsp), %rdi
movq 0x530(%rsp), %rsi
movq 0x4f8(%rsp), %rdx
callq 0x11e0
movq 0x4e0(%rsp), %rax
movq %rax, 0x4d0(%rsp)
movq 0x4e8(%rsp), %rax
movq %rax, 0x4d8(%rsp)
movq 0x470(%rsp), %rdi
leaq 0x4c0(%rsp), %rsi
movq 0x4f8(%rsp), %rdx
callq 0x1160
leaq 0x180(%rsp), %rdi
leaq 0x4c0(%rsp), %rsi
leaq 0x480(%rsp), %rdx
leaq 0x4d0(%rsp), %rcx
leaq 0x4a0(%rsp), %r8
movq 0x538(%rsp), %r9
movq 0x4f8(%rsp), %rax
movq %rax, (%rsp)
callq 0x10f0
movl %eax, 0x1c(%rsp)
movq 0x470(%rsp), %rdi
callq 0x1110
movq 0x478(%rsp), %rdi
callq 0x1110
movq 0x468(%rsp), %rdi
callq 0x1110
movl 0x1c(%rsp), %eax
addq $0x528, %rsp            # imm = 0x528
retq
nopw %cs:(%rax,%rax)