#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 /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ bzero(char *, int);
int /*<<< orphan*/ errorurl(char *, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ filename(char *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fwrite(char *, int, int /*<<< orphan*/,
                          int /*<<< orphan*/ *);
int /*<<< orphan*/ nhtml(char *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sprintf(char *, char *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strlen(char *);
void GETNEW(char *htmlurl, char *cmd, char *lnk, char *sys_buf) {
  FILE *book1;
  int sysbn = 4000000;
  int error = 1;
  char url[256];
  char cplnk[256];
  bzero(cplnk, 256);
  strcpy(cplnk, lnk);
  bzero(url, 256);
  strcpy(url, cmd);
  errorurl(url, error);
  if (error == 1) {
    bzero(sys_buf, sysbn);
    sprintf(sys_buf,
            "GET %s HTTP/1.0\r\nHost: %s\r\nUser-Agent: HTML4.01\r\n\r\n",
            htmlurl, cmd);
    nhtml(cmd, sys_buf);
    filename(cplnk);
    if ((book1 = fopen(cplnk, "w")) == NULL)
      printf("error\n");
    fwrite(sys_buf, 1, strlen(sys_buf), book1);
    fclose(book1);
  } else
    sprintf(sys_buf, "cant find host :-(");
}


x86 assembly (clang, -O0):
<GETNEW>:
push   %rbp
mov    %rsp,%rbp
sub    $0x240,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x3d0900,-0x2c(%rbp)
movl   $0x1,-0x30(%rbp)
lea    -0x230(%rbp),%rdi
mov    $0x100,%esi
call   10b0 <bzero@plt>
lea    -0x230(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x130(%rbp),%rdi
mov    $0x100,%esi
call   10b0 <bzero@plt>
lea    -0x130(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x130(%rbp),%rdi
mov    -0x30(%rbp),%esi
call   1090 <errorurl@plt>
cmpl   $0x1,-0x30(%rbp)
jne    12d9 <GETNEW+0x129>
mov    -0x20(%rbp),%rdi
mov    -0x2c(%rbp),%esi
call   10b0 <bzero@plt>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xdad(%rip),%rsi
mov    $0x0,%al
call   10c0 <sprintf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <nhtml@plt>
lea    -0x230(%rbp),%rdi
call   1080 <filename@plt>
lea    -0x230(%rbp),%rdi
lea    0xdb3(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    12a0 <GETNEW+0xf0>
lea    0xd9b(%rip),%rdi
call   1070 <printf@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x238(%rbp)
mov    -0x20(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x238(%rbp),%rdi
mov    %eax,%edx
mov    -0x28(%rbp),%rcx
mov    $0x1,%esi
call   10d0 <fwrite@plt>
mov    -0x28(%rbp),%rdi
call   1050 <fclose@plt>
jmp    12eb <GETNEW+0x13b>
mov    -0x20(%rbp),%rdi
lea    0xd59(%rip),%rsi
mov    $0x0,%al
call   10c0 <sprintf@plt>
add    $0x240,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GETNEW>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x200,%rsp
mov    %rcx,%r13
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%r12
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x100,%esi
call   10b0 <bzero@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
lea    0x100(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x100,%esi
call   10b0 <bzero@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1090 <errorurl@plt>
mov    %r13,%rdi
mov    $0x3d0900,%esi
call   10b0 <bzero@plt>
lea    0xdd8(%rip),%rsi
mov    %r13,%rdi
mov    %r12,%rdx
mov    %r15,%rcx
xor    %eax,%eax
call   10c0 <sprintf@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1050 <nhtml@plt>
mov    %r14,%rdi
call   1080 <filename@plt>
lea    0xde2(%rip),%rsi
mov    %r14,%rdi
call   10a0 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    126e <GETNEW+0xbe>
lea    0xdcd(%rip),%rdi
call   1040 <puts@plt>
mov    %r13,%rdi
call   1070 <strlen@plt>
mov    %r13,%rdi
mov    $0x1,%esi
mov    %eax,%edx
mov    %rbx,%rcx
call   10d0 <fwrite@plt>
mov    %rbx,%rdi
call   1060 <fclose@plt>
add    $0x200,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [52 x i8] c"GET %s HTTP/1.0\0D\0AHost: %s\0D\0AUser-Agent: HTML4.01\0D\0A\0D\0A\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [7 x i8] c"error\0A\00"
@.str.3 = [19 x i8] c"cant find host :-(\00"
define void @GETNEW(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
%12 = alloca [256 x i8]
%13 = alloca [256 x i8]
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
store i32 4000000, i32* %10
store i32 1, i32* %11
%14 = getelementptr inbounds [256 x i8], [256 x i8]* %13, i64 0, i64 0
%15 = call i32 @bzero(i8* %14, i32 256)
%16 = getelementptr inbounds [256 x i8], [256 x i8]* %13, i64 0, i64 0
%17 = load i8*, i8** %7
%18 = call i32 @strcpy(i8* %16, i8* %17)
%19 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%20 = call i32 @bzero(i8* %19, i32 256)
%21 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%22 = load i8*, i8** %6
%23 = call i32 @strcpy(i8* %21, i8* %22)
%24 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%25 = load i32, i32* %11
%26 = call i32 @errorurl(i8* %24, i32 %25)
%27 = load i32, i32* %11
%28 = icmp eq i32 %27, 1
br i1 %28, label %29, label %55
29: ; preds = %4
%30 = load i8*, i8** %8
%31 = load i32, i32* %10
%32 = call i32 @bzero(i8* %30, i32 %31)
%33 = load i8*, i8** %8
%34 = load i8*, i8** %5
%35 = load i8*, i8** %6
%36 = call i32 (i8*, i8*, ...) @sprintf(i8* %33, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8* %34, i8* %35)
%37 = load i8*, i8** %6
%38 = load i8*, i8** %8
%39 = call i32 @nhtml(i8* %37, i8* %38)
%40 = getelementptr inbounds [256 x i8], [256 x i8]* %13, i64 0, i64 0
%41 = call i32 @filename(i8* %40)
%42 = getelementptr inbounds [256 x i8], [256 x i8]* %13, i64 0, i64 0
%43 = call i32* @fopen(i8* %42, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %43, i32** %9
%44 = icmp eq i32* %43, null
br i1 %44, label %45, label %47
45: ; preds = %29
%46 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %47
47: ; preds = %45, %29
%48 = load i8*, i8** %8
%49 = load i8*, i8** %8
%50 = call i32 @strlen(i8* %49)
%51 = load i32*, i32** %9
%52 = call i32 @fwrite(i8* %48, i32 1, i32 %50, i32* %51)
%53 = load i32*, i32** %9
%54 = call i32 @fclose(i32* %53)
br label %58
55: ; preds = %4
%56 = load i8*, i8** %8
%57 = call i32 (i8*, i8*, ...) @sprintf(i8* %56, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
br label %58
58: ; preds = %55, %47
ret void
}

LLVM IR (-O2):
@.str = [52 x i8] c"GET %s HTTP/1.0\0D\0AHost: %s\0D\0AUser-Agent: HTML4.01\0D\0A\0D\0A\00"
@.str.1 = [2 x i8] c"w\00"
@str = [6 x i8] c"error\00"
define void @GETNEW(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca [256 x i8]
%6 = alloca [256 x i8]
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%9 = call i32 @bzero(i8* %8, i32 256)
%10 = call i32 @strcpy(i8* %8, i8* %2)
%11 = call i32 @bzero(i8* %7, i32 256)
%12 = call i32 @strcpy(i8* %7, i8* %1)
%13 = call i32 @errorurl(i8* %7, i32 1)
%14 = call i32 @bzero(i8* %3, i32 4000000)
%15 = call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %3, i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%16 = call i32 @nhtml(i8* %1, i8* %3)
%17 = call i32 @filename(i8* %8)
%18 = call i32* @fopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp eq i32* %18, null
br i1 %19, label %20, label %22
20: ; preds = %4
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
br label %22
22: ; preds = %20, %4
%23 = call i32 @strlen(i8* %3)
%24 = call i32 @fwrite(i8* %3, i32 1, i32 %23, i32* %18)
%25 = call i32 @fclose(i32* %18)
ret void
}