#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 **createStringArray();
int /*<<< orphan*/ splitString(char *, char **, int *);
scalar_t__ strcmp(char *, char *);
int dp_4_check(char *line) {
  char **splitted = createStringArray();
  int n = 0;
  splitString(line, splitted, &n);
  int asr = 0;
  int noTemp = 0;
  if (strcmp(splitted[0], "add") == 0 || strcmp(splitted[0], "sub") == 0 ||
      strcmp(splitted[0], "rsb") == 0) {
    asr = 1;
  }
  if ((strcmp(splitted[1], "r1") == 0 || strcmp(splitted[1], "r0") == 0) &&
      (strcmp(splitted[2], "r1") == 0 || strcmp(splitted[2], "r0") == 0) &&
      (strcmp(splitted[3], "r1") == 0 || strcmp(splitted[3], "r0") == 0)) {
    noTemp = 1;
  }
  return noTemp * asr;
}


x86 assembly (clang, -O0):
<dp_4_check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1050 <createStringArray@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
call   1030 <splitString@plt>
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe85(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     11c4 <dp_4_check+0x94>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe6c(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     11c4 <dp_4_check+0x94>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe53(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11cb <dp_4_check+0x9b>
movl   $0x1,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe32(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     1207 <dp_4_check+0xd7>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe17(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1286 <dp_4_check+0x156>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xdf6(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     1243 <dp_4_check+0x113>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xddb(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1286 <dp_4_check+0x156>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xdba(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     127f <dp_4_check+0x14f>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xd9f(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1286 <dp_4_check+0x156>
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
imul   -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dp_4_check>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %eax,%eax
call   1050 <createStringArray@plt>
mov    %rax,%r14
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rdx
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <splitString@plt>
mov    (%r14),%rdi
lea    0xe9d(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1197 <dp_4_check+0x67>
mov    (%r14),%rdi
lea    0xe8d(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1197 <dp_4_check+0x67>
mov    (%r14),%rdi
lea    0xe7d(%rip),%rsi
call   1040 <strcmp@plt>
xor    %ebx,%ebx
test   %rax,%rax
jne    119c <dp_4_check+0x6c>
mov    $0x1,%ebx
mov    0x8(%r14),%rdi
lea    0xe65(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11cb <dp_4_check+0x9b>
mov    0x8(%r14),%rdi
lea    0xe53(%rip),%rsi
call   1040 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    122e <dp_4_check+0xfe>
mov    0x10(%r14),%rdi
lea    0xe36(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11fa <dp_4_check+0xca>
mov    0x10(%r14),%rdi
lea    0xe24(%rip),%rsi
call   1040 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    122e <dp_4_check+0xfe>
mov    0x18(%r14),%rdi
lea    0xe07(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1229 <dp_4_check+0xf9>
mov    0x18(%r14),%rdi
lea    0xdf5(%rip),%rsi
call   1040 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    122e <dp_4_check+0xfe>
mov    $0x1,%eax
imul   %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"add\00"
@.str.1 = [4 x i8] c"sub\00"
@.str.2 = [4 x i8] c"rsb\00"
@.str.3 = [3 x i8] c"r1\00"
@.str.4 = [3 x i8] c"r0\00"
define i32 @dp_4_check(i8* %0) {
%2 = alloca i32
%3 = tail call i8** (...) @createStringArray()
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = call i32 @splitString(i8* %0, i8** %3, i32* %2)
%6 = load i8*, i8** %3
%7 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %17, label %9
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %17, label %13
13: ; preds = %9
%14 = load i8*, i8** %3
%15 = call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %13, %9, %1
br label %18
18: ; preds = %17, %13
%19 = phi i32 [ 1, %17 ], [ 0, %13 ]
%20 = getelementptr inbounds i8*, i8** %3, i64 1
%21 = load i8*, i8** %20
%22 = call i64 @strcmp(i8* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %28, label %24
24: ; preds = %18
%25 = load i8*, i8** %20
%26 = call i64 @strcmp(i8* %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %47
28: ; preds = %24, %18
%29 = getelementptr inbounds i8*, i8** %3, i64 2
%30 = load i8*, i8** %29
%31 = call i64 @strcmp(i8* %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %37, label %33
33: ; preds = %28
%34 = load i8*, i8** %29
%35 = call i64 @strcmp(i8* %34, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %47
37: ; preds = %33, %28
%38 = getelementptr inbounds i8*, i8** %3, i64 3
%39 = load i8*, i8** %38
%40 = call i64 @strcmp(i8* %39, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%41 = icmp eq i64 %40, 0
br i1 %41, label %46, label %42
42: ; preds = %37
%43 = load i8*, i8** %38
%44 = call i64 @strcmp(i8* %43, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %47
46: ; preds = %42, %37
br label %47
47: ; preds = %46, %42, %33, %24
%48 = phi i32 [ 1, %46 ], [ 0, %42 ], [ 0, %33 ], [ 0, %24 ]
%49 = mul nuw nsw i32 %48, %19
ret i32 %49
}