#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*/ errno;
int execle(char *, char *, char *, char *, int /*<<< orphan*/ *, char **);
int fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  char *feeds[] = {"http://rss.cnn.com/rss/edition.rss",
                   "http://www.rollingstone.com/news.rss",
                   "http://feeds.eonline.com/eonline/topstories"};
  int times = 3;
  char *phrase = argv[1];
  int i;
  for (i = 0; i < times; i++) {
    char var[255];
    sprintf(var, "RSS_FEED=%s", feeds[i]);
    char *vars[] = {var, NULL};
    pid_t pid = fork();
    if (pid == -1) {
      fprintf(stderr, "Can't fork process: %s\n", strerror(errno));
      return 1;
    }
    if (!pid) {
      if (execle("/usr/bin/python", "/usr/bin/python", "./rssgossip.py", phrase,
                 NULL, vars) == -1) {
        fprintf(stderr, "Can't run script: %s\n", strerror(errno));
        return 1;
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x170,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2c80(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2c7d(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0x2c7a(%rip),%rax
mov    %rax,-0x20(%rbp)
movl   $0x3,-0x34(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    12cf <main+0x17f>
lea    -0x150(%rbp),%rdi
movslq -0x44(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rdx
lea    0xead(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x150(%rbp),%rax
mov    %rax,-0x160(%rbp)
movq   $0x0,-0x158(%rbp)
mov    $0x0,%al
call   1070 <fork@plt>
mov    %eax,-0x164(%rbp)
cmpl   $0xffffffff,-0x164(%rbp)
jne    123d <main+0xed>
mov    0x2dd2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x168(%rbp)
mov    0x2dbb(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
mov    -0x168(%rbp),%edi
mov    %rax,%rdx
lea    0xe54(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12d6 <main+0x186>
cmpl   $0x0,-0x164(%rbp)
jne    12bc <main+0x16c>
mov    -0x40(%rbp),%rcx
lea    -0x160(%rbp),%r9
lea    0xe3c(%rip),%rsi
lea    0xe45(%rip),%rdx
xor    %eax,%eax
mov    %eax,%r8d
mov    %rsi,%rdi
call   1050 <execle@plt>
cmp    $0xffffffff,%eax
jne    12b7 <main+0x167>
mov    0x2d58(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x16c(%rbp)
mov    0x2d41(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
mov    -0x16c(%rbp),%edi
mov    %rax,%rdx
lea    0xe11(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12d6 <main+0x186>
jmp    12bc <main+0x16c>
jmp    12c1 <main+0x171>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11a4 <main+0x54>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x170,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x110,%rsp
mov    0x8(%rsi),%r14
lea    0xf0d(%rip),%rsi
lea    0xe92(%rip),%rdx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    %rbx,(%rsp)
movq   $0x0,0x8(%rsp)
xor    %eax,%eax
call   1070 <fork@plt>
lea    0xeea(%rip),%r15
cmp    $0xffffffff,%eax
je     1288 <main+0x138>
test   %eax,%eax
jne    11cb <main+0x7b>
lea    0xeee(%rip),%rdi
lea    0xef7(%rip),%rdx
mov    %rsp,%r9
mov    %rdi,%rsi
mov    %r14,%rcx
xor    %r8d,%r8d
call   1050 <execle@plt>
cmp    $0xffffffff,%eax
je     1281 <main+0x131>
lea    0xea2(%rip),%rsi
lea    0xe4a(%rip),%rdx
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    %rbx,(%rsp)
movq   $0x0,0x8(%rsp)
xor    %eax,%eax
call   1070 <fork@plt>
cmp    $0xffffffff,%eax
je     1288 <main+0x138>
test   %eax,%eax
jne    1226 <main+0xd6>
lea    0xe8f(%rip),%rdi
lea    0xe98(%rip),%rdx
mov    %rsp,%r9
mov    %rdi,%rsi
mov    %r14,%rcx
xor    %r8d,%r8d
call   1050 <execle@plt>
cmp    $0xffffffff,%eax
je     1281 <main+0x131>
lea    0xe47(%rip),%rsi
lea    0xe14(%rip),%rdx
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    %rbx,(%rsp)
movq   $0x0,0x8(%rsp)
xor    %eax,%eax
call   1070 <fork@plt>
cmp    $0xffffffff,%eax
je     1288 <main+0x138>
test   %eax,%eax
jne    127d <main+0x12d>
lea    0xe38(%rip),%rdi
lea    0xe41(%rip),%rdx
mov    %rsp,%r9
mov    %rdi,%rsi
mov    %r14,%rcx
xor    %r8d,%r8d
call   1050 <execle@plt>
cmp    $0xffffffff,%eax
je     1281 <main+0x131>
xor    %eax,%eax
jmp    12b1 <main+0x161>
lea    0xe2f(%rip),%r15
mov    0x2d51(%rip),%rax
mov    (%rax),%ebx
mov    0x2d40(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
mov    %ebx,%edi
mov    %r15,%rsi
mov    %rax,%rdx
call   1030 <fprintf@plt>
mov    $0x1,%eax
add    $0x110,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [35 x i8] c"http://rss.cnn.com/rss/edition.rss\00"
@.str.1 = [37 x i8] c"http://www.rollingstone.com/news.rss\00"
@.str.2 = [44 x i8] c"http://feeds.eonline.com/eonline/topstories\00"
@__const.main.feeds = [3 x i8*] [i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i32 0, i32 0)]
@.str.3 = [12 x i8] c"RSS_FEED=%s\00"
@stderr = global i32 0
@.str.4 = [24 x i8] c"Can't fork process: %s\0A\00"
@errno = global i32 0
@.str.5 = [16 x i8] c"/usr/bin/python\00"
@.str.6 = [15 x i8] c"./rssgossip.py\00"
@.str.7 = [22 x i8] c"Can't run script: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [3 x i8*]
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca [255 x i8]
%11 = alloca [2 x i8*]
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = bitcast [3 x i8*]* %6 to i8*
store i32 3, i32* %7
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
store i8* %16, i8** %8
store i32 0, i32* %9
br label %17
17: ; preds = %54, %2
%18 = load i32, i32* %9
%19 = load i32, i32* %7
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %57
21: ; preds = %17
%22 = getelementptr inbounds [255 x i8], [255 x i8]* %10, i64 0, i64 0
%23 = load i32, i32* %9
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [3 x i8*], [3 x i8*]* %6, i64 0, i64 %24
%26 = load i8*, i8** %25
%27 = call i32 @sprintf(i8* %22, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* %26)
%28 = getelementptr inbounds [2 x i8*], [2 x i8*]* %11, i64 0, i64 0
%29 = getelementptr inbounds [255 x i8], [255 x i8]* %10, i64 0, i64 0
store i8* %29, i8** %28
%30 = getelementptr inbounds i8*, i8** %28, i64 1
store i8* null, i8** %30
%31 = call i32 (...) @fork()
store i32 %31, i32* %12
%32 = load i32, i32* %12
%33 = icmp eq i32 %32, -1
br i1 %33, label %34, label %39
34: ; preds = %21
%35 = load i32, i32* @stderr
%36 = load i32, i32* @errno
%37 = call i8* @strerror(i32 %36)
%38 = call i32 @fprintf(i32 %35, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i8* %37)
store i32 1, i32* %3
br label %58
39: ; preds = %21
%40 = load i32, i32* %12
%41 = icmp ne i32 %40, 0
br i1 %41, label %53, label %42
42: ; preds = %39
%43 = load i8*, i8** %8
%44 = getelementptr inbounds [2 x i8*], [2 x i8*]* %11, i64 0, i64 0
%45 = call i32 @execle(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i8* %43, i32* null, i8** %44)
%46 = icmp eq i32 %45, -1
br i1 %46, label %47, label %52
47: ; preds = %42
%48 = load i32, i32* @stderr
%49 = load i32, i32* @errno
%50 = call i8* @strerror(i32 %49)
%51 = call i32 @fprintf(i32 %48, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), i8* %50)
store i32 1, i32* %3
br label %58
52: ; preds = %42
br label %53
53: ; preds = %52, %39
br label %54
54: ; preds = %53
%55 = load i32, i32* %9
%56 = add nsw i32 %55, 1
store i32 %56, i32* %9
br label %17
57: ; preds = %17
store i32 0, i32* %3
br label %58
58: ; preds = %57, %47, %34
%59 = load i32, i32* %3
ret i32 %59
}

LLVM IR (-O2):
@.str = [35 x i8] c"http://rss.cnn.com/rss/edition.rss\00"
@.str.1 = [37 x i8] c"http://www.rollingstone.com/news.rss\00"
@.str.2 = [44 x i8] c"http://feeds.eonline.com/eonline/topstories\00"
@.str.3 = [12 x i8] c"RSS_FEED=%s\00"
@stderr = global i32 0
@.str.4 = [24 x i8] c"Can't fork process: %s\0A\00"
@errno = global i32 0
@.str.5 = [16 x i8] c"/usr/bin/python\00"
@.str.6 = [15 x i8] c"./rssgossip.py\00"
@.str.7 = [22 x i8] c"Can't run script: %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [255 x i8]
%4 = alloca [2 x i8*]
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%8 = bitcast [2 x i8*]* %4 to i8*
%9 = getelementptr inbounds [2 x i8*], [2 x i8*]* %4, i64 0, i64 0
%10 = getelementptr inbounds [2 x i8*], [2 x i8*]* %4, i64 0, i64 1
%11 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
store i8* %7, i8** %9
store i8* null, i8** %10
%12 = call i32 (...) @fork()
switch i32 %12, label %22 [
i32 -1, label %16
i32 0, label %13
]
13: ; preds = %2
%14 = call i32 @execle(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i8* %6, i32* null, i8** %9)
%15 = icmp eq i32 %14, -1
br i1 %15, label %16, label %22
16: ; preds = %13, %25, %31, %2, %22, %28
%17 = phi i8* [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), %28 ], [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), %22 ], [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), %2 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), %31 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), %25 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), %13 ]
%18 = load i32, i32* @stderr
%19 = load i32, i32* @errno
%20 = call i8* @strerror(i32 %19)
%21 = call i32 @fprintf(i32 %18, i8* %17, i8* %20)
br label %35
22: ; preds = %2, %13
%23 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
store i8* %7, i8** %9
store i8* null, i8** %10
%24 = call i32 (...) @fork()
switch i32 %24, label %28 [
i32 -1, label %16
i32 0, label %25
]
25: ; preds = %22
%26 = call i32 @execle(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i8* %6, i32* null, i8** %9)
%27 = icmp eq i32 %26, -1
br i1 %27, label %16, label %28
28: ; preds = %25, %22
%29 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0))
store i8* %7, i8** %9
store i8* null, i8** %10
%30 = call i32 (...) @fork()
switch i32 %30, label %34 [
i32 -1, label %16
i32 0, label %31
]
31: ; preds = %28
%32 = call i32 @execle(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i8* %6, i32* null, i8** %9)
%33 = icmp eq i32 %32, -1
br i1 %33, label %16, label %34
34: ; preds = %31, %28
br label %35
35: ; preds = %34, %16
%36 = phi i32 [ 1, %16 ], [ 0, %34 ]
ret i32 %36
}