#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 */
scalar_t__ WordHasPrefix(char *, char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void PassWordsWithPrefixes(char *word, char *outputFileName, char *prefix) {
  if (WordHasPrefix(word, prefix)) {
    FILE *outputFile;
    outputFile = fopen(outputFileName, "a");
    fprintf(outputFile, word);
    fprintf(outputFile, " ");
    fclose(outputFile);
  }
}


x86 assembly (clang, -O0):
<PassWordsWithPrefixes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <WordHasPrefix@plt>
cmp    $0x0,%rax
je     11a5 <PassWordsWithPrefixes+0x65>
mov    -0x10(%rbp),%rdi
lea    0xe8a(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
lea    0xe6b(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PassWordsWithPrefixes>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rdx,%rsi
call   1040 <WordHasPrefix@plt>
test   %rax,%rax
je     119f <PassWordsWithPrefixes+0x4f>
lea    0xe91(%rip),%rsi
mov    %r14,%rdi
call   1070 <fopen@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15,%rsi
call   1060 <fprintf@plt>
mov    $0x20,%edi
mov    %rbx,%rsi
call   1050 <fputc@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <fclose@plt>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"a\00"
@.str.1 = [2 x i8] c" \00"
define void @PassWordsWithPrefixes(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load i8*, i8** %4
%9 = load i8*, i8** %6
%10 = call i64 @WordHasPrefix(i8* %8, i8* %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %22
12: ; preds = %3
%13 = load i8*, i8** %5
%14 = call i32* @fopen(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %14, i32** %7
%15 = load i32*, i32** %7
%16 = load i8*, i8** %4
%17 = call i32 @fprintf(i32* %15, i8* %16)
%18 = load i32*, i32** %7
%19 = call i32 @fprintf(i32* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%20 = load i32*, i32** %7
%21 = call i32 @fclose(i32* %20)
br label %22
22: ; preds = %12, %3
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"a\00"
define void @PassWordsWithPrefixes(i8* %0, i8* nocapture %1, i8* %2) {
%4 = tail call i64 @WordHasPrefix(i8* %0, i8* %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %3
%7 = tail call i32* @fopen(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @fprintf(i32* %7, i8* %0)
%9 = tail call i32 @fputc(i32 32, i32* %7)
%10 = tail call i32 @fclose(i32* %7)
br label %11
11: ; preds = %6, %3
ret void
}