// File: /workspace/github_c_makefile_star2_O0/loversmile[P]sugarcrm/sugar_function.c
// Function: setCall
int setCall(struct soap *soap, const char *soap_endpoint, char *session, char *call_id, SGCallItem *call_item, char **return_id)
{
    /* call_id if NULL, added new , if not NULL, update*/
    char soap_action[128] = {0};
    memset(soap_action, 0, sizeof(soap_action));
    snprintf(soap_action, sizeof(soap_action), "%s/set_entry", soap_endpoint);
    
    struct name_USCOREvalue_USCORElist *setEntry_name_value_list = NULL;
    struct ns1__set_USCOREentryResponse *_param_9 = NULL;
    setEntry_name_value_list = (struct name_USCOREvalue_USCORElist *)malloc(sizeof(struct name_USCOREvalue_USCORElist));
    _param_9 = (struct ns1__set_USCOREentryResponse *)malloc(sizeof(struct ns1__set_USCOREentryResponse));
    int item = 0;
    setEntry_name_value_list->__ptr = (struct ns1__name_USCOREvalue**)malloc(PTR_SIZE);
    setEntry_name_value_list->__ptr[item] = (struct ns1__name_USCOREvalue*)malloc(sizeof(struct ns1__name_USCOREvalue));
    setEntry_name_value_list->__ptr[item]->name = strdup("name");
    setEntry_name_value_list->__ptr[item++]->value = strdup(call_item->name ? call_item->name : "");
    setEntry_name_value_list->__ptr[item] = (struct ns1__name_USCOREvalue*)malloc(sizeof(struct ns1__name_USCOREvalue));
    setEntry_name_value_list->__ptr[item]->name = strdup("parent_type");
    setEntry_name_value_list->__ptr[item++]->value = strdup(call_item->parent_type ? call_item->parent_type : "");
    setEntry_name_value_list->__ptr[item] = (struct ns1__name_USCOREvalue*)malloc(sizeof(struct ns1__name_USCOREvalue));
    setEntry_name_value_list->__ptr[item]->name = strdup("parent_id");
    setEntry_name_value_list->__ptr[item++]->value = strdup(call_item->parent_id ? call_item->parent_id : "");
    setEntry_name_value_list->__ptr[item] = (struct ns1__name_USCOREvalue*)malloc(sizeof(struct ns1__name_USCOREvalue));
    setEntry_name_value_list->__ptr[item]->name = strdup("direction");
    setEntry_name_value_list->__ptr[item++]->value = strdup(call_item->direction ? call_item->direction : "");  
    setEntry_name_value_list->__ptr[item] = (struct ns1__name_USCOREvalue*)malloc(sizeof(struct ns1__name_USCOREvalue));
    setEntry_name_value_list->__ptr[item]->name = strdup("description");
    setEntry_name_value_list->__ptr[item++]->value = strdup(call_item->description ? call_item->description : "");
    setEntry_name_value_list->__ptr[item] = (struct ns1__name_USCOREvalue*)malloc(sizeof(struct ns1__name_USCOREvalue));
    setEntry_name_value_list->__ptr[item]->name = strdup("duration_minutes");
    setEntry_name_value_list->__ptr[item++]->value = strdup(call_item->duration_minutes ? call_item->duration_minutes : "");
    setEntry_name_value_list->__ptr[item] = (struct ns1__name_USCOREvalue*)malloc(sizeof(struct ns1__name_USCOREvalue));
    setEntry_name_value_list->__ptr[item]->name = strdup("duration_hours");
    setEntry_name_value_list->__ptr[item++]->value = strdup(call_item->duration_hours ? call_item->duration_hours : "");
    setEntry_name_value_list->__ptr[item] = (struct ns1__name_USCOREvalue*)malloc(sizeof(struct ns1__name_USCOREvalue));
    setEntry_name_value_list->__ptr[item]->name = strdup("date_start");
    setEntry_name_value_list->__ptr[item++]->value = strdup(call_item->date_start ? call_item->date_start : "");
    setEntry_name_value_list->__ptr[item] = (struct ns1__name_USCOREvalue*)malloc(sizeof(struct ns1__name_USCOREvalue));
    setEntry_name_value_list->__ptr[item]->name = strdup("assigned_user_id");
    setEntry_name_value_list->__ptr[item++]->value = strdup(call_item->assigned_user_id ? call_item->assigned_user_id : "");
    if (call_id != NULL && strlen(call_id) > 0) {
        setEntry_name_value_list->__ptr[item] = (struct ns1__name_USCOREvalue*)malloc(sizeof(struct ns1__name_USCOREvalue));
        setEntry_name_value_list->__ptr[item]->name = strdup("id");
        setEntry_name_value_list->__ptr[item++]->value = strdup(call_id);
    } 
    setEntry_name_value_list->__size = item;
    
    int ret = setEntry(soap, soap_endpoint, soap_action, session, "Calls", setEntry_name_value_list, _param_9);
        printf("8*****\n");
    if (ret == SOAP_OK) {
        printf("Success setEntry!\n");
        //snprintf(set_entry_res_id, sizeof(set_entry_res_id), "%s\0\n", _param_9->return_->id);
        *return_id = strdup(_param_9->return_->id);
    } else {
        printf("ret = %d\n", ret);
        soap_print_fault(soap, stderr);
        //goto end;
    }
    int j = 0;
	for(j = 0; j < item; j++)
	{
		SAFE_FREE(setEntry_name_value_list->__ptr[j]->name);
		SAFE_FREE(setEntry_name_value_list->__ptr[j]->value);
		SAFE_FREE(setEntry_name_value_list->__ptr[j]);
	}
	SAFE_FREE(setEntry_name_value_list->__ptr);
	SAFE_FREE(setEntry_name_value_list);
    SAFE_FREE(_param_9);
    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
leaq -0xb0(%rbp), %rdi
xorl %esi, %esi
movl $0x80, %edx
callq 0x3190
leaq -0xb0(%rbp), %rdi
xorl %esi, %esi
movl $0x80, %edx
callq 0x3190
leaq -0xb0(%rbp), %rdi
movq -0x10(%rbp), %rcx
movl $0x80, %esi
leaq 0x93c0(%rip), %rdx      # 0x7c4c0
movb $0x0, %al
callq 0x3150
movq $0x0, -0xb8(%rbp)
movq $0x0, -0xc0(%rbp)
movl $0x10, %edi
callq 0x3290
movq %rax, -0xb8(%rbp)
movl $0x8, %edi
callq 0x3290
movq %rax, -0xc0(%rbp)
movl $0x0, -0xc4(%rbp)
movl $0x40, %edi
callq 0x3290
movq %rax, %rcx
movq -0xb8(%rbp), %rax
movq %rcx, (%rax)
movl $0x10, %edi
callq 0x3290
movq %rax, %rdx
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movslq -0xc4(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
leaq 0x646a(%rip), %rdi      # 0x795f3
callq 0x33a0
movq %rax, %rcx
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movslq -0xc4(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
cmpq $0x0, (%rax)
je 0x731c3
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xd8(%rbp)
jmp 0x731d3
leaq 0x790f(%rip), %rax      # 0x7aad9
movq %rax, -0xd8(%rbp)
jmp 0x731d3
movq -0xd8(%rbp), %rdi
callq 0x33a0
movq %rax, %rcx
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movl -0xc4(%rbp), %edx
movl %edx, %esi
addl $0x1, %esi
movl %esi, -0xc4(%rbp)
movslq %edx, %rdx
movq (%rax,%rdx,8), %rax
movq %rcx, 0x8(%rax)
movl $0x10, %edi
callq 0x3290
movq %rax, %rdx
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movslq -0xc4(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
leaq 0x929c(%rip), %rdi      # 0x7c4cd
callq 0x33a0
movq %rax, %rcx
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movslq -0xc4(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x7326d
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xe0(%rbp)
jmp 0x7327d
leaq 0x7865(%rip), %rax      # 0x7aad9
movq %rax, -0xe0(%rbp)
jmp 0x7327d
movq -0xe0(%rbp), %rdi
callq 0x33a0
movq %rax, %rcx
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movl -0xc4(%rbp), %edx
movl %edx, %esi
addl $0x1, %esi
movl %esi, -0xc4(%rbp)
movslq %edx, %rdx
movq (%rax,%rdx,8), %rax
movq %rcx, 0x8(%rax)
movl $0x10, %edi
callq 0x3290
movq %rax, %rdx
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movslq -0xc4(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
leaq 0x91fe(%rip), %rdi      # 0x7c4d9
callq 0x33a0
movq %rax, %rcx
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movslq -0xc4(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x73317
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0xe8(%rbp)
jmp 0x73327
leaq 0x77bb(%rip), %rax      # 0x7aad9
movq %rax, -0xe8(%rbp)
jmp 0x73327
movq -0xe8(%rbp), %rdi
callq 0x33a0
movq %rax, %rcx
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movl -0xc4(%rbp), %edx
movl %edx, %esi
addl $0x1, %esi
movl %esi, -0xc4(%rbp)
movslq %edx, %rdx
movq (%rax,%rdx,8), %rax
movq %rcx, 0x8(%rax)
movl $0x10, %edi
callq 0x3290
movq %rax, %rdx
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movslq -0xc4(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
leaq 0x915e(%rip), %rdi      # 0x7c4e3
callq 0x33a0
movq %rax, %rcx
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movslq -0xc4(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x733c1
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0xf0(%rbp)
jmp 0x733d1
leaq 0x7711(%rip), %rax      # 0x7aad9
movq %rax, -0xf0(%rbp)
jmp 0x733d1
movq -0xf0(%rbp), %rdi
callq 0x33a0
movq %rax, %rcx
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movl -0xc4(%rbp), %edx
movl %edx, %esi
addl $0x1, %esi
movl %esi, -0xc4(%rbp)
movslq %edx, %rdx
movq (%rax,%rdx,8), %rax
movq %rcx, 0x8(%rax)
movl $0x10, %edi
callq 0x3290
movq %rax, %rdx
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movslq -0xc4(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
leaq 0x62b1(%rip), %rdi      # 0x796e0
callq 0x33a0
movq %rax, %rcx
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movslq -0xc4(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x7346b
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0xf8(%rbp)
jmp 0x7347b
leaq 0x7667(%rip), %rax      # 0x7aad9
movq %rax, -0xf8(%rbp)
jmp 0x7347b
movq -0xf8(%rbp), %rdi
callq 0x33a0
movq %rax, %rcx
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movl -0xc4(%rbp), %edx
movl %edx, %esi
addl $0x1, %esi
movl %esi, -0xc4(%rbp)
movslq %edx, %rdx
movq (%rax,%rdx,8), %rax
movq %rcx, 0x8(%rax)
movl $0x10, %edi
callq 0x3290
movq %rax, %rdx
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movslq -0xc4(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
leaq 0x9014(%rip), %rdi      # 0x7c4ed
callq 0x33a0
movq %rax, %rcx
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movslq -0xc4(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x73515
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x100(%rbp)
jmp 0x73525
leaq 0x75bd(%rip), %rax      # 0x7aad9
movq %rax, -0x100(%rbp)
jmp 0x73525
movq -0x100(%rbp), %rdi
callq 0x33a0
movq %rax, %rcx
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movl -0xc4(%rbp), %edx
movl %edx, %esi
addl $0x1, %esi
movl %esi, -0xc4(%rbp)
movslq %edx, %rdx
movq (%rax,%rdx,8), %rax
movq %rcx, 0x8(%rax)
movl $0x10, %edi
callq 0x3290
movq %rax, %rdx
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movslq -0xc4(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
leaq 0x8f7b(%rip), %rdi      # 0x7c4fe
callq 0x33a0
movq %rax, %rcx
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movslq -0xc4(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
cmpq $0x0, 0x30(%rax)
je 0x735bf
movq -0x28(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x108(%rbp)
jmp 0x735cf
leaq 0x7513(%rip), %rax      # 0x7aad9
movq %rax, -0x108(%rbp)
jmp 0x735cf
movq -0x108(%rbp), %rdi
callq 0x33a0
movq %rax, %rcx
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movl -0xc4(%rbp), %edx
movl %edx, %esi
addl $0x1, %esi
movl %esi, -0xc4(%rbp)
movslq %edx, %rdx
movq (%rax,%rdx,8), %rax
movq %rcx, 0x8(%rax)
movl $0x10, %edi
callq 0x3290
movq %rax, %rdx
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movslq -0xc4(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
leaq 0x8deb(%rip), %rdi      # 0x7c418
callq 0x33a0
movq %rax, %rcx
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movslq -0xc4(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
cmpq $0x0, 0x38(%rax)
je 0x73669
movq -0x28(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x110(%rbp)
jmp 0x73679
leaq 0x7469(%rip), %rax      # 0x7aad9
movq %rax, -0x110(%rbp)
jmp 0x73679
movq -0x110(%rbp), %rdi
callq 0x33a0
movq %rax, %rcx
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movl -0xc4(%rbp), %edx
movl %edx, %esi
addl $0x1, %esi
movl %esi, -0xc4(%rbp)
movslq %edx, %rdx
movq (%rax,%rdx,8), %rax
movq %rcx, 0x8(%rax)
movl $0x10, %edi
callq 0x3290
movq %rax, %rdx
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movslq -0xc4(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
leaq 0x5ebc(%rip), %rdi      # 0x79593
callq 0x33a0
movq %rax, %rcx
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movslq -0xc4(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0x73713
movq -0x28(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x118(%rbp)
jmp 0x73723
leaq 0x73bf(%rip), %rax      # 0x7aad9
movq %rax, -0x118(%rbp)
jmp 0x73723
movq -0x118(%rbp), %rdi
callq 0x33a0
movq %rax, %rcx
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movl -0xc4(%rbp), %edx
movl %edx, %esi
addl $0x1, %esi
movl %esi, -0xc4(%rbp)
movslq %edx, %rdx
movq (%rax,%rdx,8), %rax
movq %rcx, 0x8(%rax)
cmpq $0x0, -0x20(%rbp)
je 0x737ed
movq -0x20(%rbp), %rdi
callq 0x3100
cmpq $0x0, %rax
jbe 0x737ed
movl $0x10, %edi
callq 0x3290
movq %rax, %rdx
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movslq -0xc4(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
leaq 0x609f(%rip), %rdi      # 0x7983a
callq 0x33a0
movq %rax, %rcx
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movslq -0xc4(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rdi
callq 0x33a0
movq %rax, %rcx
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movl -0xc4(%rbp), %edx
movl %edx, %esi
addl $0x1, %esi
movl %esi, -0xc4(%rbp)
movslq %edx, %rdx
movq (%rax,%rdx,8), %rax
movq %rcx, 0x8(%rax)
movl -0xc4(%rbp), %ecx
movq -0xb8(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq -0xb0(%rbp), %rdx
movq -0x18(%rbp), %rcx
movq -0xb8(%rbp), %r9
movq -0xc0(%rbp), %rax
leaq 0x8bed(%rip), %r8       # 0x7c412
movq %rax, (%rsp)
callq 0x71d50
movl %eax, -0xc8(%rbp)
leaq 0x8cd2(%rip), %rdi      # 0x7c50d
movb $0x0, %al
callq 0x3140
cmpl $0x0, -0xc8(%rbp)
jne 0x73877
leaq 0x8cc3(%rip), %rdi      # 0x7c515
movb $0x0, %al
callq 0x3140
movq -0xc0(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rdi
callq 0x33a0
movq %rax, %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
jmp 0x7389e
movl -0xc8(%rbp), %esi
leaq 0x8846(%rip), %rdi      # 0x7c0ca
movb $0x0, %al
callq 0x3140
movq -0x8(%rbp), %rdi
movq 0x1b762(%rip), %rax     # 0x8eff8
movq (%rax), %rsi
callq 0x6e2c0
movl $0x0, -0xcc(%rbp)
movl $0x0, -0xcc(%rbp)
movl -0xcc(%rbp), %eax
cmpl -0xc4(%rbp), %eax
jge 0x739d0
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movslq -0xcc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpq $0x0, (%rax)
je 0x73918
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movslq -0xcc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rdi
callq 0x3030
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movslq -0xcc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq $0x0, (%rax)
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movslq -0xcc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpq $0x0, 0x8(%rax)
je 0x7396f
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movslq -0xcc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x8(%rax), %rdi
callq 0x3030
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movslq -0xcc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq $0x0, 0x8(%rax)
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movslq -0xcc(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x739ba
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movslq -0xcc(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3030
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movslq -0xcc(%rbp), %rcx
movq $0x0, (%rax,%rcx,8)
jmp 0x739bc
movl -0xcc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xcc(%rbp)
jmp 0x738b2
movq -0xb8(%rbp), %rax
cmpq $0x0, (%rax)
je 0x739fa
movq -0xb8(%rbp), %rax
movq (%rax), %rdi
callq 0x3030
movq -0xb8(%rbp), %rax
movq $0x0, (%rax)
cmpq $0x0, -0xb8(%rbp)
je 0x73a1b
movq -0xb8(%rbp), %rdi
callq 0x3030
movq $0x0, -0xb8(%rbp)
cmpq $0x0, -0xc0(%rbp)
je 0x73a3c
movq -0xc0(%rbp), %rdi
callq 0x3030
movq $0x0, -0xc0(%rbp)
movl -0xc8(%rbp), %eax
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
nopl (%rax,%rax)