#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__ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
char *sre_malloc(char *, int, int);
char *sre_realloc(char *, int, char *, int);
int strlen(char *);
char *sre_fgets(char **buf, int *n, FILE *fp) {
  char *s;
  int len;
  int pos;
  if (*n == 0) {
    *buf = sre_malloc(
        "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/vinuesa/get_phylomarkers/refs/heads/master/"
        "bin/clustal-omega-1.2.4/src/squid/sre_string.c",
        249, (sizeof(char) * 128));
    *n = 128;
  }
  if (fgets(*buf, *n, fp) == NULL)
    return NULL;
  if (feof(fp))
    return *buf;
  len = strlen(*buf);
  if ((*buf)[len - 1] == '\n')
    return *buf;
  pos = (*n) - 1;
  while (1) {
    *n += 128;
    *buf = sre_realloc(
        "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/vinuesa/get_phylomarkers/refs/heads/master/"
        "bin/clustal-omega-1.2.4/src/squid/sre_string.c",
        279, (*buf), (sizeof(char) * (*n)));
    s = *buf + pos;
    if (fgets(s, 129, fp) == NULL)
      return *buf;
    len = strlen(s);
    if (s[len - 1] == '\n')
      return *buf;
    pos += 128;
  }
}


x86 assembly (clang, -O0):
<sre_fgets>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmpl   $0x0,(%rax)
jne    119b <sre_fgets+0x4b>
lea    0xe88(%rip),%rdi
mov    $0xf9,%esi
mov    $0x80,%edx
call   1070 <sre_malloc@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x80,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
mov    -0x20(%rbp),%rdx
call   1040 <fgets@plt>
cmp    $0x0,%rax
jne    11c8 <sre_fgets+0x78>
movq   $0x0,-0x8(%rbp)
jmp    12f4 <sre_fgets+0x1a4>
mov    -0x20(%rbp),%rdi
call   1050 <feof@plt>
cmp    $0x0,%rax
je     11eb <sre_fgets+0x9b>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
jmp    12f4 <sre_fgets+0x1a4>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    1227 <sre_fgets+0xd7>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
jmp    12f4 <sre_fgets+0x1a4>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
sub    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x80,%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x18(%rbp),%rax
movslq (%rax),%rax
shl    $0x0,%rax
mov    %eax,%ecx
lea    0xda4(%rip),%rdi
mov    $0x117,%esi
call   1060 <sre_realloc@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movslq -0x30(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    $0x81,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
jne    12ae <sre_fgets+0x15e>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
jmp    12f4 <sre_fgets+0x1a4>
mov    -0x28(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    12e4 <sre_fgets+0x194>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
jmp    12f4 <sre_fgets+0x1a4>
mov    -0x30(%rbp),%eax
add    $0x80,%eax
mov    %eax,-0x30(%rbp)
jmp    1233 <sre_fgets+0xe3>
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sre_fgets>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r13
mov    (%rsi),%ebx
test   %ebx,%ebx
je     1170 <sre_fgets+0x20>
mov    0x0(%r13),%rdi
jmp    1199 <sre_fgets+0x49>
lea    0xe89(%rip),%rdi
mov    $0x80,%ebx
mov    $0xf9,%esi
mov    $0x80,%edx
call   1070 <sre_malloc@plt>
mov    %rax,%rdi
mov    %rax,0x0(%r13)
movl   $0x80,(%r15)
mov    %ebx,%esi
mov    %r14,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     1299 <sre_fgets+0x149>
mov    %r14,%rdi
call   1050 <feof@plt>
mov    %rax,%rcx
mov    0x0(%r13),%rax
test   %rcx,%rcx
jne    129b <sre_fgets+0x14b>
mov    %rax,%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    0x0(%r13),%rax
movslq %ecx,%rcx
cmpb   $0xa,-0x1(%rcx,%rax,1)
je     129b <sre_fgets+0x14b>
mov    (%r15),%ecx
lea    -0x1(%rcx),%edx
movslq %edx,%rbp
sub    $0xffffff80,%ecx
mov    %ecx,(%r15)
lea    0xe0a(%rip),%rdi
mov    $0x117,%esi
mov    %rax,%rdx
call   1060 <sre_realloc@plt>
mov    %rax,%rbx
mov    %rax,0x0(%r13)
add    %rbp,%rbx
mov    %rbx,%rdi
mov    $0x81,%esi
mov    %r14,(%rsp)
mov    %r14,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     1293 <sre_fgets+0x143>
lea    0x80(%rbp),%r12
nopl   (%rax)
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
cmpb   $0xa,-0x1(%rax,%rbx,1)
je     1293 <sre_fgets+0x143>
lea    0x80(%rbp),%r14
mov    (%r15),%ecx
mov    0x0(%r13),%rdx
sub    $0xffffff80,%ecx
mov    %ecx,(%r15)
lea    0xda4(%rip),%rdi
mov    $0x117,%esi
call   1060 <sre_realloc@plt>
mov    %rax,0x0(%r13)
lea    (%rax,%rbp,1),%rbx
add    $0x80,%rbx
lea    (%rax,%r12,1),%rdi
mov    $0x81,%esi
mov    (%rsp),%rdx
call   1040 <fgets@plt>
sub    $0xffffffffffffff80,%r12
mov    %r14,%rbp
test   %rax,%rax
jne    1230 <sre_fgets+0xe0>
mov    0x0(%r13),%rax
jmp    129b <sre_fgets+0x14b>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [180 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/vinuesa/get_phylomarkers/refs/heads/master/bin/clustal-omega-1.2.4/src/squid/sre_string.c\00"
define i8* @sre_fgets(i8** %0, i32* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
store i8** %0, i8*** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
%11 = load i32*, i32** %6
%12 = load i32, i32* %11
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %3
%15 = call i8* @sre_malloc(i8* getelementptr inbounds ([180 x i8], [180 x i8]* @.str, i64 0, i64 0), i32 249, i32 128)
%16 = load i8**, i8*** %5
store i8* %15, i8** %16
%17 = load i32*, i32** %6
store i32 128, i32* %17
br label %18
18: ; preds = %14, %3
%19 = load i8**, i8*** %5
%20 = load i8*, i8** %19
%21 = load i32*, i32** %6
%22 = load i32, i32* %21
%23 = load i32*, i32** %7
%24 = call i32* @fgets(i8* %20, i32 %22, i32* %23)
%25 = icmp eq i32* %24, null
br i1 %25, label %26, label %27
26: ; preds = %18
store i8* null, i8** %4
br label %96
27: ; preds = %18
%28 = load i32*, i32** %7
%29 = call i64 @feof(i32* %28)
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %27
%32 = load i8**, i8*** %5
%33 = load i8*, i8** %32
store i8* %33, i8** %4
br label %96
34: ; preds = %27
%35 = load i8**, i8*** %5
%36 = load i8*, i8** %35
%37 = call i32 @strlen(i8* %36)
store i32 %37, i32* %9
%38 = load i8**, i8*** %5
%39 = load i8*, i8** %38
%40 = load i32, i32* %9
%41 = sub nsw i32 %40, 1
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8, i8* %39, i64 %42
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = icmp eq i32 %45, 10
br i1 %46, label %47, label %50
47: ; preds = %34
%48 = load i8**, i8*** %5
%49 = load i8*, i8** %48
store i8* %49, i8** %4
br label %96
50: ; preds = %34
%51 = load i32*, i32** %6
%52 = load i32, i32* %51
%53 = sub nsw i32 %52, 1
store i32 %53, i32* %10
br label %54
54: ; preds = %50, %93
%55 = load i32*, i32** %6
%56 = load i32, i32* %55
%57 = add nsw i32 %56, 128
store i32 %57, i32* %55
%58 = load i8**, i8*** %5
%59 = load i8*, i8** %58
%60 = load i32*, i32** %6
%61 = load i32, i32* %60
%62 = sext i32 %61 to i64
%63 = mul i64 1, %62
%64 = trunc i64 %63 to i32
%65 = call i8* @sre_realloc(i8* getelementptr inbounds ([180 x i8], [180 x i8]* @.str, i64 0, i64 0), i32 279, i8* %59, i32 %64)
%66 = load i8**, i8*** %5
store i8* %65, i8** %66
%67 = load i8**, i8*** %5
%68 = load i8*, i8** %67
%69 = load i32, i32* %10
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds i8, i8* %68, i64 %70
store i8* %71, i8** %8
%72 = load i8*, i8** %8
%73 = load i32*, i32** %7
%74 = call i32* @fgets(i8* %72, i32 129, i32* %73)
%75 = icmp eq i32* %74, null
br i1 %75, label %76, label %79
76: ; preds = %54
%77 = load i8**, i8*** %5
%78 = load i8*, i8** %77
store i8* %78, i8** %4
br label %96
79: ; preds = %54
%80 = load i8*, i8** %8
%81 = call i32 @strlen(i8* %80)
store i32 %81, i32* %9
%82 = load i8*, i8** %8
%83 = load i32, i32* %9
%84 = sub nsw i32 %83, 1
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds i8, i8* %82, i64 %85
%87 = load i8, i8* %86
%88 = sext i8 %87 to i32
%89 = icmp eq i32 %88, 10
br i1 %89, label %90, label %93
90: ; preds = %79
%91 = load i8**, i8*** %5
%92 = load i8*, i8** %91
store i8* %92, i8** %4
br label %96
93: ; preds = %79
%94 = load i32, i32* %10
%95 = add nsw i32 %94, 128
store i32 %95, i32* %10
br label %54
96: ; preds = %90, %76, %47, %31, %26
%97 = load i8*, i8** %4
ret i8* %97
}

LLVM IR (-O2):
@.str = [180 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/vinuesa/get_phylomarkers/refs/heads/master/bin/clustal-omega-1.2.4/src/squid/sre_string.c\00"
define i8* @sre_fgets(i8** nocapture %0, i32* nocapture %1, i32* nocapture %2) {
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = load i8*, i8** %0
br label %10
8: ; preds = %3
%9 = tail call i8* @sre_malloc(i8* getelementptr inbounds ([180 x i8], [180 x i8]* @.str, i64 0, i64 0), i32 249, i32 128)
store i8* %9, i8** %0
store i32 128, i32* %1
br label %10
10: ; preds = %6, %8
%11 = phi i32 [ %4, %6 ], [ 128, %8 ]
%12 = phi i8* [ %7, %6 ], [ %9, %8 ]
%13 = tail call i32* @fgets(i8* %12, i32 %11, i32* %2)
%14 = icmp eq i32* %13, null
br i1 %14, label %56, label %15
15: ; preds = %10
%16 = tail call i64 @feof(i32* %2)
%17 = icmp eq i64 %16, 0
%18 = load i8*, i8** %0
br i1 %17, label %19, label %56
19: ; preds = %15
%20 = tail call i32 @strlen(i8* %18)
%21 = load i8*, i8** %0
%22 = add nsw i32 %20, -1
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = load i8, i8* %24
%26 = icmp eq i8 %25, 10
br i1 %26, label %56, label %27
27: ; preds = %19
%28 = load i32, i32* %1
%29 = add i32 %28, -1
%30 = sext i32 %29 to i64
%31 = add nsw i32 %28, 128
store i32 %31, i32* %1
%32 = tail call i8* @sre_realloc(i8* getelementptr inbounds ([180 x i8], [180 x i8]* @.str, i64 0, i64 0), i32 279, i8* %21, i32 %31)
store i8* %32, i8** %0
%33 = getelementptr inbounds i8, i8* %32, i64 %30
%34 = tail call i32* @fgets(i8* %33, i32 129, i32* %2)
%35 = icmp eq i32* %34, null
br i1 %35, label %54, label %36
36: ; preds = %27, %45
%37 = phi i8* [ %51, %45 ], [ %33, %27 ]
%38 = phi i64 [ %46, %45 ], [ %30, %27 ]
%39 = tail call i32 @strlen(i8* %37)
%40 = add nsw i32 %39, -1
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8, i8* %37, i64 %41
%43 = load i8, i8* %42
%44 = icmp eq i8 %43, 10
br i1 %44, label %54, label %45
45: ; preds = %36
%46 = add i64 %38, 128
%47 = load i32, i32* %1
%48 = load i8*, i8** %0
%49 = add nsw i32 %47, 128
store i32 %49, i32* %1
%50 = tail call i8* @sre_realloc(i8* getelementptr inbounds ([180 x i8], [180 x i8]* @.str, i64 0, i64 0), i32 279, i8* %48, i32 %49)
store i8* %50, i8** %0
%51 = getelementptr inbounds i8, i8* %50, i64 %46
%52 = tail call i32* @fgets(i8* %51, i32 129, i32* %2)
%53 = icmp eq i32* %52, null
br i1 %53, label %54, label %36
54: ; preds = %45, %36, %27
%55 = load i8*, i8** %0
br label %56
56: ; preds = %54, %15, %19, %10
%57 = phi i8* [ null, %10 ], [ %21, %19 ], [ %18, %15 ], [ %55, %54 ]
ret i8* %57
}