// File: /workspace/github_c_makefile_star2_O3/OpenKMIP[P]libkmip/src/kmip.c
// Function: kmip_encode_device_credential
int
kmip_encode_device_credential(KMIP *ctx, const DeviceCredential *value)
{
    int result = 0;
    result = kmip_encode_int32_be(ctx, TAG_TYPE(KMIP_TAG_CREDENTIAL_VALUE, KMIP_TYPE_STRUCTURE));
    CHECK_RESULT(ctx, result);
    
    uint8 *length_index = ctx->index;
    uint8 *value_index = ctx->index += 4;
    
    if(value->device_serial_number != NULL)
    {
        result = kmip_encode_text_string(ctx, KMIP_TAG_DEVICE_SERIAL_NUMBER, value->device_serial_number);
        CHECK_RESULT(ctx, result);
    }
    
    if(value->password != NULL)
    {
        result = kmip_encode_text_string(ctx, KMIP_TAG_PASSWORD, value->password);
        CHECK_RESULT(ctx, result);
    }
    
    if(value->device_identifier != NULL)
    {
        result = kmip_encode_text_string(ctx, KMIP_TAG_DEVICE_IDENTIFIER, value->device_identifier);
        CHECK_RESULT(ctx, result);
    }
    
    if(value->network_identifier != NULL)
    {
        result = kmip_encode_text_string(ctx, KMIP_TAG_NETWORK_IDENTIFIER, value->network_identifier);
        CHECK_RESULT(ctx, result);
    }
    
    if(value->machine_identifier != NULL)
    {
        result = kmip_encode_text_string(ctx, KMIP_TAG_MACHINE_IDENTIFIER, value->machine_identifier);
        CHECK_RESULT(ctx, result);
    }
    
    if(value->media_identifier != NULL)
    {
        result = kmip_encode_text_string(ctx, KMIP_TAG_MEDIA_IDENTIFIER, value->media_identifier);
        CHECK_RESULT(ctx, result);
    }
    
    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 %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movl $0x42002501, %esi       # imm = 0x42002501
callq 0x60a0
testl %eax, %eax
je 0xecc9
movl %eax, %ebp
leaq 0x117d1(%rip), %rsi     # 0x20482
movq %rbx, %rdi
movl $0x1eb0, %edx           # imm = 0x1EB0
callq 0x6de0
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rbx), %r12
leaq 0x4(%r12), %r15
movq %r15, 0x8(%rbx)
movq (%r14), %rdx
testq %rdx, %rdx
je 0xed02
movq %rbx, %rdi
movl $0x4200b0, %esi         # imm = 0x4200B0
callq 0x6670
testl %eax, %eax
je 0xed02
movl %eax, %ebp
leaq 0x1178a(%rip), %rsi     # 0x20482
movq %rbx, %rdi
movl $0x1eb8, %edx           # imm = 0x1EB8
jmp 0xecb9
movq 0x8(%r14), %rdx
testq %rdx, %rdx
je 0xed2f
movq %rbx, %rdi
movl $0x4200a1, %esi         # imm = 0x4200A1
callq 0x6670
testl %eax, %eax
je 0xed2f
movl %eax, %ebp
leaq 0x1175d(%rip), %rsi     # 0x20482
movq %rbx, %rdi
movl $0x1ebe, %edx           # imm = 0x1EBE
jmp 0xecb9
movq 0x10(%r14), %rdx
testq %rdx, %rdx
je 0xed5f
movq %rbx, %rdi
movl $0x4200a2, %esi         # imm = 0x4200A2
callq 0x6670
testl %eax, %eax
je 0xed5f
movl %eax, %ebp
leaq 0x11730(%rip), %rsi     # 0x20482
movq %rbx, %rdi
movl $0x1ec4, %edx           # imm = 0x1EC4
jmp 0xecb9
movq 0x18(%r14), %rdx
testq %rdx, %rdx
je 0xed8f
movq %rbx, %rdi
movl $0x4200ab, %esi         # imm = 0x4200AB
callq 0x6670
testl %eax, %eax
je 0xed8f
movl %eax, %ebp
leaq 0x11700(%rip), %rsi     # 0x20482
movq %rbx, %rdi
movl $0x1eca, %edx           # imm = 0x1ECA
jmp 0xecb9
movq 0x20(%r14), %rdx
testq %rdx, %rdx
je 0xedbf
movq %rbx, %rdi
movl $0x4200a9, %esi         # imm = 0x4200A9
callq 0x6670
testl %eax, %eax
je 0xedbf
movl %eax, %ebp
leaq 0x116d0(%rip), %rsi     # 0x20482
movq %rbx, %rdi
movl $0x1ed0, %edx           # imm = 0x1ED0
jmp 0xecb9
movq 0x28(%r14), %rdx
testq %rdx, %rdx
je 0xedef
movq %rbx, %rdi
movl $0x4200aa, %esi         # imm = 0x4200AA
callq 0x6670
testl %eax, %eax
je 0xedef
movl %eax, %ebp
leaq 0x116a0(%rip), %rsi     # 0x20482
movq %rbx, %rdi
movl $0x1ed6, %edx           # imm = 0x1ED6
jmp 0xecb9
movq 0x8(%rbx), %r14
movq %r12, 0x8(%rbx)
movq %r14, %rsi
subq %r15, %rsi
movq %rbx, %rdi
callq 0x6a80
testl %eax, %eax
je 0xee1f
movl %eax, %ebp
leaq 0x11670(%rip), %rsi     # 0x20482
movq %rbx, %rdi
movl $0x1edd, %edx           # imm = 0x1EDD
jmp 0xecb9
movq %r14, 0x8(%rbx)
xorl %ebp, %ebp
jmp 0xecbe