#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_backtranslation(char const *, char const *, int /*<<< orphan*/ *,
                          char const *);
int check_translation(char const *, char const *, int /*<<< orphan*/ *,
                      char const *);
int main(int argc, char **argv) {
  int result = 0;
  const char *tbl = "en-us-g2.ctb";
  const char *input = "but b can ";
  const char *expected = "b ;b c ";
  result |= check_translation(tbl, input, NULL, expected);
  result |= check_backtranslation(tbl, expected, NULL, input);
  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)
movl   $0x0,-0x14(%rbp)
lea    0xebc(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xebe(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xebe(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%edx
call   1030 <check_translation@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x28(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%edx
call   1040 <check_backtranslation@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xed2(%rip),%r15
lea    0xed8(%rip),%r14
lea    0xedc(%rip),%rbx
mov    %r15,%rdi
mov    %r14,%rsi
xor    %edx,%edx
mov    %rbx,%rcx
call   1030 <check_translation@plt>
mov    %eax,%ebp
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
mov    %r14,%rcx
call   1040 <check_backtranslation@plt>
or     %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"en-us-g2.ctb\00"
@.str.1 = [11 x i8] c"but b can \00"
@.str.2 = [8 x i8] c"b ;b c \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 i8*
%9 = 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 ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8** %7
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8** %8
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8** %9
%10 = load i8*, i8** %7
%11 = load i8*, i8** %8
%12 = load i8*, i8** %9
%13 = call i32 @check_translation(i8* %10, i8* %11, i32* null, i8* %12)
%14 = load i32, i32* %6
%15 = or i32 %14, %13
store i32 %15, i32* %6
%16 = load i8*, i8** %7
%17 = load i8*, i8** %9
%18 = load i8*, i8** %8
%19 = call i32 @check_backtranslation(i8* %16, i8* %17, i32* null, i8* %18)
%20 = load i32, i32* %6
%21 = or i32 %20, %19
store i32 %21, i32* %6
%22 = load i32, i32* %6
ret i32 %22
}

LLVM IR (-O2):
@.str = [13 x i8] c"en-us-g2.ctb\00"
@.str.1 = [11 x i8] c"but b can \00"
@.str.2 = [8 x i8] c"b ;b c \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @check_translation(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32* null, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @check_backtranslation(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32* null, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%5 = or i32 %4, %3
ret i32 %5
}