// File: /workspace/github_c_makefile_star2_O3/OpenKMIP[P]libkmip/src/kmip.c
// Function: kmip_encode_protection_storage_masks
int
kmip_encode_protection_storage_masks(KMIP *ctx, const ProtectionStorageMasks *value)
{
    CHECK_ENCODE_ARGS(ctx, value);
    CHECK_KMIP_VERSION(ctx, KMIP_2_0);

    int result = 0;

    result = kmip_encode_int32_be(
        ctx,
        TAG_TYPE(KMIP_TAG_PROTECTION_STORAGE_MASKS, KMIP_TYPE_STRUCTURE)
    );
    CHECK_RESULT(ctx, result);

    uint8 *length_index = ctx->index;
    uint8 *value_index = ctx->index += 4;

    if(value->masks != NULL)
    {
        LinkedListItem *curr = value->masks->head;
        while(curr != NULL)
        {
            result = kmip_encode_integer(ctx, KMIP_TAG_PROTECTION_STORAGE_MASK, *(int32 *)curr->data);
            CHECK_RESULT(ctx, result);

            curr = curr->next;
        }
    }

    uint8 *curr_index = ctx->index;
    ctx->index = length_index;

    result = kmip_encode_length(ctx, curr_index - value_index);
    CHECK_RESULT(ctx, result);

    ctx->index = curr_index;

    return(KMIP_OK);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0xc77b
movq %rsi, %r14
xorl %ebp, %ebp
testq %rsi, %rsi
je 0xc90a
movq %rdi, %rbx
cmpl $0x4, 0x18(%rdi)
ja 0xc785
leaq 0x38(%rbx), %rdi
xorl %r14d, %r14d
cmpl $0x0, 0x64(%rdi,%r14)
je 0xc7bd
addq $0x68, %r14
cmpq $0x820, %r14            # imm = 0x820
jne 0xc764
jmp 0xc7e4
movl $0xffffffef, %ebp       # imm = 0xFFFFFFEF
jmp 0xc90a
movq %rbx, %rdi
movl $0x42015f01, %esi       # imm = 0x42015F01
callq 0x60a0
testl %eax, %eax
je 0xc7ee
movl %eax, %ebp
leaq 0x38(%rbx), %rdi
xorl %r14d, %r14d
cmpl $0x0, 0x64(%rdi,%r14)
je 0xc84c
addq $0x68, %r14
cmpq $0x820, %r14            # imm = 0x820
jne 0xc79f
jmp 0xc90a
addq %r14, %rdi
movq %rdi, 0x860(%rbx)
leaq 0x12156(%rip), %rsi     # 0x1e924
movl $0x63, %edx
callq 0x66f0
movl $0x18db, 0x9c(%rbx,%r14) # imm = 0x18DB
movl $0xfffffff5, %ebp       # imm = 0xFFFFFFF5
jmp 0xc90a
movq 0x8(%rbx), %r12
leaq 0x4(%r12), %r15
movq %r15, 0x8(%rbx)
movq (%r14), %r14
movq %r15, %r13
testq %r14, %r14
je 0xc87c
movq (%r14), %r14
testq %r14, %r14
je 0xc878
movq 0x10(%r14), %rax
movl (%rax), %edx
movq %rbx, %rdi
movl $0x42015e, %esi         # imm = 0x42015E
callq 0x63d0
testl %eax, %eax
je 0xc806
movl %eax, %ebp
leaq 0x38(%rbx), %rdi
xorl %r14d, %r14d
cmpl $0x0, 0x64(%rdi,%r14)
je 0xc8e3
addq $0x68, %r14
cmpq $0x820, %r14            # imm = 0x820
jne 0xc82e
jmp 0xc90a
addq %r14, %rdi
movq %rdi, 0x860(%rbx)
leaq 0x120c7(%rip), %rsi     # 0x1e924
movl $0x63, %edx
callq 0x66f0
movl $0x18e3, 0x9c(%rbx,%r14) # imm = 0x18E3
jmp 0xc90a
movq 0x8(%rbx), %r13
movq %r12, 0x8(%rbx)
movq %r13, %rsi
subq %r15, %rsi
movq %rbx, %rdi
callq 0x6a80
testl %eax, %eax
je 0xc8b2
movl %eax, %ebp
leaq 0x38(%rbx), %rdi
xorl %r14d, %r14d
cmpl $0x0, 0x64(%rdi,%r14)
je 0xc8ba
addq $0x68, %r14
cmpq $0x820, %r14            # imm = 0x820
jne 0xc89b
jmp 0xc90a
movq %r13, 0x8(%rbx)
xorl %ebp, %ebp
jmp 0xc90a
addq %r14, %rdi
movq %rdi, 0x860(%rbx)
leaq 0x12059(%rip), %rsi     # 0x1e924
movl $0x63, %edx
callq 0x66f0
movl $0x18f8, 0x9c(%rbx,%r14) # imm = 0x18F8
jmp 0xc90a
addq %r14, %rdi
movq %rdi, 0x860(%rbx)
leaq 0x12030(%rip), %rsi     # 0x1e924
movl $0x63, %edx
callq 0x66f0
movl $0x18ee, 0x9c(%rbx,%r14) # imm = 0x18EE
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq