#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 check_translation(char *, char *, int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ lou_compileString(char *, char *);
int /*<<< orphan*/ lou_free();
int /*<<< orphan*/ sprintf(char *, char *, char, char, char);
int main(int argc, char **argv) {
  int result = 0;
  char *table = "empty.ctb";
  char rule[18];
  lou_compileString(table, "include latinLetterDef6Dots.uti");
  for (char c1 = 'a'; c1 <= 'z'; c1++) {
    for (char c2 = 'a'; c2 <= 'z'; c2++) {
      for (char c3 = 'a'; c3 <= 'z'; c3++) {
        sprintf(rule, "always aa%c%c%c 1", c1, c2, c3);
        lou_compileString(table, rule);
      }
    }
  }
  result |= check_translation(table, "aaaaa", NULL, "a");
  result |= check_translation(table, "aaaaa", NULL, "a");
  result |= check_translation(table, "aazzz", NULL, "a");
  lou_free();
  return result;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xe9c(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe97(%rip),%rsi
call   1050 <lou_compileString@plt>
movb   $0x61,-0x41(%rbp)
movsbl -0x41(%rbp),%eax
cmp    $0x7a,%eax
jg     120a <main+0xca>
movb   $0x61,-0x42(%rbp)
movsbl -0x42(%rbp),%eax
cmp    $0x7a,%eax
jg     11f8 <main+0xb8>
movb   $0x61,-0x43(%rbp)
movsbl -0x43(%rbp),%eax
cmp    $0x7a,%eax
jg     11e6 <main+0xa6>
lea    -0x40(%rbp),%rdi
mov    -0x41(%rbp),%cl
mov    -0x42(%rbp),%al
lea    0xe6e(%rip),%rsi
movsbl %cl,%edx
movsbl %al,%ecx
movsbl -0x43(%rbp),%r8d
call   1060 <sprintf@plt>
mov    -0x20(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1050 <lou_compileString@plt>
mov    -0x43(%rbp),%al
add    $0x1,%al
mov    %al,-0x43(%rbp)
jmp    119e <main+0x5e>
jmp    11eb <main+0xab>
mov    -0x42(%rbp),%al
add    $0x1,%al
mov    %al,-0x42(%rbp)
jmp    118d <main+0x4d>
jmp    11fd <main+0xbd>
mov    -0x41(%rbp),%al
add    $0x1,%al
mov    %al,-0x41(%rbp)
jmp    117c <main+0x3c>
mov    -0x20(%rbp),%rdi
lea    0xe27(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
lea    0xe20(%rip),%rcx
call   1030 <check_translation@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe06(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
lea    0xdff(%rip),%rcx
call   1030 <check_translation@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xdeb(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
lea    0xdde(%rip),%rcx
call   1030 <check_translation@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1040 <lou_free@plt>
mov    -0x14(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xeab(%rip),%r14
lea    0xeae(%rip),%rsi
mov    %r14,%rdi
call   1050 <lou_compileString@plt>
mov    $0x61,%r12b
lea    0xebc(%rip),%r15
mov    %rsp,%r13
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x61,%bl
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x61,%bpl
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl %r12b,%edx
movsbl %bl,%ecx
movsbl %bpl,%ebp
mov    %r13,%rdi
mov    %r15,%rsi
mov    %ebp,%r8d
call   1060 <sprintf@plt>
mov    %r14,%rdi
mov    %r13,%rsi
call   1050 <lou_compileString@plt>
add    $0x1,%bpl
cmp    $0x7b,%bpl
jne    11a0 <main+0x60>
add    $0x1,%bl
cmp    $0x7b,%bl
jne    1190 <main+0x50>
add    $0x1,%r12b
cmp    $0x7b,%r12b
jne    1180 <main+0x40>
lea    0xe19(%rip),%r12
lea    0xe4e(%rip),%r14
lea    0xe4b(%rip),%r15
mov    %r12,%rdi
mov    %r14,%rsi
xor    %edx,%edx
mov    %r15,%rcx
call   1030 <check_translation@plt>
mov    %eax,%ebp
mov    %r12,%rdi
mov    %r14,%rsi
xor    %edx,%edx
mov    %r15,%rcx
call   1030 <check_translation@plt>
mov    %eax,%ebx
or     %ebp,%ebx
lea    0xe20(%rip),%rsi
mov    %r12,%rdi
xor    %edx,%edx
mov    %r15,%rcx
call   1030 <check_translation@plt>
mov    %eax,%ebp
or     %ebx,%ebp
xor    %eax,%eax
call   1040 <lou_free@plt>
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"empty.ctb\00"
@.str.1 = [32 x i8] c"include latinLetterDef6Dots.uti\00"
@.str.2 = [18 x i8] c"always aa%c%c%c 1\00"
@.str.3 = [6 x i8] c"aaaaa\00"
@.str.4 = [2 x i8] c"a\00"
@.str.5 = [6 x i8] c"aazzz\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca [18 x i8]
%9 = alloca i8
%10 = alloca i8
%11 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %7
%12 = load i8*, i8** %7
%13 = call i32 @lou_compileString(i8* %12, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
store i8 97, i8* %9
br label %14
14: ; preds = %45, %2
%15 = load i8, i8* %9
%16 = sext i8 %15 to i32
%17 = icmp sle i32 %16, 122
br i1 %17, label %18, label %48
18: ; preds = %14
store i8 97, i8* %10
br label %19
19: ; preds = %41, %18
%20 = load i8, i8* %10
%21 = sext i8 %20 to i32
%22 = icmp sle i32 %21, 122
br i1 %22, label %23, label %44
23: ; preds = %19
store i8 97, i8* %11
br label %24
24: ; preds = %37, %23
%25 = load i8, i8* %11
%26 = sext i8 %25 to i32
%27 = icmp sle i32 %26, 122
br i1 %27, label %28, label %40
28: ; preds = %24
%29 = getelementptr inbounds [18 x i8], [18 x i8]* %8, i64 0, i64 0
%30 = load i8, i8* %9
%31 = load i8, i8* %10
%32 = load i8, i8* %11
%33 = call i32 @sprintf(i8* %29, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8 signext %30, i8 signext %31, i8 signext %32)
%34 = load i8*, i8** %7
%35 = getelementptr inbounds [18 x i8], [18 x i8]* %8, i64 0, i64 0
%36 = call i32 @lou_compileString(i8* %34, i8* %35)
br label %37
37: ; preds = %28
%38 = load i8, i8* %11
%39 = add i8 %38, 1
store i8 %39, i8* %11
br label %24
40: ; preds = %24
br label %41
41: ; preds = %40
%42 = load i8, i8* %10
%43 = add i8 %42, 1
store i8 %43, i8* %10
br label %19
44: ; preds = %19
br label %45
45: ; preds = %44
%46 = load i8, i8* %9
%47 = add i8 %46, 1
store i8 %47, i8* %9
br label %14
48: ; preds = %14
%49 = load i8*, i8** %7
%50 = call i32 @check_translation(i8* %49, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%51 = load i32, i32* %6
%52 = or i32 %51, %50
store i32 %52, i32* %6
%53 = load i8*, i8** %7
%54 = call i32 @check_translation(i8* %53, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%55 = load i32, i32* %6
%56 = or i32 %55, %54
store i32 %56, i32* %6
%57 = load i8*, i8** %7
%58 = call i32 @check_translation(i8* %57, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%59 = load i32, i32* %6
%60 = or i32 %59, %58
store i32 %60, i32* %6
%61 = call i32 (...) @lou_free()
%62 = load i32, i32* %6
ret i32 %62
}

LLVM IR (-O2):
@.str = [10 x i8] c"empty.ctb\00"
@.str.1 = [32 x i8] c"include latinLetterDef6Dots.uti\00"
@.str.2 = [18 x i8] c"always aa%c%c%c 1\00"
@.str.3 = [6 x i8] c"aaaaa\00"
@.str.4 = [2 x i8] c"a\00"
@.str.5 = [6 x i8] c"aazzz\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [18 x i8]
%4 = getelementptr inbounds [18 x i8], [18 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @lou_compileString(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
br label %6
6: ; preds = %2, %17
%7 = phi i8 [ 97, %2 ], [ %18, %17 ]
br label %15
8: ; preds = %17
%9 = call i32 @check_translation(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%10 = call i32 @check_translation(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%11 = or i32 %10, %9
%12 = call i32 @check_translation(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%13 = or i32 %11, %12
%14 = call i32 (...) @lou_free()
ret i32 %13
15: ; preds = %6, %20
%16 = phi i8 [ 97, %6 ], [ %21, %20 ]
br label %23
17: ; preds = %20
%18 = add nuw nsw i8 %7, 1
%19 = icmp eq i8 %18, 123
br i1 %19, label %8, label %6
20: ; preds = %23
%21 = add nuw nsw i8 %16, 1
%22 = icmp eq i8 %21, 123
br i1 %22, label %17, label %15
23: ; preds = %15, %23
%24 = phi i8 [ 97, %15 ], [ %27, %23 ]
%25 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8 signext %7, i8 signext %16, i8 signext %24)
%26 = call i32 @lou_compileString(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %4)
%27 = add nuw nsw i8 %24, 1
%28 = icmp eq i8 %27, 123
br i1 %28, label %20, label %23
}