#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_inpos(char const *, char const *, int const *);
int check_translation(char const *, char const *, int /*<<< orphan*/ *,
                      char const *);
int /*<<< orphan*/ lou_free();
int main(int argc, char **argv) {
  int result = 0;
  const char *txt = "aaabcdefg";
  const char *table1 = "inpos_pass0.ctb";
  const char *table2 = "inpos_pass0.ctb,inpos_pass1.ctb";
  const char *table3 = "inpos_pass0.ctb,inpos_pass1.ctb,inpos_pass2.ctb";
  const char *table4 =
      "inpos_pass0.ctb,inpos_pass1.ctb,inpos_pass2.ctb,inpos_pass3.ctb";
  const char *brl1 = "abcddefg";
  const char *brl2 = "xcddwg";
  const char *brl3 = "zydwg";
  const char *brl4 = "zydeeeg";
  const int inpos1[] = {0, 3, 4, 5, 5, 6, 7, 8};
  const int inpos2[] = {0, 4, 5, 5, 6, 8};
  const int inpos3[] = {0, 0, 5, 6, 8};
  const int inpos4[] = {0, 0, 5, 6, 6, 6, 8};
  result |= check_inpos(table1, txt, inpos1);
  result |= check_inpos(table2, txt, inpos2);
  result |= check_inpos(table3, txt, inpos3);
  result |= check_inpos(table4, txt, inpos4);
  result |= check_translation(table1, txt, NULL, brl1);
  result |= check_translation(table2, txt, NULL, brl2);
  result |= check_translation(table3, txt, NULL, brl3);
  result |= check_translation(table4, txt, NULL, brl4);
  lou_free();
  return result;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xea9(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xea8(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xead(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xec2(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    0xee7(%rip),%rax
mov    %rax,-0x40(%rbp)
lea    0xf1c(%rip),%rax
mov    %rax,-0x48(%rbp)
lea    0xf1a(%rip),%rax
mov    %rax,-0x50(%rbp)
lea    0xf16(%rip),%rax
mov    %rax,-0x58(%rbp)
lea    0xf11(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xf16(%rip),%rax
mov    %rax,-0x80(%rbp)
mov    0xf13(%rip),%rax
mov    %rax,-0x78(%rbp)
mov    0xf10(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0xf0d(%rip),%rax
mov    %rax,-0x68(%rbp)
mov    0xf0a(%rip),%rax
mov    %rax,-0xa0(%rbp)
mov    0xf04(%rip),%rax
mov    %rax,-0x98(%rbp)
mov    0xefe(%rip),%rax
mov    %rax,-0x90(%rbp)
mov    0xf00(%rip),%rax
mov    %rax,-0xc0(%rbp)
mov    0xefa(%rip),%rax
mov    %rax,-0xb8(%rbp)
mov    0xef5(%rip),%eax
mov    %eax,-0xb0(%rbp)
mov    0xef8(%rip),%rax
mov    %rax,-0xe0(%rbp)
mov    0xef2(%rip),%rax
mov    %rax,-0xd8(%rbp)
mov    0xeec(%rip),%rax
mov    %rax,-0xd0(%rbp)
mov    0xee7(%rip),%eax
mov    %eax,-0xc8(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
lea    -0x80(%rbp),%rdx
call   1040 <check_inpos@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x20(%rbp),%rsi
lea    -0xa0(%rbp),%rdx
call   1040 <check_inpos@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rsi
lea    -0xc0(%rbp),%rdx
call   1040 <check_inpos@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x20(%rbp),%rsi
lea    -0xe0(%rbp),%rdx
call   1040 <check_inpos@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x48(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%edx
call   1030 <check_translation@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x50(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%edx
call   1030 <check_translation@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x58(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%edx
call   1030 <check_translation@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x60(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%edx
call   1030 <check_translation@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1050 <lou_free@plt>
mov    -0x14(%rbp),%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
movaps 0xf98(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xf7c(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
mov    0xfa0(%rip),%rax
mov    %rax,0x30(%rsp)
movaps 0xf84(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
mov    0xfa9(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xf8e(%rip),%xmm0
movaps %xmm0,(%rsp)
movups 0xfaf(%rip),%xmm0
movups %xmm0,0x4c(%rsp)
movaps 0xf97(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
lea    0xe65(%rip),%rbx
lea    0xe54(%rip),%r12
lea    0x60(%rsp),%rdx
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <check_inpos@plt>
mov    %eax,%ebp
lea    0xe55(%rip),%rdi
lea    0x20(%rsp),%rdx
mov    %r12,%rsi
call   1040 <check_inpos@plt>
mov    %eax,%r14d
or     %ebp,%r14d
lea    0xe5b(%rip),%rbp
mov    %rsp,%rdx
mov    %rbp,%rdi
mov    %r12,%rsi
call   1040 <check_inpos@plt>
mov    %eax,%r15d
lea    0xe73(%rip),%rdi
lea    0x40(%rsp),%rdx
mov    %r12,%rsi
call   1040 <check_inpos@plt>
mov    %eax,%r13d
or     %r15d,%r13d
or     %r14d,%r13d
lea    0xe96(%rip),%rcx
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %edx,%edx
call   1030 <check_translation@plt>
mov    %eax,%r14d
lea    0xe88(%rip),%rcx
lea    0xde8(%rip),%rdi
mov    %r12,%rsi
xor    %edx,%edx
call   1030 <check_translation@plt>
mov    %eax,%ebx
or     %r14d,%ebx
lea    0xe72(%rip),%rcx
mov    %rbp,%rdi
mov    %r12,%rsi
xor    %edx,%edx
call   1030 <check_translation@plt>
mov    %eax,%ebp
or     %ebx,%ebp
or     %r13d,%ebp
lea    0xe5d(%rip),%rcx
lea    0xe00(%rip),%rdi
mov    %r12,%rsi
xor    %edx,%edx
call   1030 <check_translation@plt>
mov    %eax,%ebx
or     %ebp,%ebx
xor    %eax,%eax
call   1050 <lou_free@plt>
mov    %ebx,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"aaabcdefg\00"
@.str.1 = [16 x i8] c"inpos_pass0.ctb\00"
@.str.2 = [32 x i8] c"inpos_pass0.ctb,inpos_pass1.ctb\00"
@.str.3 = [48 x i8] c"inpos_pass0.ctb,inpos_pass1.ctb,inpos_pass2.ctb\00"
@.str.4 = [64 x i8] c"inpos_pass0.ctb,inpos_pass1.ctb,inpos_pass2.ctb,inpos_pass3.ctb\00"
@.str.5 = [9 x i8] c"abcddefg\00"
@.str.6 = [7 x i8] c"xcddwg\00"
@.str.7 = [6 x i8] c"zydwg\00"
@.str.8 = [8 x i8] c"zydeeeg\00"
@__const.main.inpos1 = [8 x i32] [i32 0, i32 3, i32 4, i32 5, i32 5, i32 6, i32 7, i32 8]
@__const.main.inpos2 = [6 x i32] [i32 0, i32 4, i32 5, i32 5, i32 6, i32 8]
@__const.main.inpos3 = [5 x i32] [i32 0, i32 0, i32 5, i32 6, i32 8]
@__const.main.inpos4 = [7 x i32] [i32 0, i32 0, i32 5, i32 6, i32 6, i32 6, i32 8]
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca [8 x i32]
%17 = alloca [6 x i32]
%18 = alloca [5 x i32]
%19 = alloca [7 x i32]
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
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8** %8
store i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i8** %9
store i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.3, i64 0, i64 0), i8** %10
store i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.4, i64 0, i64 0), i8** %11
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8** %12
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8** %13
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8** %14
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i8** %15
%20 = bitcast [8 x i32]* %16 to i8*
%21 = bitcast [6 x i32]* %17 to i8*
%22 = bitcast [5 x i32]* %18 to i8*
%23 = bitcast [7 x i32]* %19 to i8*
%24 = load i8*, i8** %8
%25 = load i8*, i8** %7
%26 = getelementptr inbounds [8 x i32], [8 x i32]* %16, i64 0, i64 0
%27 = call i32 @check_inpos(i8* %24, i8* %25, i32* %26)
%28 = load i32, i32* %6
%29 = or i32 %28, %27
store i32 %29, i32* %6
%30 = load i8*, i8** %9
%31 = load i8*, i8** %7
%32 = getelementptr inbounds [6 x i32], [6 x i32]* %17, i64 0, i64 0
%33 = call i32 @check_inpos(i8* %30, i8* %31, i32* %32)
%34 = load i32, i32* %6
%35 = or i32 %34, %33
store i32 %35, i32* %6
%36 = load i8*, i8** %10
%37 = load i8*, i8** %7
%38 = getelementptr inbounds [5 x i32], [5 x i32]* %18, i64 0, i64 0
%39 = call i32 @check_inpos(i8* %36, i8* %37, i32* %38)
%40 = load i32, i32* %6
%41 = or i32 %40, %39
store i32 %41, i32* %6
%42 = load i8*, i8** %11
%43 = load i8*, i8** %7
%44 = getelementptr inbounds [7 x i32], [7 x i32]* %19, i64 0, i64 0
%45 = call i32 @check_inpos(i8* %42, i8* %43, i32* %44)
%46 = load i32, i32* %6
%47 = or i32 %46, %45
store i32 %47, i32* %6
%48 = load i8*, i8** %8
%49 = load i8*, i8** %7
%50 = load i8*, i8** %12
%51 = call i32 @check_translation(i8* %48, i8* %49, i32* null, i8* %50)
%52 = load i32, i32* %6
%53 = or i32 %52, %51
store i32 %53, i32* %6
%54 = load i8*, i8** %9
%55 = load i8*, i8** %7
%56 = load i8*, i8** %13
%57 = call i32 @check_translation(i8* %54, i8* %55, i32* null, i8* %56)
%58 = load i32, i32* %6
%59 = or i32 %58, %57
store i32 %59, i32* %6
%60 = load i8*, i8** %10
%61 = load i8*, i8** %7
%62 = load i8*, i8** %14
%63 = call i32 @check_translation(i8* %60, i8* %61, i32* null, i8* %62)
%64 = load i32, i32* %6
%65 = or i32 %64, %63
store i32 %65, i32* %6
%66 = load i8*, i8** %11
%67 = load i8*, i8** %7
%68 = load i8*, i8** %15
%69 = call i32 @check_translation(i8* %66, i8* %67, i32* null, i8* %68)
%70 = load i32, i32* %6
%71 = or i32 %70, %69
store i32 %71, i32* %6
%72 = call i32 (...) @lou_free()
%73 = load i32, i32* %6
ret i32 %73
}

LLVM IR (-O2):
@.str = [10 x i8] c"aaabcdefg\00"
@.str.1 = [16 x i8] c"inpos_pass0.ctb\00"
@.str.2 = [32 x i8] c"inpos_pass0.ctb,inpos_pass1.ctb\00"
@.str.3 = [48 x i8] c"inpos_pass0.ctb,inpos_pass1.ctb,inpos_pass2.ctb\00"
@.str.4 = [64 x i8] c"inpos_pass0.ctb,inpos_pass1.ctb,inpos_pass2.ctb,inpos_pass3.ctb\00"
@.str.5 = [9 x i8] c"abcddefg\00"
@.str.6 = [7 x i8] c"xcddwg\00"
@.str.7 = [6 x i8] c"zydwg\00"
@.str.8 = [8 x i8] c"zydeeeg\00"
@__const.main.inpos1 = [8 x i32] [i32 0, i32 3, i32 4, i32 5, i32 5, i32 6, i32 7, i32 8]
@__const.main.inpos2 = [6 x i32] [i32 0, i32 4, i32 5, i32 5, i32 6, i32 8]
@__const.main.inpos3 = [5 x i32] [i32 0, i32 0, i32 5, i32 6, i32 8]
@__const.main.inpos4 = [7 x i32] [i32 0, i32 0, i32 5, i32 6, i32 6, i32 6, i32 8]
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [8 x i32]
%4 = alloca [6 x i32]
%5 = alloca [5 x i32]
%6 = alloca [7 x i32]
%7 = bitcast [8 x i32]* %3 to i8*
%8 = bitcast [6 x i32]* %4 to i8*
%9 = bitcast [5 x i32]* %5 to i8*
%10 = bitcast [7 x i32]* %6 to i8*
%11 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 0
%12 = call i32 @check_inpos(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32* %11)
%13 = getelementptr inbounds [6 x i32], [6 x i32]* %4, i64 0, i64 0
%14 = call i32 @check_inpos(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32* %13)
%15 = or i32 %14, %12
%16 = getelementptr inbounds [5 x i32], [5 x i32]* %5, i64 0, i64 0
%17 = call i32 @check_inpos(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32* %16)
%18 = or i32 %15, %17
%19 = getelementptr inbounds [7 x i32], [7 x i32]* %6, i64 0, i64 0
%20 = call i32 @check_inpos(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32* %19)
%21 = or i32 %18, %20
%22 = call i32 @check_translation(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32* null, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%23 = or i32 %21, %22
%24 = call i32 @check_translation(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32* null, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%25 = or i32 %23, %24
%26 = call i32 @check_translation(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32* null, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%27 = or i32 %25, %26
%28 = call i32 @check_translation(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32* null, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
%29 = or i32 %27, %28
%30 = call i32 (...) @lou_free()
ret i32 %29
}