#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*/ line;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int /*<<< orphan*/ SEEK_CUR;
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
scalar_t__ isspace(int);
void skip_comments(FILE *fp) {
  int ch;
  char line[100];
  while ((ch = fgetc(fp)) != EOF && isspace(ch))
    ;
  if (ch == '#') {
    fgets(line, sizeof(line), fp);
    skip_comments(fp);
  } else
    fseek(fp, -1, SEEK_CUR);
}


x86 assembly (clang, -O0):
<skip_comments>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,%ecx
mov    %ecx,-0xc(%rbp)
xor    %eax,%eax
mov    0x2e6a(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0x71(%rbp)
je     1193 <skip_comments+0x43>
mov    -0xc(%rbp),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x71(%rbp)
mov    -0x71(%rbp),%al
test   $0x1,%al
jne    11a3 <skip_comments+0x53>
jmp    11a8 <skip_comments+0x58>
jmp    115f <skip_comments+0xf>
cmpl   $0x23,-0xc(%rbp)
jne    11d2 <skip_comments+0x82>
lea    -0x70(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x64,%esi
call   1050 <fgets@plt>
mov    -0x8(%rbp),%rdi
call   1070 <skip_comments@plt>
jmp    11e9 <skip_comments+0x99>
mov    -0x8(%rbp),%rdi
mov    0x2e0b(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%esi
call   1060 <fseek@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_comments>:
push   %rbp
push   %r14
push   %rbx
sub    $0x70,%rsp
mov    %rdi,%rbx
mov    0x2e7e(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1030 <fgetc@plt>
mov    %eax,%ebp
cmp    (%r14),%eax
je     118b <skip_comments+0x3b>
mov    %ebp,%edi
call   1040 <isspace@plt>
test   %rax,%rax
jne    1170 <skip_comments+0x20>
cmp    $0x23,%ebp
jne    11b1 <skip_comments+0x61>
mov    %rsp,%rdi
mov    $0x64,%esi
mov    %rbx,%rdx
call   1050 <fgets@plt>
mov    %rbx,%rdi
call   1070 <skip_comments@plt>
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    0x2e30(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    $0xffffffff,%esi
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %rbp
jmp    1060 <fseek@plt>

LLVM IR (-O0):
@EOF = global i32 0
@SEEK_CUR = global i32 0
define void @skip_comments(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca [100 x i8]
store i32* %0, i32** %2
br label %5
5: ; preds = %16, %1
%6 = load i32*, i32** %2
%7 = call i32 @fgetc(i32* %6)
store i32 %7, i32* %3
%8 = load i32, i32* @EOF
%9 = icmp ne i32 %7, %8
br i1 %9, label %10, label %14
10: ; preds = %5
%11 = load i32, i32* %3
%12 = call i64 @isspace(i32 %11)
%13 = icmp ne i64 %12, 0
br label %14
14: ; preds = %10, %5
%15 = phi i1 [ false, %5 ], [ %13, %10 ]
br i1 %15, label %16, label %17
16: ; preds = %14
br label %5
17: ; preds = %14
%18 = load i32, i32* %3
%19 = icmp eq i32 %18, 35
br i1 %19, label %20, label %25
20: ; preds = %17
%21 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%22 = load i32*, i32** %2
%23 = call i32 @fgets(i8* %21, i32 100, i32* %22)
%24 = load i32*, i32** %2
br label %29
25: ; preds = %17
%26 = load i32*, i32** %2
%27 = load i32, i32* @SEEK_CUR
%28 = call i32 @fseek(i32* %26, i32 -1, i32 %27)
br label %29
29: ; preds = %25, %20
ret void
}

LLVM IR (-O2):
@EOF = global i32 0
@SEEK_CUR = global i32 0
define void @skip_comments(i32* nocapture %0) {
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
br label %4
4: ; preds = %8, %1
%5 = tail call i32 @fgetc(i32* %0)
%6 = load i32, i32* @EOF
%7 = icmp eq i32 %5, %6
br i1 %7, label %11, label %8
8: ; preds = %4
%9 = tail call i64 @isspace(i32 %5)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %8
%12 = icmp eq i32 %5, 35
br i1 %12, label %13, label %15
13: ; preds = %11
%14 = call i32 @fgets(i8* %3, i32 100, i32* %0)
br label %18
15: ; preds = %11
%16 = load i32, i32* @SEEK_CUR
%17 = tail call i32 @fseek(i32* %0, i32 -1, i32 %16)
br label %18
18: ; preds = %15, %13
ret void
}