#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*/ EXIT_SUCCESS;
int any(char *, char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
int main(void) {
  char string1[] = "This string contains a bunch of 's' characters";
  int pos;
  int i;
  pos = any(string1, "aeiou");
  printf("Locating the first lowercase vowel in the string:\n\n\"This string "
         "contains a bunch of 's' characters\"\n");
  if (pos != -1) {
    (void)putchar(' ');
    for (i = 0; i < pos; i++)
      (void)putchar(' ');
    (void)putchar('^');
    printf("\n\nFound at position: %d (where '0' is the first character)\n\n",
           pos);
  } else
    printf("\n\nNot found!\n\n");
  pos = any(string1, "x");
  printf("Locating the character 'x' in the string:\n\n\"This string contains "
         "a bunch of 's' characters\"\n");
  if (pos != -1) {
    (void)putchar(' ');
    for (i = 0; i < pos; i++)
      (void)putchar(' ');
    (void)putchar('^');
    printf("\n\nFound at position: %d (where '0' is the first character)\n\n",
           pos);
  } else
    printf("\n\nNot found!\n\n");
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xe96(%rip),%rsi
mov    $0x2f,%edx
call   1050 <memcpy@plt>
lea    -0x40(%rbp),%rdi
lea    0xeb0(%rip),%rsi
call   1060 <any@plt>
mov    %eax,-0x44(%rbp)
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0xffffffff,-0x44(%rbp)
je     11f4 <main+0xa4>
mov    $0x20,%edi
call   1030 <putchar@plt>
movl   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    11d4 <main+0x84>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    11b0 <main+0x60>
mov    $0x5e,%edi
call   1030 <putchar@plt>
mov    -0x44(%rbp),%esi
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1202 <main+0xb2>
lea    0xedc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x40(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1060 <any@plt>
mov    %eax,-0x44(%rbp)
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0xffffffff,-0x44(%rbp)
je     1282 <main+0x132>
mov    $0x20,%edi
call   1030 <putchar@plt>
movl   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    1262 <main+0x112>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    123e <main+0xee>
mov    $0x5e,%edi
call   1030 <putchar@plt>
mov    -0x44(%rbp),%esi
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1290 <main+0x140>
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2d49(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x38,%rsp
movups 0xec2(%rip),%xmm0
movups %xmm0,0x1f(%rsp)
movaps 0xea7(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe8b(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xeaf(%rip),%rsi
mov    %rsp,%rdi
call   1060 <any@plt>
mov    %eax,%ebx
lea    0xee3(%rip),%rdi
call   1040 <puts@plt>
cmp    $0xffffffff,%ebx
jne    11a9 <main+0x59>
lea    0xf92(%rip),%rdi
call   1040 <puts@plt>
jmp    11e9 <main+0x99>
mov    $0x20,%edi
call   1030 <putchar@plt>
test   %ebx,%ebx
jle    11cf <main+0x7f>
mov    %ebx,%ebp
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11c0 <main+0x70>
mov    $0x5e,%edi
call   1030 <putchar@plt>
lea    0xe55(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe82(%rip),%rsi
mov    %rsp,%rdi
call   1060 <any@plt>
mov    %eax,%ebx
lea    0xed7(%rip),%rdi
call   1040 <puts@plt>
cmp    $0xffffffff,%ebx
jne    1219 <main+0xc9>
lea    0xf22(%rip),%rdi
call   1040 <puts@plt>
jmp    1259 <main+0x109>
mov    $0x20,%edi
call   1030 <putchar@plt>
test   %ebx,%ebx
jle    123f <main+0xef>
mov    %ebx,%ebp
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1230 <main+0xe0>
mov    $0x5e,%edi
call   1030 <putchar@plt>
lea    0xde5(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2d80(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@__const.main.string1 = [47 x i8] c"This string contains a bunch of 's' characters\00"
@.str = [6 x i8] c"aeiou\00"
@.str.1 = [101 x i8] c"Locating the first lowercase vowel in the string:\0A\0A\22This string contains a bunch of 's' characters\22\0A\00"
@.str.2 = [61 x i8] c"\0A\0AFound at position: %d (where '0' is the first character)\0A\0A\00"
@.str.3 = [15 x i8] c"\0A\0ANot found!\0A\0A\00"
@.str.4 = [2 x i8] c"x\00"
@.str.5 = [93 x i8] c"Locating the character 'x' in the string:\0A\0A\22This string contains a bunch of 's' characters\22\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [47 x i8]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [47 x i8]* %2 to i8*
%6 = getelementptr inbounds [47 x i8], [47 x i8]* %2, i64 0, i64 0
%7 = call i32 @any(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32 %7, i32* %3
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([101 x i8], [101 x i8]* @.str.1, i64 0, i64 0))
%9 = load i32, i32* %3
%10 = icmp ne i32 %9, -1
br i1 %10, label %11, label %26
11: ; preds = %0
%12 = call i32 @putchar(i8 signext 32)
store i32 0, i32* %4
br label %13
13: ; preds = %19, %11
%14 = load i32, i32* %4
%15 = load i32, i32* %3
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %22
17: ; preds = %13
%18 = call i32 @putchar(i8 signext 32)
br label %19
19: ; preds = %17
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %4
br label %13
22: ; preds = %13
%23 = call i32 @putchar(i8 signext 94)
%24 = load i32, i32* %3
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.2, i64 0, i64 0), i32 %24)
br label %28
26: ; preds = %0
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %28
28: ; preds = %26, %22
%29 = getelementptr inbounds [47 x i8], [47 x i8]* %2, i64 0, i64 0
%30 = call i32 @any(i8* %29, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32 %30, i32* %3
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([93 x i8], [93 x i8]* @.str.5, i64 0, i64 0))
%32 = load i32, i32* %3
%33 = icmp ne i32 %32, -1
br i1 %33, label %34, label %49
34: ; preds = %28
%35 = call i32 @putchar(i8 signext 32)
store i32 0, i32* %4
br label %36
36: ; preds = %42, %34
%37 = load i32, i32* %4
%38 = load i32, i32* %3
%39 = icmp slt i32 %37, %38
br i1 %39, label %40, label %45
40: ; preds = %36
%41 = call i32 @putchar(i8 signext 32)
br label %42
42: ; preds = %40
%43 = load i32, i32* %4
%44 = add nsw i32 %43, 1
store i32 %44, i32* %4
br label %36
45: ; preds = %36
%46 = call i32 @putchar(i8 signext 94)
%47 = load i32, i32* %3
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.2, i64 0, i64 0), i32 %47)
br label %51
49: ; preds = %28
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %51
51: ; preds = %49, %45
%52 = load i32, i32* @EXIT_SUCCESS
%53 = call i32 @exit(i32 %52)
unreachable
}

LLVM IR (-O2):
@__const.main.string1 = [47 x i8] c"This string contains a bunch of 's' characters\00"
@.str = [6 x i8] c"aeiou\00"
@.str.2 = [61 x i8] c"\0A\0AFound at position: %d (where '0' is the first character)\0A\0A\00"
@.str.4 = [2 x i8] c"x\00"
@EXIT_SUCCESS = global i32 0
@str = [100 x i8] c"Locating the first lowercase vowel in the string:\0A\0A\22This string contains a bunch of 's' characters\22\00"
@str.7 = [92 x i8] c"Locating the character 'x' in the string:\0A\0A\22This string contains a bunch of 's' characters\22\00"
@str.8 = [14 x i8] c"\0A\0ANot found!\0A\00"
define i32 @main() {
%1 = alloca [47 x i8]
%2 = getelementptr inbounds [47 x i8], [47 x i8]* %1, i64 0, i64 0
%3 = call i32 @any(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([100 x i8], [100 x i8]* @str, i64 0, i64 0))
%5 = icmp eq i32 %3, -1
br i1 %5, label %17, label %6
6: ; preds = %0
%7 = call i32 @putchar(i8 signext 32)
%8 = icmp sgt i32 %3, 0
br i1 %8, label %9, label %14
9: ; preds = %6, %9
%10 = phi i32 [ %12, %9 ], [ 0, %6 ]
%11 = call i32 @putchar(i8 signext 32)
%12 = add nuw nsw i32 %10, 1
%13 = icmp eq i32 %12, %3
br i1 %13, label %14, label %9
14: ; preds = %9, %6
%15 = call i32 @putchar(i8 signext 94)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.2, i64 0, i64 0), i32 %3)
br label %19
17: ; preds = %0
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.8, i64 0, i64 0))
br label %19
19: ; preds = %17, %14
%20 = call i32 @any(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([92 x i8], [92 x i8]* @str.7, i64 0, i64 0))
%22 = icmp eq i32 %20, -1
br i1 %22, label %34, label %23
23: ; preds = %19
%24 = call i32 @putchar(i8 signext 32)
%25 = icmp sgt i32 %20, 0
br i1 %25, label %26, label %31
26: ; preds = %23, %26
%27 = phi i32 [ %29, %26 ], [ 0, %23 ]
%28 = call i32 @putchar(i8 signext 32)
%29 = add nuw nsw i32 %27, 1
%30 = icmp eq i32 %29, %20
br i1 %30, label %31, label %26
31: ; preds = %26, %23
%32 = call i32 @putchar(i8 signext 94)
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.2, i64 0, i64 0), i32 %20)
br label %36
34: ; preds = %19
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.8, i64 0, i64 0))
br label %36
36: ; preds = %34, %31
%37 = load i32, i32* @EXIT_SUCCESS
%38 = call i32 @exit(i32 %37)
unreachable
}