#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 EOF;
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ ungetc(int, int /*<<< orphan*/ *);
void skip_to_next_line(FILE *f) {
  int r;
  while (1) {
    while ((r = fgetc(f)) != '\n' && r != EOF)
      ;
    if (r == EOF)
      break;
    r = fgetc(f);
    if (r == EOF)
      break;
    if (r != '#') {
      ungetc(r, f);
      break;
    }
  }
}


x86 assembly (clang, -O0):
<skip_to_next_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
jmp    1131 <skip_to_next_line+0x11>
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,%ecx
mov    %ecx,-0xc(%rbp)
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0xd(%rbp)
je     115f <skip_to_next_line+0x3f>
mov    -0xc(%rbp),%eax
mov    0x2e91(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    116f <skip_to_next_line+0x4f>
jmp    1174 <skip_to_next_line+0x54>
jmp    1131 <skip_to_next_line+0x11>
mov    -0xc(%rbp),%eax
mov    0x2e6a(%rip),%rcx
cmp    (%rcx),%eax
jne    118b <skip_to_next_line+0x6b>
jmp    11ce <skip_to_next_line+0xae>
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2e47(%rip),%rcx
cmp    (%rcx),%eax
jne    11ae <skip_to_next_line+0x8e>
jmp    11ce <skip_to_next_line+0xae>
cmpl   $0x23,-0xc(%rbp)
je     11c9 <skip_to_next_line+0xa9>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%rsi
call   1040 <ungetc@plt>
jmp    11ce <skip_to_next_line+0xae>
jmp    112c <skip_to_next_line+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_to_next_line>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2eba(%rip),%r14
xchg   %ax,%ax
mov    %rbx,%rdi
call   1030 <fgetc@plt>
mov    (%r14),%ecx
cmp    $0xa,%eax
je     1144 <skip_to_next_line+0x24>
cmp    %ecx,%eax
jne    1130 <skip_to_next_line+0x10>
cmp    %ecx,%eax
je     116b <skip_to_next_line+0x4b>
mov    %rbx,%rdi
call   1030 <fgetc@plt>
cmp    (%r14),%eax
je     116b <skip_to_next_line+0x4b>
cmp    $0x23,%eax
je     1130 <skip_to_next_line+0x10>
mov    %eax,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <ungetc@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@EOF = global i32 0
define void @skip_to_next_line(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
br label %4
4: ; preds = %1, %35
br label %5
5: ; preds = %15, %4
%6 = load i32*, i32** %2
%7 = call i32 @fgetc(i32* %6)
store i32 %7, i32* %3
%8 = icmp ne i32 %7, 10
br i1 %8, label %9, label %13
9: ; preds = %5
%10 = load i32, i32* %3
%11 = load i32, i32* @EOF
%12 = icmp ne i32 %10, %11
br label %13
13: ; preds = %9, %5
%14 = phi i1 [ false, %5 ], [ %12, %9 ]
br i1 %14, label %15, label %16
15: ; preds = %13
br label %5
16: ; preds = %13
%17 = load i32, i32* %3
%18 = load i32, i32* @EOF
%19 = icmp eq i32 %17, %18
br i1 %19, label %20, label %21
20: ; preds = %16
br label %36
21: ; preds = %16
%22 = load i32*, i32** %2
%23 = call i32 @fgetc(i32* %22)
store i32 %23, i32* %3
%24 = load i32, i32* %3
%25 = load i32, i32* @EOF
%26 = icmp eq i32 %24, %25
br i1 %26, label %27, label %28
27: ; preds = %21
br label %36
28: ; preds = %21
%29 = load i32, i32* %3
%30 = icmp ne i32 %29, 35
br i1 %30, label %31, label %35
31: ; preds = %28
%32 = load i32, i32* %3
%33 = load i32*, i32** %2
%34 = call i32 @ungetc(i32 %32, i32* %33)
br label %36
35: ; preds = %28
br label %4
36: ; preds = %31, %27, %20
ret void
}

LLVM IR (-O2):
@EOF = global i32 0
define void @skip_to_next_line(i32* nocapture %0) {
br label %2
2: ; preds = %8, %1
%3 = tail call i32 @fgetc(i32* %0)
%4 = icmp ne i32 %3, 10
%5 = load i32, i32* @EOF
%6 = icmp ne i32 %3, %5
%7 = select i1 %4, i1 %6, i1 false
br i1 %7, label %8, label %9
8: ; preds = %2, %15
br label %2
9: ; preds = %2
%10 = icmp eq i32 %3, %5
br i1 %10, label %19, label %11
11: ; preds = %9
%12 = tail call i32 @fgetc(i32* %0)
%13 = load i32, i32* @EOF
%14 = icmp eq i32 %12, %13
br i1 %14, label %19, label %15
15: ; preds = %11
%16 = icmp eq i32 %12, 35
br i1 %16, label %8, label %17
17: ; preds = %15
%18 = tail call i32 @ungetc(i32 %12, i32* %0)
br label %19
19: ; preds = %11, %9, %17
ret void
}