#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 */
char *strsep(char **, char *);
int main(void) {
  char buf[6] = "aybxc";
  char *workp = buf;
  char *retp = strsep(&workp, "xy");
  return !(retp == buf && buf[1] == '\0' && workp == buf + 2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xedb(%rip),%eax
mov    %eax,-0xa(%rbp)
mov    0xed5(%rip),%ax
mov    %ax,-0x6(%rbp)
lea    -0xa(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0x18(%rbp),%rdi
lea    0xec0(%rip),%rsi
call   1030 <strsep@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rcx
lea    -0xa(%rbp),%rdx
xor    %eax,%eax
cmp    %rdx,%rcx
mov    %al,-0x21(%rbp)
jne    118c <main+0x7c>
movsbl -0x9(%rbp),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x21(%rbp)
jne    118c <main+0x7c>
mov    -0x18(%rbp),%rax
lea    -0xa(%rbp),%rcx
add    $0x2,%rcx
cmp    %rcx,%rax
sete   %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movw   $0x63,0x4(%rsp)
movl   $0x78627961,(%rsp)
mov    %rsp,%rbx
mov    %rbx,0x8(%rsp)
lea    0xed4(%rip),%rsi
lea    0x8(%rsp),%rdi
call   1030 <strsep@plt>
cmp    %rbx,%rax
setne  %al
cmpb   $0x0,0x1(%rsp)
setne  %cl
or     %al,%cl
lea    0x2(%rsp),%rax
cmp    %rax,0x8(%rsp)
setne  %al
or     %cl,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.buf = [6 x i8] c"aybxc\00"
@.str = [3 x i8] c"xy\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x i8]
%3 = alloca i8*
%4 = alloca i8*
store i32 0, i32* %1
%5 = bitcast [6 x i8]* %2 to i8*
%6 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
store i8* %6, i8** %3
%7 = call i8* @strsep(i8** %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i8* %7, i8** %4
%8 = load i8*, i8** %4
%9 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%10 = icmp eq i8* %8, %9
br i1 %10, label %11, label %21
11: ; preds = %0
%12 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 1
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %21
16: ; preds = %11
%17 = load i8*, i8** %3
%18 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%19 = getelementptr inbounds i8, i8* %18, i64 2
%20 = icmp eq i8* %17, %19
br label %21
21: ; preds = %16, %11, %0
%22 = phi i1 [ false, %11 ], [ false, %0 ], [ %20, %16 ]
%23 = xor i1 %22, true
%24 = zext i1 %23 to i32
ret i32 %24
}

LLVM IR (-O2):
@__const.main.buf = [6 x i8] c"aybxc\00"
@.str = [3 x i8] c"xy\00"
define i32 @main() {
%1 = alloca [6 x i8]
%2 = alloca i8*
%3 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%4 = bitcast i8** %2 to i8*
store i8* %3, i8** %2
%5 = call i8* @strsep(i8** %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%6 = icmp ne i8* %5, %3
%7 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 1
%8 = load i8, i8* %7
%9 = icmp ne i8 %8, 0
%10 = select i1 %6, i1 true, i1 %9
%11 = load i8*, i8** %2
%12 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 2
%13 = icmp ne i8* %11, %12
%14 = select i1 %10, i1 true, i1 %13
%15 = zext i1 %14 to i32
ret i32 %15
}