#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 /*<<< orphan*/ *strchr(char const *, char);
int main(void) {
  const char *string = "This is a test";
  char character1 = 'a';
  char character2 = 'z';
  if (strchr(string, character1) != NULL) {
    printf("\'%c\' was found in \"%s\".\n", character1, string);
  } else {
    printf("\'%c\' was not found in \"%s\".\n", character1, string);
  }
  if (strchr(string, character2) != NULL) {
    printf("\'%c\' was found in \"%s\".\n", character2, string);
  } else {
    printf("\'%c\' was not found in \"%s\".\n", character2, string);
  }
  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)
movb   $0x61,-0x11(%rbp)
movb   $0x7a,-0x12(%rbp)
mov    -0x10(%rbp),%rdi
movsbl -0x11(%rbp),%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
je     1174 <main+0x54>
mov    -0x11(%rbp),%al
mov    -0x10(%rbp),%rdx
lea    0xea8(%rip),%rdi
movsbl %al,%esi
call   1040 <printf@plt>
jmp    118a <main+0x6a>
mov    -0x11(%rbp),%al
mov    -0x10(%rbp),%rdx
lea    0xea6(%rip),%rdi
movsbl %al,%esi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
movsbl -0x12(%rbp),%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
je     11bc <main+0x9c>
mov    -0x12(%rbp),%al
mov    -0x10(%rbp),%rdx
lea    0xe60(%rip),%rdi
movsbl %al,%esi
call   1040 <printf@plt>
jmp    11d2 <main+0xb2>
mov    -0x12(%rbp),%al
mov    -0x10(%rbp),%rdx
lea    0xe5e(%rip),%rdi
movsbl %al,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
lea    0xed4(%rip),%r14
mov    %r14,%rdi
mov    $0x61,%esi
call   1030 <strchr@plt>
test   %rax,%rax
lea    0xee5(%rip),%r15
lea    0xec5(%rip),%rbx
mov    %rbx,%rdi
cmove  %r15,%rdi
mov    $0x61,%esi
mov    %r14,%rdx
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0x7a,%esi
call   1030 <strchr@plt>
test   %rax,%rax
cmove  %r15,%rbx
mov    %rbx,%rdi
mov    $0x7a,%esi
mov    %r14,%rdx
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [15 x i8] c"This is a test\00"
@.str.1 = [25 x i8] c"'%c' was found in \22%s\22.\0A\00"
@.str.2 = [29 x i8] c"'%c' was not found in \22%s\22.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8
%4 = 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 97, i8* %3
store i8 122, i8* %4
%5 = load i8*, i8** %2
%6 = load i8, i8* %3
%7 = call i32* @strchr(i8* %5, i8 signext %6)
%8 = icmp ne i32* %7, null
br i1 %8, label %9, label %13
9: ; preds = %0
%10 = load i8, i8* %3
%11 = load i8*, i8** %2
%12 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8 signext %10, i8* %11)
br label %17
13: ; preds = %0
%14 = load i8, i8* %3
%15 = load i8*, i8** %2
%16 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8 signext %14, i8* %15)
br label %17
17: ; preds = %13, %9
%18 = load i8*, i8** %2
%19 = load i8, i8* %4
%20 = call i32* @strchr(i8* %18, i8 signext %19)
%21 = icmp ne i32* %20, null
br i1 %21, label %22, label %26
22: ; preds = %17
%23 = load i8, i8* %4
%24 = load i8*, i8** %2
%25 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8 signext %23, i8* %24)
br label %30
26: ; preds = %17
%27 = load i8, i8* %4
%28 = load i8*, i8** %2
%29 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8 signext %27, i8* %28)
br label %30
30: ; preds = %26, %22
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"This is a test\00"
@.str.1 = [25 x i8] c"'%c' was found in \22%s\22.\0A\00"
@.str.2 = [29 x i8] c"'%c' was not found in \22%s\22.\0A\00"
define i32 @main() {
%1 = tail call i32* @strchr(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8 signext 97)
%2 = icmp eq i32* %1, null
%3 = select i1 %2, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0)
%4 = tail call i32 @printf(i8* %3, i8 signext 97, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32* @strchr(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8 signext 122)
%6 = icmp eq i32* %5, null
%7 = select i1 %6, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0)
%8 = tail call i32 @printf(i8* %7, i8 signext 122, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret i32 0
}