#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 */
int /*<<< orphan*/ *wcspbrk(int /*<<< orphan*/ *, int /*<<< orphan*/ const *);
wchar_t *wcssep(wchar_t **restrict string, const wchar_t *restrict delimiters) {
  wchar_t *r = *string;
  wchar_t *next;
  if (r == NULL)
    return NULL;
  next = wcspbrk(r, delimiters);
  if (next != NULL)
    *next++ = 0;
  *string = next;
  return r;
}


x86 assembly (clang, -O0):
<wcssep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1143 <wcssep+0x33>
movq   $0x0,-0x8(%rbp)
jmp    1187 <wcssep+0x77>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <wcspbrk@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1174 <wcssep+0x64>
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x28(%rbp)
movl   $0x0,(%rax)
mov    -0x28(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wcssep>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%rbx
test   %rbx,%rbx
je     1140 <wcssep+0x30>
mov    %rdi,%r14
mov    %rbx,%rdi
call   1030 <wcspbrk@plt>
test   %rax,%rax
je     113b <wcssep+0x2b>
mov    %rax,%rcx
add    $0x4,%rcx
movl   $0x0,(%rax)
jmp    113d <wcssep+0x2d>
xor    %ecx,%ecx
mov    %rcx,(%r14)
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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