// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x100, %rsp            # imm = 0x100
movq 0x10(%rbp), %rax
movq %rdi, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
movq %rdx, -0x28(%rbp)
movq %rcx, -0x30(%rbp)
movq %r8, -0x38(%rbp)
movq %r9, -0x40(%rbp)
leaq -0xc0(%rbp), %rdi
xorl %esi, %esi
movl $0x80, %edx
callq 0x3190
leaq -0xc0(%rbp), %rdi
xorl %esi, %esi
movl $0x80, %edx
callq 0x3190
leaq -0xc0(%rbp), %rdi
movq -0x20(%rbp), %rcx
movl $0x80, %esi
leaq 0x7955(%rip), %rdx      # 0x7c55c
movb $0x0, %al
callq 0x3150
movq $0x0, -0xc8(%rbp)
movl $0x8, %edi
callq 0x3290
movq %rax, -0xc8(%rbp)
movq $0x0, -0xd0(%rbp)
movl $0x10, %edi
callq 0x3290
movq %rax, -0xd0(%rbp)
movl $0x40, %edi
callq 0x3290
movq %rax, %rcx
movq -0xd0(%rbp), %rax
movq %rcx, (%rax)
movq -0x40(%rbp), %rdi
callq 0x33a0
movq %rax, %rcx
movq -0xd0(%rbp), %rax
movq (%rax), %rax
movq %rcx, (%rax)
movq -0xd0(%rbp), %rax
movl $0x1, 0x8(%rax)
movl $0x0, -0xd4(%rbp)
movq $0x0, -0xe0(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
leaq -0xc0(%rbp), %rdx
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %r9
movq -0x38(%rbp), %r14
movq -0xd0(%rbp), %rbx
movq -0xe0(%rbp), %r11
movl -0xd4(%rbp), %r10d
movq -0xc8(%rbp), %rax
leaq 0x7709(%rip), %r8       # 0x7c3e0
movq %r14, (%rsp)
movq %rbx, 0x8(%rsp)
movq %r11, 0x10(%rsp)
movl %r10d, 0x18(%rsp)
movq %rax, 0x20(%rsp)
callq 0x71df0
movl %eax, -0xe4(%rbp)
cmpl $0x0, -0xe4(%rbp)
jne 0x74d4d
leaq 0x7880(%rip), %rdi      # 0x7c58a
movb $0x0, %al
callq 0x3140
movq -0xc8(%rbp), %rax
movq (%rax), %rax
movl (%rax), %ecx
movq 0x10(%rbp), %rax
movl %ecx, (%rax)
movq -0xc8(%rbp), %rax
movq (%rax), %rax
movl 0x4(%rax), %ecx
movq 0x10(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0xc8(%rbp), %rax
movq (%rax), %rax
movl 0x8(%rax), %ecx
movq 0x10(%rbp), %rax
movl %ecx, 0x8(%rax)
jmp 0x74d74
movl -0xe4(%rbp), %esi
leaq 0x7370(%rip), %rdi      # 0x7c0ca
movb $0x0, %al
callq 0x3140
movq -0x18(%rbp), %rdi
movq 0x1a28c(%rip), %rax     # 0x8eff8
movq (%rax), %rsi
callq 0x6e2c0
movl $0x0, -0xe8(%rbp)
movl $0x0, -0xe8(%rbp)
movl -0xe8(%rbp), %eax
movq -0xd0(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x74df8
movq -0xd0(%rbp), %rax
movq (%rax), %rax
movslq -0xe8(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x74de5
movq -0xd0(%rbp), %rax
movq (%rax), %rax
movslq -0xe8(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3030
movq -0xd0(%rbp), %rax
movq (%rax), %rax
movslq -0xe8(%rbp), %rcx
movq $0x0, (%rax,%rcx,8)
jmp 0x74de7
movl -0xe8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xe8(%rbp)
jmp 0x74d88
movq -0xd0(%rbp), %rax
cmpq $0x0, (%rax)
je 0x74e22
movq -0xd0(%rbp), %rax
movq (%rax), %rdi
callq 0x3030
movq -0xd0(%rbp), %rax
movq $0x0, (%rax)
cmpq $0x0, -0xd0(%rbp)
je 0x74e43
movq -0xd0(%rbp), %rdi
callq 0x3030
movq $0x0, -0xd0(%rbp)
cmpq $0x0, -0xc8(%rbp)
je 0x74e64
movq -0xc8(%rbp), %rdi
callq 0x3030
movq $0x0, -0xc8(%rbp)
movl -0xe4(%rbp), %eax
addq $0x100, %rsp            # imm = 0x100
popq %rbx
popq %r14
popq %rbp
retq
nopw %cs:(%rax,%rax)