#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 */
int /*<<< orphan*/ vassert(int /*<<< orphan*/, char *);
char *strpbrk(const char *str1, const char *str2) {
  char *s2;
  vassert(str1 != NULL, "str1 == NULL");
  vassert(str2 != NULL, "str2 == NULL");
  while (*str1) {
    s2 = (char *)str2;
    while (*s2) {
      if (*s2 == *str1)
        return (char *)str1;
      s2++;
    }
    str1++;
  }
  return NULL;
}


x86 assembly (clang, -O0):
<strpbrk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
lea    0xecc(%rip),%rsi
call   1030 <vassert@plt>
cmpq   $0x0,-0x18(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
lea    0xec0(%rip),%rsi
call   1030 <vassert@plt>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11b9 <strpbrk+0xa9>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmpb   $0x0,(%rax)
je     11a8 <strpbrk+0x98>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    1197 <strpbrk+0x87>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    11c1 <strpbrk+0xb1>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1167 <strpbrk+0x57>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1152 <strpbrk+0x42>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strpbrk>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
lea    0xed6(%rip),%rsi
call   1030 <vassert@plt>
xor    %edi,%edi
test   %r14,%r14
setne  %dil
lea    0xece(%rip),%rsi
call   1030 <vassert@plt>
mov    (%rbx),%al
test   %al,%al
je     1191 <strpbrk+0x81>
mov    (%r14),%sil
add    $0x1,%r14
jmp    116b <strpbrk+0x5b>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x1(%rbx),%al
add    $0x1,%rbx
test   %al,%al
je     1191 <strpbrk+0x81>
mov    %r14,%rdx
mov    %esi,%ecx
test   %sil,%sil
je     1160 <strpbrk+0x50>
cs nopw 0x0(%rax,%rax,1)
nop
cmp    %al,%cl
je     1193 <strpbrk+0x83>
movzbl (%rdx),%ecx
add    $0x1,%rdx
test   %cl,%cl
jne    1180 <strpbrk+0x70>
jmp    1160 <strpbrk+0x50>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [13 x i8] c"str1 == NULL\00"
@.str.1 = [13 x i8] c"str2 == NULL\00"
define i8* @strpbrk(i8* %0, i8* %1) {
%3 = icmp ne i8* %0, null
%4 = zext i1 %3 to i32
%5 = tail call i32 @vassert(i32 %4, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%6 = icmp ne i8* %1, null
%7 = zext i1 %6 to i32
%8 = tail call i32 @vassert(i32 %7, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%9 = load i8, i8* %0
%10 = icmp eq i8 %9, 0
br i1 %10, label %29, label %11
11: ; preds = %2
%12 = load i8, i8* %1
%13 = icmp eq i8 %12, 0
br label %14
14: ; preds = %11, %25
%15 = phi i8 [ %9, %11 ], [ %27, %25 ]
%16 = phi i8* [ %0, %11 ], [ %26, %25 ]
br i1 %13, label %25, label %20
17: ; preds = %20
%18 = load i8, i8* %24
%19 = icmp eq i8 %18, 0
br i1 %19, label %25, label %20
20: ; preds = %14, %17
%21 = phi i8 [ %18, %17 ], [ %12, %14 ]
%22 = phi i8* [ %24, %17 ], [ %1, %14 ]
%23 = icmp eq i8 %21, %15
%24 = getelementptr inbounds i8, i8* %22, i64 1
br i1 %23, label %29, label %17
25: ; preds = %17, %14
%26 = getelementptr inbounds i8, i8* %16, i64 1
%27 = load i8, i8* %26
%28 = icmp eq i8 %27, 0
br i1 %28, label %29, label %14
29: ; preds = %25, %20, %2
%30 = phi i8* [ null, %2 ], [ %16, %20 ], [ null, %25 ]
ret i8* %30
}