#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*/ GetParsedBuf(char *, char **);
int /*<<< orphan*/ GetProgArgv(char *, char *, char *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(char *);
scalar_t__ malloc(scalar_t__);
int /*<<< orphan*/ pclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *popen(char *, char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, ...);
scalar_t__ strlen(char *);
void IncludeEXE(char *szCmd, FILE *ofp) {
  char *p, *a, *qs;
  char *prog, *argv;
  char szLine[1024];
  FILE *fp;
  prog = (char *)malloc(strlen(szCmd) + 1);
  if (prog == NULL)
    return;
  argv = (char *)malloc(strlen(szCmd) + 1);
  if (argv == NULL) {
    free(prog);
    return;
  }
  GetProgArgv(szCmd, prog, argv);
  if (prog[0] == '\0') {
    free(prog);
    free(argv);
    return;
  }
  GetParsedBuf(prog, &p);
  if (argv[0]) {
    GetParsedBuf(argv, &a);
    qs = (char *)malloc(strlen(p) + strlen(a) + 10);
    sprintf(qs, "%s %s", p, a);
  } else {
    qs = (char *)malloc(strlen(p) + 10);
    sprintf(qs, "%s", p);
  }
  fp = popen(qs, "r");
  if (fp) {
    while (fgets(szLine, 1023, fp)) {
      if (ofp) {
        fputs(szLine, ofp);
      } else {
        puts(szLine);
      }
    }
    pclose(fp);
  }
  free(p);
  if (argv[0])
    free(a);
  free(qs);
  free(prog);
  free(argv);
}


x86 assembly (clang, -O0):
<IncludeEXE>:
push   %rbp
mov    %rsp,%rbp
sub    $0x450,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1090 <malloc@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    11ec <IncludeEXE+0x3c>
jmp    13be <IncludeEXE+0x20e>
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1090 <malloc@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    121e <IncludeEXE+0x6e>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
jmp    13be <IncludeEXE+0x20e>
mov    -0x8(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdx
call   10d0 <GetProgArgv@plt>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1256 <IncludeEXE+0xa6>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
jmp    13be <IncludeEXE+0x20e>
mov    -0x30(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   10b0 <GetParsedBuf@plt>
mov    -0x38(%rbp),%rax
cmpb   $0x0,(%rax)
je     12cc <IncludeEXE+0x11c>
mov    -0x38(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   10b0 <GetParsedBuf@plt>
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,-0x450(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x450(%rbp),%rdi
add    %rax,%rdi
add    $0xa,%rdi
call   1090 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xd40(%rip),%rsi
mov    $0x0,%al
call   10c0 <sprintf@plt>
jmp    12fb <IncludeEXE+0x14b>
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rdi
add    $0xa,%rdi
call   1090 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xd0f(%rip),%rsi
mov    $0x0,%al
call   10c0 <sprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0xd00(%rip),%rsi
call   10a0 <popen@plt>
mov    %rax,-0x448(%rbp)
cmpq   $0x0,-0x448(%rbp)
je     1384 <IncludeEXE+0x1d4>
jmp    1325 <IncludeEXE+0x175>
lea    -0x440(%rbp),%rdi
mov    -0x448(%rbp),%rdx
mov    $0x3ff,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
je     1378 <IncludeEXE+0x1c8>
cmpq   $0x0,-0x10(%rbp)
je     1367 <IncludeEXE+0x1b7>
lea    -0x440(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1070 <fputs@plt>
jmp    1373 <IncludeEXE+0x1c3>
lea    -0x440(%rbp),%rdi
call   1040 <puts@plt>
jmp    1325 <IncludeEXE+0x175>
mov    -0x448(%rbp),%rdi
call   1060 <pclose@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rax
cmpb   $0x0,(%rax)
je     13a3 <IncludeEXE+0x1f3>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
add    $0x450,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IncludeEXE>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x418,%rsp
mov    %rsi,%r13
mov    %rdi,%rbx
call   1060 <strlen@plt>
lea    0x1(%rax),%rdi
call   10a0 <malloc@plt>
test   %rax,%rax
je     1365 <IncludeEXE+0x1a5>
mov    %rax,%r15
mov    %rbx,%rdi
call   1060 <strlen@plt>
lea    0x1(%rax),%rdi
call   10a0 <malloc@plt>
test   %rax,%rax
je     127e <IncludeEXE+0xbe>
mov    %rax,%r14
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %rax,%rdx
call   10e0 <GetProgArgv@plt>
cmpb   $0x0,(%r15)
je     1283 <IncludeEXE+0xc3>
mov    %rsp,%rsi
mov    %r15,%rdi
call   10c0 <GetParsedBuf@plt>
cmpb   $0x0,(%r14)
je     12a4 <IncludeEXE+0xe4>
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
call   10c0 <GetParsedBuf@plt>
mov    (%rsp),%rdi
call   1060 <strlen@plt>
mov    %rax,%rbx
mov    0x8(%rsp),%rdi
call   1060 <strlen@plt>
lea    (%rbx,%rax,1),%rdi
add    $0xa,%rdi
call   10a0 <malloc@plt>
mov    %rax,%r12
mov    (%rsp),%rdx
mov    0x8(%rsp),%rcx
lea    0xd8e(%rip),%rsi
mov    %rax,%rdi
xor    %eax,%eax
call   10d0 <sprintf@plt>
jmp    12c5 <IncludeEXE+0x105>
mov    %r15,%rdi
jmp    128e <IncludeEXE+0xce>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
add    $0x418,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>
mov    (%rsp),%rdi
call   1060 <strlen@plt>
lea    0xa(%rax),%rdi
call   10a0 <malloc@plt>
mov    %rax,%r12
mov    (%rsp),%rsi
mov    %rax,%rdi
call   1040 <strcpy@plt>
lea    0xd3a(%rip),%rsi
mov    %r12,%rdi
call   10b0 <popen@plt>
test   %rax,%rax
je     1334 <IncludeEXE+0x174>
mov    %rax,%rbx
lea    0x10(%rsp),%rdi
mov    $0x3ff,%esi
mov    %rax,%rdx
call   1090 <fgets@plt>
test   %rax,%rax
je     132c <IncludeEXE+0x16c>
lea    0x10(%rsp),%rbp
jmp    131a <IncludeEXE+0x15a>
nopw   0x0(%rax,%rax,1)
call   1050 <puts@plt>
mov    %rbp,%rdi
mov    $0x3ff,%esi
mov    %rbx,%rdx
call   1090 <fgets@plt>
test   %rax,%rax
je     132c <IncludeEXE+0x16c>
mov    %rbp,%rdi
test   %r13,%r13
je     1300 <IncludeEXE+0x140>
mov    %r13,%rsi
call   1080 <fputs@plt>
jmp    1305 <IncludeEXE+0x145>
mov    %rbx,%rdi
call   1070 <pclose@plt>
mov    (%rsp),%rdi
call   1030 <free@plt>
cmpb   $0x0,(%r14)
je     134d <IncludeEXE+0x18d>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
add    $0x418,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%s %s\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [2 x i8] c"r\00"
define void @IncludeEXE(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca [1024 x i8]
%11 = alloca i32*
store i8* %0, i8** %3
store i32* %1, i32** %4
%12 = load i8*, i8** %3
%13 = call i64 @strlen(i8* %12)
%14 = add nsw i64 %13, 1
%15 = call i64 @malloc(i64 %14)
%16 = inttoptr i64 %15 to i8*
store i8* %16, i8** %8
%17 = load i8*, i8** %8
%18 = icmp eq i8* %17, null
br i1 %18, label %19, label %20
19: ; preds = %2
br label %119
20: ; preds = %2
%21 = load i8*, i8** %3
%22 = call i64 @strlen(i8* %21)
%23 = add nsw i64 %22, 1
%24 = call i64 @malloc(i64 %23)
%25 = inttoptr i64 %24 to i8*
store i8* %25, i8** %9
%26 = load i8*, i8** %9
%27 = icmp eq i8* %26, null
br i1 %27, label %28, label %31
28: ; preds = %20
%29 = load i8*, i8** %8
%30 = call i32 @free(i8* %29)
br label %119
31: ; preds = %20
%32 = load i8*, i8** %3
%33 = load i8*, i8** %8
%34 = load i8*, i8** %9
%35 = call i32 @GetProgArgv(i8* %32, i8* %33, i8* %34)
%36 = load i8*, i8** %8
%37 = getelementptr inbounds i8, i8* %36, i64 0
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = icmp eq i32 %39, 0
br i1 %40, label %41, label %46
41: ; preds = %31
%42 = load i8*, i8** %8
%43 = call i32 @free(i8* %42)
%44 = load i8*, i8** %9
%45 = call i32 @free(i8* %44)
br label %119
46: ; preds = %31
%47 = load i8*, i8** %8
%48 = call i32 @GetParsedBuf(i8* %47, i8** %5)
%49 = load i8*, i8** %9
%50 = getelementptr inbounds i8, i8* %49, i64 0
%51 = load i8, i8* %50
%52 = icmp ne i8 %51, 0
br i1 %52, label %53, label %68
53: ; preds = %46
%54 = load i8*, i8** %9
%55 = call i32 @GetParsedBuf(i8* %54, i8** %6)
%56 = load i8*, i8** %5
%57 = call i64 @strlen(i8* %56)
%58 = load i8*, i8** %6
%59 = call i64 @strlen(i8* %58)
%60 = add nsw i64 %57, %59
%61 = add nsw i64 %60, 10
%62 = call i64 @malloc(i64 %61)
%63 = inttoptr i64 %62 to i8*
store i8* %63, i8** %7
%64 = load i8*, i8** %7
%65 = load i8*, i8** %5
%66 = load i8*, i8** %6
%67 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %64, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %65, i8* %66)
br label %77
68: ; preds = %46
%69 = load i8*, i8** %5
%70 = call i64 @strlen(i8* %69)
%71 = add nsw i64 %70, 10
%72 = call i64 @malloc(i64 %71)
%73 = inttoptr i64 %72 to i8*
store i8* %73, i8** %7
%74 = load i8*, i8** %7
%75 = load i8*, i8** %5
%76 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %74, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %75)
br label %77
77: ; preds = %68, %53
%78 = load i8*, i8** %7
%79 = call i32* @popen(i8* %78, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %79, i32** %11
%80 = load i32*, i32** %11
%81 = icmp ne i32* %80, null
br i1 %81, label %82, label %102
82: ; preds = %77
br label %83
83: ; preds = %98, %82
%84 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%85 = load i32*, i32** %11
%86 = call i64 @fgets(i8* %84, i32 1023, i32* %85)
%87 = icmp ne i64 %86, 0
br i1 %87, label %88, label %99
88: ; preds = %83
%89 = load i32*, i32** %4
%90 = icmp ne i32* %89, null
br i1 %90, label %91, label %95
91: ; preds = %88
%92 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%93 = load i32*, i32** %4
%94 = call i32 @fputs(i8* %92, i32* %93)
br label %98
95: ; preds = %88
%96 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%97 = call i32 @puts(i8* %96)
br label %98
98: ; preds = %95, %91
br label %83
99: ; preds = %83
%100 = load i32*, i32** %11
%101 = call i32 @pclose(i32* %100)
br label %102
102: ; preds = %99, %77
%103 = load i8*, i8** %5
%104 = call i32 @free(i8* %103)
%105 = load i8*, i8** %9
%106 = getelementptr inbounds i8, i8* %105, i64 0
%107 = load i8, i8* %106
%108 = icmp ne i8 %107, 0
br i1 %108, label %109, label %112
109: ; preds = %102
%110 = load i8*, i8** %6
%111 = call i32 @free(i8* %110)
br label %112
112: ; preds = %109, %102
%113 = load i8*, i8** %7
%114 = call i32 @free(i8* %113)
%115 = load i8*, i8** %8
%116 = call i32 @free(i8* %115)
%117 = load i8*, i8** %9
%118 = call i32 @free(i8* %117)
br label %119
119: ; preds = %112, %41, %28, %19
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s %s\00"
@.str.2 = [2 x i8] c"r\00"
define void @IncludeEXE(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [1024 x i8]
%6 = bitcast i8** %3 to i8*
%7 = bitcast i8** %4 to i8*
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%9 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%10 = add nsw i64 %9, 1
%11 = tail call i64 @malloc(i64 %10)
%12 = inttoptr i64 %11 to i8*
%13 = icmp eq i64 %11, 0
br i1 %13, label %85, label %14
14: ; preds = %2
%15 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%16 = add nsw i64 %15, 1
%17 = tail call i64 @malloc(i64 %16)
%18 = inttoptr i64 %17 to i8*
%19 = icmp eq i64 %17, 0
br i1 %19, label %20, label %22
20: ; preds = %14
%21 = tail call i32 @free(i8* %12)
br label %85
22: ; preds = %14
%23 = tail call i32 @GetProgArgv(i8* %0, i8* %12, i8* %18)
%24 = load i8, i8* %12
%25 = icmp eq i8 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %22
%27 = tail call i32 @free(i8* %12)
%28 = tail call i32 @free(i8* %18)
br label %85
29: ; preds = %22
%30 = call i32 @GetParsedBuf(i8* %12, i8** %3)
%31 = load i8, i8* %18
%32 = icmp eq i8 %31, 0
br i1 %32, label %46, label %33
33: ; preds = %29
%34 = call i32 @GetParsedBuf(i8* %18, i8** %4)
%35 = load i8*, i8** %3
%36 = call i64 @strlen(i8* dereferenceable(1) %35)
%37 = load i8*, i8** %4
%38 = call i64 @strlen(i8* dereferenceable(1) %37)
%39 = add i64 %36, 10
%40 = add i64 %39, %38
%41 = call i64 @malloc(i64 %40)
%42 = inttoptr i64 %41 to i8*
%43 = load i8*, i8** %3
%44 = load i8*, i8** %4
%45 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %42, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %43, i8* %44)
br label %54
46: ; preds = %29
%47 = load i8*, i8** %3
%48 = call i64 @strlen(i8* dereferenceable(1) %47)
%49 = add nsw i64 %48, 10
%50 = call i64 @malloc(i64 %49)
%51 = inttoptr i64 %50 to i8*
%52 = load i8*, i8** %3
%53 = call i8* @strcpy(i8* dereferenceable(1) %51, i8* dereferenceable(1) %52)
br label %54
54: ; preds = %46, %33
%55 = phi i8* [ %42, %33 ], [ %51, %46 ]
%56 = call i32* @popen(i8* %55, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%57 = icmp eq i32* %56, null
br i1 %57, label %73, label %58
58: ; preds = %54
%59 = call i64 @fgets(i8* %8, i32 1023, i32* %56)
%60 = icmp eq i64 %59, 0
br i1 %60, label %71, label %61
61: ; preds = %58
%62 = icmp eq i32* %1, null
br label %63
63: ; preds = %61, %68
br i1 %62, label %66, label %64
64: ; preds = %63
%65 = call i32 @fputs(i8* %8, i32* %1)
br label %68
66: ; preds = %63
%67 = call i32 @puts(i8* %8)
br label %68
68: ; preds = %66, %64
%69 = call i64 @fgets(i8* %8, i32 1023, i32* %56)
%70 = icmp eq i64 %69, 0
br i1 %70, label %71, label %63
71: ; preds = %68, %58
%72 = call i32 @pclose(i32* %56)
br label %73
73: ; preds = %71, %54
%74 = load i8*, i8** %3
%75 = call i32 @free(i8* %74)
%76 = load i8, i8* %18
%77 = icmp eq i8 %76, 0
br i1 %77, label %81, label %78
78: ; preds = %73
%79 = load i8*, i8** %4
%80 = call i32 @free(i8* %79)
br label %81
81: ; preds = %78, %73
%82 = call i32 @free(i8* %55)
%83 = call i32 @free(i8* %12)
%84 = call i32 @free(i8* %18)
br label %85
85: ; preds = %2, %81, %26, %20
ret void
}