#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*/ printf(char *);
char const *strpbrk(char const *, char *);
int test_strpbrk(void) {
  const char *str = "hello, world!";
  printf("\tstrpbrk");
  if (strpbrk(str, "l") != &str[2])
    return 1;
  if (strpbrk(str, "w!") != &str[7])
    return 1;
  if (strpbrk(str, "!w") != &str[7])
    return 1;
  printf("\tpassed.\n");
  return 0;
}


x86 assembly (clang, -O0):
<test_strpbrk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
lea    0xecd(%rip),%rsi
call   1040 <strpbrk@plt>
mov    -0x10(%rbp),%rcx
add    $0x2,%rcx
cmp    %rcx,%rax
je     116c <test_strpbrk+0x4c>
movl   $0x1,-0x4(%rbp)
jmp    11d9 <test_strpbrk+0xb9>
mov    -0x10(%rbp),%rdi
lea    0xea2(%rip),%rsi
call   1040 <strpbrk@plt>
mov    -0x10(%rbp),%rcx
add    $0x7,%rcx
cmp    %rcx,%rax
je     1199 <test_strpbrk+0x79>
movl   $0x1,-0x4(%rbp)
jmp    11d9 <test_strpbrk+0xb9>
mov    -0x10(%rbp),%rdi
lea    0xe78(%rip),%rsi
call   1040 <strpbrk@plt>
mov    -0x10(%rbp),%rcx
add    $0x7,%rcx
cmp    %rcx,%rax
je     11c6 <test_strpbrk+0xa6>
movl   $0x1,-0x4(%rbp)
jmp    11d9 <test_strpbrk+0xb9>
lea    0xe52(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_strpbrk>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <printf@plt>
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"hello, world!\00"
@.str.1 = [9 x i8] c"\09strpbrk\00"
@.str.2 = [2 x i8] c"l\00"
@.str.3 = [3 x i8] c"w!\00"
@.str.4 = [3 x i8] c"!w\00"
@.str.5 = [10 x i8] c"\09passed.\0A\00"
define i32 @test_strpbrk() {
%1 = alloca i32
%2 = alloca i8*
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i8* @strpbrk(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%6 = load i8*, i8** %2
%7 = getelementptr inbounds i8, i8* %6, i64 2
%8 = icmp ne i8* %5, %7
br i1 %8, label %9, label %10
9: ; preds = %0
store i32 1, i32* %1
br label %26
10: ; preds = %0
%11 = load i8*, i8** %2
%12 = call i8* @strpbrk(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%13 = load i8*, i8** %2
%14 = getelementptr inbounds i8, i8* %13, i64 7
%15 = icmp ne i8* %12, %14
br i1 %15, label %16, label %17
16: ; preds = %10
store i32 1, i32* %1
br label %26
17: ; preds = %10
%18 = load i8*, i8** %2
%19 = call i8* @strpbrk(i8* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%20 = load i8*, i8** %2
%21 = getelementptr inbounds i8, i8* %20, i64 7
%22 = icmp ne i8* %19, %21
br i1 %22, label %23, label %24
23: ; preds = %17
store i32 1, i32* %1
br label %26
24: ; preds = %17
%25 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %1
br label %26
26: ; preds = %24, %23, %16, %9
%27 = load i32, i32* %1
ret i32 %27
}

LLVM IR (-O2):
@.str.1 = [9 x i8] c"\09strpbrk\00"
@str = [9 x i8] c"\09passed.\00"
define i32 @test_strpbrk() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
ret i32 0
}