// File: /workspace/github_c_makefile_star2_O2/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 0xdd2f
movl %eax, %ebp
leaq 0x9ecd(%rip), %rsi      # 0x17be4
movq %rbx, %rdi
movl $0x1eb0, %edx           # imm = 0x1EB0
callq 0x6e80
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 0xdd68
movq %rbx, %rdi
movl $0x4200b0, %esi         # imm = 0x4200B0
callq 0x66a0
testl %eax, %eax
je 0xdd68
movl %eax, %ebp
leaq 0x9e86(%rip), %rsi      # 0x17be4
movq %rbx, %rdi
movl $0x1eb8, %edx           # imm = 0x1EB8
jmp 0xdd1f
movq 0x8(%r14), %rdx
testq %rdx, %rdx
je 0xdd95
movq %rbx, %rdi
movl $0x4200a1, %esi         # imm = 0x4200A1
callq 0x66a0
testl %eax, %eax
je 0xdd95
movl %eax, %ebp
leaq 0x9e59(%rip), %rsi      # 0x17be4
movq %rbx, %rdi
movl $0x1ebe, %edx           # imm = 0x1EBE
jmp 0xdd1f
movq 0x10(%r14), %rdx
testq %rdx, %rdx
je 0xddc5
movq %rbx, %rdi
movl $0x4200a2, %esi         # imm = 0x4200A2
callq 0x66a0
testl %eax, %eax
je 0xddc5
movl %eax, %ebp
leaq 0x9e2c(%rip), %rsi      # 0x17be4
movq %rbx, %rdi
movl $0x1ec4, %edx           # imm = 0x1EC4
jmp 0xdd1f
movq 0x18(%r14), %rdx
testq %rdx, %rdx
je 0xddf5
movq %rbx, %rdi
movl $0x4200ab, %esi         # imm = 0x4200AB
callq 0x66a0
testl %eax, %eax
je 0xddf5
movl %eax, %ebp
leaq 0x9dfc(%rip), %rsi      # 0x17be4
movq %rbx, %rdi
movl $0x1eca, %edx           # imm = 0x1ECA
jmp 0xdd1f
movq 0x20(%r14), %rdx
testq %rdx, %rdx
je 0xde25
movq %rbx, %rdi
movl $0x4200a9, %esi         # imm = 0x4200A9
callq 0x66a0
testl %eax, %eax
je 0xde25
movl %eax, %ebp
leaq 0x9dcc(%rip), %rsi      # 0x17be4
movq %rbx, %rdi
movl $0x1ed0, %edx           # imm = 0x1ED0
jmp 0xdd1f
movq 0x28(%r14), %rdx
testq %rdx, %rdx
je 0xde55
movq %rbx, %rdi
movl $0x4200aa, %esi         # imm = 0x4200AA
callq 0x66a0
testl %eax, %eax
je 0xde55
movl %eax, %ebp
leaq 0x9d9c(%rip), %rsi      # 0x17be4
movq %rbx, %rdi
movl $0x1ed6, %edx           # imm = 0x1ED6
jmp 0xdd1f
movq 0x8(%rbx), %r14
movq %r12, 0x8(%rbx)
movq %r14, %rsi
subq %r15, %rsi
movq %rbx, %rdi
callq 0x6b10
testl %eax, %eax
je 0xde85
movl %eax, %ebp
leaq 0x9d6c(%rip), %rsi      # 0x17be4
movq %rbx, %rdi
movl $0x1edd, %edx           # imm = 0x1EDD
jmp 0xdd1f
movq %r14, 0x8(%rbx)
xorl %ebp, %ebp
jmp 0xdd24