#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 */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ read_dict_info();
int /*<<< orphan*/ stem(char *, char *);
int main(int argc, char *argv[]) {
  char word[80];
  char thestem[80];
  FILE *fd;
  fd = fopen(argv[1], "r");
  if (!fd) {
    printf("Couldn't open the input file: %s", argv[1]);
    exit(1);
  }
  read_dict_info();
  fscanf(fd, "%s", word);
  while (!feof(fd)) {
    stem(word, thestem);
    printf("%s\n", thestem);
    fscanf(fd, "%s", word);
  }
  fclose(fd);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe58(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0xb8(%rbp)
cmpq   $0x0,-0xb8(%rbp)
jne    11e0 <main+0x60>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe31(%rip),%rdi
call   1050 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    $0x0,%al
call   1080 <read_dict_info@plt>
mov    -0xb8(%rbp),%rdi
lea    -0x60(%rbp),%rdx
lea    0xe27(%rip),%rsi
call   1060 <fscanf@plt>
mov    -0xb8(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    121f <main+0x9f>
jmp    125e <main+0xde>
lea    -0x60(%rbp),%rdi
lea    -0xb0(%rbp),%rsi
call   1030 <stem@plt>
lea    -0xb0(%rbp),%rsi
lea    0xde6(%rip),%rdi
call   1050 <printf@plt>
mov    -0xb8(%rbp),%rdi
lea    -0x60(%rbp),%rdx
lea    0xdcc(%rip),%rsi
call   1060 <fscanf@plt>
jmp    11fe <main+0x7e>
mov    -0xb8(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x4(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa0,%rsp
mov    %rsi,%r14
mov    0x8(%rsi),%rdi
lea    0xe62(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     123b <main+0xbb>
mov    %rax,%rbx
xor    %eax,%eax
call   1080 <read_dict_info@plt>
lea    0xe63(%rip),%rsi
mov    %rsp,%rdx
mov    %rbx,%rdi
call   1060 <fscanf@plt>
mov    %rbx,%rdi
call   1070 <feof@plt>
test   %eax,%eax
jne    1220 <main+0xa0>
mov    %rsp,%r14
lea    0x50(%rsp),%r15
lea    0xe40(%rip),%r12
lea    0xe36(%rip),%r13
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <stem@plt>
mov    %r12,%rdi
mov    %r15,%rsi
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %r14,%rdx
call   1060 <fscanf@plt>
mov    %rbx,%rdi
call   1070 <feof@plt>
test   %eax,%eax
je     11f0 <main+0x70>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
mov    0x8(%r14),%rsi
lea    0xdbc(%rip),%rdi
call   1050 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [33 x i8] c"Couldn't open the input file: %s\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [80 x i8]
%7 = alloca [80 x i8]
%8 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %12, i32** %8
%13 = load i32*, i32** %8
%14 = icmp ne i32* %13, null
br i1 %14, label %21, label %15
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i8* %18)
%20 = call i32 @exit(i32 1)
unreachable
21: ; preds = %2
%22 = call i32 (...) @read_dict_info()
%23 = load i32*, i32** %8
%24 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%25 = call i32 @fscanf(i32* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %24)
br label %26
26: ; preds = %31, %21
%27 = load i32*, i32** %8
%28 = call i32 @feof(i32* %27)
%29 = icmp ne i32 %28, 0
%30 = xor i1 %29, true
br i1 %30, label %31, label %40
31: ; preds = %26
%32 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%33 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%34 = call i32 @stem(i8* %32, i8* %33)
%35 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%36 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %35)
%37 = load i32*, i32** %8
%38 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%39 = call i32 @fscanf(i32* %37, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %38)
br label %26
40: ; preds = %26
%41 = load i32*, i32** %8
%42 = call i32 @fclose(i32* %41)
%43 = load i32, i32* %3
ret i32 %43
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [33 x i8] c"Couldn't open the input file: %s\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [80 x i8]
%4 = alloca [80 x i8]
%5 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32* @fopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i8*, i8** %7
%13 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = tail call i32 @exit(i32 1)
unreachable
15: ; preds = %2
%16 = tail call i32 (...) @read_dict_info()
%17 = call i32 @fscanf(i32* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %5)
%18 = call i32 @feof(i32* %9)
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %26
20: ; preds = %15, %20
%21 = call i32 @stem(i8* %5, i8* %6)
%22 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %6)
%23 = call i32 @fscanf(i32* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %5)
%24 = call i32 @feof(i32* %9)
%25 = icmp eq i32 %24, 0
br i1 %25, label %20, label %26
26: ; preds = %20, %15
%27 = call i32 @fclose(i32* %9)
ret i32 0
}