// File: /workspace/github_c_makefile_star2_O1/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 0xf037
movl %eax, %ebp
leaq 0x123f3(%rip), %rsi     # 0x21412
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 0xf070
movq %rbx, %rdi
movl $0x4200b0, %esi         # imm = 0x4200B0
callq 0x6670
testl %eax, %eax
je 0xf070
movl %eax, %ebp
leaq 0x123ac(%rip), %rsi     # 0x21412
movq %rbx, %rdi
movl $0x1eb8, %edx           # imm = 0x1EB8
jmp 0xf027
movq 0x8(%r14), %rdx
testq %rdx, %rdx
je 0xf09d
movq %rbx, %rdi
movl $0x4200a1, %esi         # imm = 0x4200A1
callq 0x6670
testl %eax, %eax
je 0xf09d
movl %eax, %ebp
leaq 0x1237f(%rip), %rsi     # 0x21412
movq %rbx, %rdi
movl $0x1ebe, %edx           # imm = 0x1EBE
jmp 0xf027
movq 0x10(%r14), %rdx
testq %rdx, %rdx
je 0xf0cd
movq %rbx, %rdi
movl $0x4200a2, %esi         # imm = 0x4200A2
callq 0x6670
testl %eax, %eax
je 0xf0cd
movl %eax, %ebp
leaq 0x12352(%rip), %rsi     # 0x21412
movq %rbx, %rdi
movl $0x1ec4, %edx           # imm = 0x1EC4
jmp 0xf027
movq 0x18(%r14), %rdx
testq %rdx, %rdx
je 0xf0fd
movq %rbx, %rdi
movl $0x4200ab, %esi         # imm = 0x4200AB
callq 0x6670
testl %eax, %eax
je 0xf0fd
movl %eax, %ebp
leaq 0x12322(%rip), %rsi     # 0x21412
movq %rbx, %rdi
movl $0x1eca, %edx           # imm = 0x1ECA
jmp 0xf027
movq 0x20(%r14), %rdx
testq %rdx, %rdx
je 0xf12d
movq %rbx, %rdi
movl $0x4200a9, %esi         # imm = 0x4200A9
callq 0x6670
testl %eax, %eax
je 0xf12d
movl %eax, %ebp
leaq 0x122f2(%rip), %rsi     # 0x21412
movq %rbx, %rdi
movl $0x1ed0, %edx           # imm = 0x1ED0
jmp 0xf027
movq 0x28(%r14), %rdx
testq %rdx, %rdx
je 0xf15d
movq %rbx, %rdi
movl $0x4200aa, %esi         # imm = 0x4200AA
callq 0x6670
testl %eax, %eax
je 0xf15d
movl %eax, %ebp
leaq 0x122c2(%rip), %rsi     # 0x21412
movq %rbx, %rdi
movl $0x1ed6, %edx           # imm = 0x1ED6
jmp 0xf027
movq 0x8(%rbx), %r14
movq %r12, 0x8(%rbx)
movq %r14, %rsi
subq %r15, %rsi
movq %rbx, %rdi
callq 0x6a80
testl %eax, %eax
je 0xf18d
movl %eax, %ebp
leaq 0x12292(%rip), %rsi     # 0x21412
movq %rbx, %rdi
movl $0x1edd, %edx           # imm = 0x1EDD
jmp 0xf027
movq %r14, 0x8(%rbx)
xorl %ebp, %ebp
jmp 0xf02c