#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 EXIT_SUCCESS;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ stderr;
int test_get_colocated_path(char *);
int test_run_cmd();
int test_run_cmd_get_output();
int test_run_cmd_give_input(char *, char *);
int test_shell_escape();
int main(int argc __attribute__((unused)), char **argv) {
  do {
    int __my_ret__ = test_run_cmd();
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 162, "test_run_cmd()");
      return __my_ret__;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = test_run_cmd_get_output();
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 163,
              "test_run_cmd_get_output()");
      return __my_ret__;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = test_get_colocated_path(argv[0]);
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 164,
              "test_get_colocated_path(argv[0])");
      return __my_ret__;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = test_run_cmd_give_input(argv[0], "abc");
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 165,
              "test_run_cmd_give_input(argv[0], \"abc\")");
      return __my_ret__;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = test_run_cmd_give_input(argv[0], "");
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 166,
              "test_run_cmd_give_input(argv[0], \"\")");
      return __my_ret__;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = test_run_cmd_give_input(argv[0], "foobarbaz");
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 167,
              "test_run_cmd_give_input(argv[0], \"foobarbaz\")");
      return __my_ret__;
    }
  } while (0);
  ;
  do {
    int __my_ret__ = test_shell_escape();
    if (__my_ret__) {
      fprintf(stderr, "failed on line %d: %s\n", 168, "test_shell_escape()");
      return __my_ret__;
    }
  } while (0);
  ;
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <test_run_cmd@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11b6 <main+0x56>
mov    0x2e4f(%rip),%rax
mov    (%rax),%edi
lea    0xe66(%rip),%rsi
mov    $0xa2,%edx
lea    0xe71(%rip),%rcx
call   1080 <fprintf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    13ac <main+0x24c>
jmp    11bb <main+0x5b>
jmp    11c0 <main+0x60>
mov    $0x0,%al
call   1050 <test_run_cmd_get_output@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     1200 <main+0xa0>
mov    0x2e05(%rip),%rax
mov    (%rax),%edi
lea    0xe1c(%rip),%rsi
mov    $0xa3,%edx
lea    0xe36(%rip),%rcx
call   1080 <fprintf@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    13ac <main+0x24c>
jmp    1205 <main+0xa5>
jmp    120a <main+0xaa>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <test_get_colocated_path@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     124f <main+0xef>
mov    0x2db6(%rip),%rax
mov    (%rax),%edi
lea    0xdcd(%rip),%rsi
mov    $0xa4,%edx
lea    0xe01(%rip),%rcx
call   1080 <fprintf@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    13ac <main+0x24c>
jmp    1254 <main+0xf4>
jmp    1259 <main+0xf9>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xdfa(%rip),%rsi
call   1060 <test_run_cmd_give_input@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     12a5 <main+0x145>
mov    0x2d60(%rip),%rax
mov    (%rax),%edi
lea    0xd77(%rip),%rsi
mov    $0xa5,%edx
lea    0xdd0(%rip),%rcx
call   1080 <fprintf@plt>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    13ac <main+0x24c>
jmp    12aa <main+0x14a>
jmp    12af <main+0x14f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xd59(%rip),%rsi
call   1060 <test_run_cmd_give_input@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     12fb <main+0x19b>
mov    0x2d0a(%rip),%rax
mov    (%rax),%edi
lea    0xd21(%rip),%rsi
mov    $0xa6,%edx
lea    0xda2(%rip),%rcx
call   1080 <fprintf@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    13ac <main+0x24c>
jmp    1300 <main+0x1a0>
jmp    1305 <main+0x1a5>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xd9f(%rip),%rsi
call   1060 <test_run_cmd_give_input@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
je     1351 <main+0x1f1>
mov    0x2cb4(%rip),%rax
mov    (%rax),%edi
lea    0xccb(%rip),%rsi
mov    $0xa7,%edx
lea    0xd7b(%rip),%rcx
call   1080 <fprintf@plt>
mov    -0x28(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    13ac <main+0x24c>
jmp    1356 <main+0x1f6>
jmp    135b <main+0x1fb>
mov    $0x0,%al
call   1070 <test_shell_escape@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
je     139b <main+0x23b>
mov    0x2c6a(%rip),%rax
mov    (%rax),%edi
lea    0xc81(%rip),%rsi
mov    $0xa8,%edx
lea    0xd5f(%rip),%rcx
call   1080 <fprintf@plt>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    13ac <main+0x24c>
jmp    13a0 <main+0x240>
mov    0x2c31(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
xor    %eax,%eax
call   1040 <test_run_cmd@plt>
test   %eax,%eax
je     119a <main+0x3a>
mov    %eax,%ebx
mov    0x2e65(%rip),%rax
mov    (%rax),%edi
lea    0xe7c(%rip),%rsi
lea    0xe8c(%rip),%rcx
mov    $0xa2,%edx
call   1080 <fprintf@plt>
jmp    12e7 <main+0x187>
xor    %eax,%eax
call   1050 <test_run_cmd_get_output@plt>
test   %eax,%eax
je     11cd <main+0x6d>
mov    %eax,%ebx
mov    0x2e32(%rip),%rax
mov    (%rax),%edi
lea    0xe49(%rip),%rsi
lea    0xe68(%rip),%rcx
mov    $0xa3,%edx
call   1080 <fprintf@plt>
jmp    12e7 <main+0x187>
mov    (%r14),%rdi
call   1030 <test_get_colocated_path@plt>
test   %eax,%eax
je     1201 <main+0xa1>
mov    %eax,%ebx
mov    0x2dfe(%rip),%rax
mov    (%rax),%edi
lea    0xe15(%rip),%rsi
lea    0xe4e(%rip),%rcx
mov    $0xa4,%edx
call   1080 <fprintf@plt>
jmp    12e7 <main+0x187>
mov    (%r14),%rdi
lea    0xe56(%rip),%rsi
call   1060 <test_run_cmd_give_input@plt>
test   %eax,%eax
je     123c <main+0xdc>
mov    %eax,%ebx
mov    0x2dc3(%rip),%rax
mov    (%rax),%edi
lea    0xdda(%rip),%rsi
lea    0xe38(%rip),%rcx
mov    $0xa5,%edx
call   1080 <fprintf@plt>
jmp    12e7 <main+0x187>
mov    (%r14),%rdi
lea    0xdd0(%rip),%rsi
call   1060 <test_run_cmd_give_input@plt>
test   %eax,%eax
je     1274 <main+0x114>
mov    %eax,%ebx
mov    0x2d88(%rip),%rax
mov    (%rax),%edi
lea    0xd9f(%rip),%rsi
lea    0xe25(%rip),%rcx
mov    $0xa6,%edx
call   1080 <fprintf@plt>
jmp    12e7 <main+0x187>
mov    (%r14),%rdi
lea    0xe34(%rip),%rsi
call   1060 <test_run_cmd_give_input@plt>
test   %eax,%eax
je     12ac <main+0x14c>
mov    %eax,%ebx
mov    0x2d50(%rip),%rax
mov    (%rax),%edi
lea    0xd67(%rip),%rsi
lea    0xe1c(%rip),%rcx
mov    $0xa7,%edx
call   1080 <fprintf@plt>
jmp    12e7 <main+0x187>
xor    %eax,%eax
call   1070 <test_shell_escape@plt>
mov    %eax,%ebx
test   %eax,%eax
je     12da <main+0x17a>
mov    0x2d20(%rip),%rax
mov    (%rax),%edi
lea    0xd37(%rip),%rsi
lea    0xe1a(%rip),%rcx
mov    $0xa8,%edx
call   1080 <fprintf@plt>
test   %ebx,%ebx
jne    12e7 <main+0x187>
mov    0x2cf3(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [23 x i8] c"failed on line %d: %s\0A\00"
@.str.1 = [15 x i8] c"test_run_cmd()\00"
@.str.2 = [26 x i8] c"test_run_cmd_get_output()\00"
@.str.3 = [33 x i8] c"test_get_colocated_path(argv[0])\00"
@.str.4 = [4 x i8] c"abc\00"
@.str.5 = [40 x i8] c"test_run_cmd_give_input(argv[0], \22abc\22)\00"
@.str.6 = [1 x i8] zeroinitializer
@.str.7 = [37 x i8] c"test_run_cmd_give_input(argv[0], \22\22)\00"
@.str.8 = [10 x i8] c"foobarbaz\00"
@.str.9 = [46 x i8] c"test_run_cmd_give_input(argv[0], \22foobarbaz\22)\00"
@.str.10 = [20 x i8] c"test_shell_escape()\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %13
13: ; preds = %2
%14 = call i32 (...) @test_run_cmd()
store i32 %14, i32* %6
%15 = load i32, i32* %6
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %13
%18 = load i32, i32* @stderr
%19 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 162, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%20 = load i32, i32* %6
store i32 %20, i32* %3
br label %96
21: ; preds = %13
br label %22
22: ; preds = %21
br label %23
23: ; preds = %22
%24 = call i32 (...) @test_run_cmd_get_output()
store i32 %24, i32* %7
%25 = load i32, i32* %7
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %31
27: ; preds = %23
%28 = load i32, i32* @stderr
%29 = call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 163, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%30 = load i32, i32* %7
store i32 %30, i32* %3
br label %96
31: ; preds = %23
br label %32
32: ; preds = %31
br label %33
33: ; preds = %32
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 0
%36 = load i8*, i8** %35
%37 = call i32 @test_get_colocated_path(i8* %36)
store i32 %37, i32* %8
%38 = load i32, i32* %8
%39 = icmp ne i32 %38, 0
br i1 %39, label %40, label %44
40: ; preds = %33
%41 = load i32, i32* @stderr
%42 = call i32 @fprintf(i32 %41, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 164, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
%43 = load i32, i32* %8
store i32 %43, i32* %3
br label %96
44: ; preds = %33
br label %45
45: ; preds = %44
br label %46
46: ; preds = %45
%47 = load i8**, i8*** %5
%48 = getelementptr inbounds i8*, i8** %47, i64 0
%49 = load i8*, i8** %48
%50 = call i32 @test_run_cmd_give_input(i8* %49, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
store i32 %50, i32* %9
%51 = load i32, i32* %9
%52 = icmp ne i32 %51, 0
br i1 %52, label %53, label %57
53: ; preds = %46
%54 = load i32, i32* @stderr
%55 = call i32 @fprintf(i32 %54, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 165, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0))
%56 = load i32, i32* %9
store i32 %56, i32* %3
br label %96
57: ; preds = %46
br label %58
58: ; preds = %57
br label %59
59: ; preds = %58
%60 = load i8**, i8*** %5
%61 = getelementptr inbounds i8*, i8** %60, i64 0
%62 = load i8*, i8** %61
%63 = call i32 @test_run_cmd_give_input(i8* %62, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0))
store i32 %63, i32* %10
%64 = load i32, i32* %10
%65 = icmp ne i32 %64, 0
br i1 %65, label %66, label %70
66: ; preds = %59
%67 = load i32, i32* @stderr
%68 = call i32 @fprintf(i32 %67, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 166, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0))
%69 = load i32, i32* %10
store i32 %69, i32* %3
br label %96
70: ; preds = %59
br label %71
71: ; preds = %70
br label %72
72: ; preds = %71
%73 = load i8**, i8*** %5
%74 = getelementptr inbounds i8*, i8** %73, i64 0
%75 = load i8*, i8** %74
%76 = call i32 @test_run_cmd_give_input(i8* %75, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
store i32 %76, i32* %11
%77 = load i32, i32* %11
%78 = icmp ne i32 %77, 0
br i1 %78, label %79, label %83
79: ; preds = %72
%80 = load i32, i32* @stderr
%81 = call i32 @fprintf(i32 %80, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 167, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.9, i64 0, i64 0))
%82 = load i32, i32* %11
store i32 %82, i32* %3
br label %96
83: ; preds = %72
br label %84
84: ; preds = %83
br label %85
85: ; preds = %84
%86 = call i32 (...) @test_shell_escape()
store i32 %86, i32* %12
%87 = load i32, i32* %12
%88 = icmp ne i32 %87, 0
br i1 %88, label %89, label %93
89: ; preds = %85
%90 = load i32, i32* @stderr
%91 = call i32 @fprintf(i32 %90, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 168, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0))
%92 = load i32, i32* %12
store i32 %92, i32* %3
br label %96
93: ; preds = %85
br label %94
94: ; preds = %93
%95 = load i32, i32* @EXIT_SUCCESS
store i32 %95, i32* %3
br label %96
96: ; preds = %94, %89, %79, %66, %53, %40, %27, %17
%97 = load i32, i32* %3
ret i32 %97
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [23 x i8] c"failed on line %d: %s\0A\00"
@.str.1 = [15 x i8] c"test_run_cmd()\00"
@.str.2 = [26 x i8] c"test_run_cmd_get_output()\00"
@.str.3 = [33 x i8] c"test_get_colocated_path(argv[0])\00"
@.str.4 = [4 x i8] c"abc\00"
@.str.5 = [40 x i8] c"test_run_cmd_give_input(argv[0], \22abc\22)\00"
@.str.6 = [1 x i8] zeroinitializer
@.str.7 = [37 x i8] c"test_run_cmd_give_input(argv[0], \22\22)\00"
@.str.8 = [10 x i8] c"foobarbaz\00"
@.str.9 = [46 x i8] c"test_run_cmd_give_input(argv[0], \22foobarbaz\22)\00"
@.str.10 = [20 x i8] c"test_shell_escape()\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 (...) @test_run_cmd()
%4 = icmp eq i32 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 162, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
br label %51
8: ; preds = %2
%9 = tail call i32 (...) @test_run_cmd_get_output()
%10 = icmp eq i32 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %8
%12 = load i32, i32* @stderr
%13 = tail call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 163, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %51
14: ; preds = %8
%15 = load i8*, i8** %1
%16 = tail call i32 @test_get_colocated_path(i8* %15)
%17 = icmp eq i32 %16, 0
br i1 %17, label %21, label %18
18: ; preds = %14
%19 = load i32, i32* @stderr
%20 = tail call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 164, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
br label %51
21: ; preds = %14
%22 = load i8*, i8** %1
%23 = tail call i32 @test_run_cmd_give_input(i8* %22, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%24 = icmp eq i32 %23, 0
br i1 %24, label %28, label %25
25: ; preds = %21
%26 = load i32, i32* @stderr
%27 = tail call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 165, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0))
br label %51
28: ; preds = %21
%29 = load i8*, i8** %1
%30 = tail call i32 @test_run_cmd_give_input(i8* %29, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0))
%31 = icmp eq i32 %30, 0
br i1 %31, label %35, label %32
32: ; preds = %28
%33 = load i32, i32* @stderr
%34 = tail call i32 @fprintf(i32 %33, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 166, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.7, i64 0, i64 0))
br label %51
35: ; preds = %28
%36 = load i8*, i8** %1
%37 = tail call i32 @test_run_cmd_give_input(i8* %36, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
%38 = icmp eq i32 %37, 0
br i1 %38, label %42, label %39
39: ; preds = %35
%40 = load i32, i32* @stderr
%41 = tail call i32 @fprintf(i32 %40, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 167, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.9, i64 0, i64 0))
br label %51
42: ; preds = %35
%43 = tail call i32 (...) @test_shell_escape()
%44 = icmp eq i32 %43, 0
br i1 %44, label %48, label %45
45: ; preds = %42
%46 = load i32, i32* @stderr
%47 = tail call i32 @fprintf(i32 %46, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 168, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0))
br label %48
48: ; preds = %42, %45
%49 = load i32, i32* @EXIT_SUCCESS
%50 = select i1 %44, i32 %49, i32 %43
br label %51
51: ; preds = %39, %32, %25, %18, %11, %5, %48
%52 = phi i32 [ %3, %5 ], [ %9, %11 ], [ %16, %18 ], [ %23, %25 ], [ %30, %32 ], [ %37, %39 ], [ %50, %48 ]
ret i32 %52
}