#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 *strpbrk(char *, char *);
void strpbrkTest() {
  char str[] = "This is a sample string";
  char key[] = "aeiou";
  char *pch;
  printf("Vowels in '%s': ", str);
  pch = strpbrk(str, key);
  while (pch != NULL) {
    printf("%c ", *pch);
    pch = strpbrk(pch + 1, key);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<strpbrkTest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecb(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec9(%rip),%eax
mov    %eax,-0x26(%rbp)
mov    0xec3(%rip),%ax
mov    %ax,-0x22(%rbp)
lea    -0x20(%rbp),%rsi
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
lea    -0x26(%rbp),%rsi
call   1040 <strpbrk@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     11ba <strpbrkTest+0x9a>
mov    -0x30(%rbp),%rax
movsbl (%rax),%esi
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%rdi
add    $0x1,%rdi
lea    -0x26(%rbp),%rsi
call   1040 <strpbrk@plt>
mov    %rax,-0x30(%rbp)
jmp    1180 <strpbrkTest+0x60>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strpbrkTest>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
movaps 0xec0(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x676e6972747320,%rax
mov    %rax,0x10(%rsp)
lea    0xec4(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeaa(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strpbrk@plt>
test   %rax,%rax
je     11b4 <strpbrkTest+0x84>
mov    %rax,%rbx
lea    0xeaa(%rip),%r14
lea    0xe8c(%rip),%r15
nopl   0x0(%rax)
movsbl (%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <strpbrk@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1190 <strpbrkTest+0x60>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.strpbrkTest.str = [24 x i8] c"This is a sample string\00"
@__const.strpbrkTest.key = [6 x i8] c"aeiou\00"
@.str = [17 x i8] c"Vowels in '%s': \00"
@.str.1 = [4 x i8] c"%c \00"
@.str.2 = [2 x i8] c"\0A\00"
define void @strpbrkTest() {
%1 = alloca [24 x i8]
%2 = alloca [6 x i8]
%3 = alloca i8*
%4 = bitcast [24 x i8]* %1 to i8*
%5 = bitcast [6 x i8]* %2 to i8*
%6 = getelementptr inbounds [24 x i8], [24 x i8]* %1, i64 0, i64 0
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [24 x i8], [24 x i8]* %1, i64 0, i64 0
%9 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%10 = call i8* @strpbrk(i8* %8, i8* %9)
store i8* %10, i8** %3
br label %11
11: ; preds = %14, %0
%12 = load i8*, i8** %3
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %23
14: ; preds = %11
%15 = load i8*, i8** %3
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%19 = load i8*, i8** %3
%20 = getelementptr inbounds i8, i8* %19, i64 1
%21 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%22 = call i8* @strpbrk(i8* %20, i8* %21)
store i8* %22, i8** %3
br label %11
23: ; preds = %11
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__const.strpbrkTest.str = [24 x i8] c"This is a sample string\00"
@__const.strpbrkTest.key = [6 x i8] c"aeiou\00"
@.str = [17 x i8] c"Vowels in '%s': \00"
@.str.1 = [4 x i8] c"%c \00"
define void @strpbrkTest() {
%1 = alloca [24 x i8]
%2 = getelementptr inbounds [24 x i8], [24 x i8]* %1, i64 0, i64 0
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i8* @strpbrk(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @__const.strpbrkTest.key, i64 0, i64 0))
%5 = icmp eq i8* %4, null
br i1 %5, label %14, label %6
6: ; preds = %0, %6
%7 = phi i8* [ %12, %6 ], [ %4, %0 ]
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = call i8* @strpbrk(i8* %11, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @__const.strpbrkTest.key, i64 0, i64 0))
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %6
14: ; preds = %6, %0
%15 = call i32 @putchar(i32 10)
ret void
}