#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__ strlen(char const *);
scalar_t__ strpbrk(char const *, char *);
int nospecials(const char *p, size_t l) {
  size_t upto = 0;
  do {
    if (strpbrk(p + upto, "^$*+?.([%-"))
      return 0;
    upto += strlen(p + upto) + 1;
  } while (upto <= l);
  return 1;
}


x86 assembly (clang, -O0):
<nospecials>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
add    -0x20(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1040 <strpbrk@plt>
cmp    $0x0,%rax
je     1162 <nospecials+0x42>
movl   $0x0,-0x4(%rbp)
jmp    1190 <nospecials+0x70>
mov    -0x10(%rbp),%rdi
add    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%rax
add    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jbe    1138 <nospecials+0x18>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nospecials>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%r13
xor    %r14d,%r14d
lea    0xec5(%rip),%r12
xor    %ebp,%ebp
nopl   (%rax)
mov    %r13,%rbx
add    %rbp,%rbx
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <strpbrk@plt>
test   %rax,%rax
jne    1170 <nospecials+0x50>
mov    %rbx,%rdi
call   1030 <strlen@plt>
add    %rax,%rbp
add    $0x1,%rbp
cmp    %r15,%rbp
jbe    1140 <nospecials+0x20>
mov    $0x1,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"^$*+?.([%-\00"
define i32 @nospecials(i8* %0, i64 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
store i8* %0, i8** %4
store i64 %1, i64* %5
store i64 0, i64* %6
br label %7
7: ; preds = %22, %2
%8 = load i8*, i8** %4
%9 = load i64, i64* %6
%10 = getelementptr inbounds i8, i8* %8, i64 %9
%11 = call i64 @strpbrk(i8* %10, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %7
store i32 0, i32* %3
br label %27
14: ; preds = %7
%15 = load i8*, i8** %4
%16 = load i64, i64* %6
%17 = getelementptr inbounds i8, i8* %15, i64 %16
%18 = call i64 @strlen(i8* %17)
%19 = add nsw i64 %18, 1
%20 = load i64, i64* %6
%21 = add i64 %20, %19
store i64 %21, i64* %6
br label %22
22: ; preds = %14
%23 = load i64, i64* %6
%24 = load i64, i64* %5
%25 = icmp ule i64 %23, %24
br i1 %25, label %7, label %26
26: ; preds = %22
store i32 1, i32* %3
br label %27
27: ; preds = %26, %13
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
@.str = [11 x i8] c"^$*+?.([%-\00"
define i32 @nospecials(i8* %0, i64 %1) {
br label %3
3: ; preds = %8, %2
%4 = phi i64 [ 0, %2 ], [ %11, %8 ]
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = tail call i64 @strpbrk(i8* %5, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %3
%9 = tail call i64 @strlen(i8* dereferenceable(1) %5)
%10 = add i64 %4, 1
%11 = add i64 %10, %9
%12 = icmp ugt i64 %11, %1
br i1 %12, label %13, label %3
13: ; preds = %8, %3
%14 = phi i32 [ 0, %3 ], [ 1, %8 ]
ret i32 %14
}