#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 *, char const *, int, char *,
                          char const *);
int *strpbrk(char const *, char const *);
int main(void) {
  const char *string1 = "This is a test";
  const char *string2 = "beware";
  printf("%s\"%s\"\n'%c'%s\n\"%s\"\n", "Of the characters in ", string2,
         *strpbrk(string1, string2), " appears earliest in ", string1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strpbrk@plt>
mov    -0x20(%rbp),%rdx
mov    (%rax),%ecx
mov    -0x10(%rbp),%r9
lea    0xeab(%rip),%rdi
lea    0xeb8(%rip),%rsi
lea    0xec7(%rip),%r8
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%r14
lea    0xedd(%rip),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <strpbrk@plt>
mov    (%rax),%ecx
lea    0xed0(%rip),%rdi
lea    0xedd(%rip),%rsi
lea    0xeec(%rip),%r8
mov    %rbx,%rdx
mov    %r14,%r9
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [15 x i8] c"This is a test\00"
@.str.1 = [7 x i8] c"beware\00"
@.str.2 = [20 x i8] c"%s\22%s\22\0A'%c'%s\0A\22%s\22\0A\00"
@.str.3 = [22 x i8] c"Of the characters in \00"
@.str.4 = [22 x i8] c" appears earliest in \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8** %3
%4 = load i8*, i8** %3
%5 = load i8*, i8** %2
%6 = load i8*, i8** %3
%7 = call i32* @strpbrk(i8* %5, i8* %6)
%8 = load i32, i32* %7
%9 = load i8*, i8** %2
%10 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* %4, i32 %8, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"This is a test\00"
@.str.1 = [7 x i8] c"beware\00"
@.str.2 = [20 x i8] c"%s\22%s\22\0A'%c'%s\0A\22%s\22\0A\00"
@.str.3 = [22 x i8] c"Of the characters in \00"
@.str.4 = [22 x i8] c" appears earliest in \00"
define i32 @main() {
%1 = tail call i32* @strpbrk(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%2 = load i32, i32* %1
%3 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %2, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret i32 0
}