#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 */
scalar_t__ EOF;
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, char *);
char *strchr(char *, char);
int /*<<< orphan*/ strlcpy(char *, char *, int);
char *strrchr(char *, char);
int /*<<< orphan*/ *strstr(char *, char *);
int main() {
  FILE *fp, *out;
  fp = fopen("~/Desktop/test.html", "r");
  out = fopen("git-real", "w");
  char ch[500], temp[500];
  char *s1, *s2;
  int length1, length2;
  while ((fscanf(fp, "%s", ch)) != EOF) {
    if (strstr(ch, "720p") != NULL && strstr(ch, "\"") != NULL) {
      s1 = strchr(ch, '\"');
      s2 = strrchr(ch, '\"');
      length1 = (int)(s1 - ch);
      length2 = (int)(s2 - ch);
      strlcpy(temp, ch + length1 + 1, length2 - length1);
      fprintf(out, "%s\n", temp);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe77(%rip),%rdi
lea    0xe84(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    0xe76(%rip),%rdi
lea    0xe78(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x210(%rbp),%rdx
lea    0xe5f(%rip),%rsi
call   1050 <fscanf@plt>
mov    0x2e1a(%rip),%rcx
cmp    (%rcx),%rax
je     12b8 <main+0x148>
lea    -0x210(%rbp),%rdi
lea    0xe3f(%rip),%rsi
call   1090 <strstr@plt>
cmp    $0x0,%rax
je     12b3 <main+0x143>
lea    -0x210(%rbp),%rdi
lea    0xe27(%rip),%rsi
call   1090 <strstr@plt>
cmp    $0x0,%rax
je     12b3 <main+0x143>
lea    -0x210(%rbp),%rdi
mov    $0x22,%esi
call   1030 <strchr@plt>
mov    %rax,-0x418(%rbp)
lea    -0x210(%rbp),%rdi
mov    $0x22,%esi
call   1040 <strrchr@plt>
mov    %rax,-0x420(%rbp)
mov    -0x418(%rbp),%rax
lea    -0x210(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x424(%rbp)
mov    -0x420(%rbp),%rax
lea    -0x210(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x428(%rbp)
lea    -0x410(%rbp),%rdi
lea    -0x210(%rbp),%rsi
movslq -0x424(%rbp),%rax
add    %rax,%rsi
add    $0x1,%rsi
mov    -0x428(%rbp),%edx
sub    -0x424(%rbp),%edx
call   1070 <strlcpy@plt>
mov    -0x18(%rbp),%rdi
lea    -0x410(%rbp),%rdx
lea    0xd7d(%rip),%rsi
call   1060 <fprintf@plt>
jmp    11b0 <main+0x40>
xor    %eax,%eax
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x408,%rsp
lea    0xe78(%rip),%rdi
lea    0xe85(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%r15
lea    0xe78(%rip),%rdi
lea    0xe7a(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,0x8(%rsp)
lea    0xe6b(%rip),%rsi
lea    0x10(%rsp),%r12
mov    %r15,%rdi
mov    %r12,%rdx
call   1050 <fscanf@plt>
mov    0x2e1b(%rip),%r14
cmp    (%r14),%rax
jne    11e6 <main+0x76>
xor    %eax,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe37(%rip),%rbx
lea    0xe2d(%rip),%r13
jmp    1213 <main+0xa3>
cs nopw 0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %r13,%rsi
mov    %r12,%rdx
call   1050 <fscanf@plt>
cmp    (%r14),%rax
je     11d2 <main+0x62>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1090 <strstr@plt>
test   %rax,%rax
je     1200 <main+0x90>
mov    %r12,%rdi
mov    $0x22,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     1200 <main+0x90>
mov    %r12,%rdi
mov    $0x22,%esi
call   1030 <strchr@plt>
mov    %r14,%rbp
mov    %rax,%r14
mov    %r12,%rdi
mov    $0x22,%esi
call   1040 <strrchr@plt>
sub    %r12,%r14
sub    %r12d,%eax
movslq %r14d,%rcx
mov    %rbp,%r14
lea    (%rsp,%rcx,1),%rsi
add    $0x11,%rsi
sub    %ecx,%eax
lea    0x210(%rsp),%rbp
mov    %rbp,%rdi
mov    %eax,%edx
call   1070 <strlcpy@plt>
mov    0x8(%rsp),%rdi
lea    0xda0(%rip),%rsi
mov    %rbp,%rdx
call   1060 <fprintf@plt>
jmp    1200 <main+0x90>

LLVM IR (-O0):
@.str = [20 x i8] c"~/Desktop/test.html\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [9 x i8] c"git-real\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [3 x i8] c"%s\00"
@EOF = global i64 0
@.str.5 = [5 x i8] c"720p\00"
@.str.6 = [2 x i8] c"\22\00"
@.str.7 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca [500 x i8]
%5 = alloca [500 x i8]
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
%10 = call i32* @fopen(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %10, i32** %2
%11 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %11, i32** %3
br label %12
12: ; preds = %56, %0
%13 = load i32*, i32** %2
%14 = getelementptr inbounds [500 x i8], [500 x i8]* %4, i64 0, i64 0
%15 = call i64 @fscanf(i32* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %14)
%16 = load i64, i64* @EOF
%17 = icmp ne i64 %15, %16
br i1 %17, label %18, label %57
18: ; preds = %12
%19 = getelementptr inbounds [500 x i8], [500 x i8]* %4, i64 0, i64 0
%20 = call i32* @strstr(i8* %19, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%21 = icmp ne i32* %20, null
br i1 %21, label %22, label %56
22: ; preds = %18
%23 = getelementptr inbounds [500 x i8], [500 x i8]* %4, i64 0, i64 0
%24 = call i32* @strstr(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%25 = icmp ne i32* %24, null
br i1 %25, label %26, label %56
26: ; preds = %22
%27 = getelementptr inbounds [500 x i8], [500 x i8]* %4, i64 0, i64 0
%28 = call i8* @strchr(i8* %27, i8 signext 34)
store i8* %28, i8** %6
%29 = getelementptr inbounds [500 x i8], [500 x i8]* %4, i64 0, i64 0
%30 = call i8* @strrchr(i8* %29, i8 signext 34)
store i8* %30, i8** %7
%31 = load i8*, i8** %6
%32 = getelementptr inbounds [500 x i8], [500 x i8]* %4, i64 0, i64 0
%33 = ptrtoint i8* %31 to i64
%34 = ptrtoint i8* %32 to i64
%35 = sub i64 %33, %34
%36 = trunc i64 %35 to i32
store i32 %36, i32* %8
%37 = load i8*, i8** %7
%38 = getelementptr inbounds [500 x i8], [500 x i8]* %4, i64 0, i64 0
%39 = ptrtoint i8* %37 to i64
%40 = ptrtoint i8* %38 to i64
%41 = sub i64 %39, %40
%42 = trunc i64 %41 to i32
store i32 %42, i32* %9
%43 = getelementptr inbounds [500 x i8], [500 x i8]* %5, i64 0, i64 0
%44 = getelementptr inbounds [500 x i8], [500 x i8]* %4, i64 0, i64 0
%45 = load i32, i32* %8
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8, i8* %44, i64 %46
%48 = getelementptr inbounds i8, i8* %47, i64 1
%49 = load i32, i32* %9
%50 = load i32, i32* %8
%51 = sub nsw i32 %49, %50
%52 = call i32 @strlcpy(i8* %43, i8* %48, i32 %51)
%53 = load i32*, i32** %3
%54 = getelementptr inbounds [500 x i8], [500 x i8]* %5, i64 0, i64 0
%55 = call i32 @fprintf(i32* %53, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %54)
br label %56
56: ; preds = %26, %22, %18
br label %12
57: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"~/Desktop/test.html\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [9 x i8] c"git-real\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [3 x i8] c"%s\00"
@EOF = global i64 0
@.str.5 = [5 x i8] c"720p\00"
@.str.7 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [500 x i8]
%2 = alloca [500 x i8]
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%5 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [500 x i8], [500 x i8]* %2, i64 0, i64 0
%7 = call i64 @fscanf(i32* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %5)
%8 = load i64, i64* @EOF
%9 = icmp eq i64 %7, %8
br i1 %9, label %38, label %10
10: ; preds = %0
%11 = ptrtoint [500 x i8]* %1 to i64
br label %12
12: ; preds = %10, %34
%13 = call i32* @strstr(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%14 = icmp eq i32* %13, null
br i1 %14, label %34, label %15
15: ; preds = %12
%16 = call i8* bitcast (i8* (i8*, i8)* @strchr to i8* (i8*, i32)*)(i8* %5, i32 34)
%17 = icmp eq i8* %16, null
br i1 %17, label %34, label %18
18: ; preds = %15
%19 = call i8* @strchr(i8* %5, i8 signext 34)
%20 = call i8* @strrchr(i8* %5, i8 signext 34)
%21 = ptrtoint i8* %19 to i64
%22 = sub i64 %21, %11
%23 = trunc i64 %22 to i32
%24 = ptrtoint i8* %20 to i64
%25 = sub i64 %24, %11
%26 = trunc i64 %25 to i32
%27 = shl i64 %22, 32
%28 = ashr exact i64 %27, 32
%29 = getelementptr inbounds [500 x i8], [500 x i8]* %1, i64 0, i64 %28
%30 = getelementptr inbounds i8, i8* %29, i64 1
%31 = sub nsw i32 %26, %23
%32 = call i32 @strlcpy(i8* %6, i8* %30, i32 %31)
%33 = call i32 @fprintf(i32* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %6)
br label %34
34: ; preds = %18, %15, %12
%35 = call i64 @fscanf(i32* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %5)
%36 = load i64, i64* @EOF
%37 = icmp eq i64 %35, %36
br i1 %37, label %38, label %12
38: ; preds = %34, %0
ret i32 0
}