#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 */
struct _citrus_memory_stream {
  int dummy;
};

/* Variables and functions */
int EOF;
int /*<<< orphan*/ _citrus_bcs_isspace(int);
int /*<<< orphan*/ _citrus_memory_stream_getc(struct _citrus_memory_stream *);
int _citrus_memory_stream_peek(struct _citrus_memory_stream *);
void _citrus_memory_stream_skip_ws(struct _citrus_memory_stream *ms) {
  int ch;
  while ((ch = _citrus_memory_stream_peek(ms)) != EOF) {
    if (!_citrus_bcs_isspace(ch))
      break;
    _citrus_memory_stream_getc(ms);
  }
}


x86 assembly (clang, -O0):
<_citrus_memory_stream_skip_ws>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <_citrus_memory_stream_peek@plt>
mov    %eax,-0xc(%rbp)
mov    0x2e99(%rip),%rcx
cmp    (%rcx),%eax
je     117b <_citrus_memory_stream_skip_ws+0x4b>
mov    -0xc(%rbp),%edi
call   1040 <_citrus_bcs_isspace@plt>
cmp    $0x0,%eax
jne    116d <_citrus_memory_stream_skip_ws+0x3d>
jmp    117b <_citrus_memory_stream_skip_ws+0x4b>
mov    -0x8(%rbp),%rdi
call   1050 <_citrus_memory_stream_getc@plt>
jmp    113c <_citrus_memory_stream_skip_ws+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_citrus_memory_stream_skip_ws>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <_citrus_memory_stream_peek@plt>
mov    0x2ea5(%rip),%r14
cmp    (%r14),%eax
je     1170 <_citrus_memory_stream_skip_ws+0x40>
nopl   0x0(%rax,%rax,1)
mov    %eax,%edi
call   1040 <_citrus_bcs_isspace@plt>
test   %eax,%eax
je     1170 <_citrus_memory_stream_skip_ws+0x40>
mov    %rbx,%rdi
call   1050 <_citrus_memory_stream_getc@plt>
mov    %rbx,%rdi
call   1030 <_citrus_memory_stream_peek@plt>
cmp    (%r14),%eax
jne    1150 <_citrus_memory_stream_skip_ws+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct._citrus_memory_stream = type { i32 }
@EOF = global i32 0
define void @_citrus_memory_stream_skip_ws(%struct._citrus_memory_stream* %0) {
%2 = alloca %struct._citrus_memory_stream*
%3 = alloca i32
store %struct._citrus_memory_stream* %0, %struct._citrus_memory_stream** %2
br label %4
4: ; preds = %14, %1
%5 = load %struct._citrus_memory_stream*, %struct._citrus_memory_stream** %2
%6 = call i32 @_citrus_memory_stream_peek(%struct._citrus_memory_stream* %5)
store i32 %6, i32* %3
%7 = load i32, i32* @EOF
%8 = icmp ne i32 %6, %7
br i1 %8, label %9, label %17
9: ; preds = %4
%10 = load i32, i32* %3
%11 = call i32 @_citrus_bcs_isspace(i32 %10)
%12 = icmp ne i32 %11, 0
br i1 %12, label %14, label %13
13: ; preds = %9
br label %17
14: ; preds = %9
%15 = load %struct._citrus_memory_stream*, %struct._citrus_memory_stream** %2
%16 = call i32 @_citrus_memory_stream_getc(%struct._citrus_memory_stream* %15)
br label %4
17: ; preds = %13, %4
ret void
}

LLVM IR (-O2):
%struct._citrus_memory_stream = type { i32 }
@EOF = global i32 0
define void @_citrus_memory_stream_skip_ws(%struct._citrus_memory_stream* %0) {
%2 = tail call i32 @_citrus_memory_stream_peek(%struct._citrus_memory_stream* %0)
%3 = load i32, i32* @EOF
%4 = icmp eq i32 %2, %3
br i1 %4, label %14, label %5
5: ; preds = %1, %9
%6 = phi i32 [ %11, %9 ], [ %2, %1 ]
%7 = tail call i32 @_citrus_bcs_isspace(i32 %6)
%8 = icmp eq i32 %7, 0
br i1 %8, label %14, label %9
9: ; preds = %5
%10 = tail call i32 @_citrus_memory_stream_getc(%struct._citrus_memory_stream* %0)
%11 = tail call i32 @_citrus_memory_stream_peek(%struct._citrus_memory_stream* %0)
%12 = load i32, i32* @EOF
%13 = icmp eq i32 %11, %12
br i1 %13, label %14, label %5
14: ; preds = %9, %5, %1
ret void
}