#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 */
struct sigaction {
  int dummy;
};
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ O_RDWR;
int /*<<< orphan*/ exit(int);
scalar_t__ malloc(int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int read(int, char *, int);
int /*<<< orphan*/ sprintf(char *, char *, char *);
char *strcat(char *, char *);
int strncmp(char *, char *, int);
int /*<<< orphan*/ strncpy(char *, char *, int);
int /*<<< orphan*/ system(char *);
int main() {
  struct sigaction sig_handler;
  char buff[100];
  ssize_t bytes_written;
  int pipe_in, pipe_out;
  int layers;
  char *link = NULL;
  char get[4];
  pipe_in = open("/tmp/earth_in_pipe", O_RDWR);
  if (pipe_in < 0) {
    printf("Error openning ");
    puts("/tmp/earth_in_pipe");
    exit(1);
  }
  pipe_out = open("/tmp/earth_out_pipe", O_RDWR);
  if (pipe_out < 0) {
    printf("Error openning ");
    puts("/tmp/earth_out_pipe");
    exit(1);
  }
  while (42) {
    int bytes_read, layers;
    char *s_buff = NULL;
    bytes_read = read(pipe_out, buff, sizeof(char) * 99);
    s_buff = (char *)malloc(bytes_read * sizeof(char));
    link = (char *)malloc(bytes_read * sizeof(char));
    strncpy(s_buff, buff, bytes_read);
    printf("bytes read: %d\n", bytes_read);
    printf("Pipe out = %s\n", s_buff);
    int res = strncmp(s_buff, "get", 3);
    if (res == 0) {
      strncpy(link, &s_buff[4], bytes_read - 4);
      printf("site: %s\n", link);
      char *callpy = NULL;
      char *sentmsg = NULL;
      callpy = (char *)malloc((bytes_read + 20) * sizeof(char));
      sentmsg = (char *)malloc((bytes_read + 140) * sizeof(char));
      callpy[0] = '\0';
      callpy = strcat(callpy, "python crawler.py ");
      callpy = strcat(callpy, link);
      printf("%s\n", callpy);
      system(callpy);
      system("chmod +x sedScript.sh");
      system("sh sedScript.sh");
      system("tar -zcf site.tar.gz remotefile* basefile.html");
      system("/home/ainsoph/devel/SpaceApp/dtn-2.9.0/apps/dtncp/dtncp "
             "site.tar.gz dtn://spaceapps.dtn");
      sprintf(sentmsg,
              "/home/ainsoph/devel/SpaceApp/dtn-2.9.0/apps/dtnsend/dtnsend -s "
              "dtn://spaceapps.dtn/me -d dtn://spaceapps.dtn/mars -t m -p "
              "\"snt:%s\"",
              link);
      system(sentmsg);
      printf("%s done!\n", link);
    }
    res = strncmp(s_buff, "snt", 3);
    if (res == 0) {
      char *cmd, *cmd1;
      strncpy(link, &s_buff[4], bytes_read - 4);
      printf("siteSNT: %s\n", link);
      cmd = (char *)malloc((bytes_read + 50) * sizeof(char));
      cmd1 = (char *)malloc((bytes_read + 125) * sizeof(char));
      sprintf(cmd, "mkdir -p /home/ainsoph/devel/SpaceApp/ainsoph/www/%s",
              link);
      system(cmd);
      sprintf(cmd1,
              "mv "
              "/home/ainsoph/devel/SpaceApp/ainsoph/dtn/incoming/spaceapps.dtn/"
              "site.tar.gz /home/ainsoph/devel/SpaceApp/ainsoph/www/%s/",
              link);
      system(cmd1);
      printf("Site %s available!\n", link);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x88(%rbp)
mov    0x2e14(%rip),%rax
mov    (%rax),%esi
lea    0xe23(%rip),%rdi
call   10a0 <open@plt>
mov    %eax,-0x78(%rbp)
cmpl   $0x0,-0x78(%rbp)
jge    1213 <main+0x63>
lea    0xe1d(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xdfc(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    0x2dce(%rip),%rax
mov    (%rax),%esi
lea    0xe00(%rip),%rdi
call   10a0 <open@plt>
mov    %eax,-0x7c(%rbp)
cmpl   $0x0,-0x7c(%rbp)
jge    1259 <main+0xa9>
lea    0xdd7(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xdd9(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
jmp    125e <main+0xae>
movq   $0x0,-0xa0(%rbp)
mov    -0x7c(%rbp),%edi
lea    -0x70(%rbp),%rsi
mov    $0x63,%edx
call   1080 <read@plt>
mov    %eax,-0x90(%rbp)
movslq -0x90(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0xa0(%rbp)
movslq -0x90(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x88(%rbp)
mov    -0xa0(%rbp),%rdi
lea    -0x70(%rbp),%rsi
mov    -0x90(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x90(%rbp),%esi
lea    0xd62(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0xa0(%rbp),%rsi
lea    0xd5d(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0xa0(%rbp),%rdi
lea    0xd57(%rip),%rsi
mov    $0x3,%edx
call   1040 <strncmp@plt>
mov    %eax,-0xa4(%rbp)
cmpl   $0x0,-0xa4(%rbp)
jne    146d <main+0x2bd>
mov    -0x88(%rbp),%rdi
mov    -0xa0(%rbp),%rsi
add    $0x4,%rsi
mov    -0x90(%rbp),%edx
sub    $0x4,%edx
call   1030 <strncpy@plt>
mov    -0x88(%rbp),%rsi
lea    0xd10(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movq   $0x0,-0xb0(%rbp)
movq   $0x0,-0xb8(%rbp)
mov    -0x90(%rbp),%eax
add    $0x14,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0xb0(%rbp)
mov    -0x90(%rbp),%eax
add    $0x8c,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0xb8(%rbp)
mov    -0xb0(%rbp),%rax
movb   $0x0,(%rax)
mov    -0xb0(%rbp),%rdi
lea    0xca9(%rip),%rsi
call   10b0 <strcat@plt>
mov    %rax,-0xb0(%rbp)
mov    -0xb0(%rbp),%rdi
mov    -0x88(%rbp),%rsi
call   10b0 <strcat@plt>
mov    %rax,-0xb0(%rbp)
mov    -0xb0(%rbp),%rsi
lea    0xdcf(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0xb0(%rbp),%rdi
call   1060 <system@plt>
lea    0xc6e(%rip),%rdi
call   1060 <system@plt>
lea    0xc78(%rip),%rdi
call   1060 <system@plt>
lea    0xc7c(%rip),%rdi
call   1060 <system@plt>
lea    0xc9f(%rip),%rdi
call   1060 <system@plt>
mov    -0xb8(%rbp),%rdi
mov    -0x88(%rbp),%rdx
lea    0xcdd(%rip),%rsi
call   10c0 <sprintf@plt>
mov    -0xb8(%rbp),%rdi
call   1060 <system@plt>
mov    -0x88(%rbp),%rsi
lea    0xd41(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0xa0(%rbp),%rdi
lea    0xd36(%rip),%rsi
mov    $0x3,%edx
call   1040 <strncmp@plt>
mov    %eax,-0xa4(%rbp)
cmpl   $0x0,-0xa4(%rbp)
jne    1568 <main+0x3b8>
mov    -0x88(%rbp),%rdi
mov    -0xa0(%rbp),%rsi
add    $0x4,%rsi
mov    -0x90(%rbp),%edx
sub    $0x4,%edx
call   1030 <strncpy@plt>
mov    -0x88(%rbp),%rsi
lea    0xcef(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x90(%rbp),%eax
add    $0x32,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0xc0(%rbp)
mov    -0x90(%rbp),%eax
add    $0x7d,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0xc8(%rbp)
mov    -0xc0(%rbp),%rdi
mov    -0x88(%rbp),%rdx
lea    0xca6(%rip),%rsi
call   10c0 <sprintf@plt>
mov    -0xc0(%rbp),%rdi
call   1060 <system@plt>
mov    -0xc8(%rbp),%rdi
mov    -0x88(%rbp),%rdx
lea    0xcb5(%rip),%rsi
call   10c0 <sprintf@plt>
mov    -0xc8(%rbp),%rdi
call   1060 <system@plt>
mov    -0x88(%rbp),%rsi
lea    0xd12(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    125e <main+0xae>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    0x2e13(%rip),%rbx
mov    (%rbx),%esi
lea    0xe22(%rip),%rdi
call   10b0 <open@plt>
test   %eax,%eax
js     1403 <main+0x243>
mov    (%rbx),%esi
lea    0xe2f(%rip),%rdi
call   10b0 <open@plt>
mov    %eax,0xc(%rsp)
test   %eax,%eax
js     141a <main+0x25a>
lea    0x10(%rsp),%r13
nopw   0x0(%rax,%rax,1)
mov    0xc(%rsp),%edi
mov    %r13,%rsi
mov    $0x63,%edx
call   1090 <read@plt>
mov    %eax,%r15d
mov    %eax,%edi
call   10a0 <malloc@plt>
mov    %rax,%r12
mov    %r15d,%edi
call   10a0 <malloc@plt>
mov    %rax,%r14
mov    %r12,%rdi
mov    %r13,%rsi
mov    %r15d,%edx
call   1030 <strncpy@plt>
lea    0xde9(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xde8(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r12,%rdi
lea    0xde3(%rip),%rsi
mov    $0x3,%edx
call   1040 <strncmp@plt>
test   %eax,%eax
jne    135e <main+0x19e>
lea    0x4(%r12),%rsi
lea    -0x4(%r15),%edx
mov    %r14,%rdi
call   1030 <strncpy@plt>
lea    0xdbd(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0x14(%r15),%edi
call   10a0 <malloc@plt>
mov    %rax,%rbp
lea    0x8c(%r15),%edi
call   10a0 <malloc@plt>
mov    %r13,%rbx
mov    %rax,%r13
movb   $0x0,0x0(%rbp)
mov    %rbp,%rdi
call   1060 <strlen@plt>
movups 0xd8c(%rip),%xmm0
movups %xmm0,0x0(%rbp,%rax,1)
movl   $0x207970,0xf(%rbp,%rax,1)
mov    %rbp,%rdi
mov    %r14,%rsi
call   10c0 <strcat@plt>
mov    %rbp,%rdi
call   1050 <puts@plt>
mov    %rbp,%rdi
call   1070 <system@plt>
lea    0xd70(%rip),%rdi
call   1070 <system@plt>
lea    0xd7a(%rip),%rdi
call   1070 <system@plt>
lea    0xd7e(%rip),%rdi
call   1070 <system@plt>
lea    0xda1(%rip),%rdi
call   1070 <system@plt>
mov    %r13,%rdi
lea    0xdea(%rip),%rsi
mov    %r14,%rdx
call   10d0 <sprintf@plt>
mov    %r13,%rdi
mov    %rbx,%r13
call   1070 <system@plt>
lea    0xe53(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r12,%rdi
lea    0xe49(%rip),%rsi
mov    $0x3,%edx
call   1040 <strncmp@plt>
test   %eax,%eax
jne    1210 <main+0x50>
add    $0x4,%r12
lea    -0x4(%r15),%edx
mov    %r14,%rdi
mov    %r12,%rsi
call   1030 <strncpy@plt>
lea    0xe21(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0x32(%r15),%edi
call   10a0 <malloc@plt>
mov    %rax,%rbp
add    $0x7d,%r15d
mov    %r15d,%edi
call   10a0 <malloc@plt>
mov    %rax,%rbx
mov    %rbp,%rdi
lea    0xdff(%rip),%rsi
mov    %r14,%rdx
call   10d0 <sprintf@plt>
mov    %rbp,%rdi
call   1070 <system@plt>
mov    %rbx,%rdi
lea    0xe1a(%rip),%rsi
mov    %r14,%rdx
call   10d0 <sprintf@plt>
mov    %rbx,%rdi
call   1070 <system@plt>
lea    0xe7f(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
jmp    1210 <main+0x50>
lea    0xc09(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xbe8(%rip),%rdi
jmp    142f <main+0x26f>
lea    0xbf2(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xbf4(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
%struct.sigaction = type { i32 }
@.str = [19 x i8] c"/tmp/earth_in_pipe\00"
@O_RDWR = global i32 0
@.str.1 = [16 x i8] c"Error openning \00"
@.str.2 = [20 x i8] c"/tmp/earth_out_pipe\00"
@.str.3 = [16 x i8] c"bytes read: %d\0A\00"
@.str.4 = [15 x i8] c"Pipe out = %s\0A\00"
@.str.5 = [4 x i8] c"get\00"
@.str.6 = [10 x i8] c"site: %s\0A\00"
@.str.7 = [19 x i8] c"python crawler.py \00"
@.str.8 = [4 x i8] c"%s\0A\00"
@.str.9 = [22 x i8] c"chmod +x sedScript.sh\00"
@.str.10 = [16 x i8] c"sh sedScript.sh\00"
@.str.11 = [47 x i8] c"tar -zcf site.tar.gz remotefile* basefile.html\00"
@.str.12 = [88 x i8] c"/home/ainsoph/devel/SpaceApp/dtn-2.9.0/apps/dtncp/dtncp site.tar.gz dtn://spaceapps.dtn\00"
@.str.13 = [131 x i8] c"/home/ainsoph/devel/SpaceApp/dtn-2.9.0/apps/dtnsend/dtnsend -s dtn://spaceapps.dtn/me -d dtn://spaceapps.dtn/mars -t m -p \22snt:%s\22\00"
@.str.14 = [10 x i8] c"%s done!\0A\00"
@.str.15 = [4 x i8] c"snt\00"
@.str.16 = [13 x i8] c"siteSNT: %s\0A\00"
@.str.17 = [53 x i8] c"mkdir -p /home/ainsoph/devel/SpaceApp/ainsoph/www/%s\00"
@.str.18 = [124 x i8] c"mv /home/ainsoph/devel/SpaceApp/ainsoph/dtn/incoming/spaceapps.dtn/site.tar.gz /home/ainsoph/devel/SpaceApp/ainsoph/www/%s/\00"
@.str.19 = [20 x i8] c"Site %s available!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.sigaction
%3 = alloca [100 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca [4 x i8]
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i8*
%17 = alloca i8*
store i32 0, i32* %1
store i8* null, i8** %8
%18 = load i32, i32* @O_RDWR
%19 = call i32 @open(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %18)
store i32 %19, i32* %5
%20 = load i32, i32* %5
%21 = icmp slt i32 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %0
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%24 = call i32 @puts(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%25 = call i32 @exit(i32 1)
unreachable
26: ; preds = %0
%27 = load i32, i32* @O_RDWR
%28 = call i32 @open(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %27)
store i32 %28, i32* %6
%29 = load i32, i32* %6
%30 = icmp slt i32 %29, 0
br i1 %30, label %31, label %35
31: ; preds = %26
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%33 = call i32 @puts(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%34 = call i32 @exit(i32 1)
unreachable
35: ; preds = %26
br label %36
36: ; preds = %35, %149
store i8* null, i8** %12
%37 = load i32, i32* %6
%38 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%39 = call i32 @read(i32 %37, i8* %38, i32 99)
store i32 %39, i32* %10
%40 = load i32, i32* %10
%41 = sext i32 %40 to i64
%42 = mul i64 %41, 1
%43 = trunc i64 %42 to i32
%44 = call i64 @malloc(i32 %43)
%45 = inttoptr i64 %44 to i8*
store i8* %45, i8** %12
%46 = load i32, i32* %10
%47 = sext i32 %46 to i64
%48 = mul i64 %47, 1
%49 = trunc i64 %48 to i32
%50 = call i64 @malloc(i32 %49)
%51 = inttoptr i64 %50 to i8*
store i8* %51, i8** %8
%52 = load i8*, i8** %12
%53 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%54 = load i32, i32* %10
%55 = call i32 @strncpy(i8* %52, i8* %53, i32 %54)
%56 = load i32, i32* %10
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %56)
%58 = load i8*, i8** %12
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i8* %58)
%60 = load i8*, i8** %12
%61 = call i32 @strncmp(i8* %60, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 3)
store i32 %61, i32* %13
%62 = load i32, i32* %13
%63 = icmp eq i32 %62, 0
br i1 %63, label %64, label %109
64: ; preds = %36
%65 = load i8*, i8** %8
%66 = load i8*, i8** %12
%67 = getelementptr inbounds i8, i8* %66, i64 4
%68 = load i32, i32* %10
%69 = sub nsw i32 %68, 4
%70 = call i32 @strncpy(i8* %65, i8* %67, i32 %69)
%71 = load i8*, i8** %8
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* %71)
store i8* null, i8** %14
store i8* null, i8** %15
%73 = load i32, i32* %10
%74 = add nsw i32 %73, 20
%75 = sext i32 %74 to i64
%76 = mul i64 %75, 1
%77 = trunc i64 %76 to i32
%78 = call i64 @malloc(i32 %77)
%79 = inttoptr i64 %78 to i8*
store i8* %79, i8** %14
%80 = load i32, i32* %10
%81 = add nsw i32 %80, 140
%82 = sext i32 %81 to i64
%83 = mul i64 %82, 1
%84 = trunc i64 %83 to i32
%85 = call i64 @malloc(i32 %84)
%86 = inttoptr i64 %85 to i8*
store i8* %86, i8** %15
%87 = load i8*, i8** %14
%88 = getelementptr inbounds i8, i8* %87, i64 0
store i8 0, i8* %88
%89 = load i8*, i8** %14
%90 = call i8* @strcat(i8* %89, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
store i8* %90, i8** %14
%91 = load i8*, i8** %14
%92 = load i8*, i8** %8
%93 = call i8* @strcat(i8* %91, i8* %92)
store i8* %93, i8** %14
%94 = load i8*, i8** %14
%95 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %94)
%96 = load i8*, i8** %14
%97 = call i32 @system(i8* %96)
%98 = call i32 @system(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0))
%99 = call i32 @system(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0))
%100 = call i32 @system(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.11, i64 0, i64 0))
%101 = call i32 @system(i8* getelementptr inbounds ([88 x i8], [88 x i8]* @.str.12, i64 0, i64 0))
%102 = load i8*, i8** %15
%103 = load i8*, i8** %8
%104 = call i32 @sprintf(i8* %102, i8* getelementptr inbounds ([131 x i8], [131 x i8]* @.str.13, i64 0, i64 0), i8* %103)
%105 = load i8*, i8** %15
%106 = call i32 @system(i8* %105)
%107 = load i8*, i8** %8
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.14, i64 0, i64 0), i8* %107)
br label %109
109: ; preds = %64, %36
%110 = load i8*, i8** %12
%111 = call i32 @strncmp(i8* %110, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0), i32 3)
store i32 %111, i32* %13
%112 = load i32, i32* %13
%113 = icmp eq i32 %112, 0
br i1 %113, label %114, label %149
114: ; preds = %109
%115 = load i8*, i8** %8
%116 = load i8*, i8** %12
%117 = getelementptr inbounds i8, i8* %116, i64 4
%118 = load i32, i32* %10
%119 = sub nsw i32 %118, 4
%120 = call i32 @strncpy(i8* %115, i8* %117, i32 %119)
%121 = load i8*, i8** %8
%122 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.16, i64 0, i64 0), i8* %121)
%123 = load i32, i32* %10
%124 = add nsw i32 %123, 50
%125 = sext i32 %124 to i64
%126 = mul i64 %125, 1
%127 = trunc i64 %126 to i32
%128 = call i64 @malloc(i32 %127)
%129 = inttoptr i64 %128 to i8*
store i8* %129, i8** %16
%130 = load i32, i32* %10
%131 = add nsw i32 %130, 125
%132 = sext i32 %131 to i64
%133 = mul i64 %132, 1
%134 = trunc i64 %133 to i32
%135 = call i64 @malloc(i32 %134)
%136 = inttoptr i64 %135 to i8*
store i8* %136, i8** %17
%137 = load i8*, i8** %16
%138 = load i8*, i8** %8
%139 = call i32 @sprintf(i8* %137, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.17, i64 0, i64 0), i8* %138)
%140 = load i8*, i8** %16
%141 = call i32 @system(i8* %140)
%142 = load i8*, i8** %17
%143 = load i8*, i8** %8
%144 = call i32 @sprintf(i8* %142, i8* getelementptr inbounds ([124 x i8], [124 x i8]* @.str.18, i64 0, i64 0), i8* %143)
%145 = load i8*, i8** %17
%146 = call i32 @system(i8* %145)
%147 = load i8*, i8** %8
%148 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.19, i64 0, i64 0), i8* %147)
br label %149
149: ; preds = %114, %109
br label %36
}

LLVM IR (-O2):
@.str = [19 x i8] c"/tmp/earth_in_pipe\00"
@O_RDWR = global i32 0
@.str.1 = [16 x i8] c"Error openning \00"
@.str.2 = [20 x i8] c"/tmp/earth_out_pipe\00"
@.str.3 = [16 x i8] c"bytes read: %d\0A\00"
@.str.4 = [15 x i8] c"Pipe out = %s\0A\00"
@.str.5 = [4 x i8] c"get\00"
@.str.6 = [10 x i8] c"site: %s\0A\00"
@.str.7 = [19 x i8] c"python crawler.py \00"
@.str.9 = [22 x i8] c"chmod +x sedScript.sh\00"
@.str.10 = [16 x i8] c"sh sedScript.sh\00"
@.str.11 = [47 x i8] c"tar -zcf site.tar.gz remotefile* basefile.html\00"
@.str.12 = [88 x i8] c"/home/ainsoph/devel/SpaceApp/dtn-2.9.0/apps/dtncp/dtncp site.tar.gz dtn://spaceapps.dtn\00"
@.str.13 = [131 x i8] c"/home/ainsoph/devel/SpaceApp/dtn-2.9.0/apps/dtnsend/dtnsend -s dtn://spaceapps.dtn/me -d dtn://spaceapps.dtn/mars -t m -p \22snt:%s\22\00"
@.str.14 = [10 x i8] c"%s done!\0A\00"
@.str.15 = [4 x i8] c"snt\00"
@.str.16 = [13 x i8] c"siteSNT: %s\0A\00"
@.str.17 = [53 x i8] c"mkdir -p /home/ainsoph/devel/SpaceApp/ainsoph/www/%s\00"
@.str.18 = [124 x i8] c"mv /home/ainsoph/devel/SpaceApp/ainsoph/dtn/incoming/spaceapps.dtn/site.tar.gz /home/ainsoph/devel/SpaceApp/ainsoph/www/%s/\00"
@.str.19 = [20 x i8] c"Site %s available!\0A\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @O_RDWR
%4 = tail call i32 @open(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %0
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %0
%11 = load i32, i32* @O_RDWR
%12 = tail call i32 @open(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %11)
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%17 = tail call i32 @exit(i32 1)
unreachable
18: ; preds = %10, %71
%19 = call i32 @read(i32 %12, i8* %2, i32 99)
%20 = call i64 @malloc(i32 %19)
%21 = inttoptr i64 %20 to i8*
%22 = call i64 @malloc(i32 %19)
%23 = inttoptr i64 %22 to i8*
%24 = call i32 @strncpy(i8* %21, i8* %2, i32 %19)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %19)
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i8* %21)
%27 = call i32 @strncmp(i8* %21, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 3)
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %52
29: ; preds = %18
%30 = getelementptr inbounds i8, i8* %21, i64 4
%31 = add nsw i32 %19, -4
%32 = call i32 @strncpy(i8* %23, i8* %30, i32 %31)
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* %23)
%34 = add nsw i32 %19, 20
%35 = call i64 @malloc(i32 %34)
%36 = inttoptr i64 %35 to i8*
%37 = add nsw i32 %19, 140
%38 = call i64 @malloc(i32 %37)
%39 = inttoptr i64 %38 to i8*
store i8 0, i8* %36
%40 = call i64 @strlen(i8* %36)
%41 = getelementptr i8, i8* %36, i64 %40
%42 = call i8* @strcat(i8* %36, i8* dereferenceable(1) %23)
%43 = call i32 @puts(i8* %36)
%44 = call i32 @system(i8* %36)
%45 = call i32 @system(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i64 0, i64 0))
%46 = call i32 @system(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.10, i64 0, i64 0))
%47 = call i32 @system(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.11, i64 0, i64 0))
%48 = call i32 @system(i8* getelementptr inbounds ([88 x i8], [88 x i8]* @.str.12, i64 0, i64 0))
%49 = call i32 @sprintf(i8* dereferenceable(1) %39, i8* dereferenceable(1) getelementptr inbounds ([131 x i8], [131 x i8]* @.str.13, i64 0, i64 0), i8* %23)
%50 = call i32 @system(i8* %39)
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.14, i64 0, i64 0), i8* %23)
br label %52
52: ; preds = %29, %18
%53 = call i32 @strncmp(i8* %21, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0), i32 3)
%54 = icmp eq i32 %53, 0
br i1 %54, label %55, label %71
55: ; preds = %52
%56 = getelementptr inbounds i8, i8* %21, i64 4
%57 = add nsw i32 %19, -4
%58 = call i32 @strncpy(i8* %23, i8* %56, i32 %57)
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.16, i64 0, i64 0), i8* %23)
%60 = add nsw i32 %19, 50
%61 = call i64 @malloc(i32 %60)
%62 = inttoptr i64 %61 to i8*
%63 = add nsw i32 %19, 125
%64 = call i64 @malloc(i32 %63)
%65 = inttoptr i64 %64 to i8*
%66 = call i32 @sprintf(i8* dereferenceable(1) %62, i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str.17, i64 0, i64 0), i8* %23)
%67 = call i32 @system(i8* %62)
%68 = call i32 @sprintf(i8* dereferenceable(1) %65, i8* dereferenceable(1) getelementptr inbounds ([124 x i8], [124 x i8]* @.str.18, i64 0, i64 0), i8* %23)
%69 = call i32 @system(i8* %65)
%70 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.19, i64 0, i64 0), i8* %23)
br label %71
71: ; preds = %55, %52
br label %18
}