// File: /workspace/github_c_makefile_star2_O3/OpenKMIP[P]libkmip/tests/tests.c
// Function: test_decode_attestation_credential
int
test_decode_attestation_credential(TestTracker *tracker)
{
    TRACK_TEST(tracker);

    uint8 encoding[128] = {
        0x42, 0x00, 0x25, 0x01, 0x00, 0x00, 0x00, 0x70,
        0x42, 0x00, 0xC8, 0x01, 0x00, 0x00, 0x00, 0x20,
        0x42, 0x00, 0xC9, 0x08, 0x00, 0x00, 0x00, 0x04,
        0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00,
        0x42, 0x00, 0xCA, 0x08, 0x00, 0x00, 0x00, 0x06,
        0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
        0x42, 0x00, 0xC7, 0x05, 0x00, 0x00, 0x00, 0x04,
        0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
        0x42, 0x00, 0xCB, 0x08, 0x00, 0x00, 0x00, 0x10,
        0x22, 0x22, 0x22, 0x22, 0x44, 0x44, 0x44, 0x44,
        0x66, 0x66, 0x66, 0x66, 0x88, 0x88, 0x88, 0x88,
        0x42, 0x00, 0xCC, 0x08, 0x00, 0x00, 0x00, 0x14,
        0x11, 0x11, 0x11, 0x11, 0x33, 0x33, 0x33, 0x33,
        0x55, 0x55, 0x55, 0x55, 0x77, 0x77, 0x77, 0x77,
        0x99, 0x99, 0x99, 0x99, 0x00, 0x00, 0x00, 0x00
    };
    
    struct kmip ctx = {0};
    kmip_init(&ctx, encoding, ARRAY_LENGTH(encoding), KMIP_1_2);
    
    uint8 nonce_id[4] = {0x01, 0x02, 0x03, 0x04};
    struct byte_string ni = {0};
    ni.value = nonce_id;
    ni.size = ARRAY_LENGTH(nonce_id);
    
    uint8 nonce_value[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
    struct byte_string nv = {0};
    nv.value = nonce_value;
    nv.size = ARRAY_LENGTH(nonce_value);
    
    struct nonce n = {0};
    n.nonce_id = &ni;
    n.nonce_value = &nv;
    
    uint8 measurement[16] = {
        0x22, 0x22, 0x22, 0x22, 0x44, 0x44, 0x44, 0x44,
        0x66, 0x66, 0x66, 0x66, 0x88, 0x88, 0x88, 0x88
    };
    struct byte_string am = {0};
    am.value = measurement;
    am.size = ARRAY_LENGTH(measurement);
    
    uint8 assertion[20] = {
        0x11, 0x11, 0x11, 0x11, 0x33, 0x33, 0x33, 0x33,
        0x55, 0x55, 0x55, 0x55, 0x77, 0x77, 0x77, 0x77,
        0x99, 0x99, 0x99, 0x99
    };
    struct byte_string aa = {0};
    aa.value = assertion;
    aa.size = ARRAY_LENGTH(assertion);
    
    struct attestation_credential expected = {0};
    expected.nonce = &n;
    expected.attestation_type = KMIP_ATTEST_TPM_QUOTE;
    expected.attestation_measurement = &am;
    expected.attestation_assertion = &aa;
    
    struct attestation_credential observed = {0};
    
    int result = kmip_decode_attestation_credential(&ctx, &observed);
    result = report_decoding_test_result(
        tracker,
        &ctx,
        kmip_compare_attestation_credential(&expected, &observed),
        result,
        __func__);
    kmip_free_attestation_credential(&ctx, &observed);
    kmip_destroy(&ctx);
    return(result);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x9f0, %rsp            # imm = 0x9F0
movq %rdi, %r14
incw (%rdi)
leaq 0x22732(%rip), %rsi     # 0x31d20
leaq 0xd0(%rsp), %r15
movl $0x10, %ecx
movq %r15, %rdi
rep  movsq (%rsi), %es:(%rdi)
leaq 0x158(%rsp), %rbx
movl $0x898, %edx            # imm = 0x898
movq %rbx, %rdi
xorl %esi, %esi
callq 0x10c0
movl $0x80, %edx
movq %rbx, %rdi
movq %r15, %rsi
movl $0x2, %ecx
callq 0x13177
leaq 0x4(%rsp), %rax
movl $0x4030201, (%rax)      # imm = 0x4030201
leaq 0x60(%rsp), %rcx
movq %rax, (%rcx)
movq $0x4, 0x8(%rcx)
leaq 0x8(%rsp), %rax
movw $0xffff, 0x4(%rax)      # imm = 0xFFFF
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
leaq 0x50(%rsp), %rdx
movq %rax, (%rdx)
movq $0x6, 0x8(%rdx)
leaq 0x40(%rsp), %rax
movq %rcx, (%rax)
movq %rdx, 0x8(%rax)
movaps 0x1db44(%rip), %xmm0    # 0x2d1c0
leaq 0x10(%rsp), %rcx
movaps %xmm0, (%rcx)
leaq 0x30(%rsp), %rdx
movq %rcx, (%rdx)
movq $0x10, 0x8(%rdx)
movaps 0x22705(%rip), %xmm0    # 0x31da0
leaq 0x70(%rsp), %rcx
movaps %xmm0, (%rcx)
movl $0x99999999, 0x10(%rcx) # imm = 0x99999999
leaq 0x20(%rsp), %rsi
movq %rcx, (%rsi)
movq $0x14, 0x8(%rsi)
leaq 0xb0(%rsp), %r15
movq $0x0, 0x8(%r15)
movq %rax, (%r15)
movl $0x1, 0x8(%r15)
movq %rdx, 0x10(%r15)
movq %rsi, 0x18(%r15)
xorps %xmm0, %xmm0
leaq 0x90(%rsp), %r12
movaps %xmm0, 0x10(%r12)
movaps %xmm0, (%r12)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x25e01
movl %eax, %ebp
movq %r15, %rdi
movq %r12, %rsi
callq 0x16ed1
leaq 0x1f98a(%rip), %r8      # 0x2f09c
movq %r14, %rdi
movq %rbx, %rsi
movl %eax, %edx
movl %ebp, %ecx
callq 0x1363
movl %eax, %ebp
movq %rbx, %rdi
movq %r12, %rsi
callq 0x14bea
movq %rbx, %rdi
callq 0x13455
movl %ebp, %eax
addq $0x9f0, %rsp            # imm = 0x9F0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq