#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 */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
scalar_t__ _wc_indelim(int /*<<< orphan*/, int /*<<< orphan*/ const *);
wchar_t *wcspbrk(const wchar_t *s, const wchar_t *set) {
  size_t n = 0;
  for (;;) {
    wchar_t wc = s[n];
    if (!wc)
      return NULL;
    if (_wc_indelim(wc, set))
      return (wchar_t *)&s[n];
    n++;
  }
}


x86 assembly (clang, -O0):
<wcspbrk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    114d <wcspbrk+0x3d>
movq   $0x0,-0x8(%rbp)
jmp    118c <wcspbrk+0x7c>
mov    -0x24(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1030 <_wc_indelim@plt>
cmp    $0x0,%rax
je     117b <wcspbrk+0x6b>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
jmp    118c <wcspbrk+0x7c>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1128 <wcspbrk+0x18>
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wcspbrk>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%edi
test   %edi,%edi
je     1138 <wcspbrk+0x28>
mov    %rsi,%r14
mov    %r14,%rsi
call   1030 <_wc_indelim@plt>
test   %rax,%rax
jne    113a <wcspbrk+0x2a>
mov    0x4(%rbx),%edi
add    $0x4,%rbx
test   %edi,%edi
jne    1120 <wcspbrk+0x10>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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