#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*/ FILE;

/* Variables and functions */
char EOF;
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ hash_table_add(char *);
int /*<<< orphan*/ perror(char *);
int init_corpus_from_file(char *filename) {
  char ch;
  char chaine[100];
  FILE *fp;
  fp = fopen(filename, "r");
  if (fp == NULL) {
    perror("Error while opening the file.\n");
    exit(EXIT_FAILURE);
  }
  int i = 0;
  while ((ch = fgetc(fp)) != EOF) {
    int separator = 0;
    for (int j = 0;
         "  \t\n\r.,:;`/\"+-_(){}[]<>*&^%$#@!?~/|\\=1234567890"[j] != '\0';
         j++) {
      if ("  \t\n\r.,:;`/\"+-_(){}[]<>*&^%$#@!?~/|\\=1234567890"[j] == ch) {
        separator = 1;
        break;
      }
    }
    if (!separator) {
      chaine[i] = ch;
      i++;
      continue;
    }
    if (!i)
      continue;
    chaine[i] = '\0';
    i = 0;
    hash_table_add(chaine);
  }
  fclose(fp);
  return 1;
}


x86 assembly (clang, -O0):
<init_corpus_from_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe86(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x78(%rbp)
cmpq   $0x0,-0x78(%rbp)
jne    11a8 <init_corpus_from_file+0x48>
lea    0xe6d(%rip),%rdi
call   1060 <perror@plt>
mov    0x2e37(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
movl   $0x0,-0x7c(%rbp)
mov    -0x78(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %al,-0x9(%rbp)
movsbl %al,%eax
mov    0x2e23(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     128f <init_corpus_from_file+0x12f>
movl   $0x0,-0x80(%rbp)
movl   $0x0,-0x84(%rbp)
movslq -0x84(%rbp),%rcx
lea    0xe32(%rip),%rax
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     123f <init_corpus_from_file+0xdf>
movslq -0x84(%rbp),%rcx
lea    0xe17(%rip),%rax
movsbl (%rax,%rcx,1),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
jne    1226 <init_corpus_from_file+0xc6>
movl   $0x1,-0x80(%rbp)
jmp    123f <init_corpus_from_file+0xdf>
jmp    122b <init_corpus_from_file+0xcb>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    11e1 <init_corpus_from_file+0x81>
cmpl   $0x0,-0x80(%rbp)
jne    1262 <init_corpus_from_file+0x102>
mov    -0x9(%rbp),%cl
movslq -0x7c(%rbp),%rax
mov    %cl,-0x70(%rbp,%rax,1)
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    11af <init_corpus_from_file+0x4f>
cmpl   $0x0,-0x7c(%rbp)
jne    1271 <init_corpus_from_file+0x111>
jmp    11af <init_corpus_from_file+0x4f>
movslq -0x7c(%rbp),%rax
movb   $0x0,-0x70(%rbp,%rax,1)
movl   $0x0,-0x7c(%rbp)
lea    -0x70(%rbp),%rdi
call   1070 <hash_table_add@plt>
jmp    11af <init_corpus_from_file+0x4f>
mov    -0x78(%rbp),%rdi
call   1030 <fclose@plt>
mov    $0x1,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_corpus_from_file>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x70,%rsp
lea    0xe8c(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     124e <init_corpus_from_file+0xee>
mov    %rax,%r12
mov    %rax,%rdi
call   1040 <fgetc@plt>
mov    0x2e54(%rip),%r15
cmp    (%r15),%al
jne    11b4 <init_corpus_from_file+0x54>
mov    %r12,%rdi
call   1030 <fclose@plt>
mov    $0x1,%eax
add    $0x70,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
xor    %ecx,%ecx
lea    0xe64(%rip),%rbx
mov    %rsp,%r14
jmp    11e7 <init_corpus_from_file+0x87>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %r13d,%r13d
test   %ecx,%ecx
jne    1230 <init_corpus_from_file+0xd0>
mov    %r12,%rdi
call   1040 <fgetc@plt>
mov    %r13d,%ecx
cmp    (%r15),%al
je     1199 <init_corpus_from_file+0x39>
mov    $0x3,%edx
cmp    %al,-0x3(%rdx,%rbx,1)
je     11d0 <init_corpus_from_file+0x70>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    %al,-0x2(%rdx,%rbx,1)
je     11d0 <init_corpus_from_file+0x70>
cmp    %al,-0x1(%rdx,%rbx,1)
je     11d0 <init_corpus_from_file+0x70>
cmp    $0x2f,%rdx
je     1241 <init_corpus_from_file+0xe1>
cmp    %al,(%rdx,%rbx,1)
je     11d0 <init_corpus_from_file+0x70>
add    $0x4,%rdx
cmp    %al,-0x3(%rdx,%rbx,1)
jne    1200 <init_corpus_from_file+0xa0>
jmp    11d0 <init_corpus_from_file+0x70>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movslq %ecx,%rax
movb   $0x0,(%rsp,%rax,1)
mov    %r14,%rdi
call   1070 <hash_table_add@plt>
jmp    11d7 <init_corpus_from_file+0x77>
movslq %ecx,%r13
mov    %al,(%rsp,%r13,1)
add    $0x1,%r13d
jmp    11d7 <init_corpus_from_file+0x77>
lea    0xdad(%rip),%rdi
call   1060 <perror@plt>
mov    0x2d77(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [31 x i8] c"Error while opening the file.\0A\00"
@EXIT_FAILURE = global i32 0
@EOF = global i8 0
@.str.2 = [48 x i8] c" \09\0A\0D.,:;`/\22+-_(){}[]<>*&^%$#@!?~/|\\=1234567890\00"
define i32 @init_corpus_from_file(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
%4 = alloca [100 x i8]
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %2
%9 = load i8*, i8** %2
%10 = call i32* @fopen(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %10, i32** %5
%11 = load i32*, i32** %5
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %17
13: ; preds = %1
%14 = call i32 @perror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%15 = load i32, i32* @EXIT_FAILURE
%16 = call i32 @exit(i32 %15)
unreachable
17: ; preds = %1
store i32 0, i32* %6
br label %18
18: ; preds = %61, %60, %50, %17
%19 = load i32*, i32** %5
%20 = call signext i8 @fgetc(i32* %19)
store i8 %20, i8* %3
%21 = sext i8 %20 to i32
%22 = load i8, i8* @EOF
%23 = sext i8 %22 to i32
%24 = icmp ne i32 %21, %23
br i1 %24, label %25, label %67
25: ; preds = %18
store i32 0, i32* %7
store i32 0, i32* %8
br label %26
26: ; preds = %44, %25
%27 = load i32, i32* %8
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [48 x i8], [48 x i8]* @.str.2, i64 0, i64 %28
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %47
33: ; preds = %26
%34 = load i32, i32* %8
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [48 x i8], [48 x i8]* @.str.2, i64 0, i64 %35
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = load i8, i8* %3
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %38, %40
br i1 %41, label %42, label %43
42: ; preds = %33
store i32 1, i32* %7
br label %47
43: ; preds = %33
br label %44
44: ; preds = %43
%45 = load i32, i32* %8
%46 = add nsw i32 %45, 1
store i32 %46, i32* %8
br label %26
47: ; preds = %42, %26
%48 = load i32, i32* %7
%49 = icmp ne i32 %48, 0
br i1 %49, label %57, label %50
50: ; preds = %47
%51 = load i8, i8* %3
%52 = load i32, i32* %6
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 %53
store i8 %51, i8* %54
%55 = load i32, i32* %6
%56 = add nsw i32 %55, 1
store i32 %56, i32* %6
br label %18
57: ; preds = %47
%58 = load i32, i32* %6
%59 = icmp ne i32 %58, 0
br i1 %59, label %61, label %60
60: ; preds = %57
br label %18
61: ; preds = %57
%62 = load i32, i32* %6
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 %63
store i8 0, i8* %64
store i32 0, i32* %6
%65 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%66 = call i32 @hash_table_add(i8* %65)
br label %18
67: ; preds = %18
%68 = load i32*, i32** %5
%69 = call i32 @fclose(i32* %68)
ret i32 1
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [31 x i8] c"Error while opening the file.\0A\00"
@EXIT_FAILURE = global i32 0
@EOF = global i8 0
@.str.2 = [48 x i8] c" \09\0A\0D.,:;`/\22+-_(){}[]<>*&^%$#@!?~/|\\=1234567890\00"
define i32 @init_corpus_from_file(i8* nocapture %0) {
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%4 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32* %4, null
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = call signext i8 @fgetc(i32* %4)
%8 = load i8, i8* @EOF
%9 = icmp eq i8 %7, %8
br i1 %9, label %56, label %14
10: ; preds = %1
%11 = tail call i32 @perror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%12 = load i32, i32* @EXIT_FAILURE
%13 = tail call i32 @exit(i32 %12)
unreachable
14: ; preds = %6, %51
%15 = phi i8 [ %53, %51 ], [ %7, %6 ]
%16 = phi i32 [ %52, %51 ], [ 0, %6 ]
br label %36
17: ; preds = %36
%18 = or i64 %37, 1
%19 = getelementptr inbounds [48 x i8], [48 x i8]* @.str.2, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = icmp eq i8 %20, %15
br i1 %21, label %45, label %22
22: ; preds = %17
%23 = or i64 %37, 2
%24 = getelementptr inbounds [48 x i8], [48 x i8]* @.str.2, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = icmp eq i8 %25, %15
%27 = or i64 %37, 3
br i1 %26, label %45, label %28
28: ; preds = %22
%29 = icmp eq i64 %27, 47
br i1 %29, label %41, label %30
30: ; preds = %28
%31 = getelementptr inbounds [48 x i8], [48 x i8]* @.str.2, i64 0, i64 %27
%32 = load i8, i8* %31
%33 = icmp eq i8 %32, %15
br i1 %33, label %45, label %34
34: ; preds = %30
%35 = add nuw nsw i64 %37, 4
br label %36
36: ; preds = %34, %14
%37 = phi i64 [ 0, %14 ], [ %35, %34 ]
%38 = getelementptr inbounds [48 x i8], [48 x i8]* @.str.2, i64 0, i64 %37
%39 = load i8, i8* %38
%40 = icmp eq i8 %39, %15
br i1 %40, label %45, label %17
41: ; preds = %28
%42 = sext i32 %16 to i64
%43 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %42
store i8 %15, i8* %43
%44 = add nsw i32 %16, 1
br label %51
45: ; preds = %30, %22, %17, %36
%46 = icmp eq i32 %16, 0
br i1 %46, label %51, label %47
47: ; preds = %45
%48 = sext i32 %16 to i64
%49 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %48
store i8 0, i8* %49
%50 = call i32 @hash_table_add(i8* %3)
br label %51
51: ; preds = %45, %47, %41
%52 = phi i32 [ 0, %47 ], [ %44, %41 ], [ 0, %45 ]
%53 = call signext i8 @fgetc(i32* %4)
%54 = load i8, i8* @EOF
%55 = icmp eq i8 %53, %54
br i1 %55, label %56, label %14
56: ; preds = %51, %6
%57 = call i32 @fclose(i32* %4)
ret i32 1
}