#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 fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ read_line(int /*<<< orphan*/ *);
int /*<<< orphan*/ ungetc(char, int /*<<< orphan*/ *);
void skip_header(FILE *f) {
  int extra = 0;
  char c;
  for (c = fgetc(f); c == ';' || c == '>'; read_line(f), c = fgetc(f))
    if (c == ';')
      extra = 1;
    else
      extra = 0;
  ungetc(c, f);
  if (extra)
    read_line(f);
}


x86 assembly (clang, -O0):
<skip_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %al,-0xd(%rbp)
movsbl -0xd(%rbp),%ecx
mov    $0x1,%al
cmp    $0x3b,%ecx
mov    %al,-0xe(%rbp)
je     116e <skip_header+0x3e>
movsbl -0xd(%rbp),%eax
cmp    $0x3e,%eax
sete   %al
mov    %al,-0xe(%rbp)
mov    -0xe(%rbp),%al
test   $0x1,%al
jne    117e <skip_header+0x4e>
jmp    11bd <skip_header+0x8d>
movsbl -0xd(%rbp),%eax
cmp    $0x3b,%eax
jne    1197 <skip_header+0x67>
movl   $0x1,-0xc(%rbp)
jmp    119e <skip_header+0x6e>
movl   $0x0,-0xc(%rbp)
jmp    11a3 <skip_header+0x73>
mov    -0x8(%rbp),%rdi
call   1050 <read_line@plt>
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %al,-0xd(%rbp)
jmp    114f <skip_header+0x1f>
mov    -0xd(%rbp),%al
mov    -0x8(%rbp),%rsi
movsbl %al,%edi
call   1040 <ungetc@plt>
cmpl   $0x0,-0xc(%rbp)
je     11df <skip_header+0xaf>
mov    -0x8(%rbp),%rdi
call   1050 <read_line@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_header>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
xor    %r14d,%r14d
jmp    114d <skip_header+0x1d>
nopl   0x0(%rax)
xor    %ebp,%ebp
mov    %rbx,%rdi
call   1050 <read_line@plt>
mov    %ebp,%r14d
mov    %rbx,%rdi
call   1030 <fgetc@plt>
mov    $0x1,%ebp
cmp    $0x3b,%al
je     1142 <skip_header+0x12>
cmp    $0x3e,%al
je     1140 <skip_header+0x10>
movsbl %al,%edi
mov    %rbx,%rsi
call   1040 <ungetc@plt>
test   %r14d,%r14d
je     117e <skip_header+0x4e>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <read_line@plt>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @skip_header(i32* %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i32 [ 0, %1 ], [ %7, %6 ]
%4 = tail call signext i8 @fgetc(i32* %0)
switch i8 %4, label %9 [
i8 59, label %6
i8 62, label %5
]
5: ; preds = %2
br label %6
6: ; preds = %2, %5
%7 = phi i32 [ 0, %5 ], [ 1, %2 ]
%8 = tail call i32 @read_line(i32* %0)
br label %2
9: ; preds = %2
%10 = tail call i32 @ungetc(i8 signext %4, i32* %0)
%11 = icmp eq i32 %3, 0
br i1 %11, label %14, label %12
12: ; preds = %9
%13 = tail call i32 @read_line(i32* %0)
br label %14
14: ; preds = %12, %9
ret void
}