#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__ checkChar(char *, int);
int /*<<< orphan*/ free(char *);
scalar_t__ insert(char **, int, int);
int /*<<< orphan*/ insertArray(char *, int *, int *, char **);
int /*<<< orphan*/ printf(char *, ...);
int strlen(char *);
void commandInsert(char **data, char *param1, char *param2, int *wordNumber,
                   int *wordNumberArray, char **wordArray) {
  int dataLenght = 0;
  if (param1 == NULL && param2 == NULL && (*data) != NULL) {
    dataLenght = strlen(*data);
    if (checkChar(*data, dataLenght)) {
      if (insert(data, *wordNumber, dataLenght)) {
        printf("word number: %d\n", (*wordNumber));
        insertArray(*data, wordNumber, wordNumberArray, wordArray);
        (*wordNumber)++;
      } else {
        printf("ignored\n");
      }
    } else {
      free(*data);
      *data = NULL;
      printf("ignored\n");
    }
  } else {
    if (*data != NULL) {
      free(*data);
      *data = NULL;
    }
    printf("ignored\n");
  }
}


x86 assembly (clang, -O0):
<commandInsert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1268 <commandInsert+0x108>
cmpq   $0x0,-0x18(%rbp)
jne    1268 <commandInsert+0x108>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1268 <commandInsert+0x108>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x34(%rbp),%esi
call   1070 <checkChar@plt>
cmp    $0x0,%rax
je     123e <commandInsert+0xde>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
mov    -0x34(%rbp),%edx
call   1080 <insert@plt>
cmp    $0x0,%rax
je     122b <commandInsert+0xcb>
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
lea    0xe04(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
call   1030 <insertArray@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
jmp    1239 <commandInsert+0xd9>
lea    0xddf(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1263 <commandInsert+0x103>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1040 <free@plt>
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
lea    0xdb5(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    129b <commandInsert+0x13b>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     128d <commandInsert+0x12d>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1040 <free@plt>
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
lea    0xd7d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<commandInsert>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
or     %rdx,%rsi
jne    11e8 <commandInsert+0x78>
test   %rdi,%rdi
je     11fe <commandInsert+0x8e>
mov    %r9,%r15
mov    %r8,%r12
mov    %rcx,%r14
call   1060 <strlen@plt>
mov    %eax,%ebp
mov    (%rbx),%rdi
mov    %eax,%esi
call   1080 <checkChar@plt>
test   %rax,%rax
je     11ef <commandInsert+0x7f>
mov    (%r14),%esi
mov    %rbx,%rdi
mov    %ebp,%edx
call   1090 <insert@plt>
test   %rax,%rax
je     11fe <commandInsert+0x8e>
mov    (%r14),%esi
lea    0xe3d(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    (%rbx),%rdi
mov    %r14,%rsi
mov    %r12,%rdx
mov    %r15,%rcx
call   1030 <insertArray@plt>
addl   $0x1,(%r14)
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
test   %rdi,%rdi
jne    11f2 <commandInsert+0x82>
jmp    11fe <commandInsert+0x8e>
mov    (%rbx),%rdi
call   1040 <free@plt>
movq   $0x0,(%rbx)
lea    0xe0c(%rip),%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <puts@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"word number: %d\0A\00"
@.str.1 = [9 x i8] c"ignored\0A\00"
define void @commandInsert(i8** %0, i8* %1, i8* %2, i32* %3, i32* %4, i8** %5) {
%7 = alloca i8**
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i8**
%13 = alloca i32
store i8** %0, i8*** %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store i32* %3, i32** %10
store i32* %4, i32** %11
store i8** %5, i8*** %12
store i32 0, i32* %13
%14 = load i8*, i8** %8
%15 = icmp eq i8* %14, null
br i1 %15, label %16, label %62
16: ; preds = %6
%17 = load i8*, i8** %9
%18 = icmp eq i8* %17, null
br i1 %18, label %19, label %62
19: ; preds = %16
%20 = load i8**, i8*** %7
%21 = load i8*, i8** %20
%22 = icmp ne i8* %21, null
br i1 %22, label %23, label %62
23: ; preds = %19
%24 = load i8**, i8*** %7
%25 = load i8*, i8** %24
%26 = call i32 @strlen(i8* %25)
store i32 %26, i32* %13
%27 = load i8**, i8*** %7
%28 = load i8*, i8** %27
%29 = load i32, i32* %13
%30 = call i64 @checkChar(i8* %28, i32 %29)
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %55
32: ; preds = %23
%33 = load i8**, i8*** %7
%34 = load i32*, i32** %10
%35 = load i32, i32* %34
%36 = load i32, i32* %13
%37 = call i64 @insert(i8** %33, i32 %35, i32 %36)
%38 = icmp ne i64 %37, 0
br i1 %38, label %39, label %52
39: ; preds = %32
%40 = load i32*, i32** %10
%41 = load i32, i32* %40
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %41)
%43 = load i8**, i8*** %7
%44 = load i8*, i8** %43
%45 = load i32*, i32** %10
%46 = load i32*, i32** %11
%47 = load i8**, i8*** %12
%48 = call i32 @insertArray(i8* %44, i32* %45, i32* %46, i8** %47)
%49 = load i32*, i32** %10
%50 = load i32, i32* %49
%51 = add nsw i32 %50, 1
store i32 %51, i32* %49
br label %54
52: ; preds = %32
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %54
54: ; preds = %52, %39
br label %61
55: ; preds = %23
%56 = load i8**, i8*** %7
%57 = load i8*, i8** %56
%58 = call i32 @free(i8* %57)
%59 = load i8**, i8*** %7
store i8* null, i8** %59
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %61
61: ; preds = %55, %54
br label %73
62: ; preds = %19, %16, %6
%63 = load i8**, i8*** %7
%64 = load i8*, i8** %63
%65 = icmp ne i8* %64, null
br i1 %65, label %66, label %71
66: ; preds = %62
%67 = load i8**, i8*** %7
%68 = load i8*, i8** %67
%69 = call i32 @free(i8* %68)
%70 = load i8**, i8*** %7
store i8* null, i8** %70
br label %71
71: ; preds = %66, %62
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %73
73: ; preds = %71, %61
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"word number: %d\0A\00"
@str.3 = [8 x i8] c"ignored\00"
define void @commandInsert(i8** %0, i8* readnone %1, i8* readnone %2, i32* %3, i32* %4, i8** %5) {
%7 = icmp eq i8* %1, null
%8 = icmp eq i8* %2, null
%9 = and i1 %7, %8
%10 = load i8*, i8** %0
%11 = icmp eq i8* %10, null
br i1 %9, label %12, label %35
12: ; preds = %6
br i1 %11, label %38, label %13
13: ; preds = %12
%14 = tail call i32 @strlen(i8* %10)
%15 = load i8*, i8** %0
%16 = tail call i64 @checkChar(i8* %15, i32 %14)
%17 = icmp eq i64 %16, 0
br i1 %17, label %31, label %18
18: ; preds = %13
%19 = load i32, i32* %3
%20 = tail call i64 @insert(i8** %0, i32 %19, i32 %14)
%21 = icmp eq i64 %20, 0
br i1 %21, label %29, label %22
22: ; preds = %18
%23 = load i32, i32* %3
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %23)
%25 = load i8*, i8** %0
%26 = tail call i32 @insertArray(i8* %25, i32* %3, i32* %4, i8** %5)
%27 = load i32, i32* %3
%28 = add nsw i32 %27, 1
store i32 %28, i32* %3
br label %40
29: ; preds = %18
%30 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.3, i64 0, i64 0))
br label %40
31: ; preds = %13
%32 = load i8*, i8** %0
%33 = tail call i32 @free(i8* %32)
store i8* null, i8** %0
%34 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.3, i64 0, i64 0))
br label %40
35: ; preds = %6
br i1 %11, label %38, label %36
36: ; preds = %35
%37 = tail call i32 @free(i8* %10)
store i8* null, i8** %0
br label %38
38: ; preds = %12, %36, %35
%39 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.3, i64 0, i64 0))
br label %40
40: ; preds = %31, %29, %22, %38
ret void
}