#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 */
int ASTIL_ReadLine(int /*<<< orphan*/ *, char *);
scalar_t__ memcmp(char *, char *, int);
int /*<<< orphan*/ memcpy(char *, char *, int);
void ASTIL_ReadComment(FILE *fp, char *line, char *comment) {
  int len = ASTIL_ReadLine(fp, line);
  if (len >= 9 && memcmp(line, "COMMENT: ", 9) == 0) {
    len -= 9;
    memcpy(comment, line + 9, len + 1);
    for (;;) {
      int len2 = ASTIL_ReadLine(fp, line);
      if (len2 >= 9 && memcmp(line, "         ", 9) == 0) {
        if (len < 1000 - 100) {
          comment[len++] = '\n';
          len2 -= 9;
          memcpy(comment + len, line + 9, len2 + 1);
          len += len2;
        }
      } else
        break;
    }
  }
}


x86 assembly (clang, -O0):
<ASTIL_ReadComment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <ASTIL_ReadLine@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x9,-0x1c(%rbp)
jl     123d <ASTIL_ReadComment+0x10d>
mov    -0x10(%rbp),%rdi
lea    0xe97(%rip),%rsi
mov    $0x9,%edx
call   1040 <memcmp@plt>
cmp    $0x0,%rax
jne    123d <ASTIL_ReadComment+0x10d>
mov    -0x1c(%rbp),%eax
sub    $0x9,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x9,%rsi
mov    -0x1c(%rbp),%edx
add    $0x1,%edx
call   1050 <memcpy@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <ASTIL_ReadLine@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x9,-0x20(%rbp)
jl     122e <ASTIL_ReadComment+0xfe>
mov    -0x10(%rbp),%rdi
lea    0xe48(%rip),%rsi
mov    $0x9,%edx
call   1040 <memcmp@plt>
cmp    $0x0,%rax
jne    122e <ASTIL_ReadComment+0xfe>
cmpl   $0x384,-0x1c(%rbp)
jge    1229 <ASTIL_ReadComment+0xf9>
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x1c(%rbp)
movslq %ecx,%rcx
movb   $0xa,(%rax,%rcx,1)
mov    -0x20(%rbp),%eax
sub    $0x9,%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
movslq -0x1c(%rbp),%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
add    $0x9,%rsi
mov    -0x20(%rbp),%edx
add    $0x1,%edx
call   1050 <memcpy@plt>
mov    -0x20(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    1233 <ASTIL_ReadComment+0x103>
jmp    1238 <ASTIL_ReadComment+0x108>
jmp    119d <ASTIL_ReadComment+0x6d>
jmp    123d <ASTIL_ReadComment+0x10d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ASTIL_ReadComment>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r12
mov    %rdi,%r15
call   1030 <ASTIL_ReadLine@plt>
cmp    $0x9,%eax
jl     11f5 <ASTIL_ReadComment+0xc5>
mov    %eax,%ebx
lea    0xea5(%rip),%rsi
mov    %r12,%rdi
mov    $0x9,%edx
call   1040 <memcmp@plt>
test   %rax,%rax
jne    11f5 <ASTIL_ReadComment+0xc5>
lea    0x9(%r12),%r13
lea    -0x8(%rbx),%edx
mov    %r14,%rdi
mov    %r13,%rsi
call   1050 <memcpy@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1030 <ASTIL_ReadLine@plt>
cmp    $0x9,%eax
jl     11f5 <ASTIL_ReadComment+0xc5>
mov    %eax,%ebp
add    $0xfffffff7,%ebx
jmp    11b2 <ASTIL_ReadComment+0x82>
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %r12,%rsi
call   1030 <ASTIL_ReadLine@plt>
mov    %eax,%ebp
cmp    $0x8,%eax
jle    11f5 <ASTIL_ReadComment+0xc5>
mov    %r12,%rdi
lea    0xe4e(%rip),%rsi
mov    $0x9,%edx
call   1040 <memcmp@plt>
test   %rax,%rax
jne    11f5 <ASTIL_ReadComment+0xc5>
cmp    $0x383,%ebx
jg     11a0 <ASTIL_ReadComment+0x70>
movslq %ebx,%rax
movb   $0xa,(%r14,%rax,1)
lea    (%r14,%rax,1),%rdi
add    $0x1,%rdi
lea    -0x8(%rbp),%edx
mov    %r13,%rsi
call   1050 <memcpy@plt>
add    %ebp,%ebx
add    $0xfffffff8,%ebx
jmp    11a0 <ASTIL_ReadComment+0x70>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"COMMENT: \00"
@.str.1 = [10 x i8] c" \00"
define void @ASTIL_ReadComment(i32* %0, i8* %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%9 = load i32*, i32** %4
%10 = load i8*, i8** %5
%11 = call i32 @ASTIL_ReadLine(i32* %9, i8* %10)
store i32 %11, i32* %7
%12 = load i32, i32* %7
%13 = icmp sge i32 %12, 9
br i1 %13, label %14, label %64
14: ; preds = %3
%15 = load i8*, i8** %5
%16 = call i64 @memcmp(i8* %15, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 9)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %64
18: ; preds = %14
%19 = load i32, i32* %7
%20 = sub nsw i32 %19, 9
store i32 %20, i32* %7
%21 = load i8*, i8** %6
%22 = load i8*, i8** %5
%23 = getelementptr inbounds i8, i8* %22, i64 9
%24 = load i32, i32* %7
%25 = add nsw i32 %24, 1
%26 = call i32 @memcpy(i8* %21, i8* %23, i32 %25)
br label %27
27: ; preds = %62, %18
%28 = load i32*, i32** %4
%29 = load i8*, i8** %5
%30 = call i32 @ASTIL_ReadLine(i32* %28, i8* %29)
store i32 %30, i32* %8
%31 = load i32, i32* %8
%32 = icmp sge i32 %31, 9
br i1 %32, label %33, label %61
33: ; preds = %27
%34 = load i8*, i8** %5
%35 = call i64 @memcmp(i8* %34, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 9)
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %61
37: ; preds = %33
%38 = load i32, i32* %7
%39 = icmp slt i32 %38, 900
br i1 %39, label %40, label %60
40: ; preds = %37
%41 = load i8*, i8** %6
%42 = load i32, i32* %7
%43 = add nsw i32 %42, 1
store i32 %43, i32* %7
%44 = sext i32 %42 to i64
%45 = getelementptr inbounds i8, i8* %41, i64 %44
store i8 10, i8* %45
%46 = load i32, i32* %8
%47 = sub nsw i32 %46, 9
store i32 %47, i32* %8
%48 = load i8*, i8** %6
%49 = load i32, i32* %7
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i8, i8* %48, i64 %50
%52 = load i8*, i8** %5
%53 = getelementptr inbounds i8, i8* %52, i64 9
%54 = load i32, i32* %8
%55 = add nsw i32 %54, 1
%56 = call i32 @memcpy(i8* %51, i8* %53, i32 %55)
%57 = load i32, i32* %8
%58 = load i32, i32* %7
%59 = add nsw i32 %58, %57
store i32 %59, i32* %7
br label %60
60: ; preds = %40, %37
br label %62
61: ; preds = %33, %27
br label %63
62: ; preds = %60
br label %27
63: ; preds = %61
br label %64
64: ; preds = %63, %14, %3
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"COMMENT: \00"
@.str.1 = [10 x i8] c" \00"
define void @ASTIL_ReadComment(i32* %0, i8* %1, i8* %2) {
%4 = tail call i32 @ASTIL_ReadLine(i32* %0, i8* %1)
%5 = icmp sgt i32 %4, 8
br i1 %5, label %6, label %38
6: ; preds = %3
%7 = tail call i64 @memcmp(i8* %1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 9)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %38
9: ; preds = %6
%10 = getelementptr inbounds i8, i8* %1, i64 9
%11 = add nsw i32 %4, -8
%12 = tail call i32 @memcpy(i8* %2, i8* %10, i32 %11)
%13 = tail call i32 @ASTIL_ReadLine(i32* %0, i8* %1)
%14 = icmp sgt i32 %13, 8
br i1 %14, label %15, label %38
15: ; preds = %9
%16 = add nsw i32 %4, -9
br label %17
17: ; preds = %15, %34
%18 = phi i32 [ %36, %34 ], [ %13, %15 ]
%19 = phi i32 [ %35, %34 ], [ %16, %15 ]
%20 = tail call i64 @memcmp(i8* %1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 9)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %38
22: ; preds = %17
%23 = icmp slt i32 %19, 900
br i1 %23, label %24, label %34
24: ; preds = %22
%25 = add nsw i32 %19, 1
%26 = sext i32 %19 to i64
%27 = getelementptr inbounds i8, i8* %2, i64 %26
store i8 10, i8* %27
%28 = add nsw i32 %18, -9
%29 = sext i32 %25 to i64
%30 = getelementptr inbounds i8, i8* %2, i64 %29
%31 = add nsw i32 %18, -8
%32 = tail call i32 @memcpy(i8* %30, i8* %10, i32 %31)
%33 = add nsw i32 %28, %25
br label %34
34: ; preds = %24, %22
%35 = phi i32 [ %33, %24 ], [ %19, %22 ]
%36 = tail call i32 @ASTIL_ReadLine(i32* %0, i8* %1)
%37 = icmp sgt i32 %36, 8
br i1 %37, label %17, label %38
38: ; preds = %17, %34, %9, %6, %3
ret void
}