// File: WShabti-Team[P]WShabtiPict/wshabtilib/api/pictapi.cpp
// Function: PictAddParameter
PICT_HANDLE
API_SPEC
PictAddParameter
    (
    IN     const PICT_HANDLE model,
    IN           size_t      valueCount,
    IN OPT unsigned int      order,
    IN OPT unsigned int      valueWeights[]
    )
{
    Model* modelObj = static_cast<Model*>( NO_CONST_HANDLE( model ));

    Parameter* param = new Parameter( order,
                                      static_cast<int>( modelObj->GetParameters().size() + 1 ),
                                      static_cast<int>( valueCount ),
                                      L"",
                                      false );
    try
    {
        if( NULL != param )
        {
            if( NULL != valueWeights )
            {
                std::vector<int> weights;
                weights.reserve( valueCount );
                weights.insert( weights.begin(), valueWeights, valueWeights + valueCount );
                param->SetWeights( move( weights ));
            }

            modelObj->AddParameter( param );
        }
    }
    catch( ... )
    {
        param = NULL;
    }

    return( param );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movl $0xd0, %edi
callq 0x75e0
movq %rax, -0xc8(%rbp)
movb $0x1, -0x62(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0xbc(%rbp)
movq -0x28(%rbp), %rdi
callq 0x1c780
movq %rax, -0xb8(%rbp)
jmp 0x2f9c2
movq -0xb8(%rbp), %rdi
callq 0x8fd0
incl %eax
movl %eax, -0xd8(%rbp)
movl -0x10(%rbp), %eax
movl %eax, -0xd4(%rbp)
leaq -0x61(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
callq 0x72c0
movq -0xd0(%rbp), %rdx
leaq 0x34fff(%rip), %rsi     # 0x649fc
leaq -0x60(%rbp), %rdi
callq 0x2ff70
jmp 0x2fa08
movl -0xd4(%rbp), %ecx
movl -0xd8(%rbp), %edx
movl -0xbc(%rbp), %esi
movq -0xc8(%rbp), %rdi
leaq -0x60(%rbp), %r8
xorl %r9d, %r9d
callq 0x2dd50
jmp 0x2fa2f
movb $0x0, -0x62(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x7910
leaq -0x61(%rbp), %rdi
callq 0x79f0
movq -0xc8(%rbp), %rax
movq %rax, -0x30(%rbp)
xorl %eax, %eax
cmpq -0x30(%rbp), %rax
je 0x2fc01
xorl %eax, %eax
cmpq -0x20(%rbp), %rax
je 0x2fbc1
leaq -0x80(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
callq 0x1bbb0
movq -0xe0(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x30170
jmp 0x2fa8a
leaq -0x80(%rbp), %rdi
movq %rdi, -0xf0(%rbp)
callq 0x24ba0
movq %rax, -0x90(%rbp)
leaq -0x88(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x30310
movq -0xf0(%rbp), %rdi
movq -0x20(%rbp), %rdx
movq -0x10(%rbp), %rax
leaq (%rdx,%rax,4), %rcx
movq -0x88(%rbp), %rsi
callq 0x30270
movq %rax, -0xe8(%rbp)
jmp 0x2fadc
movq -0xe8(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x100(%rbp)
leaq -0xb0(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
leaq -0x80(%rbp), %rsi
callq 0x30350
movq -0x100(%rbp), %rdi
movq -0xf8(%rbp), %rsi
callq 0x2d800
jmp 0x2fb21
leaq -0xb0(%rbp), %rdi
callq 0x1bca0
leaq -0x80(%rbp), %rdi
callq 0x1bca0
jmp 0x2fbc1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x2fb75
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x2fb6c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x7910
leaq -0x61(%rbp), %rdi
callq 0x79f0
testb $0x1, -0x62(%rbp)
jne 0x2fb7d
jmp 0x2fb8e
movq -0xc8(%rbp), %rdi
movl $0xd0, %esi
callq 0x7600
jmp 0x2fc03
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x2fbb6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x1bca0
leaq -0x80(%rbp), %rdi
callq 0x1bca0
jmp 0x2fbde
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x1c940
jmp 0x2fbd0
jmp 0x2fc01
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movq -0x38(%rbp), %rdi
callq 0x7220
movq $0x0, -0x30(%rbp)
callq 0x7900
movq -0x30(%rbp), %rax
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
jmp 0x2fbf4
movq -0x38(%rbp), %rdi
callq 0x79d0
nopl (%rax)