#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 */
scalar_t__ calloc(int, int);
int /*<<< orphan*/ fun(char *, char *, char **, int, int *, int *, int *);
int *findSubstring(char *s, char **words, int wordsSize, int *returnSize) {
  *returnSize = 0;
  int *mark = (int *)calloc(sizeof(int), wordsSize);
  int *ret = (int *)calloc(sizeof(int), 8192);
  fun(s, s, words, wordsSize, mark, ret, returnSize);
  return ret;
}


x86 assembly (clang, -O0):
<findSubstring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x14(%rbp),%esi
mov    $0x4,%edi
call   1040 <calloc@plt>
mov    %rax,-0x28(%rbp)
mov    $0x4,%edi
mov    $0x2000,%esi
call   1040 <calloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
mov    -0x20(%rbp),%rax
mov    %rax,(%rsp)
call   1030 <fun@plt>
mov    -0x30(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findSubstring>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r13
mov    %edx,%r15d
mov    %rsi,%r14
mov    %rdi,%rbp
movl   $0x0,(%rcx)
mov    $0x4,%edi
mov    %edx,%esi
call   1040 <calloc@plt>
mov    %rax,%r12
mov    $0x4,%edi
mov    $0x2000,%esi
call   1040 <calloc@plt>
mov    %rax,%rbx
mov    %r13,(%rsp)
mov    %rbp,%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
mov    %r15d,%ecx
mov    %r12,%r8
mov    %rax,%r9
call   1030 <fun@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32* @findSubstring(i8* %0, i8** %1, i32 %2, i32* %3) {
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
store i8* %0, i8** %5
store i8** %1, i8*** %6
store i32 %2, i32* %7
store i32* %3, i32** %8
%11 = load i32*, i32** %8
store i32 0, i32* %11
%12 = load i32, i32* %7
%13 = call i64 @calloc(i32 4, i32 %12)
%14 = inttoptr i64 %13 to i32*
store i32* %14, i32** %9
%15 = call i64 @calloc(i32 4, i32 8192)
%16 = inttoptr i64 %15 to i32*
store i32* %16, i32** %10
%17 = load i8*, i8** %5
%18 = load i8*, i8** %5
%19 = load i8**, i8*** %6
%20 = load i32, i32* %7
%21 = load i32*, i32** %9
%22 = load i32*, i32** %10
%23 = load i32*, i32** %8
%24 = call i32 @fun(i8* %17, i8* %18, i8** %19, i32 %20, i32* %21, i32* %22, i32* %23)
%25 = load i32*, i32** %10
ret i32* %25
}

LLVM IR (-O2):
define i32* @findSubstring(i8* %0, i8** %1, i32 %2, i32* %3) {
store i32 0, i32* %3
%5 = tail call i64 @calloc(i32 4, i32 %2)
%6 = inttoptr i64 %5 to i32*
%7 = tail call i64 @calloc(i32 4, i32 8192)
%8 = inttoptr i64 %7 to i32*
%9 = tail call i32 @fun(i8* %0, i8* %0, i8** %1, i32 %2, i32* %6, i32* %8, i32* %3)
ret i32* %8
}