#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 *xstrcpbrk(char *s1, char *s2) {
  char *sc1;
  char *sc2;
  for (sc1 = s1; *sc1 != '\0'; sc1++)
    for (sc2 = s2;; sc2++)
      if (*sc2 == '\0')
        return sc1;
      else if (*sc1 == *sc2)
        break;
  return NULL;
}


x86 assembly (clang, -O0):
<xstrcpbrk>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1195 <xstrcpbrk+0x95>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1149 <xstrcpbrk+0x49>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    119d <xstrcpbrk+0x9d>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
mov    -0x28(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    1164 <xstrcpbrk+0x64>
jmp    117f <xstrcpbrk+0x7f>
jmp    1169 <xstrcpbrk+0x69>
jmp    116e <xstrcpbrk+0x6e>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    112c <xstrcpbrk+0x2c>
jmp    1184 <xstrcpbrk+0x84>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1114 <xstrcpbrk+0x14>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xstrcpbrk>:
mov    (%rdi),%r9b
test   %r9b,%r9b
je     114d <xstrcpbrk+0x4d>
mov    %rdi,%rax
mov    (%rsi),%r8b
add    $0x1,%rsi
mov    %rsi,%rdx
mov    %r8d,%ecx
test   %r8b,%r8b
je     114f <xstrcpbrk+0x4f>
nopl   (%rax)
cmp    %cl,%r9b
je     1140 <xstrcpbrk+0x40>
movzbl (%rdx),%ecx
add    $0x1,%rdx
test   %cl,%cl
jne    1120 <xstrcpbrk+0x20>
jmp    1150 <xstrcpbrk+0x50>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x1(%rdi),%r9b
add    $0x1,%rdi
test   %r9b,%r9b
jne    1112 <xstrcpbrk+0x12>
xor    %eax,%eax
ret
mov    %rdi,%rax
ret

LLVM IR (-O0):
define i8* @xstrcpbrk(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
store i8* %8, i8** %6
br label %9
9: ; preds = %38, %2
%10 = load i8*, i8** %6
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %41
14: ; preds = %9
%15 = load i8*, i8** %5
store i8* %15, i8** %7
br label %16
16: ; preds = %34, %14
%17 = load i8*, i8** %7
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %16
%22 = load i8*, i8** %6
store i8* %22, i8** %3
br label %42
23: ; preds = %16
%24 = load i8*, i8** %6
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = load i8*, i8** %7
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %26, %29
br i1 %30, label %31, label %32
31: ; preds = %23
br label %37
32: ; preds = %23
br label %33
33: ; preds = %32
br label %34
34: ; preds = %33
%35 = load i8*, i8** %7
%36 = getelementptr inbounds i8, i8* %35, i32 1
store i8* %36, i8** %7
br label %16
37: ; preds = %31
br label %38
38: ; preds = %37
%39 = load i8*, i8** %6
%40 = getelementptr inbounds i8, i8* %39, i32 1
store i8* %40, i8** %6
br label %9
41: ; preds = %9
store i8* null, i8** %3
br label %42
42: ; preds = %41, %21
%43 = load i8*, i8** %3
ret i8* %43
}

LLVM IR (-O2):
define i8* @xstrcpbrk(i8* %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %23, label %5
5: ; preds = %2
%6 = load i8, i8* %1
%7 = icmp eq i8 %6, 0
br label %8
8: ; preds = %5, %19
%9 = phi i8 [ %3, %5 ], [ %21, %19 ]
%10 = phi i8* [ %0, %5 ], [ %20, %19 ]
br i1 %7, label %23, label %14
11: ; preds = %14
%12 = load i8, i8* %18
%13 = icmp eq i8 %12, 0
br i1 %13, label %23, label %14
14: ; preds = %8, %11
%15 = phi i8 [ %12, %11 ], [ %6, %8 ]
%16 = phi i8* [ %18, %11 ], [ %1, %8 ]
%17 = icmp eq i8 %9, %15
%18 = getelementptr inbounds i8, i8* %16, i64 1
br i1 %17, label %19, label %11
19: ; preds = %14
%20 = getelementptr inbounds i8, i8* %10, i64 1
%21 = load i8, i8* %20
%22 = icmp eq i8 %21, 0
br i1 %22, label %23, label %8
23: ; preds = %19, %8, %11, %2
%24 = phi i8* [ null, %2 ], [ %10, %11 ], [ %0, %8 ], [ null, %19 ]
ret i8* %24
}