#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 */
int /*<<< orphan*/ isspace(char);
char *skip_nonspace_except(char *p, char except) {
  char *p1;
  p1 = p;
  while (!isspace(*p1) && *p1 != except)
    p1++;
  return p1;
}


x86 assembly (clang, -O0):
<skip_nonspace_except>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x19(%rbp)
jne    1159 <skip_nonspace_except+0x49>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1169 <skip_nonspace_except+0x59>
jmp    117a <skip_nonspace_except+0x6a>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    112a <skip_nonspace_except+0x1a>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_nonspace_except>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
movsbl (%rdi),%edi
nopl   0x0(%rax,%rax,1)
call   1030 <isspace@plt>
test   %eax,%eax
jne    1138 <skip_nonspace_except+0x28>
cmp    %bpl,(%rbx)
je     1138 <skip_nonspace_except+0x28>
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
jmp    1120 <skip_nonspace_except+0x10>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i8* @skip_nonspace_except(i8* %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8
%5 = alloca i8*
store i8* %0, i8** %3
store i8 %1, i8* %4
%6 = load i8*, i8** %3
store i8* %6, i8** %5
br label %7
7: ; preds = %21, %2
%8 = load i8*, i8** %5
%9 = load i8, i8* %8
%10 = call i32 @isspace(i8 signext %9)
%11 = icmp ne i32 %10, 0
br i1 %11, label %19, label %12
12: ; preds = %7
%13 = load i8*, i8** %5
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = load i8, i8* %4
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %15, %17
br label %19
19: ; preds = %12, %7
%20 = phi i1 [ false, %7 ], [ %18, %12 ]
br i1 %20, label %21, label %24
21: ; preds = %19
%22 = load i8*, i8** %5
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %5
br label %7
24: ; preds = %19
%25 = load i8*, i8** %5
ret i8* %25
}

LLVM IR (-O2):
define i8* @skip_nonspace_except(i8* %0, i8 signext %1) {
%3 = load i8, i8* %0
%4 = tail call i32 @isspace(i8 signext %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %15
6: ; preds = %2, %10
%7 = phi i8* [ %11, %10 ], [ %0, %2 ]
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, %1
br i1 %9, label %15, label %10
10: ; preds = %6
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = load i8, i8* %11
%13 = tail call i32 @isspace(i8 signext %12)
%14 = icmp eq i32 %13, 0
br i1 %14, label %6, label %15
15: ; preds = %6, %10, %2
%16 = phi i8* [ %0, %2 ], [ %11, %10 ], [ %7, %6 ]
ret i8* %16
}