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

    uint8 expected[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
    };
    
    uint8 observed[128] = {0};
    struct kmip ctx = {0};
    kmip_init(&ctx, observed, ARRAY_LENGTH(observed), 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 ac = {0};
    ac.nonce = &n;
    ac.attestation_type = KMIP_ATTEST_TPM_QUOTE;
    ac.attestation_measurement = &am;
    ac.attestation_assertion = &aa;
    
    int result = kmip_encode_attestation_credential(&ctx, &ac);
    result = report_encoding_test_result(
        tracker,
        &ctx,
        expected,
        observed,
        result,
        __func__);
    kmip_destroy(&ctx);
    return(result);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x9d0, %rsp            # imm = 0x9D0
movq %rdi, %rbx
incw (%rdi)
xorps %xmm0, %xmm0
leaq 0xb0(%rsp), %r14
movaps %xmm0, 0x70(%r14)
movaps %xmm0, 0x60(%r14)
movaps %xmm0, 0x50(%r14)
movaps %xmm0, 0x40(%r14)
movaps %xmm0, 0x30(%r14)
movaps %xmm0, 0x20(%r14)
movaps %xmm0, 0x10(%r14)
movaps %xmm0, (%r14)
leaq 0x138(%rsp), %r15
movl $0x898, %edx            # imm = 0x898
movq %r15, %rdi
xorl %esi, %esi
callq 0x10c0
movl $0x80, %edx
movq %r15, %rdi
movq %r14, %rsi
movl $0x2, %ecx
callq 0x13747
leaq 0x4(%rsp), %rax
movl $0x4030201, (%rax)      # imm = 0x4030201
leaq 0x60(%rsp), %rcx
xorps %xmm1, %xmm1
movaps %xmm1, (%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
movaps %xmm1, (%rdx)
movq %rax, (%rdx)
movq $0x6, 0x8(%rdx)
leaq 0x40(%rsp), %rax
movaps %xmm1, (%rax)
movq %rcx, (%rax)
movq %rdx, 0x8(%rax)
movaps 0x1f885(%rip), %xmm0    # 0x2f1c0
leaq 0x30(%rsp), %rcx
movaps %xmm0, (%rcx)
leaq 0x20(%rsp), %rdx
movaps %xmm1, (%rdx)
movq %rcx, (%rdx)
movq $0x10, 0x8(%rdx)
movaps 0x24453(%rip), %xmm0    # 0x33db0
leaq 0x70(%rsp), %rcx
movaps %xmm0, (%rcx)
movl $0x99999999, 0x10(%rcx) # imm = 0x99999999
leaq 0x10(%rsp), %rdi
movaps %xmm1, (%rdi)
movq %rcx, (%rdi)
movq $0x14, 0x8(%rdi)
leaq 0x90(%rsp), %rsi
movaps %xmm1, (%rsi)
movaps %xmm1, 0x10(%rsi)
movq %rax, (%rsi)
movl $0x1, 0x8(%rsi)
movq %rdx, 0x10(%rsi)
movq %rdi, 0x18(%rsi)
movq %r15, %rdi
callq 0x1b0b4
leaq 0x24381(%rip), %rdx     # 0x33d30
leaq 0x216c3(%rip), %r9      # 0x31079
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rcx
movl %eax, %r8d
callq 0x123c
movl %eax, %ebx
movq %r15, %rdi
callq 0x13a23
movl %ebx, %eax
addq $0x9d0, %rsp            # imm = 0x9D0
popq %rbx
popq %r14
popq %r15
retq