#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 */
struct dict_radix {
  int dummy;
};

/* Variables and functions */
scalar_t__ hspell_init(struct dict_radix **, int);
int /*<<< orphan*/ hspell_uninit(struct dict_radix *);
int /*<<< orphan*/ linginfo_desc2text(char *, char *, int);
scalar_t__ linginfo_lookup(char *, char **, char **);
char *linginfo_stem2text(char *, int);
int /*<<< orphan*/ printf(char *, char *, ...);
int /*<<< orphan*/ puts(char *);
int main() {
  char *test_data[] = {"ùåìçï", "àùä", "ðùåú", "éìãéðå"};
  const int test_data_count = 4;
  struct dict_radix *dict;
  if (hspell_init(&dict, 2) != 0)
    return -1;
  int i;
  for (i = 0; i < test_data_count; i++) {
    char *desc, *stem;
    printf("stem for %s -- ", test_data[i]);
    if (linginfo_lookup(test_data[i], &desc, &stem)) {
      puts("found -- \n");
      int stem_num;
      for (stem_num = 0;; stem_num++) {
        char buf[80];
        if (!linginfo_desc2text(buf, desc, stem_num))
          break;
        printf("\t%s(%s%s)\n", linginfo_stem2text(stem, stem_num), buf, "");
      }
    } else
      puts("not found!\n");
  }
  hspell_uninit(dict);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2c77(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2c74(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0x2c71(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2c6e(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x4,-0x34(%rbp)
lea    -0x40(%rbp),%rdi
mov    $0x2,%esi
call   1060 <hspell_init@plt>
cmp    $0x0,%rax
je     11d9 <main+0x69>
movl   $0xffffffff,-0x4(%rbp)
jmp    12c2 <main+0x152>
movl   $0x0,-0x44(%rbp)
cmpl   $0x4,-0x44(%rbp)
jge    12b2 <main+0x142>
movslq -0x44(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rsi
lea    0xe2e(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movslq -0x44(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rdi
lea    -0x50(%rbp),%rsi
lea    -0x58(%rbp),%rdx
call   1030 <linginfo_lookup@plt>
cmp    $0x0,%rax
je     1293 <main+0x123>
lea    0xe10(%rip),%rdi
call   1040 <puts@plt>
movl   $0x0,-0x5c(%rbp)
lea    -0xb0(%rbp),%rdi
mov    -0x50(%rbp),%rsi
mov    -0x5c(%rbp),%edx
call   1090 <linginfo_desc2text@plt>
cmp    $0x0,%eax
jne    1255 <main+0xe5>
jmp    128e <main+0x11e>
mov    -0x58(%rbp),%rdi
mov    -0x5c(%rbp),%esi
call   1080 <linginfo_stem2text@plt>
mov    %rax,%rsi
lea    -0xb0(%rbp),%rdx
lea    0xdd1(%rip),%rdi
lea    0xdc9(%rip),%rcx
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    1234 <main+0xc4>
jmp    129f <main+0x12f>
lea    0xdb4(%rip),%rdi
call   1040 <puts@plt>
jmp    12a4 <main+0x134>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11e0 <main+0x70>
mov    -0x40(%rbp),%rdi
call   1050 <hspell_uninit@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
lea    0x18(%rsp),%rdi
mov    $0x2,%esi
call   1060 <hspell_init@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
jne    1279 <main+0x109>
lea    0x20(%rsp),%rbp
lea    0xe99(%rip),%r12
lea    0xe91(%rip),%r13
xor    %r15d,%r15d
jmp    11da <main+0x6a>
cs nopw 0x0(%rax,%rax,1)
lea    0xe87(%rip),%rdi
call   1040 <puts@plt>
add    $0x1,%r15
cmp    $0x4,%r15
je     126d <main+0xfd>
lea    0x2c1f(%rip),%rax
mov    (%rax,%r15,8),%rbx
lea    0xe3c(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
lea    0x8(%rsp),%rsi
lea    0x10(%rsp),%rdx
call   1030 <linginfo_lookup@plt>
test   %rax,%rax
je     11c0 <main+0x50>
lea    0xe24(%rip),%rdi
call   1040 <puts@plt>
mov    0x8(%rsp),%rsi
mov    %rbp,%rdi
xor    %edx,%edx
call   1090 <linginfo_desc2text@plt>
test   %eax,%eax
je     11cc <main+0x5c>
xor    %r14d,%r14d
nop
mov    0x10(%rsp),%rdi
mov    %r14d,%esi
call   1080 <linginfo_stem2text@plt>
mov    %r12,%rdi
mov    %rax,%rsi
mov    %rbp,%rdx
mov    %r13,%rcx
xor    %eax,%eax
call   1070 <printf@plt>
add    $0x1,%r14d
mov    0x8(%rsp),%rsi
mov    %rbp,%rdi
mov    %r14d,%edx
call   1090 <linginfo_desc2text@plt>
test   %eax,%eax
jne    1230 <main+0xc0>
jmp    11cc <main+0x5c>
mov    0x18(%rsp),%rdi
call   1050 <hspell_uninit@plt>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.dict_radix = type { i32 }
@.str = [11 x i8] c"\C3\B9\C3\A5\C3\AC\C3\A7\C3\AF\00"
@.str.1 = [7 x i8] c"\C3\A0\C3\B9\C3\A4\00"
@.str.2 = [9 x i8] c"\C3\B0\C3\B9\C3\A5\C3\BA\00"
@.str.3 = [13 x i8] c"\C3\A9\C3\AC\C3\A3\C3\A9\C3\B0\C3\A5\00"
@__const.main.test_data = [4 x i8*] [i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i32 0, i32 0)]
@.str.4 = [16 x i8] c"stem for %s -- \00"
@.str.5 = [11 x i8] c"found -- \0A\00"
@.str.6 = [11 x i8] c"\09%s(%s%s)\0A\00"
@.str.7 = [1 x i8] zeroinitializer
@.str.8 = [12 x i8] c"not found!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i8*]
%3 = alloca i32
%4 = alloca %struct.dict_radix*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca [80 x i8]
store i32 0, i32* %1
%10 = bitcast [4 x i8*]* %2 to i8*
store i32 4, i32* %3
%11 = call i64 @hspell_init(%struct.dict_radix** %4, i32 2)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %0
store i32 -1, i32* %1
br label %58
14: ; preds = %0
store i32 0, i32* %5
br label %15
15: ; preds = %52, %14
%16 = load i32, i32* %5
%17 = icmp slt i32 %16, 4
br i1 %17, label %18, label %55
18: ; preds = %15
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 %20
%22 = load i8*, i8** %21
%23 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8* %22)
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 %25
%27 = load i8*, i8** %26
%28 = call i64 @linginfo_lookup(i8* %27, i8** %6, i8** %7)
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %49
30: ; preds = %18
%31 = call i32 @puts(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %8
br label %32
32: ; preds = %45, %30
%33 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%34 = load i8*, i8** %6
%35 = load i32, i32* %8
%36 = call i32 @linginfo_desc2text(i8* %33, i8* %34, i32 %35)
%37 = icmp ne i32 %36, 0
br i1 %37, label %39, label %38
38: ; preds = %32
br label %48
39: ; preds = %32
%40 = load i8*, i8** %7
%41 = load i32, i32* %8
%42 = call i8* @linginfo_stem2text(i8* %40, i32 %41)
%43 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%44 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* %42, i8* %43, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.7, i64 0, i64 0))
br label %45
45: ; preds = %39
%46 = load i32, i32* %8
%47 = add nsw i32 %46, 1
store i32 %47, i32* %8
br label %32
48: ; preds = %38
br label %51
49: ; preds = %18
%50 = call i32 @puts(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0))
br label %51
51: ; preds = %49, %48
br label %52
52: ; preds = %51
%53 = load i32, i32* %5
%54 = add nsw i32 %53, 1
store i32 %54, i32* %5
br label %15
55: ; preds = %15
%56 = load %struct.dict_radix*, %struct.dict_radix** %4
%57 = call i32 @hspell_uninit(%struct.dict_radix* %56)
store i32 0, i32* %1
br label %58
58: ; preds = %55, %13
%59 = load i32, i32* %1
ret i32 %59
}

LLVM IR (-O2):
%struct.dict_radix = type { i32 }
@.str = [11 x i8] c"\C3\B9\C3\A5\C3\AC\C3\A7\C3\AF\00"
@.str.1 = [7 x i8] c"\C3\A0\C3\B9\C3\A4\00"
@.str.2 = [9 x i8] c"\C3\B0\C3\B9\C3\A5\C3\BA\00"
@.str.3 = [13 x i8] c"\C3\A9\C3\AC\C3\A3\C3\A9\C3\B0\C3\A5\00"
@__const.main.test_data = [4 x i8*] [i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i32 0, i32 0)]
@.str.4 = [16 x i8] c"stem for %s -- \00"
@.str.5 = [11 x i8] c"found -- \0A\00"
@.str.6 = [11 x i8] c"\09%s(%s%s)\0A\00"
@.str.7 = [1 x i8] zeroinitializer
@.str.8 = [12 x i8] c"not found!\0A\00"
define i32 @main() {
%1 = alloca %struct.dict_radix*
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca [80 x i8]
%5 = bitcast %struct.dict_radix** %1 to i8*
%6 = call i64 @hspell_init(%struct.dict_radix** %1, i32 2)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %42
8: ; preds = %0
%9 = bitcast i8** %2 to i8*
%10 = bitcast i8** %3 to i8*
%11 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
br label %12
12: ; preds = %8, %36
%13 = phi i64 [ 0, %8 ], [ %37, %36 ]
%14 = getelementptr inbounds [4 x i8*], [4 x i8*]* @__const.main.test_data, i64 0, i64 %13
%15 = load i8*, i8** %14
%16 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8* %15)
%17 = call i64 @linginfo_lookup(i8* %15, i8** %2, i8** %3)
%18 = icmp eq i64 %17, 0
br i1 %18, label %34, label %19
19: ; preds = %12
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
%21 = load i8*, i8** %2
%22 = call i32 @linginfo_desc2text(i8* %11, i8* %21, i32 0)
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %25, %19
br label %36
25: ; preds = %19, %25
%26 = phi i32 [ %30, %25 ], [ 0, %19 ]
%27 = load i8*, i8** %3
%28 = call i8* @linginfo_stem2text(i8* %27, i32 %26)
%29 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* %28, i8* %11, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.7, i64 0, i64 0))
%30 = add nuw nsw i32 %26, 1
%31 = load i8*, i8** %2
%32 = call i32 @linginfo_desc2text(i8* %11, i8* %31, i32 %30)
%33 = icmp eq i32 %32, 0
br i1 %33, label %24, label %25
34: ; preds = %12
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0))
br label %36
36: ; preds = %24, %34
%37 = add nuw nsw i64 %13, 1
%38 = icmp eq i64 %37, 4
br i1 %38, label %39, label %12
39: ; preds = %36
%40 = load %struct.dict_radix*, %struct.dict_radix** %1
%41 = call i32 @hspell_uninit(%struct.dict_radix* %40)
br label %42
42: ; preds = %0, %39
%43 = phi i32 [ 0, %39 ], [ -1, %0 ]
ret i32 %43
}