#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 /*<<< orphan*/ check_translation(char *, char *, char *, char *);
char *malloc(int);
int main(int argc, char **argv) {
  int i;
  char *table = "pass0_typebuf.ctb";
  char *text = "foo baz";
  char *expected = "foobar .baz";
  char *typeform = malloc(20 * sizeof(char));
  for (i = 0; i < 7; i++)
    typeform[i] = 0;
  for (i = 4; i < 7; i++)
    typeform[i] = 1;
  if (!check_translation(table, text, typeform, expected))
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xec7(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    $0x14,%edi
call   1040 <malloc@plt>
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x7,-0x14(%rbp)
jge    1190 <main+0x70>
mov    -0x38(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    116c <main+0x4c>
movl   $0x4,-0x14(%rbp)
cmpl   $0x7,-0x14(%rbp)
jge    11bb <main+0x9b>
mov    -0x38(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x1,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1197 <main+0x77>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    -0x30(%rbp),%rcx
call   1030 <check_translation@plt>
cmp    $0x0,%eax
jne    11e5 <main+0xc5>
movl   $0x0,-0x4(%rbp)
jmp    11ec <main+0xcc>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x14,%edi
call   1040 <malloc@plt>
movl   $0x0,(%rax)
movw   $0x101,0x4(%rax)
movb   $0x1,0x6(%rax)
lea    0xebe(%rip),%rdi
lea    0xec9(%rip),%rsi
lea    0xeca(%rip),%rcx
mov    %rax,%rdx
call   1030 <check_translation@plt>
xor    %ecx,%ecx
test   %eax,%eax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"pass0_typebuf.ctb\00"
@.str.1 = [8 x i8] c"foo baz\00"
@.str.2 = [12 x i8] c"foobar .baz\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*
%10 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8** %7
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %8
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8** %9
%11 = call i8* @malloc(i32 20)
store i8* %11, i8** %10
store i32 0, i32* %6
br label %12
12: ; preds = %20, %2
%13 = load i32, i32* %6
%14 = icmp slt i32 %13, 7
br i1 %14, label %15, label %23
15: ; preds = %12
%16 = load i8*, i8** %10
%17 = load i32, i32* %6
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
store i8 0, i8* %19
br label %20
20: ; preds = %15
%21 = load i32, i32* %6
%22 = add nsw i32 %21, 1
store i32 %22, i32* %6
br label %12
23: ; preds = %12
store i32 4, i32* %6
br label %24
24: ; preds = %32, %23
%25 = load i32, i32* %6
%26 = icmp slt i32 %25, 7
br i1 %26, label %27, label %35
27: ; preds = %24
%28 = load i8*, i8** %10
%29 = load i32, i32* %6
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %28, i64 %30
store i8 1, i8* %31
br label %32
32: ; preds = %27
%33 = load i32, i32* %6
%34 = add nsw i32 %33, 1
store i32 %34, i32* %6
br label %24
35: ; preds = %24
%36 = load i8*, i8** %7
%37 = load i8*, i8** %8
%38 = load i8*, i8** %10
%39 = load i8*, i8** %9
%40 = call i32 @check_translation(i8* %36, i8* %37, i8* %38, i8* %39)
%41 = icmp ne i32 %40, 0
br i1 %41, label %43, label %42
42: ; preds = %35
store i32 0, i32* %3
br label %44
43: ; preds = %35
store i32 1, i32* %3
br label %44
44: ; preds = %43, %42
%45 = load i32, i32* %3
ret i32 %45
}

LLVM IR (-O2):
@.str = [18 x i8] c"pass0_typebuf.ctb\00"
@.str.1 = [8 x i8] c"foo baz\00"
@.str.2 = [12 x i8] c"foobar .baz\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call dereferenceable_or_null(20) i8* @malloc(i32 20)
%4 = bitcast i8* %3 to i32*
store i32 0, i32* %4
%5 = getelementptr i8, i8* %3, i64 4
%6 = tail call i32 @check_translation(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %3, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i32
ret i32 %8
}