// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xa10, %rsp            # imm = 0xA10
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movw (%rax), %cx
addw $0x1, %cx
movw %cx, (%rax)
leaq -0x90(%rbp), %rdi
leaq 0x2f565(%rip), %rsi     # 0x45e20
movl $0x80, %edx
callq 0x10c0
leaq -0x928(%rbp), %rdi
xorl %esi, %esi
movl $0x898, %edx            # imm = 0x898
callq 0x1090
leaq -0x90(%rbp), %rsi
leaq -0x928(%rbp), %rdi
movl $0x80, %edx
movl $0x2, %ecx
callq 0x1c6e0
movl 0x3081d(%rip), %eax     # 0x47118
movl %eax, -0x92c(%rbp)
leaq -0x940(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x1090
leaq -0x92c(%rbp), %rax
movq %rax, -0x940(%rbp)
movq $0x4, -0x938(%rbp)
movl 0x2f56d(%rip), %eax     # 0x45ea0
movl %eax, -0x946(%rbp)
movw 0x2f564(%rip), %ax      # 0x45ea4
movw %ax, -0x942(%rbp)
leaq -0x958(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x1090
leaq -0x946(%rbp), %rax
movq %rax, -0x958(%rbp)
movq $0x6, -0x950(%rbp)
leaq -0x968(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x1090
leaq -0x940(%rbp), %rax
movq %rax, -0x968(%rbp)
leaq -0x958(%rbp), %rax
movq %rax, -0x960(%rbp)
movq 0x308a7(%rip), %rax     # 0x47250
movq %rax, -0x980(%rbp)
movq 0x308a1(%rip), %rax     # 0x47258
movq %rax, -0x978(%rbp)
leaq -0x990(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x1090
leaq -0x980(%rbp), %rax
movq %rax, -0x990(%rbp)
movq $0x10, -0x988(%rbp)
movq 0x2f4bf(%rip), %rax     # 0x45eb0
movq %rax, -0x9b0(%rbp)
movq 0x2f4b9(%rip), %rax     # 0x45eb8
movq %rax, -0x9a8(%rbp)
movl 0x2f4b4(%rip), %eax     # 0x45ec0
movl %eax, -0x9a0(%rbp)
leaq -0x9c0(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x1090
leaq -0x9b0(%rbp), %rax
movq %rax, -0x9c0(%rbp)
movq $0x14, -0x9b8(%rbp)
leaq -0x9e0(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x1090
leaq -0x968(%rbp), %rax
movq %rax, -0x9e0(%rbp)
movl $0x1, -0x9d8(%rbp)
leaq -0x990(%rbp), %rax
movq %rax, -0x9d0(%rbp)
leaq -0x9c0(%rbp), %rax
movq %rax, -0x9c8(%rbp)
leaq -0xa00(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x1090
leaq -0x928(%rbp), %rdi
leaq -0xa00(%rbp), %rsi
callq 0x351c0
movl %eax, -0xa04(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xa10(%rbp)
leaq -0x9e0(%rbp), %rdi
leaq -0xa00(%rbp), %rsi
callq 0x23770
movq -0xa10(%rbp), %rdi
movl %eax, %edx
movl -0xa04(%rbp), %ecx
leaq -0x928(%rbp), %rsi
leaq 0x2a4f8(%rip), %r8      # 0x40fe4
callq 0x13a0
movl %eax, -0xa04(%rbp)
leaq -0x928(%rbp), %rdi
leaq -0xa00(%rbp), %rsi
callq 0x1f250
leaq -0x928(%rbp), %rdi
callq 0x1cab0
movl -0xa04(%rbp), %eax
addq $0xa10, %rsp            # imm = 0xA10
popq %rbp
retq
nopw %cs:(%rax,%rax)