// File: /workspace/github_c_makefile_star2_O0/OpenKMIP[P]libkmip/src/kmip.c
// Function: kmip_free_attribute
void
kmip_free_attribute(KMIP *ctx, Attribute *value)
{
    if(value != NULL)
    {
        if(value->value != NULL)
        {
            switch(value->type)
            {
                case KMIP_ATTR_APPLICATION_SPECIFIC_INFORMATION:
                {
                    kmip_free_application_specific_information(ctx, value->value);
                }
                break;

                case KMIP_ATTR_UNIQUE_IDENTIFIER:
                kmip_free_text_string(ctx, value->value);
                break;
                
                case KMIP_ATTR_NAME:
                kmip_free_name(ctx, value->value);
                break;
                
                case KMIP_ATTR_OBJECT_TYPE:
                *(int32*)value->value = 0;
                break;
                
                case KMIP_ATTR_CRYPTOGRAPHIC_ALGORITHM:
                *(int32*)value->value = 0;
                break;
                
                case KMIP_ATTR_CRYPTOGRAPHIC_LENGTH:
                *(int32*)value->value = KMIP_UNSET;
                break;
                
                case KMIP_ATTR_OPERATION_POLICY_NAME:
                kmip_free_text_string(ctx, value->value);
                break;
                
                case KMIP_ATTR_CRYPTOGRAPHIC_USAGE_MASK:
                *(int32*)value->value = KMIP_UNSET;
                break;
                
                case KMIP_ATTR_STATE:
                *(int32*)value->value = 0;
                break;

                case KMIP_ATTR_OBJECT_GROUP:
                {
                    kmip_free_text_string(ctx, value->value);
                }
                break;

                case KMIP_ATTR_ACTIVATION_DATE:
                case KMIP_ATTR_DEACTIVATION_DATE:
                case KMIP_ATTR_PROCESS_START_DATE:
                case KMIP_ATTR_PROTECT_STOP_DATE:
                {
                    *(int64*)value->value = KMIP_UNSET;
                } break;

                case KMIP_ATTR_CRYPTOGRAPHIC_PARAMETERS:
                {
                    kmip_free_cryptographic_parameters(ctx, value->value);
                } break;
                
                default:
                /* NOTE (ph) Hitting this case means that we don't know what the */
                /*      actual type, size, or value of value->value is. We can   */
                /*      still free it but we cannot securely zero the memory. We */
                /*      also do not know how to free any possible substructures  */
                /*      pointed to within value->value.                          */
                /*                                                               */
                /*      Avoid hitting this case at all costs.                    */
                break;
            };
            
            ctx->free_func(ctx->state, value->value);
            value->value = NULL;
        }
        
        value->type = 0;
        value->index = KMIP_UNSET;
    }
    
    return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x95f4
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x95df
movq -0x10(%rbp), %rax
movl (%rax), %eax
movq %rax, -0x18(%rbp)
subq $0xe, %rax
ja 0x95b1
movq -0x18(%rbp), %rax
leaq 0x1b103(%rip), %rcx     # 0x245cc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x6d60
jmp 0x95b3
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x6380
jmp 0x95b3
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x6630
jmp 0x95b3
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl $0x0, (%rax)
jmp 0x95b3
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl $0x0, (%rax)
jmp 0x95b3
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
jmp 0x95b3
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x6380
jmp 0x95b3
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
jmp 0x95b3
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl $0x0, (%rax)
jmp 0x95b3
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x6380
jmp 0x95b3
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq $-0x1, (%rax)
jmp 0x95b3
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x6ef0
jmp 0x95b3
jmp 0x95b3
movq -0x8(%rbp), %rax
movq 0x878(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x890(%rcx), %rdi
movq -0x10(%rbp), %rcx
movq 0x8(%rcx), %rsi
callq *%rax
movq -0x10(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x10(%rbp), %rax
movl $0x0, (%rax)
movq -0x10(%rbp), %rax
movl $0xffffffff, 0x4(%rax)  # imm = 0xFFFFFFFF
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)