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

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sprintf(char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
int system(char *);
char *tmpnam(int /*<<< orphan*/ *);
char *makeText(char *document) {
  char str[80];
  if (system("which docx2txt.pl > /dev/null") == 0)
    sprintf(str, "docx2txt.pl ");
  else if (system("which docx2txt > /dev/null") == 0)
    sprintf(str, "docx2txt ");
  else {
    printf("Cannot find the docx2txt program!\nMake sure that it is installed "
           "and in your path.\nThe program can be downloaded from "
           "http://docx2txt.sourceforge.net/, or possibly your distro's "
           "package manager.");
  }
  char *output = tmpnam(NULL);
  strcat(str, " \"");
  strcat(str, document);
  strcat(str, "\" ");
  strcat(str, output);
  int command = system(str);
  if (command != 0) {
    printf("Error reading votes and proceedings file\n");
  }
  return output;
}


x86 assembly (clang, -O0):
<makeText>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xe9d(%rip),%rdi
call   1030 <system@plt>
cmp    $0x0,%eax
jne    1186 <makeText+0x36>
lea    -0x60(%rbp),%rdi
lea    0xea2(%rip),%rsi
call   1060 <sprintf@plt>
jmp    11c1 <makeText+0x71>
lea    0xe9e(%rip),%rdi
call   1030 <system@plt>
cmp    $0x0,%eax
jne    11b0 <makeText+0x60>
lea    -0x60(%rbp),%rdi
lea    0xea0(%rip),%rsi
call   1060 <sprintf@plt>
jmp    11bc <makeText+0x6c>
lea    0xe99(%rip),%rdi
call   1040 <printf@plt>
jmp    11c1 <makeText+0x71>
xor    %eax,%eax
mov    %eax,%edi
call   1070 <tmpnam@plt>
mov    %rax,-0x68(%rbp)
lea    -0x60(%rbp),%rdi
lea    0xf3a(%rip),%rsi
call   1050 <strcat@plt>
lea    -0x60(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1050 <strcat@plt>
lea    -0x60(%rbp),%rdi
lea    0xf20(%rip),%rsi
call   1050 <strcat@plt>
lea    -0x60(%rbp),%rdi
mov    -0x68(%rbp),%rsi
call   1050 <strcat@plt>
lea    -0x60(%rbp),%rdi
call   1030 <system@plt>
mov    %eax,-0x6c(%rbp)
cmpl   $0x0,-0x6c(%rbp)
je     122a <makeText+0xda>
lea    0xef4(%rip),%rdi
call   1040 <printf@plt>
mov    -0x68(%rbp),%rax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<makeText>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
mov    %rdi,%r14
lea    0xe9d(%rip),%rdi
call   1040 <system@plt>
test   %eax,%eax
je     118a <makeText+0x3a>
lea    0xeb8(%rip),%rdi
call   1040 <system@plt>
test   %eax,%eax
je     11a9 <makeText+0x59>
lea    0xecd(%rip),%rdi
call   1050 <printf@plt>
jmp    11be <makeText+0x6e>
movabs $0x206c702e747874,%rax
mov    %rax,0x5(%rsp)
movabs $0x7478743278636f64,%rax
74 78 74
mov    %rax,(%rsp)
jmp    11be <makeText+0x6e>
movabs $0x7478743278636f64,%rax
74 78 74
mov    %rax,(%rsp)
movw   $0x20,0x8(%rsp)
xor    %edi,%edi
call   1070 <tmpnam@plt>
mov    %rax,%r15
lea    0xf44(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1060 <strcat@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <strcat@plt>
lea    0xf2a(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcat@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <strcat@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
test   %eax,%eax
je     1217 <makeText+0xc7>
lea    0xf07(%rip),%rdi
call   1030 <puts@plt>
mov    %r15,%rax
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [30 x i8] c"which docx2txt.pl > /dev/null\00"
@.str.1 = [13 x i8] c"docx2txt.pl \00"
@.str.2 = [27 x i8] c"which docx2txt > /dev/null\00"
@.str.3 = [10 x i8] c"docx2txt \00"
@.str.4 = [195 x i8] c"Cannot find the docx2txt program!\0AMake sure that it is installed and in your path.\0AThe program can be downloaded from http://docx2txt.sourceforge.net/, or possibly your distro's package manager.\00"
@.str.5 = [3 x i8] c" \22\00"
@.str.6 = [3 x i8] c"\22 \00"
@.str.7 = [42 x i8] c"Error reading votes and proceedings file\0A\00"
define i8* @makeText(i8* %0) {
%2 = alloca i8*
%3 = alloca [80 x i8]
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %2
%6 = call i32 @system(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%10 = call i32 @sprintf(i8* %9, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %20
11: ; preds = %1
%12 = call i32 @system(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%16 = call i32 @sprintf(i8* %15, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
br label %19
17: ; preds = %11
%18 = call i32 @printf(i8* getelementptr inbounds ([195 x i8], [195 x i8]* @.str.4, i64 0, i64 0))
br label %19
19: ; preds = %17, %14
br label %20
20: ; preds = %19, %8
%21 = call i8* @tmpnam(i32* null)
store i8* %21, i8** %4
%22 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%23 = call i32 @strcat(i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%24 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%25 = load i8*, i8** %2
%26 = call i32 @strcat(i8* %24, i8* %25)
%27 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%28 = call i32 @strcat(i8* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%29 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%30 = load i8*, i8** %4
%31 = call i32 @strcat(i8* %29, i8* %30)
%32 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%33 = call i32 @system(i8* %32)
store i32 %33, i32* %5
%34 = load i32, i32* %5
%35 = icmp ne i32 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %20
%37 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0))
br label %38
38: ; preds = %36, %20
%39 = load i8*, i8** %4
ret i8* %39
}

LLVM IR (-O2):
@.str = [30 x i8] c"which docx2txt.pl > /dev/null\00"
@.str.1 = [13 x i8] c"docx2txt.pl \00"
@.str.2 = [27 x i8] c"which docx2txt > /dev/null\00"
@.str.3 = [10 x i8] c"docx2txt \00"
@.str.4 = [195 x i8] c"Cannot find the docx2txt program!\0AMake sure that it is installed and in your path.\0AThe program can be downloaded from http://docx2txt.sourceforge.net/, or possibly your distro's package manager.\00"
@.str.5 = [3 x i8] c" \22\00"
@.str.6 = [3 x i8] c"\22 \00"
@str = [41 x i8] c"Error reading votes and proceedings file\00"
define i8* @makeText(i8* %0) {
%2 = alloca [80 x i8]
%3 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%4 = tail call i32 @system(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
br label %13
7: ; preds = %1
%8 = tail call i32 @system(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %7
br label %13
11: ; preds = %7
%12 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([195 x i8], [195 x i8]* @.str.4, i64 0, i64 0))
br label %13
13: ; preds = %10, %11, %6
%14 = tail call i8* @tmpnam(i32* null)
%15 = call i32 @strcat(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%16 = call i32 @strcat(i8* %3, i8* %0)
%17 = call i32 @strcat(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%18 = call i32 @strcat(i8* %3, i8* %14)
%19 = call i32 @system(i8* %3)
%20 = icmp eq i32 %19, 0
br i1 %20, label %23, label %21
21: ; preds = %13
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
br label %23
23: ; preds = %21, %13
ret i8* %14
}