// File: /workspace/github_c_makefile_star2_O3/loversmile[P]sugarcrm/sugar_function.c
// Function: setContactRelation
int setContactRelation(struct soap *soap, const char *soap_endpoint, char *session, char *contact_id, char *link_name, char *link_id, SGLinkReturn *link_return)
{
    char soap_action[128] = {0};
    memset(soap_action, 0, sizeof(soap_action));
    snprintf(soap_action, sizeof(soap_action), "%s/set_relationship", soap_endpoint);
    
    struct ns1__set_USCORErelationshipResponse *_param_6 = NULL;
    _param_6 = (struct ns1__set_USCORErelationshipResponse *)malloc(sizeof(struct ns1__set_USCORErelationshipResponse));
    
    struct select_USCOREfields *related_USCOREids = NULL;
    related_USCOREids = (struct select_USCOREfields *)malloc(sizeof(struct select_USCOREfields));
    related_USCOREids->__ptr = (char**)malloc(PTR_SIZE);
    related_USCOREids->__ptr[0] = strdup(link_id);
    related_USCOREids->__size = 1;
    
    int delete_ = 0;
    struct name_USCOREvalue_USCORElist *rel_name_value_list = NULL;
    /*rel_name_value_list = (struct name_USCOREvalue_USCORElist *)soap_malloc(soap, sizeof(struct name_USCOREvalue_USCORElist));
    rel_name_value_list->__ptr = (struct ns1__name_USCOREvalue**)soap_malloc(soap, PTR_SIZE);
    rel_name_value_list->__ptr[0] = (struct ns1__name_USCOREvalue*)soap_malloc(soap, sizeof(struct ns1__name_USCOREvalue));
    rel_name_value_list->__ptr[0]->name = strdup("contact_role");
    rel_name_value_list->__ptr[0]->value = strdup("Other");
    rel_name_value_list->__size = 1; */

    int ret = setRelationship(soap, soap_endpoint, soap_action, session, "Contacts", contact_id, link_name, related_USCOREids, 
                rel_name_value_list, delete_, _param_6);
    if (ret == SOAP_OK) {
        printf("Success setContactRelation!\n");
        link_return->created = _param_6->return_->created;
        link_return->failed = _param_6->return_->failed;
        link_return->deleted = _param_6->return_->deleted;
        //printf("created = %d\nfailed = %d\ndeleted = %d\n", 
        //        _param_6->return_->created, _param_6->return_->failed, _param_6->return_->deleted);
    } else {
        printf("ret = %d\n", ret);
        soap_print_fault(soap, stderr);
        //goto end;
    }
	int j = 0;
	for (j = 0; j < related_USCOREids->__size; j++)
	{
		SAFE_FREE(related_USCOREids->__ptr[j]);
	}
	SAFE_FREE(related_USCOREids->__ptr);
	SAFE_FREE(related_USCOREids);
	SAFE_FREE(_param_6);
    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %r9, 0x8(%rsp)
movq %r8, 0x18(%rsp)
movq %rcx, %r13
movq %rdx, 0x10(%rsp)
movq %rsi, %r12
movq %rdi, (%rsp)
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %r15
movaps %xmm0, 0x70(%r15)
movaps %xmm0, 0x60(%r15)
movaps %xmm0, 0x50(%r15)
movaps %xmm0, 0x40(%r15)
movaps %xmm0, 0x30(%r15)
movaps %xmm0, 0x20(%r15)
movaps %xmm0, 0x10(%r15)
movaps %xmm0, (%r15)
leaq 0x61ec(%rip), %rdx      # 0x54178
movl $0x80, %esi
movq %r15, %rdi
movq %r12, %rcx
xorl %eax, %eax
callq 0x3150
movl $0x8, %edi
callq 0x3290
movq %rax, %rbp
movl $0x10, %edi
callq 0x3290
movq %rax, %r14
movl $0x40, %edi
callq 0x3290
movq %rax, %rbx
movq %rax, (%r14)
movq 0x8(%rsp), %rdi
callq 0x3390
movq %rax, (%rbx)
movq (%rsp), %rbx
movl $0x1, 0x8(%r14)
leaq 0x5fe4(%rip), %rdi      # 0x53fcc
movq %r13, %rsi
xorl %eax, %eax
callq 0x3140
subq $0x8, %rsp
leaq 0x605a(%rip), %r8       # 0x54057
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %rbp, %r15
movq 0x18(%rsp), %rcx
movq %r13, %r9
pushq %rbp
pushq $0x0
pushq $0x0
pushq %r14
pushq 0x40(%rsp)
callq 0x345c7
addq $0x30, %rsp
movl %eax, %ebp
testl %eax, %eax
je 0x4e04f
leaq 0x5d86(%rip), %rdi      # 0x53db8
movl %ebp, %esi
xorl %eax, %eax
callq 0x3140
movq 0x23fb6(%rip), %rax     # 0x71ff8
movq (%rax), %rsi
movq %rbx, %rdi
callq 0x4ab13
jmp 0x4e072
movq 0xe0(%rsp), %rbx
leaq 0x6273(%rip), %rdi      # 0x542d1
callq 0x30a0
movq (%r15), %rax
movq (%rax), %rcx
movq %rcx, (%rbx)
movl 0x8(%rax), %eax
movl %eax, 0x8(%rbx)
movl 0x8(%r14), %eax
testl %eax, %eax
jle 0x4e0a7
xorl %ebx, %ebx
movq (%r14), %rcx
movq (%rcx,%rbx,8), %rdi
testq %rdi, %rdi
je 0x4e09c
callq 0x3030
movq (%r14), %rax
movq $0x0, (%rax,%rbx,8)
movl 0x8(%r14), %eax
incq %rbx
movslq %eax, %rcx
cmpq %rcx, %rbx
jl 0x4e07c
movq (%r14), %rdi
testq %rdi, %rdi
je 0x4e0b4
callq 0x3030
movq %r14, %rdi
callq 0x3030
testq %r15, %r15
je 0x4e0c9
movq %r15, %rdi
callq 0x3030
movl %ebp, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq