#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 ui {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ui_get_c(struct ui *, int /*<<< orphan*/ *);
scalar_t__ ui_peek_c(struct ui *, char *);
void skip_to_next_word(struct ui *is) {
  char tmp;
  while (ui_peek_c(is, &tmp) && tmp != ' ')
    ui_get_c(is, NULL);
  while (ui_peek_c(is, &tmp) && tmp == ' ')
    ui_get_c(is, NULL);
}


x86 assembly (clang, -O0):
<skip_to_next_word>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x9(%rbp),%rsi
call   1030 <ui_peek_c@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0xa(%rbp)
je     1158 <skip_to_next_word+0x38>
movsbl -0x9(%rbp),%eax
cmp    $0x20,%eax
setne  %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
test   $0x1,%al
jne    1168 <skip_to_next_word+0x48>
jmp    117a <skip_to_next_word+0x5a>
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <ui_get_c@plt>
jmp    112c <skip_to_next_word+0xc>
jmp    117f <skip_to_next_word+0x5f>
mov    -0x8(%rbp),%rdi
lea    -0x9(%rbp),%rsi
call   1030 <ui_peek_c@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0xb(%rbp)
je     11ab <skip_to_next_word+0x8b>
movsbl -0x9(%rbp),%eax
cmp    $0x20,%eax
sete   %al
mov    %al,-0xb(%rbp)
mov    -0xb(%rbp),%al
test   $0x1,%al
jne    11bb <skip_to_next_word+0x9b>
jmp    11cd <skip_to_next_word+0xad>
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <ui_get_c@plt>
jmp    117f <skip_to_next_word+0x5f>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_to_next_word>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0x7(%rsp),%rsi
call   1030 <ui_peek_c@plt>
test   %rax,%rax
je     1171 <skip_to_next_word+0x51>
cmpb   $0x20,0x7(%rsp)
je     1171 <skip_to_next_word+0x51>
lea    0x7(%rsp),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <ui_get_c@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <ui_peek_c@plt>
test   %rax,%rax
je     1171 <skip_to_next_word+0x51>
cmpb   $0x20,0x7(%rsp)
jne    1150 <skip_to_next_word+0x30>
lea    0x7(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <ui_peek_c@plt>
test   %rax,%rax
je     11b1 <skip_to_next_word+0x91>
cmpb   $0x20,0x7(%rsp)
jne    11b1 <skip_to_next_word+0x91>
lea    0x7(%rsp),%r14
nop
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <ui_get_c@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <ui_peek_c@plt>
test   %rax,%rax
je     11b1 <skip_to_next_word+0x91>
cmpb   $0x20,0x7(%rsp)
je     1190 <skip_to_next_word+0x70>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.ui = type { i32 }
define void @skip_to_next_word(%struct.ui* %0) {
%2 = alloca %struct.ui*
%3 = alloca i8
store %struct.ui* %0, %struct.ui** %2
br label %4
4: ; preds = %14, %1
%5 = load %struct.ui*, %struct.ui** %2
%6 = call i64 @ui_peek_c(%struct.ui* %5, i8* %3)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %4
%9 = load i8, i8* %3
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 32
br label %12
12: ; preds = %8, %4
%13 = phi i1 [ false, %4 ], [ %11, %8 ]
br i1 %13, label %14, label %17
14: ; preds = %12
%15 = load %struct.ui*, %struct.ui** %2
%16 = call i32 @ui_get_c(%struct.ui* %15, i32* null)
br label %4
17: ; preds = %12
br label %18
18: ; preds = %28, %17
%19 = load %struct.ui*, %struct.ui** %2
%20 = call i64 @ui_peek_c(%struct.ui* %19, i8* %3)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %18
%23 = load i8, i8* %3
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 32
br label %26
26: ; preds = %22, %18
%27 = phi i1 [ false, %18 ], [ %25, %22 ]
br i1 %27, label %28, label %31
28: ; preds = %26
%29 = load %struct.ui*, %struct.ui** %2
%30 = call i32 @ui_get_c(%struct.ui* %29, i32* null)
br label %18
31: ; preds = %26
ret void
}

LLVM IR (-O2):
%struct.ui = type { i32 }
define void @skip_to_next_word(%struct.ui* %0) {
%2 = alloca i8
%3 = call i64 @ui_peek_c(%struct.ui* %0, i8* %2)
%4 = icmp ne i64 %3, 0
%5 = load i8, i8* %2
%6 = icmp ne i8 %5, 32
%7 = select i1 %4, i1 %6, i1 false
br i1 %7, label %14, label %8
8: ; preds = %14, %1
%9 = call i64 @ui_peek_c(%struct.ui* %0, i8* %2)
%10 = icmp ne i64 %9, 0
%11 = load i8, i8* %2
%12 = icmp eq i8 %11, 32
%13 = select i1 %10, i1 %12, i1 false
br i1 %13, label %21, label %28
14: ; preds = %1, %14
%15 = call i32 @ui_get_c(%struct.ui* %0, i32* null)
%16 = call i64 @ui_peek_c(%struct.ui* %0, i8* %2)
%17 = icmp ne i64 %16, 0
%18 = load i8, i8* %2
%19 = icmp ne i8 %18, 32
%20 = select i1 %17, i1 %19, i1 false
br i1 %20, label %14, label %8
21: ; preds = %8, %21
%22 = call i32 @ui_get_c(%struct.ui* %0, i32* null)
%23 = call i64 @ui_peek_c(%struct.ui* %0, i8* %2)
%24 = icmp ne i64 %23, 0
%25 = load i8, i8* %2
%26 = icmp eq i8 %25, 32
%27 = select i1 %24, i1 %26, i1 false
br i1 %27, label %21, label %28
28: ; preds = %21, %8
ret void
}