#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
char *_joint(char **, char, int);
int /*<<< orphan*/ _split(char *, char, char ***);
char *_substring(char *, int, scalar_t__);
int atoi(char *);
scalar_t__ strlen(char *);
void _transfer_str_ip_port(char *buf, char *ip[], int *port) {
  char *ps = _substring(buf, 5, strlen(buf) - 5);
  char **array = 0;
  _split(ps, ',', &array);
  *ip = _joint(array, '.', 4);
  *port = atoi(array[4]) * 256 + atoi(array[5]);
}


x86 assembly (clang, -O0):
<_transfer_str_ip_port>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x38(%rbp),%rdi
mov    %rax,%rdx
sub    $0x5,%rdx
mov    $0x5,%esi
call   1070 <_substring@plt>
mov    %rax,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x2c,%esi
lea    -0x28(%rbp),%rdx
call   1030 <_split@plt>
mov    -0x28(%rbp),%rdi
mov    $0x2e,%esi
mov    $0x4,%edx
call   1040 <_joint@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rax
mov    0x20(%rax),%rdi
call   1060 <atoi@plt>
shl    $0x8,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%rax
mov    0x28(%rax),%rdi
call   1060 <atoi@plt>
mov    -0x2c(%rbp),%ecx
add    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_transfer_str_ip_port>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
call   1050 <strlen@plt>
lea    -0x5(%rax),%rdx
mov    %rbx,%rdi
mov    $0x5,%esi
call   1070 <_substring@plt>
movq   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rdx
mov    %rax,%rdi
mov    $0x2c,%esi
call   1030 <_split@plt>
mov    0x8(%rsp),%rdi
mov    $0x2e,%esi
mov    $0x4,%edx
call   1040 <_joint@plt>
mov    %rax,(%r15)
mov    0x8(%rsp),%r15
mov    0x20(%r15),%rdi
call   1060 <atoi@plt>
mov    %eax,%ebx
shl    $0x8,%ebx
mov    0x28(%r15),%rdi
call   1060 <atoi@plt>
add    %ebx,%eax
mov    %eax,(%r14)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @_transfer_str_ip_port(i8* %0, i8** %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i8**
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i32* %2, i32** %6
%9 = load i8*, i8** %4
%10 = load i8*, i8** %4
%11 = call i64 @strlen(i8* %10)
%12 = sub nsw i64 %11, 5
%13 = call i8* @_substring(i8* %9, i32 5, i64 %12)
store i8* %13, i8** %7
store i8** null, i8*** %8
%14 = load i8*, i8** %7
%15 = call i32 @_split(i8* %14, i8 signext 44, i8*** %8)
%16 = load i8**, i8*** %8
%17 = call i8* @_joint(i8** %16, i8 signext 46, i32 4)
%18 = load i8**, i8*** %5
store i8* %17, i8** %18
%19 = load i8**, i8*** %8
%20 = getelementptr inbounds i8*, i8** %19, i64 4
%21 = load i8*, i8** %20
%22 = call i32 @atoi(i8* %21)
%23 = mul nsw i32 %22, 256
%24 = load i8**, i8*** %8
%25 = getelementptr inbounds i8*, i8** %24, i64 5
%26 = load i8*, i8** %25
%27 = call i32 @atoi(i8* %26)
%28 = add nsw i32 %23, %27
%29 = load i32*, i32** %6
store i32 %28, i32* %29
ret void
}

LLVM IR (-O2):
define void @_transfer_str_ip_port(i8* %0, i8** nocapture writeonly %1, i32* nocapture writeonly %2) {
%4 = alloca i8**
%5 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%6 = add nsw i64 %5, -5
%7 = tail call i8* @_substring(i8* %0, i32 5, i64 %6)
%8 = bitcast i8*** %4 to i8*
store i8** null, i8*** %4
%9 = call i32 @_split(i8* %7, i8 signext 44, i8*** %4)
%10 = load i8**, i8*** %4
%11 = call i8* @_joint(i8** %10, i8 signext 46, i32 4)
store i8* %11, i8** %1
%12 = load i8**, i8*** %4
%13 = getelementptr inbounds i8*, i8** %12, i64 4
%14 = load i8*, i8** %13
%15 = call i32 @atoi(i8* %14)
%16 = shl nsw i32 %15, 8
%17 = getelementptr inbounds i8*, i8** %12, i64 5
%18 = load i8*, i8** %17
%19 = call i32 @atoi(i8* %18)
%20 = add nsw i32 %19, %16
store i32 %20, i32* %2
ret void
}