// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xb10, %rsp            # imm = 0xB10
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movw (%rax), %cx
addw $0x1, %cx
movw %cx, (%rax)
leaq -0xe0(%rbp), %rdi
leaq 0x2f375(%rip), %rsi     # 0x45ed0
movl $0xd8, %edx
callq 0x10c0
leaq -0x1c0(%rbp), %rdi
xorl %esi, %esi
movl $0xd8, %edx
callq 0x1090
leaq -0xa58(%rbp), %rdi
xorl %esi, %esi
movl $0x898, %edx            # imm = 0x898
callq 0x1090
leaq -0x1c0(%rbp), %rsi
leaq -0xa58(%rbp), %rdi
movl $0xd8, %edx
movl $0x2, %ecx
callq 0x1c6e0
leaq -0xa60(%rbp), %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x1090
movl $0x1, -0xa60(%rbp)
movl $0x0, -0xa5c(%rbp)
leaq -0xa70(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x1090
leaq 0x29931(%rip), %rax     # 0x4051a
movq %rax, -0xa70(%rbp)
movq $0x6, -0xa68(%rbp)
leaq -0xa80(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x1090
leaq 0x2990c(%rip), %rax     # 0x40521
movq %rax, -0xa80(%rbp)
movq $0x7, -0xa78(%rbp)
leaq -0xa90(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x1090
leaq -0xa70(%rbp), %rax
movq %rax, -0xa90(%rbp)
leaq -0xa80(%rbp), %rax
movq %rax, -0xa88(%rbp)
leaq -0xaa0(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x1090
movl $0x1, -0xaa0(%rbp)
leaq -0xa90(%rbp), %rax
movq %rax, -0xa98(%rbp)
leaq -0xaa8(%rbp), %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x1090
leaq -0xaa0(%rbp), %rax
movq %rax, -0xaa8(%rbp)
movq 0x306b7(%rip), %rax     # 0x47360
movq %rax, -0xab0(%rbp)
leaq -0xb00(%rbp), %rdi
xorl %esi, %esi
movl $0x50, %edx
callq 0x1090
leaq -0xb00(%rbp), %rdi
callq 0x1d4c0
leaq -0xa60(%rbp), %rax
movq %rax, -0xb00(%rbp)
movl $0x1, -0xad4(%rbp)
leaq -0xab0(%rbp), %rax
movq %rax, -0xad0(%rbp)
movq $0x2, -0xac8(%rbp)
leaq -0xaa8(%rbp), %rax
movq %rax, -0xaf0(%rbp)
movl $0x1, -0xae8(%rbp)
movl $0x1, -0xae4(%rbp)
movl $0x2, -0xad8(%rbp)
leaq -0xa58(%rbp), %rdi
leaq -0xb00(%rbp), %rsi
callq 0x298a0
movl %eax, -0xb04(%rbp)
movq -0x8(%rbp), %rdi
leaq -0xe0(%rbp), %rdx
leaq -0x1c0(%rbp), %rcx
movl -0xb04(%rbp), %r8d
leaq -0xa58(%rbp), %rsi
leaq 0x2a29b(%rip), %r9      # 0x41007
callq 0x11f0
movl %eax, -0xb04(%rbp)
leaq -0xa58(%rbp), %rdi
callq 0x1cab0
movl -0xb04(%rbp), %eax
addq $0xb10, %rsp            # imm = 0xB10
popq %rbp
retq
nopw %cs:(%rax,%rax)