#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 ar_peek(int /*<<< orphan*/ *);
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ is_eof(int /*<<< orphan*/ *);
scalar_t__ isspace(char);
int /*<<< orphan*/ printf(char *, char);
int /*<<< orphan*/ scan_comment(int /*<<< orphan*/ *);
void scan_past_whitespace(FILE *f) {
  char c;
  while (!is_eof(f) && ((c = ar_peek(f)) != -1 && (isspace(c) || c == '#'))) {
    if (c == '#') {
      scan_comment(f);
    } else {
      c = fgetc(f);
      printf("Scanned whitespace: %d\n", c);
    }
  }
}


x86 assembly (clang, -O0):
<scan_past_whitespace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <is_eof@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0xa(%rbp)
jne    11d6 <scan_past_whitespace+0x76>
mov    -0x8(%rbp),%rdi
call   1030 <ar_peek@plt>
mov    %al,-0x9(%rbp)
movsbl %al,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
mov    %al,-0xb(%rbp)
je     11d0 <scan_past_whitespace+0x70>
movsbl -0x9(%rbp),%edi
call   1070 <isspace@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0xc(%rbp)
jne    11ca <scan_past_whitespace+0x6a>
movsbl -0x9(%rbp),%eax
cmp    $0x23,%eax
sete   %al
mov    %al,-0xc(%rbp)
mov    -0xc(%rbp),%al
mov    %al,-0xb(%rbp)
mov    -0xb(%rbp),%al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
test   $0x1,%al
jne    11e6 <scan_past_whitespace+0x86>
jmp    1222 <scan_past_whitespace+0xc2>
movsbl -0x9(%rbp),%eax
cmp    $0x23,%eax
jne    1201 <scan_past_whitespace+0xa1>
mov    -0x8(%rbp),%rdi
call   1080 <scan_comment@plt>
jmp    121d <scan_past_whitespace+0xbd>
mov    -0x8(%rbp),%rdi
call   1060 <fgetc@plt>
mov    %al,-0x9(%rbp)
lea    0xdec(%rip),%rdi
movsbl -0x9(%rbp),%esi
call   1050 <printf@plt>
jmp    116c <scan_past_whitespace+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scan_past_whitespace>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
call   1040 <is_eof@plt>
test   %eax,%eax
je     1177 <scan_past_whitespace+0x17>
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xe82(%rip),%r14
jmp    119c <scan_past_whitespace+0x3c>
call   1060 <fgetc@plt>
movsbl %al,%esi
mov    %r14,%rdi
call   1050 <printf@plt>
mov    %r15,%rdi
call   1040 <is_eof@plt>
test   %eax,%eax
jne    1171 <scan_past_whitespace+0x11>
mov    %r15,%rdi
call   1030 <ar_peek@plt>
cmp    $0xff,%al
je     1171 <scan_past_whitespace+0x11>
mov    %eax,%ebx
movsbl %al,%edi
call   1070 <isspace@plt>
test   %rax,%rax
jne    11bc <scan_past_whitespace+0x5c>
cmp    $0x23,%bl
jne    1171 <scan_past_whitespace+0x11>
mov    %r15,%rdi
cmp    $0x23,%bl
jne    1180 <scan_past_whitespace+0x20>
call   1080 <scan_comment@plt>
jmp    1190 <scan_past_whitespace+0x30>

LLVM IR (-O0):
@.str = [24 x i8] c"Scanned whitespace: %d\0A\00"
define void @scan_past_whitespace(i32* %0) {
%2 = alloca i32*
%3 = alloca i8
store i32* %0, i32** %2
br label %4
4: ; preds = %39, %1
%5 = load i32*, i32** %2
%6 = call i32 @is_eof(i32* %5)
%7 = icmp ne i32 %6, 0
br i1 %7, label %25, label %8
8: ; preds = %4
%9 = load i32*, i32** %2
%10 = call signext i8 @ar_peek(i32* %9)
store i8 %10, i8* %3
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, -1
br i1 %12, label %13, label %23
13: ; preds = %8
%14 = load i8, i8* %3
%15 = call i64 @isspace(i8 signext %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %21, label %17
17: ; preds = %13
%18 = load i8, i8* %3
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 35
br label %21
21: ; preds = %17, %13
%22 = phi i1 [ true, %13 ], [ %20, %17 ]
br label %23
23: ; preds = %21, %8
%24 = phi i1 [ false, %8 ], [ %22, %21 ]
br label %25
25: ; preds = %23, %4
%26 = phi i1 [ false, %4 ], [ %24, %23 ]
br i1 %26, label %27, label %40
27: ; preds = %25
%28 = load i8, i8* %3
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 35
br i1 %30, label %31, label %34
31: ; preds = %27
%32 = load i32*, i32** %2
%33 = call i32 @scan_comment(i32* %32)
br label %39
34: ; preds = %27
%35 = load i32*, i32** %2
%36 = call signext i8 @fgetc(i32* %35)
store i8 %36, i8* %3
%37 = load i8, i8* %3
%38 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8 signext %37)
br label %39
39: ; preds = %34, %31
br label %4
40: ; preds = %25
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"Scanned whitespace: %d\0A\00"
define void @scan_past_whitespace(i32* %0) {
%2 = tail call i32 @is_eof(i32* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %21
4: ; preds = %1, %18
%5 = tail call signext i8 @ar_peek(i32* %0)
%6 = icmp eq i8 %5, -1
br i1 %6, label %21, label %7
7: ; preds = %4
%8 = tail call i64 @isspace(i8 signext %5)
%9 = icmp ne i64 %8, 0
%10 = icmp eq i8 %5, 35
%11 = select i1 %9, i1 true, i1 %10
br i1 %11, label %12, label %21
12: ; preds = %7
br i1 %10, label %13, label %15
13: ; preds = %12
%14 = tail call i32 @scan_comment(i32* %0)
br label %18
15: ; preds = %12
%16 = tail call signext i8 @fgetc(i32* %0)
%17 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8 signext %16)
br label %18
18: ; preds = %15, %13
%19 = tail call i32 @is_eof(i32* %0)
%20 = icmp eq i32 %19, 0
br i1 %20, label %4, label %21
21: ; preds = %7, %18, %4, %1
ret void
}