#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 */
scalar_t__ malloc(size_t);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ snprintf(char *, size_t, char *, char *);
size_t strlen(char *);
scalar_t__ strncmp(char *, char *, size_t);
int /*<<< orphan*/ system(char *);
int main(int argc, char *argv[]) {
  char *http = "http://";
  if (!argv[1]) {
    printf("Run only in the Command Prompt and not in GUI..\n");
    printf("HGET(Heronix Web Get) for Windows.\n");
    printf("\n");
    printf("Usage: hilix.exe %s \n", argv[1]);
  } else {
    printf("Downloading Page: %s \n", argv[1]);
    size_t syscmd_len = strlen("wget") + strlen("http://") + strlen(argv[1]);
    size_t syscmd_size = syscmd_len + 2;
    char *syscmd = (char *)malloc(syscmd_size);
    if (strncmp(argv[1], "http://", strlen("http://")) == 0) {
      snprintf(syscmd, syscmd_size, "wget %s", argv[1]);
      printf("%s\n", argv[1]);
    } else {
      snprintf(syscmd, syscmd_size, "wget http://%s", argv[1]);
      printf("%s\n", argv[1]);
    }
    printf("%s\n", syscmd);
    system(syscmd);
    return 0;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe83(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x8(%rax)
jne    11d5 <main+0x75>
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1309 <main+0x1a9>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe98(%rip),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x48(%rbp)
lea    0xdfe(%rip),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x48(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x40(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1080 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x38(%rbp)
lea    0xda4(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x38(%rbp),%rdi
mov    %rax,%rdx
lea    0xd91(%rip),%rsi
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    12b5 <main+0x155>
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0xdfa(%rip),%rdx
call   1070 <snprintf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xdee(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    12e7 <main+0x187>
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0xdcf(%rip),%rdx
call   1070 <snprintf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xdb7(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x30(%rbp),%rsi
lea    0xda5(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x30(%rbp),%rdi
call   1050 <system@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    0x8(%rsi),%rsi
test   %rsi,%rsi
je     120b <main+0x8b>
lea    0xe86(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x8(%rbx),%rdi
call   1060 <strlen@plt>
lea    0xd(%rax),%r15
mov    %r15,%rdi
call   10a0 <malloc@plt>
mov    %rax,%r14
mov    0x8(%rbx),%rdi
lea    0xe3e(%rip),%rsi
mov    $0x7,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
mov    0x8(%rbx),%rcx
lea    0xe5b(%rip),%rax
lea    0xe5c(%rip),%rdx
cmove  %rax,%rdx
mov    %r14,%rdi
mov    %r15,%rsi
call   1090 <snprintf@plt>
mov    0x8(%rbx),%rdi
call   1050 <puts@plt>
mov    %r14,%rdi
call   1050 <puts@plt>
mov    %r14,%rdi
call   1070 <system@plt>
jmp    123f <main+0xbf>
lea    0xe3a(%rip),%rdi
call   1050 <puts@plt>
lea    0xe5e(%rip),%rdi
call   1050 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x8(%rbx),%rsi
lea    0xdd0(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [8 x i8] c"http://\00"
@.str.1 = [49 x i8] c"Run only in the Command Prompt and not in GUI..\0A\00"
@.str.2 = [36 x i8] c"HGET(Heronix Web Get) for Windows.\0A\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [22 x i8] c"Usage: hilix.exe %s \0A\00"
@.str.5 = [23 x i8] c"Downloading Page: %s \0A\00"
@.str.6 = [5 x i8] c"wget\00"
@.str.7 = [8 x i8] c"wget %s\00"
@.str.8 = [4 x i8] c"%s\0A\00"
@.str.9 = [15 x i8] c"wget http://%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %6
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = icmp ne i8* %12, null
br i1 %13, label %22, label %14
14: ; preds = %2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* %20)
br label %73
22: ; preds = %2
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8* %25)
%27 = call i64 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%28 = call i64 @strlen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%29 = add i64 %27, %28
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 1
%32 = load i8*, i8** %31
%33 = call i64 @strlen(i8* %32)
%34 = add i64 %29, %33
store i64 %34, i64* %7
%35 = load i64, i64* %7
%36 = add i64 %35, 2
store i64 %36, i64* %8
%37 = load i64, i64* %8
%38 = call i64 @malloc(i64 %37)
%39 = inttoptr i64 %38 to i8*
store i8* %39, i8** %9
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 1
%42 = load i8*, i8** %41
%43 = call i64 @strlen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%44 = call i64 @strncmp(i8* %42, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i64 %43)
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %57
46: ; preds = %22
%47 = load i8*, i8** %9
%48 = load i64, i64* %8
%49 = load i8**, i8*** %5
%50 = getelementptr inbounds i8*, i8** %49, i64 1
%51 = load i8*, i8** %50
%52 = call i32 @snprintf(i8* %47, i64 %48, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i8* %51)
%53 = load i8**, i8*** %5
%54 = getelementptr inbounds i8*, i8** %53, i64 1
%55 = load i8*, i8** %54
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %55)
br label %68
57: ; preds = %22
%58 = load i8*, i8** %9
%59 = load i64, i64* %8
%60 = load i8**, i8*** %5
%61 = getelementptr inbounds i8*, i8** %60, i64 1
%62 = load i8*, i8** %61
%63 = call i32 @snprintf(i8* %58, i64 %59, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), i8* %62)
%64 = load i8**, i8*** %5
%65 = getelementptr inbounds i8*, i8** %64, i64 1
%66 = load i8*, i8** %65
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %66)
br label %68
68: ; preds = %57, %46
%69 = load i8*, i8** %9
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %69)
%71 = load i8*, i8** %9
%72 = call i32 @system(i8* %71)
store i32 0, i32* %3
br label %73
73: ; preds = %68, %14
%74 = load i32, i32* %3
ret i32 %74
}

LLVM IR (-O2):
@.str = [8 x i8] c"http://\00"
@.str.4 = [22 x i8] c"Usage: hilix.exe %s \0A\00"
@.str.5 = [23 x i8] c"Downloading Page: %s \0A\00"
@.str.7 = [8 x i8] c"wget %s\00"
@.str.9 = [15 x i8] c"wget http://%s\00"
@str = [48 x i8] c"Run only in the Command Prompt and not in GUI..\00"
@str.10 = [35 x i8] c"HGET(Heronix Web Get) for Windows.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %12
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.10, i64 0, i64 0))
%9 = tail call i32 @putchar(i32 10)
%10 = load i8*, i8** %3
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* %10)
br label %29
12: ; preds = %2
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8* %4)
%14 = load i8*, i8** %3
%15 = tail call i64 @strlen(i8* dereferenceable(1) %14)
%16 = add i64 %15, 13
%17 = tail call i64 @malloc(i64 %16)
%18 = inttoptr i64 %17 to i8*
%19 = load i8*, i8** %3
%20 = tail call i64 @strncmp(i8* %19, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i64 7)
%21 = icmp eq i64 %20, 0
%22 = load i8*, i8** %3
%23 = select i1 %21, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0)
%24 = tail call i32 @snprintf(i8* %18, i64 %16, i8* %23, i8* %22)
%25 = load i8*, i8** %3
%26 = tail call i32 @puts(i8* dereferenceable(1) %25)
%27 = tail call i32 @puts(i8* dereferenceable(1) %18)
%28 = tail call i32 @system(i8* %18)
br label %29
29: ; preds = %6, %12
ret i32 0
}