#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__ lou_checkTable(char const *);
int /*<<< orphan*/ lou_free();
int /*<<< orphan*/ printf(char *, char const *);
int main(int argc, char **argv) {
  const char *goodTable = "en-us-g1.ctb";
  const char *badTable = "bad.ctb";
  int result = 0;
  if (lou_checkTable(goodTable) == 0) {
    printf("Getting %s failed, expected success\n", goodTable);
    result = 1;
  }
  if (lou_checkTable(badTable) != 0) {
    printf("Getting %s succeeded, expected failure\n", badTable);
    result = 1;
  }
  if (lou_checkTable(goodTable) == 0) {
    printf("Getting %s failed, expected success\n", goodTable);
    result = 1;
  }
  lou_free();
  return result;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb3(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xeb5(%rip),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <lou_checkTable@plt>
cmp    $0x0,%rax
jne    118d <main+0x5d>
mov    -0x18(%rbp),%rsi
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <lou_checkTable@plt>
cmp    $0x0,%rax
je     11b7 <main+0x87>
mov    -0x20(%rbp),%rsi
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <lou_checkTable@plt>
cmp    $0x0,%rax
jne    11e1 <main+0xb1>
mov    -0x18(%rbp),%rsi
lea    0xe40(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x24(%rbp)
mov    $0x0,%al
call   1040 <lou_free@plt>
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rdi
call   1050 <lou_checkTable@plt>
xor    %ebx,%ebx
test   %rax,%rax
jne    115c <main+0x2c>
lea    0xeca(%rip),%rdi
lea    0xeae(%rip),%rsi
call   1030 <printf@plt>
mov    $0x1,%ebx
lea    0xeaa(%rip),%rdi
call   1050 <lou_checkTable@plt>
test   %rax,%rax
je     1185 <main+0x55>
lea    0xec6(%rip),%rdi
lea    0xe92(%rip),%rsi
call   1030 <printf@plt>
mov    $0x1,%ebx
lea    0xe74(%rip),%rdi
call   1050 <lou_checkTable@plt>
test   %rax,%rax
jne    11ae <main+0x7e>
lea    0xe78(%rip),%rdi
lea    0xe5c(%rip),%rsi
call   1030 <printf@plt>
mov    $0x1,%ebx
xor    %eax,%eax
call   1040 <lou_free@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"en-us-g1.ctb\00"
@.str.1 = [8 x i8] c"bad.ctb\00"
@.str.2 = [37 x i8] c"Getting %s failed, expected success\0A\00"
@.str.3 = [40 x i8] c"Getting %s succeeded, expected failure\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca 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 i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %7
store i32 0, i32* %8
%9 = load i8*, i8** %6
%10 = call i64 @lou_checkTable(i8* %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = load i8*, i8** %6
%14 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i8* %13)
store i32 1, i32* %8
br label %15
15: ; preds = %12, %2
%16 = load i8*, i8** %7
%17 = call i64 @lou_checkTable(i8* %16)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %15
%20 = load i8*, i8** %7
%21 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), i8* %20)
store i32 1, i32* %8
br label %22
22: ; preds = %19, %15
%23 = load i8*, i8** %6
%24 = call i64 @lou_checkTable(i8* %23)
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %22
%27 = load i8*, i8** %6
%28 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i8* %27)
store i32 1, i32* %8
br label %29
29: ; preds = %26, %22
%30 = call i32 (...) @lou_free()
%31 = load i32, i32* %8
ret i32 %31
}

LLVM IR (-O2):
@.str = [13 x i8] c"en-us-g1.ctb\00"
@.str.1 = [8 x i8] c"bad.ctb\00"
@.str.2 = [37 x i8] c"Getting %s failed, expected success\0A\00"
@.str.3 = [40 x i8] c"Getting %s succeeded, expected failure\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 @lou_checkTable(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
%8 = phi i32 [ 1, %5 ], [ 0, %2 ]
%9 = tail call i64 @lou_checkTable(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %7
%12 = tail call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %13
13: ; preds = %11, %7
%14 = phi i32 [ 1, %11 ], [ %8, %7 ]
%15 = tail call i64 @lou_checkTable(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = tail call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %19
19: ; preds = %17, %13
%20 = phi i32 [ 1, %17 ], [ %14, %13 ]
%21 = tail call i32 (...) @lou_free()
ret i32 %20
}