// File: /workspace/github_c_makefile_star2_O2/loversmile[P]sugarcrm/sugar_function.c
// Function: setCallRelation
int setCallRelation(struct soap *soap, const char *soap_endpoint, char *session, char *call_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 *)soap_malloc(soap, sizeof(struct ns1__set_USCORErelationshipResponse));
    
    struct select_USCOREfields *related_USCOREids = NULL;
    related_USCOREids = (struct select_USCOREfields *)soap_malloc(soap, sizeof(struct select_USCOREfields));
    related_USCOREids->__ptr = (char**)soap_malloc(soap, 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, "Calls", call_id, link_name, related_USCOREids, 
                rel_name_value_list, delete_, _param_6);
    if (ret == SOAP_OK) {
        printf("Success setRelationship!\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, (%rsp)
movq %r8, 0x18(%rsp)
movq %rcx, 0x10(%rsp)
movq %rdx, 0x8(%rsp)
movq %rsi, %rbx
movq %rdi, %r15
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %r13
movaps %xmm0, 0x70(%r13)
movaps %xmm0, 0x60(%r13)
movaps %xmm0, 0x50(%r13)
movaps %xmm0, 0x40(%r13)
movaps %xmm0, 0x30(%r13)
movaps %xmm0, 0x20(%r13)
movaps %xmm0, 0x10(%r13)
movaps %xmm0, (%r13)
leaq 0x6346(%rip), %rdx      # 0x4f178
movl $0x80, %esi
movq %r13, %rdi
movq %rbx, %rcx
xorl %eax, %eax
callq 0x3150
pushq $0x8
popq %rsi
movq %r15, %rdi
callq 0x35f17
movq %rax, %r12
pushq $0x10
popq %rsi
movq %r15, %rdi
callq 0x35f17
movq %rax, %r14
pushq $0x40
popq %rsi
movq %r15, %rdi
callq 0x35f17
movq %rax, %rbp
movq %rax, (%r14)
movq (%rsp), %rdi
callq 0x33a0
movq %rax, (%rbp)
movl $0x1, 0x8(%r14)
subq $0x8, %rsp
leaq 0x61f8(%rip), %r8       # 0x4f089
movq %r15, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq 0x10(%rsp), %rcx
movq 0x18(%rsp), %r9
pushq %r12
pushq $0x0
pushq $0x0
pushq %r14
pushq 0x40(%rsp)
callq 0x47aec
addq $0x30, %rsp
movl %eax, %ebp
testl %eax, %eax
je 0x48ee3
leaq 0x5ef2(%rip), %rdi      # 0x4edb8
movl %ebp, %esi
xorl %eax, %eax
callq 0x3140
movq 0x27122(%rip), %rax     # 0x6fff8
movq (%rax), %rsi
movq %r15, %rdi
callq 0x460f9
jmp 0x48f07
movq 0xe0(%rsp), %rbx
leaq 0x63c6(%rip), %rdi      # 0x4f2b8
callq 0x30a0
movq (%r12), %rax
movq (%rax), %rcx
movq %rcx, (%rbx)
movl 0x8(%rax), %eax
movl %eax, 0x8(%rbx)
xorl %ebx, %ebx
movslq 0x8(%r14), %rax
movq (%r14), %rdi
cmpq %rax, %rbx
jge 0x48f30
movq (%rdi,%rbx,8), %rdi
testq %rdi, %rdi
je 0x48f2b
callq 0x3030
movq (%r14), %rax
andq $0x0, (%rax,%rbx,8)
incq %rbx
jmp 0x48f09
callq 0x3030
movq %r14, %rdi
callq 0x3030
movq %r12, %rdi
callq 0x3030
movl %ebp, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq