#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_outpos(char const *, char const *, int const *);
int /*<<< orphan*/ lou_free();
int main(int argc, char **argv) {
  const char *table = "en-us-g1.ctb";
  int result = 0;
  const char *str1 = "ab";
  const int expected_outpos1[] = {0, 1};
  result |= check_outpos(table, str1, expected_outpos1);
  const char *str2 = "1";
  const int expected_outpos2[] = {1};
  result |= check_outpos(table, str2, expected_outpos2);
  const char *str3 = "1 2";
  const int expected_outpos3[] = {1, 2, 4};
  result |= check_outpos(table, str3, expected_outpos3);
  const char *str4 = "1 2 3";
  const int expected_outpos4[] = {1, 2, 4, 5, 7};
  result |= check_outpos(table, str4, expected_outpos4);
  lou_free();
  return result;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec0(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xebb(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xebf(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
lea    -0x30(%rbp),%rdx
call   1040 <check_outpos@plt>
or     -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
lea    0xe91(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xe9b(%rip),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x38(%rbp),%rsi
lea    -0x3c(%rbp),%rdx
call   1040 <check_outpos@plt>
or     -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
lea    0xe68(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xe7b(%rip),%rax
mov    %rax,-0x54(%rbp)
mov    0xe79(%rip),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x48(%rbp),%rsi
lea    -0x54(%rbp),%rdx
call   1040 <check_outpos@plt>
or     -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
lea    0xe36(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xe55(%rip),%rax
mov    %rax,-0x80(%rbp)
mov    0xe52(%rip),%rax
mov    %rax,-0x78(%rbp)
mov    0xe50(%rip),%eax
mov    %eax,-0x70(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x60(%rbp),%rsi
lea    -0x80(%rbp),%rdx
call   1040 <check_outpos@plt>
or     -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    $0x0,%al
call   1030 <lou_free@plt>
mov    -0x1c(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x38,%rsp
movabs $0x100000000,%rax
mov    %rax,0x18(%rsp)
lea    0xec0(%rip),%r14
lea    0xec6(%rip),%rsi
lea    0x18(%rsp),%rdx
mov    %r14,%rdi
call   1040 <check_outpos@plt>
mov    %eax,%ebx
movl   $0x1,0x4(%rsp)
lea    0xeab(%rip),%rsi
lea    0x4(%rsp),%rdx
mov    %r14,%rdi
call   1040 <check_outpos@plt>
mov    %eax,%ebp
or     %ebx,%ebp
mov    0xeac(%rip),%eax
mov    %eax,0x10(%rsp)
mov    0xe99(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0xe7f(%rip),%rsi
lea    0x8(%rsp),%rdx
mov    %r14,%rdi
call   1040 <check_outpos@plt>
mov    %eax,%r15d
mov    0xe97(%rip),%eax
mov    %eax,0x30(%rsp)
movaps 0xe7c(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
lea    0xe56(%rip),%rsi
lea    0x20(%rsp),%rdx
mov    %r14,%rdi
call   1040 <check_outpos@plt>
mov    %eax,%ebx
or     %r15d,%ebx
or     %ebp,%ebx
xor    %eax,%eax
call   1030 <lou_free@plt>
mov    %ebx,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"en-us-g1.ctb\00"
@.str.1 = [3 x i8] c"ab\00"
@__const.main.expected_outpos1 = [2 x i32] [i32 0, i32 1]
@.str.2 = [2 x i8] c"1\00"
@__const.main.expected_outpos2 = [1 x i32] [i32 1]
@.str.3 = [4 x i8] c"1 2\00"
@__const.main.expected_outpos3 = [3 x i32] [i32 1, i32 2, i32 4]
@.str.4 = [6 x i8] c"1 2 3\00"
@__const.main.expected_outpos4 = [5 x i32] [i32 1, i32 2, i32 4, i32 5, i32 7]
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca [2 x i32]
%10 = alloca i8*
%11 = alloca [1 x i32]
%12 = alloca i8*
%13 = alloca [3 x i32]
%14 = alloca i8*
%15 = alloca [5 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8** %6
store i32 0, i32* %7
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %8
%16 = bitcast [2 x i32]* %9 to i8*
%17 = load i8*, i8** %6
%18 = load i8*, i8** %8
%19 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
%20 = call i32 @check_outpos(i8* %17, i8* %18, i32* %19)
%21 = load i32, i32* %7
%22 = or i32 %21, %20
store i32 %22, i32* %7
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8** %10
%23 = bitcast [1 x i32]* %11 to i8*
%24 = load i8*, i8** %6
%25 = load i8*, i8** %10
%26 = getelementptr inbounds [1 x i32], [1 x i32]* %11, i64 0, i64 0
%27 = call i32 @check_outpos(i8* %24, i8* %25, i32* %26)
%28 = load i32, i32* %7
%29 = or i32 %28, %27
store i32 %29, i32* %7
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8** %12
%30 = bitcast [3 x i32]* %13 to i8*
%31 = load i8*, i8** %6
%32 = load i8*, i8** %12
%33 = getelementptr inbounds [3 x i32], [3 x i32]* %13, i64 0, i64 0
%34 = call i32 @check_outpos(i8* %31, i8* %32, i32* %33)
%35 = load i32, i32* %7
%36 = or i32 %35, %34
store i32 %36, i32* %7
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8** %14
%37 = bitcast [5 x i32]* %15 to i8*
%38 = load i8*, i8** %6
%39 = load i8*, i8** %14
%40 = getelementptr inbounds [5 x i32], [5 x i32]* %15, i64 0, i64 0
%41 = call i32 @check_outpos(i8* %38, i8* %39, i32* %40)
%42 = load i32, i32* %7
%43 = or i32 %42, %41
store i32 %43, i32* %7
%44 = call i32 (...) @lou_free()
%45 = load i32, i32* %7
ret i32 %45
}

LLVM IR (-O2):
@.str = [13 x i8] c"en-us-g1.ctb\00"
@.str.1 = [3 x i8] c"ab\00"
@.str.2 = [2 x i8] c"1\00"
@.str.3 = [4 x i8] c"1 2\00"
@__const.main.expected_outpos3 = [3 x i32] [i32 1, i32 2, i32 4]
@.str.4 = [6 x i8] c"1 2 3\00"
@__const.main.expected_outpos4 = [5 x i32] [i32 1, i32 2, i32 4, i32 5, i32 7]
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i64
%4 = alloca [1 x i32]
%5 = alloca [3 x i32]
%6 = alloca [5 x i32]
%7 = bitcast i64* %3 to i8*
store i64 4294967296, i64* %3
%8 = bitcast i64* %3 to i32*
%9 = call i32 @check_outpos(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
%10 = bitcast [1 x i32]* %4 to i8*
%11 = getelementptr inbounds [1 x i32], [1 x i32]* %4, i64 0, i64 0
store i32 1, i32* %11
%12 = call i32 @check_outpos(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32* %11)
%13 = or i32 %12, %9
%14 = bitcast [3 x i32]* %5 to i8*
%15 = getelementptr inbounds [3 x i32], [3 x i32]* %5, i64 0, i64 0
%16 = call i32 @check_outpos(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32* %15)
%17 = or i32 %13, %16
%18 = bitcast [5 x i32]* %6 to i8*
%19 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 0
%20 = call i32 @check_outpos(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32* %19)
%21 = or i32 %17, %20
%22 = call i32 (...) @lou_free()
ret i32 %21
}