// File: /workspace/github_c_makefile_star2_O0/loversmile[P]sugarcrm/sugar_function.c
// Function: setAccount
int setAccount(struct soap *soap, const char *soap_endpoint, char *session, char *account_id, SGAccountItem *account_item, char **return_id)
{
	/* contact_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(account_item->name ? account_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("phone_office");
    setEntry_name_value_list->__ptr[item++]->value = strdup(account_item->phone_office ? account_item->phone_office : "");  
    setEntry_name_value_list->__ptr[item] = (struct ns1__name_USCOREvalue*)malloc(sizeof(struct ns1__name_USCOREvalue));
    setEntry_name_value_list->__ptr[item]->name = strdup("phone_alternate");
    setEntry_name_value_list->__ptr[item++]->value = strdup(account_item->phone_alternate ? account_item->phone_alternate : "");
    setEntry_name_value_list->__ptr[item] = (struct ns1__name_USCOREvalue*)malloc(sizeof(struct ns1__name_USCOREvalue));
    setEntry_name_value_list->__ptr[item]->name = strdup("phone_fax");
    setEntry_name_value_list->__ptr[item++]->value = strdup(account_item->phone_fax ? account_item->phone_fax : "");
    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(account_item->description ? account_item->description : "");
    if (account_id != NULL && strlen(account_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(account_id);
    } 
    setEntry_name_value_list->__size = item;
    
    int ret = setEntry(soap, soap_endpoint, soap_action, session, "Accounts", setEntry_name_value_list, _param_9);
        printf("8*****\n");
	
    if (ret == SOAP_OK) {
        printf("Success setContact!\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 $0x100, %rsp            # imm = 0x100
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 0x64e0(%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 0x358a(%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 0x760a3
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xd8(%rbp)
jmp 0x760b3
leaq 0x4a2f(%rip), %rax      # 0x7aad9
movq %rax, -0xd8(%rbp)
jmp 0x760b3
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 0x629a(%rip), %rdi      # 0x7c3ab
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 0x7614d
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xe0(%rbp)
jmp 0x7615d
leaq 0x4985(%rip), %rax      # 0x7aad9
movq %rax, -0xe0(%rbp)
jmp 0x7615d
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 0x6468(%rip), %rdi      # 0x7c623
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 0x761f7
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0xe8(%rbp)
jmp 0x76207
leaq 0x48db(%rip), %rax      # 0x7aad9
movq %rax, -0xe8(%rbp)
jmp 0x76207
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 0x639f(%rip), %rdi      # 0x7c604
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 0x762a1
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0xf0(%rbp)
jmp 0x762b1
leaq 0x4831(%rip), %rax      # 0x7aad9
movq %rax, -0xf0(%rbp)
jmp 0x762b1
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 0x33d1(%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 0x7634b
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0xf8(%rbp)
jmp 0x7635b
leaq 0x4787(%rip), %rax      # 0x7aad9
movq %rax, -0xf8(%rbp)
jmp 0x7635b
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)
cmpq $0x0, -0x20(%rbp)
je 0x76425
movq -0x20(%rbp), %rdi
callq 0x3100
cmpq $0x0, %rax
jbe 0x76425
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 0x3467(%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 0x5f38(%rip), %r8       # 0x7c395
movq %rax, (%rsp)
callq 0x71d50
movl %eax, -0xc8(%rbp)
leaq 0x609a(%rip), %rdi      # 0x7c50d
movb $0x0, %al
callq 0x3140
cmpl $0x0, -0xc8(%rbp)
jne 0x764af
leaq 0x6184(%rip), %rdi      # 0x7c60e
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 0x764d6
movl -0xc8(%rbp), %esi
leaq 0x5c0e(%rip), %rdi      # 0x7c0ca
movb $0x0, %al
callq 0x3140
movq -0x8(%rbp), %rdi
movq 0x18b2a(%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 0x76608
movq -0xb8(%rbp), %rax
movq (%rax), %rax
movslq -0xcc(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpq $0x0, (%rax)
je 0x76550
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 0x765a7
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 0x765f2
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 0x765f4
movl -0xcc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xcc(%rbp)
jmp 0x764ea
movq -0xb8(%rbp), %rax
cmpq $0x0, (%rax)
je 0x76632
movq -0xb8(%rbp), %rax
movq (%rax), %rdi
callq 0x3030
movq -0xb8(%rbp), %rax
movq $0x0, (%rax)
cmpq $0x0, -0xb8(%rbp)
je 0x76653
movq -0xb8(%rbp), %rdi
callq 0x3030
movq $0x0, -0xb8(%rbp)
cmpq $0x0, -0xc0(%rbp)
je 0x76674
movq -0xc0(%rbp), %rdi
callq 0x3030
movq $0x0, -0xc0(%rbp)
movl -0xc8(%rbp), %eax
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
nopw %cs:(%rax,%rax)