#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(int);
int m_len(int);
scalar_t__ mls(int, int);
int parser_skip_whitespace(int buf, int *p) {
  int c;
  while (*p < m_len(buf)) {
    c = (*(char *)mls((buf), (*p)));
    if (c == 0)
      return -1;
    if (!isspace(c))
      return 0;
    (*p)++;
  }
  return -1;
}


x86 assembly (clang, -O0):
<parser_skip_whitespace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <m_len@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jge    11b4 <parser_skip_whitespace+0x84>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
call   1050 <mls@plt>
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1187 <parser_skip_whitespace+0x57>
movl   $0xffffffff,-0x4(%rbp)
jmp    11bb <parser_skip_whitespace+0x8b>
mov    -0x14(%rbp),%edi
call   1040 <isspace@plt>
cmp    $0x0,%eax
jne    11a4 <parser_skip_whitespace+0x74>
movl   $0x0,-0x4(%rbp)
jmp    11bb <parser_skip_whitespace+0x8b>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
jmp    113f <parser_skip_whitespace+0xf>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parser_skip_whitespace>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%rbx
mov    %edi,%r12d
mov    (%rsi),%r15d
call   1030 <m_len@plt>
mov    $0xffffffff,%r14d
cmp    %eax,%r15d
jge    1192 <parser_skip_whitespace+0x62>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%rbx),%esi
mov    %r12d,%edi
call   1050 <mls@plt>
movsbl (%rax),%edi
test   %edi,%edi
je     1192 <parser_skip_whitespace+0x62>
call   1040 <isspace@plt>
test   %eax,%eax
je     118f <parser_skip_whitespace+0x5f>
mov    (%rbx),%ebp
add    $0x1,%ebp
mov    %ebp,(%rbx)
mov    %r12d,%edi
call   1030 <m_len@plt>
cmp    %eax,%ebp
jl     1160 <parser_skip_whitespace+0x30>
jmp    1192 <parser_skip_whitespace+0x62>
xor    %r14d,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @parser_skip_whitespace(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
store i32 %0, i32* %4
store i32* %1, i32** %5
br label %7
7: ; preds = %29, %2
%8 = load i32*, i32** %5
%9 = load i32, i32* %8
%10 = load i32, i32* %4
%11 = call i32 @m_len(i32 %10)
%12 = icmp slt i32 %9, %11
br i1 %12, label %13, label %33
13: ; preds = %7
%14 = load i32, i32* %4
%15 = load i32*, i32** %5
%16 = load i32, i32* %15
%17 = call i64 @mls(i32 %14, i32 %16)
%18 = inttoptr i64 %17 to i8*
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
store i32 %20, i32* %6
%21 = load i32, i32* %6
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %13
store i32 -1, i32* %3
br label %34
24: ; preds = %13
%25 = load i32, i32* %6
%26 = call i32 @isspace(i32 %25)
%27 = icmp ne i32 %26, 0
br i1 %27, label %29, label %28
28: ; preds = %24
store i32 0, i32* %3
br label %34
29: ; preds = %24
%30 = load i32*, i32** %5
%31 = load i32, i32* %30
%32 = add nsw i32 %31, 1
store i32 %32, i32* %30
br label %7
33: ; preds = %7
store i32 -1, i32* %3
br label %34
34: ; preds = %33, %28, %23
%35 = load i32, i32* %3
ret i32 %35
}

LLVM IR (-O2):
define i32 @parser_skip_whitespace(i32 %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = tail call i32 @m_len(i32 %0)
%5 = icmp slt i32 %3, %4
br i1 %5, label %6, label %21
6: ; preds = %2, %16
%7 = load i32, i32* %1
%8 = tail call i64 @mls(i32 %0, i32 %7)
%9 = inttoptr i64 %8 to i8*
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %21, label %12
12: ; preds = %6
%13 = sext i8 %10 to i32
%14 = tail call i32 @isspace(i32 %13)
%15 = icmp eq i32 %14, 0
br i1 %15, label %21, label %16
16: ; preds = %12
%17 = load i32, i32* %1
%18 = add nsw i32 %17, 1
store i32 %18, i32* %1
%19 = tail call i32 @m_len(i32 %0)
%20 = icmp slt i32 %18, %19
br i1 %20, label %6, label %21
21: ; preds = %6, %12, %16, %2
%22 = phi i32 [ -1, %2 ], [ -1, %16 ], [ 0, %12 ], [ -1, %6 ]
ret i32 %22
}