#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 *, ...);
int string_find(char *, char);
int main() {
  char c = 'g';
  char str1[] = "Testing";
  char str2[] = "gvcqable";
  char str3[] = "riodsgholskdf";
  char str4[] = "Azxczxczxc";
  printf("Position of '%c' in (-1 means not found):\n", c);
  printf("<%s> = %d\n", str1, string_find(str1, c));
  printf("<%s> = %d\n", str2, string_find(str2, c));
  printf("<%s> = %d\n", str3, string_find(str3, c));
  printf("<%s> = %d\n", str4, string_find(str4, c));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x67,-0x5(%rbp)
mov    0xec6(%rip),%rax
mov    %rax,-0xd(%rbp)
mov    0xec3(%rip),%rax
mov    %rax,-0x16(%rbp)
mov    0xec1(%rip),%al
mov    %al,-0xe(%rbp)
mov    0xeb8(%rip),%rax
mov    %rax,-0x24(%rbp)
mov    0xeb6(%rip),%eax
mov    %eax,-0x1c(%rbp)
mov    0xeb0(%rip),%ax
mov    %ax,-0x18(%rbp)
mov    0xea7(%rip),%rax
mov    %rax,-0x2f(%rbp)
mov    0xea4(%rip),%ax
mov    %ax,-0x27(%rbp)
mov    0xe9c(%rip),%al
mov    %al,-0x25(%rbp)
movsbl -0x5(%rbp),%esi
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xd(%rbp),%rax
mov    %rax,-0x50(%rbp)
lea    -0xd(%rbp),%rdi
movsbl -0x5(%rbp),%esi
call   1040 <string_find@plt>
mov    -0x50(%rbp),%rsi
mov    %eax,%edx
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x16(%rbp),%rax
mov    %rax,-0x48(%rbp)
lea    -0x16(%rbp),%rdi
movsbl -0x5(%rbp),%esi
call   1040 <string_find@plt>
mov    -0x48(%rbp),%rsi
mov    %eax,%edx
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x24(%rbp),%rax
mov    %rax,-0x40(%rbp)
lea    -0x24(%rbp),%rdi
movsbl -0x5(%rbp),%esi
call   1040 <string_find@plt>
mov    -0x40(%rbp),%rsi
mov    %eax,%edx
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x2f(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0x2f(%rbp),%rdi
movsbl -0x5(%rbp),%esi
call   1040 <string_find@plt>
mov    -0x38(%rbp),%rsi
mov    %eax,%edx
lea    0xe16(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
movabs $0x676e6974736554,%rax
mov    %rax,0x20(%rsp)
movabs $0x656c626171637667,%rax
62 6c 65
mov    %rax,(%rsp)
movb   $0x0,0x8(%rsp)
movabs $0x66646b736c6f68,%rax
mov    %rax,0x2e(%rsp)
movabs $0x6f686773646f6972,%rax
67 68 6f
mov    %rax,0x28(%rsp)
movabs $0x7a63787a63787a41,%rax
78 63 7a
mov    %rax,0x10(%rsp)
movl   $0x63787a,0x17(%rsp)
lea    0xe9d(%rip),%rdi
mov    $0x67,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x67,%esi
call   1040 <string_find@plt>
lea    0xea3(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x67,%esi
call   1040 <string_find@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x28(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x67,%esi
call   1040 <string_find@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x67,%esi
call   1040 <string_find@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.str1 = [8 x i8] c"Testing\00"
@__const.main.str2 = [9 x i8] c"gvcqable\00"
@__const.main.str3 = [14 x i8] c"riodsgholskdf\00"
@__const.main.str4 = [11 x i8] c"Azxczxczxc\00"
@.str = [43 x i8] c"Position of '%c' in (-1 means not found):\0A\00"
@.str.1 = [11 x i8] c"<%s> = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca [8 x i8]
%4 = alloca [9 x i8]
%5 = alloca [14 x i8]
%6 = alloca [11 x i8]
store i32 0, i32* %1
store i8 103, i8* %2
%7 = bitcast [8 x i8]* %3 to i8*
%8 = bitcast [9 x i8]* %4 to i8*
%9 = bitcast [14 x i8]* %5 to i8*
%10 = bitcast [11 x i8]* %6 to i8*
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%15 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%16 = load i8, i8* %2
%17 = call i32 @string_find(i8* %15, i8 signext %16)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %14, i32 %17)
%19 = getelementptr inbounds [9 x i8], [9 x i8]* %4, i64 0, i64 0
%20 = getelementptr inbounds [9 x i8], [9 x i8]* %4, i64 0, i64 0
%21 = load i8, i8* %2
%22 = call i32 @string_find(i8* %20, i8 signext %21)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %19, i32 %22)
%24 = getelementptr inbounds [14 x i8], [14 x i8]* %5, i64 0, i64 0
%25 = getelementptr inbounds [14 x i8], [14 x i8]* %5, i64 0, i64 0
%26 = load i8, i8* %2
%27 = call i32 @string_find(i8* %25, i8 signext %26)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %24, i32 %27)
%29 = getelementptr inbounds [11 x i8], [11 x i8]* %6, i64 0, i64 0
%30 = getelementptr inbounds [11 x i8], [11 x i8]* %6, i64 0, i64 0
%31 = load i8, i8* %2
%32 = call i32 @string_find(i8* %30, i8 signext %31)
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %29, i32 %32)
ret i32 0
}

LLVM IR (-O2):
@__const.main.str2 = [9 x i8] c"gvcqable\00"
@__const.main.str3 = [14 x i8] c"riodsgholskdf\00"
@__const.main.str4 = [11 x i8] c"Azxczxczxc\00"
@.str = [43 x i8] c"Position of '%c' in (-1 means not found):\0A\00"
@.str.1 = [11 x i8] c"<%s> = %d\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca [9 x i8]
%3 = alloca [14 x i8]
%4 = alloca [11 x i8]
%5 = bitcast i64* %1 to i8*
store i64 29113321805538644, i64* %1
%6 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [14 x i8], [14 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 0
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i32 103)
%10 = call i32 @string_find(i8* %5, i8 signext 103)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i64* %1, i32 %10)
%12 = call i32 @string_find(i8* %6, i8 signext 103)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %6, i32 %12)
%14 = call i32 @string_find(i8* %7, i8 signext 103)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %7, i32 %14)
%16 = call i32 @string_find(i8* %8, i8 signext 103)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %8, i32 %16)
ret i32 0
}