#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 */
char EOF;
char fgetc(int /*<<< orphan*/ *);
char getc(int /*<<< orphan*/ *);
long iscomment(char *, int /*<<< orphan*/ *);
scalar_t__ malloc(long);
int /*<<< orphan*/ printf(char *);
scalar_t__ realloc(char *, long);
int /*<<< orphan*/ t_error(char *);
char *readandstore_comment(FILE *inputfile, int opt, long maxbuffersize) {
  char *buffer = NULL;
  long int buffer_index = 0, buffer_size = 0;
  if (inputfile == NULL) {
    t_error("You tried to read from a closed file ");
  }
  buffer_size = 256;
  buffer = (char *)malloc(buffer_size * sizeof(char));
  if (buffer == NULL) {
    t_error("Cannot allocate the buffer");
  }
  buffer[buffer_size - 1] = '\0';
  if (opt == 1) {
    buffer_index = iscomment(buffer, inputfile);
  } else {
    buffer[0] = '/';
    buffer[1] = '*';
    buffer[2] = '*';
    buffer_index = 3;
  }
  do {
    if (buffer_index < buffer_size - 2) {
      buffer[buffer_index] = fgetc(inputfile);
      if (buffer[buffer_index] == '*') {
        buffer_index++;
        buffer[buffer_index] = fgetc(inputfile);
        if (buffer[buffer_index] == '/') {
          buffer_index++;
          buffer[buffer_index] = '\0';
          break;
        } else {
          buffer_index++;
        }
      } else {
        ++buffer_index;
      }
    } else {
      if (buffer_size == maxbuffersize) {
        printf("\nWarning::A very long comment has exceeded the maximum  "
               "buffer size\n");
        printf("\nWarnin::Flushing the rest of the comment \n");
        buffer[buffer_size - 8] = ' ';
        buffer[buffer_size - 7] = '.';
        buffer[buffer_size - 6] = '.';
        buffer[buffer_size - 5] = '.';
        buffer[buffer_size - 4] = ' ';
        do {
          do {
            buffer[buffer_size - 3] = getc(inputfile);
          } while (buffer[buffer_size - 3] != '*');
          buffer[buffer_size - 2] = getc(inputfile);
        } while (buffer[buffer_size - 2] != '/');
        if (buffer[buffer_size - 2] == EOF) {
          t_error("Unespected end of file: comment closed by End of file");
        } else {
          break;
        }
      } else if (buffer_size + 256 > maxbuffersize) {
        buffer_size = maxbuffersize;
        buffer = (char *)realloc(buffer, buffer_size * sizeof(char));
        if (buffer == NULL) {
          t_error("Cannot expand the buffer");
        }
        buffer[buffer_size - 1] = '\0';
      } else {
        buffer_size += 256;
        buffer = (char *)realloc(buffer, buffer_size * sizeof(char));
        if (buffer == NULL) {
          t_error("Cannot expand the buffer");
        }
        buffer[buffer_size - 1] = '\0';
      }
    }
  } while (buffer[buffer_index - 1] != EOF);
  if (buffer[buffer_index - 1] == EOF) {
    t_error("Unespected end of file: comment closed by End of file");
  }
  return buffer;
}


x86 assembly (clang, -O0):
<readandstore_comment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    11b2 <readandstore_comment+0x42>
lea    0xe53(%rip),%rdi
call   1070 <t_error@plt>
movq   $0x100,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
shl    $0x0,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11e2 <readandstore_comment+0x72>
lea    0xe49(%rip),%rdi
call   1070 <t_error@plt>
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
cmpl   $0x1,-0xc(%rbp)
jne    1212 <readandstore_comment+0xa2>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1080 <iscomment@plt>
mov    %rax,-0x28(%rbp)
jmp    1231 <readandstore_comment+0xc1>
mov    -0x20(%rbp),%rax
movb   $0x2f,(%rax)
mov    -0x20(%rbp),%rax
movb   $0x2a,0x1(%rax)
mov    -0x20(%rbp),%rax
movb   $0x2a,0x2(%rax)
movq   $0x3,-0x28(%rbp)
jmp    1236 <readandstore_comment+0xc6>
mov    -0x28(%rbp),%rax
mov    -0x30(%rbp),%rcx
sub    $0x2,%rcx
cmp    %rcx,%rax
jge    12ec <readandstore_comment+0x17c>
mov    -0x8(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %al,%dl
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2a,%eax
jne    12db <readandstore_comment+0x16b>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %al,%dl
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2f,%eax
jne    12ca <readandstore_comment+0x15a>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    14e2 <readandstore_comment+0x372>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    12e7 <readandstore_comment+0x177>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    14bb <readandstore_comment+0x34b>
mov    -0x30(%rbp),%rax
cmp    -0x18(%rbp),%rax
jne    140a <readandstore_comment+0x29a>
lea    0xd40(%rip),%rdi
call   1030 <printf@plt>
lea    0xd79(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
sub    $0x8,%rcx
movb   $0x20,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
sub    $0x7,%rcx
movb   $0x2e,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
sub    $0x6,%rcx
movb   $0x2e,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
sub    $0x5,%rcx
movb   $0x2e,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
sub    $0x4,%rcx
movb   $0x20,(%rax,%rcx,1)
jmp    1367 <readandstore_comment+0x1f7>
mov    -0x8(%rbp),%rdi
call   1090 <getc@plt>
mov    %al,%dl
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
sub    $0x3,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
sub    $0x3,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2a,%eax
jne    1367 <readandstore_comment+0x1f7>
mov    -0x8(%rbp),%rdi
call   1090 <getc@plt>
mov    %al,%dl
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
sub    $0x2,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
sub    $0x2,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2f,%eax
jne    1362 <readandstore_comment+0x1f2>
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
sub    $0x2,%rcx
movsbl (%rax,%rcx,1),%eax
mov    0x2c04(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    1400 <readandstore_comment+0x290>
lea    0xcbc(%rip),%rdi
call   1070 <t_error@plt>
jmp    1405 <readandstore_comment+0x295>
jmp    14e2 <readandstore_comment+0x372>
jmp    14b6 <readandstore_comment+0x346>
mov    -0x30(%rbp),%rax
add    $0x100,%rax
cmp    -0x18(%rbp),%rax
jle    1467 <readandstore_comment+0x2f7>
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x30(%rbp),%rsi
shl    $0x0,%rsi
call   1060 <realloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1452 <readandstore_comment+0x2e2>
lea    0xc9b(%rip),%rdi
call   1070 <t_error@plt>
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    14b1 <readandstore_comment+0x341>
mov    -0x30(%rbp),%rax
add    $0x100,%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x30(%rbp),%rsi
shl    $0x0,%rsi
call   1060 <realloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    14a1 <readandstore_comment+0x331>
lea    0xc4c(%rip),%rdi
call   1070 <t_error@plt>
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    14b6 <readandstore_comment+0x346>
jmp    14bb <readandstore_comment+0x34b>
jmp    14c0 <readandstore_comment+0x350>
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
sub    $0x1,%rcx
movsbl (%rax,%rcx,1),%eax
mov    0x2b11(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    1236 <readandstore_comment+0xc6>
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
sub    $0x1,%rcx
movsbl (%rax,%rcx,1),%eax
mov    0x2aef(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    1510 <readandstore_comment+0x3a0>
lea    0xba7(%rip),%rdi
call   1070 <t_error@plt>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readandstore_comment>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %esi,%ebp
mov    %rdi,%r15
test   %rdi,%rdi
jne    1194 <readandstore_comment+0x24>
lea    0xe71(%rip),%rdi
call   1070 <t_error@plt>
mov    $0x100,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    11b2 <readandstore_comment+0x42>
lea    0xe79(%rip),%rdi
call   1070 <t_error@plt>
movb   $0x0,0xff(%rbx)
cmp    $0x1,%ebp
jne    11ce <readandstore_comment+0x5e>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1080 <iscomment@plt>
mov    %rax,%r12
jmp    11dd <readandstore_comment+0x6d>
movw   $0x2a2f,(%rbx)
movb   $0x2a,0x2(%rbx)
mov    $0x3,%r12d
mov    $0x100,%r13d
jmp    120e <readandstore_comment+0x9e>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%r12
mov    %r13,%rbp
mov    -0x1(%r12,%rbx,1),%al
mov    %rbp,%r13
mov    0x2de2(%rip),%rcx
cmp    (%rcx),%al
je     1341 <readandstore_comment+0x1d1>
lea    -0x2(%r13),%rbp
cmp    %rbp,%r12
jge    1250 <readandstore_comment+0xe0>
mov    %r15,%rdi
call   1040 <fgetc@plt>
mov    %al,(%rbx,%r12,1)
cmp    $0x2a,%al
jne    11f0 <readandstore_comment+0x80>
mov    %r15,%rdi
call   1040 <fgetc@plt>
mov    %al,0x1(%rbx,%r12,1)
add    $0x2,%r12
cmp    $0x2f,%al
jne    11f4 <readandstore_comment+0x84>
jmp    1333 <readandstore_comment+0x1c3>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmp    %r14,%r13
jne    12d0 <readandstore_comment+0x160>
lea    0xe34(%rip),%rdi
call   1030 <puts@plt>
lea    0xe6c(%rip),%rdi
call   1030 <puts@plt>
movl   $0x2e2e2e20,-0x8(%rbx,%r14,1)
2e 2e
movb   $0x20,-0x4(%rbx,%r14,1)
nopl   0x0(%rax)
mov    %r15,%rdi
call   1090 <getc@plt>
mov    %al,-0x3(%rbx,%r14,1)
cmp    $0x2a,%al
jne    1280 <readandstore_comment+0x110>
mov    %r15,%rdi
call   1090 <getc@plt>
mov    %al,(%rbx,%rbp,1)
cmp    $0x2f,%al
jne    1280 <readandstore_comment+0x110>
mov    0x2d41(%rip),%rax
mov    (%rax),%al
cmp    $0x2f,%al
jne    1341 <readandstore_comment+0x1d1>
lea    0xd89(%rip),%rdi
call   1070 <t_error@plt>
mov    %r14,%rbp
jmp    11f7 <readandstore_comment+0x87>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0x100(%r13),%rbp
mov    %rbx,%rdi
cmp    %r14,%rbp
jle    1309 <readandstore_comment+0x199>
mov    %r14,%rsi
call   1060 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    12fb <readandstore_comment+0x18b>
lea    0xd81(%rip),%rdi
call   1070 <t_error@plt>
movb   $0x0,-0x1(%rbx,%r14,1)
mov    %r14,%rbp
jmp    11f7 <readandstore_comment+0x87>
mov    %rbp,%rsi
call   1060 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1325 <readandstore_comment+0x1b5>
lea    0xd57(%rip),%rdi
call   1070 <t_error@plt>
movb   $0x0,0xff(%r13,%rbx,1)
jmp    11f7 <readandstore_comment+0x87>
movb   $0x0,(%rbx,%r12,1)
mov    0x2ca9(%rip),%rax
mov    (%rax),%al
cmp    %al,-0x1(%r12,%rbx,1)
jne    1354 <readandstore_comment+0x1e4>
lea    0xcf2(%rip),%rdi
call   1070 <t_error@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [38 x i8] c"You tried to read from a closed file \00"
@.str.1 = [27 x i8] c"Cannot allocate the buffer\00"
@.str.2 = [69 x i8] c"\0AWarning::A very long comment has exceeded the maximum buffer size\0A\00"
@.str.3 = [44 x i8] c"\0AWarnin::Flushing the rest of the comment \0A\00"
@EOF = global i8 0
@.str.4 = [54 x i8] c"Unespected end of file: comment closed by End of file\00"
@.str.5 = [25 x i8] c"Cannot expand the buffer\00"
define i8* @readandstore_comment(i32* %0, i32 %1, i64 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i64
store i32* %0, i32** %4
store i32 %1, i32* %5
store i64 %2, i64* %6
store i8* null, i8** %7
store i64 0, i64* %8
store i64 0, i64* %9
%10 = load i32*, i32** %4
%11 = icmp eq i32* %10, null
br i1 %11, label %12, label %14
12: ; preds = %3
%13 = call i32 @t_error(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %12, %3
store i64 256, i64* %9
%15 = load i64, i64* %9
%16 = mul i64 %15, 1
%17 = call i64 @malloc(i64 %16)
%18 = inttoptr i64 %17 to i8*
store i8* %18, i8** %7
%19 = load i8*, i8** %7
%20 = icmp eq i8* %19, null
br i1 %20, label %21, label %23
21: ; preds = %14
%22 = call i32 @t_error(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
br label %23
23: ; preds = %21, %14
%24 = load i8*, i8** %7
%25 = load i64, i64* %9
%26 = sub nsw i64 %25, 1
%27 = getelementptr inbounds i8, i8* %24, i64 %26
store i8 0, i8* %27
%28 = load i32, i32* %5
%29 = icmp eq i32 %28, 1
br i1 %29, label %30, label %34
30: ; preds = %23
%31 = load i8*, i8** %7
%32 = load i32*, i32** %4
%33 = call i64 @iscomment(i8* %31, i32* %32)
store i64 %33, i64* %8
br label %41
34: ; preds = %23
%35 = load i8*, i8** %7
%36 = getelementptr inbounds i8, i8* %35, i64 0
store i8 47, i8* %36
%37 = load i8*, i8** %7
%38 = getelementptr inbounds i8, i8* %37, i64 1
store i8 42, i8* %38
%39 = load i8*, i8** %7
%40 = getelementptr inbounds i8, i8* %39, i64 2
store i8 42, i8* %40
store i64 3, i64* %8
br label %41
41: ; preds = %34, %30
br label %42
42: ; preds = %200, %41
%43 = load i64, i64* %8
%44 = load i64, i64* %9
%45 = sub nsw i64 %44, 2
%46 = icmp slt i64 %43, %45
br i1 %46, label %47, label %87
47: ; preds = %42
%48 = load i32*, i32** %4
%49 = call signext i8 @fgetc(i32* %48)
%50 = load i8*, i8** %7
%51 = load i64, i64* %8
%52 = getelementptr inbounds i8, i8* %50, i64 %51
store i8 %49, i8* %52
%53 = load i8*, i8** %7
%54 = load i64, i64* %8
%55 = getelementptr inbounds i8, i8* %53, i64 %54
%56 = load i8, i8* %55
%57 = sext i8 %56 to i32
%58 = icmp eq i32 %57, 42
br i1 %58, label %59, label %83
59: ; preds = %47
%60 = load i64, i64* %8
%61 = add nsw i64 %60, 1
store i64 %61, i64* %8
%62 = load i32*, i32** %4
%63 = call signext i8 @fgetc(i32* %62)
%64 = load i8*, i8** %7
%65 = load i64, i64* %8
%66 = getelementptr inbounds i8, i8* %64, i64 %65
store i8 %63, i8* %66
%67 = load i8*, i8** %7
%68 = load i64, i64* %8
%69 = getelementptr inbounds i8, i8* %67, i64 %68
%70 = load i8, i8* %69
%71 = sext i8 %70 to i32
%72 = icmp eq i32 %71, 47
br i1 %72, label %73, label %79
73: ; preds = %59
%74 = load i64, i64* %8
%75 = add nsw i64 %74, 1
store i64 %75, i64* %8
%76 = load i8*, i8** %7
%77 = load i64, i64* %8
%78 = getelementptr inbounds i8, i8* %76, i64 %77
store i8 0, i8* %78
br label %210
79: ; preds = %59
%80 = load i64, i64* %8
%81 = add nsw i64 %80, 1
store i64 %81, i64* %8
br label %82
82: ; preds = %79
br label %86
83: ; preds = %47
%84 = load i64, i64* %8
%85 = add nsw i64 %84, 1
store i64 %85, i64* %8
br label %86
86: ; preds = %83, %82
br label %199
87: ; preds = %42
%88 = load i64, i64* %9
%89 = load i64, i64* %6
%90 = icmp eq i64 %88, %89
br i1 %90, label %91, label %159
91: ; preds = %87
%92 = call i32 @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.2, i64 0, i64 0))
%93 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0))
%94 = load i8*, i8** %7
%95 = load i64, i64* %9
%96 = sub nsw i64 %95, 8
%97 = getelementptr inbounds i8, i8* %94, i64 %96
store i8 32, i8* %97
%98 = load i8*, i8** %7
%99 = load i64, i64* %9
%100 = sub nsw i64 %99, 7
%101 = getelementptr inbounds i8, i8* %98, i64 %100
store i8 46, i8* %101
%102 = load i8*, i8** %7
%103 = load i64, i64* %9
%104 = sub nsw i64 %103, 6
%105 = getelementptr inbounds i8, i8* %102, i64 %104
store i8 46, i8* %105
%106 = load i8*, i8** %7
%107 = load i64, i64* %9
%108 = sub nsw i64 %107, 5
%109 = getelementptr inbounds i8, i8* %106, i64 %108
store i8 46, i8* %109
%110 = load i8*, i8** %7
%111 = load i64, i64* %9
%112 = sub nsw i64 %111, 4
%113 = getelementptr inbounds i8, i8* %110, i64 %112
store i8 32, i8* %113
br label %114
114: ; preds = %137, %91
br label %115
115: ; preds = %122, %114
%116 = load i32*, i32** %4
%117 = call signext i8 @getc(i32* %116)
%118 = load i8*, i8** %7
%119 = load i64, i64* %9
%120 = sub nsw i64 %119, 3
%121 = getelementptr inbounds i8, i8* %118, i64 %120
store i8 %117, i8* %121
br label %122
122: ; preds = %115
%123 = load i8*, i8** %7
%124 = load i64, i64* %9
%125 = sub nsw i64 %124, 3
%126 = getelementptr inbounds i8, i8* %123, i64 %125
%127 = load i8, i8* %126
%128 = sext i8 %127 to i32
%129 = icmp ne i32 %128, 42
br i1 %129, label %115, label %130
130: ; preds = %122
%131 = load i32*, i32** %4
%132 = call signext i8 @getc(i32* %131)
%133 = load i8*, i8** %7
%134 = load i64, i64* %9
%135 = sub nsw i64 %134, 2
%136 = getelementptr inbounds i8, i8* %133, i64 %135
store i8 %132, i8* %136
br label %137
137: ; preds = %130
%138 = load i8*, i8** %7
%139 = load i64, i64* %9
%140 = sub nsw i64 %139, 2
%141 = getelementptr inbounds i8, i8* %138, i64 %140
%142 = load i8, i8* %141
%143 = sext i8 %142 to i32
%144 = icmp ne i32 %143, 47
br i1 %144, label %114, label %145
145: ; preds = %137
%146 = load i8*, i8** %7
%147 = load i64, i64* %9
%148 = sub nsw i64 %147, 2
%149 = getelementptr inbounds i8, i8* %146, i64 %148
%150 = load i8, i8* %149
%151 = sext i8 %150 to i32
%152 = load i8, i8* @EOF
%153 = sext i8 %152 to i32
%154 = icmp eq i32 %151, %153
br i1 %154, label %155, label %157
155: ; preds = %145
%156 = call i32 @t_error(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0))
br label %158
157: ; preds = %145
br label %210
158: ; preds = %155
br label %198
159: ; preds = %87
%160 = load i64, i64* %9
%161 = add nsw i64 %160, 256
%162 = load i64, i64* %6
%163 = icmp sgt i64 %161, %162
br i1 %163, label %164, label %180
164: ; preds = %159
%165 = load i64, i64* %6
store i64 %165, i64* %9
%166 = load i8*, i8** %7
%167 = load i64, i64* %9
%168 = mul i64 %167, 1
%169 = call i64 @realloc(i8* %166, i64 %168)
%170 = inttoptr i64 %169 to i8*
store i8* %170, i8** %7
%171 = load i8*, i8** %7
%172 = icmp eq i8* %171, null
br i1 %172, label %173, label %175
173: ; preds = %164
%174 = call i32 @t_error(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
br label %175
175: ; preds = %173, %164
%176 = load i8*, i8** %7
%177 = load i64, i64* %9
%178 = sub nsw i64 %177, 1
%179 = getelementptr inbounds i8, i8* %176, i64 %178
store i8 0, i8* %179
br label %197
180: ; preds = %159
%181 = load i64, i64* %9
%182 = add nsw i64 %181, 256
store i64 %182, i64* %9
%183 = load i8*, i8** %7
%184 = load i64, i64* %9
%185 = mul i64 %184, 1
%186 = call i64 @realloc(i8* %183, i64 %185)
%187 = inttoptr i64 %186 to i8*
store i8* %187, i8** %7
%188 = load i8*, i8** %7
%189 = icmp eq i8* %188, null
br i1 %189, label %190, label %192
190: ; preds = %180
%191 = call i32 @t_error(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
br label %192
192: ; preds = %190, %180
%193 = load i8*, i8** %7
%194 = load i64, i64* %9
%195 = sub nsw i64 %194, 1
%196 = getelementptr inbounds i8, i8* %193, i64 %195
store i8 0, i8* %196
br label %197
197: ; preds = %192, %175
br label %198
198: ; preds = %197, %158
br label %199
199: ; preds = %198, %86
br label %200
200: ; preds = %199
%201 = load i8*, i8** %7
%202 = load i64, i64* %8
%203 = sub nsw i64 %202, 1
%204 = getelementptr inbounds i8, i8* %201, i64 %203
%205 = load i8, i8* %204
%206 = sext i8 %205 to i32
%207 = load i8, i8* @EOF
%208 = sext i8 %207 to i32
%209 = icmp ne i32 %206, %208
br i1 %209, label %42, label %210
210: ; preds = %200, %157, %73
%211 = load i8*, i8** %7
%212 = load i64, i64* %8
%213 = sub nsw i64 %212, 1
%214 = getelementptr inbounds i8, i8* %211, i64 %213
%215 = load i8, i8* %214
%216 = sext i8 %215 to i32
%217 = load i8, i8* @EOF
%218 = sext i8 %217 to i32
%219 = icmp eq i32 %216, %218
br i1 %219, label %220, label %222
220: ; preds = %210
%221 = call i32 @t_error(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0))
br label %222
222: ; preds = %220, %210
%223 = load i8*, i8** %7
ret i8* %223
}

LLVM IR (-O2):
@.str = [38 x i8] c"You tried to read from a closed file \00"
@.str.1 = [27 x i8] c"Cannot allocate the buffer\00"
@EOF = global i8 0
@.str.4 = [54 x i8] c"Unespected end of file: comment closed by End of file\00"
@.str.5 = [25 x i8] c"Cannot expand the buffer\00"
@str = [68 x i8] c"\0AWarning::A very long comment has exceeded the maximum buffer size\00"
@str.6 = [43 x i8] c"\0AWarnin::Flushing the rest of the comment \00"
define i8* @readandstore_comment(i32* %0, i32 %1, i64 %2) {
%4 = icmp eq i32* %0, null
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @t_error(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %3
%8 = tail call i64 @malloc(i64 256)
%9 = inttoptr i64 %8 to i8*
%10 = icmp eq i64 %8, 0
br i1 %10, label %11, label %13
11: ; preds = %7
%12 = tail call i32 @t_error(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
br label %13
13: ; preds = %11, %7
%14 = getelementptr inbounds i8, i8* %9, i64 255
store i8 0, i8* %14
%15 = icmp eq i32 %1, 1
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = tail call i64 @iscomment(i8* %9, i32* %0)
br label %21
18: ; preds = %13
store i8 47, i8* %9
%19 = getelementptr inbounds i8, i8* %9, i64 1
store i8 42, i8* %19
%20 = getelementptr inbounds i8, i8* %9, i64 2
store i8 42, i8* %20
br label %21
21: ; preds = %18, %16
%22 = phi i64 [ %17, %16 ], [ 3, %18 ]
%23 = add nsw i64 %2, -1
%24 = add nsw i64 %2, -8
%25 = add nsw i64 %2, -7
%26 = add nsw i64 %2, -6
%27 = add nsw i64 %2, -5
%28 = add nsw i64 %2, -4
%29 = add nsw i64 %2, -3
br label %30
30: ; preds = %93, %21
%31 = phi i8* [ %9, %21 ], [ %94, %93 ]
%32 = phi i64 [ %22, %21 ], [ %95, %93 ]
%33 = phi i64 [ 256, %21 ], [ %96, %93 ]
%34 = add nsw i64 %33, -2
%35 = icmp slt i64 %32, %34
br i1 %35, label %36, label %49
36: ; preds = %30
%37 = tail call signext i8 @fgetc(i32* %0)
%38 = getelementptr inbounds i8, i8* %31, i64 %32
store i8 %37, i8* %38
%39 = icmp eq i8 %37, 42
%40 = add nsw i64 %32, 1
br i1 %39, label %41, label %93
41: ; preds = %36
%42 = tail call signext i8 @fgetc(i32* %0)
%43 = getelementptr inbounds i8, i8* %31, i64 %40
store i8 %42, i8* %43
%44 = icmp eq i8 %42, 47
%45 = add nsw i64 %32, 2
br i1 %44, label %46, label %93
46: ; preds = %41
%47 = getelementptr inbounds i8, i8* %31, i64 %45
store i8 0, i8* %47
%48 = load i8, i8* @EOF
br label %102
49: ; preds = %30
%50 = icmp eq i64 %33, %2
br i1 %50, label %51, label %73
51: ; preds = %49
%52 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @str, i64 0, i64 0))
%53 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.6, i64 0, i64 0))
%54 = getelementptr inbounds i8, i8* %31, i64 %24
store i8 32, i8* %54
%55 = getelementptr inbounds i8, i8* %31, i64 %25
store i8 46, i8* %55
%56 = getelementptr inbounds i8, i8* %31, i64 %26
store i8 46, i8* %56
%57 = getelementptr inbounds i8, i8* %31, i64 %27
store i8 46, i8* %57
%58 = getelementptr inbounds i8, i8* %31, i64 %28
store i8 32, i8* %58
%59 = getelementptr inbounds i8, i8* %31, i64 %29
%60 = getelementptr inbounds i8, i8* %31, i64 %34
br label %61
61: ; preds = %64, %51
%62 = tail call signext i8 @getc(i32* %0)
store i8 %62, i8* %59
%63 = icmp eq i8 %62, 42
br i1 %63, label %65, label %64
64: ; preds = %61, %65
br label %61
65: ; preds = %61
%66 = tail call signext i8 @getc(i32* %0)
store i8 %66, i8* %60
%67 = icmp eq i8 %66, 47
br i1 %67, label %68, label %64
68: ; preds = %65
%69 = load i8, i8* @EOF
%70 = icmp eq i8 %69, 47
br i1 %70, label %71, label %102
71: ; preds = %68
%72 = tail call i32 @t_error(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0))
br label %93
73: ; preds = %49
%74 = add nsw i64 %33, 256
%75 = icmp sgt i64 %74, %2
br i1 %75, label %76, label %84
76: ; preds = %73
%77 = tail call i64 @realloc(i8* %31, i64 %2)
%78 = inttoptr i64 %77 to i8*
%79 = icmp eq i64 %77, 0
br i1 %79, label %80, label %82
80: ; preds = %76
%81 = tail call i32 @t_error(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
br label %82
82: ; preds = %80, %76
%83 = getelementptr inbounds i8, i8* %78, i64 %23
store i8 0, i8* %83
br label %93
84: ; preds = %73
%85 = tail call i64 @realloc(i8* %31, i64 %74)
%86 = inttoptr i64 %85 to i8*
%87 = icmp eq i64 %85, 0
br i1 %87, label %88, label %90
88: ; preds = %84
%89 = tail call i32 @t_error(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
br label %90
90: ; preds = %88, %84
%91 = add nsw i64 %33, 255
%92 = getelementptr inbounds i8, i8* %86, i64 %91
store i8 0, i8* %92
br label %93
93: ; preds = %41, %36, %82, %90, %71
%94 = phi i8* [ %31, %71 ], [ %78, %82 ], [ %86, %90 ], [ %31, %36 ], [ %31, %41 ]
%95 = phi i64 [ %32, %71 ], [ %32, %82 ], [ %32, %90 ], [ %40, %36 ], [ %45, %41 ]
%96 = phi i64 [ %2, %71 ], [ %2, %82 ], [ %74, %90 ], [ %33, %36 ], [ %33, %41 ]
%97 = add nsw i64 %95, -1
%98 = getelementptr inbounds i8, i8* %94, i64 %97
%99 = load i8, i8* %98
%100 = load i8, i8* @EOF
%101 = icmp eq i8 %99, %100
br i1 %101, label %102, label %30
102: ; preds = %68, %93, %46
%103 = phi i8 [ %48, %46 ], [ %69, %68 ], [ %99, %93 ]
%104 = phi i8* [ %31, %46 ], [ %31, %68 ], [ %94, %93 ]
%105 = phi i64 [ %45, %46 ], [ %32, %68 ], [ %95, %93 ]
%106 = add nsw i64 %105, -1
%107 = getelementptr inbounds i8, i8* %104, i64 %106
%108 = load i8, i8* %107
%109 = icmp eq i8 %108, %103
br i1 %109, label %110, label %112
110: ; preds = %102
%111 = tail call i32 @t_error(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0))
br label %112
112: ; preds = %110, %102
ret i8* %104
}