#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 */
unsigned char getc(int /*<<< orphan*/ *);
scalar_t__ isspace(unsigned char);
void PPM_scan_ws(unsigned char *c, FILE *fp) {
  if (*c == '#')
    while ((*c = getc(fp)) != '\n')
      continue;
  while (isspace(*c)) {
    *c = getc(fp);
    if (*c == '#')
      while ((*c = getc(fp)) != '\n')
        continue;
  }
}


x86 assembly (clang, -O0):
<PPM_scan_ws>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x23,%eax
jne    116a <PPM_scan_ws+0x4a>
jmp    1145 <PPM_scan_ws+0x25>
mov    -0x10(%rbp),%rdi
call   1040 <getc@plt>
mov    -0x8(%rbp),%rcx
mov    %al,(%rcx)
movzbl %al,%eax
cmp    $0xa,%eax
je     1165 <PPM_scan_ws+0x45>
jmp    1145 <PPM_scan_ws+0x25>
jmp    116a <PPM_scan_ws+0x4a>
jmp    116f <PPM_scan_ws+0x4f>
mov    -0x8(%rbp),%rax
movzbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
je     11d5 <PPM_scan_ws+0xb5>
mov    -0x10(%rbp),%rdi
call   1040 <getc@plt>
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x23,%eax
jne    11d0 <PPM_scan_ws+0xb0>
jmp    11ab <PPM_scan_ws+0x8b>
mov    -0x10(%rbp),%rdi
call   1040 <getc@plt>
mov    -0x8(%rbp),%rcx
mov    %al,(%rcx)
movzbl %al,%eax
cmp    $0xa,%eax
je     11cb <PPM_scan_ws+0xab>
jmp    11ab <PPM_scan_ws+0x8b>
jmp    11d0 <PPM_scan_ws+0xb0>
jmp    116f <PPM_scan_ws+0x4f>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PPM_scan_ws>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi),%al
cmp    $0x23,%al
jne    1140 <PPM_scan_ws+0x20>
mov    %r14,%rdi
call   1040 <getc@plt>
mov    %al,(%rbx)
cmp    $0xa,%al
jne    1130 <PPM_scan_ws+0x10>
mov    $0xa,%al
movzbl %al,%edi
call   1030 <isspace@plt>
test   %rax,%rax
je     1170 <PPM_scan_ws+0x50>
mov    %r14,%rdi
call   1040 <getc@plt>
mov    %al,(%rbx)
cmp    $0x23,%al
jne    1140 <PPM_scan_ws+0x20>
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1040 <getc@plt>
mov    %al,(%rbx)
cmp    $0xa,%al
jne    1160 <PPM_scan_ws+0x40>
jmp    113e <PPM_scan_ws+0x1e>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @PPM_scan_ws(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
store i8* %0, i8** %3
store i32* %1, i32** %4
%5 = load i8*, i8** %3
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = icmp eq i32 %7, 35
br i1 %8, label %9, label %18
9: ; preds = %2
br label %10
10: ; preds = %16, %9
%11 = load i32*, i32** %4
%12 = call zeroext i8 @getc(i32* %11)
%13 = load i8*, i8** %3
store i8 %12, i8* %13
%14 = zext i8 %12 to i32
%15 = icmp ne i32 %14, 10
br i1 %15, label %16, label %17
16: ; preds = %10
br label %10
17: ; preds = %10
br label %18
18: ; preds = %17, %2
br label %19
19: ; preds = %41, %18
%20 = load i8*, i8** %3
%21 = load i8, i8* %20
%22 = call i64 @isspace(i8 zeroext %21)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %42
24: ; preds = %19
%25 = load i32*, i32** %4
%26 = call zeroext i8 @getc(i32* %25)
%27 = load i8*, i8** %3
store i8 %26, i8* %27
%28 = load i8*, i8** %3
%29 = load i8, i8* %28
%30 = zext i8 %29 to i32
%31 = icmp eq i32 %30, 35
br i1 %31, label %32, label %41
32: ; preds = %24
br label %33
33: ; preds = %39, %32
%34 = load i32*, i32** %4
%35 = call zeroext i8 @getc(i32* %34)
%36 = load i8*, i8** %3
store i8 %35, i8* %36
%37 = zext i8 %35 to i32
%38 = icmp ne i32 %37, 10
br i1 %38, label %39, label %40
39: ; preds = %33
br label %33
40: ; preds = %33
br label %41
41: ; preds = %40, %24
br label %19
42: ; preds = %19
ret void
}

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