#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*/ *);
int /*<<< orphan*/ free(char *);
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 *);
int read_comment(FILE *inputfile, int opt, long maxbuffersize, short print) {
  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';
  buffer[0] = buffer[1] = buffer[2] = '\0';
  if (opt == 1) {
    buffer_index = iscomment(buffer, inputfile);
  } else {
    buffer[0] = '/';
    buffer[1] = '*';
    buffer[2] = '*';
    buffer_index = 3;
  }
  if (buffer_index == 0) {
    printf("\nWarning:: no comment found\n");
    return 0;
  }
  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");
  }
  if (print)
    printf("\n%s\n", buffer);
  free(buffer);
  return buffer_index;
}


x86 assembly (clang, -O0):
<read_comment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %cx,%ax
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ax,-0x22(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11c9 <read_comment+0x49>
lea    0xe3c(%rip),%rdi
call   1080 <t_error@plt>
movq   $0x100,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
shl    $0x0,%rdi
call   1060 <malloc@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    11f9 <read_comment+0x79>
lea    0xe32(%rip),%rdi
call   1080 <t_error@plt>
mov    -0x30(%rbp),%rax
mov    -0x40(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x30(%rbp),%rax
movb   $0x0,0x2(%rax)
mov    -0x30(%rbp),%rax
movb   $0x0,0x1(%rax)
mov    -0x30(%rbp),%rax
movb   $0x0,(%rax)
cmpl   $0x1,-0x14(%rbp)
jne    1240 <read_comment+0xc0>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1090 <iscomment@plt>
mov    %rax,-0x38(%rbp)
jmp    125f <read_comment+0xdf>
mov    -0x30(%rbp),%rax
movb   $0x2f,(%rax)
mov    -0x30(%rbp),%rax
movb   $0x2a,0x1(%rax)
mov    -0x30(%rbp),%rax
movb   $0x2a,0x2(%rax)
movq   $0x3,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    1284 <read_comment+0x104>
lea    0xdd0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1594 <read_comment+0x414>
jmp    1289 <read_comment+0x109>
mov    -0x38(%rbp),%rax
mov    -0x40(%rbp),%rcx
sub    $0x2,%rcx
cmp    %rcx,%rax
jge    133f <read_comment+0x1bf>
mov    -0x10(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %al,%dl
mov    -0x30(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x30(%rbp),%rax
mov    -0x38(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2a,%eax
jne    132e <read_comment+0x1ae>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %al,%dl
mov    -0x30(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x30(%rbp),%rax
mov    -0x38(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2f,%eax
jne    131d <read_comment+0x19d>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rax
mov    -0x38(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1539 <read_comment+0x3b9>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    133a <read_comment+0x1ba>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1512 <read_comment+0x392>
mov    -0x40(%rbp),%rax
cmp    -0x20(%rbp),%rax
jne    1461 <read_comment+0x2e1>
lea    0xd0a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd41(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%rax
mov    -0x40(%rbp),%rcx
sub    $0x8,%rcx
movb   $0x20,(%rax,%rcx,1)
mov    -0x30(%rbp),%rax
mov    -0x40(%rbp),%rcx
sub    $0x7,%rcx
movb   $0x2e,(%rax,%rcx,1)
mov    -0x30(%rbp),%rax
mov    -0x40(%rbp),%rcx
sub    $0x6,%rcx
movb   $0x2e,(%rax,%rcx,1)
mov    -0x30(%rbp),%rax
mov    -0x40(%rbp),%rcx
sub    $0x5,%rcx
movb   $0x2e,(%rax,%rcx,1)
mov    -0x30(%rbp),%rax
mov    -0x40(%rbp),%rcx
sub    $0x4,%rcx
movb   $0x20,(%rax,%rcx,1)
jmp    13be <read_comment+0x23e>
mov    -0x10(%rbp),%rdi
call   10a0 <getc@plt>
mov    %al,%dl
mov    -0x30(%rbp),%rax
mov    -0x40(%rbp),%rcx
sub    $0x3,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x30(%rbp),%rax
mov    -0x40(%rbp),%rcx
sub    $0x3,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2a,%eax
jne    13be <read_comment+0x23e>
mov    -0x10(%rbp),%rdi
call   10a0 <getc@plt>
mov    %al,%dl
mov    -0x30(%rbp),%rax
mov    -0x40(%rbp),%rcx
sub    $0x2,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x30(%rbp),%rax
mov    -0x40(%rbp),%rcx
sub    $0x2,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2f,%eax
jne    13b9 <read_comment+0x239>
mov    -0x30(%rbp),%rax
mov    -0x40(%rbp),%rcx
sub    $0x2,%rcx
movsbl (%rax,%rcx,1),%eax
mov    0x2bad(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    1457 <read_comment+0x2d7>
lea    0xc82(%rip),%rdi
call   1080 <t_error@plt>
jmp    145c <read_comment+0x2dc>
jmp    1539 <read_comment+0x3b9>
jmp    150d <read_comment+0x38d>
mov    -0x40(%rbp),%rax
add    $0x100,%rax
cmp    -0x20(%rbp),%rax
jle    14be <read_comment+0x33e>
mov    -0x20(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x40(%rbp),%rsi
shl    $0x0,%rsi
call   1070 <realloc@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    14a9 <read_comment+0x329>
lea    0xc61(%rip),%rdi
call   1080 <t_error@plt>
mov    -0x30(%rbp),%rax
mov    -0x40(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1508 <read_comment+0x388>
mov    -0x40(%rbp),%rax
add    $0x100,%rax
mov    %rax,-0x40(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x40(%rbp),%rsi
shl    $0x0,%rsi
call   1070 <realloc@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    14f8 <read_comment+0x378>
lea    0xc12(%rip),%rdi
call   1080 <t_error@plt>
mov    -0x30(%rbp),%rax
mov    -0x40(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    150d <read_comment+0x38d>
jmp    1512 <read_comment+0x392>
jmp    1517 <read_comment+0x397>
mov    -0x30(%rbp),%rax
mov    -0x38(%rbp),%rcx
sub    $0x1,%rcx
movsbl (%rax,%rcx,1),%eax
mov    0x2aba(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    1289 <read_comment+0x109>
mov    -0x30(%rbp),%rax
mov    -0x38(%rbp),%rcx
sub    $0x1,%rcx
movsbl (%rax,%rcx,1),%eax
mov    0x2a98(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    1567 <read_comment+0x3e7>
lea    0xb6d(%rip),%rdi
call   1080 <t_error@plt>
cmpw   $0x0,-0x22(%rbp)
je     1584 <read_comment+0x404>
mov    -0x30(%rbp),%rsi
lea    0xba1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_comment>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%ebp
mov    %rdx,%r12
mov    %esi,%r14d
mov    %rdi,%r15
test   %rdi,%rdi
jne    11b7 <read_comment+0x27>
lea    0xe4e(%rip),%rdi
call   1090 <t_error@plt>
mov    $0x100,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    11d5 <read_comment+0x45>
lea    0xe56(%rip),%rdi
call   1090 <t_error@plt>
movb   $0x0,0xff(%rbx)
movb   $0x0,0x2(%rbx)
movw   $0x0,(%rbx)
cmp    $0x1,%r14d
jne    1211 <read_comment+0x81>
mov    %rbx,%rdi
mov    %r15,%rsi
call   10a0 <iscomment@plt>
mov    %rax,%rcx
test   %rax,%rax
jne    121f <read_comment+0x8f>
lea    0xeff(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
jmp    13c1 <read_comment+0x231>
movw   $0x2a2f,(%rbx)
movb   $0x2a,0x2(%rbx)
mov    $0x3,%ecx
mov    %ebp,0x4(%rsp)
mov    $0x100,%r13d
jmp    1250 <read_comment+0xc0>
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rcx
add    $0x1,%rcx
mov    %r13,%r14
mov    -0x1(%rcx,%rbx,1),%al
mov    %r14,%r13
mov    0x2da0(%rip),%rdx
cmp    (%rdx),%al
je     1388 <read_comment+0x1f8>
lea    -0x2(%r13),%rbp
cmp    %rbp,%rcx
jge    1290 <read_comment+0x100>
mov    %r15,%rdi
mov    %rcx,%rbp
call   1060 <fgetc@plt>
mov    %al,(%rbx,%rbp,1)
cmp    $0x2a,%al
jne    1230 <read_comment+0xa0>
mov    %r15,%rdi
call   1060 <fgetc@plt>
mov    %rbp,%rcx
mov    %al,0x1(%rbx,%rbp,1)
add    $0x2,%rcx
cmp    $0x2f,%al
jne    1237 <read_comment+0xa7>
jmp    1376 <read_comment+0x1e6>
nopw   0x0(%rax,%rax,1)
cmp    %r12,%r13
jne    1310 <read_comment+0x180>
mov    %rcx,%r13
lea    0xdf6(%rip),%rdi
call   1040 <puts@plt>
lea    0xe2e(%rip),%rdi
call   1040 <puts@plt>
movl   $0x2e2e2e20,-0x8(%rbx,%r12,1)
2e 2e
movb   $0x20,-0x4(%rbx,%r12,1)
nop
mov    %r15,%rdi
call   10b0 <getc@plt>
mov    %al,-0x3(%rbx,%r12,1)
cmp    $0x2a,%al
jne    12c0 <read_comment+0x130>
mov    %r15,%rdi
call   10b0 <getc@plt>
mov    %al,(%rbx,%rbp,1)
cmp    $0x2f,%al
jne    12c0 <read_comment+0x130>
mov    0x2d01(%rip),%rax
mov    (%rax),%al
cmp    $0x2f,%al
jne    1385 <read_comment+0x1f5>
lea    0xd49(%rip),%rdi
call   1090 <t_error@plt>
mov    %r12,%r14
mov    %r13,%rcx
jmp    123a <read_comment+0xaa>
nopl   0x0(%rax,%rax,1)
mov    %rcx,%rbp
lea    0x100(%r13),%r14
mov    %rbx,%rdi
cmp    %r12,%r14
jle    1349 <read_comment+0x1b9>
mov    %r12,%rsi
call   1080 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    133e <read_comment+0x1ae>
lea    0xd3e(%rip),%rdi
call   1090 <t_error@plt>
movb   $0x0,-0x1(%rbx,%r12,1)
mov    %r12,%r14
jmp    136e <read_comment+0x1de>
mov    %r14,%rsi
call   1080 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1365 <read_comment+0x1d5>
lea    0xd17(%rip),%rdi
call   1090 <t_error@plt>
movb   $0x0,0xff(%r13,%rbx,1)
mov    %rbp,%rcx
jmp    123a <read_comment+0xaa>
movb   $0x0,(%rbx,%rcx,1)
mov    0x2c67(%rip),%rax
mov    (%rax),%al
jmp    1388 <read_comment+0x1f8>
mov    %r13,%rcx
cmp    %al,-0x1(%rcx,%rbx,1)
mov    %rcx,%rbp
jne    139d <read_comment+0x20d>
lea    0xca9(%rip),%rdi
call   1090 <t_error@plt>
cmpw   $0x0,0x4(%rsp)
je     13b6 <read_comment+0x226>
lea    0xce4(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %rbp,%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 = [29 x i8] c"\0AWarning:: no comment found\0A\00"
@.str.3 = [69 x i8] c"\0AWarning::A very long comment has exceeded the maximum buffer size\0A\00"
@.str.4 = [44 x i8] c"\0AWarnin::Flushing the rest of the comment \0A\00"
@EOF = global i8 0
@.str.5 = [54 x i8] c"Unespected end of file: comment closed by End of file\00"
@.str.6 = [25 x i8] c"Cannot expand the buffer\00"
@.str.7 = [5 x i8] c"\0A%s\0A\00"
define i32 @read_comment(i32* %0, i32 %1, i64 %2, i16 signext %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i64
%9 = alloca i16
%10 = alloca i8*
%11 = alloca i64
%12 = alloca i64
store i32* %0, i32** %6
store i32 %1, i32* %7
store i64 %2, i64* %8
store i16 %3, i16* %9
store i8* null, i8** %10
store i64 0, i64* %11
store i64 0, i64* %12
%13 = load i32*, i32** %6
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %17
15: ; preds = %4
%16 = call i32 @t_error(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %17
17: ; preds = %15, %4
store i64 256, i64* %12
%18 = load i64, i64* %12
%19 = mul i64 %18, 1
%20 = call i64 @malloc(i64 %19)
%21 = inttoptr i64 %20 to i8*
store i8* %21, i8** %10
%22 = load i8*, i8** %10
%23 = icmp eq i8* %22, null
br i1 %23, label %24, label %26
24: ; preds = %17
%25 = call i32 @t_error(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
br label %26
26: ; preds = %24, %17
%27 = load i8*, i8** %10
%28 = load i64, i64* %12
%29 = sub nsw i64 %28, 1
%30 = getelementptr inbounds i8, i8* %27, i64 %29
store i8 0, i8* %30
%31 = load i8*, i8** %10
%32 = getelementptr inbounds i8, i8* %31, i64 2
store i8 0, i8* %32
%33 = load i8*, i8** %10
%34 = getelementptr inbounds i8, i8* %33, i64 1
store i8 0, i8* %34
%35 = load i8*, i8** %10
%36 = getelementptr inbounds i8, i8* %35, i64 0
store i8 0, i8* %36
%37 = load i32, i32* %7
%38 = icmp eq i32 %37, 1
br i1 %38, label %39, label %43
39: ; preds = %26
%40 = load i8*, i8** %10
%41 = load i32*, i32** %6
%42 = call i64 @iscomment(i8* %40, i32* %41)
store i64 %42, i64* %11
br label %50
43: ; preds = %26
%44 = load i8*, i8** %10
%45 = getelementptr inbounds i8, i8* %44, i64 0
store i8 47, i8* %45
%46 = load i8*, i8** %10
%47 = getelementptr inbounds i8, i8* %46, i64 1
store i8 42, i8* %47
%48 = load i8*, i8** %10
%49 = getelementptr inbounds i8, i8* %48, i64 2
store i8 42, i8* %49
store i64 3, i64* %11
br label %50
50: ; preds = %43, %39
%51 = load i64, i64* %11
%52 = icmp eq i64 %51, 0
br i1 %52, label %53, label %55
53: ; preds = %50
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %5
br label %247
55: ; preds = %50
br label %56
56: ; preds = %214, %55
%57 = load i64, i64* %11
%58 = load i64, i64* %12
%59 = sub nsw i64 %58, 2
%60 = icmp slt i64 %57, %59
br i1 %60, label %61, label %101
61: ; preds = %56
%62 = load i32*, i32** %6
%63 = call signext i8 @fgetc(i32* %62)
%64 = load i8*, i8** %10
%65 = load i64, i64* %11
%66 = getelementptr inbounds i8, i8* %64, i64 %65
store i8 %63, i8* %66
%67 = load i8*, i8** %10
%68 = load i64, i64* %11
%69 = getelementptr inbounds i8, i8* %67, i64 %68
%70 = load i8, i8* %69
%71 = sext i8 %70 to i32
%72 = icmp eq i32 %71, 42
br i1 %72, label %73, label %97
73: ; preds = %61
%74 = load i64, i64* %11
%75 = add nsw i64 %74, 1
store i64 %75, i64* %11
%76 = load i32*, i32** %6
%77 = call signext i8 @fgetc(i32* %76)
%78 = load i8*, i8** %10
%79 = load i64, i64* %11
%80 = getelementptr inbounds i8, i8* %78, i64 %79
store i8 %77, i8* %80
%81 = load i8*, i8** %10
%82 = load i64, i64* %11
%83 = getelementptr inbounds i8, i8* %81, i64 %82
%84 = load i8, i8* %83
%85 = sext i8 %84 to i32
%86 = icmp eq i32 %85, 47
br i1 %86, label %87, label %93
87: ; preds = %73
%88 = load i64, i64* %11
%89 = add nsw i64 %88, 1
store i64 %89, i64* %11
%90 = load i8*, i8** %10
%91 = load i64, i64* %11
%92 = getelementptr inbounds i8, i8* %90, i64 %91
store i8 0, i8* %92
br label %224
93: ; preds = %73
%94 = load i64, i64* %11
%95 = add nsw i64 %94, 1
store i64 %95, i64* %11
br label %96
96: ; preds = %93
br label %100
97: ; preds = %61
%98 = load i64, i64* %11
%99 = add nsw i64 %98, 1
store i64 %99, i64* %11
br label %100
100: ; preds = %97, %96
br label %213
101: ; preds = %56
%102 = load i64, i64* %12
%103 = load i64, i64* %8
%104 = icmp eq i64 %102, %103
br i1 %104, label %105, label %173
105: ; preds = %101
%106 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.3, i64 0, i64 0))
%107 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0))
%108 = load i8*, i8** %10
%109 = load i64, i64* %12
%110 = sub nsw i64 %109, 8
%111 = getelementptr inbounds i8, i8* %108, i64 %110
store i8 32, i8* %111
%112 = load i8*, i8** %10
%113 = load i64, i64* %12
%114 = sub nsw i64 %113, 7
%115 = getelementptr inbounds i8, i8* %112, i64 %114
store i8 46, i8* %115
%116 = load i8*, i8** %10
%117 = load i64, i64* %12
%118 = sub nsw i64 %117, 6
%119 = getelementptr inbounds i8, i8* %116, i64 %118
store i8 46, i8* %119
%120 = load i8*, i8** %10
%121 = load i64, i64* %12
%122 = sub nsw i64 %121, 5
%123 = getelementptr inbounds i8, i8* %120, i64 %122
store i8 46, i8* %123
%124 = load i8*, i8** %10
%125 = load i64, i64* %12
%126 = sub nsw i64 %125, 4
%127 = getelementptr inbounds i8, i8* %124, i64 %126
store i8 32, i8* %127
br label %128
128: ; preds = %151, %105
br label %129
129: ; preds = %136, %128
%130 = load i32*, i32** %6
%131 = call signext i8 @getc(i32* %130)
%132 = load i8*, i8** %10
%133 = load i64, i64* %12
%134 = sub nsw i64 %133, 3
%135 = getelementptr inbounds i8, i8* %132, i64 %134
store i8 %131, i8* %135
br label %136
136: ; preds = %129
%137 = load i8*, i8** %10
%138 = load i64, i64* %12
%139 = sub nsw i64 %138, 3
%140 = getelementptr inbounds i8, i8* %137, i64 %139
%141 = load i8, i8* %140
%142 = sext i8 %141 to i32
%143 = icmp ne i32 %142, 42
br i1 %143, label %129, label %144
144: ; preds = %136
%145 = load i32*, i32** %6
%146 = call signext i8 @getc(i32* %145)
%147 = load i8*, i8** %10
%148 = load i64, i64* %12
%149 = sub nsw i64 %148, 2
%150 = getelementptr inbounds i8, i8* %147, i64 %149
store i8 %146, i8* %150
br label %151
151: ; preds = %144
%152 = load i8*, i8** %10
%153 = load i64, i64* %12
%154 = sub nsw i64 %153, 2
%155 = getelementptr inbounds i8, i8* %152, i64 %154
%156 = load i8, i8* %155
%157 = sext i8 %156 to i32
%158 = icmp ne i32 %157, 47
br i1 %158, label %128, label %159
159: ; preds = %151
%160 = load i8*, i8** %10
%161 = load i64, i64* %12
%162 = sub nsw i64 %161, 2
%163 = getelementptr inbounds i8, i8* %160, i64 %162
%164 = load i8, i8* %163
%165 = sext i8 %164 to i32
%166 = load i8, i8* @EOF
%167 = sext i8 %166 to i32
%168 = icmp eq i32 %165, %167
br i1 %168, label %169, label %171
169: ; preds = %159
%170 = call i32 @t_error(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.5, i64 0, i64 0))
br label %172
171: ; preds = %159
br label %224
172: ; preds = %169
br label %212
173: ; preds = %101
%174 = load i64, i64* %12
%175 = add nsw i64 %174, 256
%176 = load i64, i64* %8
%177 = icmp sgt i64 %175, %176
br i1 %177, label %178, label %194
178: ; preds = %173
%179 = load i64, i64* %8
store i64 %179, i64* %12
%180 = load i8*, i8** %10
%181 = load i64, i64* %12
%182 = mul i64 %181, 1
%183 = call i64 @realloc(i8* %180, i64 %182)
%184 = inttoptr i64 %183 to i8*
store i8* %184, i8** %10
%185 = load i8*, i8** %10
%186 = icmp eq i8* %185, null
br i1 %186, label %187, label %189
187: ; preds = %178
%188 = call i32 @t_error(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0))
br label %189
189: ; preds = %187, %178
%190 = load i8*, i8** %10
%191 = load i64, i64* %12
%192 = sub nsw i64 %191, 1
%193 = getelementptr inbounds i8, i8* %190, i64 %192
store i8 0, i8* %193
br label %211
194: ; preds = %173
%195 = load i64, i64* %12
%196 = add nsw i64 %195, 256
store i64 %196, i64* %12
%197 = load i8*, i8** %10
%198 = load i64, i64* %12
%199 = mul i64 %198, 1
%200 = call i64 @realloc(i8* %197, i64 %199)
%201 = inttoptr i64 %200 to i8*
store i8* %201, i8** %10
%202 = load i8*, i8** %10
%203 = icmp eq i8* %202, null
br i1 %203, label %204, label %206
204: ; preds = %194
%205 = call i32 @t_error(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0))
br label %206
206: ; preds = %204, %194
%207 = load i8*, i8** %10
%208 = load i64, i64* %12
%209 = sub nsw i64 %208, 1
%210 = getelementptr inbounds i8, i8* %207, i64 %209
store i8 0, i8* %210
br label %211
211: ; preds = %206, %189
br label %212
212: ; preds = %211, %172
br label %213
213: ; preds = %212, %100
br label %214
214: ; preds = %213
%215 = load i8*, i8** %10
%216 = load i64, i64* %11
%217 = sub nsw i64 %216, 1
%218 = getelementptr inbounds i8, i8* %215, i64 %217
%219 = load i8, i8* %218
%220 = sext i8 %219 to i32
%221 = load i8, i8* @EOF
%222 = sext i8 %221 to i32
%223 = icmp ne i32 %220, %222
br i1 %223, label %56, label %224
224: ; preds = %214, %171, %87
%225 = load i8*, i8** %10
%226 = load i64, i64* %11
%227 = sub nsw i64 %226, 1
%228 = getelementptr inbounds i8, i8* %225, i64 %227
%229 = load i8, i8* %228
%230 = sext i8 %229 to i32
%231 = load i8, i8* @EOF
%232 = sext i8 %231 to i32
%233 = icmp eq i32 %230, %232
br i1 %233, label %234, label %236
234: ; preds = %224
%235 = call i32 @t_error(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.5, i64 0, i64 0))
br label %236
236: ; preds = %234, %224
%237 = load i16, i16* %9
%238 = icmp ne i16 %237, 0
br i1 %238, label %239, label %242
239: ; preds = %236
%240 = load i8*, i8** %10
%241 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* %240)
br label %242
242: ; preds = %239, %236
%243 = load i8*, i8** %10
%244 = call i32 @free(i8* %243)
%245 = load i64, i64* %11
%246 = trunc i64 %245 to i32
store i32 %246, i32* %5
br label %247
247: ; preds = %242, %53
%248 = load i32, i32* %5
ret i32 %248
}

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