// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x111b3
movl $0xffffffef, -0x4(%rbp) # imm = 0xFFFFFFEF
jmp 0x1132c
cmpq $0x0, -0x18(%rbp)
jne 0x111c6
movl $0x0, -0x4(%rbp)
jmp 0x1132c
jmp 0x111c8
jmp 0x111ca
movq -0x10(%rbp), %rax
cmpl $0x5, 0x18(%rax)
jae 0x111f5
movq -0x10(%rbp), %rdi
leaq 0x13a46(%rip), %rsi     # 0x24c25
movl $0x18db, %edx           # imm = 0x18DB
callq 0x6f20
movl $0xfffffff5, -0x4(%rbp) # imm = 0xFFFFFFF5
jmp 0x1132c
jmp 0x111f7
movl $0x0, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
movl $0x42015f01, %esi       # imm = 0x42015F01
callq 0x60b0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x11235
movq -0x10(%rbp), %rdi
leaq 0x13a05(%rip), %rsi     # 0x24c25
movl $0x18e3, %edx           # imm = 0x18E3
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1132c
jmp 0x11237
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rcx
movq 0x8(%rcx), %rax
addq $0x4, %rax
movq %rax, 0x8(%rcx)
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
cmpq $0x0, (%rax)
je 0x112c5
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x112c3
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movl (%rax), %edx
movl $0x42015e, %esi         # imm = 0x42015E
callq 0x6420
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x112b4
movq -0x10(%rbp), %rdi
leaq 0x13983(%rip), %rsi     # 0x24c25
movl $0x18ee, %edx           # imm = 0x18EE
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1132c
jmp 0x112b6
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x1126f
jmp 0x112c5
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x30(%rbp), %rax
subq %rax, %rsi
callq 0x6ba0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x11317
movq -0x10(%rbp), %rdi
leaq 0x13920(%rip), %rsi     # 0x24c25
movl $0x18f8, %edx           # imm = 0x18F8
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1132c
jmp 0x11319
movq -0x40(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)