#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__ ispunct(char);
scalar_t__ isspace(char);
char *skipPunct(char *ptr, char *end) {
  char *p = ptr;
  while (p < end && (isspace(*p) || ispunct(*p)))
    ++p;
  return p;
}


x86 assembly (clang, -O0):
<skipPunct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
xor    %eax,%eax
cmp    -0x10(%rbp),%rcx
mov    %al,-0x19(%rbp)
jae    1185 <skipPunct+0x65>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isspace@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x1a(%rbp)
jne    117f <skipPunct+0x5f>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <ispunct@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x1a(%rbp)
mov    -0x1a(%rbp),%al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1195 <skipPunct+0x75>
jmp    11a6 <skipPunct+0x86>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1138 <skipPunct+0x18>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skipPunct>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
cmp    %rsi,%rdi
jae    1169 <skipPunct+0x49>
mov    %rsi,%r14
mov    %rsi,%r15
sub    %rbx,%r15
jmp    114a <skipPunct+0x2a>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
add    $0xffffffffffffffff,%r15
je     1166 <skipPunct+0x46>
movsbl (%rbx),%edi
call   1040 <isspace@plt>
test   %rax,%rax
jne    1140 <skipPunct+0x20>
movsbl (%rbx),%edi
call   1030 <ispunct@plt>
test   %rax,%rax
jne    1140 <skipPunct+0x20>
jmp    1169 <skipPunct+0x49>
mov    %r14,%rbx
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @skipPunct(i8* %0, i8* %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 = %25, %2
%8 = load i8*, i8** %5
%9 = load i8*, i8** %4
%10 = icmp ult i8* %8, %9
br i1 %10, label %11, label %23
11: ; preds = %7
%12 = load i8*, i8** %5
%13 = load i8, i8* %12
%14 = call i64 @isspace(i8 signext %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %21, label %16
16: ; preds = %11
%17 = load i8*, i8** %5
%18 = load i8, i8* %17
%19 = call i64 @ispunct(i8 signext %18)
%20 = icmp ne i64 %19, 0
br label %21
21: ; preds = %16, %11
%22 = phi i1 [ true, %11 ], [ %20, %16 ]
br label %23
23: ; preds = %21, %7
%24 = phi i1 [ false, %7 ], [ %22, %21 ]
br i1 %24, label %25, label %28
25: ; preds = %23
%26 = load i8*, i8** %5
%27 = getelementptr inbounds i8, i8* %26, i32 1
store i8* %27, i8** %5
br label %7
28: ; preds = %23
%29 = load i8*, i8** %5
ret i8* %29
}

LLVM IR (-O2):
define i8* @skipPunct(i8* %0, i8* readnone %1) {
%3 = icmp ult i8* %0, %1
br i1 %3, label %4, label %21
4: ; preds = %2
%5 = ptrtoint i8* %1 to i64
%6 = ptrtoint i8* %0 to i64
%7 = sub i64 %5, %6
%8 = getelementptr i8, i8* %0, i64 %7
br label %9
9: ; preds = %4, %18
%10 = phi i8* [ %19, %18 ], [ %0, %4 ]
%11 = load i8, i8* %10
%12 = tail call i64 @isspace(i8 signext %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %9
%15 = load i8, i8* %10
%16 = tail call i64 @ispunct(i8 signext %15)
%17 = icmp eq i64 %16, 0
br i1 %17, label %21, label %18
18: ; preds = %9, %14
%19 = getelementptr inbounds i8, i8* %10, i64 1
%20 = icmp eq i8* %19, %8
br i1 %20, label %21, label %9
21: ; preds = %14, %18, %2
%22 = phi i8* [ %0, %2 ], [ %8, %18 ], [ %10, %14 ]
ret i8* %22
}