#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);
scalar_t__ word_in(char *, int, int, char *);
char **commonWords(char *str1, char *str2) {
  int start_index = 0;
  int end_index = 0;
  char **common_words = NULL;
  for (end_index = 0; str1[end_index] != '\0'; end_index++) {
    if (str1[end_index] == ' ') {
      if (word_in(str1, start_index, end_index, str2)) {
        char *common_word =
            (char *)calloc(end_index - start_index + 2, sizeof(char));
      }
    }
  }
  return NULL;
}


x86 assembly (clang, -O0):
<commonWords>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     11c3 <commonWords+0xa3>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jne    11b0 <commonWords+0x90>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x10(%rbp),%rcx
call   1040 <word_in@plt>
cmp    $0x0,%rax
je     11ab <commonWords+0x8b>
mov    -0x18(%rbp),%edi
sub    -0x14(%rbp),%edi
add    $0x2,%edi
mov    $0x1,%esi
call   1030 <calloc@plt>
mov    %rax,-0x28(%rbp)
jmp    11b0 <commonWords+0x90>
jmp    11b5 <commonWords+0x95>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114d <commonWords+0x2d>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<commonWords>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
jmp    1138 <commonWords+0x18>
nop
test   %al,%al
je     1164 <commonWords+0x44>
add    $0x1,%rbx
movzbl (%r15,%rbx,1),%eax
cmp    $0x20,%al
jne    1130 <commonWords+0x10>
mov    %r15,%rdi
xor    %esi,%esi
mov    %ebx,%edx
mov    %r14,%rcx
call   1040 <word_in@plt>
test   %rax,%rax
je     1134 <commonWords+0x14>
lea    0x2(%rbx),%edi
mov    $0x1,%esi
call   1030 <calloc@plt>
jmp    1134 <commonWords+0x14>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8** @commonWords(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32 0, i32* %5
store i32 0, i32* %6
store i8** null, i8*** %7
store i32 0, i32* %6
br label %9
9: ; preds = %41, %2
%10 = load i8*, i8** %3
%11 = load i32, i32* %6
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %10, i64 %12
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %44
17: ; preds = %9
%18 = load i8*, i8** %3
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 32
br i1 %24, label %25, label %40
25: ; preds = %17
%26 = load i8*, i8** %3
%27 = load i32, i32* %5
%28 = load i32, i32* %6
%29 = load i8*, i8** %4
%30 = call i64 @word_in(i8* %26, i32 %27, i32 %28, i8* %29)
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %39
32: ; preds = %25
%33 = load i32, i32* %6
%34 = load i32, i32* %5
%35 = sub nsw i32 %33, %34
%36 = add nsw i32 %35, 2
%37 = call i64 @calloc(i32 %36, i32 1)
%38 = inttoptr i64 %37 to i8*
store i8* %38, i8** %8
br label %39
39: ; preds = %32, %25
br label %40
40: ; preds = %39, %17
br label %41
41: ; preds = %40
%42 = load i32, i32* %6
%43 = add nsw i32 %42, 1
store i32 %43, i32* %6
br label %9
44: ; preds = %9
ret i8** null
}

LLVM IR (-O2):
define noalias i8** @commonWords(i8* %0, i8* %1) {
br label %3
3: ; preds = %15, %2
%4 = phi i64 [ %16, %15 ], [ 0, %2 ]
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
switch i8 %6, label %15 [
i8 0, label %17
i8 32, label %7
]
7: ; preds = %3
%8 = trunc i64 %4 to i32
%9 = tail call i64 @word_in(i8* %0, i32 0, i32 %8, i8* %1)
%10 = icmp eq i64 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %7
%12 = trunc i64 %4 to i32
%13 = add i32 %12, 2
%14 = tail call i64 @calloc(i32 %13, i32 1)
br label %15
15: ; preds = %3, %11, %7
%16 = add nuw i64 %4, 1
br label %3
17: ; preds = %3
ret i8** null
}