#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 */
int ckyParseCount(int, int, int **, int, int, int *, int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  int nonTerminal = 7;
  int terminal = 2;
  int ruleCount = 10;
  int start = 2;
  int len = 4;
  int rules[ruleCount][3];
  int string[4] = {0, 0, 1, 1};
  rules[0][0] = 2;
  rules[0][1] = 5;
  rules[0][2] = 3;
  rules[1][0] = 2;
  rules[1][1] = 4;
  rules[1][2] = 6;
  rules[2][0] = 5;
  rules[2][1] = 0;
  rules[2][2] = 0;
  rules[3][0] = 6;
  rules[3][1] = 1;
  rules[3][2] = 1;
  rules[4][0] = 3;
  rules[4][1] = 3;
  rules[4][2] = 1;
  rules[5][0] = 4;
  rules[5][1] = 4;
  rules[5][2] = 0;
  rules[6][0] = -1;
  rules[6][1] = 3;
  rules[6][2] = 1;
  rules[7][0] = -1;
  rules[7][1] = 4;
  rules[7][2] = 0;
  rules[8][0] = -1;
  rules[8][1] = 0;
  rules[8][2] = 0;
  rules[9][0] = -1;
  rules[9][1] = 1;
  rules[9][2] = 1;
  int returned = ckyParseCount(nonTerminal, terminal, rules, start, ruleCount,
                               string, len);
  printf("returned %d\n", returned);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x7,-0x14(%rbp)
movl   $0x2,-0x18(%rbp)
movl   $0xa,-0x1c(%rbp)
movl   $0x2,-0x20(%rbp)
movl   $0x4,-0x24(%rbp)
mov    -0x1c(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x30(%rbp)
lea    (%rax,%rax,2),%rcx
lea    0xf(,%rcx,4),%rcx
movabs $0x1ffffffff0,%rdx
and    %rdx,%rcx
mov    %rsp,%rdx
sub    %rcx,%rdx
mov    %rdx,%rsp
mov    %rax,-0x38(%rbp)
mov    0xe77(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xe74(%rip),%rax
mov    %rax,-0x48(%rbp)
movl   $0x2,(%rdx)
movl   $0x5,0x4(%rdx)
movl   $0x3,0x8(%rdx)
movl   $0x2,0xc(%rdx)
movl   $0x4,0x10(%rdx)
movl   $0x6,0x14(%rdx)
movl   $0x5,0x18(%rdx)
movl   $0x0,0x1c(%rdx)
movl   $0x0,0x20(%rdx)
movl   $0x6,0x24(%rdx)
movl   $0x1,0x28(%rdx)
movl   $0x1,0x2c(%rdx)
movl   $0x3,0x30(%rdx)
movl   $0x3,0x34(%rdx)
movl   $0x1,0x38(%rdx)
movl   $0x4,0x3c(%rdx)
movl   $0x4,0x40(%rdx)
movl   $0x0,0x44(%rdx)
movl   $0xffffffff,0x48(%rdx)
movl   $0x3,0x4c(%rdx)
movl   $0x1,0x50(%rdx)
movl   $0xffffffff,0x54(%rdx)
movl   $0x4,0x58(%rdx)
movl   $0x0,0x5c(%rdx)
movl   $0xffffffff,0x60(%rdx)
movl   $0x0,0x64(%rdx)
movl   $0x0,0x68(%rdx)
movl   $0xffffffff,0x6c(%rdx)
movl   $0x1,0x70(%rdx)
movl   $0x1,0x74(%rdx)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x20(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
lea    -0x50(%rbp),%r9
mov    -0x24(%rbp),%eax
sub    $0x10,%rsp
mov    %eax,(%rsp)
call   1030 <ckyParseCount@plt>
add    $0x10,%rsp
mov    %eax,-0x54(%rbp)
mov    -0x54(%rbp),%esi
lea    0xd76(%rip),%rdi
call   1040 <printf@plt>
mov    -0x30(%rbp),%rax
mov    %rax,%rsp
xor    %eax,%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x98,%rsp
movaps 0xf42(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xec6(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xeca(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xece(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xed2(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xed6(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xeda(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xede(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movabs $0x100000001,%rax
mov    %rax,0x90(%rsp)
movl   $0x4,(%rsp)
lea    0x20(%rsp),%rdx
lea    0x10(%rsp),%r9
mov    $0x7,%edi
mov    $0x2,%esi
mov    $0x2,%ecx
mov    $0xa,%r8d
call   1030 <ckyParseCount@plt>
lea    0xeb2(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x98,%rsp
ret

LLVM IR (-O0):
@__const.main.string = [4 x i32] [i32 0, i32 0, i32 1, i32 1]
@.str = [13 x i8] c"returned %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i64
%12 = alloca [4 x i32]
%13 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 7, i32* %5
store i32 2, i32* %6
store i32 10, i32* %7
store i32 2, i32* %8
store i32 4, i32* %9
%14 = load i32, i32* %7
%15 = zext i32 %14 to i64
%16 = call i8* @llvm.stacksave()
store i8* %16, i8** %10
%17 = alloca [3 x i32], i64 %15
store i64 %15, i64* %11
%18 = bitcast [4 x i32]* %12 to i8*
%19 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 0
%20 = getelementptr inbounds [3 x i32], [3 x i32]* %19, i64 0, i64 0
store i32 2, i32* %20
%21 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 0
%22 = getelementptr inbounds [3 x i32], [3 x i32]* %21, i64 0, i64 1
store i32 5, i32* %22
%23 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 0
%24 = getelementptr inbounds [3 x i32], [3 x i32]* %23, i64 0, i64 2
store i32 3, i32* %24
%25 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 1
%26 = getelementptr inbounds [3 x i32], [3 x i32]* %25, i64 0, i64 0
store i32 2, i32* %26
%27 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 1
%28 = getelementptr inbounds [3 x i32], [3 x i32]* %27, i64 0, i64 1
store i32 4, i32* %28
%29 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 1
%30 = getelementptr inbounds [3 x i32], [3 x i32]* %29, i64 0, i64 2
store i32 6, i32* %30
%31 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 2
%32 = getelementptr inbounds [3 x i32], [3 x i32]* %31, i64 0, i64 0
store i32 5, i32* %32
%33 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 2
%34 = getelementptr inbounds [3 x i32], [3 x i32]* %33, i64 0, i64 1
store i32 0, i32* %34
%35 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 2
%36 = getelementptr inbounds [3 x i32], [3 x i32]* %35, i64 0, i64 2
store i32 0, i32* %36
%37 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 3
%38 = getelementptr inbounds [3 x i32], [3 x i32]* %37, i64 0, i64 0
store i32 6, i32* %38
%39 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 3
%40 = getelementptr inbounds [3 x i32], [3 x i32]* %39, i64 0, i64 1
store i32 1, i32* %40
%41 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 3
%42 = getelementptr inbounds [3 x i32], [3 x i32]* %41, i64 0, i64 2
store i32 1, i32* %42
%43 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 4
%44 = getelementptr inbounds [3 x i32], [3 x i32]* %43, i64 0, i64 0
store i32 3, i32* %44
%45 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 4
%46 = getelementptr inbounds [3 x i32], [3 x i32]* %45, i64 0, i64 1
store i32 3, i32* %46
%47 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 4
%48 = getelementptr inbounds [3 x i32], [3 x i32]* %47, i64 0, i64 2
store i32 1, i32* %48
%49 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 5
%50 = getelementptr inbounds [3 x i32], [3 x i32]* %49, i64 0, i64 0
store i32 4, i32* %50
%51 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 5
%52 = getelementptr inbounds [3 x i32], [3 x i32]* %51, i64 0, i64 1
store i32 4, i32* %52
%53 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 5
%54 = getelementptr inbounds [3 x i32], [3 x i32]* %53, i64 0, i64 2
store i32 0, i32* %54
%55 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 6
%56 = getelementptr inbounds [3 x i32], [3 x i32]* %55, i64 0, i64 0
store i32 -1, i32* %56
%57 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 6
%58 = getelementptr inbounds [3 x i32], [3 x i32]* %57, i64 0, i64 1
store i32 3, i32* %58
%59 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 6
%60 = getelementptr inbounds [3 x i32], [3 x i32]* %59, i64 0, i64 2
store i32 1, i32* %60
%61 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 7
%62 = getelementptr inbounds [3 x i32], [3 x i32]* %61, i64 0, i64 0
store i32 -1, i32* %62
%63 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 7
%64 = getelementptr inbounds [3 x i32], [3 x i32]* %63, i64 0, i64 1
store i32 4, i32* %64
%65 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 7
%66 = getelementptr inbounds [3 x i32], [3 x i32]* %65, i64 0, i64 2
store i32 0, i32* %66
%67 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 8
%68 = getelementptr inbounds [3 x i32], [3 x i32]* %67, i64 0, i64 0
store i32 -1, i32* %68
%69 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 8
%70 = getelementptr inbounds [3 x i32], [3 x i32]* %69, i64 0, i64 1
store i32 0, i32* %70
%71 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 8
%72 = getelementptr inbounds [3 x i32], [3 x i32]* %71, i64 0, i64 2
store i32 0, i32* %72
%73 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 9
%74 = getelementptr inbounds [3 x i32], [3 x i32]* %73, i64 0, i64 0
store i32 -1, i32* %74
%75 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 9
%76 = getelementptr inbounds [3 x i32], [3 x i32]* %75, i64 0, i64 1
store i32 1, i32* %76
%77 = getelementptr inbounds [3 x i32], [3 x i32]* %17, i64 9
%78 = getelementptr inbounds [3 x i32], [3 x i32]* %77, i64 0, i64 2
store i32 1, i32* %78
%79 = load i32, i32* %5
%80 = load i32, i32* %6
%81 = bitcast [3 x i32]* %17 to i32**
%82 = load i32, i32* %8
%83 = load i32, i32* %7
%84 = getelementptr inbounds [4 x i32], [4 x i32]* %12, i64 0, i64 0
%85 = load i32, i32* %9
%86 = call i32 @ckyParseCount(i32 %79, i32 %80, i32** %81, i32 %82, i32 %83, i32* %84, i32 %85)
store i32 %86, i32* %13
%87 = load i32, i32* %13
%88 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %87)
%89 = load i8*, i8** %10
ret i32 0
}

LLVM IR (-O2):
@__const.main.string = [4 x i32] [i32 0, i32 0, i32 1, i32 1]
@.str = [13 x i8] c"returned %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [4 x i32]
%4 = alloca [10 x [3 x i32]]
%5 = bitcast [4 x i32]* %3 to i8*
%6 = bitcast [10 x [3 x i32]]* %4 to <4 x i32>*
store <4 x i32> <i32 2, i32 5, i32 3, i32 2>, <4 x i32>* %6
%7 = getelementptr inbounds [10 x [3 x i32]], [10 x [3 x i32]]* %4, i64 0, i64 1, i64 1
%8 = bitcast i32* %7 to <4 x i32>*
store <4 x i32> <i32 4, i32 6, i32 5, i32 0>, <4 x i32>* %8
%9 = getelementptr inbounds [10 x [3 x i32]], [10 x [3 x i32]]* %4, i64 0, i64 2, i64 2
%10 = bitcast i32* %9 to <4 x i32>*
store <4 x i32> <i32 0, i32 6, i32 1, i32 1>, <4 x i32>* %10
%11 = getelementptr inbounds [10 x [3 x i32]], [10 x [3 x i32]]* %4, i64 0, i64 4, i64 0
%12 = bitcast i32* %11 to <4 x i32>*
store <4 x i32> <i32 3, i32 3, i32 1, i32 4>, <4 x i32>* %12
%13 = getelementptr inbounds [10 x [3 x i32]], [10 x [3 x i32]]* %4, i64 0, i64 5, i64 1
%14 = bitcast i32* %13 to <4 x i32>*
store <4 x i32> <i32 4, i32 0, i32 -1, i32 3>, <4 x i32>* %14
%15 = getelementptr inbounds [10 x [3 x i32]], [10 x [3 x i32]]* %4, i64 0, i64 6, i64 2
%16 = bitcast i32* %15 to <4 x i32>*
store <4 x i32> <i32 1, i32 -1, i32 4, i32 0>, <4 x i32>* %16
%17 = getelementptr inbounds [10 x [3 x i32]], [10 x [3 x i32]]* %4, i64 0, i64 8, i64 0
%18 = bitcast i32* %17 to <4 x i32>*
store <4 x i32> <i32 -1, i32 0, i32 0, i32 -1>, <4 x i32>* %18
%19 = getelementptr inbounds [10 x [3 x i32]], [10 x [3 x i32]]* %4, i64 0, i64 9, i64 1
store i32 1, i32* %19
%20 = getelementptr inbounds [10 x [3 x i32]], [10 x [3 x i32]]* %4, i64 0, i64 9, i64 2
store i32 1, i32* %20
%21 = bitcast [10 x [3 x i32]]* %4 to i32**
%22 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%23 = call i32 @ckyParseCount(i32 7, i32 2, i32** %21, i32 2, i32 10, i32* %22, i32 4)
%24 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %23)
ret i32 0
}