// File: /workspace/github_c_makefile_star2_O3/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, 0x8(%rsp)
movq %rdx, 0x10(%rsp)
movq %rsi, %r12
movq %rdi, %r15
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %rbp
movaps %xmm0, 0x70(%rbp)
movaps %xmm0, 0x60(%rbp)
movaps %xmm0, 0x50(%rbp)
movaps %xmm0, 0x40(%rbp)
movaps %xmm0, 0x30(%rbp)
movaps %xmm0, 0x20(%rbp)
movaps %xmm0, 0x10(%rbp)
movaps %xmm0, (%rbp)
leaq 0x63a5(%rip), %rdx      # 0x54178
movl $0x80, %esi
movq %rbp, %rdi
movq %r12, %rcx
xorl %eax, %eax
callq 0x3150
movl $0x8, %esi
movq %r15, %rdi
callq 0x39272
movq %rax, %r13
movl $0x10, %esi
movq %r15, %rdi
callq 0x39272
movq %rax, %r14
movl $0x40, %esi
movq %r15, %rdi
callq 0x39272
movq %rax, %rbx
movq %rax, (%r14)
movq (%rsp), %rdi
callq 0x3390
movq %rax, (%rbx)
movl $0x1, 0x8(%r14)
leaq 0x6199(%rip), %rdi      # 0x53fcc
movq 0x8(%rsp), %rbx
movq %rbx, %rsi
xorl %eax, %eax
callq 0x3140
subq $0x8, %rsp
leaq 0x623c(%rip), %r8       # 0x54089
movq %r15, %rdi
movq %r12, %rsi
movq %rbp, %rdx
movq 0x18(%rsp), %rcx
movq %rbx, %r9
pushq %r13
pushq $0x0
pushq $0x0
pushq %r14
pushq 0x40(%rsp)
callq 0x345c7
addq $0x30, %rsp
movl %eax, %ebp
testl %eax, %eax
je 0x4de9d
leaq 0x5f38(%rip), %rdi      # 0x53db8
movl %ebp, %esi
xorl %eax, %eax
callq 0x3140
movq 0x24168(%rip), %rax     # 0x71ff8
movq (%rax), %rsi
movq %r15, %rdi
callq 0x4ab13
jmp 0x4dec1
movq 0xe0(%rsp), %rbx
leaq 0x640c(%rip), %rdi      # 0x542b8
callq 0x30a0
movq (%r13), %rax
movq (%rax), %rcx
movq %rcx, (%rbx)
movl 0x8(%rax), %eax
movl %eax, 0x8(%rbx)
movl 0x8(%r14), %eax
testl %eax, %eax
jle 0x4def6
xorl %ebx, %ebx
movq (%r14), %rcx
movq (%rcx,%rbx,8), %rdi
testq %rdi, %rdi
je 0x4deeb
callq 0x3030
movq (%r14), %rax
movq $0x0, (%rax,%rbx,8)
movl 0x8(%r14), %eax
incq %rbx
movslq %eax, %rcx
cmpq %rcx, %rbx
jl 0x4decb
movq (%r14), %rdi
testq %rdi, %rdi
je 0x4df03
callq 0x3030
movq %r14, %rdi
callq 0x3030
testq %r13, %r13
je 0x4df18
movq %r13, %rdi
callq 0x3030
movl %ebp, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq