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

/* Variables and functions */
char EOF;
int /*<<< orphan*/ bzero(char *, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ filename(char *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int /*<<< orphan*/ strcpy(char *, char *);
int GET(char *lnk, char *sys_buf) {
  int i = 0;
  char cplnk[256];
  char c;
  FILE *book;
  bzero(cplnk, 256);
  strcpy(cplnk, lnk);
  filename(cplnk);
  if ((book = fopen(cplnk, "r")) == NULL) {
    printf("there is no html\n");
    return 2;
  } else {
    rewind(book);
    bzero(sys_buf, sizeof(sys_buf));
    while ((c = fgetc(book)) != EOF) {
      sys_buf[i] = c;
      i++;
    }
    fclose(book);
    return 1;
  }
}


x86 assembly (clang, -O0):
<GET>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    -0x120(%rbp),%rdi
mov    $0x100,%esi
call   10a0 <bzero@plt>
lea    -0x120(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x120(%rbp),%rdi
call   1080 <filename@plt>
lea    -0x120(%rbp),%rdi
lea    0xe2b(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x130(%rbp)
cmp    $0x0,%rax
jne    1203 <GET+0x83>
lea    0xe10(%rip),%rdi
call   1050 <printf@plt>
movl   $0x2,-0x4(%rbp)
jmp    1276 <GET+0xf6>
mov    -0x130(%rbp),%rdi
call   1060 <rewind@plt>
mov    -0x18(%rbp),%rdi
mov    $0x8,%esi
call   10a0 <bzero@plt>
mov    -0x130(%rbp),%rdi
call   1070 <fgetc@plt>
mov    %al,-0x121(%rbp)
movsbl %al,%eax
mov    0x2daf(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1263 <GET+0xe3>
mov    -0x121(%rbp),%dl
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    121d <GET+0x9d>
mov    -0x130(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GET>:
push   %r15
push   %r14
push   %rbx
sub    $0x100,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0x100,%esi
call   10a0 <bzero@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %r15,%rdi
call   1080 <filename@plt>
lea    0xe44(%rip),%rsi
mov    %r15,%rdi
call   1090 <fopen@plt>
test   %rax,%rax
je     1222 <GET+0xa2>
mov    %rax,%r14
mov    %rax,%rdi
call   1060 <rewind@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
call   10a0 <bzero@plt>
mov    %r14,%rdi
call   1070 <fgetc@plt>
mov    0x2df8(%rip),%r15
cmp    (%r15),%al
je     1213 <GET+0x93>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %al,(%rbx)
mov    %r14,%rdi
call   1070 <fgetc@plt>
add    $0x1,%rbx
cmp    (%r15),%al
jne    1200 <GET+0x80>
mov    %r14,%rdi
call   1050 <fclose@plt>
mov    $0x1,%eax
jmp    1233 <GET+0xb3>
lea    0xdd9(%rip),%rdi
call   1040 <puts@plt>
mov    $0x2,%eax
add    $0x100,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [18 x i8] c"there is no html\0A\00"
@EOF = global i8 0
define i32 @GET(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca [256 x i8]
%8 = alloca i8
%9 = alloca i32*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 0, i32* %6
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%11 = call i32 @bzero(i8* %10, i32 256)
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%13 = load i8*, i8** %4
%14 = call i32 @strcpy(i8* %12, i8* %13)
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%16 = call i32 @filename(i8* %15)
%17 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%18 = call i32* @fopen(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %18, i32** %9
%19 = icmp eq i32* %18, null
br i1 %19, label %20, label %22
20: ; preds = %2
%21 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
store i32 2, i32* %3
br label %45
22: ; preds = %2
%23 = load i32*, i32** %9
%24 = call i32 @rewind(i32* %23)
%25 = load i8*, i8** %5
%26 = call i32 @bzero(i8* %25, i32 8)
br label %27
27: ; preds = %34, %22
%28 = load i32*, i32** %9
%29 = call signext i8 @fgetc(i32* %28)
store i8 %29, i8* %8
%30 = sext i8 %29 to i32
%31 = load i8, i8* @EOF
%32 = sext i8 %31 to i32
%33 = icmp ne i32 %30, %32
br i1 %33, label %34, label %42
34: ; preds = %27
%35 = load i8, i8* %8
%36 = load i8*, i8** %5
%37 = load i32, i32* %6
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8, i8* %36, i64 %38
store i8 %35, i8* %39
%40 = load i32, i32* %6
%41 = add nsw i32 %40, 1
store i32 %41, i32* %6
br label %27
42: ; preds = %27
%43 = load i32*, i32** %9
%44 = call i32 @fclose(i32* %43)
store i32 1, i32* %3
br label %45
45: ; preds = %42, %20
%46 = load i32, i32* %3
ret i32 %46
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@EOF = global i8 0
@str = [17 x i8] c"there is no html\00"
define i32 @GET(i8* %0, i8* nocapture writeonly %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = call i32 @bzero(i8* %4, i32 256)
%6 = call i32 @strcpy(i8* %4, i8* %0)
%7 = call i32 @filename(i8* %4)
%8 = call i32* @fopen(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
br label %28
12: ; preds = %2
%13 = call i32 @rewind(i32* %8)
%14 = call i32 @bzero(i8* %1, i32 8)
%15 = call signext i8 @fgetc(i32* %8)
%16 = load i8, i8* @EOF
%17 = icmp eq i8 %15, %16
br i1 %17, label %26, label %18
18: ; preds = %12, %18
%19 = phi i64 [ %22, %18 ], [ 0, %12 ]
%20 = phi i8 [ %23, %18 ], [ %15, %12 ]
%21 = getelementptr inbounds i8, i8* %1, i64 %19
store i8 %20, i8* %21
%22 = add nuw i64 %19, 1
%23 = call signext i8 @fgetc(i32* %8)
%24 = load i8, i8* @EOF
%25 = icmp eq i8 %23, %24
br i1 %25, label %26, label %18
26: ; preds = %18, %12
%27 = call i32 @fclose(i32* %8)
br label %28
28: ; preds = %26, %10
%29 = phi i32 [ 2, %10 ], [ 1, %26 ]
ret i32 %29
}