#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 */

/* Variables and functions */
char gchar();
int /*<<< orphan*/ iscntrl(char);
int /*<<< orphan*/ isspace(char);
char skip_space(void) {
  char ch;
  for (;;) {
    if ((ch = gchar()) < 0)
      return -1;
    if (!isspace(ch) && !iscntrl(ch))
      break;
  }
  return ch;
}


x86 assembly (clang, -O0):
<skip_space>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <gchar@plt>
mov    %al,-0x2(%rbp)
movsbl %al,%eax
cmp    $0x0,%eax
jge    1157 <skip_space+0x27>
movb   $0xff,-0x1(%rbp)
jmp    118b <skip_space+0x5b>
movsbl -0x2(%rbp),%edi
call   1050 <isspace@plt>
cmp    $0x0,%eax
jne    1180 <skip_space+0x50>
movsbl -0x2(%rbp),%edi
call   1040 <iscntrl@plt>
cmp    $0x0,%eax
jne    1180 <skip_space+0x50>
jmp    1185 <skip_space+0x55>
jmp    1138 <skip_space+0x8>
mov    -0x2(%rbp),%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_space>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <gchar@plt>
test   %al,%al
js     1178 <skip_space+0x48>
mov    %eax,%ebx
jmp    115d <skip_space+0x2d>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <gchar@plt>
mov    %eax,%ebx
test   %al,%al
js     1178 <skip_space+0x48>
movsbl %bl,%ebp
mov    %ebp,%edi
call   1050 <isspace@plt>
test   %eax,%eax
jne    1150 <skip_space+0x20>
mov    %ebp,%edi
call   1040 <iscntrl@plt>
test   %eax,%eax
jne    1150 <skip_space+0x20>
jmp    117a <skip_space+0x4a>
mov    $0xff,%bl
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define signext i8 @skip_space() {
%1 = alloca i8
%2 = alloca i8
br label %3
3: ; preds = %17, %0
%4 = call signext i8 (...) @gchar()
store i8 %4, i8* %2
%5 = sext i8 %4 to i32
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %3
store i8 -1, i8* %1
br label %20
8: ; preds = %3
%9 = load i8, i8* %2
%10 = call i32 @isspace(i8 signext %9)
%11 = icmp ne i32 %10, 0
br i1 %11, label %17, label %12
12: ; preds = %8
%13 = load i8, i8* %2
%14 = call i32 @iscntrl(i8 signext %13)
%15 = icmp ne i32 %14, 0
br i1 %15, label %17, label %16
16: ; preds = %12
br label %18
17: ; preds = %12, %8
br label %3
18: ; preds = %16
%19 = load i8, i8* %2
store i8 %19, i8* %1
br label %20
20: ; preds = %18, %7
%21 = load i8, i8* %1
ret i8 %21
}

LLVM IR (-O2):
define signext i8 @skip_space() {
%1 = tail call signext i8 (...) @gchar()
%2 = icmp slt i8 %1, 0
br i1 %2, label %13, label %3
3: ; preds = %0, %10
%4 = phi i8 [ %11, %10 ], [ %1, %0 ]
%5 = tail call i32 @isspace(i8 signext %4)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = tail call i32 @iscntrl(i8 signext %4)
%9 = icmp eq i32 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %7, %3
%11 = tail call signext i8 (...) @gchar()
%12 = icmp slt i8 %11, 0
br i1 %12, label %13, label %3
13: ; preds = %10, %7, %0
%14 = phi i8 [ -1, %0 ], [ %4, %7 ], [ -1, %10 ]
ret i8 %14
}