#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 */
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ function(char *, int /*<<< orphan*/, char *,
                            int /*<<< orphan*/, char **, int *);
scalar_t__ malloc(int);
int strlen(char *);
char **restoreIpAddresses(char *s, int *returnSize) {
  char **result = (char **)malloc(sizeof(char *) * 10000);
  *returnSize = 0;
  char *temp = (char *)malloc(sizeof(char) * (strlen(s) + 4));
  function(s, 0, temp, 0, result, returnSize);
  free(temp);
  return result;
}


x86 assembly (clang, -O0):
<restoreIpAddresses>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x13880,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x4,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%r8
mov    -0x10(%rbp),%r9
xor    %ecx,%ecx
mov    %ecx,%esi
call   1060 <function@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<restoreIpAddresses>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r12
mov    $0x13880,%edi
call   1050 <malloc@plt>
mov    %rax,%r15
movl   $0x0,(%r14)
mov    %r12,%rdi
call   1040 <strlen@plt>
lea    0x4(%rax),%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %r12,%rdi
xor    %esi,%esi
mov    %rax,%rdx
xor    %ecx,%ecx
mov    %r15,%r8
mov    %r14,%r9
call   1060 <function@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r15,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8** @restoreIpAddresses(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i8**
%6 = alloca i8*
store i8* %0, i8** %3
store i32* %1, i32** %4
%7 = call i64 @malloc(i32 80000)
%8 = inttoptr i64 %7 to i8**
store i8** %8, i8*** %5
%9 = load i32*, i32** %4
store i32 0, i32* %9
%10 = load i8*, i8** %3
%11 = call i32 @strlen(i8* %10)
%12 = add nsw i32 %11, 4
%13 = sext i32 %12 to i64
%14 = mul i64 1, %13
%15 = trunc i64 %14 to i32
%16 = call i64 @malloc(i32 %15)
%17 = inttoptr i64 %16 to i8*
store i8* %17, i8** %6
%18 = load i8*, i8** %3
%19 = load i8*, i8** %6
%20 = load i8**, i8*** %5
%21 = load i32*, i32** %4
%22 = call i32 @function(i8* %18, i32 0, i8* %19, i32 0, i8** %20, i32* %21)
%23 = load i8*, i8** %6
%24 = call i32 @free(i8* %23)
%25 = load i8**, i8*** %5
ret i8** %25
}

LLVM IR (-O2):
define i8** @restoreIpAddresses(i8* %0, i32* %1) {
%3 = tail call i64 @malloc(i32 80000)
%4 = inttoptr i64 %3 to i8**
store i32 0, i32* %1
%5 = tail call i32 @strlen(i8* %0)
%6 = add nsw i32 %5, 4
%7 = tail call i64 @malloc(i32 %6)
%8 = inttoptr i64 %7 to i8*
%9 = tail call i32 @function(i8* %0, i32 0, i8* %8, i32 0, i8** %4, i32* %1)
%10 = tail call i32 @free(i8* %8)
ret i8** %4
}