// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
movl $0x42002501, %esi       # imm = 0x42002501
callq 0x60b0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x14c8e
movq -0x10(%rbp), %rdi
leaq 0x104cf(%rip), %rsi     # 0x25148
movl $0x1eb0, %edx           # imm = 0x1EB0
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x14ee6
jmp 0x14c90
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 0x14cfc
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rdx
movl $0x4200b0, %esi         # imm = 0x4200B0
callq 0x66f0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x14cf8
movq -0x10(%rbp), %rdi
leaq 0x10465(%rip), %rsi     # 0x25148
movl $0x1eb8, %edx           # imm = 0x1EB8
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x14ee6
jmp 0x14cfa
jmp 0x14cfc
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x14d4a
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdx
movl $0x4200a1, %esi         # imm = 0x4200A1
callq 0x66f0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x14d46
movq -0x10(%rbp), %rdi
leaq 0x10417(%rip), %rsi     # 0x25148
movl $0x1ebe, %edx           # imm = 0x1EBE
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x14ee6
jmp 0x14d48
jmp 0x14d4a
movq -0x18(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x14d98
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdx
movl $0x4200a2, %esi         # imm = 0x4200A2
callq 0x66f0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x14d94
movq -0x10(%rbp), %rdi
leaq 0x103c9(%rip), %rsi     # 0x25148
movl $0x1ec4, %edx           # imm = 0x1EC4
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x14ee6
jmp 0x14d96
jmp 0x14d98
movq -0x18(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x14de6
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rdx
movl $0x4200ab, %esi         # imm = 0x4200AB
callq 0x66f0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x14de2
movq -0x10(%rbp), %rdi
leaq 0x1037b(%rip), %rsi     # 0x25148
movl $0x1eca, %edx           # imm = 0x1ECA
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x14ee6
jmp 0x14de4
jmp 0x14de6
movq -0x18(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x14e34
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rdx
movl $0x4200a9, %esi         # imm = 0x4200A9
callq 0x66f0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x14e30
movq -0x10(%rbp), %rdi
leaq 0x1032d(%rip), %rsi     # 0x25148
movl $0x1ed0, %edx           # imm = 0x1ED0
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x14ee6
jmp 0x14e32
jmp 0x14e34
movq -0x18(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x14e7f
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rdx
movl $0x4200aa, %esi         # imm = 0x4200AA
callq 0x66f0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x14e7b
movq -0x10(%rbp), %rdi
leaq 0x102df(%rip), %rsi     # 0x25148
movl $0x1ed6, %edx           # imm = 0x1ED6
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x14ee6
jmp 0x14e7d
jmp 0x14e7f
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x30(%rbp), %rax
subq %rax, %rsi
callq 0x6ba0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x14ed1
movq -0x10(%rbp), %rdi
leaq 0x10289(%rip), %rsi     # 0x25148
movl $0x1edd, %edx           # imm = 0x1EDD
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x14ee6
jmp 0x14ed3
movq -0x38(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nop