#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 pid_t;

/* Variables and functions */
int /*<<< orphan*/ close(int);
int dup2(int, int);
int /*<<< orphan*/ error(char *);
int execle(char *, char *, char *, char *, char *, int /*<<< orphan*/ *,
           char **);
scalar_t__ fgets(char *, int, int /*<<< orphan*/);
int fork();
int /*<<< orphan*/ open_url(char *);
int pipe(int *);
int /*<<< orphan*/ stdin;
int main(int argc, char *argv[]) {
  char *phrase = argv[1];
  char *vars[] = {
      "RSS_FEED=http://feeds.feedburner.com/planetarduino?format=xml", NULL};
  int fd[2];
  if (pipe(fd) == -1)
    error("Can't create the pipe");
  pid_t pid = fork();
  if (pid == -1)
    error("Can't fork process");
  if (!pid) {
    close(fd[0]);
    if (dup2(fd[1], 1) == -1)
      error("Can't redirect Standard Output");
    if (execle("/usr/bin/python", "/usr/bin/python", "./rssgossip.py", "-u",
               phrase, NULL, vars) == -1)
      error("Can't run script");
  }
  close(fd[1]);
  if (dup2(fd[0], 0) == -1)
    error("Can't redirect Standard Input");
  char line[255];
  while (fgets(line, 255, stdin)) {
    if (line[0] == '\t')
      open_url(line + 1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x150,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    0x2c54(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2c51(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    -0x38(%rbp),%rdi
call   1050 <pipe@plt>
cmp    $0xffffffff,%eax
jne    11d9 <main+0x59>
lea    0xe6a(%rip),%rdi
call   1070 <error@plt>
mov    $0x0,%al
call   10a0 <fork@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0xffffffff,-0x3c(%rbp)
jne    11f9 <main+0x79>
lea    0xe60(%rip),%rdi
call   1070 <error@plt>
cmpl   $0x0,-0x3c(%rbp)
jne    1275 <main+0xf5>
mov    -0x38(%rbp),%edi
call   1040 <close@plt>
mov    -0x34(%rbp),%edi
mov    $0x1,%esi
call   1030 <dup2@plt>
cmp    $0xffffffff,%eax
jne    122d <main+0xad>
lea    0xe3f(%rip),%rdi
call   1070 <error@plt>
mov    -0x18(%rbp),%r8
lea    -0x30(%rbp),%rax
lea    0xe4a(%rip),%rsi
lea    0xe53(%rip),%rdx
lea    0xe5b(%rip),%rcx
xor    %edi,%edi
mov    %edi,%r9d
mov    %rsi,%rdi
mov    %rax,(%rsp)
call   1090 <execle@plt>
cmp    $0xffffffff,%eax
jne    1270 <main+0xf0>
lea    0xe3d(%rip),%rdi
call   1070 <error@plt>
jmp    1275 <main+0xf5>
mov    -0x34(%rbp),%edi
call   1040 <close@plt>
mov    -0x38(%rbp),%edi
xor    %esi,%esi
call   1030 <dup2@plt>
cmp    $0xffffffff,%eax
jne    129c <main+0x11c>
lea    0xe22(%rip),%rdi
call   1070 <error@plt>
jmp    12a1 <main+0x121>
lea    -0x140(%rbp),%rdi
mov    0x2d31(%rip),%rax
mov    (%rax),%edx
mov    $0xff,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
je     12ea <main+0x16a>
movsbl -0x140(%rbp),%eax
cmp    $0x9,%eax
jne    12e5 <main+0x165>
lea    -0x140(%rbp),%rdi
add    $0x1,%rdi
call   1080 <open_url@plt>
jmp    12a1 <main+0x121>
xor    %eax,%eax
add    $0x150,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x120,%rsp
mov    0x8(%rsi),%rbx
movaps 0x2c69(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0x8(%rsp),%rdi
call   1050 <pipe@plt>
cmp    $0xffffffff,%eax
jne    11b7 <main+0x37>
lea    0xe8c(%rip),%rdi
call   1070 <error@plt>
xor    %eax,%eax
call   10a0 <fork@plt>
cmp    $0xffffffff,%eax
je     1229 <main+0xa9>
test   %eax,%eax
jne    1235 <main+0xb5>
mov    0x8(%rsp),%edi
call   1040 <close@plt>
mov    0xc(%rsp),%edi
mov    $0x1,%esi
call   1030 <dup2@plt>
cmp    $0xffffffff,%eax
jne    11ef <main+0x6f>
lea    0xe7d(%rip),%rdi
call   1070 <error@plt>
lea    0x10(%rsp),%rax
mov    %rax,(%rsp)
lea    0xe87(%rip),%rdi
lea    0xe90(%rip),%rdx
lea    0xe98(%rip),%rcx
mov    %rdi,%rsi
mov    %rbx,%r8
xor    %r9d,%r9d
call   1090 <execle@plt>
cmp    $0xffffffff,%eax
jne    1235 <main+0xb5>
lea    0xe81(%rip),%rdi
jmp    1230 <main+0xb0>
lea    0xe24(%rip),%rdi
call   1070 <error@plt>
mov    0xc(%rsp),%edi
call   1040 <close@plt>
mov    0x8(%rsp),%edi
xor    %esi,%esi
call   1030 <dup2@plt>
cmp    $0xffffffff,%eax
jne    125a <main+0xda>
lea    0xe64(%rip),%rdi
call   1070 <error@plt>
mov    0x2d7f(%rip),%r15
mov    (%r15),%edx
lea    0x20(%rsp),%rdi
mov    $0xff,%esi
call   1060 <fgets@plt>
test   %rax,%rax
je     12b6 <main+0x136>
lea    0x21(%rsp),%r14
lea    0x20(%rsp),%rbx
jmp    12a5 <main+0x125>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%r15),%edx
mov    %rbx,%rdi
mov    $0xff,%esi
call   1060 <fgets@plt>
test   %rax,%rax
je     12b6 <main+0x136>
cmpb   $0x9,0x20(%rsp)
jne    1290 <main+0x110>
mov    %r14,%rdi
call   1080 <open_url@plt>
jmp    1290 <main+0x110>
xor    %eax,%eax
add    $0x120,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [62 x i8] c"RSS_FEED=http://feeds.feedburner.com/planetarduino?format=xml\00"
@__const.main.vars = [2 x i8*] [i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i32 0, i32 0), i8* null]
@.str.1 = [22 x i8] c"Can't create the pipe\00"
@.str.2 = [19 x i8] c"Can't fork process\00"
@.str.3 = [31 x i8] c"Can't redirect Standard Output\00"
@.str.4 = [16 x i8] c"/usr/bin/python\00"
@.str.5 = [15 x i8] c"./rssgossip.py\00"
@.str.6 = [3 x i8] c"-u\00"
@.str.7 = [17 x i8] c"Can't run script\00"
@.str.8 = [30 x i8] c"Can't redirect Standard Input\00"
@stdin = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca [2 x i8*]
%8 = alloca [2 x i32]
%9 = alloca i32
%10 = alloca [255 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
store i8* %13, i8** %6
%14 = bitcast [2 x i8*]* %7 to i8*
%15 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%16 = call i32 @pipe(i32* %15)
%17 = icmp eq i32 %16, -1
br i1 %17, label %18, label %20
18: ; preds = %2
%19 = call i32 @error(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
br label %20
20: ; preds = %18, %2
%21 = call i32 (...) @fork()
store i32 %21, i32* %9
%22 = load i32, i32* %9
%23 = icmp eq i32 %22, -1
br i1 %23, label %24, label %26
24: ; preds = %20
%25 = call i32 @error(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
br label %26
26: ; preds = %24, %20
%27 = load i32, i32* %9
%28 = icmp ne i32 %27, 0
br i1 %28, label %47, label %29
29: ; preds = %26
%30 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%31 = load i32, i32* %30
%32 = call i32 @close(i32 %31)
%33 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 1
%34 = load i32, i32* %33
%35 = call i32 @dup2(i32 %34, i32 1)
%36 = icmp eq i32 %35, -1
br i1 %36, label %37, label %39
37: ; preds = %29
%38 = call i32 @error(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
br label %39
39: ; preds = %37, %29
%40 = load i8*, i8** %6
%41 = getelementptr inbounds [2 x i8*], [2 x i8*]* %7, i64 0, i64 0
%42 = call i32 @execle(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %40, i32* null, i8** %41)
%43 = icmp eq i32 %42, -1
br i1 %43, label %44, label %46
44: ; preds = %39
%45 = call i32 @error(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0))
br label %46
46: ; preds = %44, %39
br label %47
47: ; preds = %46, %26
%48 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 1
%49 = load i32, i32* %48
%50 = call i32 @close(i32 %49)
%51 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%52 = load i32, i32* %51
%53 = call i32 @dup2(i32 %52, i32 0)
%54 = icmp eq i32 %53, -1
br i1 %54, label %55, label %57
55: ; preds = %47
%56 = call i32 @error(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0))
br label %57
57: ; preds = %55, %47
br label %58
58: ; preds = %72, %57
%59 = getelementptr inbounds [255 x i8], [255 x i8]* %10, i64 0, i64 0
%60 = load i32, i32* @stdin
%61 = call i64 @fgets(i8* %59, i32 255, i32 %60)
%62 = icmp ne i64 %61, 0
br i1 %62, label %63, label %73
63: ; preds = %58
%64 = getelementptr inbounds [255 x i8], [255 x i8]* %10, i64 0, i64 0
%65 = load i8, i8* %64
%66 = sext i8 %65 to i32
%67 = icmp eq i32 %66, 9
br i1 %67, label %68, label %72
68: ; preds = %63
%69 = getelementptr inbounds [255 x i8], [255 x i8]* %10, i64 0, i64 0
%70 = getelementptr inbounds i8, i8* %69, i64 1
%71 = call i32 @open_url(i8* %70)
br label %72
72: ; preds = %68, %63
br label %58
73: ; preds = %58
ret i32 0
}

LLVM IR (-O2):
@.str = [62 x i8] c"RSS_FEED=http://feeds.feedburner.com/planetarduino?format=xml\00"
@__const.main.vars = [2 x i8*] [i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i32 0, i32 0), i8* null]
@.str.1 = [22 x i8] c"Can't create the pipe\00"
@.str.2 = [19 x i8] c"Can't fork process\00"
@.str.3 = [31 x i8] c"Can't redirect Standard Output\00"
@.str.4 = [16 x i8] c"/usr/bin/python\00"
@.str.5 = [15 x i8] c"./rssgossip.py\00"
@.str.6 = [3 x i8] c"-u\00"
@.str.7 = [17 x i8] c"Can't run script\00"
@.str.8 = [30 x i8] c"Can't redirect Standard Input\00"
@stdin = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [2 x i8*]
%4 = alloca [2 x i32]
%5 = alloca [255 x i8]
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = bitcast [2 x i8*]* %3 to i8*
%9 = bitcast [2 x i32]* %4 to i8*
%10 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
%11 = call i32 @pipe(i32* %10)
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = call i32 @error(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
br label %15
15: ; preds = %13, %2
%16 = call i32 (...) @fork()
switch i32 %16, label %33 [
i32 -1, label %30
i32 0, label %17
]
17: ; preds = %15
%18 = load i32, i32* %10
%19 = call i32 @close(i32 %18)
%20 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
%21 = load i32, i32* %20
%22 = call i32 @dup2(i32 %21, i32 1)
%23 = icmp eq i32 %22, -1
br i1 %23, label %24, label %26
24: ; preds = %17
%25 = call i32 @error(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
br label %26
26: ; preds = %24, %17
%27 = getelementptr inbounds [2 x i8*], [2 x i8*]* %3, i64 0, i64 0
%28 = call i32 @execle(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %7, i32* null, i8** %27)
%29 = icmp eq i32 %28, -1
br i1 %29, label %30, label %33
30: ; preds = %26, %15
%31 = phi i8* [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), %15 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), %26 ]
%32 = call i32 @error(i8* %31)
br label %33
33: ; preds = %30, %15, %26
%34 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
%35 = load i32, i32* %34
%36 = call i32 @close(i32 %35)
%37 = load i32, i32* %10
%38 = call i32 @dup2(i32 %37, i32 0)
%39 = icmp eq i32 %38, -1
br i1 %39, label %40, label %42
40: ; preds = %33
%41 = call i32 @error(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0))
br label %42
42: ; preds = %40, %33
%43 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
%44 = load i32, i32* @stdin
%45 = call i64 @fgets(i8* %43, i32 255, i32 %44)
%46 = icmp eq i64 %45, 0
br i1 %46, label %58, label %47
47: ; preds = %42
%48 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 1
br label %49
49: ; preds = %47, %54
%50 = load i8, i8* %43
%51 = icmp eq i8 %50, 9
br i1 %51, label %52, label %54
52: ; preds = %49
%53 = call i32 @open_url(i8* %48)
br label %54
54: ; preds = %52, %49
%55 = load i32, i32* @stdin
%56 = call i64 @fgets(i8* %43, i32 255, i32 %55)
%57 = icmp eq i64 %56, 0
br i1 %57, label %58, label %49
58: ; preds = %54, %42
ret i32 0
}