#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 */
scalar_t__ iswhite(char);
int p_check(char *str, int *i) {
  int count;
  count = 1;
  ++*i;
  while (iswhite(str[*i]))
    ++*i;
  if (str[*i])
    count = 0;
  return (count);
}


x86 assembly (clang, -O0):
<p_check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <iswhite@plt>
cmp    $0x0,%rax
je     1160 <p_check+0x50>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
jmp    1132 <p_check+0x22>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     117c <p_check+0x6c>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<p_check>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
nopw   0x0(%rax,%rax,1)
movslq (%rbx),%rax
lea    0x1(%rax),%rcx
mov    %ecx,(%rbx)
movsbl 0x1(%r14,%rax,1),%edi
call   1030 <iswhite@plt>
test   %rax,%rax
jne    1120 <p_check+0x10>
movslq (%rbx),%rcx
xor    %eax,%eax
cmpb   $0x0,(%r14,%rcx,1)
sete   %al
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @p_check(i8* nocapture %0, i32* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = load i32, i32* %1
%5 = add nsw i32 %4, 1
store i32 %5, i32* %1
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = tail call i64 @iswhite(i8 signext %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %3
11: ; preds = %3
%12 = load i32, i32* %1
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %0, i64 %13
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
%17 = zext i1 %16 to i32
ret i32 %17
}