#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__ malloc(int);
int /*<<< orphan*/ printf(char *);
scalar_t__ strstr(char *, char *);
int cgnsvaluegenerator(char addr[500]) {
  char **cell;
  int ncell;
  ncell = 7;
  cell = (char **)malloc(ncell * sizeof(char *));
  cell[0] = "TRI_3";
  cell[1] = "QUAD_4";
  cell[2] = "PYRA_5";
  cell[3] = "PENTA_6";
  cell[4] = "HEXA_8";
  cell[5] = "MIXED";
  cell[6] = "TETRA_4";
  int i, compret;
  char *ret;
  for (i = 0; i < 7; i++) {
    if (strstr(addr, cell[i])) {
      if (i == 0) {
        return 3;
      } else if (i == 1) {
        return 4;
      } else if (i == 2) {
        return 5;
      } else if (i == 3) {
        return 6;
      } else if (i == 4) {
        return 8;
      } else if (i == 5) {
        return 0;
        printf("\n warning mixed !!!!");
      } else if (i == 6) {
        return 4;
      }
    } else {
    }
  }
}


x86 assembly (clang, -O0):
<cgnsvaluegenerator>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x7,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
lea    0xeaf(%rip),%rcx
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
lea    0xea7(%rip),%rcx
mov    %rcx,0x8(%rax)
mov    -0x18(%rbp),%rax
lea    0xe9f(%rip),%rcx
mov    %rcx,0x10(%rax)
mov    -0x18(%rbp),%rax
lea    0xe97(%rip),%rcx
mov    %rcx,0x18(%rax)
mov    -0x18(%rbp),%rax
lea    0xe90(%rip),%rcx
mov    %rcx,0x20(%rax)
mov    -0x18(%rbp),%rax
lea    0xe88(%rip),%rcx
mov    %rcx,0x28(%rax)
mov    -0x18(%rbp),%rax
lea    0xe7f(%rip),%rcx
mov    %rcx,0x30(%rax)
movl   $0x0,-0x20(%rbp)
cmpl   $0x7,-0x20(%rbp)
jge    12b3 <cgnsvaluegenerator+0x193>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1040 <strstr@plt>
cmp    $0x0,%rax
je     129b <cgnsvaluegenerator+0x17b>
cmpl   $0x0,-0x20(%rbp)
jne    11f4 <cgnsvaluegenerator+0xd4>
movl   $0x3,-0x4(%rbp)
jmp    12b3 <cgnsvaluegenerator+0x193>
cmpl   $0x1,-0x20(%rbp)
jne    120a <cgnsvaluegenerator+0xea>
movl   $0x4,-0x4(%rbp)
jmp    12b3 <cgnsvaluegenerator+0x193>
cmpl   $0x2,-0x20(%rbp)
jne    1220 <cgnsvaluegenerator+0x100>
movl   $0x5,-0x4(%rbp)
jmp    12b3 <cgnsvaluegenerator+0x193>
cmpl   $0x3,-0x20(%rbp)
jne    1236 <cgnsvaluegenerator+0x116>
movl   $0x6,-0x4(%rbp)
jmp    12b3 <cgnsvaluegenerator+0x193>
cmpl   $0x4,-0x20(%rbp)
jne    124c <cgnsvaluegenerator+0x12c>
movl   $0x8,-0x4(%rbp)
jmp    12b3 <cgnsvaluegenerator+0x193>
cmpl   $0x5,-0x20(%rbp)
jne    1262 <cgnsvaluegenerator+0x142>
movl   $0x0,-0x4(%rbp)
jmp    12b3 <cgnsvaluegenerator+0x193>
cmpl   $0x6,-0x20(%rbp)
jne    1278 <cgnsvaluegenerator+0x158>
movl   $0x4,-0x4(%rbp)
jmp    12b3 <cgnsvaluegenerator+0x193>
jmp    127d <cgnsvaluegenerator+0x15d>
jmp    1282 <cgnsvaluegenerator+0x162>
jmp    1287 <cgnsvaluegenerator+0x167>
jmp    128c <cgnsvaluegenerator+0x16c>
jmp    1291 <cgnsvaluegenerator+0x171>
jmp    1296 <cgnsvaluegenerator+0x176>
jmp    12a0 <cgnsvaluegenerator+0x180>
jmp    12a0 <cgnsvaluegenerator+0x180>
jmp    12a5 <cgnsvaluegenerator+0x185>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11b5 <cgnsvaluegenerator+0x95>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cgnsvaluegenerator>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0x38,%edi
call   1030 <malloc@plt>
mov    %rax,%rbx
lea    0xec5(%rip),%rsi
mov    %rsi,(%rax)
lea    0xec1(%rip),%rax
mov    %rax,0x8(%rbx)
lea    0xebd(%rip),%rax
mov    %rax,0x10(%rbx)
lea    0xeb9(%rip),%rax
mov    %rax,0x18(%rbx)
lea    0xeb6(%rip),%rax
mov    %rax,0x20(%rbx)
lea    0xeb2(%rip),%rax
mov    %rax,0x28(%rbx)
lea    0xead(%rip),%rax
mov    %rax,0x30(%rbx)
mov    %r14,%rdi
call   1040 <strstr@plt>
mov    %rax,%rcx
mov    $0x3,%eax
test   %rcx,%rcx
jne    122f <cgnsvaluegenerator+0x10f>
mov    0x8(%rbx),%rsi
mov    %r14,%rdi
call   1040 <strstr@plt>
test   %rax,%rax
je     11b1 <cgnsvaluegenerator+0x91>
mov    $0x4,%eax
jmp    122f <cgnsvaluegenerator+0x10f>
mov    0x10(%rbx),%rsi
mov    %r14,%rdi
call   1040 <strstr@plt>
mov    %rax,%rcx
mov    $0x5,%eax
test   %rcx,%rcx
jne    122f <cgnsvaluegenerator+0x10f>
mov    0x18(%rbx),%rsi
mov    %r14,%rdi
call   1040 <strstr@plt>
mov    %rax,%rcx
mov    $0x6,%eax
test   %rcx,%rcx
jne    122f <cgnsvaluegenerator+0x10f>
mov    0x20(%rbx),%rsi
mov    %r14,%rdi
call   1040 <strstr@plt>
mov    %rax,%rcx
mov    $0x8,%eax
test   %rcx,%rcx
jne    122f <cgnsvaluegenerator+0x10f>
mov    0x28(%rbx),%rsi
mov    %r14,%rdi
call   1040 <strstr@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    122f <cgnsvaluegenerator+0x10f>
mov    0x30(%rbx),%rsi
mov    %r14,%rdi
call   1040 <strstr@plt>
mov    %rax,%rcx
mov    $0x3,%eax
test   %rcx,%rcx
jne    11aa <cgnsvaluegenerator+0x8a>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c"TRI_3\00"
@.str.1 = [7 x i8] c"QUAD_4\00"
@.str.2 = [7 x i8] c"PYRA_5\00"
@.str.3 = [8 x i8] c"PENTA_6\00"
@.str.4 = [7 x i8] c"HEXA_8\00"
@.str.5 = [6 x i8] c"MIXED\00"
@.str.6 = [8 x i8] c"TETRA_4\00"
define i32 @cgnsvaluegenerator(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
store i8* %0, i8** %3
store i32 7, i32* %5
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = mul i64 %10, 8
%12 = trunc i64 %11 to i32
%13 = call i64 @malloc(i32 %12)
%14 = inttoptr i64 %13 to i8**
store i8** %14, i8*** %4
%15 = load i8**, i8*** %4
%16 = getelementptr inbounds i8*, i8** %15, i64 0
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %16
%17 = load i8**, i8*** %4
%18 = getelementptr inbounds i8*, i8** %17, i64 1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8** %18
%19 = load i8**, i8*** %4
%20 = getelementptr inbounds i8*, i8** %19, i64 2
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8** %20
%21 = load i8**, i8*** %4
%22 = getelementptr inbounds i8*, i8** %21, i64 3
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8** %22
%23 = load i8**, i8*** %4
%24 = getelementptr inbounds i8*, i8** %23, i64 4
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8** %24
%25 = load i8**, i8*** %4
%26 = getelementptr inbounds i8*, i8** %25, i64 5
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8** %26
%27 = load i8**, i8*** %4
%28 = getelementptr inbounds i8*, i8** %27, i64 6
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i8** %28
store i32 0, i32* %6
br label %29
29: ; preds = %78, %1
%30 = load i32, i32* %6
%31 = icmp slt i32 %30, 7
br i1 %31, label %32, label %81
32: ; preds = %29
%33 = load i8*, i8** %3
%34 = load i8**, i8*** %4
%35 = load i32, i32* %6
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8*, i8** %34, i64 %36
%38 = load i8*, i8** %37
%39 = call i64 @strstr(i8* %33, i8* %38)
%40 = icmp ne i64 %39, 0
br i1 %40, label %41, label %76
41: ; preds = %32
%42 = load i32, i32* %6
%43 = icmp eq i32 %42, 0
br i1 %43, label %44, label %45
44: ; preds = %41
store i32 3, i32* %2
br label %81
45: ; preds = %41
%46 = load i32, i32* %6
%47 = icmp eq i32 %46, 1
br i1 %47, label %48, label %49
48: ; preds = %45
store i32 4, i32* %2
br label %81
49: ; preds = %45
%50 = load i32, i32* %6
%51 = icmp eq i32 %50, 2
br i1 %51, label %52, label %53
52: ; preds = %49
store i32 5, i32* %2
br label %81
53: ; preds = %49
%54 = load i32, i32* %6
%55 = icmp eq i32 %54, 3
br i1 %55, label %56, label %57
56: ; preds = %53
store i32 6, i32* %2
br label %81
57: ; preds = %53
%58 = load i32, i32* %6
%59 = icmp eq i32 %58, 4
br i1 %59, label %60, label %61
60: ; preds = %57
store i32 8, i32* %2
br label %81
61: ; preds = %57
%62 = load i32, i32* %6
%63 = icmp eq i32 %62, 5
br i1 %63, label %64, label %65
64: ; preds = %61
store i32 0, i32* %2
br label %81
65: ; preds = %61
%66 = load i32, i32* %6
%67 = icmp eq i32 %66, 6
br i1 %67, label %68, label %69
68: ; preds = %65
store i32 4, i32* %2
br label %81
69: ; preds = %65
br label %70
70: ; preds = %69
br label %71
71: ; preds = %70
br label %72
72: ; preds = %71
br label %73
73: ; preds = %72
br label %74
74: ; preds = %73
br label %75
75: ; preds = %74
br label %77
76: ; preds = %32
br label %77
77: ; preds = %76, %75
br label %78
78: ; preds = %77
%79 = load i32, i32* %6
%80 = add nsw i32 %79, 1
store i32 %80, i32* %6
br label %29
81: ; preds = %44, %48, %52, %56, %60, %64, %68, %29
%82 = load i32, i32* %2
ret i32 %82
}

LLVM IR (-O2):
@.str = [6 x i8] c"TRI_3\00"
@.str.1 = [7 x i8] c"QUAD_4\00"
@.str.2 = [7 x i8] c"PYRA_5\00"
@.str.3 = [8 x i8] c"PENTA_6\00"
@.str.4 = [7 x i8] c"HEXA_8\00"
@.str.5 = [6 x i8] c"MIXED\00"
@.str.6 = [8 x i8] c"TETRA_4\00"
define i32 @cgnsvaluegenerator(i8* %0) {
%2 = tail call i64 @malloc(i32 56)
%3 = inttoptr i64 %2 to i8**
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %3
%4 = getelementptr inbounds i8*, i8** %3, i64 1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8** %4
%5 = getelementptr inbounds i8*, i8** %3, i64 2
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8** %5
%6 = getelementptr inbounds i8*, i8** %3, i64 3
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8** %6
%7 = getelementptr inbounds i8*, i8** %3, i64 4
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8** %7
%8 = getelementptr inbounds i8*, i8** %3, i64 5
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8** %8
%9 = getelementptr inbounds i8*, i8** %3, i64 6
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i8** %9
%10 = tail call i64 @strstr(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %37
12: ; preds = %1
%13 = load i8*, i8** %4
%14 = tail call i64 @strstr(i8* %0, i8* %13)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %36
16: ; preds = %12
%17 = load i8*, i8** %5
%18 = tail call i64 @strstr(i8* %0, i8* %17)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %37
20: ; preds = %16
%21 = load i8*, i8** %6
%22 = tail call i64 @strstr(i8* %0, i8* %21)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %37
24: ; preds = %20
%25 = load i8*, i8** %7
%26 = tail call i64 @strstr(i8* %0, i8* %25)
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %37
28: ; preds = %24
%29 = load i8*, i8** %8
%30 = tail call i64 @strstr(i8* %0, i8* %29)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %37
32: ; preds = %28
%33 = load i8*, i8** %9
%34 = tail call i64 @strstr(i8* %0, i8* %33)
%35 = icmp eq i64 %34, 0
br i1 %35, label %37, label %36
36: ; preds = %32, %12
br label %37
37: ; preds = %28, %24, %20, %1, %32, %16, %36
%38 = phi i32 [ 4, %36 ], [ 5, %16 ], [ 3, %32 ], [ 3, %1 ], [ 6, %20 ], [ 8, %24 ], [ 0, %28 ]
ret i32 %38
}