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

    uint8 expected[216] = {
        0x42, 0x00, 0x77, 0x01, 0x00, 0x00, 0x00, 0xD0, 
        0x42, 0x00, 0x69, 0x01, 0x00, 0x00, 0x00, 0x20, 
        0x42, 0x00, 0x6A, 0x02, 0x00, 0x00, 0x00, 0x04, 
        0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 
        0x42, 0x00, 0x6B, 0x02, 0x00, 0x00, 0x00, 0x04, 
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
        0x42, 0x00, 0xD3, 0x06, 0x00, 0x00, 0x00, 0x08,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
        0x42, 0x00, 0xC7, 0x05, 0x00, 0x00, 0x00, 0x04,
        0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
        0x42, 0x00, 0xC7, 0x05, 0x00, 0x00, 0x00, 0x04,
        0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
        0x42, 0x00, 0x0C, 0x01, 0x00, 0x00, 0x00, 0x40, 
        0x42, 0x00, 0x23, 0x01, 0x00, 0x00, 0x00, 0x38, 
        0x42, 0x00, 0x24, 0x05, 0x00, 0x00, 0x00, 0x04, 
        0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 
        0x42, 0x00, 0x25, 0x01, 0x00, 0x00, 0x00, 0x20, 
        0x42, 0x00, 0x99, 0x07, 0x00, 0x00, 0x00, 0x06, 
        0x42, 0x61, 0x72, 0x6E, 0x65, 0x79, 0x00, 0x00, 
        0x42, 0x00, 0xA1, 0x07, 0x00, 0x00, 0x00, 0x07, 
        0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x32, 0x00, 
        0x42, 0x00, 0x0E, 0x05, 0x00, 0x00, 0x00, 0x04, 
        0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 
        0x42, 0x00, 0x10, 0x06, 0x00, 0x00, 0x00, 0x08, 
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 
        0x42, 0x00, 0x0D, 0x02, 0x00, 0x00, 0x00, 0x04, 
        0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00
    };
    
    uint8 observed[216] = {0};
    struct kmip ctx = {0};
    kmip_init(&ctx, observed, ARRAY_LENGTH(observed), KMIP_1_2);
    
    struct protocol_version pv = {0};
    pv.major = 1;
    pv.minor = 0;
    
    struct text_string username = {0};
    username.value = "Barney";
    username.size = 6;
    struct text_string password = {0};
    password.value = "secret2";
    password.size = 7;
    
    struct username_password_credential upc = {0};
    upc.username = &username;
    upc.password = &password;
    
    struct credential c = {0};
    c.credential_type = KMIP_CRED_USERNAME_AND_PASSWORD;
    c.credential_value = &upc;
    
    struct authentication a = {0};
    a.credential = &c;
    
    enum attestation_type types[2] = {
        KMIP_ATTEST_TPM_QUOTE, 
        KMIP_ATTEST_SAML_ASSERTION
    };
    
    struct request_header rh = {0};
    kmip_init_request_header(&rh);
    
    rh.protocol_version = &pv;
    rh.attestation_capable_indicator = KMIP_TRUE;
    rh.attestation_types = types;
    rh.attestation_type_count = ARRAY_LENGTH(types);
    rh.authentication = &a;
    rh.batch_error_continuation_option = KMIP_BATCH_CONTINUE;
    rh.batch_order_option = KMIP_TRUE;
    rh.batch_count = 2;
    
    int result = kmip_encode_request_header(&ctx, &rh);
    result = report_encoding_test_result(
        tracker,
        &ctx,
        expected,
        observed,
        result,
        __func__);
    kmip_destroy(&ctx);
    return(result);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa28, %rsp            # imm = 0xA28
movq %rdi, %rbx
incw (%rdi)
leaq 0xb0(%rsp), %r14
movl $0xd8, %edx
movq %r14, %rdi
xorl %esi, %esi
callq 0x10c0
leaq 0x190(%rsp), %r15
movl $0x898, %edx            # imm = 0x898
movq %r15, %rdi
xorl %esi, %esi
callq 0x10c0
movl $0xd8, %edx
movq %r15, %rdi
movq %r14, %rsi
movl $0x2, %ecx
callq 0x13747
leaq 0x18(%rsp), %r13
movq $0x1, (%r13)
xorps %xmm0, %xmm0
leaq 0x50(%rsp), %rax
movaps %xmm0, (%rax)
leaq 0x209f3(%rip), %rcx     # 0x305d2
movq %rcx, (%rax)
movq $0x6, 0x8(%rax)
leaq 0x40(%rsp), %rcx
movaps %xmm0, (%rcx)
leaq 0x209e0(%rip), %rdx     # 0x305d9
movq %rdx, (%rcx)
movq $0x7, 0x8(%rcx)
leaq 0x30(%rsp), %rdx
movaps %xmm0, (%rdx)
movq %rax, (%rdx)
movq %rcx, 0x8(%rdx)
leaq 0x20(%rsp), %rax
movaps %xmm0, (%rax)
movl $0x1, (%rax)
movq %rdx, 0x8(%rax)
leaq 0x10(%rsp), %rbp
movq %rax, (%rbp)
movabsq $0x300000001, %rax      # imm = 0x300000001
leaq 0x8(%rsp), %r14
movq %rax, (%r14)
leaq 0x60(%rsp), %r12
movaps %xmm0, 0x40(%r12)
movaps %xmm0, 0x30(%r12)
movaps %xmm0, 0x20(%r12)
movaps %xmm0, 0x10(%r12)
movaps %xmm0, (%r12)
movq %r12, %rdi
callq 0x13ebe
movq %r13, (%r12)
movq %r14, 0x30(%r12)
movq $0x2, 0x38(%r12)
movq %rbp, 0x10(%r12)
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x18(%r12)
movabsq $0x100000002, %rax      # imm = 0x100000002
movq %rax, 0x28(%r12)
movq %r15, %rdi
movq %r12, %rsi
callq 0x1b3b8
leaq 0x2411f(%rip), %rdx     # 0x33dd0
leaq 0x21407(%rip), %r9      # 0x310bf
movq %rbx, %rdi
movq %r15, %rsi
leaq 0xb0(%rsp), %rcx
movl %eax, %r8d
callq 0x123c
movl %eax, %ebx
movq %r15, %rdi
callq 0x13a23
movl %ebx, %eax
addq $0xa28, %rsp            # imm = 0xA28
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq