#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 /*<<< orphan*/ SEEK_SET;
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, long, int /*<<< orphan*/);
long ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ skip_whitespaces(int /*<<< orphan*/ *);
scalar_t__ strcmp(char *, char *);
int iscomment(char *buffer, FILE *inputfile) {
  long buffer_index = 0, pos;
  pos = ftell(inputfile);
  skip_whitespaces(inputfile);
  while (buffer_index < 3) {
    buffer[buffer_index] = fgetc(inputfile);
    buffer_index++;
  }
  buffer[buffer_index] = '\0';
  if (strcmp(buffer, "/**") != 0) {
    fseek(inputfile, pos, SEEK_SET);
    return buffer_index = 0;
  } else {
    return buffer_index;
  }
}


x86 assembly (clang, -O0):
<iscomment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <ftell@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <skip_whitespaces@plt>
cmpq   $0x3,-0x20(%rbp)
jge    11b0 <iscomment+0x60>
mov    -0x18(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %al,%dl
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    117e <iscomment+0x2e>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rdi
lea    0xe39(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     1200 <iscomment+0xb0>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    0x2dfb(%rip),%rax
mov    (%rax),%edx
call   1070 <fseek@plt>
movq   $0x0,-0x20(%rbp)
movl   $0x0,-0x4(%rbp)
jmp    1207 <iscomment+0xb7>
mov    -0x20(%rbp),%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iscomment>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1060 <ftell@plt>
mov    %rax,%r14
mov    %r15,%rdi
call   1030 <skip_whitespaces@plt>
mov    %r15,%rdi
call   1040 <fgetc@plt>
mov    %al,(%rbx)
mov    %r15,%rdi
call   1040 <fgetc@plt>
mov    %al,0x1(%rbx)
mov    %r15,%rdi
call   1040 <fgetc@plt>
mov    %al,0x2(%rbx)
movb   $0x0,0x3(%rbx)
lea    0xe67(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11be <iscomment+0x6e>
mov    0x2e33(%rip),%rax
mov    (%rax),%edx
mov    %r15,%rdi
mov    %r14,%rsi
call   1070 <fseek@plt>
xor    %eax,%eax
jmp    11c3 <iscomment+0x73>
mov    $0x3,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"/**\00"
@SEEK_SET = global i32 0
define i32 @iscomment(i8* %0, i32* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i64
%7 = alloca i64
store i8* %0, i8** %4
store i32* %1, i32** %5
store i64 0, i64* %6
%8 = load i32*, i32** %5
%9 = call i64 @ftell(i32* %8)
store i64 %9, i64* %7
%10 = load i32*, i32** %5
%11 = call i32 @skip_whitespaces(i32* %10)
br label %12
12: ; preds = %15, %2
%13 = load i64, i64* %6
%14 = icmp slt i64 %13, 3
br i1 %14, label %15, label %23
15: ; preds = %12
%16 = load i32*, i32** %5
%17 = call signext i8 @fgetc(i32* %16)
%18 = load i8*, i8** %4
%19 = load i64, i64* %6
%20 = getelementptr inbounds i8, i8* %18, i64 %19
store i8 %17, i8* %20
%21 = load i64, i64* %6
%22 = add nsw i64 %21, 1
store i64 %22, i64* %6
br label %12
23: ; preds = %12
%24 = load i8*, i8** %4
%25 = load i64, i64* %6
%26 = getelementptr inbounds i8, i8* %24, i64 %25
store i8 0, i8* %26
%27 = load i8*, i8** %4
%28 = call i64 @strcmp(i8* %27, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %35
30: ; preds = %23
%31 = load i32*, i32** %5
%32 = load i64, i64* %7
%33 = load i32, i32* @SEEK_SET
%34 = call i32 @fseek(i32* %31, i64 %32, i32 %33)
store i64 0, i64* %6
store i32 0, i32* %3
br label %38
35: ; preds = %23
%36 = load i64, i64* %6
%37 = trunc i64 %36 to i32
store i32 %37, i32* %3
br label %38
38: ; preds = %35, %30
%39 = load i32, i32* %3
ret i32 %39
}

LLVM IR (-O2):
@.str = [4 x i8] c"/**\00"
@SEEK_SET = global i32 0
define i32 @iscomment(i8* %0, i32* %1) {
%3 = tail call i64 @ftell(i32* %1)
%4 = tail call i32 @skip_whitespaces(i32* %1)
%5 = tail call signext i8 @fgetc(i32* %1)
store i8 %5, i8* %0
%6 = tail call signext i8 @fgetc(i32* %1)
%7 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %6, i8* %7
%8 = tail call signext i8 @fgetc(i32* %1)
%9 = getelementptr inbounds i8, i8* %0, i64 2
store i8 %8, i8* %9
%10 = getelementptr inbounds i8, i8* %0, i64 3
store i8 0, i8* %10
%11 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %16, label %13
13: ; preds = %2
%14 = load i32, i32* @SEEK_SET
%15 = tail call i32 @fseek(i32* %1, i64 %3, i32 %14)
br label %16
16: ; preds = %2, %13
%17 = phi i32 [ 0, %13 ], [ 3, %2 ]
ret i32 %17
}