#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 */
typedef int /*<<< orphan*/ buf;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ canon_sort(char *, char *, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ init_accent();
int /*<<< orphan*/ perror(char *);
scalar_t__ strcmp(char *, char *);
int strlen(char *);
int an_main(char *pattern, char *dictfile, void (*callback)(const char *word)) {
  FILE *fp;
  char an[100];
  char buf[100];
  char buf2[100];
  int anlen;
  int c;
  init_accent();
  canon_sort(an, pattern, -1);
  anlen = strlen(an);
  fp = fopen(dictfile, "r");
  if (fp == 0) {
    perror(dictfile);
    return 1;
  }
  while (fgets(buf, sizeof(buf), fp) != NULL) {
    if (canon_sort(buf2, buf, anlen))
      continue;
    if (strcmp(an, buf2) == 0) {
      buf[strlen(buf) - 1] = 0;
      callback(buf);
    }
  }
  fclose(fp);
  return 0;
}


x86 assembly (clang, -O0):
<an_main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x180,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    $0x0,%al
call   1070 <init_accent@plt>
lea    -0x90(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0xffffffff,%edx
call   1080 <canon_sort@plt>
lea    -0x90(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x174(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe30(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    11f9 <an_main+0x79>
mov    -0x18(%rbp),%rdi
call   10a0 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    129d <an_main+0x11d>
jmp    11fe <an_main+0x7e>
lea    -0x100(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    $0x64,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     128d <an_main+0x10d>
lea    -0x170(%rbp),%rdi
lea    -0x100(%rbp),%rsi
mov    -0x174(%rbp),%edx
call   1080 <canon_sort@plt>
cmp    $0x0,%rax
je     1245 <an_main+0xc5>
jmp    11fe <an_main+0x7e>
lea    -0x90(%rbp),%rdi
lea    -0x170(%rbp),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1288 <an_main+0x108>
lea    -0x100(%rbp),%rdi
call   1040 <strlen@plt>
sub    $0x1,%eax
cltq
movb   $0x0,-0x100(%rbp,%rax,1)
mov    -0x20(%rbp),%rax
lea    -0x100(%rbp),%rdi
call   *%rax
jmp    11fe <an_main+0x7e>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x180,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<an_main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x148,%rsp
mov    %rdx,%r14
mov    %rsi,%r12
mov    %rdi,%rbx
xor    %eax,%eax
call   1070 <init_accent@plt>
mov    %rsp,%rbp
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    $0xffffffff,%edx
call   1080 <canon_sort@plt>
mov    %rbp,%rdi
call   1040 <strlen@plt>
mov    %eax,%r15d
lea    0xe3a(%rip),%rsi
mov    %r12,%rdi
call   1090 <fopen@plt>
test   %rax,%rax
je     127b <an_main+0xfb>
mov    %rax,%rbx
lea    0xe0(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x64,%esi
mov    %rax,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     125f <an_main+0xdf>
lea    0x70(%rsp),%r12
mov    %rsp,%r13
jmp    1225 <an_main+0xa5>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rdi
mov    $0x64,%esi
mov    %rbx,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     125f <an_main+0xdf>
mov    %r12,%rdi
mov    %rbp,%rsi
mov    %r15d,%edx
call   1080 <canon_sort@plt>
test   %rax,%rax
jne    1210 <an_main+0x90>
mov    %r13,%rdi
mov    %r12,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    1210 <an_main+0x90>
mov    %rbp,%rdi
call   1040 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbp,1)
mov    %rbp,%rdi
call   *%r14
jmp    1210 <an_main+0x90>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x148,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r12,%rdi
call   10a0 <perror@plt>
mov    $0x1,%eax
jmp    1269 <an_main+0xe9>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
define i32 @an_main(i8* %0, i8* %1, void (i8*)* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca void (i8*)*
%8 = alloca i32*
%9 = alloca [100 x i8]
%10 = alloca [100 x i8]
%11 = alloca [100 x i8]
%12 = alloca i32
%13 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store void (i8*)* %2, void (i8*)** %7
%14 = call i32 (...) @init_accent()
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%16 = load i8*, i8** %5
%17 = call i64 @canon_sort(i8* %15, i8* %16, i32 -1)
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%19 = call i32 @strlen(i8* %18)
store i32 %19, i32* %12
%20 = load i8*, i8** %6
%21 = call i32* @fopen(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %21, i32** %8
%22 = load i32*, i32** %8
%23 = icmp eq i32* %22, null
br i1 %23, label %24, label %27
24: ; preds = %3
%25 = load i8*, i8** %6
%26 = call i32 @perror(i8* %25)
store i32 1, i32* %4
br label %57
27: ; preds = %3
br label %28
28: ; preds = %53, %39, %27
%29 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%30 = load i32*, i32** %8
%31 = call i32* @fgets(i8* %29, i32 100, i32* %30)
%32 = icmp ne i32* %31, null
br i1 %32, label %33, label %54
33: ; preds = %28
%34 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%35 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%36 = load i32, i32* %12
%37 = call i64 @canon_sort(i8* %34, i8* %35, i32 %36)
%38 = icmp ne i64 %37, 0
br i1 %38, label %39, label %40
39: ; preds = %33
br label %28
40: ; preds = %33
%41 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%42 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%43 = call i64 @strcmp(i8* %41, i8* %42)
%44 = icmp eq i64 %43, 0
br i1 %44, label %45, label %53
45: ; preds = %40
%46 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%47 = call i32 @strlen(i8* %46)
%48 = sub nsw i32 %47, 1
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 %49
store i8 0, i8* %50
%51 = load void (i8*)*, void (i8*)** %7
%52 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
br label %53
53: ; preds = %45, %40
br label %28
54: ; preds = %28
%55 = load i32*, i32** %8
%56 = call i32 @fclose(i32* %55)
store i32 0, i32* %4
br label %57
57: ; preds = %54, %24
%58 = load i32, i32* %4
ret i32 %58
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
define i32 @an_main(i8* %0, i8* nocapture %1, void (i8*)* nocapture %2) {
%4 = alloca [100 x i8]
%5 = alloca [100 x i8]
%6 = alloca [100 x i8]
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%10 = tail call i32 (...) @init_accent()
%11 = call i64 @canon_sort(i8* %7, i8* %0, i32 -1)
%12 = call i32 @strlen(i8* %7)
%13 = call i32* @fopen(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%14 = icmp eq i32* %13, null
br i1 %14, label %18, label %15
15: ; preds = %3
%16 = call i32* @fgets(i8* %8, i32 100, i32* %13)
%17 = icmp eq i32* %16, null
br i1 %17, label %34, label %20
18: ; preds = %3
%19 = call i32 @perror(i8* %1)
br label %36
20: ; preds = %15, %31
%21 = call i64 @canon_sort(i8* %9, i8* %8, i32 %12)
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %31
23: ; preds = %20
%24 = call i64 @strcmp(i8* %7, i8* %9)
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %31
26: ; preds = %23
%27 = call i32 @strlen(i8* %8)
%28 = add nsw i32 %27, -1
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 %29
store i8 0, i8* %30
br label %31
31: ; preds = %23, %26, %20
%32 = call i32* @fgets(i8* %8, i32 100, i32* %13)
%33 = icmp eq i32* %32, null
br i1 %33, label %34, label %20
34: ; preds = %31, %15
%35 = call i32 @fclose(i32* %13)
br label %36
36: ; preds = %34, %18
%37 = phi i32 [ 1, %18 ], [ 0, %34 ]
ret i32 %37
}