#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*/ *);
scalar_t__ isspace(int);
int /*<<< orphan*/ ungetc(int, int /*<<< orphan*/ *);
void ppm_skip(FILE *f) {
  int c, comment = 0;
  do {
    c = fgetc(f);
    if (c == '#')
      comment = 1;
    if (c == '\n')
      comment = 0;
  } while (c != EOF && (isspace(c) || comment));
  if (c != EOF)
    ungetc(c, f);
}


x86 assembly (clang, -O0):
<ppm_skip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x23,-0xc(%rbp)
jne    1160 <ppm_skip+0x30>
movl   $0x1,-0x10(%rbp)
cmpl   $0xa,-0xc(%rbp)
jne    1171 <ppm_skip+0x41>
movl   $0x0,-0x10(%rbp)
jmp    1176 <ppm_skip+0x46>
mov    -0xc(%rbp),%ecx
xor    %eax,%eax
mov    0x2e66(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0x11(%rbp)
je     11b7 <ppm_skip+0x87>
mov    -0xc(%rbp),%edi
call   1040 <isspace@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x12(%rbp)
jne    11b1 <ppm_skip+0x81>
cmpl   $0x0,-0x10(%rbp)
setne  %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1143 <ppm_skip+0x13>
mov    -0xc(%rbp),%eax
mov    0x2e1c(%rip),%rcx
cmp    (%rcx),%eax
je     11e0 <ppm_skip+0xb0>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%rsi
call   1050 <ungetc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ppm_skip>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r13
xor    %r14d,%r14d
mov    $0x1,%r12d
mov    0x2e9a(%rip),%r15
xor    %ebx,%ebx
mov    %r13,%rdi
call   1030 <fgetc@plt>
cmp    $0x23,%eax
cmove  %r12d,%ebx
cmp    $0xa,%eax
cmove  %r14d,%ebx
cmp    (%r15),%eax
je     1182 <ppm_skip+0x52>
mov    %eax,%ebp
mov    %eax,%edi
call   1040 <isspace@plt>
test   %rax,%rax
jne    1150 <ppm_skip+0x20>
test   %ebx,%ebx
jne    1150 <ppm_skip+0x20>
cmp    (%r15),%ebp
jne    1191 <ppm_skip+0x61>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %ebp,%edi
mov    %r13,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <ungetc@plt>

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

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